@vectorize-io/hindsight-control-plane 0.5.3 → 0.5.4

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.
Files changed (53) hide show
  1. package/package.json +1 -1
  2. package/standalone/.next/BUILD_ID +1 -1
  3. package/standalone/.next/build-manifest.json +3 -3
  4. package/standalone/.next/prerender-manifest.json +3 -3
  5. package/standalone/.next/server/app/_global-error.html +1 -1
  6. package/standalone/.next/server/app/_global-error.rsc +1 -1
  7. package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  10. package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  11. package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/standalone/.next/server/app/_not-found.html +1 -1
  14. package/standalone/.next/server/app/_not-found.rsc +2 -2
  15. package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  16. package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  17. package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  18. package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  19. package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  20. package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/standalone/.next/server/app/banks/[bankId]/page_client-reference-manifest.js +1 -1
  22. package/standalone/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  23. package/standalone/.next/server/app/dashboard.html +1 -1
  24. package/standalone/.next/server/app/dashboard.rsc +3 -3
  25. package/standalone/.next/server/app/dashboard.segments/_full.segment.rsc +3 -3
  26. package/standalone/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  27. package/standalone/.next/server/app/dashboard.segments/_index.segment.rsc +2 -2
  28. package/standalone/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  29. package/standalone/.next/server/app/dashboard.segments/dashboard/__PAGE__.segment.rsc +2 -2
  30. package/standalone/.next/server/app/dashboard.segments/dashboard.segment.rsc +1 -1
  31. package/standalone/.next/server/app/index.html +1 -1
  32. package/standalone/.next/server/app/index.rsc +2 -2
  33. package/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  34. package/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
  35. package/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  36. package/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  37. package/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  38. package/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  39. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__09_g7l8._.js +3 -3
  40. package/standalone/.next/server/chunks/ssr/hindsight-control-plane_06incyr._.js +1 -1
  41. package/standalone/.next/server/middleware-build-manifest.js +3 -3
  42. package/standalone/.next/server/pages/404.html +1 -1
  43. package/standalone/.next/server/pages/500.html +1 -1
  44. package/standalone/.next/server/server-reference-manifest.js +1 -1
  45. package/standalone/.next/server/server-reference-manifest.json +1 -1
  46. package/standalone/.next/static/chunks/{0el.lvk380c-3.js → 0.l3gmz37keyi.js} +1 -1
  47. package/standalone/.next/static/chunks/11-z6itkm-6zt.css +2 -0
  48. package/standalone/.next/static/chunks/{15kz4nyl_kh_s.js → 17md1r75onm4j.js} +2 -2
  49. package/standalone/package.json +1 -1
  50. package/standalone/.next/static/chunks/079k.275mmkog.css +0 -2
  51. /package/standalone/.next/static/{YO5OUekYxYd7Dxt97tUEV → IwtQPmflMvzV-TiNhLYeg}/_buildManifest.js +0 -0
  52. /package/standalone/.next/static/{YO5OUekYxYd7Dxt97tUEV → IwtQPmflMvzV-TiNhLYeg}/_clientMiddlewareManifest.js +0 -0
  53. /package/standalone/.next/static/{YO5OUekYxYd7Dxt97tUEV → IwtQPmflMvzV-TiNhLYeg}/_ssgManifest.js +0 -0
@@ -4,5 +4,5 @@ You can add a description to the \`${f$}\` by passing a \`${f1}\` component as a
4
4
 
5
5
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${f$}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
6
 
7
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return em.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null};let f8=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(fX,{className:(0,eO.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));f8.displayName=fX.displayName;let f7=em.forwardRef(({className:e,...t},n)=>(0,ep.jsxs)(fG,{children:[(0,ep.jsx)(f8,{}),(0,ep.jsx)(fQ,{ref:n,className:(0,eO.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));f7.displayName=fQ.displayName;let f9=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eO.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...t});f9.displayName="AlertDialogHeader";let pe=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eO.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});pe.displayName="AlertDialogFooter";let pt=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f0,{ref:n,className:(0,eO.cn)("text-lg font-semibold",e),...t}));pt.displayName=f0.displayName;let pn=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f2,{ref:n,className:(0,eO.cn)("text-sm text-muted-foreground",e),...t}));pn.displayName=f2.displayName;let pr=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f5,{ref:n,className:(0,eO.cn)((0,eL.buttonVariants)(),e),...t}));pr.displayName=f5.displayName;let pi=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f4,{ref:n,className:(0,eO.cn)((0,eL.buttonVariants)({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));pi.displayName=f4.displayName;let pa=(0,eN.default)("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"}]]),po=(0,eN.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);function ps(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function pl({metadata:e}){let t=Object.entries(e);return 0===t.length?(0,ep.jsx)("span",{children:"-"}):(0,ep.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map(([e,t])=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",children:[e,"=",String(t)]},e)),t.length>3&&(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",t.length-3]})]})}function pc(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(""),[s,l]=(0,em.useState)(0),[c,u]=(0,em.useState)(1),d=Math.ceil(s/50),h=(c-1)*50,[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(""),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(null),[S,T]=(0,em.useState)(null),A=async(t=1)=>{if(e){i(!0);try{let r=await eD.client.listDocuments({bank_id:e,q:a,limit:50,offset:(t-1)*50});n(r.items||[]),l(r.total||0)}catch(e){}finally{i(!1)}}},O=e=>{u(e),A(e)},M=async t=>{if(e){v(!0),p({id:t}),w(!1),N("");try{let n=await eD.client.getDocument(t,e);p(n)}catch(e){p(null)}finally{v(!1)}}},P=async()=>{if(!e||!C)return;let t=C.id;y(t),_(null);try{let n=await eD.client.deleteDocument(t,e);T({success:!0,message:`Deleted document and ${n.memory_units_deleted} memory units.`}),f?.id===t&&p(null),A(c)}catch(e){console.error("Error deleting document:",e),T({success:!1,message:"Error deleting document: "+e.message})}finally{y(null)}},D=()=>{w(!1),N("")},L=async()=>{if(!e||!f)return;let t=j.split(",").map(e=>e.trim()).filter(e=>e.length>0);E(!0);try{await eD.client.updateDocument(f.id,e,t),p({...f,tags:t}),n(e=>e.map(e=>e.id===f.id?{...e,tags:t}:e)),w(!1),N("")}catch(e){console.error("Error updating document tags:",e)}finally{E(!1)}};return(0,em.useEffect)(()=>{e&&(u(1),A(1))},[e]),(0,em.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{u(1),A(1)},300);return()=>clearTimeout(t)},[a]),(0,ep.jsxs)("div",{children:[r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading documents..."})]})}):t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[s," ",1===s?"document":"documents"]}),(0,ep.jsxs)("div",{className:"w-full",children:[(0,ep.jsx)("div",{className:"px-5 mb-4",children:(0,ep.jsx)(eI.Input,{type:"text",value:a,onChange:e=>o(e.target.value),placeholder:"Search documents (ID)...",className:"max-w-2xl"})}),(0,ep.jsx)("div",{className:"overflow-x-auto px-5 pb-5",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"Document ID"}),(0,ep.jsx)(eJ,{children:"Created"}),(0,ep.jsx)(eJ,{children:"Tags"}),(0,ep.jsx)(eJ,{children:"Metadata"}),(0,ep.jsx)(eJ,{children:"Size"}),(0,ep.jsx)(eJ,{children:"Memory Units"})]})}),(0,ep.jsx)(eZ,{children:t.length>0?t.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>M(e.id),children:[(0,ep.jsx)(e0,{className:"text-card-foreground font-mono text-xs break-all",children:e.id}),(0,ep.jsx)(e0,{className:"text-card-foreground",title:e.created_at?new Date(e.created_at).toLocaleString():"",children:e.created_at?function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);if(i<30)return`${i}d ago`;let a=Math.floor(i/30);return a<12?`${a}mo ago`:`${Math.floor(a/12)}y ago`}(e.created_at):"N/A"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.tags&&e.tags.length>0?(0,ep.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.tags.slice(0,3).map((e,t)=>(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t)),e.tags.length>3&&(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",e.tags.length-3]})]}):"-"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.document_metadata&&Object.keys(e.document_metadata).length>0?(0,ep.jsx)(pl,{metadata:e.document_metadata}):"-"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:ps(e.text_length||0)}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.memory_unit_count})]},e.id)):(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:6,className:"text-center",children:'Click "Load Documents" to view data'})})})]})}),d>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t px-5",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[h+1,"-",Math.min(h+50,s)," of ",s]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>O(1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>O(c-1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",d]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>O(c+1),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>O(d),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No documents found"})]})}),t.length>0&&f&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[560px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,ep.jsxs)("div",{className:"p-5",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:"Document Details"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Original document text and metadata"})]}),(0,ep.jsxs)(eL.Button,{variant:"secondary",size:"sm",onClick:()=>p(null),className:"h-9 px-3 gap-2",children:[(0,ep.jsx)(e$.X,{className:"h-4 w-4"}),"Close"]})]}),g?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading document..."})]})}):(0,ep.jsxs)("div",{className:"space-y-5",children:[(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Document ID"}),(0,ep.jsx)("div",{className:"text-sm font-mono break-all text-card-foreground",children:f.id})]}),f.created_at&&(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:new Date(f.created_at).toLocaleString()})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Memory Units"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:f.memory_unit_count})]})]}),f.original_text&&(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Size"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:ps(new Blob([f.original_text]).size)})]}),f.retain_params&&(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg space-y-3",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase",children:"Retain Parameters"}),f.retain_params.context&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Context"}),(0,ep.jsx)("div",{className:"text-sm text-card-foreground",children:f.retain_params.context})]}),f.retain_params.event_date&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Event Date"}),(0,ep.jsx)("div",{className:"text-sm text-card-foreground",children:new Date(f.retain_params.event_date).toLocaleString()})]}),f.retain_params.metadata&&Object.keys(f.retain_params.metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Metadata"}),(0,ep.jsx)(pl,{metadata:f.retain_params.metadata})]})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase",children:"Tags"}),!b&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>{N((f?.tags??[]).join(", ")),w(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,ep.jsx)(po,{className:"h-3 w-3"}),"Edit"]})]}),b?(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(eI.Input,{value:j,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"text-sm h-8",onKeyDown:e=>{"Enter"===e.key&&L(),"Escape"===e.key&&D()},autoFocus:!0}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Comma-separated. Leave empty to remove all tags."}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eL.Button,{size:"sm",onClick:L,disabled:k,className:"h-7 px-3 gap-1 text-xs",children:[k?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(tF.Check,{className:"h-3 w-3"}),"Save"]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:D,disabled:k,className:"h-7 px-3 gap-1 text-xs",children:[(0,ep.jsx)(e$.X,{className:"h-3 w-3"}),"Cancel"]})]})]}):f.tags&&f.tags.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:f.tags.map((e,t)=>(0,ep.jsx)("span",{className:"text-sm px-3 py-1.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t))}):(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No tags"})]}),(0,ep.jsx)("div",{className:"pt-2 border-t border-border",children:(0,ep.jsxs)(eL.Button,{variant:"destructive",size:"sm",onClick:()=>{_({id:f.id,memoryCount:f.memory_unit_count})},className:"w-full gap-2",disabled:x===f.id,children:[x===f.id?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(pa,{className:"h-4 w-4"}),"Delete Document"]})}),f.original_text&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Original Text"}),(0,ep.jsx)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border max-h-[400px] overflow-y-auto",children:(0,ep.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono leading-relaxed text-card-foreground",children:f.original_text})})]})]})]})}),(0,ep.jsx)(fY,{open:!!C,onOpenChange:e=>!e&&_(null),children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Document"}),(0,ep.jsxs)(pn,{children:["Are you sure you want to delete document"," ",(0,ep.jsxs)("span",{className:"font-mono font-semibold",children:['"',C?.id,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),"This will also delete"," ",C?.memoryCount!==void 0?(0,ep.jsxs)("span",{className:"font-semibold",children:[C.memoryCount," memory units"]}):"all memory units"," ","extracted from this document.",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{children:"Cancel"}),(0,ep.jsx)(pr,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),(0,ep.jsx)(fY,{open:!!S,onOpenChange:e=>!e&&T(null),children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:S?.success?"Document Deleted":"Error"}),(0,ep.jsx)(pn,{children:S?.message})]}),(0,ep.jsx)(pe,{children:(0,ep.jsx)(pr,{onClick:()=>T(null),children:"OK"})})]})})]})}function pu(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("relations"),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(1),[x,y]=(0,em.useState)(0),b=Math.ceil(x/50),w=(g-1)*50,j=async(t=1)=>{if(e){i(!0);try{let r=await eD.client.listEntities({bank_id:e,limit:50,offset:(t-1)*50});n(r.items||[]),y(r.total||0)}catch(e){}finally{i(!1)}}},N=async t=>{if(e){l(!0);try{let n=await eD.client.getEntity(t,e);o(n)}catch(e){}finally{l(!1)}}},k=e=>{v(e),j(e)},E=(0,em.useCallback)(async()=>{if(e){p(!0);try{let t=await eD.client.getEntityGraph({bank_id:e,limit:2e3,min_count:1});h(t)}catch(e){}finally{p(!1)}}},[e]);(0,em.useEffect)(()=>{e&&(v(1),j(1),o(null),h(null))},[e]),(0,em.useEffect)(()=>{"relations"!==c||!e||d||f||E()},[c,e,d,f,E]);let C=(0,em.useMemo)(()=>d?hG(d):{nodes:[],links:[]},[d]),_=(0,em.useMemo)(()=>{let e=new Map;for(let t of C.links){let n="number"==typeof t.weight&&t.weight>0?t.weight:1;e.set(t.source,(e.get(t.source)||0)+n),e.set(t.target,(e.get(t.target)||0)+n)}return e},[C]),S=(0,em.useMemo)(()=>{let e=1;for(let t of _.values())t>e&&(e=t);return e},[_]),T=(0,em.useCallback)(e=>3+11*Math.sqrt((_.get(e.id)||0)/S),[_,S]),A=(0,em.useMemo)(()=>{let e=d?.edges||[];if(!e.length)return null;let t=new Map,n=1/0,r=-1/0;for(let i of e){let e=i.data.lastCooccurred;if(!e)continue;let a=Date.parse(e);if(!Number.isNaN(a)){for(let e of[i.data.source,i.data.target]){let n=t.get(e);(void 0===n||a>n)&&t.set(e,a)}a<n&&(n=a),a>r&&(r=a)}}return Number.isFinite(n)&&Number.isFinite(r)&&r!==n?{times:t,minT:n,maxT:r}:null},[d]),O=(0,em.useCallback)(e=>{if(!A)return .5;let t=A.times.get(e.id);return void 0===t?0:(t-A.minT)/(A.maxT-A.minT)},[A]),M=(0,em.useCallback)(e=>{N(e.id)},[e]),P=e=>e?new Date(e).toLocaleDateString():"N/A";return(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"mb-4 flex items-center justify-end",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>u("relations"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"relations"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(fL,{className:"w-4 h-4"}),"Relations"]}),(0,ep.jsxs)("button",{onClick:()=>u("list"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"list"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eG,{className:"w-4 h-4"}),"List"]})]})}),"relations"===c&&(0,ep.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:f?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entity graph..."})]})}):C.nodes.length>0?(0,ep.jsx)(fD,{data:C,height:700,onNodeClick:M,nodeSizeFn:T,nodeHeatFn:A?O:void 0,heatLegendLabel:A?"recency · last co-occurrence":void 0,heatLegendEndpoints:A?[new Date(A.minT).toISOString().slice(0,10),new Date(A.maxT).toISOString().slice(0,10)]:void 0,sizeLegendLabel:"co-occurrences",compactLabels:!0}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entity co-occurrences yet"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Two entities co-occur when they appear in the same memory."})]})})}),"list"===c&&(0,ep.jsx)("div",{children:r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entities..."})]})}):t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[x," ",1===x?"entity":"entities"]}),(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"Name"}),(0,ep.jsx)(eJ,{children:"Mentions"}),(0,ep.jsx)(eJ,{children:"First Seen"}),(0,ep.jsx)(eJ,{children:"Last Seen"})]})}),(0,ep.jsx)(eZ,{children:t.map(e=>(0,ep.jsxs)(eQ,{onClick:()=>N(e.id),className:`cursor-pointer hover:bg-muted/50 ${a?.id===e.id?"bg-primary/10":""}`,children:[(0,ep.jsx)(e0,{className:"font-medium text-card-foreground",children:e.canonical_name}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.mention_count}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:P(e.first_seen)}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:P(e.last_seen)})]},e.id))})]})}),b>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[w+1,"-",Math.min(w+50,x)," of ",x]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(1),disabled:1===g||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(g-1),disabled:1===g||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[g," / ",b]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(g+1),disabled:g===b||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(b),disabled:g===b||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entities found"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Entities are extracted from facts when memories are added."})]})})}),a&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,ep.jsxs)("div",{className:"p-5",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-card-foreground",children:a.canonical_name}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Entity details"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>o(null),className:"h-8 w-8 p-0",children:(0,ep.jsx)("span",{className:"text-lg",children:"x"})})]}),(0,ep.jsxs)("div",{className:"space-y-5",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentions"}),(0,ep.jsx)("div",{className:"text-lg font-semibold text-card-foreground",children:a.mention_count})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"First Seen"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:P(a.first_seen)})]})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Entity ID"}),(0,ep.jsx)("code",{className:"text-xs font-mono break-all text-muted-foreground",children:a.id})]})]})]})})]})}var pd=e.i(32089);let ph=["world","experience","observation"],pf={world:{label:"World",active:"bg-violet-500/15 text-violet-700 border-violet-400 dark:text-violet-300 dark:border-violet-500",inactive:"border-border text-muted-foreground hover:border-violet-300 hover:text-violet-600 dark:hover:text-violet-400",dot:"bg-violet-500"},experience:{label:"Experience",active:"bg-pink-500/15 text-pink-700 border-pink-400 dark:text-pink-300 dark:border-pink-500",inactive:"border-border text-muted-foreground hover:border-pink-300 hover:text-pink-600 dark:hover:text-pink-400",dot:"bg-pink-500"},observation:{label:"Observation",active:"bg-indigo-500/15 text-indigo-700 border-indigo-400 dark:text-indigo-300 dark:border-indigo-500",inactive:"border-border text-muted-foreground hover:border-indigo-300 hover:text-indigo-600 dark:hover:text-indigo-400",dot:"bg-indigo-500"}};function pp({ft:e,active:t,onToggle:n}){let r=pf[e];return(0,ep.jsxs)("button",{type:"button",onClick:n,className:(0,eO.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-all",t?r.active:r.inactive),children:[(0,ep.jsx)("span",{className:(0,eO.cn)("h-1.5 w-1.5 rounded-full",t?r.dot:"bg-muted-foreground/50")}),r.label]})}function pm({value:e,onChange:t,label:n="Fact types:"}){return(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:n}),(0,ep.jsx)("div",{className:"flex gap-1.5",children:ph.map(n=>(0,ep.jsx)(pp,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})]})}function pg({value:e,onChange:t}){return(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:ph.map(n=>(0,ep.jsx)(pp,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})}let pv=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("rounded-xl bg-card text-card-foreground ring-1 ring-border/60 shadow-[0_1px_2px_rgba(0,0,0,0.04),0_2px_8px_-2px_rgba(0,0,0,0.06)] dark:ring-border/40 dark:shadow-[0_1px_2px_rgba(0,0,0,0.4),0_4px_16px_-4px_rgba(0,0,0,0.5)]",e),...t}));pv.displayName="Card";let px=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("flex flex-col space-y-1.5 p-6",e),...t}));px.displayName="CardHeader";let py=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-2xl font-semibold leading-none tracking-tight",e),...t}));py.displayName="CardTitle";let pb=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-sm text-muted-foreground",e),...t}));pb.displayName="CardDescription";let pw=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("p-6 pt-0",e),...t}));pw.displayName="CardContent",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("flex items-center p-6 pt-0",e),...t})).displayName="CardFooter";var pj=e.i(52571);let pN=(0,eN.default)("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"}]]),pk=(0,eN.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),pE=(0,eN.default)("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"}]]),pC=(0,eN.default)("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"}]]);var p_=e.i(1864);"function"==typeof SuppressedError&&SuppressedError;var pS=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}},pT={"text/plain":"Text","text/html":"Url",default:"Text"},pA=function(e,t){var n,r,i,a,o,s,l,c,u=!1;t||(t={}),i=t.debug||!1;try{if(o=pS(),s=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=pT[t.format]||pT.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),l.addRange(s),!document.execCommand("copy"))throw Error("copy command was unsuccessful");u=!0}catch(o){i&&console.error("unable to copy using execCommand: ",o),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(o){i&&console.error("unable to copy using clipboardData: ",o),i&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",r=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",a=n.replace(/#{\s*key\s*}/g,r),window.prompt(a,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),c&&document.body.removeChild(c),o()}return u};function pO(e){return"[object Object]"===Object.prototype.toString.call(e)}function pM(e){return Array.isArray(e)?e.length:pO(e)?Object.keys(e).length:0}function pP(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=pM(e);if("function"==typeof r){let i=pI(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||pO(e)&&o>i)}function pD(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=Math.ceil(e.length/100);if("function"==typeof r){let i=pI(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||pO(e)&&o>i)}function pL(e,t,n){return"boolean"==typeof e?e:"number"==typeof e&&!!(t>e)||"collapsed"===e&&!!n||"expanded"===e&&!n}function pI(e,t){try{return e(...t)}catch(e){reportError(e)}}function pR(e){if(!0===e||pO(e)&&!0===e.add)return!0}function pB(e){if(!0===e||pO(e)&&!0===e.edit)return!0}function pz(e){if(!0===e||pO(e)&&!0===e.delete)return!0}function pF(e){return!e||void 0===e.add||!!e.add}function pV(e){return!e||void 0===e.edit||!!e.edit}function pU(e){return!e||void 0===e.delete||!!e.delete}function pH(e){return!e||void 0===e.enableClipboard||!!e.enableClipboard}function pW(){return(pW=Object.assign.bind()).apply(this,arguments)}var pY=function(e){return em.createElement("svg",pW({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),w||(w=em.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))};function pG(){return(pG=Object.assign.bind()).apply(this,arguments)}var pX=function(e){return em.createElement("svg",pG({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),j||(j=em.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))};function p$(){return(p$=Object.assign.bind()).apply(this,arguments)}var pq=function(e){return em.createElement("svg",p$({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),N||(N=em.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),k||(k=em.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function pK({node:e,nodeMeta:t}){let{customizeCopy:n,CopyComponent:r,CopiedComponent:i}=(0,em.useContext)(mo),[a,o]=(0,em.useState)(!1),s=r=>{r.stopPropagation();let i=n(e,t);"string"==typeof i&&i&&function(e){var t,n,r,i;t=this,n=void 0,r=void 0,i=function*(){try{yield navigator.clipboard.writeText(e)}catch(t){pA(e)}},new(r||(r=Promise))(function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(o,s)}l((i=i.apply(t,n||[])).next())})}(i),o(!0),setTimeout(()=>o(!1),3e3)};return a?"function"==typeof i?(0,ep.jsx)(i,{className:"json-view--copy",style:{display:"inline-block"}}):(0,ep.jsx)(pq,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof r?(0,ep.jsx)(r,{onClick:s,className:"json-view--copy"}):(0,ep.jsx)(pX,{onClick:s,className:"json-view--copy"})}function pZ({indexOrName:e,value:t,depth:n,deleteHandle:r,editHandle:i,parent:a,parentPath:o}){let{displayArrayIndex:s}=(0,em.useContext)(mo),l=Array.isArray(a);return(0,ep.jsxs)("div",Object.assign({className:"json-view--pair"},{children:[!l||l&&s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",Object.assign({className:"number"==typeof e?"json-view--index":"json-view--property"},{children:e})),":"," "]}):(0,ep.jsx)(ep.Fragment,{}),(0,ep.jsx)(mi,{node:t,depth:n+1,deleteHandle:(e,t)=>r(e,t),editHandle:(e,t,n,r)=>i(e,t,n,r),parent:a,indexOrName:e,parentPath:o})]}))}function pQ(){return(pQ=Object.assign.bind()).apply(this,arguments)}var pJ=function(e){return em.createElement("svg",pQ({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),E||(E=em.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),C||(C=em.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))};function p0(){return(p0=Object.assign.bind()).apply(this,arguments)}var p1=function(e){return em.createElement("svg",p0({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_||(_=em.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),S||(S=em.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))};function p2(){return(p2=Object.assign.bind()).apply(this,arguments)}var p5=function(e){return em.createElement("svg",p2({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),T||(T=em.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),A||(A=em.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))};function p3(){return(p3=Object.assign.bind()).apply(this,arguments)}var p4=function(e){return em.createElement("svg",p3({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),O||(O=em.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),M||(M=em.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function p6({originNode:e,node:t,depth:n,index:r,deleteHandle:i,customOptions:a,startIndex:o,parent:s,parentPath:l}){let{enableClipboard:c,src:u,onEdit:d,onChange:h,forceUpdate:f,displaySize:p,CustomOperation:g}=(0,em.useContext)(mo),v=[...l,String(r)],[x,y]=(0,em.useState)(!0),b=(0,em.useCallback)((t,r,i)=>{e[t]=r,d&&d({newValue:r,oldValue:i,depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),h&&h({type:"edit",depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),f()},[t,d,h,f]),w=t=>{e.splice(t,1),i&&i(t,l),f()},j=(0,ep.jsxs)(ep.Fragment,{children:[!x&&(0,ep.jsxs)("span",Object.assign({onClick:()=>y(!0),className:"jv-size-chevron"},{children:[pL(p,n,x)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[pM(t)," Items"]})),(0,ep.jsx)(pY,{className:"jv-chevron"})]})),!x&&c&&pH(a)&&(0,ep.jsx)(pK,{node:t,nodeMeta:{depth:n,indexOrName:r,parent:s,parentPath:l,currentPath:v}}),"function"==typeof g?(0,ep.jsx)(g,{node:t}):null]});return(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{children:"["}),j,x?(0,ep.jsxs)("button",Object.assign({onClick:()=>y(!1),className:"jv-button"},{children:[o," ... ",o+t.length-1]})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:t.map((e,i)=>(0,ep.jsx)(pZ,{indexOrName:i+o,value:e,depth:n,parent:t,deleteHandle:w,editHandle:b,parentPath:l},String(r)+String(i)))})),(0,ep.jsx)("span",{children:"]"})]})}function p8({node:e,depth:t,deleteHandle:n,indexOrName:r,customOptions:i,parent:a,parentPath:o}){let s=void 0!==r?[...o,String(r)]:o,l=[];for(let t=0;t<e.length;t+=100)l.push(e.slice(t,t+100));let{collapsed:c,enableClipboard:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,CustomOperation:v,onChange:x,forceUpdate:y,displaySize:b}=(0,em.useContext)(mo),[w,j]=(0,em.useState)(pD(e,t,r,c,d,i));(0,em.useEffect)(()=>{j(pD(e,t,r,c,d,i))},[c,d]);let[N,k]=(0,em.useState)(!1),[E,C]=(0,em.useState)(!1),_=()=>{e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),y()},S=N||E,T=(0,ep.jsxs)(ep.Fragment,{children:[!w&&!S&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!0),className:"jv-size-chevron"},{children:[pL(b,t,w)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),(0,ep.jsx)(pY,{className:"jv-chevron"})]})),S&&(0,ep.jsx)(p5,{className:"json-view--edit",style:{display:"inline-block"},onClick:E?_:()=>{k(!1),n&&n(r,o),f&&f({value:e,depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o}),x&&x({type:"delete",depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o})}}),S&&(0,ep.jsx)(p4,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{k(!1),C(!1)}}),!w&&!S&&u&&pH(i)&&(0,ep.jsx)(pK,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:a,parentPath:o,currentPath:s}}),!w&&!S&&pR(h)&&pF(i)&&(0,ep.jsx)(p1,{className:"json-view--edit",onClick:()=>{_()}}),!w&&!S&&pz(h)&&pU(i)&&n&&(0,ep.jsx)(pJ,{className:"json-view--edit",onClick:()=>k(!0)}),"function"==typeof v?(0,ep.jsx)(v,{node:e}):null]});return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"["}),T,w?(0,ep.jsx)("button",Object.assign({onClick:()=>j(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:l.map((a,s)=>(0,ep.jsx)(p6,{originNode:e,node:a,depth:t,index:s,startIndex:100*s,deleteHandle:n,customOptions:i,parentPath:o},String(r)+String(s)))})),(0,ep.jsx)("span",{children:"]"}),w&&pL(b,t,w)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function p7({node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parent:a,parentPath:o}){let{collapsed:s,onCollapse:l,enableClipboard:c,ignoreLargeArray:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,onEdit:v,onChange:x,forceUpdate:y,displaySize:b,CustomOperation:w}=(0,em.useContext)(mo),j=void 0!==n?[...o,String(n)]:o;if(!u&&Array.isArray(e)&&e.length>100)return(0,ep.jsx)(p8,{node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parentPath:j});let N=pO(e),[k,E]=(0,em.useState)(pP(e,t,n,s,d,i)),C=r=>{null==l||l({isCollapsing:!r,node:e,depth:t,indexOrName:n}),E(r)};(0,em.useEffect)(()=>{C(pP(e,t,n,s,d,i))},[s,d]);let _=(0,em.useCallback)((n,r,i)=>{Array.isArray(e)?e[+n]=r:e&&(e[n]=r),v&&v({newValue:r,oldValue:i,depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),x&&x({type:"edit",depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),y()},[e,v,x,y]),S=t=>{Array.isArray(e)?e.splice(+t,1):e&&delete e[t],y()},[T,A]=(0,em.useState)(!1),[O,M]=(0,em.useState)(!1),P=(0,em.useRef)(null),D=()=>{var n;if(N){let r=null==(n=P.current)?void 0:n.value;r&&(e[r]=null,P.current&&(P.current.value=""),M(!1),g&&g({indexOrName:r,depth:t,src:p,parentType:"object",parentPath:j}),x&&x({type:"add",indexOrName:r,depth:t,src:p,parentType:"object",parentPath:j}))}else Array.isArray(e)&&(e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}));y()},L=T||O,I=()=>{A(!1),M(!1)},R=(0,ep.jsxs)(ep.Fragment,{children:[!k&&!L&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!0),className:"jv-size-chevron"},{children:[pL(b,t,k)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[pM(e)," Items"]})),(0,ep.jsx)(pY,{className:"jv-chevron"})]})),O&&N&&(0,ep.jsx)("input",{className:"json-view--input",placeholder:"property",ref:P,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),D()):"Escape"===e.key&&I()}}),L&&(0,ep.jsx)(p5,{className:"json-view--edit",style:{display:"inline-block"},onClick:O?D:()=>{A(!1),r&&r(n,j),f&&f({value:e,depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),x&&x({type:"delete",depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j})}}),L&&(0,ep.jsx)(p4,{className:"json-view--edit",style:{display:"inline-block"},onClick:I}),!k&&!L&&c&&pH(i)&&(0,ep.jsx)(pK,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:a,parentPath:o,currentPath:j}}),!k&&!L&&pR(h)&&pF(i)&&(0,ep.jsx)(p1,{className:"json-view--edit",onClick:()=>{N?(M(!0),setTimeout(()=>{var e;return null==(e=P.current)?void 0:e.focus()})):D()}}),!k&&!L&&pz(h)&&pU(i)&&r&&(0,ep.jsx)(pJ,{className:"json-view--edit",onClick:()=>A(!0)}),"function"==typeof w?(0,ep.jsx)(w,{node:e}):null]});return Array.isArray(e)?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"["}),R,k?(0,ep.jsx)("button",Object.assign({onClick:()=>C(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:e.map((r,i)=>(0,ep.jsx)(pZ,{indexOrName:i,value:r,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(i)))})),(0,ep.jsx)("span",{children:"]"}),k&&pL(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[pM(e)," Items"]}))]}):N?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"{"}),R,k?(0,ep.jsx)("button",Object.assign({onClick:()=>C(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([r,i])=>(0,ep.jsx)(pZ,{indexOrName:r,value:i,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(r)))})),(0,ep.jsx)("span",{children:"}"}),k&&pL(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[pM(e)," Items"]}))]}):(0,ep.jsx)("span",{children:String(e)})}let p9=em.default.forwardRef(({str:e,className:t,ctrlClick:n},r)=>{let{collapseStringMode:i,collapseStringsAfterLength:a,customizeCollapseStringUI:o}=(0,em.useContext)(mo),[s,l]=(0,em.useState)(!0),c=(0,em.useRef)(null);a=a>0?a:0;let u=e.replace(/\s+/g," "),d="function"==typeof o?o(u,s):"string"==typeof o?o:"...",h=e=>{var t;if((e.ctrlKey||e.metaKey)&&n)n(e);else{let e=window.getSelection();if(e&&e.anchorOffset!==e.focusOffset&&(null==(t=e.anchorNode)?void 0:t.parentElement)===c.current)return;l(!s)}};if(e.length<=a)return(0,ep.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']}));if("address"===i)return e.length<=10?(0,ep.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']})):(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,6),d,u.slice(-4)]:e,'"']}));if("directly"===i)return(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,a),d]:e,'"']}));if("word"===i){let n=a,r=a+1,i=u,o=1;for(;;){if(/\W/.test(e[n])){i=e.slice(0,n);break}if(/\W/.test(e[r])){i=e.slice(0,r);break}if(6===o){i=e.slice(0,a);break}o++,n--,r++}return(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[i,d]:e,'"']}))}return(0,ep.jsxs)("span",Object.assign({ref:c,className:t},{children:['"',e,'"']}))});function me(){return(me=Object.assign.bind()).apply(this,arguments)}var mt=function(e){return em.createElement("svg",me({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),P||(P=em.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))};function mn(){return(mn=Object.assign.bind()).apply(this,arguments)}var mr=function(e){return em.createElement("svg",mn({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),D||(D=em.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),L||(L=em.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function mi({node:e,depth:t,deleteHandle:n,indexOrName:r,parent:i,editHandle:a,parentPath:o}){let s,{collapseStringsAfterLength:l,enableClipboard:c,editable:u,src:d,onDelete:h,onChange:f,customizeNode:p,matchesURL:g,urlRegExp:v,EditComponent:x,DoneComponent:y,CancelComponent:b,CustomOperation:w}=(0,em.useContext)(mo);if("function"==typeof p&&(s=pI(p,[{node:e,depth:t,indexOrName:r}])),s){if((0,em.isValidElement)(s))return s;else if("function"==typeof s){let n=s;return(0,ep.jsx)(n,{node:e,depth:t,indexOrName:r})}}if(Array.isArray(e)||pO(e))return(0,ep.jsx)(p7,{parent:i,node:e,depth:t,indexOrName:r,deleteHandle:n,parentPath:o,customOptions:"object"==typeof s?s:void 0});{var j;let p=typeof e,N=void 0!==r?[...o,String(r)]:o,[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),S=(0,em.useRef)(null),T=()=>{E(!0),setTimeout(()=>{var e,t;null==(e=window.getSelection())||e.selectAllChildren(S.current),null==(t=S.current)||t.focus()})},A=(0,em.useCallback)(()=>{let t=S.current.innerText;try{let n=JSON.parse(t);a&&a(r,n,e,o)}catch(i){let n="string"===p?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t;a&&a(r,n,e,o)}E(!1)},[a,r,e,o,p]),O=()=>{E(!1),_(!1)},M=()=>{_(!1),n&&n(r,o),h&&h({value:e,depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",parentPath:o}),f&&f({depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",type:"delete",parentPath:o})},P=(0,em.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),A()):"Escape"===e.key&&O()},[A]),D=k||C,L=!D&&pB(u)&&pV(s)&&a?e=>{(e.ctrlKey||e.metaKey)&&T()}:void 0,I=(0,ep.jsxs)(ep.Fragment,{children:[D&&("function"==typeof y?(0,ep.jsx)(y,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?M:A}):(0,ep.jsx)(p5,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?M:A})),D&&("function"==typeof b?(0,ep.jsx)(b,{className:"json-view--edit",style:{display:"inline-block"},onClick:O}):(0,ep.jsx)(p4,{className:"json-view--edit",style:{display:"inline-block"},onClick:O})),!D&&c&&pH(s)&&(0,ep.jsx)(pK,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:i,parentPath:o,currentPath:N}}),!D&&g&&"string"===p&&v.test(e)&&(!(j=s)||void 0===j.matchesURL||!!j.matchesURL)&&(0,ep.jsx)("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:(0,ep.jsx)(mr,{})})),!D&&pB(u)&&pV(s)&&a&&("function"==typeof x?(0,ep.jsx)(x,{className:"json-view--edit",onClick:T}):(0,ep.jsx)(mt,{className:"json-view--edit",onClick:T})),!D&&pz(u)&&pU(s)&&n&&(0,ep.jsx)(pJ,{className:"json-view--edit",onClick:()=>_(!0)}),"function"==typeof w?(0,ep.jsx)(w,{node:e}):null]}),R="json-view--string";switch(p){case"number":case"bigint":R="json-view--number";break;case"boolean":R="json-view--boolean";break;case"object":R="json-view--null"}"string"==typeof(null==s?void 0:s.className)&&(R+=" "+s.className),C&&(R+=" json-view--deleting");let B=String(e);"bigint"===p&&(B+="n");let z=(0,em.useMemo)(()=>(0,ep.jsx)("span",{contentEditable:!0,className:R,dangerouslySetInnerHTML:{__html:"string"===p?`"${B}"`:B},ref:S,onKeyDown:P}),[B,p,P]);return"string"===p?(0,ep.jsxs)(ep.Fragment,{children:[k?z:e.length>l?(0,ep.jsx)(p9,{str:e,ref:S,className:R,ctrlClick:L}):(0,ep.jsxs)("span",Object.assign({className:R,onClick:L},{children:['"',B,'"']})),I]}):(0,ep.jsxs)(ep.Fragment,{children:[k?z:(0,ep.jsx)("span",Object.assign({className:R,onClick:L},{children:B})),I]})}}let ma=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,mo=(0,em.createContext)({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:ma,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function ms({src:e,collapseStringsAfterLength:t=99,collapseStringMode:n="directly",customizeCollapseStringUI:r,collapseObjectsAfterLength:i=99,collapsed:a,onCollapse:o,enableClipboard:s=!0,editable:l=!1,onEdit:c,onDelete:u,onAdd:d,onChange:h,dark:f=!1,theme:p="default",customizeNode:g,customizeCopy:v=e=>(function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,(e,t)=>{switch(typeof t){case"bigint":return String(t)+"n";case"number":case"boolean":case"object":case"string":return t;default:return String(t)}},void 0)}catch(e){return`${e.name}: ${e.message}`||"JSON.stringify failed"}})(e),displaySize:x,displayArrayIndex:y=!0,style:b,className:w,matchesURL:j=!1,urlRegExp:N=ma,ignoreLargeArray:k=!1,CopyComponent:E,CopiedComponent:C,EditComponent:_,CancelComponent:S,DoneComponent:T,CustomOperation:A}){let[O,M]=(0,em.useState)(0),P=(0,em.useCallback)(()=>M(e=>++e),[]),[D,L]=(0,em.useState)(e);return(0,em.useEffect)(()=>L(e),[e]),(0,ep.jsx)(mo.Provider,Object.assign({value:{src:D,collapseStringsAfterLength:t,collapseStringMode:n,customizeCollapseStringUI:r,collapseObjectsAfterLength:i,collapsed:a,onCollapse:o,enableClipboard:s,editable:l,onEdit:c,onDelete:u,onAdd:d,onChange:h,forceUpdate:P,customizeNode:g,customizeCopy:v,displaySize:x,displayArrayIndex:y,matchesURL:j,urlRegExp:N,ignoreLargeArray:k,CopyComponent:E,CopiedComponent:C,EditComponent:_,CancelComponent:S,DoneComponent:T,CustomOperation:A}},{children:(0,ep.jsx)("code",Object.assign({className:"json-view"+(f?" dark":"")+(p&&"default"!==p?" json-view_"+p:"")+(w?" "+w:""),style:b},{children:(0,ep.jsx)(mi,{node:D,depth:1,editHandle:(e,t,n,r)=>{L(t),c&&c({newValue:t,oldValue:n,depth:1,src:D,indexOrName:e,parentType:null,parentPath:r}),h&&h({type:"edit",depth:1,src:D,indexOrName:e,parentType:null,parentPath:r})},deleteHandle:(e,t)=>{L(void 0),u&&u({value:D,depth:1,src:D,indexOrName:e,parentType:null,parentPath:t}),h&&h({depth:1,src:D,indexOrName:e,parentType:null,type:"delete",parentPath:t})},parentPath:[]})}))}))}var ml=e.i(26330),mc=e.i(3536),mu=e.i(65491),md=e.i(10772),mh=e.i(53660),mf=e.i(74606),mp=e.i(96626),mm=e.i(42727),mg=Symbol("radix.slottable");function mv(e){return em.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mg}var mx=e.i(30207),my=e.i(86312),mb=e.i(85369),mw=["Enter"," "],mj=["ArrowUp","PageDown","End"],mN=["ArrowDown","PageUp","Home",...mj],mk={ltr:[...mw,"ArrowRight"],rtl:[...mw,"ArrowLeft"]},mE={ltr:["ArrowLeft"],rtl:["ArrowRight"]},mC="Menu",[m_,mS,mT]=(0,ts.createCollection)(mC),[mA,mO]=(0,tt.createContextScope)(mC,[mT,mh.createPopperScope,mm.createRovingFocusGroupScope]),mM=(0,mh.createPopperScope)(),mP=(0,mm.createRovingFocusGroupScope)(),[mD,mL]=mA(mC),[mI,mR]=mA(mC),mB=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=mM(t),[l,c]=em.useState(null),u=em.useRef(!1),d=(0,mx.useCallbackRef)(a),h=(0,tr.useDirection)(i);return em.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,ep.jsx)(mh.Root,{...s,children:(0,ep.jsx)(mD,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,ep.jsx)(mI,{scope:t,onClose:em.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};mB.displayName=mC;var mz=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=mM(n);return(0,ep.jsx)(mh.Anchor,{...i,...r,ref:t})});mz.displayName="MenuAnchor";var mF="MenuPortal",[mV,mU]=mA(mF,{forceMount:void 0}),mH=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=mL(mF,t);return(0,ep.jsx)(mV,{scope:t,forceMount:n,children:(0,ep.jsx)(mp.Presence,{present:n||a.open,children:(0,ep.jsx)(mf.Portal,{asChild:!0,container:i,children:r})})})};mH.displayName=mF;var mW="MenuContent",[mY,mG]=mA(mW),mX=em.forwardRef((e,t)=>{let n=mU(mW,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=mL(mW,e.__scopeMenu),o=mR(mW,e.__scopeMenu);return(0,ep.jsx)(m_.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(mp.Presence,{present:r||a.open,children:(0,ep.jsx)(m_.Slot,{scope:e.__scopeMenu,children:o.modal?(0,ep.jsx)(m$,{...i,ref:t}):(0,ep.jsx)(mq,{...i,ref:t})})})})}),m$=em.forwardRef((e,t)=>{let n=mL(mW,e.__scopeMenu),r=em.useRef(null),i=(0,te.useComposedRefs)(t,r);return em.useEffect(()=>{let e=r.current;if(e)return(0,my.hideOthers)(e)},[]),(0,ep.jsx)(mZ,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,e9.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mq=em.forwardRef((e,t)=>{let n=mL(mW,e.__scopeMenu);return(0,ep.jsx)(mZ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),mK=((o=em.forwardRef((e,t)=>{let{children:n,...r}=e;if(em.isValidElement(n)){var i;let e,a,o=(i=n,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...a}:"className"===r&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==em.Fragment&&(s.ref=t?(0,te.composeRefs)(t,o):o),em.cloneElement(n,s)}return em.Children.count(n)>1?em.Children.only(null):null})).displayName="MenuContent.ScrollLock.SlotClone",r=o,(i=em.forwardRef((e,t)=>{let{children:n,...i}=e,a=em.Children.toArray(n),o=a.find(mv);if(o){let e=o.props.children,n=a.map(t=>t!==o?t:em.Children.count(e)>1?em.Children.only(null):em.isValidElement(e)?e.props.children:null);return(0,ep.jsx)(r,{...i,ref:t,children:em.isValidElement(e)?em.cloneElement(e,void 0,n):null})}return(0,ep.jsx)(r,{...i,ref:t,children:n})})).displayName="MenuContent.ScrollLock.Slot",i),mZ=em.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...g}=e,v=mL(mW,n),x=mR(mW,n),y=mM(n),b=mP(n),w=mS(n),[j,N]=em.useState(null),k=em.useRef(null),E=(0,te.useComposedRefs)(t,k,v.onContentChange),C=em.useRef(0),_=em.useRef(""),S=em.useRef(0),T=em.useRef(null),A=em.useRef("right"),O=em.useRef(0),M=p?mb.RemoveScroll:em.Fragment;em.useEffect(()=>()=>window.clearTimeout(C.current),[]),(0,mc.useFocusGuards)();let P=em.useCallback(e=>{var t,n;return A.current===T.current?.side&&(t=e,!!(n=T.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],l=o.x,c=o.y,u=s.x,d=s.y;c>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,ep.jsx)(mY,{scope:n,searchRef:_,onItemEnter:em.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:em.useCallback(e=>{P(e)||(k.current?.focus(),N(null))},[P]),onTriggerLeave:em.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:S,onPointerGraceIntentChange:em.useCallback(e=>{T.current=e},[]),children:(0,ep.jsx)(M,{...p?{as:mK,allowPinchZoom:!0}:void 0,children:(0,ep.jsx)(mu.FocusScope,{asChild:!0,trapped:i,onMountAutoFocus:(0,e9.composeEventHandlers)(a,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,ep.jsx)(ml.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:(0,ep.jsx)(mm.Root,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:N,onEntryFocus:(0,e9.composeEventHandlers)(l,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ep.jsx)(mh.Content,{role:"menu","aria-orientation":"vertical","data-state":gf(v.open),"data-radix-menu-content":"",dir:x.dir,...y,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:(0,e9.composeEventHandlers)(g.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,a,o,s,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=_.current+i,a=w().filter(e=>!e.disabled),o=document.activeElement,s=a.find(e=>e.ref.current===o)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1,o=(r=Math.max(a,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(o=o.filter(e=>e!==n));let s=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==n?s:void 0}(a.map(e=>e.textValue),t,s),c=a.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(C.current),""!==t&&(C.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let a=k.current;if(e.target!==a||!mN.includes(e.key))return;e.preventDefault();let o=w().filter(e=>!e.disabled).map(e=>e.ref.current);mj.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,e9.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),_.current="")}),onPointerMove:(0,e9.composeEventHandlers)(e.onPointerMove,gg(e=>{let t=e.target,n=O.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>O.current?"right":"left",O.current=e.clientX)}))})})})})})})});mX.displayName=mW;var mQ=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(to.Primitive.div,{role:"group",...r,ref:t})});mQ.displayName="MenuGroup";var mJ=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(to.Primitive.div,{...r,ref:t})});mJ.displayName="MenuLabel";var m0="MenuItem",m1="menu.itemSelect",m2=em.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=em.useRef(null),o=mR(m0,e.__scopeMenu),s=mG(m0,e.__scopeMenu),l=(0,te.useComposedRefs)(t,a),c=em.useRef(!1);return(0,ep.jsx)(m5,{...i,ref:l,disabled:n,onClick:(0,e9.composeEventHandlers)(e.onClick,()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(m1,{bubbles:!0,cancelable:!0});e.addEventListener(m1,e=>r?.(e),{once:!0}),(0,to.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?c.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,e9.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,e9.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==s.searchRef.current;n||t&&" "===e.key||mw.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});m2.displayName=m0;var m5=em.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=mG(m0,n),s=mP(n),l=em.useRef(null),c=(0,te.useComposedRefs)(t,l),[u,d]=em.useState(!1),[h,f]=em.useState("");return em.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[a.children]),(0,ep.jsx)(m_.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,ep.jsx)(mm.Item,{asChild:!0,...s,focusable:!r,children:(0,ep.jsx)(to.Primitive.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:c,onPointerMove:(0,e9.composeEventHandlers)(e.onPointerMove,gg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,e9.composeEventHandlers)(e.onPointerLeave,gg(e=>o.onItemLeave(e))),onFocus:(0,e9.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,e9.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),m3=em.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,ep.jsx)(gn,{scope:e.__scopeMenu,checked:n,children:(0,ep.jsx)(m2,{role:"menuitemcheckbox","aria-checked":gp(n)?"mixed":n,...i,ref:t,"data-state":gm(n),onSelect:(0,e9.composeEventHandlers)(i.onSelect,()=>r?.(!!gp(n)||!n),{checkForDefaultPrevented:!1})})})});m3.displayName="MenuCheckboxItem";var m4="MenuRadioGroup",[m6,m8]=mA(m4,{value:void 0,onValueChange:()=>{}}),m7=em.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=(0,mx.useCallbackRef)(r);return(0,ep.jsx)(m6,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,ep.jsx)(mQ,{...i,ref:t})})});m7.displayName=m4;var m9="MenuRadioItem",ge=em.forwardRef((e,t)=>{let{value:n,...r}=e,i=m8(m9,e.__scopeMenu),a=n===i.value;return(0,ep.jsx)(gn,{scope:e.__scopeMenu,checked:a,children:(0,ep.jsx)(m2,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":gm(a),onSelect:(0,e9.composeEventHandlers)(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ge.displayName=m9;var gt="MenuItemIndicator",[gn,gr]=mA(gt,{checked:!1}),gi=em.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=gr(gt,n);return(0,ep.jsx)(mp.Presence,{present:r||gp(a.checked)||!0===a.checked,children:(0,ep.jsx)(to.Primitive.span,{...i,ref:t,"data-state":gm(a.checked)})})});gi.displayName=gt;var ga=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(to.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});ga.displayName="MenuSeparator";var go=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=mM(n);return(0,ep.jsx)(mh.Arrow,{...i,...r,ref:t})});go.displayName="MenuArrow";var[gs,gl]=mA("MenuSub"),gc="MenuSubTrigger",gu=em.forwardRef((e,t)=>{let n=mL(gc,e.__scopeMenu),r=mR(gc,e.__scopeMenu),i=gl(gc,e.__scopeMenu),a=mG(gc,e.__scopeMenu),o=em.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=a,c={__scopeMenu:e.__scopeMenu},u=em.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return em.useEffect(()=>u,[u]),em.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]),(0,ep.jsx)(mz,{asChild:!0,...c,children:(0,ep.jsx)(m5,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":gf(n.open),...e,ref:(0,te.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:(0,e9.composeEventHandlers)(e.onPointerMove,gg(t=>{a.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,e9.composeEventHandlers)(e.onPointerLeave,gg(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,o=t[i?"left":"right"],l=t[i?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:(0,e9.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==a.searchRef.current;e.disabled||i&&" "===t.key||mk[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});gu.displayName=gc;var gd="MenuSubContent",gh=em.forwardRef((e,t)=>{let n=mU(mW,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=mL(mW,e.__scopeMenu),o=mR(mW,e.__scopeMenu),s=gl(gd,e.__scopeMenu),l=em.useRef(null),c=(0,te.useComposedRefs)(t,l);return(0,ep.jsx)(m_.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(mp.Presence,{present:r||a.open,children:(0,ep.jsx)(m_.Slot,{scope:e.__scopeMenu,children:(0,ep.jsx)(mZ,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:c,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,e9.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:(0,e9.composeEventHandlers)(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:(0,e9.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=mE[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});function gf(e){return e?"open":"closed"}function gp(e){return"indeterminate"===e}function gm(e){return gp(e)?"indeterminate":e?"checked":"unchecked"}function gg(e){return t=>"mouse"===t.pointerType?e(t):void 0}gh.displayName=gd;var gv="DropdownMenu",[gx,gy]=(0,tt.createContextScope)(gv,[mO]),gb=mO(),[gw,gj]=gx(gv),gN=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=gb(t),c=em.useRef(null),[u,d]=(0,tn.useControllableState)({prop:i,defaultProp:a??!1,onChange:o,caller:gv});return(0,ep.jsx)(gw,{scope:t,triggerId:(0,md.useId)(),triggerRef:c,contentId:(0,md.useId)(),open:u,onOpenChange:d,onOpenToggle:em.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,ep.jsx)(mB,{...l,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};gN.displayName=gv;var gk="DropdownMenuTrigger",gE=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=gj(gk,n),o=gb(n);return(0,ep.jsx)(mz,{asChild:!0,...o,children:(0,ep.jsx)(to.Primitive.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:(0,te.composeRefs)(t,a.triggerRef),onPointerDown:(0,e9.composeEventHandlers)(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:(0,e9.composeEventHandlers)(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});gE.displayName=gk;var gC=e=>{let{__scopeDropdownMenu:t,...n}=e,r=gb(t);return(0,ep.jsx)(mH,{...r,...n})};gC.displayName="DropdownMenuPortal";var g_="DropdownMenuContent",gS=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gj(g_,n),a=gb(n),o=em.useRef(!1);return(0,ep.jsx)(mX,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:(0,e9.composeEventHandlers)(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:(0,e9.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gS.displayName=g_,em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(mQ,{...i,...r,ref:t})}).displayName="DropdownMenuGroup";var gT=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(mJ,{...i,...r,ref:t})});gT.displayName="DropdownMenuLabel";var gA=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(m2,{...i,...r,ref:t})});gA.displayName="DropdownMenuItem";var gO=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(m3,{...i,...r,ref:t})});gO.displayName="DropdownMenuCheckboxItem",em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(m7,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup";var gM=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(ge,{...i,...r,ref:t})});gM.displayName="DropdownMenuRadioItem";var gP=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(gi,{...i,...r,ref:t})});gP.displayName="DropdownMenuItemIndicator";var gD=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(ga,{...i,...r,ref:t})});gD.displayName="DropdownMenuSeparator",em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(go,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var gL=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(gu,{...i,...r,ref:t})});gL.displayName="DropdownMenuSubTrigger";var gI=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gb(n);return(0,ep.jsx)(gh,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gI.displayName="DropdownMenuSubContent";let gR=(0,eN.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);em.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,ep.jsxs)(gL,{ref:i,className:(0,eO.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,(0,ep.jsx)(eT.ChevronRight,{className:"ml-auto"})]})).displayName=gL.displayName,em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(gI,{ref:n,className:(0,eO.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})).displayName=gI.displayName;let gB=em.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,ep.jsx)(gC,{children:(0,ep.jsx)(gS,{ref:r,sideOffset:t,className:(0,eO.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));gB.displayName=gS.displayName;let gz=em.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(gA,{ref:r,className:(0,eO.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n}));gz.displayName=gA.displayName,em.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,ep.jsxs)(gO,{ref:i,className:(0,eO.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(gP,{children:(0,ep.jsx)(tF.Check,{className:"h-4 w-4"})})}),t]})).displayName=gO.displayName,em.forwardRef(({className:e,children:t,...n},r)=>(0,ep.jsxs)(gM,{ref:r,className:(0,eO.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(gP,{children:(0,ep.jsx)(gR,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=gM.displayName,em.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(gT,{ref:r,className:(0,eO.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n})).displayName=gT.displayName;let gF=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(gD,{ref:n,className:(0,eO.cn)("-mx-1 my-1 h-px bg-muted",e),...t}));gF.displayName=gD.displayName;var tV=tV;let gV=(0,eN.default)("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"}]]),gU=(0,eN.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);function gH(){}function gW(){}let gY=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gX={};function g$(e,t){return((t||gX).jsx?gG:gY).test(e)}let gq=/[ \t\n\f\r]/g;function gK(e){return""===e.replace(gq,"")}class gZ{constructor(e,t){this.attribute=t,this.property=e}}gZ.prototype.attribute="",gZ.prototype.booleanish=!1,gZ.prototype.boolean=!1,gZ.prototype.commaOrSpaceSeparated=!1,gZ.prototype.commaSeparated=!1,gZ.prototype.defined=!1,gZ.prototype.mustUseProperty=!1,gZ.prototype.number=!1,gZ.prototype.overloadedBoolean=!1,gZ.prototype.property="",gZ.prototype.spaceSeparated=!1,gZ.prototype.space=void 0;let gQ=0,gJ=g6(),g0=g6(),g1=g6(),g2=g6(),g5=g6(),g3=g6(),g4=g6();function g6(){return 2**++gQ}e.s(["boolean",0,gJ,"booleanish",0,g0,"commaOrSpaceSeparated",0,g4,"commaSeparated",0,g3,"number",0,g2,"overloadedBoolean",0,g1,"spaceSeparated",0,g5],744);var g8=e.i(744);let g7=Object.keys(g8);class g9 extends gZ{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<g7.length;){const e=g7[i];!function(e,t,n){n&&(e[t]=n)}(this,g7[i],(n&g8[e])===g8[e])}}}function ve(e){return e.toLowerCase()}g9.prototype.defined=!0;let vt=/[A-Z]/g,vn=/-[a-z]/g,vr=/^data[-\w.:]+$/i;function vi(e){return"-"+e.toLowerCase()}function va(e){return e.charAt(1).toUpperCase()}let vo={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class vs{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function vl(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new vs(n,r,t)}function vc(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new g9(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ve(r)]=r,n[ve(a.attribute)]=r}return new vs(t,n,e.space)}vs.prototype.normal={},vs.prototype.property={},vs.prototype.space=void 0;let vu=vc({properties:{ariaActiveDescendant:null,ariaAtomic:g0,ariaAutoComplete:null,ariaBusy:g0,ariaChecked:g0,ariaColCount:g2,ariaColIndex:g2,ariaColSpan:g2,ariaControls:g5,ariaCurrent:null,ariaDescribedBy:g5,ariaDetails:null,ariaDisabled:g0,ariaDropEffect:g5,ariaErrorMessage:null,ariaExpanded:g0,ariaFlowTo:g5,ariaGrabbed:g0,ariaHasPopup:null,ariaHidden:g0,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:g5,ariaLevel:g2,ariaLive:null,ariaModal:g0,ariaMultiLine:g0,ariaMultiSelectable:g0,ariaOrientation:null,ariaOwns:g5,ariaPlaceholder:null,ariaPosInSet:g2,ariaPressed:g0,ariaReadOnly:g0,ariaRelevant:null,ariaRequired:g0,ariaRoleDescription:g5,ariaRowCount:g2,ariaRowIndex:g2,ariaRowSpan:g2,ariaSelected:g0,ariaSetSize:g2,ariaSort:null,ariaValueMax:g2,ariaValueMin:g2,ariaValueNow:g2,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function vd(e,t){return t in e?e[t]:t}function vh(e,t){return vd(e,t.toLowerCase())}let vf=vc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:g3,acceptCharset:g5,accessKey:g5,action:null,allow:null,allowFullScreen:gJ,allowPaymentRequest:gJ,allowUserMedia:gJ,alt:null,as:null,async:gJ,autoCapitalize:null,autoComplete:g5,autoFocus:gJ,autoPlay:gJ,blocking:g5,capture:null,charSet:null,checked:gJ,cite:null,className:g5,cols:g2,colSpan:null,content:null,contentEditable:g0,controls:gJ,controlsList:g5,coords:g2|g3,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gJ,defer:gJ,dir:null,dirName:null,disabled:gJ,download:g1,draggable:g0,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gJ,formTarget:null,headers:g5,height:g2,hidden:g1,high:g2,href:null,hrefLang:null,htmlFor:g5,httpEquiv:g5,id:null,imageSizes:null,imageSrcSet:null,inert:gJ,inputMode:null,integrity:null,is:null,isMap:gJ,itemId:null,itemProp:g5,itemRef:g5,itemScope:gJ,itemType:g5,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gJ,low:g2,manifest:null,max:null,maxLength:g2,media:null,method:null,min:null,minLength:g2,multiple:gJ,muted:gJ,name:null,nonce:null,noModule:gJ,noValidate:gJ,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gJ,optimum:g2,pattern:null,ping:g5,placeholder:null,playsInline:gJ,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gJ,referrerPolicy:null,rel:g5,required:gJ,reversed:gJ,rows:g2,rowSpan:g2,sandbox:g5,scope:null,scoped:gJ,seamless:gJ,selected:gJ,shadowRootClonable:gJ,shadowRootDelegatesFocus:gJ,shadowRootMode:null,shape:null,size:g2,sizes:null,slot:null,span:g2,spellCheck:g0,src:null,srcDoc:null,srcLang:null,srcSet:null,start:g2,step:null,style:null,tabIndex:g2,target:null,title:null,translate:null,type:null,typeMustMatch:gJ,useMap:null,value:g0,width:g2,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:g5,axis:null,background:null,bgColor:null,border:g2,borderColor:null,bottomMargin:g2,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gJ,declare:gJ,event:null,face:null,frame:null,frameBorder:null,hSpace:g2,leftMargin:g2,link:null,longDesc:null,lowSrc:null,marginHeight:g2,marginWidth:g2,noResize:gJ,noHref:gJ,noShade:gJ,noWrap:gJ,object:null,profile:null,prompt:null,rev:null,rightMargin:g2,rules:null,scheme:null,scrolling:g0,standby:null,summary:null,text:null,topMargin:g2,valueType:null,version:null,vAlign:null,vLink:null,vSpace:g2,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gJ,disableRemotePlayback:gJ,prefix:null,property:null,results:g2,security:null,unselectable:null},space:"html",transform:vh}),vp=vc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:g4,accentHeight:g2,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:g2,amplitude:g2,arabicForm:null,ascent:g2,attributeName:null,attributeType:null,azimuth:g2,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:g2,by:null,calcMode:null,capHeight:g2,className:g5,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:g2,diffuseConstant:g2,direction:null,display:null,dur:null,divisor:g2,dominantBaseline:null,download:gJ,dx:null,dy:null,edgeMode:null,editable:null,elevation:g2,enableBackground:null,end:null,event:null,exponent:g2,externalResourcesRequired:null,fill:null,fillOpacity:g2,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:g3,g2:g3,glyphName:g3,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:g2,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:g2,horizOriginX:g2,horizOriginY:g2,id:null,ideographic:g2,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:g2,k:g2,k1:g2,k2:g2,k3:g2,k4:g2,kernelMatrix:g4,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:g2,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:g2,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:g2,overlineThickness:g2,paintOrder:null,panose1:null,path:null,pathLength:g2,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:g5,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:g2,pointsAtY:g2,pointsAtZ:g2,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:g4,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:g4,rev:g4,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:g4,requiredFeatures:g4,requiredFonts:g4,requiredFormats:g4,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:g2,specularExponent:g2,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:g2,strikethroughThickness:g2,string:null,stroke:null,strokeDashArray:g4,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:g2,strokeOpacity:g2,strokeWidth:null,style:null,surfaceScale:g2,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:g4,tabIndex:g2,tableValues:null,target:null,targetX:g2,targetY:g2,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:g4,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:g2,underlineThickness:g2,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:g2,values:null,vAlphabetic:g2,vMathematical:g2,vectorEffect:null,vHanging:g2,vIdeographic:g2,version:null,vertAdvY:g2,vertOriginX:g2,vertOriginY:g2,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:g2,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vd}),vm=vc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),vg=vc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vh}),vv=vc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),vx=vl([vu,vf,vm,vg,vv],"html"),vy=vl([vu,vp,vm,vg,vv],"svg");var vb=e.i(15511);let vw=vN("end"),vj=vN("start");function vN(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function vk(e){return e&&"object"==typeof e?"position"in e||"type"in e?vC(e.position):"start"in e||"end"in e?vC(e):"line"in e||"column"in e?vE(e):"":""}function vE(e){return v_(e&&e.line)+":"+v_(e&&e.column)}function vC(e){return vE(e&&e.start)+"-"+vE(e&&e.end)}function v_(e){return e&&"number"==typeof e?e:1}class vS extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},a=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=vk(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vS.prototype.file="",vS.prototype.name="",vS.prototype.reason="",vS.prototype.message="",vS.prototype.stack="",vS.prototype.column=void 0,vS.prototype.line=void 0,vS.prototype.ancestors=void 0,vS.prototype.cause=void 0,vS.prototype.fatal=void 0,vS.prototype.place=void 0,vS.prototype.ruleId=void 0,vS.prototype.source=void 0;let vT={}.hasOwnProperty,vA=new Map,vO=/[A-Z]/g,vM=new Set(["table","tbody","thead","tfoot","tr"]),vP=new Set(["td","th"]),vD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vL(e,t,n){var r,i,a,o,s,l,c,u,d;let h,f,p,g,v,x,y,b,w,j,N;return"element"===t.type?(r=e,i=t,a=n,f=h=r.schema,"svg"===i.tagName.toLowerCase()&&"html"===h.space&&(r.schema=vy),r.ancestors.push(i),p=vz(r,i.tagName,!1),g=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&vT.call(t.properties,r)){let a=function(e,t,n){let r=function(e,t){let n=ve(t),r=t,i=gZ;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&vr.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(vn,va);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!vn.test(e)){let n=e.replace(vt,vi);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=g9}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,vb.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new vS("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=vD+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)vT.call(e,t)&&(n[function(e){let t=e.replace(vO,vV);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?vo[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(a){let[r,o]=a;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof o&&vP.has(t.tagName)?n=o:i[r]=o}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(r,i),v=vB(r,i),vM.has(i.tagName)&&(v=v.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&gK(e.value):gK(e))})),vI(r,g,p,i),vR(g,v),r.ancestors.pop(),r.schema=h,r.create(i,p,g,a)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return gH("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}vF(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=n,y=x=o.schema,"svg"===s.name&&"html"===x.space&&(o.schema=vy),o.ancestors.push(s),b=null===s.name?o.Fragment:vz(o,s.name,!0),w=function(e,t){let n={};for(let r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];gH("ExpressionStatement"===t.type);let i=t.expression;gH("ObjectExpression"===i.type);let a=i.properties[0];gH("SpreadElement"===a.type),Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else vF(e,t.position);else{let i,a=r.name;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];gH("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else vF(e,t.position);else i=null===r.value||r.value;n[a]=i}return n}(o,s),j=vB(o,s),vI(o,w,b,s),vR(w,j),o.ancestors.pop(),o.schema=x,o.create(s,b,w,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vF(e,t.position)}(e,t):"root"===t.type?(c=e,u=t,d=n,vR(N={},vB(c,u)),c.create(u,c.Fragment,N,d)):"text"===t.type?t.value:void 0}function vI(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function vR(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function vB(e,t){let n=[],r=-1,i=e.passKeys?new Map:vA;for(;++r<t.children.length;){let a,o=t.children[r];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}let s=vL(e,o,a);void 0!==s&&n.push(s)}return n}function vz(e,t,n){let r;if(n)if(t.includes(".")){let e,n=t.split("."),i=-1;for(;++i<n.length;){let t=g$(n[i])?{type:"Identifier",name:n[i]}:{type:"Literal",value:n[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}gH(e,"always a result"),r=e}else r=g$(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){let t=r.value;return vT.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);vF(e)}function vF(e,t){let n=new vS("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=vD+"#cannot-handle-mdx-estrees-without-createevaluater",n}function vV(e){return"-"+e.toLowerCase()}let vU={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},vH={};function vW(e,t){let n=t||vH;return vY(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function vY(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return vG(e.children,t,n)}return Array.isArray(e)?vG(e,t,n):""}function vG(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=vY(e[i],t,n);return r.join("")}function vX(e,t,n,r){let i,a=e.length,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function v$(e,t){return e.length>0?(vX(e,e.length,0,t),e):t}let vq={}.hasOwnProperty;function vK(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(vq.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];if(a)for(r in a){vq.call(i,r)||(i[r]=[]);let e=a[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);vX(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}function vZ(e){return null!==e&&e<-2}function vQ(e){return -2===e||-1===e||32===e}function vJ(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function v0(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return vQ(r)?(e.enter(n),function r(o){return vQ(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}vJ(/[A-Za-z]/),vJ(/[\dA-Za-z]/),vJ(/[#-'*+\--9=?A-Z^-~]/),vJ(/\d/),vJ(/[\dA-Fa-f]/),vJ(/[!-/:-@[-`{-~]/),vJ(/\p{P}|\p{S}/u),vJ(/\s/);let v1={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),v0(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return vZ(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},v2={tokenize:function(e){let t,n,r,i=this,a=[],o=0;return s;function s(t){if(o<a.length){let n=a[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,c)(t)}return c(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&x();let r=i.events.length,a=r;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){n=i.events[a][1].end;break}v(o);let s=r;for(;s<i.events.length;)i.events[s][1].end={...n},s++;return vX(i.events,a+1,0,i.events.slice(r)),i.events.length=s,c(e)}return s(e)}function c(n){if(o===a.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return p(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(v5,u,d)(n)}function u(e){return t&&x(),v(o),h(e)}function d(e){return i.parser.lazy[i.now().line]=o!==a.length,r=i.now().offset,p(e)}function h(t){return i.containerState={},e.attempt(v5,f,p)(t)}function f(e){return o++,a.push([i.currentConstruct,i.containerState]),h(e)}function p(r){if(null===r){t&&x(),v(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){g(e.exit("chunkFlow"),!0),v(0),e.consume(n);return}return vZ(n)?(e.consume(n),g(e.exit("chunkFlow")),o=0,i.interrupt=void 0,s):(e.consume(n),t)}(r)}function g(e,a){let s=i.sliceStream(e);if(a&&s.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(s),i.parser.lazy[e.start.line]){let e,n,a=t.events.length;for(;a--;)if(t.events[a][1].start.offset<r&&(!t.events[a][1].end||t.events[a][1].end.offset>r))return;let s=i.events.length,l=s;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(v(o),a=s;a<i.events.length;)i.events[a][1].end={...n},a++;vX(i.events,l+1,0,i.events.slice(s)),i.events.length=a}}function v(t){let n=a.length;for(;n-- >t;){let t=a[n];i.containerState=t[1],t[0].exit.call(i,e)}a.length=t}function x(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},v5={tokenize:function(e,t,n){return v0(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},v3=xr(/[A-Za-z]/),v4=xr(/[\dA-Za-z]/),v6=xr(/[#-'*+\--9=?A-Z^-~]/),v8=xr(/\d/),v7=xr(/[\dA-Fa-f]/),v9=xr(/[!-/:-@[-`{-~]/);function xe(e){return null!==e&&e<-2}function xt(e){return null!==e&&(e<0||32===e)}function xn(e){return -2===e||-1===e||32===e}function xr(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xi(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return xn(r)?(e.enter(n),function r(o){return xn(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}xr(/\p{P}|\p{S}/u),xr(/\s/);let xa={partial:!0,tokenize:function(e,t,n){return function(t){return xn(t)?xi(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||xe(e)?t(e):n(e)}}};class xo{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&xs(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),xs(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),xs(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);xs(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);xs(this.left,t.reverse())}}}function xs(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function xl(e){let t,n,r,i,a,o,s,l={},c=-1,u=new xo(e);for(;++c<u.length;){for(;c in l;)c=l[c];if(t=u.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],a=e.get(t)[2],o=t-1,s=[],l=i._tokenizer;!l&&(l=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let c=l.events,u=[],d={},h=-1,f=i,p=0,g=0,v=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(n=a.sliceStream(f),f.next||n.push(null),r&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=f,f=f.next}for(f=i;++h<c.length;)"exit"===c[h][0]&&"enter"===c[h-1][0]&&c[h][1].type===c[h-1][1].type&&c[h][1].start.line!==c[h][1].end.line&&(g=h+1,v.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),h=v.length;h--;){let t=c.slice(v[h],v[h+1]),n=s.pop();u.push([n,n+t.length-1]),e.splice(n,2,t)}for(u.reverse(),h=-1;++h<u.length;)d[p+u[h][0]]=p+u[h][1],p+=u[h][1]-u[h][0]-1;return d}(u,c)),c=l[c],s=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=u.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(u.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...u.get(n)[1].start},(a=u.slice(n,c)).unshift(t),u.splice(n,c-n+1,a))}}return vX(e,0,1/0,u.slice(0)),!s}let xc={resolve:function(e){return xl(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):xe(t)?e.check(xu,a,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function a(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},xu={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),xi(e,i,"linePrefix")};function i(i){if(null===i||xe(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},xd={tokenize:function(e){let t=this,n=e.attempt(xa,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,v0(e,e.attempt(this.parser.constructs.flow,r,e.attempt(xc,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},xh={resolveAll:xg()},xf=xm("string"),xp=xm("text");function xm(e){return{resolveAll:xg("text"===e?xv:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function xg(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function xv(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],a=t.sliceStream(i),o=a.length,s=-1,l=0;for(;o--;){let e=a[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let a={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}xb(/[A-Za-z]/),xb(/[\dA-Za-z]/),xb(/[#-'*+\--9=?A-Z^-~]/),xb(/\d/),xb(/[\dA-Fa-f]/),xb(/[!-/:-@[-`{-~]/);let xx=xb(/\p{P}|\p{S}/u),xy=xb(/\s/);function xb(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xw(e){return null===e||null!==e&&(e<0||32===e)||xy(e)?1:xx(e)?2:void 0}function xj(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}let xN={name:"attention",resolveAll:function(e,t){let n,r,i,a,o,s,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close){for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[u][1].start};xk(d,-s),xk(h,s),a={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:h},i={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:s>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[n][1].end={...a.start},e[u][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=v$(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=v$(l,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=v$(l,xj(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=v$(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=v$(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,vX(e,n-1,u-n+3,l),u=n+l.length-c-2;break}}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,a=xw(i);return function(o){return n=o,e.enter("attentionSequence"),function o(s){if(s===n)return e.consume(s),o;let l=e.exit("attentionSequence"),c=xw(s),u=!c||2===c&&a||r.includes(s),d=!a||2===a&&c||r.includes(i);return l._open=!!(42===n?u:u&&(a||!d)),l._close=!!(42===n?d:d&&(c||!u)),t(s)}(o)}}};function xk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let xE={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return xn(t)?xi(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(xE,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return xn(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},xC={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return v9(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},x_=document.createElement("i");function xS(e){let t="&"+e+";";x_.innerHTML=t;let n=x_.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let xT={name:"characterReference",tokenize:function(e,t,n){let r,i,a=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=v4,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=v7,c):(e.enter("characterReferenceValue"),r=7,i=v8,c(t))}function c(s){if(59===s&&o){let r=e.exit("characterReferenceValue");return i!==v4||xS(a.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return i(s)&&o++<r?(e.consume(s),c):n(s)}}},xA={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xO={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),xn(t)?xi(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a>=s?(e.exit("codeFencedFenceSequence"),xn(i)?xi(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||xe(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,s=0;return function(t){var a;let c;return a=t,o=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=a,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s<3?n(i):(e.exit("codeFencedFenceSequence"),xn(i)?xi(e,l,"whitespace")(i):l(i))}(a)};function l(a){return null===a||xe(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(xA,u,p)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||xe(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):xn(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xi(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(a))}function c(t){return null===t||xe(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||xe(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function u(t){return e.attempt(a,p,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&xn(t)?xi(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||xe(t)?e.check(xA,u,p)(t):(e.enter("codeFlowValue"),function t(n){return null===n||xe(n)?(e.exit("codeFlowValue"),f(n)):(e.consume(n),t)}(t))}function p(n){return e.exit("codeFenced"),t(n)}}},xM={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),xi(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?a(n):xe(n)?e.attempt(xP,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||xe(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},xP={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):xe(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):xi(e,a,"linePrefix",5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):xe(e)?i(e):n(e)}}};function xD(e){return null!==e&&(e<32||127===e)}function xL(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xI(e,t,n,r,i,a,o,s,l){let c=l||1/0,u=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),d):null===t||32===t||41===t||xD(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),p(t))};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||null!==t&&t<-2?n(t):(e.consume(t),92===t?f:h)}function f(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function p(i){return!u&&(null===i||41===i||null!==i&&(i<0||32===i))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(i)):u<c&&40===i?(e.consume(i),u++,p):41===i?(e.consume(i),u--,p):null===i||32===i||40===i||xD(i)?n(i):(e.consume(i),92===i?g:p)}function g(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function xR(e){return null!==e&&e<-2}function xB(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xz(e,t,n,r,i,a){let o,s=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),c};function c(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):93===d?(e.exit(a),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):xR(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||xR(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),o||(o=-2!==t&&-1!==t&&32!==t),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function xF(e){return null!==e&&e<-2}function xV(e){return -2===e||-1===e||32===e}function xU(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xH(e,t,n,r,i,a){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,s):n(t)};function s(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){if(t===o)return e.exit(a),s(o);if(null===t)return n(t);if(xF(t)){var r,i;let n,a;return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r=l,i="linePrefix",n=1/0,a=0,function(t){return xV(t)?(e.enter(i),function t(o){return xV(o)&&a++<n?(e.consume(o),t):(e.exit(i),r(o))}(t)):r(t)}}return e.enter("chunkString",{contentType:"string"}),c(t)}function c(t){return t===o||null===t||xF(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===o||92===t?(e.consume(t),c):c(t)}}function xW(e){return -2===e||-1===e||32===e}function xY(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xG(e,t){let n;return function r(i){var a,o;if(null!==i&&i<-2)return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;if(xW(i)){let t,s;return(a=r,o=n?"linePrefix":"lineSuffix",t=1/0,s=0,function(n){return xW(n)?(e.enter(o),function n(r){return xW(r)&&s++<t?(e.consume(r),n):(e.exit(o),a(r))}(n)):a(n)})(i)}return t(i)}}function xX(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}xL(/[A-Za-z]/),xL(/[\dA-Za-z]/),xL(/[#-'*+\--9=?A-Z^-~]/),xL(/\d/),xL(/[\dA-Fa-f]/),xL(/[!-/:-@[-`{-~]/),xL(/\p{P}|\p{S}/u),xL(/\s/),xB(/[A-Za-z]/),xB(/[\dA-Za-z]/),xB(/[#-'*+\--9=?A-Z^-~]/),xB(/\d/),xB(/[\dA-Fa-f]/),xB(/[!-/:-@[-`{-~]/),xB(/\p{P}|\p{S}/u),xB(/\s/),xU(/[A-Za-z]/),xU(/[\dA-Za-z]/),xU(/[#-'*+\--9=?A-Z^-~]/),xU(/\d/),xU(/[\dA-Fa-f]/),xU(/[!-/:-@[-`{-~]/),xU(/\p{P}|\p{S}/u),xU(/\s/),xY(/[A-Za-z]/),xY(/[\dA-Za-z]/),xY(/[#-'*+\--9=?A-Z^-~]/),xY(/\d/),xY(/[\dA-Fa-f]/),xY(/[!-/:-@[-`{-~]/),xY(/\p{P}|\p{S}/u),xY(/\s/);let x$={partial:!0,tokenize:function(e,t,n){return function(t){return xt(t)?xG(e,r)(t):n(t)};function r(t){return xH(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return xn(t)?xi(e,a,"whitespace")(t):a(t)}function a(e){return null===e||xe(e)?t(e):n(e)}}},xq=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xK=["pre","script","style","textarea"],xZ={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(xa,t,n)}}},xQ={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return xe(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xJ={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&vX(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,a,o=e.length,s=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){s=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},u={type:"labelText",start:{...e[r+s+2][1].end},end:{...e[i-2][1].start}};return a=v$(a=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+s+3)),a=v$(a,[["enter",u,t]]),a=v$(a,xj(t.parser.constructs.insideSpan.null,e.slice(r+s+4,i-3),t)),a=v$(a,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),a=v$(a,e.slice(i+1)),a=v$(a,[["exit",l,t]]),vX(e,r,e.length,a),e},tokenize:function(e,t,n){let r,i,a=this,o=a.events.length;for(;o--;)if(("labelImage"===a.events[o][1].type||"labelLink"===a.events[o][1].type)&&!a.events[o][1]._balanced){r=a.events[o][1];break}return function(t){return r?r._inactive?u(t):(i=a.parser.defined.includes(xX(a.sliceSerialize({start:r.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):n(t)};function s(t){return 40===t?e.attempt(x0,c,i?c:u)(t):91===t?e.attempt(x1,c,i?l:u)(t):i?c(t):u(t)}function l(t){return e.attempt(x2,c,u)(t)}function c(e){return t(e)}function u(e){return r._balanced=!0,n(e)}}},x0={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return xt(t)?xG(e,i)(t):i(t)}function i(t){return 41===t?c(t):xI(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return xt(t)?xG(e,s)(t):c(t)}function o(e){return n(e)}function s(t){return 34===t||39===t||40===t?xH(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return xt(t)?xG(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},x1={tokenize:function(e,t,n){let r=this;return function(t){return xz.call(r,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(xX(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},x2={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},x5={name:"labelStartImage",resolveAll:xJ.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):n(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},x3={name:"labelStartLink",resolveAll:xJ.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},x4={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),xi(e,t,"linePrefix")}}},x6={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(a){var o;return e.enter("thematicBreak"),r=o=a,function a(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),xn(n)?xi(e,a,"whitespace")(n):a(n))}(o)):i>=3&&(null===o||xe(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},x8={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(xa,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,xi(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!xn(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(x9,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,xi(e,e.attempt(x8,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:v8(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(x6,n,s)(t):s(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return v8(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),s(i)):n(i)}(t)}return n(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(xa,r.interrupt?n:l,e.attempt(x7,u,c))}function l(e){return r.containerState.initialBlankLine=!0,a++,u(e)}function c(t){return xn(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},x7={partial:!0,tokenize:function(e,t,n){let r=this;return xi(e,function(e){let i=r.events[r.events.length-1];return!xn(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},x9={partial:!0,tokenize:function(e,t,n){let r=this;return xi(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},ye={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),i||"definition"!==e[a][1].type||(i=a);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let s,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){s="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||s)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),xn(n)?xi(e,a,"lineSuffix")(n):a(n))}(o)):n(t)};function a(r){return null===r||xe(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,xz.call(i,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function a(t){return(r=xX(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return xt(t)?xG(e,s)(t):s(t)}function s(t){return xI(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(x$,c,c)(t)}function c(t){return xn(t)?xi(e,u,"whitespace")(t):u(t)}function u(a){return null===a||xe(a)?(e.exit("definition"),i.parser.defined.push(r),t(a)):n(a)}}}},"disable",0,{null:[]},"document",0,{42:x8,43:x8,45:x8,48:x8,49:x8,50:x8,51:x8,52:x8,53:x8,54:x8,55:x8,56:x8,57:x8,62:xE},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,a=3;return"whitespace"===e[3][1].type&&(a+=2),i-2>a&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(a===i-1||i-4>a&&"whitespace"===e[i-2][1].type)&&(i-=a+1===i?2:4),i>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[i][1].end},r={type:"chunkText",start:e[a][1].start,end:e[i][1].end,contentType:"text"},vX(e,a,i-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var a;return e.enter("atxHeading"),a=i,e.enter("atxHeadingSequence"),function i(a){return 35===a&&r++<6?(e.consume(a),i):null===a||xt(a)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||xe(r)?(e.exit("atxHeading"),t(r)):xn(r)?xi(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||xt(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(a)):n(a)}(a)}}},42:x6,45:[ye,x6],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,a,o,s,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(o){return 33===o?(e.consume(o),u):47===o?(e.consume(o),i=!0,f):63===o?(e.consume(o),r=3,l.interrupt?t:P):v3(o)?(e.consume(o),a=String.fromCharCode(o),p):n(o)}function u(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,o=0,h):v3(i)?(e.consume(i),r=4,l.interrupt?t:P):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:P):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:E:h:n(r)}function f(t){return v3(t)?(e.consume(t),a=String.fromCharCode(t),p):n(t)}function p(o){if(null===o||47===o||62===o||xt(o)){let s=47===o,c=a.toLowerCase();return!s&&!i&&xK.includes(c)?(r=1,l.interrupt?t(o):E(o)):xq.includes(a.toLowerCase())?(r=6,s)?(e.consume(o),g):l.interrupt?t(o):E(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return xn(n)?(e.consume(n),t):N(n)}(o):v(o))}return 45===o||v4(o)?(e.consume(o),a+=String.fromCharCode(o),p):n(o)}function g(r){return 62===r?(e.consume(r),l.interrupt?t:E):n(r)}function v(t){return 47===t?(e.consume(t),N):58===t||95===t||v3(t)?(e.consume(t),x):xn(t)?(e.consume(t),v):N(t)}function x(t){return 45===t||46===t||58===t||95===t||v4(t)?(e.consume(t),x):y(t)}function y(t){return 61===t?(e.consume(t),b):xn(t)?(e.consume(t),y):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),s=t,w):xn(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||xt(n)?y(n):(e.consume(n),t)}(t)}function w(t){return t===s?(e.consume(t),s=null,j):null===t||xe(t)?n(t):(e.consume(t),w)}function j(e){return 47===e||62===e||xn(e)?v(e):n(e)}function N(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||xe(t)?E(t):xn(t)?(e.consume(t),k):n(t)}function E(t){return 45===t&&2===r?(e.consume(t),T):60===t&&1===r?(e.consume(t),A):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),P):93===t&&5===r?(e.consume(t),M):xe(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(xZ,L,C)(t)):null===t||xe(t)?(e.exit("htmlFlowData"),C(t)):(e.consume(t),E)}function C(t){return e.check(xQ,_,L)(t)}function _(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||xe(t)?C(t):(e.enter("htmlFlowData"),E(t))}function T(t){return 45===t?(e.consume(t),P):E(t)}function A(t){return 47===t?(e.consume(t),a="",O):E(t)}function O(t){if(62===t){let n=a.toLowerCase();return xK.includes(n)?(e.consume(t),D):E(t)}return v3(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),O):E(t)}function M(t){return 93===t?(e.consume(t),P):E(t)}function P(t){return 62===t?(e.consume(t),D):45===t&&2===r?(e.consume(t),P):E(t)}function D(t){return null===t||xe(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),D)}function L(n){return e.exit("htmlFlow"),t(n)}}},61:ye,95:x6,96:xO,126:xO},"flowInitial",0,{[-2]:xM,[-1]:xM,32:xM},"insideSpan",0,{null:[xN,xh]},"string",0,{38:xT,92:xC},"text",0,{[-5]:x4,[-4]:x4,[-3]:x4,33:x5,38:xT,42:xN,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return v3(t)?(e.consume(t),a):64===t?n(t):s(t)}function a(t){return 43===t||45===t||46===t||v4(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||v4(n))&&r++<32?(e.consume(n),t):(r=0,s(n))}(t)):s(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||null!==r&&(r<32||127===r)?n(r):(e.consume(r),o)}function s(t){return 64===t?(e.consume(t),l):v6(t)?(e.consume(t),s):n(t)}function l(i){return v4(i)?function i(a){return 46===a?(e.consume(a),r=0,l):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||v4(a))&&r++<63){let n=45===a?t:i;return e.consume(a),n}return n(a)}(a)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,a,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),w):63===t?(e.consume(t),y):v3(t)?(e.consume(t),N):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,f):v3(t)?(e.consume(t),x):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):xe(t)?(a=u,O(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),h):u(t)}function h(e){return 62===e?A(e):45===e?d(e):u(e)}function f(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?p:f):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),g):xe(t)?(a=p,O(t)):(e.consume(t),p)}function g(t){return 93===t?(e.consume(t),v):p(t)}function v(t){return 62===t?A(t):93===t?(e.consume(t),v):p(t)}function x(t){return null===t||62===t?A(t):xe(t)?(a=x,O(t)):(e.consume(t),x)}function y(t){return null===t?n(t):63===t?(e.consume(t),b):xe(t)?(a=y,O(t)):(e.consume(t),y)}function b(e){return 62===e?A(e):y(e)}function w(t){return v3(t)?(e.consume(t),j):n(t)}function j(t){return 45===t||v4(t)?(e.consume(t),j):function t(n){return xe(n)?(a=t,O(n)):xn(n)?(e.consume(n),t):A(n)}(t)}function N(t){return 45===t||v4(t)?(e.consume(t),N):47===t||62===t||xt(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),A):58===t||95===t||v3(t)?(e.consume(t),E):xe(t)?(a=k,O(t)):xn(t)?(e.consume(t),k):A(t)}function E(t){return 45===t||46===t||58===t||95===t||v4(t)?(e.consume(t),E):function t(n){return 61===n?(e.consume(n),C):xe(n)?(a=t,O(n)):xn(n)?(e.consume(n),t):k(n)}(t)}function C(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,_):xe(t)?(a=C,O(t)):xn(t)?(e.consume(t),C):(e.consume(t),S)}function _(t){return t===r?(e.consume(t),r=void 0,T):null===t?n(t):xe(t)?(a=_,O(t)):(e.consume(t),_)}function S(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||xt(t)?k(t):(e.consume(t),S)}function T(e){return 47===e||62===e||xt(e)?k(e):n(e)}function A(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function O(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),M}function M(t){return xn(t)?xi(e,P,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):P(t)}function P(t){return e.enter("htmlTextData"),a(t)}}}],91:x3,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return xe(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},xC],93:xJ,95:xN,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),a++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",s(o))}(l)):xe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||xe(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var yt=e.i(4127);let yn=/[\0\t\n\r]/g;function yr(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let yi=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ya(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return yr(n.slice(t?2:1),t?16:10)}return xS(n)||e}let yo={}.hasOwnProperty;function ys(e){return{line:e.line,column:e.column,offset:e.offset}}function yl(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+vk({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vk({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+vk({start:t.start,end:t.end})+") is still open")}function yc(e){let t=this;t.parser=function(n){var r,i;let a,o,s,l;return"string"!=typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(x),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(p),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(f),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(f,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(g),hardBreakTrailing:r(g),htmlFlow:r(v,i),htmlFlowData:c,htmlText:r(v,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(x),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(y),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(p),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){u.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){u.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:u,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=yr(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=xS(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=ys(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:u,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:u,data:u,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=xX(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:u,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:u,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(yi,ya),n.identifier=xX(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=ys(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),u.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=xX(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(yo.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:a,exit:s,buffer:i,resume:l,data:n},c=[],u=-1;for(;++u<e.length;)("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)&&("enter"===e[u][0]?c.push(u):u=function(e,t,n){let r,i,a,o,s=t-1,l=-1,c=!1;for(;++s<=n;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||a||(a=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=s;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}a&&(!i||a<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||s,0,["exit",r,t[2]]),s++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(s,0,["enter",i,t[2]]),s++,n++,a=void 0,o=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),u));for(u=-1;++u<e.length;){let n=t[e[u][0]];yo.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||yl).call(o,void 0,e[0])}for(r.position={start:ys(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ys(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r};function r(e,t){return function(n){a.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:ys(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||yl).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+vk({start:e.start,end:e.end})+"): it’s not open");n.position.end=ys(e.end)}function l(){return vW(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:ys(e.start),end:void 0},t.push(n)),this.stack.push(n)}function u(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ys(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function v(){return{type:"html",value:""}}function x(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!xl(e););return e}((function(e){let t={constructs:vK([yt,...(e||{}).extensions||[]]),content:n(v1),defined:[],document:n(v2),flow:n(xd),lazy:{},string:n(xf),text:n(xp)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],l={attempt:p(function(e,t){g(e,t.from)}),check:p(f),consume:function(e){vZ(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),s.push(n),n},exit:function(e){let t=s.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:p(f,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a,o=e[r];if("string"==typeof o)a=o;else switch(o){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":" ";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(o)}n=-2===o,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=v$(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),u=u(t)}else u=u(n)}}(),null!==o[o.length-1])?[]:(g(t,0),c.events=xj(a,c.events,c),c.events)}},u=t.tokenize.call(c,l);return t.resolveAll&&a.push(t),c;function d(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,o)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[a].slice(0,o))}return n}(o,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e,t){t.restore()}function p(e,t){return function(n,i,a){var o;let u,d,f,p;return Array.isArray(n)?g(n):"tokenize"in n?g([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return g([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function g(e){return(u=e,d=0,0===e.length)?a:x(e[d])}function x(e){return function(n){let i,a,o,u,d;return(i=h(),a=c.previous,o=c.currentConstruct,u=c.events.length,d=Array.from(s),p={from:u,restore:function(){r=i,c.previous=a,c.currentConstruct=o,c.events.length=u,s=d,v()}},f=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,y,b)(n)}}function y(t){return e(f,p),i}function b(e){return(p.restore(),++d<u.length)?x(u[d]):a}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&vX(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,s="",l=!0,function(e,t,n){let r,i,c,u,d,h=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,s="",l&&(65279===e.charCodeAt(0)&&c++,l=void 0);c<e.length;){if(yn.lastIndex=c,u=(r=yn.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(u),!r){s=e.slice(c);break}if(10===d&&c===u&&a)h.push(-3),a=void 0;else switch(a&&(h.push(-5),a=void 0),c<u&&(h.push(e.slice(c,u)),o+=u-c),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:a=!0,o=1}c=u+1}return n&&(a&&h.push(-5),s&&h.push(s),h.push(null)),h})(n,r,!0))))}}let yu="object"==typeof self?self:globalThis,yd=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new yu[e](t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new yu[a](o),i)})(0)},{toString:yh}={},{keys:yf}=Object,yp=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=yh.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},ym=([e,t])=>0===e&&("function"===t||"symbol"===t),yg=(e,{json:t,lossy:n}={})=>{var r,i,a;let o,s,l=[];return(r=!(t||n),i=!!t,a=new Map,o=(e,t)=>{let n=l.push(e)-1;return a.set(t,n),n},s=e=>{if(a.has(e))return a.get(e);let[t,n]=yp(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(s(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return s(e.toJSON());let a=[],l=o([t,a],e);for(let t of yf(e))(r||!ym(yp(e[t])))&&a.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(ym(yp(t))||ym(yp(i))))&&n.push([s(t),s(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!ym(yp(t)))&&n.push(s(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},yv="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?yd(yg(e,t)):structuredClone(e):(e,t)=>yd(yg(e,t));yy(/[A-Za-z]/);let yx=yy(/[\dA-Za-z]/);function yy(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function yb(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o="";if(37===a&&yx(e.charCodeAt(n+1))&&yx(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function yw(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function yj(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}yy(/[#-'*+\--9=?A-Z^-~]/),yy(/\d/),yy(/[\dA-Fa-f]/),yy(/[!-/:-@[-`{-~]/),yy(/\p{P}|\p{S}/u),yy(/\s/);let yN=function(e){var t,n;if(null==e)return yE;if("function"==typeof e)return yk(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=yN(e[n]);return yk(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,yk(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,yk(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function yk(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function yE(){return!0}let yC=[];function y_(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let a=yN(i),o=r?-1:1;(function e(i,s,l){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return u;function u(){var c;let u,d,h,f=yC;if((!t||a(i,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(c=n(i,l))?c:"number"==typeof c?[!0,c]:null==c?yC:[c])[0])return f;if("children"in i&&i.children&&i.children&&"skip"!==f[0])for(d=(r?i.children.length:-1)+o,h=l.concat(i);d>-1&&d<i.children.length;){if(!1===(u=e(i.children[d],d,h)())[0])return u;d="number"==typeof u[1]?u[1]:d+o}return f}})(e,void 0,[])()}function yS(e,t,n,r){let i,a,o;"function"==typeof t&&"function"!=typeof n?(a=void 0,o=t,i=n):(a=t,o=n,i=r),y_(e,a,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}function yT(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),a=i[0];a&&"text"===a.type?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function yA(e){let t=e.spread;return null==t?e.children.length>1:t}function yO(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let yM={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=yb(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),s=e.footnoteCounts.get(i);void 0===s?(s=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yT(e,t);let i={src:yb(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){let n={src:yb(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yT(e,t);let i={href:yb(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){let n={href:yb(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=yA(n[r])}return t}(n):yA(t),a={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<r.length;){let e=r[s];(i||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=vj(t.children[1]),o=vw(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",a=n&&"table"===n.type?n.align:void 0,o=a?a.length:t.children.length,s=-1,l=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(yO(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(yO(t.slice(i),i>0,!1)),a.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:yP,yaml:yP,definition:yP,footnoteDefinition:yP};function yP(){}let yD={}.hasOwnProperty,yL={};function yI(e,t){e.position&&(t.position=function(e){let t=vj(e),n=vw(e);if(t&&n)return{start:t,end:n}}(e))}function yR(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,yv(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function yB(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function yz(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function yF(e,t){let n,r,i,a,o=(n=t||yL,r=new Map,i=new Map,a={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=yz(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=yz(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:yR,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...yM,...n.handlers},one:function(e,t){let n=e.type,r=a.handlers[n];if(yD.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=yv(n);return r.children=a.all(e),r}return yv(e)}return(a.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(yD.call(n,"hProperties")||yD.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(a,e,t)},options:n,patch:yI,wrap:yB},yS(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||yw,r=e.options.footnoteBackLabel||yj,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),c=yb(o.toLowerCase()),u=0,d=[],h=e.footnoteCounts.get(o);for(;void 0!==h&&++u<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=a[a.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else a.push(...d);let p={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(a,!0)};e.patch(i,p),s.push(p)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...yv(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(gH("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function yV(e,t){return e&&"run"in e?async function(n,r){let i=yF(n,{file:r,...t});await e.run(i,r)}:function(n,r){return yF(n,{file:r,...e||t})}}function yU(e){if(e)throw e}var yH=e.i(4100);function yW(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let yY=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');yq(e);let r=0,i=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,s=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else o<0&&(n=!0,o=a+1),s>-1&&(e.codePointAt(a)===t.codePointAt(s--)?s<0&&(i=a):(s=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},yG=function(e){let t;if(yq(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},yX=function(e){let t;yq(e);let n=e.length,r=-1,i=0,a=-1,o=0;for(;n--;){let s=e.codePointAt(n);if(47===s){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===s?a<0?a=n:1!==o&&(o=1):a>-1&&(o=-1)}return a<0||r<0||0===o||1===o&&a===r-1&&a===i+1?"":e.slice(a,r)},y$=function(...e){var t;let n,r,i,a=-1;for(;++a<e.length;)yq(e[a]),e[a]&&(i=void 0===i?e[a]:i+"/"+e[a]);return void 0===i?".":(yq(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",a=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(i.length<2||2!==a||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",a=0):a=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,s=0;continue}}else if(i.length>0){i="",a=0,o=l,s=0;continue}}t&&(i=i.length>0?i+"/..":"..",a=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else 46===n&&s>-1?s++:s=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function yq(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function yK(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let yZ=["history","path","basename","stem","extname","dirname"];class yQ{constructor(e){let t,n;t=e?yK(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<yZ.length;){const e=yZ[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)yZ.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?yY(this.path):void 0}set basename(e){y0(e,"basename"),yJ(e,"basename"),this.path=y$(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?yG(this.path):void 0}set dirname(e){y1(this.basename,"dirname"),this.path=y$(e||"",this.basename)}get extname(){return"string"==typeof this.path?yX(this.path):void 0}set extname(e){if(yJ(e,"extname"),y1(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=y$(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){yK(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!yK(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),y0(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?yY(this.path,this.extname):void 0}set stem(e){y0(e,"stem"),yJ(e,"stem"),this.path=y$(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new vS(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function yJ(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function y0(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function y1(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let y2=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},y5={}.hasOwnProperty;class y3 extends y2{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(a,...o){let s=e[++n],l=-1;if(a)return void r(a);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let n;return function(...t){let a,o=e.length>t.length;o&&t.push(r);try{a=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(a&&a.then&&"function"==typeof a.then?a.then(i,r):a instanceof Error?r(a):i(a))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(s,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new y3,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,yH.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(y7("data",this.frozen),this.namespace[e]=t,this):y5.call(this.namespace,e)&&this.namespace[e]||void 0:e?(y7("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=bt(e),n=this.parser||this.Parser;return y6("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),y6("process",this.parser||this.Parser),y8("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=bt(e),o=n.parse(a);function s(e,n){e||!n?i(e):r?r(n):(gH(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(o,a,function(e,t,r){var i,a;if(e||!t||!r)return s(e);let o=n.stringify(t,r);"string"==typeof(i=o)||(a=i)&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a?r.value=o:r.result=o,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),y6("processSync",this.parser||this.Parser),y8("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,yU(e),t=r}),be("processSync","process",n),gH(t,"we either bailed on an error or have a tree"),t}run(e,t,n){y9(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){gH("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=bt(t);r.run(e,o,function(t,r,o){let s=r||e;t?a(t):i?i(s):(gH(n,"`done` is defined if `resolve` is not"),n(void 0,s,o))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){yU(e),n=t,r=!0}),be("runSync","run",r),gH(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=bt(t),r=this.compiler||this.Compiler;return y8("stringify",r),y9(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(y7("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?a(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(e.plugins),e.settings&&(r.settings=(0,yH.default)(!0,r.settings,e.settings))}function a(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];yW(o)&&yW(r)&&(r=(0,yH.default)(!0,o,r)),n[i]=[e,r,...a]}}}}let y4=new y3().freeze();function y6(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function y8(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function y7(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function y9(e){if(!yW(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function be(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function bt(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new yQ(e)}let bn=[],br={allowDangerousHtml:!0},bi=/^(https?|ircs?|mailto|xmpp)$/i,ba=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function bo(e){var t;let n,r,i,a,o,s=(n=(t=e).rehypePlugins||bn,r=t.remarkPlugins||bn,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...br}:br,y4().use(yc).use(r).use(yV,i).use(n)),l=(a=e.children||"",o=new yQ,"string"==typeof a?o.value=a:gW("Unexpected value `"+a+"` for `children` prop, expected `string`"),o);return function(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||bs;for(let e of ba)Object.hasOwn(t,e.from)&&gW("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return n&&a&&gW("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),yS(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return o?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in vU)if(Object.hasOwn(vU,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=vU[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let o=n?!n.includes(e.tagName):!!a&&a.includes(e.tagName);if(!o&&r&&"number"==typeof t&&(o=!r(e,t,i)),o&&i&&"number"==typeof t)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var n,r,i,a;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=s,r=t.jsxDEV,o=function(e,t,i,a){let o=Array.isArray(i.children),s=vj(e);return r(t,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:n,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,a=t.jsxs,o=function(e,t,n,r){let o=Array.isArray(n.children)?a:i;return r?o(t,n,r):o(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?vy:vx,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=vL(l,e,void 0);return c&&"string"!=typeof c?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}(e,{Fragment:ep.Fragment,components:i,ignoreInvalidStyle:!0,jsx:ep.jsx,jsxs:ep.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function bs(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||bi.test(e.slice(0,t))?e:""}function bl(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}bd(/[A-Za-z]/),bd(/[\dA-Za-z]/),bd(/[#-'*+\--9=?A-Z^-~]/),bd(/\d/),bd(/[\dA-Fa-f]/),bd(/[!-/:-@[-`{-~]/);let bc=bd(/\p{P}|\p{S}/u),bu=bd(/\s/);function bd(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let bh="phrasing",bf=["autolink","link","image","label"];function bp(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bm(e){this.config.enter.autolinkProtocol.call(this,e)}function bg(e){this.config.exit.autolinkProtocol.call(this,e)}function bv(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];gH("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function bx(e){this.config.exit.autolinkEmail.call(this,e)}function by(e){this.exit(e)}function bb(e){!function(e,t,n){let r=yN((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<i.length;)y_(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){let e=t[o],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,l=n.children.indexOf(e),c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(s!==n&&u.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(s<e.value.length&&u.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...u)):u=[e],l+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bw],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bj]],{ignore:["link","linkReference"]})}function bw(e,t,n,r,i){let a,o="";if(!bN(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),(a=n.split(".")).length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=bl(e,"("),a=bl(e,")");for(;-1!==r&&i>a;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),a++;return[e,n]}(n+r);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function bj(e,t,n,r){return!(!bN(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bN(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||bu(n)||bc(n))&&(!t||47!==n)}function bk(){this.buffer()}function bE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bC(){this.buffer()}function b_(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bS(e){let t=this.resume(),n=this.stack[this.stack.length-1];gH("footnoteReference"===n.type),n.identifier=xX(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bT(e){this.exit(e)}function bA(e){let t=this.resume(),n=this.stack[this.stack.length-1];gH("footnoteDefinition"===n.type),n.identifier=xX(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bO(e){this.exit(e)}function bM(e,t,n,r){let i=n.createTracker(r),a=i.move("[^"),o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]")}function bP(e,t,n){return 0===t?e:bD(e,t,n)}function bD(e,t,n){return(n?"":" ")+e}bM.peek=function(){return"["};let bL=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function bI(e){this.enter({type:"delete",children:[]},e)}function bR(e){this.exit(e)}function bB(e,t,n,r){let i=n.createTracker(r),a=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function bz(e){return e.length}function bF(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}bB.peek=function(){return"~"};function bV(e,t,n){let r=e.value||"",i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){let e,t=n.unsafe[a],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}bV.peek=function(){return"`"};yN(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let bU=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),a=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let o=a.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=n.createTracker(r);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,s.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?a:a+" ".repeat(o-a.length))+e});return l(),c};function bH(e){let t=e._align;gH(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function bW(e){this.exit(e),this.data.inTable=void 0}function bY(e){this.enter({type:"tableRow",children:[]},e)}function bG(e){this.exit(e)}function bX(e){this.enter({type:"tableCell",children:[]},e)}function b$(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,bq));let n=this.stack[this.stack.length-1];gH("inlineCode"===n.type),n.value=t,this.exit(e)}function bq(e,t){return"|"===t?t:e}function bK(e){let t=this.stack[this.stack.length-2];gH("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function bZ(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];gH("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,i=t.children,a=-1;for(;++a<i.length;){let e=i[a];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function bQ(e,t,n,r){let i=e.children[0],a="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);a&&s.move(o);let l=bU(e,t,n,{...r,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let bJ=b3(/[A-Za-z]/),b0=b3(/[\dA-Za-z]/);function b1(e){return null!==e&&(e<0||32===e)}b3(/[#-'*+\--9=?A-Z^-~]/),b3(/\d/),b3(/[\dA-Fa-f]/),b3(/[!-/:-@[-`{-~]/);let b2=b3(/\p{P}|\p{S}/u),b5=b3(/\s/);function b3(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let b4={tokenize:function(e,t,n){let r=0;return function t(a){return(87===a||119===a)&&r<3?(r++,e.consume(a),t):46===a&&3===r?(e.consume(a),i):n(a)};function i(e){return null===e?n(e):t(e)}},partial:!0},b6={tokenize:function(e,t,n){let r,i,a;return o;function o(t){return 46===t||95===t?e.check(b7,l,s)(t):null===t||b1(t)||b5(t)||45!==t&&b2(t)?l(t):(a=!0,e.consume(t),o)}function s(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),o}function l(e){return i||r||!a?n(e):t(e)}},partial:!0},b8={tokenize:function(e,t){let n=0,r=0;return i;function i(o){return 40===o?(n++,e.consume(o),i):41===o&&r<n?a(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(b7,t,a)(o):null===o||b1(o)||b5(o)?t(o):(e.consume(o),i)}function a(t){return 41===t&&r++,e.consume(t),i}},partial:!0},b7={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),a):93===o?(e.consume(o),i):60===o||null===o||b1(o)||b5(o)?t(o):n(o)}function i(e){return null===e||40===e||91===e||b1(e)||b5(e)?t(e):r(e)}function a(t){return bJ(t)?function t(i){return 59===i?(e.consume(i),r):bJ(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},b9={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return b0(e)?n(e):t(e)}},partial:!0},we={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!wa.call(r,r.previous)||wc(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(b4,e.attempt(b6,e.attempt(b8,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:wa},wt={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",a=!1;return function(t){return(72===t||104===t)&&wo.call(r,r.previous)&&!wc(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):n(t)};function o(t){if(bJ(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),s}return n(t)}function s(t){return 47===t?(e.consume(t),a)?l:(a=!0,s):n(t)}function l(t){return null===t||null!==t&&(t<32||127===t)||b1(t)||b5(t)||b2(t)?n(t):e.attempt(b6,e.attempt(b8,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:wo},wn={name:"emailAutolink",tokenize:function(e,t,n){let r,i,a=this;return function(t){return!wl(t)||!ws.call(a,a.previous)||wc(a.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return wl(r)?(e.consume(r),t):64===r?(e.consume(r),o):n(r)}(t))};function o(t){return 46===t?e.check(b9,l,s)(t):45===t||95===t||b0(t)?(i=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),r=!0,o}function l(o){return i&&r&&bJ(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:ws},wr={},wi=48;for(;wi<123;)wr[wi]=wn,58==++wi?wi=65:91===wi&&(wi=97);function wa(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||b1(e)}function wo(e){return!bJ(e)}function ws(e){return!(47===e||wl(e))}function wl(e){return 43===e||45===e||46===e||95===e||b0(e)}function wc(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function wu(e){return null!==e&&(e<0||32===e)}function wd(e){return -2===e||-1===e||32===e}function wh(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wf(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return wd(r)?(e.enter(n),function r(o){return wd(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}wr[43]=wn,wr[45]=wn,wr[46]=wn,wr[95]=wn,wr[72]=[wn,wt],wr[104]=[wn,wt],wr[87]=[wn,we],wr[119]=[wn,we],wh(/[A-Za-z]/),wh(/[\dA-Za-z]/),wh(/[#-'*+\--9=?A-Z^-~]/),wh(/\d/),wh(/[\dA-Fa-f]/),wh(/[!-/:-@[-`{-~]/),wh(/\p{P}|\p{S}/u),wh(/\s/);let wp={tokenize:function(e,t,n){let r=this;return wf(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function wm(e,t,n){let r,i=this,a=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;a--;){let e=i.events[a][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!r||!r._balanced)return n(a);let s=xX(i.sliceSerialize({start:r.end,end:i.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):n(a)}}function wg(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function wv(e,t,n){let r,i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!r||null===s||91===s||wu(s))return n(s);if(93===s){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return a.includes(xX(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return wu(s)||(r=!0),o++,e.consume(s),92===s?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function wx(e,t,n){let r,i,a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(s>999||93===t&&!i||null===t||91===t||wu(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=xX(a.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return wu(t)||(i=!0),s++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),s++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(r)||o.push(r),wf(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function wy(e,t,n){return e.check(xa,t,e.attempt(wp,t,n))}function wb(e){e.exit("gfmFootnoteDefinition")}function ww(e){return null!==e&&e<-2}function wj(e){return null!==e&&(e<0||32===e)}function wN(e){return -2===e||-1===e||32===e}function wk(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wE(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return wN(r)?(e.enter(n),function r(o){return wN(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}wk(/[A-Za-z]/),wk(/[\dA-Za-z]/),wk(/[#-'*+\--9=?A-Z^-~]/),wk(/\d/),wk(/[\dA-Fa-f]/),wk(/[!-/:-@[-`{-~]/),wk(/\p{P}|\p{S}/u),wk(/\s/);class wC{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function w_(e,t,n){let r,i=this,a=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,a="tableHead"===r||"tableRow"===r?y:s;return a===y&&i.parser.lazy[i.now().line]?n(e):a(e)};function s(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,o+=1),l(n)}function l(t){return null===t?n(t):ww(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):wN(t)?wE(e,l,"whitespace")(t):(o+=1,r&&(r=!1,a+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,l):(e.enter("data"),c(t))}function c(t){return null===t||124===t||wj(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,wN(t))?wE(e,h,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t)}function h(t){return 45===t||58===t?p(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return wN(t)?wE(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(o+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(o+=1,g(t)):null===t||ww(t)?x(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(n))}(t)):n(t)}function v(t){return wN(t)?wE(e,x,"whitespace")(t):x(t)}function x(i){if(124===i)return h(i);if(null===i||ww(i))return r&&a===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function y(t){return e.enter("tableRow"),b(t)}function b(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),b):null===n||ww(n)?(e.exit("tableRow"),t(n)):wN(n)?wE(e,b,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||wj(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?j:w)}function j(t){return 92===t||124===t?(e.consume(t),w):w(t)}}function wS(e,t){let n,r,i,a=-1,o=!0,s=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0,h=new wC;for(;++a<e.length;){let f=e[a],p=f[1];"enter"===f[0]?"tableHead"===p.type?(u=!1,0!==d&&(wA(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(o=!0,i=void 0,l=[0,0,0,0],c=[0,a+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",r,t]])),s="tableDelimiterRow"===p.type?2:r?3:1):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)?(o=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=wT(h,t,l,s,void 0,i),l=[0,0,0,0]),c[2]=a)):"tableCellDivider"===p.type&&(o?o=!1:(0!==l[1]&&(c[0]=c[1],i=wT(h,t,l,s,void 0,i)),c=[(l=c)[1],a,0,0])):"tableHead"===p.type?(u=!0,d=a):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=a,0!==l[1]?(c[0]=c[1],i=wT(h,t,l,s,a,i)):0!==c[1]&&(i=wT(h,t,c,s,a,i)),s=0):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(c[3]=a)}for(0!==d&&wA(h,t,d,n,r),h.consume(t.events),a=-1;++a<t.events.length;){let e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,a))}return e}function wT(e,t,n,r,i,a){0!==n[0]&&(a.end=Object.assign({},wO(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));let o=wO(t.events,n[1]);if(a={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",a,t]]),0!==n[2]){let i=wO(t.events,n[2]),a=wO(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(a.end=Object.assign({},wO(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function wA(e,t,n,r,i){let a=[],o=wO(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function wO(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}function wM(e){return -2===e||-1===e||32===e}function wP(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}wP(/[A-Za-z]/),wP(/[\dA-Za-z]/),wP(/[#-'*+\--9=?A-Z^-~]/),wP(/\d/),wP(/[\dA-Fa-f]/),wP(/[!-/:-@[-`{-~]/),wP(/\p{P}|\p{S}/u),wP(/\s/);let wD={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return null!==t&&(t<0||32===t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),a):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),a):n(t)}function a(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return null!==r&&r<-2?t(r):wM(r)?e.check({tokenize:wL},t,n)(r):n(r)}}};function wL(e,t,n){var r,i;let a,o;return r=function(e){return null===e?n(e):t(e)},i="whitespace",a=1/0,o=0,function(t){return wM(t)?(e.enter(i),function t(n){return wM(n)&&o++<a?(e.consume(n),t):(e.exit(i),r(n))}(t)):r(t)}}let wI={};function wR(e){let t,n,r,i=e||wI,a=this.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),s=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(vK([{text:wr},{document:{91:{name:"gfmFootnoteDefinition",tokenize:wx,continuation:{tokenize:wy},exit:wb}},text:{91:{name:"gfmFootnoteCall",tokenize:wv},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wm,resolveTo:wg}}},(t=(i||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,a=this.events,o=0;return function(s){return 126===i&&"characterEscape"!==a[a.length-1][1].type?r(s):(e.enter("strikethroughSequenceTemporary"),function a(s){let l=xw(i);if(126===s)return o>1?r(s):(e.consume(s),o++,a);if(o<2&&!t)return r(s);let c=e.exit("strikethroughSequenceTemporary"),u=xw(s);return c._open=!u||2===u&&!!l,c._close=!l||2===l&&!!u,n(s)}(s))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",a,t]],s=t.parser.constructs.insideSpan.null;s&&vX(o,o.length,0,xj(s,e.slice(r+1,n),t)),vX(o,o.length,0,[["exit",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),vX(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:w_,resolveAll:wS}}},{text:{91:wD}}])),s.push([{transforms:[bb],enter:{literalAutolink:bp,literalAutolinkEmail:bm,literalAutolinkHttp:bm,literalAutolinkWww:bm},exit:{literalAutolink:by,literalAutolinkEmail:bx,literalAutolinkHttp:bg,literalAutolinkWww:bv}},{enter:{gfmFootnoteCallString:bk,gfmFootnoteCall:bE,gfmFootnoteDefinitionLabelString:bC,gfmFootnoteDefinition:b_},exit:{gfmFootnoteCallString:bS,gfmFootnoteCall:bT,gfmFootnoteDefinitionLabelString:bA,gfmFootnoteDefinition:bO}},{canContainEols:["delete"],enter:{strikethrough:bI},exit:{strikethrough:bR}},{enter:{table:bH,tableData:bX,tableHeader:bX,tableRow:bY},exit:{codeText:b$,table:bW,tableData:bG,tableHeader:bG,tableRow:bG}},{exit:{taskListCheckValueChecked:bK,taskListCheckValueUnchecked:bK,paragraph:bZ}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bh,notInConstruct:bf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bh,notInConstruct:bf},{character:":",before:"[ps]",after:"\\/",inConstruct:bh,notInConstruct:bf}]},(r=!1,i&&i.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,t,n,i){let a=n.createTracker(i),o=a.move("[^"),s=n.enter("footnoteDefinition"),l=n.enter("label");return o+=a.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,a.current()),r?bD:bP))),s(),o},footnoteReference:bM},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:bL}],handlers:{delete:bB}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=bV(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return s(function(e,t,n){let r=e.children,i=-1,a=[],o=t.enter("table");for(;++i<r.length;)a[i]=l(r[i],t,n);return o(),a}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=s([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function s(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||bz,a=[],o=[],s=[],l=[],c=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>c&&(c=e[u].length);++a<e[u].length;){var d;let o=null==(d=e[u][a])?"":String(d);if(!1!==n.alignDelimiters){let e=i(o);r[a]=e,(void 0===l[a]||e>l[a])&&(l[a]=e)}t.push(o)}o[u]=t,s[u]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<c;)a[h]=bF(r[h]);else{let e=bF(r);for(;++h<c;)a[h]=e}h=-1;let f=[],p=[];for(;++h<c;){let e=a[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),p[h]=i),f[h]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let g=[];for(;++u<o.length;){let e=o[u],t=s[u];h=-1;let r=[];for(;++h<c;){let i=e[h]||"",o="",s="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=a[h];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(s),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==c-1)&&r.push("|")}g.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return g.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,a=[],s=t.enter("tableRow");for(;++i<r.length;)a[i]=o(r[i],e,t,n);return s(),a}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:bQ}}]})}function wB({children:e,className:t}){return(0,ep.jsx)("div",{className:(0,eO.cn)("text-[13px] leading-6 text-foreground/90 space-y-2 [&>:first-child]:mt-0",t),children:(0,ep.jsx)(bo,{remarkPlugins:[wR],components:{h1:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h2:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h3:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),h4:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),p:e=>(0,ep.jsx)("p",{className:"my-1.5",...e}),ul:e=>(0,ep.jsx)("ul",{className:"list-disc pl-5 my-1.5 space-y-0.5",...e}),ol:e=>(0,ep.jsx)("ol",{className:"list-decimal pl-5 my-1.5 space-y-0.5",...e}),li:e=>(0,ep.jsx)("li",{className:"leading-6",...e}),strong:e=>(0,ep.jsx)("strong",{className:"font-semibold text-foreground",...e}),code:e=>(0,ep.jsx)("code",{className:"text-[12px] font-mono bg-muted/70 px-1 py-0.5 rounded",...e}),a:e=>(0,ep.jsx)("a",{className:"text-primary underline",...e}),table:e=>(0,ep.jsx)("div",{className:"overflow-x-auto my-2",children:(0,ep.jsx)("table",{className:"text-[12px] border-collapse",...e})}),th:e=>(0,ep.jsx)("th",{className:"text-left font-semibold px-2 py-1 border-b border-border",...e}),td:e=>(0,ep.jsx)("td",{className:"px-2 py-1 border-b border-border/50",...e})},children:e})})}var wz=e.i(59411),tV=tV;function wF({directiveId:e,onClose:t}){let n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(null),[o,s]=(0,em.useState)(!1),[l,c]=(0,em.useState)(null);(0,em.useEffect)(()=>{e&&r&&(async()=>{s(!0),c(null),a(null);try{let t=await eD.client.getDirective(r,e);a(t)}catch(e){console.error("Error loading directive:",e),c(e.message)}finally{s(!1)}})()},[e,r]);let u=null!==e;return(0,ep.jsx)(tH.Dialog,{open:u,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,ep.jsx)(wz.VisuallyHidden,{children:(0,ep.jsx)(tH.DialogTitle,{children:"Directive Details"})}),o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)(tV.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):l?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",l]})})}):i?(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-6",children:[(0,ep.jsxs)("div",{className:"pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:i.name}),!i.is_active&&(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-red-500/10 text-red-600 dark:text-red-400 text-xs font-medium",children:"Inactive"})]}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground/70",children:i.id})]}),(0,ep.jsxs)("div",{className:"flex gap-8",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:(n=new Date(i.created_at),`${n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Priority"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:i.priority})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Content"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bo,{remarkPlugins:[wR],children:i.content})})]}),i.tags&&i.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.tags.map((e,t)=>(0,ep.jsx)("span",{className:"px-2 py-0.5 bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded text-xs",children:e},t))})]})]}):null]})})}function wV(e){let t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(60>Math.abs(n))return n>=0?"just now":"in a moment";let r=n,i="second";for(let[e,t]of[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[1/0,"year"]]){if(Math.abs(r)<e)break;r/=e,i=t}return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-Math.round(r),i)}function wU(e){let t=new Date(e);return`${t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}function wH(e){return"directives"===e?{label:"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===e?{label:"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===e?{label:"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===e?{label:"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:"observation"===e?{label:"observation",color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"}:{label:e,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"}}let wW=["observation","experience","world","directives","mental-models"];function wY({based_on:e,onViewMemory:t,onViewDirective:n}){let r=(0,em.useMemo)(()=>{if(!e)return[];let t=Object.entries(e).map(([e,t])=>({factType:e,facts:t??[]})).filter(e=>e.facts.length>0);return t.sort((e,t)=>{let n=wW.indexOf(e.factType),r=wW.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),t},[e]);return 0===r.length?(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No based_on data."}):(0,ep.jsx)("div",{className:"space-y-4",children:r.map(e=>{let r=wH(e.factType);return(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${r.color}`,children:r.label}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.facts.length})]}),(0,ep.jsx)("ul",{className:"divide-y divide-border/50",children:e.facts.map((r,i)=>{let a="directives"===e.factType&&!!n||"directives"!==e.factType&&"mental-models"!==e.factType&&!!t;return(0,ep.jsxs)("li",{className:"group flex items-start gap-3 px-3 py-2 hover:bg-muted/30",children:[(0,ep.jsxs)("p",{className:"text-sm text-foreground leading-relaxed flex-1 min-w-0",children:[r.text,r.context&&(0,ep.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5",children:r.context})]}),a&&(0,ep.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===e.factType?n?.(r.id):t?.(r.id)},children:"View →"})]},r.id||i)})})]},e.factType)})})}function wG(e){return e.match(/\s+|[A-Za-z0-9_]+|[^\s\w]/g)||[]}function wX(e){return/^\s+$/.test(e)?" ":e}function w$(e,t){return e.map((e,n)=>"same"===e.type?(0,ep.jsx)("span",{children:e.text},n):(0,ep.jsx)("span",{className:"left"===t?"bg-red-500/25 text-red-800 dark:text-red-300 rounded-sm px-0.5":"bg-green-500/25 text-green-800 dark:text-green-300 rounded-sm px-0.5",children:e.text},n))}function wq({before:e,after:t}){let{left:n,right:r}=function(e,t){let n=e.split("\n"),r=t.split("\n"),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=i,c=a;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(s.push({type:"same",text:n[l-1]}),l--,c--):c>0&&(0===l||o[l][c-1]>=o[l-1][c])?(s.push({type:"added",text:r[c-1]}),c--):(s.push({type:"removed",text:n[l-1]}),l--);s.reverse();let u=[],d=[],h=0;for(;h<s.length;){let e=s[h];if("same"===e.type){u.push({type:"same",spans:[{type:"same",text:e.text}]}),d.push({type:"same",spans:[{type:"same",text:e.text}]}),h++;continue}let t=[],n=[];for(;h<s.length&&"same"!==s[h].type;)"removed"===s[h].type?t.push(s[h].text):n.push(s[h].text),h++;let r=Math.max(t.length,n.length);for(let e=0;e<r;e++){let r=e<t.length?t[e]:null,i=e<n.length?n[e]:null;if(null!==r&&null!==i){let e=function(e,t){let n=wG(e),r=wG(t),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=wX(n[e-1])===wX(r[t-1])?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=[],c=i,u=a,d=[],h=[];for(;c>0||u>0;)if(c>0&&u>0&&wX(n[c-1])===wX(r[u-1]))d.push({type:"same",text:n[c-1]}),h.push({type:"same",text:r[u-1]}),c--,u--;else if(u>0&&(0===c||o[c][u-1]>=o[c-1][u])){let e=r[u-1];h.push({type:/^\s+$/.test(e)?"same":"added",text:e}),u--}else{let e=n[c-1];d.push({type:/^\s+$/.test(e)?"same":"removed",text:e}),c--}for(;d.length;)s.push(d.pop());for(;h.length;)l.push(h.pop());return{left:s,right:l}}(r,i),t=e.left.some(e=>"same"!==e.type)?"removed":"same",n=e.right.some(e=>"same"!==e.type)?"added":"same";u.push({type:t,spans:e.left}),d.push({type:n,spans:e.right})}else null!==r?(u.push({type:"removed",spans:[{type:"removed",text:r}]}),d.push({type:"same",spans:[{type:"same",text:""}]})):null!==i&&(u.push({type:"same",spans:[{type:"same",text:""}]}),d.push({type:"added",spans:[{type:"added",text:i}]}))}}return{left:u,right:d}}(e,t);return n.some(e=>"same"!==e.type)||r.some(e=>"same"!==e.type)?(0,ep.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border border border-border rounded-md overflow-hidden text-xs font-mono",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"px-3 py-1.5 bg-muted text-muted-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:"Before"}),n.map((e,t)=>(0,ep.jsx)("div",{className:`px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem] ${"removed"===e.type?"bg-red-500/5":""}`,children:w$(e.spans,"left")},t))]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"px-3 py-1.5 bg-muted text-muted-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:"After"}),r.map((e,t)=>(0,ep.jsx)("div",{className:`px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem] ${"added"===e.type?"bg-green-500/5":""}`,children:w$(e.spans,"right")},t))]})]}):(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"unchanged"})}function wK({before:e,after:t,onViewMemory:n,onViewDirective:r}){let i=(0,em.useMemo)(()=>{let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]),r=[];for(let i of n){let n=(e?.[i]??[]).filter(Boolean),a=(t?.[i]??[]).filter(Boolean),o=new Set(n.map(e=>e.id)),s=new Set(a.map(e=>e.id)),l=a.filter(e=>!o.has(e.id)),c=n.filter(e=>!s.has(e.id)),u=a.filter(e=>o.has(e.id));(0!==l.length||0!==c.length||0!==u.length)&&r.push({factType:i,added:l,removed:c,kept:u})}return r.sort((e,t)=>{let n=wW.indexOf(e.factType),r=wW.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),r},[e,t]);if(0===i.length)return(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No based_on data."});let a=(e,t,i)=>(0,ep.jsxs)("li",{className:`group flex items-start gap-2 px-3 py-2 ${"added"===i?"bg-green-500/10 border-l-2 border-green-500":"removed"===i?"bg-red-500/10 border-l-2 border-red-500 text-muted-foreground line-through decoration-red-500/50":""}`,children:[(0,ep.jsx)("span",{className:`font-mono text-sm shrink-0 ${"added"===i?"text-green-600 dark:text-green-400":"removed"===i?"text-red-600 dark:text-red-400":"text-muted-foreground/40"}`,children:"added"===i?"+":"removed"===i?"−":" "}),(0,ep.jsxs)("p",{className:"text-sm leading-relaxed flex-1 min-w-0",children:[e.text,e.context&&(0,ep.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5 no-underline",children:e.context})]}),("directives"===t&&!!r||"directives"!==t&&"mental-models"!==t&&!!n)&&"removed"!==i&&(0,ep.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===t?r(e.id):n(e.id)},children:"View →"})]},`${i}-${e.id}`);return(0,ep.jsx)("div",{className:"space-y-4",children:i.map(e=>{let t=wH(e.factType);return(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${t.color}`,children:t.label}),e.added.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400",children:["+",e.added.length]}),e.removed.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-red-600 dark:text-red-400",children:["−",e.removed.length]}),e.kept.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.kept.length," kept"]})]}),(0,ep.jsxs)("ul",{className:"divide-y divide-border/40",children:[e.added.map(t=>a(t,e.factType,"added")),e.removed.map(t=>a(t,e.factType,"removed")),e.kept.map(t=>a(t,e.factType,"kept"))]})]},e.factType)})})}function wZ({history:e,currentContent:t,currentBasedOn:n,onViewMemory:r,onViewDirective:i}){let[a,o]=(0,em.useState)(0),s=e[a],l=0===a?t:e[a-1].previous_content??"",c=s.previous_reflect_response?.based_on,u=0===a?n:e[a-1].previous_reflect_response?.based_on,d=s.previous_reflect_response??null;return(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-a]})," →"," ",(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-a+1,0===a?" (current)":""]})," ","· changed ",new Date(s.changed_at).toLocaleString()]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:a===e.length-1,onClick:()=>o(a+1),children:(0,ep.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===a,onClick:()=>o(a-1),children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w5,{children:"Content diff"}),null!==s.previous_content?(0,ep.jsx)(wq,{before:s.previous_content,after:l}):(0,ep.jsx)("div",{className:"border border-border rounded-lg p-3",children:(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"Previous content not available"})})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w5,{children:"Based on diff"}),d?.based_on?(0,ep.jsx)(wK,{before:c,after:u,onViewMemory:r,onViewDirective:i}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"Not captured for this version (recorded before reflect snapshots were tracked)."})]})]})}function wQ({mentalModelId:e,onClose:t,onEdit:n,onDelete:r,onRefreshed:i,initialTab:a="content"}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(a),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(null),[k,E]=(0,em.useState)(null),[C,_]=(0,em.useState)(!1);(0,em.useEffect)(()=>{e&&o&&(async()=>{u(!0),h(null),l(null),E(null),p(a);try{let t=await eD.client.getMentalModel(o,e);l(t)}catch(e){console.error("Error loading mental model:",e),h(e.message)}finally{u(!1)}})()},[e,o,a]),(0,em.useEffect)(()=>{"history"===f&&s&&o&&null===k&&(async()=>{_(!0);try{let e=await eD.client.getMentalModelHistory(o,s.id);E(e)}catch(e){console.error("Error loading mental model history:",e),E([])}finally{_(!1)}})()},[f,s,o,k]);let S=async()=>{if(o&&s){y(!0);try{let e=await eD.client.getMentalModel(o,s.id);l(e),E(null)}catch(e){console.error("Error reloading mental model:",e)}finally{y(!1)}}},T=async()=>{if(!o||!s)return;v(!0);let e=s.last_refreshed_at;try{await eD.client.refreshMentalModel(o,s.id);let t=0,n=async()=>{t++;try{let r=await eD.client.getMentalModel(o,s.id);if(r.last_refreshed_at!==e){l(r),E(null),i?.(r),v(!1);return}if(t>=120){v(!1),ev.toast.error("Refresh timeout",{description:"Refresh is taking longer than expected. Check the operations list for status."});return}setTimeout(n,1e3)}catch(e){console.error("Error polling mental model:",e),v(!1)}};setTimeout(n,1e3)}catch{v(!1)}},A=null!==e,O=s?.reflect_response?.based_on,M=O?Object.values(O).reduce((e,t)=>e+(t?.length??0),0):0;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.Dialog,{open:A,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tH.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,ep.jsx)(tH.DialogHeader,{className:"pr-10",children:(0,ep.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"truncate",children:s?.name??"Mental Model"}),s&&(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:S,disabled:x,title:"Reload data",children:(0,ep.jsx)(eU,{className:`h-3.5 w-3.5 ${x?"animate-spin":""}`})}),s?.trigger?.refresh_after_consolidation&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-500/10 text-green-600 dark:text-green-400 text-xs font-medium",children:[(0,ep.jsx)(gV,{className:"w-3 h-3"}),"Auto refresh"]})]})}),c?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsx)(tV.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):d?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",d]})})}):s?(0,ep.jsxs)(tY.Tabs,{value:f,onValueChange:e=>p(e),className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ep.jsxs)(tY.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ep.jsxs)(tY.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,ep.jsxs)(tY.TabsTrigger,{value:"configuration",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),"Configuration"]}),(0,ep.jsxs)(tY.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(tU,{className:"w-3.5 h-3.5"}),"History"]})]}),(0,ep.jsxs)(gN,{children:[(0,ep.jsx)(gE,{asChild:!0,children:(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:g,"aria-label":"Actions",children:(0,ep.jsx)(gU,{className:"h-4 w-4"})})}),(0,ep.jsxs)(gB,{align:"end",children:[n&&(0,ep.jsxs)(gz,{onClick:()=>n(s),children:[(0,ep.jsx)(po,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(gz,{onClick:T,disabled:g,children:[(0,ep.jsx)(eU,{className:"h-4 w-4 mr-2"}),"Refresh Manually"]}),r&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(gF,{}),(0,ep.jsxs)(gz,{onClick:()=>r(s),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(pa,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsxs)(tY.TabsContent,{value:"content",className:"mt-0 space-y-6",children:[(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),(0,ep.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:"Stored content"}),(0,ep.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",s.content.length.toLocaleString()," chars"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[!0===s.is_stale?(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-amber-500/15 text-amber-700 dark:text-amber-400",title:"New memories in this mental model's scope have been ingested since it was last refreshed",children:"Stale"}):!1===s.is_stale?(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-green-500/15 text-green-700 dark:text-green-400",title:"No new memories in this mental model's scope since it was last refreshed",children:"In sync"}):null,(0,ep.jsxs)("span",{title:wU(s.last_refreshed_at),className:"flex items-center gap-1",children:[(0,ep.jsx)(eU,{className:"w-3 h-3"}),"Last refreshed ",wV(s.last_refreshed_at)]})]})]}),(0,ep.jsx)(wB,{className:"p-4",children:s.content})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(w5,{children:["Based On",M>0?` (${M})`:""]}),s.reflect_response?(0,ep.jsx)(wY,{based_on:O,onViewMemory:e=>w(e),onViewDirective:e=>N(e)}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:'No source data available. Click "Refresh" to regenerate with source tracking.'})]})]}),(0,ep.jsx)(tY.TabsContent,{value:"configuration",className:"mt-0",children:(0,ep.jsx)(w2,{mentalModel:s})}),(0,ep.jsx)(tY.TabsContent,{value:"history",className:"mt-0",children:C?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tV.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):k&&k.length>0?(0,ep.jsx)(wZ,{history:k,currentContent:s.content,currentBasedOn:O,onViewMemory:e=>w(e),onViewDirective:e=>N(e)}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No history recorded yet."})})]})]}):null]})}),b&&(0,ep.jsx)(tQ,{memoryId:b,onClose:()=>w(null)}),j&&(0,ep.jsx)(wF,{directiveId:j,onClose:()=>N(null)})]})}function wJ({label:e,value:t}){return(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w5,{children:e}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:t})]})}function w0({title:e,icon:t,children:n}){return(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t,e]}),(0,ep.jsx)("div",{className:"p-4 space-y-4",children:n})]})}function w1({label:e,color:t}){return(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-xs ${t??"bg-muted text-foreground border border-border/60"}`,children:e})}function w2({mentalModel:e}){let t=e.trigger??{refresh_after_consolidation:!1},n=t.fact_types??[],r=t.tag_groups??[],i=t.exclude_mental_model_ids??[];return(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsxs)(w0,{title:"Identity",icon:(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(wJ,{label:"ID",value:(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:e.id})}),(0,ep.jsx)(wJ,{label:"Name",value:e.name}),e.source_query&&(0,ep.jsx)(wJ,{label:"Source Query",value:e.source_query}),(0,ep.jsx)(wJ,{label:"Tags",value:e.tags?.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,ep.jsx)(w1,{label:e,color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"},e))}):(0,ep.jsx)("span",{className:"text-muted-foreground italic text-sm",children:"none"})})]}),(0,ep.jsxs)(w0,{title:"Timing",icon:(0,ep.jsx)(eU,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(wJ,{label:"Created",value:wU(e.created_at)}),(0,ep.jsx)(wJ,{label:"Last Refreshed",value:(0,ep.jsx)("span",{title:wU(e.last_refreshed_at),children:wV(e.last_refreshed_at)})}),(0,ep.jsx)(wJ,{label:"Max Tokens",value:e.max_tokens.toLocaleString()})]}),(0,ep.jsxs)(w0,{title:"Refresh Trigger",icon:(0,ep.jsx)(gV,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(wJ,{label:"Refresh mode",value:"delta"===t.mode?(0,ep.jsx)(w1,{label:"Delta",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}):(0,ep.jsx)(w1,{label:"Full"})}),(0,ep.jsx)(wJ,{label:"Auto-refresh after consolidation",value:t.refresh_after_consolidation?(0,ep.jsx)(w1,{label:"Enabled",color:"bg-green-500/10 text-green-600 dark:text-green-400"}):(0,ep.jsx)(w1,{label:"Disabled"})}),(0,ep.jsx)(wJ,{label:"Fact types",value:n.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(e=>{let t=wH(e);return(0,ep.jsx)(w1,{label:t.label,color:t.color},e)})}):(0,ep.jsx)("span",{className:"text-muted-foreground italic text-sm",children:"all"})}),(0,ep.jsx)(wJ,{label:"Exclude mental models",value:t.exclude_mental_models?"Yes":"No"}),i.length>0&&(0,ep.jsx)(wJ,{label:"Excluded IDs",value:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(e=>(0,ep.jsx)("code",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted border border-border/60",children:e},e))})})]}),(0,ep.jsxs)(w0,{title:"Recall Parameters",icon:(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(wJ,{label:"Include chunks",value:null==t.include_chunks?"default":t.include_chunks?"Yes":"No"}),(0,ep.jsx)(wJ,{label:"Recall max tokens",value:null!=t.recall_max_tokens?t.recall_max_tokens.toLocaleString():"default"}),(0,ep.jsx)(wJ,{label:"Recall chunks max tokens",value:null!=t.recall_chunks_max_tokens?t.recall_chunks_max_tokens.toLocaleString():"default"}),(0,ep.jsx)(wJ,{label:"Tags match",value:t.tags_match?(0,ep.jsx)(w1,{label:t.tags_match}):"default"})]}),r.length>0&&(0,ep.jsx)("div",{className:"md:col-span-2",children:(0,ep.jsx)(w0,{title:"Tag Groups",icon:(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),children:(0,ep.jsx)("pre",{className:"text-xs font-mono bg-muted/40 rounded p-3 overflow-x-auto border border-border/60",children:JSON.stringify(r,null,2)})})})]})}function w5({children:e}){return(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:e})}function w3(){let e,t,n,r,i,a,o,s,l,c,u,{currentBank:d}=(0,ey.useBank)(),[h,f]=(0,em.useState)(""),[p,g]=(0,em.useState)("mid"),[v,x]=(0,em.useState)(4096),[y,b]=(0,em.useState)(!0),[w,j]=(0,em.useState)(!0),[N,k]=(0,em.useState)("answer"),[E,C]=(0,em.useState)(null),[_,S]=(0,em.useState)(!1),[T,A]=(0,em.useState)(""),[O,M]=(0,em.useState)("any"),[P,D]=(0,em.useState)([]),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(""),[z,F]=(0,em.useState)(""),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(!1),[Y,G]=(0,em.useState)(null),[X,$]=(0,em.useState)(null),[q,K]=(0,em.useState)(null),[Z,Q]=(0,em.useState)(!1),[J,ee]=(0,em.useState)(null),[et,en]=(0,em.useState)(null),[er,ei]=(0,em.useState)(!1),[ea,eo]=(0,em.useState)(null),[es,el]=(0,em.useState)("world"),ec="General Feedback",eu=async e=>{if(ee(e),en(null),d&&e?.id){ei(!0);try{let t=await eD.client.listObservations(d),n=t.items?.find(t=>t.id===e.id);en(n||e)}catch(t){console.error("Failed to load observation:",t),en(e)}finally{ei(!1)}}},ed=async()=>{if(d&&z.trim()){U(!0);try{let e=await eD.client.listDirectives(d),t=e.items?.find(e=>e.name===ec);if(t){let e=t.content?`${t.content}
8
- ${z.trim()}`:z.trim();await eD.client.updateDirective(d,t.id,{content:e})}else await eD.client.createDirective(d,{name:ec,content:z.trim()});F(""),W(!0),setTimeout(()=>W(!1),3e3)}catch(e){}finally{U(!1)}}},eh=async()=>{if(d&&h){S(!0),k("answer");try{let e=T.split(",").map(e=>e.trim()).filter(e=>e.length>0),t=R.split(",").map(e=>e.trim()).filter(e=>e.length>0),n=await eD.client.reflect({bank_id:d,query:h,budget:p,max_tokens:v,include_facts:y,include_tool_calls:w,...e.length>0&&{tags:e,tags_match:O},...P.length>0&&{fact_types:P},...L&&{exclude_mental_models:!0},...t.length>0&&{exclude_mental_model_ids:t}});C(n)}catch(e){}finally{S(!1)}}};return d?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(pv,{children:(0,ep.jsxs)(pw,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ek,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"text",value:h,onChange:e=>f(e.target.value),placeholder:"What would you like to reflect on?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&eh()})]}),(0,ep.jsx)(eL.Button,{onClick:eh,disabled:_||!h,className:"h-12 px-8",children:_?"Reflecting...":"Reflect"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Budget:"}),(0,ep.jsxs)(tR.Select,{value:p,onValueChange:e=>g(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tR.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tR.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eI.Input,{type:"number",value:v,onChange:e=>x(parseInt(e.target.value)||4096),className:"w-24 h-8"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(pd.Checkbox,{checked:y,onCheckedChange:e=>b(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Source"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(pd.Checkbox,{checked:w,onCheckedChange:e=>j(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Tools"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(eX,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eI.Input,{type:"text",value:T,onChange:e=>A(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tR.Select,{value:O,onValueChange:e=>M(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(pm,{value:P,onChange:D}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(pd.Checkbox,{checked:L,onCheckedChange:e=>I(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Exclude mental models"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Exclude IDs:"}),(0,ep.jsx)(eI.Input,{type:"text",value:R,onChange:e=>B(e.target.value),placeholder:"model-a, model-b",className:"h-8 w-48"})]})]})]})}),_&&(0,ep.jsx)(pv,{children:(0,ep.jsxs)(pw,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Reflecting on memories..."})]})}),!_&&E&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[E.usage&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Input tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.usage.input_tokens?.toLocaleString()})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Output tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.usage.output_tokens?.toLocaleString()})]})]}),E.trace?.tool_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Tool calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.trace.tool_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",E.trace.tool_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),E.trace?.llm_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"LLM calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.trace.llm_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",E.trace.llm_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["answer","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>k(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${N===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"answer"===e?"Answer":"trace"===e?"Trace":"JSON"},e))})]}),"answer"===N&&(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)(pv,{children:[(0,ep.jsx)(px,{children:(0,ep.jsx)(py,{children:"Answer"})}),(0,ep.jsx)(pw,{children:(0,ep.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bo,{remarkPlugins:[wR],children:E.text})})})]}),(0,ep.jsxs)(pv,{className:"border-blue-200 dark:border-blue-800",children:[(0,ep.jsxs)(px,{className:"py-4",children:[(0,ep.jsxs)(py,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(pk,{className:"w-4 h-4"}),"Add Directive"]}),(0,ep.jsx)(pb,{className:"text-xs",children:"Hard rules injected into prompts that the agent must follow"})]}),(0,ep.jsx)(pw,{className:"pt-0",children:H?(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,ep.jsx)("span",{className:"text-lg",children:"✓"}),(0,ep.jsxs)("span",{className:"text-sm font-medium",children:["Directive saved to ",ec]})]}):(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsx)(p_.Textarea,{value:z,onChange:e=>F(e.target.value),placeholder:"e.g., Always respond in formal English...",className:"flex-1 min-h-[60px] resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&ed()}}),(0,ep.jsx)(eL.Button,{onClick:ed,disabled:V||!z.trim(),className:"self-end",children:V?"Saving...":"Save"})]})})]})]}),"trace"===N&&(0,ep.jsxs)("div",{className:"space-y-4",children:[E.observations_created&&E.observations_created.length>0&&(0,ep.jsxs)(pv,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsxs)(px,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,ep.jsxs)(py,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(pN,{className:"w-4 h-4 text-emerald-600"}),"Observations Created (",E.observations_created.length,")"]}),(0,ep.jsx)(pb,{className:"text-xs",children:"New observations learned during this reflection"})]}),(0,ep.jsx)(pw,{className:"pt-4",children:(0,ep.jsx)("div",{className:"space-y-2",children:E.observations_created.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-emerald-50 dark:bg-emerald-950/50 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsx)("div",{className:"font-medium text-sm text-emerald-900 dark:text-emerald-100",children:e.name}),(0,ep.jsx)("div",{className:"text-xs text-emerald-700 dark:text-emerald-300 mt-1",children:e.description}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-2 font-mono",children:["ID: ",e.id]})]},t))})})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,ep.jsxs)(pv,{className:"h-fit",children:[(0,ep.jsxs)(px,{className:"pb-3",children:[(0,ep.jsx)(py,{className:"text-base",children:"Execution Trace"}),(0,ep.jsxs)(pb,{className:"text-xs",children:[E.iterations||0," iteration",1!==(E.iterations||0)?"s":""," •"," ",(E.trace?.llm_calls?.reduce((e,t)=>e+t.duration_ms,0)||0)+(E.trace?.tool_calls?.reduce((e,t)=>e+t.duration_ms,0)||0),"ms total"]})]}),(0,ep.jsx)(pw,{children:w?E.trace?.llm_calls&&E.trace.llm_calls.length>0||E.trace?.tool_calls&&E.trace.tool_calls.length>0?(0,ep.jsx)("div",{className:"max-h-[500px] overflow-y-auto pr-2",children:(e=E.trace?.llm_calls||[],t=E.trace?.tool_calls||[],n=[],e.forEach((r,i)=>{let a=t.filter(e=>e.iteration===i+1),o=i===e.length-1,s=r.scope.includes("final")||o&&0===a.length,l=s?e.length:i+1;n.push({type:"llm",llm:r,iteration:l,isFinal:s}),a.length>0&&n.push({type:"tools",tools:a,iteration:i+1})}),n.map((e,t)=>(0,ep.jsxs)("div",{className:"relative",children:[t<n.length-1&&(0,ep.jsx)("div",{className:"absolute left-3 top-6 bottom-0 w-0.5 bg-border"}),"llm"===e.type?(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${e.isFinal?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-primary/10 text-primary"}`,children:e.isFinal?(0,ep.jsx)(tF.Check,{className:"w-3.5 h-3.5",strokeWidth:2.5}):(0,ep.jsx)("span",{className:"text-[10px] font-semibold",children:e.iteration})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("span",{className:"font-medium text-sm",children:e.isFinal?"Response generated":"Agent decided"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),e.llm.duration_ms,"ms"]})]}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.isFinal?"Final answer":"Called tools below"})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-blue-500/15 text-blue-600 dark:text-blue-400 flex-shrink-0",children:(0,ep.jsx)(pC,{className:"w-3 h-3",fill:"currentColor"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Executing ",e.tools?.length," tool",e.tools?.length!==1?"s":""]}),e.tools?.map((e,t)=>(0,ep.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/50",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.tool}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),e.duration_ms,"ms"]})]}),(0,ep.jsxs)("div",{className:"p-2 space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Input:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(ms,{src:e.input,collapsed:1,theme:"default"})})]}),e.output&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Output:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(ms,{src:e.output,collapsed:1,theme:"default"})})]})]})]},t))]})]})]},t)))}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(pj.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"No operations"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"No LLM or tool calls were made during this reflection."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(pj.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Tool Calls" to see trace.'})]})]})})]}),(0,ep.jsxs)(pv,{className:"h-fit",children:[(0,ep.jsxs)(px,{className:"pb-3",children:[(0,ep.jsx)(py,{className:"text-base",children:"Based On"}),(0,ep.jsxs)(pb,{className:"text-xs",children:[(E.based_on?.memories?.length||0)+(E.based_on?.observations?.filter(e=>"directive"!==e.subtype)?.length||0)+(E.based_on?.directives?.length||0)," ","items used"]})]}),(0,ep.jsx)(pw,{children:y?E.based_on?.memories&&E.based_on.memories.length>0||E.based_on?.mental_models&&E.based_on.mental_models.length>0||E.based_on?.directives&&E.based_on.directives.length>0||E.based_on?.observations&&E.based_on.observations.length>0?(i=(r=E.based_on?.memories||[]).filter(e=>"world"===e.type),a=r.filter(e=>"experience"===e.type),o=E.based_on?.mental_models||[],s=(E.based_on?.observations||[]).filter(e=>"directive"!==e.subtype),c=[{id:"directives",label:"Directives",count:(l=E.based_on?.directives||[]).length},{id:"mental_models",label:"Mental Models",count:o.length},{id:"observations",label:"Observations",count:s.length},{id:"world",label:"World",count:i.length},{id:"experience",label:"Experience",count:a.length}],u=(()=>{switch(es){case"directives":return l;case"mental_models":return o;case"observations":return s;case"world":return i;case"experience":return a;default:return[]}})(),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1 mb-4",children:c.map(e=>(0,ep.jsxs)("button",{onClick:()=>el(e.id),className:`flex-1 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${es===e.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.label," (",e.count,")"]},e.id))}),u.length>0?(0,ep.jsx)("div",{className:"max-h-[400px] overflow-y-auto pr-2 space-y-3",children:u.map((e,t)=>{let n,r;return(0,ep.jsx)("div",{className:`p-4 bg-muted/50 rounded-lg border border-border/50 ${"directives"!==es?"cursor-pointer hover:bg-muted/80 transition-colors":""}`,onClick:()=>{"directives"!==es&&("observations"===es?eu(e):"mental_models"===es?eo(e.id):G(e.id))},children:"directives"===es?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.content&&(0,ep.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.content})]}):"observations"===es?(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}):"mental_models"===es?(r=(n=e.text?.indexOf(": ")??-1)>0?e.text.slice(0,n):e.id,(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:r}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:e.id})]})):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:e.context})]})},e.id||t)})}):(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground text-center py-4",children:["No ",es," items"]})]})):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,ep.jsx)(pj.Info,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-amber-900 dark:text-amber-100",children:"No facts found"}),(0,ep.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 mt-0.5",children:"No memories were used to generate this answer."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(pj.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Source" to see memories.'})]})]})})]})]})]}),"json"===N&&(0,ep.jsxs)(pv,{children:[(0,ep.jsx)(px,{children:(0,ep.jsx)(py,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(pw,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(ms,{src:E,collapsed:2,theme:"default"})})})]})]}),!_&&!E&&(0,ep.jsx)(pv,{className:"border-dashed",children:(0,ep.jsxs)(pw,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ek,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a question above to query the memory bank and generate a disposition-aware response."})]})}),(0,ep.jsx)(tQ,{memoryId:Y,onClose:()=>G(null)}),X&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pE,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"icon",onClick:()=>{$(null),K(null)},children:(0,ep.jsx)(e$.X,{className:"w-4 h-4"})})]}),Z?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),(0,ep.jsx)("p",{className:"mt-1 font-medium",children:q?.name||X.name})]}),q?.description&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),(0,ep.jsx)("p",{className:"mt-1 text-sm",children:q.description})]}),q?.tags&&q.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:q.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eX,{className:"w-2.5 h-2.5"}),e]},e))})]}),(q?.content||X.content)&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Content"}),(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:q?.content||X.content})})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:X.id})]})]})]})}),J&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pN,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Observation"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"icon",onClick:()=>{ee(null),en(null)},children:(0,ep.jsx)(e$.X,{className:"w-4 h-4"})})]}),er?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Text"}),(0,ep.jsx)("div",{className:"mt-1 prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bo,{remarkPlugins:[wR],children:et?.text||J.text})})]}),et?.tags&&et.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:et.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eX,{className:"w-2.5 h-2.5"}),e]},e))})]}),et?.source_memories&&et.source_memories.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Source Memories (",et.source_memories.length,")"]}),(0,ep.jsx)("div",{className:"space-y-2",children:et.source_memories.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.text||("string"==typeof e?e:"")})},t))})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:J.id})]})]})]})}),(0,ep.jsx)(wQ,{mentalModelId:ea,onClose:()=>eo(null)})]}):(0,ep.jsx)(pv,{className:"border-dashed",children:(0,ep.jsxs)(pw,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eE,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start reflecting."})]})})}var w4=e.i(64659);let w6=(0,eN.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function w8(){let e,t,n,r,i,a,o,s,l,c,u,d,h,f,{currentBank:p}=(0,ey.useBank)(),[g,v]=(0,em.useState)(""),[x,y]=(0,em.useState)(["world"]),[b,w]=(0,em.useState)("mid"),[j,N]=(0,em.useState)(4096),[k,E]=(0,em.useState)(""),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(""),[M,P]=(0,em.useState)("any"),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),[U,H]=(0,em.useState)(null),[W,Y]=(0,em.useState)(!1),[G,X]=(0,em.useState)("results"),[$,q]=(0,em.useState)(null),[K,Z]=(0,em.useState)(new Set),[Q,J]=(0,em.useState)(new Set),ee=e=>{Z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},et=e=>{J(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},en=e=>{let t=e.id||e.node_id;q(D?.find(e=>e.id===t||e.node_id===t)||e)},er=async()=>{if(!p)return void ev.toast.error("Validation error",{description:"Please select a memory bank first"});if(g){if(0===x.length)return void ev.toast.error("Validation error",{description:"Please select at least one type (World, Experience, or Observations)"});Y(!0);try{let e=A.split(",").map(e=>e.trim()).filter(e=>e.length>0),t={bank_id:p,query:g,types:x,budget:b,max_tokens:j,trace:!0,include:{entities:S?{max_tokens:500}:null,chunks:C?{max_tokens:8192}:null},...k&&{query_timestamp:k},...e.length>0&&{tags:e,tags_match:M}},n=await eD.client.recall(t);L(n.results||[]),R(n.entities||null),z(n.chunks||null),V(n.observations||null),H(n.trace||null),X("results")}catch(e){}finally{Y(!1)}}};return p?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(pv,{children:(0,ep.jsxs)(pw,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ej.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"text",value:g,onChange:e=>v(e.target.value),placeholder:"What would you like to recall?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&er()})]}),(0,ep.jsx)(eL.Button,{onClick:er,disabled:W||!g,className:"h-12 px-8",children:W?"Searching...":"Recall"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(pm,{value:x,onChange:y,label:"Types:"}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(gV,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsxs)(tR.Select,{value:b,onValueChange:e=>w(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tR.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tR.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eI.Input,{type:"number",value:j,onChange:e=>N(parseInt(e.target.value)),className:"w-24 h-8"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eW,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"datetime-local",value:k,onChange:e=>E(e.target.value),className:"h-8",placeholder:"Query date"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(pd.Checkbox,{checked:C,onCheckedChange:e=>_(e)}),(0,ep.jsx)(eC.FileText,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Chunks"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(pd.Checkbox,{checked:S,onCheckedChange:e=>T(e)}),(0,ep.jsx)(e_,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Entities"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(eX,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eI.Input,{type:"text",value:A,onChange:e=>O(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tR.Select,{value:M,onValueChange:e=>P(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]})]})}),W&&(0,ep.jsx)(pv,{children:(0,ep.jsxs)(pw,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Searching memories..."})]})}),!W&&D&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U?.summary&&(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Results:"}),(0,ep.jsx)("span",{className:"font-semibold",children:D.length})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"}),(0,ep.jsxs)("span",{className:"font-semibold",children:[U.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Nodes visited:"}),(0,ep.jsx)("span",{className:"font-semibold",children:U.summary.total_nodes_visited})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>X(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${G===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===e?"Results":"trace"===e?"Trace":"JSON"},e))})]}),"results"===G&&(0,ep.jsxs)("div",{className:"space-y-4",children:[F&&F.length>0&&(0,ep.jsxs)(pv,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,ep.jsx)(px,{className:"py-3",children:(0,ep.jsxs)(py,{className:"text-base flex items-center gap-2",children:[(0,ep.jsx)(eE,{className:"h-4 w-4 text-orange-500"}),(0,ep.jsx)("span",{children:"Observations"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",F.length,")"]})]})}),(0,ep.jsx)(pw,{className:"pt-0 space-y-2",children:F.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-background rounded-lg border border-orange-500/20",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-orange-500/10 text-orange-600",children:"Observation"}),(0,ep.jsxs)("span",{children:["Proof count: ",e.proof_count||1]}),(0,ep.jsxs)("span",{children:["Relevance: ",(e.relevance||0).toFixed(3)]})]})]},e.id||t))})]}),(0,ep.jsx)("div",{className:"space-y-3",children:0!==D.length||F&&0!==F.length?D.map((e,t)=>{let n=U?.visits?.find(t=>t.node_id===e.id),r=n?n.weights.final_weight:e.score||0;return(0,ep.jsx)(pv,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>q(e),children:(0,ep.jsx)(pw,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-semibold text-primary",children:t+1})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:e.type||"world"}),e.context&&(0,ep.jsx)("span",{className:"truncate max-w-xs",children:e.context}),e.occurred_start&&(0,ep.jsx)("span",{children:new Date(e.occurred_start).toLocaleDateString()})]})]}),(0,ep.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,ep.jsx)("div",{className:"text-sm font-semibold",children:(r??0).toFixed(3)}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground",children:"score"})]}),(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)}):(0,ep.jsx)(pv,{children:(0,ep.jsxs)(pw,{className:"flex flex-col items-center justify-center py-12",children:[(0,ep.jsx)(ej.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No memories found for this query."})]})})})]}),"trace"===G&&U&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U.retrieval_results&&U.retrieval_results.length>0&&(e={},U.retrieval_results.forEach(t=>{let n=t.fact_type||"all";e[n]||(e[n]=[]),e[n].push(t)}),t=Object.keys(e),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,ep.jsx)("span",{children:"PARALLEL RETRIEVAL"}),(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:t.map((t,n)=>{let r=e[t],i=`lane-${t}`,a=K.has(i),o=r.reduce((e,t)=>e+(t.results?.length||0),0),s=Math.max(...r.map(e=>e.duration_seconds||0)),l={world:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/30"},experience:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},opinion:{bg:"bg-purple-500/10",text:"text-purple-500",border:"border-purple-500/30"},all:{bg:"bg-gray-500/10",text:"text-gray-500",border:"border-gray-500/30"}},c=l[t]||l.all;return(0,ep.jsx)(pv,{className:`transition-colors ${a?"border-primary":c.border}`,children:(0,ep.jsxs)(pw,{className:"py-3 px-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>ee(i),children:[(0,ep.jsx)("div",{className:`w-8 h-8 rounded-lg ${c.bg} flex items-center justify-center`,children:(0,ep.jsx)("span",{className:`text-sm font-bold ${c.text} capitalize`,children:t.charAt(0).toUpperCase()})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground capitalize",children:t}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r.length," methods"]})]}),(0,ep.jsx)("div",{className:"flex gap-1.5 mt-1",children:r.map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-muted text-muted-foreground capitalize",children:[e.method_name,": ",e.results?.length||0]},t))})]}),(0,ep.jsxs)("div",{className:"text-right",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:o}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[s.toFixed(2),"s"]})]}),a?(0,ep.jsx)(w4.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]}),a&&(0,ep.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,ep.jsx)("div",{className:`grid gap-3 ${1===r.length?"grid-cols-1":2===r.length?"grid-cols-2":3===r.length?"grid-cols-3":"grid-cols-4"}`,children:r.map((e,t)=>{let n,r,a,o,s=`${i}-method-${t}`,l=K.has(s),c=e.results||[];return(0,ep.jsxs)("div",{className:"flex flex-col",children:[(0,ep.jsxs)("div",{className:`p-3 rounded-lg cursor-pointer transition-colors ${l?"bg-primary/10 border border-primary":"bg-muted/50 hover:bg-muted"}`,onClick:e=>{e.stopPropagation(),ee(s)},children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:e.method_name}),"temporal"===e.method_name&&e.metadata?.constraint&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,ep.jsx)(eR,{className:"h-3 w-3"}),e.metadata.constraint.start?new Date(e.metadata.constraint.start).toLocaleDateString():"any"," → ",e.metadata.constraint.end?new Date(e.metadata.constraint.end).toLocaleDateString():"any"]})]}),l?(0,ep.jsx)(w4.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),(0,ep.jsxs)("div",{className:"flex items-end justify-between",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:c.length}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[e.duration_seconds?.toFixed(2),"s"]})]})]}),l&&c.length>0&&(n=`results-${s}`,a=(r=Q.has(n))?c:c.slice(0,5),o=c.length>5,(0,ep.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[a.map((e,t)=>(0,ep.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:e.text}),(0,ep.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(e.score||e.similarity||0).toFixed(4)})})]})]})},t)),o&&(0,ep.jsx)("button",{className:"w-full text-[10px] text-primary hover:text-primary/80 py-1.5 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(n)},children:r?"Show less":`View all ${c.length} results`})]}))]},s)})})})]})},i)})}),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)("div",{className:"flex items-center gap-2",children:t.map((e,t)=>{let n={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,ep.jsx)("div",{className:"flex flex-col items-center",children:(0,ep.jsx)("div",{className:`w-1 h-4 ${n[e]||n.all} rounded-full opacity-50`})},t)})})}),(0,ep.jsx)("div",{className:"flex justify-center",children:(0,ep.jsx)(w6,{className:"h-5 w-5 text-muted-foreground/50"})})]})),U.rrf_merged&&(n="rrf-merge",r=K.has(n),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(pv,{className:`cursor-pointer transition-colors ${r?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(n),children:(0,ep.jsx)(pw,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"RRF Fusion"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"merge"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Reciprocal Rank Fusion of all retrieval results"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.rrf_merged.length}),r?(0,ep.jsx)(w4.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),r&&U.rrf_merged.length>0&&(i="results-rrf",o=(a=Q.has(i))?U.rrf_merged:U.rrf_merged.slice(0,5),s=U.rrf_merged.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[o.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:["RRF Score: ",(e.rrf_score||e.score||0).toFixed(4)]})]})]})},t)),s&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(i)},children:a?"Show less":`View all ${U.rrf_merged.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(w6,{className:"h-4 w-4 text-muted-foreground/50"})})]})),U.reranked&&(l="reranking",c=K.has(l),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(pv,{className:`cursor-pointer transition-colors ${c?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(l),children:(0,ep.jsx)(pw,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Combined Scoring"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"rerank"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,ep.jsx)("span",{className:"font-mono text-xs",children:"ce × recency_boost(±10%) × temporal_boost(±10%)"})})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.reranked.length}),c?(0,ep.jsx)(w4.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),c&&U.reranked.length>0&&(u="results-rerank",h=(d=Q.has(u))?U.reranked:U.reranked.slice(0,5),f=U.reranked.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[h.map((e,t)=>{let n=e.score_components||{};return(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(e.rerank_score||e.score||0).toFixed(4)]}),void 0!==n.cross_encoder_score_normalized&&(0,ep.jsxs)("span",{title:"Cross-encoder score (primary relevance signal)",children:["CE: ",n.cross_encoder_score_normalized.toFixed(3)]}),void 0!==n.temporal&&.5!==n.temporal&&(0,ep.jsxs)("span",{title:"Temporal proximity boost (±10% — only active for temporal queries)",children:["Tmp: ",n.temporal.toFixed(3)]}),void 0!==n.recency&&(0,ep.jsxs)("span",{title:"Recency boost (±10% — based on memory age)",children:["Rec: ",n.recency.toFixed(3)]})]})]})]})},t)}),f&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(u)},children:d?"Show less":`View all ${U.reranked.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(w6,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,ep.jsx)(pv,{className:"border-primary bg-primary/5",children:(0,ep.jsx)(pw,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Final Results"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:"output"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Top results after all processing steps"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-primary",children:D?.length||0})]})})})]}),"json"===G&&(0,ep.jsxs)(pv,{children:[(0,ep.jsx)(px,{children:(0,ep.jsx)(py,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(pw,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(ms,{src:{results:D,...I&&{entities:I},...B&&{chunks:B},...F&&{observations:F},trace:U},collapsed:2,theme:"default"})})})]})]}),!W&&!D&&(0,ep.jsx)(pv,{className:"border-dashed",children:(0,ep.jsxs)(pw,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ej.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a query above to search through your memories. Use filters to narrow down by fact type, budget, and more."})]})}),$&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsx)(tJ,{memory:$,onClose:()=>q(null),inPanel:!0,bankId:p||void 0})})]}):(0,ep.jsx)(pv,{className:"border-dashed",children:(0,ep.jsxs)(pw,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eE,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start recalling."})]})})}let w7=(0,eN.default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var w9=e.i(82458),w9=w9,tV=tV;let je={skepticism:{label:"Skepticism",shortLabel:"S",description:"How skeptical vs trusting when forming observations",lowLabel:"Trusting",highLabel:"Skeptical"},literalism:{label:"Literalism",shortLabel:"L",description:"How literally to interpret information when forming observations",lowLabel:"Flexible",highLabel:"Literal"},empathy:{label:"Empathy",shortLabel:"E",description:"How much to consider emotional context when forming observations",lowLabel:"Detached",highLabel:"Empathetic"}};function jt({hideReflectFields:e=!1}){let t=(0,eg.useRouter)(),{currentBank:n,setCurrentBank:r,loadBanks:i}=(0,ey.useBank)(),{features:a}=(0,ew.useFeatures)();a?.observations;let[o,s]=(0,em.useState)(null),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)([]),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)([]),[v,x]=(0,em.useState)(0),[y,b]=(0,em.useState)(!1),[w,j]=(0,em.useState)(!1),[N,k]=(0,em.useState)(!1),[E,C]=(0,em.useState)(!1),[_,S]=(0,em.useState)(null),[T,A]=(0,em.useState)(null),[O,M]=(0,em.useState)(!1),[P,D]=(0,em.useState)(!1),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(!1),[z,F]=(0,em.useState)(!1),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(null),[Y]=(0,em.useState)(10),[G,X]=(0,em.useState)(0),[$,q]=(0,em.useState)(null),K=async(e=H,t=G)=>{if(n)try{let r=await eD.client.listOperations(n,{status:e||void 0,limit:Y,offset:t});d(r.operations||[]),f(r.total||0)}catch(e){console.error("Error loading operations:",e)}},Z=async(e=!1)=>{if(n){if(e){try{let[e,t,r]=await Promise.all([eD.client.getBankStats(n),eD.client.listDirectives(n),eD.client.listMentalModels(n)]);c(e),g(t.items||[]),x(r.items?.length||0)}catch(e){console.error("Error refreshing stats:",e)}return}b(!0);try{let[e,t,r,i]=await Promise.all([eD.client.getBankProfile(n),eD.client.getBankStats(n),eD.client.listDirectives(n),eD.client.listMentalModels(n)]);s(e),c(t),g(r.items||[]),x(i.items?.length||0),await K()}catch(e){}finally{b(!1)}}},Q=async()=>{if(n){I(!0);try{await eD.client.deleteBank(n),D(!1),r(null),await i(),t.push("/")}catch(e){}finally{I(!1)}}},J=async()=>{if(n){F(!0);try{let e=await eD.client.clearObservations(n);B(!1),await Z(),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{F(!1)}}},ee=async()=>{if(n&&T){M(!0);try{await eD.client.deleteDirective(n,T.id),g(e=>e.filter(e=>e.id!==T.id)),_?.id===T.id&&S(null),A(null)}catch(e){}finally{M(!1)}}};return((0,em.useEffect)(()=>{if(n){Z();let e=setInterval(()=>Z(!0),5e3);return()=>clearInterval(e)}},[n]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&S(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),n)?y&&!o?(0,ep.jsx)(pv,{children:(0,ep.jsxs)(pw,{className:"text-center py-10",children:[(0,ep.jsx)(eW,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,ep.jsx)("div",{className:"text-lg text-muted-foreground",children:"Loading profile..."})]})}):(0,ep.jsxs)("div",{className:"space-y-6",children:[!e&&(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ep.jsxs)(pv,{children:[(0,ep.jsx)(px,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(py,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(pN,{className:"w-5 h-5 text-primary"}),"Disposition Profile"]}),(0,ep.jsx)(pb,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)(eL.Button,{onClick:()=>j(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(po,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(pw,{children:o&&(0,ep.jsx)("div",{className:"space-y-4",children:Object.keys(je).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:je[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:je[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o.disposition[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:je[e].lowLabel}),(0,ep.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(o.disposition[e]-1)/4*100}%`}})}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:je[e].highLabel})]})]},e))})})]}),(0,ep.jsxs)(pv,{children:[(0,ep.jsx)(px,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(py,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(w7,{className:"w-5 h-5 text-primary"}),"Mission"]}),(0,ep.jsx)(pb,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)(eL.Button,{onClick:()=>k(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(po,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(pw,{children:(0,ep.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:o?.mission||"No mission set. Set a mission to derive structural mental models and personalize reflect responses."})})]})]}),(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,ep.jsx)(w9.default,{className:"w-5 h-5 text-rose-500"}),"Directives"]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"Hard rules that must be followed during reflect"})]}),(0,ep.jsxs)(eL.Button,{onClick:()=>C(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,ep.jsx)(fI.Plus,{className:"w-4 h-4 mr-1"}),"Add"]})]}),p.length>0?(0,ep.jsx)("div",{className:"grid grid-cols-2 gap-3",children:p.map(e=>(0,ep.jsx)(pv,{className:`cursor-pointer transition-colors border-rose-500/30 ${_?.id===e.id?"bg-rose-500/10 border-rose-500":"hover:bg-rose-500/5"}`,onClick:()=>S(e),children:(0,ep.jsx)(pw,{className:"p-3",children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)(w9.default,{className:"w-4 h-4 text-rose-500 shrink-0 mt-0.5"}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.name}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:e.content}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[(0,ep.jsx)(eX,{className:"w-3 h-3 text-muted-foreground"}),e.tags.map(e=>(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:e},e))]})]})]})})},e.id))}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-rose-500/30 rounded-lg text-center",children:[(0,ep.jsx)(w9.default,{className:"w-6 h-6 mx-auto mb-2 text-rose-500/50"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"No directives yet. Directives are hard rules that must be followed during reflect."})]})]}),(0,ep.jsx)(fY,{open:P,onOpenChange:D,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Memory Bank"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."}),l&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_nodes," memories, ",l.total_documents," ","documents, and ",l.total_links," links."]})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:L,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:Q,disabled:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:L?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eU,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(fY,{open:R,onOpenChange:B,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Clear Observations"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."}),l&&l.total_observations>0&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_observations," observations."]})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:z,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:J,disabled:z,className:"bg-amber-500 text-white hover:bg-amber-600",children:z?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})}),(0,ep.jsx)(ji,{open:E,mode:"create",onClose:()=>C(!1),onCreated:e=>{g(t=>[e,...t]),C(!1)}}),(0,ep.jsx)(fY,{open:!!T,onOpenChange:e=>!e&&A(null),children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Directive"}),(0,ep.jsxs)(pn,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',T?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(pe,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(pi,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(pr,{onClick:ee,disabled:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[O?(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),_&&(0,ep.jsx)(ja,{directive:_,onClose:()=>S(null),onDelete:()=>A({id:_.id,name:_.name}),onUpdated:e=>{g(t=>t.map(t=>t.id===e.id?e:t)),S(e)}}),w&&o&&(0,ep.jsx)(jn,{disposition:o.disposition,onClose:()=>j(!1),onSaved:async()=>{await Z(),j(!1)}}),N&&o&&(0,ep.jsx)(jr,{mission:o.mission||"",onClose:()=>k(!1),onSaved:async()=>{await Z(),k(!1)}})]}):(0,ep.jsx)(pv,{children:(0,ep.jsxs)(pw,{className:"p-10 text-center",children:[(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Please select a memory bank from the dropdown above to view its profile."})]})})}function jn({disposition:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eD.client.updateBankConfig(r,{disposition_skepticism:o.skepticism,disposition_literalism:o.literalism,disposition_empathy:o.empathy}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Edit Disposition Traits"}),(0,ep.jsx)(tH.DialogDescription,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)("div",{className:"space-y-4 py-4",children:Object.keys(je).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:je[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:je[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,ep.jsx)("span",{children:je[e].lowLabel}),(0,ep.jsx)("span",{children:je[e].highLabel})]}),(0,ep.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:o[e],onChange:t=>s(n=>({...n,[e]:parseInt(t.target.value)})),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]},e))}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eU,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function jr({mission:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eD.client.updateBankConfig(r,{reflect_mission:o||null}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Edit Mission"}),(0,ep.jsx)(tH.DialogDescription,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)("div",{className:"space-y-2 py-4",children:(0,ep.jsx)(p_.Textarea,{value:o,onChange:e=>s(e.target.value),placeholder:"e.g., I am a PM for the engineering team. I help coordinate sprints and track project progress...",rows:8,className:"resize-none"})}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eU,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function ji({open:e,mode:t,directive:n,onClose:r,onCreated:i,onSaved:a}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)({name:"",content:"",tags:""});(0,em.useEffect)(()=>{"edit"===t&&n?u({name:n.name,content:n.content,tags:(n.tags||[]).join(", ")}):"create"===t&&u({name:"",content:"",tags:""})},[e,t,n]);let d=async()=>{if(o&&c.name.trim()&&c.content.trim()){l(!0);try{let e=c.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0);if("create"===t){let t=await eD.client.createDirective(o,{name:c.name.trim(),content:c.content.trim(),tags:e.length>0?e:void 0});u({name:"",content:"",tags:""}),i?.(t)}else if(n){let t=await eD.client.updateDirective(o,n.id,{name:c.name.trim(),content:c.content.trim(),tags:e});a?.(t),r()}}catch(e){}finally{l(!1)}}},h=()=>{"create"===t&&u({name:"",content:"",tags:""}),r()};return(0,ep.jsx)(tH.Dialog,{open:e,onOpenChange:e=>!e&&h(),children:(0,ep.jsxs)(tH.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(w9.default,{className:"w-5 h-5 text-rose-500"}),"create"===t?"Create":"Edit"," Directive"]}),(0,ep.jsx)(tH.DialogDescription,{children:"Directives are hard rules that must be followed during reflect."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"e.g., Competitor Policy"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Rule *"}),(0,ep.jsx)(p_.Textarea,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:"e.g., Never mention competitor products directly.",className:"min-h-[120px]"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("label",{className:"text-sm font-medium text-foreground",children:["Tags ",(0,ep.jsx)("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),(0,ep.jsx)(eI.Input,{value:c.tags,onChange:e=>u({...c,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:h,disabled:s,children:"Cancel"}),(0,ep.jsxs)(eL.Button,{onClick:d,disabled:s||!c.name.trim()||!c.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[s?(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"create"===t?"Create":"Save"]})]})]})})}function ja({directive:e,onClose:t,onDelete:n,onUpdated:r}){let[i,a]=(0,em.useState)(!1);return(0,ep.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l-2 border-rose-500 shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:[(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-8 pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)(w9.default,{className:"w-5 h-5 text-rose-500"}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:e.name}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>a(!0),className:"h-7 w-7 p-0",children:(0,ep.jsx)(po,{className:"h-3.5 w-3.5"})})]}),(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-rose-500/10 text-rose-600 dark:text-rose-400",children:"directive"})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 text-muted-foreground hover:text-rose-500",children:(0,ep.jsx)(pa,{className:"h-4 w-4"})}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(e$.X,{className:"h-4 w-4"})})]})]}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Rule"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bo,{remarkPlugins:[wR],children:e.content})})]}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tags.map(e=>(0,ep.jsx)("span",{className:"px-2 py-1 rounded bg-muted text-muted-foreground text-sm",children:e},e))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"ID"}),(0,ep.jsx)("code",{className:"text-sm font-mono break-all text-muted-foreground",children:e.id})]})]})]}),(0,ep.jsx)(ji,{open:i,mode:"edit",directive:e,onClose:()=>a(!1),onSaved:r})]})}let jo=(0,e4.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),js=em.forwardRef(({className:e,variant:t,...n},r)=>(0,ep.jsx)("div",{ref:r,role:"alert",className:(0,eO.cn)(jo({variant:t}),e),...n}));js.displayName="Alert",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("h5",{ref:n,className:(0,eO.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let jl=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-sm [&_p]:leading-relaxed",e),...t}));jl.displayName="AlertDescription";var tV=tV;let jc=(0,eN.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),ju=[{value:"HARM_CATEGORY_HARASSMENT",label:"Harassment"},{value:"HARM_CATEGORY_HATE_SPEECH",label:"Hate Speech"},{value:"HARM_CATEGORY_SEXUALLY_EXPLICIT",label:"Sexually Explicit"},{value:"HARM_CATEGORY_DANGEROUS_CONTENT",label:"Dangerous Content"}],jd=[{value:"HARM_BLOCK_THRESHOLD_UNSPECIFIED",label:"Unspecified (use Gemini default)"},{value:"OFF",label:"Off (filter disabled)"},{value:"BLOCK_NONE",label:"Block none"},{value:"BLOCK_LOW_AND_ABOVE",label:"Block low & above"},{value:"BLOCK_MEDIUM_AND_ABOVE",label:"Block medium & above"},{value:"BLOCK_ONLY_HIGH",label:"Block only high"}],jh=ju.map(e=>({category:e.value,threshold:"BLOCK_NONE"})),jf=[{label:"Core",tools:["retain","sync_retain","recall","reflect"]},{label:"Bank management",tools:["list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories"]},{label:"Mental models",tools:["list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model"]},{label:"Directives",tools:["list_directives","create_directive","delete_directive"]},{label:"Memories",tools:["list_memories","get_memory","delete_memory"]},{label:"Documents",tools:["list_documents","get_document","delete_document"]},{label:"Operations",tools:["list_operations","get_operation","cancel_operation"]},{label:"Tags",tools:["list_tags"]}],jp=jf.flatMap(e=>e.tools);function jm(e){return Array.isArray(e)?e:e&&"object"==typeof e&&Array.isArray(e.attributes)?e.attributes:null}function jg(e){return{retain_chunk_size:e.retain_chunk_size??null,retain_extraction_mode:e.retain_extraction_mode??null,retain_mission:e.retain_mission??null,retain_custom_instructions:e.retain_custom_instructions??null,entities_allow_free_form:e.entities_allow_free_form??null,entity_labels:jm(e.entity_labels)}}function jv(e){return{retain_default_strategy:e.retain_default_strategy??null,retain_strategies:e.retain_strategies??null}}function jx(e){return{enable_observations:e.enable_observations??null,consolidation_llm_batch_size:e.consolidation_llm_batch_size??null,consolidation_source_facts_max_tokens:e.consolidation_source_facts_max_tokens??null,consolidation_source_facts_max_tokens_per_observation:e.consolidation_source_facts_max_tokens_per_observation??null,observations_mission:e.observations_mission??null,max_observations_per_scope:e.max_observations_per_scope??null}}function jy(e){return{mcp_enabled_tools:e.mcp_enabled_tools??null}}function jb(e){return{llm_gemini_safety_settings:e.llm_gemini_safety_settings??null}}let jw={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function jj(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,ew.useFeatures)(),n=t?.bank_config_api??!0,[r,i]=(0,em.useState)(!0),[a,o]=(0,em.useState)({}),[s,l]=(0,em.useState)(jw),[c,u]=(0,em.useState)(jg({})),[d,h]=(0,em.useState)(jv({})),[f,p]=(0,em.useState)(jx({})),[g,v]=(0,em.useState)(jw),[x,y]=(0,em.useState)(jy({})),[b,w]=(0,em.useState)(jb({})),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),U=(0,em.useMemo)(()=>JSON.stringify(c)!==JSON.stringify(jg(a))||JSON.stringify(d)!==JSON.stringify(jv(a)),[c,d,a]),H=(0,em.useMemo)(()=>JSON.stringify(f)!==JSON.stringify(jx(a)),[f,a]),W=(0,em.useMemo)(()=>JSON.stringify(g)!==JSON.stringify(s),[g,s]),Y=(0,em.useMemo)(()=>JSON.stringify(x)!==JSON.stringify(jy(a)),[x,a]),G=(0,em.useMemo)(()=>JSON.stringify(b)!==JSON.stringify(jb(a)),[b,a]);(0,em.useEffect)(()=>{e&&X()},[e]);let X=async()=>{if(e){i(!0);try{let[t,n]=await Promise.all([eD.client.getBankConfig(e),eD.client.getBankProfile(e)]),r=t.config,i={reflect_mission:n.mission??"",disposition_skepticism:r.disposition_skepticism??n.disposition?.skepticism??3,disposition_literalism:r.disposition_literalism??n.disposition?.literalism??3,disposition_empathy:r.disposition_empathy??n.disposition?.empathy??3};o(r),l(i),u(jg(r)),h(jv(r)),p(jx(r)),v(i),y(jy(r)),w(jb(r))}catch(e){console.error("Failed to load bank data:",e)}finally{i(!1)}}},$=async()=>{if(e){N(!0),P(null);try{let t={...c,...d};await eD.client.updateBankConfig(e,t),o(e=>({...e,...t}))}catch(e){P(e.message||"Failed to save retain settings")}finally{N(!1)}}},q=async()=>{if(e){E(!0),L(null);try{await eD.client.updateBankConfig(e,f),o(e=>({...e,...f}))}catch(e){L(e.message||"Failed to save observations settings")}finally{E(!1)}}},K=async()=>{if(e){_(!0),R(null);try{await eD.client.updateBankConfig(e,{reflect_mission:g.reflect_mission||null,disposition_skepticism:g.disposition_skepticism,disposition_literalism:g.disposition_literalism,disposition_empathy:g.disposition_empathy}),l(g)}catch(e){R(e.message||"Failed to save reflect settings")}finally{_(!1)}}},Z=async()=>{if(e){T(!0),z(null);try{await eD.client.updateBankConfig(e,x),o(e=>({...e,...x}))}catch(e){z(e.message||"Failed to save MCP settings")}finally{T(!1)}}},Q=async()=>{if(e){O(!0),V(null);try{await eD.client.updateBankConfig(e,b),o(e=>({...e,...b}))}catch(e){V(e.message||"Failed to save Gemini settings")}finally{O(!1)}}};return e?n?r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tV.default,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,ep.jsx)(ep.Fragment,{children:(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)(jT,{title:"Retain",description:"Default extraction settings and named strategies. Pass a strategy name on retain requests to override defaults per-item.",error:M,dirty:U,saving:j,onSave:$,children:[(0,ep.jsx)(jA,{label:"Default strategy",description:"Applied automatically when no strategy is specified on a request.",children:(0,ep.jsxs)(tR.Select,{value:d.retain_default_strategy??"__none__",onValueChange:e=>h(t=>({...t,retain_default_strategy:"__none__"===e?null:e})),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"__none__",children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"Default"})}),Object.keys(d.retain_strategies??{}).map(e=>(0,ep.jsx)(tR.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(j_,{defaultValues:c,onDefaultChange:e=>u(t=>({...t,...e})),strategies:d.retain_strategies,onStrategiesChange:e=>h(t=>({...t,retain_strategies:e}))})]}),(0,ep.jsxs)(jT,{title:"Observations",description:"Control how facts are synthesized into durable observations",error:D,dirty:H,saving:k,onSave:q,children:[(0,ep.jsx)(jA,{label:"Enable Observations",description:"Enable automatic consolidation of facts into observations",children:(0,ep.jsx)("div",{className:"flex justify-end",children:(0,ep.jsx)(tI.Switch,{checked:f.enable_observations??!1,onCheckedChange:e=>p(t=>({...t,enable_observations:e}))})})}),(0,ep.jsx)(jO,{label:"Mission",description:"What this bank should synthesise into durable observations. Replaces the built-in consolidation rules — leave blank to use the server default.",value:f.observations_mission??"",onChange:e=>p(t=>({...t,observations_mission:e||null})),placeholder:"e.g. Observations are stable facts about people and projects. Always include preferences, skills, and recurring patterns. Ignore one-off events and ephemeral state.",rows:3}),(0,ep.jsx)(jA,{label:"LLM Batch Size",description:"Number of facts sent to the LLM in a single consolidation call. Higher values reduce LLM calls at the cost of larger prompts. Leave blank to use the server default.",children:(0,ep.jsx)(eI.Input,{type:"number",min:1,max:64,value:f.consolidation_llm_batch_size??"",onChange:e=>p(t=>({...t,consolidation_llm_batch_size:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jA,{label:"Source Facts Max Tokens",description:"Total token budget for source facts included with observations during consolidation. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jA,{label:"Source Facts Max Tokens Per Observation",description:"Per-observation token cap for source facts during consolidation. Each observation gets at most this many tokens of source facts. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens_per_observation??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens_per_observation:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jA,{label:"Max Observations Per Scope",description:"Maximum number of observations allowed per tag scope. When the limit is reached, only updates and deletes are allowed. Observations with no tags are not subject to this limit. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.max_observations_per_scope??"",onChange:e=>p(t=>({...t,max_observations_per_scope:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})})]}),(0,ep.jsxs)(jT,{title:"Reflect",description:"Shape how the bank reasons and responds in reflect operations",error:I,dirty:W,saving:C,onSave:K,children:[(0,ep.jsx)(jO,{label:"Mission",description:"Agent identity and purpose. Used as framing context in reflect.",value:g.reflect_mission,onChange:e=>v(t=>({...t,reflect_mission:e})),placeholder:"e.g. You are a senior engineering assistant. Always ground answers in documented decisions and rationale. Ignore speculation. Be direct and precise.",rows:3}),(0,ep.jsx)(jM,{label:"Skepticism",description:"How skeptical vs trusting when evaluating claims",lowLabel:"Trusting",highLabel:"Skeptical",value:g.disposition_skepticism,onChange:e=>v(t=>({...t,disposition_skepticism:e}))}),(0,ep.jsx)(jM,{label:"Literalism",description:"How literally to interpret information",lowLabel:"Flexible",highLabel:"Literal",value:g.disposition_literalism,onChange:e=>v(t=>({...t,disposition_literalism:e}))}),(0,ep.jsx)(jM,{label:"Empathy",description:"How much to weight emotional context",lowLabel:"Detached",highLabel:"Empathetic",value:g.disposition_empathy,onChange:e=>v(t=>({...t,disposition_empathy:e}))})]}),(0,ep.jsxs)(jT,{title:"MCP Tools",description:"Restrict which MCP tools this bank exposes to agents",error:B,dirty:Y,saving:S,onSave:Z,children:[(0,ep.jsx)(jA,{label:"Restrict tools",description:"When off, all tools are available. When on, only the selected tools can be invoked for this bank.",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tI.Switch,{checked:null!==x.mcp_enabled_tools,onCheckedChange:e=>y({mcp_enabled_tools:e?[...jp]:null})}),(0,ep.jsx)(e8,{className:"text-xs text-muted-foreground",children:null!==x.mcp_enabled_tools?"Enabled":"Disabled"})]})}),null!==x.mcp_enabled_tools&&(0,ep.jsx)(jS,{selected:x.mcp_enabled_tools,onChange:e=>y({mcp_enabled_tools:e})})]}),(0,ep.jsx)(jT,{title:"Models",description:"Provider-specific model settings",error:F,dirty:G,saving:A,onSave:Q,children:(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsx)("p",{className:"text-sm font-semibold",children:"Gemini / Vertex AI"}),(0,ep.jsxs)("div",{className:"pl-4 border-l-2 border-border/40 space-y-4",children:[(0,ep.jsx)(jA,{label:"Safety settings",description:(0,ep.jsxs)(ep.Fragment,{children:["When off, Gemini's default safety thresholds are used. When on, configure thresholds per harm category."," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tI.Switch,{checked:null!==b.llm_gemini_safety_settings,onCheckedChange:e=>w({llm_gemini_safety_settings:e?[...jh]:null})}),(0,ep.jsx)(e8,{className:"text-xs text-muted-foreground",children:null!==b.llm_gemini_safety_settings?"Custom":"Default"})]})}),null!==b.llm_gemini_safety_settings&&(0,ep.jsx)(jD,{value:b.llm_gemini_safety_settings,onChange:e=>w({llm_gemini_safety_settings:e})})]})]})})]})}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,ep.jsx)("p",{className:"text-base font-medium text-foreground",children:"Bank configuration is disabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-sm",children:["Set"," ",(0,ep.jsx)("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:"HINDSIGHT_API_ENABLE_BANK_CONFIG_API=true"})," ","to enable per-bank configuration."]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No bank selected"})})}let jN=["concise","verbose","verbatim","chunks","custom"],jk="__inherit__";function jE({values:e,onChange:t,isOverride:n=!1}){let r=e.retain_extraction_mode??(n?jk:""),i="custom"===e.retain_extraction_mode;return(0,ep.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,ep.jsx)(jA,{label:"Extraction Mode",description:"How aggressively to extract facts. concise = selective, verbose = capture everything, verbatim = store chunks as-is (still extract entities/time), chunks = no LLM, custom = write your own rules.",children:(0,ep.jsxs)(tR.Select,{value:r,onValueChange:e=>t({retain_extraction_mode:e===jk?null:e||null}),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tR.SelectValue,{placeholder:n?"Inherited from default":void 0})}),(0,ep.jsxs)(tR.SelectContent,{children:[n&&(0,ep.jsx)(tR.SelectItem,{value:jk,children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"inherited"})}),jN.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jA,{label:"Chunk Size",description:"Size of text chunks for processing (characters)",children:(0,ep.jsx)(eI.Input,{type:"number",min:500,max:8e3,value:e.retain_chunk_size??"",onChange:e=>t({retain_chunk_size:e.target.value?parseFloat(e.target.value):null}),placeholder:n?"Inherited from default":void 0})}),(0,ep.jsx)(jO,{label:"Mission",description:"What this bank should pay attention to during extraction. Steers the LLM without replacing the extraction rules.",value:e.retain_mission??"",onChange:e=>t({retain_mission:e||null}),placeholder:n?"Inherited from default":"e.g. Always include technical decisions, API design choices, and architectural trade-offs.",rows:3}),i&&(0,ep.jsx)(jO,{label:"Custom Extraction Prompt",description:"Replaces the built-in extraction rules entirely. Only active when Extraction Mode is set to custom.",value:e.retain_custom_instructions??"",onChange:e=>t({retain_custom_instructions:e||null}),rows:5}),(0,ep.jsx)(jA,{label:"Free Form Entities",description:"Extract regular named entities (people, places, concepts) alongside entity labels. Disable to restrict extraction to entity labels only.",children:(0,ep.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,ep.jsx)(e8,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:e.entities_allow_free_form??!0?"Enabled":"Disabled"}),(0,ep.jsx)(tI.Switch,{checked:e.entities_allow_free_form??!0,onCheckedChange:e=>t({entities_allow_free_form:e})})]})}),(0,ep.jsx)(jP,{value:e.entity_labels??[],onChange:e=>t({entity_labels:e.length>0?e:null})})]})}function jC(e){return e?Object.entries(e).map(([e,t],n)=>({id:n,name:e,values:{retain_extraction_mode:t.retain_extraction_mode??null,retain_chunk_size:t.retain_chunk_size??null,retain_mission:t.retain_mission??null,retain_custom_instructions:t.retain_custom_instructions??null,entities_allow_free_form:t.entities_allow_free_form??null,entity_labels:jm(t.entity_labels)}})):[]}function j_({defaultValues:e,onDefaultChange:t,strategies:n,onStrategiesChange:r}){let[i,a]=(0,em.useState)(()=>jC(n)),[o,s]=(0,em.useState)("default"),[l,c]=(0,em.useState)(null),u=(0,em.useRef)(!1),d=JSON.stringify(n);(0,em.useEffect)(()=>{if(u.current){u.current=!1;return}a(jC(n))},[d]);let h=e=>{u.current=!0,a(e),r(function(e){let t={};for(let n of e){if(!n.name.trim())continue;let e={};null!==n.values.retain_extraction_mode&&(e.retain_extraction_mode=n.values.retain_extraction_mode),null!==n.values.retain_chunk_size&&(e.retain_chunk_size=n.values.retain_chunk_size),n.values.retain_mission&&(e.retain_mission=n.values.retain_mission),n.values.retain_custom_instructions&&(e.retain_custom_instructions=n.values.retain_custom_instructions),null!==n.values.entities_allow_free_form&&(e.entities_allow_free_form=n.values.entities_allow_free_form),null!==n.values.entity_labels&&(e.entity_labels=n.values.entity_labels),t[n.name.trim()]=e}return Object.keys(t).length>0?t:null}(e))},f=(e,t)=>{h(i.map(n=>n.id===e?{...n,...t}:n))},p="default"!==o?i.find(e=>e.id===o):null;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"border-b border-border px-6 flex items-stretch gap-1 flex-wrap",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>s("default"),className:`relative py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px ${"default"===o?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,children:"Default"}),i.map(e=>(0,ep.jsxs)("div",{className:`relative flex items-center gap-2 py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px cursor-pointer ${o===e.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,onClick:()=>s(e.id),children:[(0,ep.jsx)("span",{className:"font-mono",children:e.name||(0,ep.jsx)("span",{className:"italic font-normal opacity-50",children:"unnamed"})}),(0,ep.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e)},className:"opacity-40 hover:opacity-100 hover:text-destructive transition-opacity text-base leading-none",children:"×"})]},e.id)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let e=Date.now();h([...i,{id:e,name:"",values:{retain_extraction_mode:null,retain_chunk_size:null,retain_mission:null,retain_custom_instructions:null,entities_allow_free_form:null,entity_labels:null}}]),s(e)},className:"py-3 px-3 text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1.5",children:[(0,ep.jsx)(fI.Plus,{className:"h-3.5 w-3.5"}),"Add strategy"]})]}),(0,ep.jsx)("div",{children:"default"===o?(0,ep.jsx)(jE,{values:e,onChange:t}):p?(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"px-6 py-3 flex items-center gap-3 border-b border-border/40",children:[(0,ep.jsx)("label",{className:"text-xs text-muted-foreground shrink-0",children:"Name"}),(0,ep.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ep.jsx)(eI.Input,{value:p.name,onChange:e=>f(p.id,{name:e.target.value}),placeholder:"strategy name (e.g. fast)",className:`h-7 text-xs font-mono max-w-[200px] ${!p.name.trim()?"border-destructive focus-visible:ring-destructive":""}`}),!p.name.trim()&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Name is required"})]})]}),(0,ep.jsx)(jE,{values:p.values,onChange:e=>f(p.id,{values:{...p.values,...e}}),isOverride:!0})]}):null}),(0,ep.jsx)(fY,{open:null!==l,onOpenChange:e=>{e||c(null)},children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsxs)(pt,{children:["Delete strategy “",l?.name||"unnamed","”?"]}),(0,ep.jsx)(pn,{children:"This will remove the strategy and all its overrides. This cannot be undone."})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{children:"Cancel"}),(0,ep.jsx)(pr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(l){var e;e=l.id,h(i.filter(t=>t.id!==e)),o===e&&s("default"),c(null)}},children:"Delete"})]})]})})]})}function jS({selected:e,onChange:t}){let n=new Set(e),r=jp.every(e=>n.has(e)),i=0===e.length;return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.length," of ",jp.length," tools enabled"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(r?[]:[...jp])},className:"text-xs text-primary hover:underline",children:r?"Deselect all":"Select all"})]}),(0,ep.jsx)("div",{className:"space-y-4",children:jf.map(e=>{let r=e.tools.filter(e=>n.has(e)).length===e.tools.length;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e.label}),(0,ep.jsx)("button",{type:"button",onClick:()=>{let i=new Set(n);r?e.tools.forEach(e=>i.delete(e)):e.tools.forEach(e=>i.add(e)),t(jp.filter(e=>i.has(e)))},className:"text-xs text-primary hover:underline",children:r?"Deselect":"Select all"})]}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tools.map(e=>{let r=n.has(e);return(0,ep.jsx)("button",{type:"button",onClick:()=>{let r;(r=new Set(n)).has(e)?r.delete(e):r.add(e),t(jp.filter(e=>r.has(e)))},className:`px-2.5 py-1 rounded text-xs font-mono transition-colors border ${r?"bg-primary text-primary-foreground border-primary":"bg-muted/30 text-muted-foreground border-border/40 hover:border-primary/40"}`,children:e},e)})})]},e.label)})}),i&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Warning: no tools selected — agents will be blocked from all MCP calls for this bank."})]})}function jT({title:e,description:t,children:n,error:r,dirty:i,saving:a,onSave:o}){return(0,ep.jsxs)("section",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:e}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:t})]}),(0,ep.jsxs)(pv,{className:"bg-muted/20 border-border/40",children:[(0,ep.jsx)("div",{className:"divide-y divide-border/40",children:n}),r&&(0,ep.jsx)("div",{className:"px-6 pb-2 pt-2",children:(0,ep.jsxs)(js,{variant:"destructive",children:[(0,ep.jsx)(jc,{className:"h-4 w-4"}),(0,ep.jsx)(jl,{children:r})]})}),(0,ep.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,ep.jsx)(eL.Button,{size:"sm",disabled:!i||a,onClick:o,children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save changes"})})]})]})}function jA({label:e,description:t,children:n}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)("div",{className:"md:w-64 shrink-0",children:n})]})})}function jO({label:e,description:t,value:n,onChange:r,placeholder:i,rows:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)(p_.Textarea,{value:n,onChange:e=>r(e.target.value),placeholder:i,rows:a??3,className:"font-mono text-sm"})]})})}function jM({label:e,description:t,lowLabel:n,highLabel:r,value:i,onChange:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[n&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right shrink-0",children:n}),(0,ep.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,ep.jsx)("button",{type:"button",onClick:()=>a(e),className:`w-4 h-4 rounded-full transition-colors hover:opacity-80 ${e<=i?"bg-primary":"bg-muted"}`},e))}),r&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-20 shrink-0",children:r}),(0,ep.jsxs)("span",{className:"text-xs font-mono text-muted-foreground ml-1 shrink-0",children:[i,"/5"]})]})]})})}function jP({value:e,onChange:t}){let[n,r]=(0,em.useState)({}),i=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))},a=(t,n,r)=>{let a=e[t].values.map((e,t)=>t===n?{...e,...r}:e);i(t,{values:a})};return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:"Entity Labels"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Classification labels extracted at retain time. Leave empty to disable."})]}),e.length>0&&(0,ep.jsxs)("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full shrink-0",children:[e.length," group",1!==e.length?"s":""]})]}),0===e.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No entity labels defined."}),(0,ep.jsx)("div",{className:"space-y-2",children:e.map((o,s)=>{let l=n[s]??!1,c="text"===o.type,u=!c;return(0,ep.jsxs)("div",{className:"border border-border/50 rounded-md bg-background",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>r(e=>({...e,[s]:!l})),className:"text-muted-foreground hover:text-foreground shrink-0",disabled:c,children:l&&u?(0,ep.jsx)(w4.ChevronDown,{className:"h-4 w-4"}):(0,ep.jsx)(eT.ChevronRight,{className:`h-4 w-4 ${c?"opacity-30":""}`})}),(0,ep.jsx)(eI.Input,{placeholder:"key (e.g. pedagogy)",value:o.key,onChange:e=>i(s,{key:e.target.value}),className:"h-8 text-xs font-mono w-36 shrink-0"}),(0,ep.jsx)(eI.Input,{placeholder:c?"description / examples":"description",value:o.description,onChange:e=>i(s,{description:e.target.value}),className:"h-8 text-xs flex-1 min-w-0"}),(0,ep.jsxs)(tR.Select,{value:o.type,onValueChange:e=>i(s,{type:e,..."text"===e?{values:[]}:{}}),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"h-8 text-xs w-32 shrink-0",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"value",className:"text-xs",children:"Single value"}),(0,ep.jsx)(tR.SelectItem,{value:"multi-values",className:"text-xs",children:"Multi-values"}),(0,ep.jsx)(tR.SelectItem,{value:"text",className:"text-xs",children:"Free text"})]})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 cursor-pointer select-none",children:[(0,ep.jsx)(pd.Checkbox,{checked:o.tag,onCheckedChange:e=>i(s,{tag:!!e}),className:"h-4 w-4"}),"tag"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(e.filter((e,t)=>t!==s)),r(e=>{let t={...e};return delete t[s],t})},className:"text-muted-foreground hover:text-destructive shrink-0",children:(0,ep.jsx)(pa,{className:"h-3.5 w-3.5"})})]}),l&&u&&(0,ep.jsxs)("div",{className:"px-3 pb-3 space-y-1 border-t border-border/30 pt-2",children:[0===o.values.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic pl-5",children:"No values yet."}),o.values.map((t,n)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 pl-5",children:[(0,ep.jsx)(eI.Input,{placeholder:"value",value:t.value,onChange:e=>a(s,n,{value:e.target.value}),className:"h-8 text-xs font-mono w-32 shrink-0"}),(0,ep.jsx)(eI.Input,{placeholder:"description",value:t.description,onChange:e=>a(s,n,{description:e.target.value}),className:"h-8 text-xs flex-1 min-w-0"}),(0,ep.jsx)("button",{type:"button",onClick:()=>{i(s,{values:e[s].values.filter((e,t)=>t!==n)})},className:"text-muted-foreground hover:text-destructive shrink-0",children:(0,ep.jsx)(pa,{className:"h-3.5 w-3.5"})})]},n)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{i(s,{values:[...e[s].values,{value:"",description:""}]})},className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground pl-5 mt-1",children:[(0,ep.jsx)(fI.Plus,{className:"h-3 w-3"}),"Add value"]})]})]},s)})}),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let n=[...e,{key:"",description:"",type:"value",optional:!0,tag:!1,values:[]}];t(n),r(e=>({...e,[n.length-1]:!0}))},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,ep.jsx)(fI.Plus,{className:"h-3.5 w-3.5"}),"Add attribute"]})]})}function jD({value:e,onChange:t}){let n=t=>e.find(e=>e.category===t)?.threshold??"BLOCK_MEDIUM_AND_ABOVE";return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:['Set the blocking threshold for each harm category. "Off" disables the filter entirely (default for Gemini 2.5+). Lower thresholds block more content.'," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:ju.map(e=>(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,ep.jsx)("span",{className:"text-sm",children:e.label}),(0,ep.jsxs)(tR.Select,{value:n(e.value),onValueChange:r=>{var i;return i=e.value,void t(ju.map(e=>({category:e.value,threshold:e.value===i?r:n(e.value)})))},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsx)(tR.SelectContent,{children:jd.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,className:"text-xs",children:e.label},e.value))})]})]},e.value))})]})}let jL=(0,eN.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),jI=(0,eN.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),jR=(0,eN.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var jB=e.i(23287),jB=jB;let jz=(0,eN.default)("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"}]]),jF=(0,eN.default)("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"}]]);e.i(34471);var jV=Symbol.for("immer-nothing"),jU=Symbol.for("immer-draftable"),jH=Symbol.for("immer-state");function jW(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var jY=Object,jG=jY.getPrototypeOf,jX="constructor",j$="prototype",jq="configurable",jK="enumerable",jZ="writable",jQ="value",jJ=e=>!!e&&!!e[jH];function j0(e){return!!e&&(j5(e)||j9(e)||!!e[jU]||!!e[jX]?.[jU]||Ne(e)||Nt(e))}var j1=jY[j$][jX].toString(),j2=new WeakMap;function j5(e){if(!e||!Nn(e))return!1;let t=jG(e);if(null===t||t===jY[j$])return!0;let n=jY.hasOwnProperty.call(t,jX)&&t[jX];if(n===Object)return!0;if(!Nr(n))return!1;let r=j2.get(n);return void 0===r&&(r=Function.toString.call(n),j2.set(n,r)),r===j1}function j3(e,t,n=!0){0===j4(e)?(n?Reflect.ownKeys(e):jY.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function j4(e){let t=e[jH];return t?t.type_:j9(e)?1:Ne(e)?2:3*!!Nt(e)}var j6=(e,t,n=j4(e))=>2===n?e.has(t):jY[j$].hasOwnProperty.call(e,t),j8=(e,t,n=j4(e))=>2===n?e.get(t):e[t],j7=(e,t,n,r=j4(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},j9=Array.isArray,Ne=e=>e instanceof Map,Nt=e=>e instanceof Set,Nn=e=>"object"==typeof e,Nr=e=>"function"==typeof e,Ni=e=>e.modified_?e.copy_:e.base_;function Na(e,t){if(Ne(e))return new Map(e);if(Nt(e))return new Set(e);if(j9(e))return Array[j$].slice.call(e);let n=j5(e);if(!0!==t&&("class_only"!==t||n)){let t=jG(e);if(null!==t&&n)return{...e};let r=jY.create(t);return jY.assign(r,e)}{let t=jY.getOwnPropertyDescriptors(e);delete t[jH];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a[jZ]&&(a[jZ]=!0,a[jq]=!0),(a.get||a.set)&&(t[i]={[jq]:!0,[jZ]:!0,[jK]:a[jK],[jQ]:e[i]})}return jY.create(jG(e),t)}}function No(e,t=!1){return Nl(e)||jJ(e)||!j0(e)||(j4(e)>1&&jY.defineProperties(e,{set:Ns,add:Ns,clear:Ns,delete:Ns}),jY.freeze(e),t&&j3(e,(e,t)=>{No(t,!0)},!1)),e}var Ns={[jQ]:function(){jW(2)}};function Nl(e){return!(null!==e&&Nn(e))||jY.isFrozen(e)}var Nc="MapSet",Nu="Patches",Nd="ArrayMethods",Nh={};function Nf(e){let t=Nh[e];return t||jW(0,e),t}var Np=e=>!!Nh[e];function Nm(e,t){t&&(e.patchPlugin_=Nf(Nu),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ng(e){Nv(e),e.drafts_.forEach(Ny),e.drafts_=null}function Nv(e){e===I&&(I=e.parent_)}var Nx=e=>I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Np(Nc)?Nf(Nc):void 0,arrayMethodsPlugin_:Np(Nd)?Nf(Nd):void 0};function Ny(e){let t=e[jH];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Nb(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(void 0!==e&&e!==n){n[jH].modified_&&(Ng(t),jW(4)),j0(e)&&(e=Nw(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[jH].base_,e,t)}else e=Nw(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&No(t,n)}(t,e,!0),Ng(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==jV?e:void 0}function Nw(e,t){if(Nl(t))return t;let n=t[jH];if(!n)return N_(t,e.handledSet_,e);if(!NN(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);NC(n,e)}return n.copy_}function Nj(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var NN=(e,t)=>e.scope_===t,Nk=[];function NE(e,t,n,r){let i=e.copy_||e.base_,a=e.type_;if(void 0!==r&&j8(i,r,a)===t)return void j7(i,r,n,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;j3(i,(e,n)=>{if(jJ(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}for(let r of e.draftLocations_.get(t)??Nk)j7(i,r,n,a)}function NC(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Nj(e)}}function N_(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||jJ(e)||t.has(e)||!j0(e)||Nl(e)||(t.add(e),j3(e,(r,i)=>{if(jJ(i)){let t=i[jH];NN(t,n)&&(j7(e,r,Ni(t),e.type_),Nj(t))}else j0(i)&&N_(i,t,n)})),e}var NS={get(e,t){let n;if(t===jH)return e;let r=e.scope_.arrayMethodsPlugin_,i=1===e.type_&&"string"==typeof t;if(i&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let a=e.copy_||e.base_;if(!j6(a,t,e.type_)){var o;let n;return o=e,(n=NO(a,t))?jQ in n?n[jQ]:n.get?.call(o.draft_):void 0}let s=a[t];if(e.finalized_||!j0(s)||i&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(n=+t)&&String(n)===t)return s;if(s===NA(e.base_,t)){NP(e);let n=1===e.type_?+t:t,r=ND(e.scope_,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in(e.copy_||e.base_),ownKeys:e=>Reflect.ownKeys(e.copy_||e.base_),set(e,t,n){let r=NO(e.copy_||e.base_,t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=NA(e.copy_||e.base_,t),i=r?.[jH];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||j6(e.base_,t,e.type_)))return!0;NP(e),NM(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_.set(t,!0),!function(e,t,n){let{scope_:r}=e;if(jJ(n)){let i=n[jH];NN(i,r)&&i.callbacks_.push(function(){NP(e),NE(e,n,Ni(i),t)})}else j0(n)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(n)&&N_(n,r.handledSet_,r):j8(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&N_(j8(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n),!0)},deleteProperty:(e,t)=>(NP(e),void 0!==NA(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),NM(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=e.copy_||e.base_,r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[jZ]:!0,[jq]:1!==e.type_||"length"!==t,[jK]:r[jK],[jQ]:n[t]}:r},defineProperty(){jW(11)},getPrototypeOf:e=>jG(e.base_),setPrototypeOf(){jW(12)}},NT={};for(let e in NS){let t=NS[e];NT[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function NA(e,t){let n=e[jH];return(n?n.copy_||n.base_:e)[t]}function NO(e,t){if(!(t in e))return;let n=jG(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=jG(n)}}function NM(e){!e.modified_&&(e.modified_=!0,e.parent_&&NM(e.parent_))}function NP(e){e.copy_||(e.assigned_=new Map,e.copy_=Na(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function ND(e,t,n,r){let[i,a]=Ne(t)?Nf(Nc).proxyMap_(t,n):Nt(t)?Nf(Nc).proxySet_(t,n):function(e,t){let n=j9(e),r={type_:+!!n,scope_:t?t.scope_:I,modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=NS;n&&(i=[r],a=NT);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}(t,n);if((n?.scope_??I).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&void 0!==r)n.callbacks_.push(function(e){if(!a||!NN(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=Ni(a);NE(n,a.draft_??a,t,r),NC(a,e)});else a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)});return i}function NL(e){return jJ(e)||jW(10,e),function e(t){let n;if(!j0(t)||Nl(t))return t;let r=t[jH],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Na(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=Na(t,!0);return j3(n,(t,r)=>{j7(n,t,e(r))},i),r&&(r.finalized_=!1),n}(e)}NT.deleteProperty=function(e,t){return NT.set.call(this,e,t,void 0)},NT.set=function(e,t,n){return NS.set.call(this,e[0],t,n,e[0])};var NI=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{let r;if(Nr(e)&&!Nr(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if(Nr(t)||jW(6),void 0===n||Nr(n)||jW(7),j0(e)){let i=Nx(this),a=ND(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Ng(i):Nv(i)}return Nm(i,n),Nb(r,i)}if(e&&Nn(e))jW(1,e);else{if(void 0===(r=t(e))&&(r=e),r===jV&&(r=void 0),this.autoFreeze_&&No(r,!0),n){let t=[],i=[];Nf(Nu).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return Nr(e)?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},(e=>"boolean"==typeof e)(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),(e=>"boolean"==typeof e)(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),(e=>"boolean"==typeof e)(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){j0(e)||jW(8),jJ(e)&&(e=NL(e));let t=Nx(this),n=ND(t,e,void 0);return n[jH].isManual_=!0,Nv(t),n}finishDraft(e,t){let n=e&&e[jH];n&&n.isManual_||jW(9);let{scope_:r}=n;return Nm(r,t),Nb(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Nf(Nu).applyPatches_;return jJ(e)?r(e,t):this.produce(e,e=>r(e,t))}}().produce,NR=e=>Array.isArray(e)?e:[e],NB=0,Nz=class{revision=NB;_value;_lastValue;_isEqual=NF;constructor(e,t=NF){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++NB)}};function NF(e,t){return e===t}function NV(e){return e instanceof Nz||console.warn("Not a valid cell! ",e),e.value}var NU=(e,t)=>!1;function NH(){return function(e=NF){return new Nz(null,e)}(NU)}var NW=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=NH()),NV(t)};Symbol();var NY=0,NG=Object.getPrototypeOf({}),NX=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,N$);tag=NH();tags={};children={};collectionTag=null;id=NY++},N$={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in NG)return r;if("object"==typeof r&&null!==r){var i;let n=e.children[t];return void 0===n&&(n=e.children[t]=Array.isArray(i=r)?new Nq(i):new NX(i)),n.tag&&NV(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=NH()).value=r),NV(n),r}})(),ownKeys:e=>(NW(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},Nq=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],NK);tag=NH();tags={};children={};collectionTag=null;id=NY++},NK={get:([e],t)=>("length"===t&&NW(e),N$.get(e,t)),ownKeys:([e])=>N$.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>N$.getOwnPropertyDescriptor(e,t),has:([e],t)=>N$.has(e,t)},NZ="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function NQ(){return{s:0,v:void 0,o:null,p:null}}function NJ(e,t={}){let n,r=NQ(),{resultEqualityCheck:i}=t,a=0;function o(){let t,o=r,{length:s}=arguments;for(let e=0;e<s;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=o.o;null===e&&(o.o=e=new WeakMap);let n=e.get(t);void 0===n?(o=NQ(),e.set(t,o)):o=n}else{let e=o.p;null===e&&(o.p=e=new Map);let n=e.get(t);void 0===n?(o=NQ(),e.set(t,o)):o=n}}let l=o;if(1===o.s)t=o.v;else if(t=e.apply(null,arguments),a++,i){let e=n?.deref?.()??n;null!=e&&i(e,t)&&(t=e,0!==a&&a--),n="object"==typeof t&&null!==t||"function"==typeof t?new NZ(t):t}return l.s=1,l.v=t,t}return o.clearCache=()=>{r=NQ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}var N0=function(e,...t){let n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r,i=0,a=0,o={},s=e.pop();"object"==typeof s&&(o=s,s=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);let{memoize:l,memoizeOptions:c=[],argsMemoize:u=NJ,argsMemoizeOptions:d=[],devModeChecks:h={}}={...n,...o},f=NR(c),p=NR(d),g=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${n}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),v=l(function(){return i++,s.apply(null,arguments)},...f);return Object.assign(u(function(){a++;let e=function(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(g,arguments);return r=v.apply(null,e)},...p),{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>r,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:l,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}(NJ),N1=Object.assign((e,t=N0)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>N1});function N2(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var N5="function"==typeof Symbol&&Symbol.observable||"@@observable",N3=()=>Math.random().toString(36).substring(7).split("").join("."),N4={INIT:`@@redux/INIT${N3()}`,REPLACE:`@@redux/REPLACE${N3()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${N3()}`};function N6(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function N8(e){let t,n=Object.keys(e),r={};for(let t=0;t<n.length;t++){let i=n[t];"function"==typeof e[i]&&(r[i]=e[i])}let i=Object.keys(r);try{Object.keys(r).forEach(e=>{let t=r[e];if(void 0===t(void 0,{type:N4.INIT}))throw Error(N2(12));if(void 0===t(void 0,{type:N4.PROBE_UNKNOWN_ACTION()}))throw Error(N2(13))})}catch(e){t=e}return function(e={},n){if(t)throw t;let a=!1,o={};for(let t=0;t<i.length;t++){let s=i[t],l=r[s],c=e[s],u=l(c,n);if(void 0===u)throw n&&n.type,Error(N2(14));o[s]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?o:e}}function N7(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function N9(e){return N6(e)&&"type"in e&&"string"==typeof e.type}function ke(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var kt=ke(),kn="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?N7:N7.apply(null,arguments)};function kr(e,t){function n(...r){if(t){let n=t(...r);if(!n)throw Error(kG(0));return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>N9(t)&&t.type===e,n}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ki=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function ka(e){return j0(e)?NI(e,()=>{}):e}function ko(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var ks="RTK_autoBatch",kl=()=>e=>({payload:e,meta:{[ks]:!0}}),kc=e=>t=>{setTimeout(t,e)},ku=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"u">typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:kc(10):"callback"===e.type?e.queueNotification:kc(e.timeout),c=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return(a=!(i=!e?.meta?.[ks]))&&!o&&(o=!0,l(c)),r.dispatch(e)}finally{i=!0}}})};function kd(e){let t,n={},r=[],i={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(kG(28));if(r in n)throw Error(kG(29));return n[r]=t,i},addAsyncThunk:(e,t)=>(t.pending&&(n[e.pending.type]=t.pending),t.rejected&&(n[e.rejected.type]=t.rejected),t.fulfilled&&(n[e.fulfilled.type]=t.fulfilled),t.settled&&r.push({matcher:e.settled,reducer:t.settled}),i),addMatcher:(e,t)=>(r.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(t=e,i)};return e(i),[n,r,t]}var kh=Symbol.for("rtk-slice-createasyncthunk"),kf=((c=kf||{}).reducer="reducer",c.reducerWithPrepare="reducerWithPrepare",c.asyncThunk="asyncThunk",c),kp=function({creators:e}={}){let t=e?.asyncThunk?.[kh];return function(e){let n,{name:r,reducerPath:i=r}=e;if(!r)throw Error(kG(11));let a=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(a),s={},l={},c={},u=[],d={addCase(e,t){let n="string"==typeof e?e:e.type;if(!n)throw Error(kG(12));if(n in l)throw Error(kG(13));return l[n]=t,d},addMatcher:(e,t)=>(u.push({matcher:e,reducer:t}),d),exposeAction:(e,t)=>(c[e]=t,d),exposeCaseReducer:(e,t)=>(s[e]=t,d)};function h(){let[t={},n=[],r]="function"==typeof e.extraReducers?kd(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let n,[r,i,a]=kd(t);if("function"==typeof e)n=()=>ka(e());else{let t=ka(e);n=()=>t}function o(e=n(),t){let s=[r[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===s.filter(e=>!!e).length&&(s=[a]),s.reduce((e,n)=>{if(n)if(jJ(e)){let r=n(e,t);return void 0===r?e:r}else{if(j0(e))return NI(e,e=>n(e,t));let r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e},e)}return o.getInitialState=n,o}(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of u)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}o.forEach(n=>{let i=a[n],o={reducerName:n,type:`${r}/${n}`,createNotation:"function"==typeof e.reducers};"asyncThunk"===i._reducerDefinitionType?function({type:e,reducerName:t},n,r,i){if(!i)throw Error(kG(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),l&&r.addCase(d.rejected,l),c&&r.addMatcher(d.settled,c),r.exposeCaseReducer(t,{fulfilled:o||km,pending:s||km,rejected:l||km,settled:c||km})}(o,i,d,t):function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&"reducerWithPrepare"!==r._reducerDefinitionType)throw Error(kG(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?kr(e,o):kr(e))}(o,i,d)});let f=e=>e,p=new Map,g=new WeakMap;function v(e,t){return n||(n=h()),n(e,t)}function x(){return n||(n=h()),n.getInitialState()}function y(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=ko(g,r,x)),i}function i(t=f){let r=ko(p,n,()=>new WeakMap);return ko(r,t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=function(e,t,n,r){function i(a,...o){let s=t(a);return void 0===s&&r&&(s=n()),e(s,...o)}return i.unwrapped=e,i}(a,t,()=>ko(g,t,x),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let b={name:r,reducer:v,actions:c,caseReducers:s,getInitialState:x,...y(i),injectInto(e,{reducerPath:t,...n}={}){let r=t??i;return e.inject({reducerPath:r,reducer:v},n),{...b,...y(r,!0)}}};return b}}();function km(){}var kg="listener",kv="completed",kx="cancelled",ky=`task-${kx}`,kb=`task-${kv}`,kw=`${kg}-${kx}`,kj=`${kg}-${kv}`,kN=class{constructor(e){this.code=e,this.message=`task ${kx} (reason: ${e})`}name="TaskAbortError";message},kk=(e,t)=>{if("function"!=typeof e)throw TypeError(kG(32))},kE=()=>{},kC=(e,t=kE)=>(e.catch(t),e),k_=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),kS=e=>{if(e.aborted)throw new kN(e.reason)};function kT(e,t){let n=kE;return new Promise((r,i)=>{let a=()=>i(new kN(e.reason));e.aborted?a():(n=k_(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=kE})}var kA=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof kN?"cancelled":"rejected",error:e}}finally{t?.()}},kO=e=>t=>kC(kT(e,t).then(t=>(kS(e),t))),kM=e=>{let t=kO(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:kP}=Object,kD={},kL="listenerMiddleware",kI=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=kr(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(i);else throw Error(kG(21));return kk(a,"options.listener"),{predicate:i,type:t,effect:a}},kR=kP(e=>{let{type:t,predicate:n,effect:r}=kI(e);return{id:((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(kG(22))}}},{withTypes:()=>kR}),kB=(e,t)=>{let{type:n,effect:r,predicate:i}=kI(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},kz=e=>{e.pending.forEach(e=>{e.abort(kw)})},kF=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},kV=kP(kr(`${kL}/add`),{withTypes:()=>kV}),kU=kr(`${kL}/removeAll`),kH=kP(kr(`${kL}/remove`),{withTypes:()=>kH}),kW=(...e)=>{console.error(`${kL}/error`,...e)},kY=(e={})=>{let t=new Map,n=new Map,{extra:r,onError:i=kW}=e;kk(i,"onError");let a=e=>{var n;return(n=kB(t,e)??kR(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),e?.cancelActive&&kz(n)}};kP(a,{withTypes:()=>a});let o=e=>{let n=kB(t,e);return n&&(n.unsubscribe(),e.cancelActive&&kz(n)),!!n};kP(o,{withTypes:()=>o});let s=async(e,o,s,l)=>{var c,u;let d,h=new AbortController,f=(c=h.signal,d=async(e,t)=>{kS(c);let n=()=>{},r=[new Promise((t,r)=>{let i=a({predicate:e,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});n=()=>{i(),r()}})];null!=t&&r.push(new Promise(e=>setTimeout(e,t,null)));try{let e=await kT(c,Promise.race(r));return kS(c),e}finally{n()}},(e,t)=>kC(d(e,t))),p=[];try{let i;e.pending.add(h),i=n.get(e)??0,n.set(e,i+1),await Promise.resolve(e.effect(o,kP({},s,{getOriginalState:l,condition:(e,t)=>f(e,t).then(Boolean),take:f,delay:kM(h.signal),pause:kO(h.signal),extra:r,signal:h.signal,fork:(u=h.signal,(e,t)=>{kk(e,"taskExecutor");let n=new AbortController;k_(u,()=>n.abort(u.reason));let r=kA(async()=>{kS(u),kS(n.signal);let t=await e({pause:kO(n.signal),delay:kM(n.signal),signal:n.signal});return kS(n.signal),t},()=>n.abort(kb));return t?.autoJoin&&p.push(r.catch(kE)),{result:kO(u)(r),cancel(){n.abort(ky)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==h&&(e.abort(kw),n.delete(e))})},cancel:()=>{h.abort(kw),e.pending.delete(h)},throwIfCancelled:()=>{kS(h.signal)}})))}catch(e){e instanceof kN||kF(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(p),h.abort(kj),1===(t=n.get(e)??1)?n.delete(e):n.set(e,t-1),e.pending.delete(h)}},l=()=>{for(let e of n.keys())kz(e);t.clear()};return{middleware:e=>n=>r=>{let c;if(!N9(r))return n(r);if(kV.match(r))return a(r.payload);if(kU.match(r))return void l();if(kH.match(r))return o(r.payload);let u=e.getState(),d=()=>{if(u===kD)throw Error(kG(23));return u};try{if(c=n(r),t.size>0){let n=e.getState();for(let a of Array.from(t.values())){let t=!1;try{t=a.predicate(r,n,u)}catch(e){t=!1,kF(i,e,{raisedBy:"predicate"})}t&&s(a,r,e,d)}}}finally{u=kD}return c},startListening:a,stopListening:o,clearListeners:l}};function kG(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");var kX=e.i(92068);function k$(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function kq(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((e,t,r)=>{var i=n[r-1];return"string"==typeof i?e+i+t:void 0!==i?e+k$(i)+t:e+t},"")}var kK=e=>0===e?0:e>0?1:-1,kZ=e=>"number"==typeof e&&e!=+e,kQ=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,kJ=e=>("number"==typeof e||e instanceof Number)&&!kZ(e),k0=e=>kJ(e)||"string"==typeof e,k1=0,k2=e=>{var t=++k1;return"".concat(e||"").concat(t)},k5=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!kJ(e)&&"string"!=typeof e)return r;if(kQ(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return kZ(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},k3=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(n[String(e[r])])return!0;else n[String(e[r])]=!0;return!1};function k4(e,t,n){return kJ(e)&&kJ(t)?k$(e+n*(t-e)):t}function k6(e,t,n){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,kX.default)(e,t))===n)}var k8=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function k7(e){return null!=e}function k9(){}function Ee(e,t){if(t){var n=Number.parseInt(t,10);if(!kZ(n))return null==e?void 0:e[n]}}var Et=kp({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),En=Et.reducer,{createEventEmitter:Er}=Et.actions,Ei=(e.i(13027),{notify(){},get:()=>[]}),Ea="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Eo="u">typeof navigator&&"ReactNative"===navigator.product,Es=Ea||Eo?em.useLayoutEffect:em.useEffect;function El(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var Ec=Symbol.for("react-redux-context"),Eu="u">typeof globalThis?globalThis:{},Ed=function(){if(!em.createContext)return{};let e=Eu[Ec]??=new Map,t=e.get(em.createContext);return t||(t=em.createContext(null),e.set(em.createContext,t)),t}(),Eh=function(e){let{children:t,context:n,serverState:r,store:i}=e,a=em.useMemo(()=>{let e=function(e){let t,n=Ei,r=0,i=!1;function a(){l.onStateChange&&l.onStateChange()}function o(){if(r++,!t){let r,i;t=e.subscribe(a),r=null,i=null,n={clear(){r=null,i=null},notify(){let e=r;for(;e;)e.callback(),e=e.next},get(){let e=[],t=r;for(;t;)e.push(t),t=t.next;return e},subscribe(e){let t=!0,n=i={callback:e,next:null,prev:i};return n.prev?n.prev.next=n:r=n,function(){t&&null!==r&&(t=!1,n.next?n.next.prev=n.prev:i=n.prev,n.prev?n.prev.next=n.next:r=n.next)}}}}}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=Ei)}let l={addNestedSub:function(e){o();let t=n.subscribe(e),r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:a,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,o())},tryUnsubscribe:function(){i&&(i=!1,s())},getListeners:()=>n};return l}(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=em.useMemo(()=>i.getState(),[i]);return Es(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]),em.createElement((n||Ed).Provider,{value:a},t)};function Ef(e=Ed){return function(){return em.useContext(e)}}var Ep=Ef(),Em=Symbol.for("immer-nothing"),Eg=Symbol.for("immer-draftable"),Ev=Symbol.for("immer-state");function Ex(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ey=Object.getPrototypeOf;function Eb(e){return!!e&&!!e[Ev]}function Ew(e){return!!e&&(Ek(e)||Array.isArray(e)||!!e[Eg]||!!e.constructor?.[Eg]||ET(e)||EA(e))}var Ej=Object.prototype.constructor.toString(),EN=new WeakMap;function Ek(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=EN.get(n);return void 0===r&&(r=Function.toString.call(n),EN.set(n,r)),r===Ej}function EE(e,t,n=!0){0===EC(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function EC(e){let t=e[Ev];return t?t.type_:Array.isArray(e)?1:ET(e)?2:3*!!EA(e)}function E_(e,t){return 2===EC(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ES(e,t,n){let r=EC(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ET(e){return e instanceof Map}function EA(e){return e instanceof Set}function EO(e){return e.copy_||e.base_}function EM(e,t){if(ET(e))return new Map(e);if(EA(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=Ek(e);if(!0!==t&&("class_only"!==t||n)){let t=Ey(e);return null!==t&&n?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[Ev];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Ey(e),t)}}function EP(e,t=!1){return EL(e)||Eb(e)||!Ew(e)||(EC(e)>1&&Object.defineProperties(e,{set:ED,add:ED,clear:ED,delete:ED}),Object.freeze(e),t&&Object.values(e).forEach(e=>EP(e,!0))),e}var ED={value:function(){Ex(2)}};function EL(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var EI={};function ER(e){let t=EI[e];return t||Ex(0,e),t}function EB(e,t){t&&(ER("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ez(e){EF(e),e.drafts_.forEach(EU),e.drafts_=null}function EF(e){e===R&&(R=e.parent_)}function EV(e){return R={drafts_:[],parent_:R,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function EU(e){let t=e[Ev];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function EH(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ev].modified_&&(Ez(t),Ex(4)),Ew(e)&&(e=EW(t,e),t.parent_||EG(t,e)),t.patches_&&ER("Patches").generateReplacementPatches_(n[Ev].base_,e,t.patches_,t.inversePatches_)):e=EW(t,n,[]),Ez(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Em?e:void 0}function EW(e,t,n){if(EL(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[Ev];if(!i)return EE(t,(r,a)=>EY(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return EG(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;3===i.type_&&(a=new Set(t),t.clear(),o=!0),EE(a,(r,a)=>EY(e,i,t,r,a,n,o),r),EG(e,t,!1),n&&e.patches_&&ER("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function EY(e,t,n,r,i,a,o){if(null==i||"object"!=typeof i&&!o)return;let s=EL(i);if(!s||o){if(Eb(i)){let o=EW(e,i,a&&t&&3!==t.type_&&!E_(t.assigned_,r)?a.concat(r):void 0);if(ES(n,r,o),!Eb(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(Ew(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;EW(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&(ET(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&EG(e,i)}}}function EG(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&EP(t,n)}var EX={get(e,t){if(t===Ev)return e;let n=EO(e);if(!E_(n,t)){var r;let i;return r=e,(i=EK(n,t))?"value"in i?i.value:i.get?.call(r.draft_):void 0}let i=n[t];return e.finalized_||!Ew(i)?i:i===Eq(e.base_,t)?(EQ(e),e.copy_[t]=E0(i,e)):i},has:(e,t)=>t in EO(e),ownKeys:e=>Reflect.ownKeys(EO(e)),set(e,t,n){let r=EK(EO(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Eq(EO(e),t),i=r?.[Ev];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||E_(e.base_,t)))return!0;EQ(e),EZ(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty:(e,t)=>(void 0!==Eq(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,EQ(e),EZ(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=EO(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ex(11)},getPrototypeOf:e=>Ey(e.base_),setPrototypeOf(){Ex(12)}},E$={};function Eq(e,t){let n=e[Ev];return(n?EO(n):e)[t]}function EK(e,t){if(!(t in e))return;let n=Ey(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ey(n)}}function EZ(e){!e.modified_&&(e.modified_=!0,e.parent_&&EZ(e.parent_))}function EQ(e){e.copy_||(e.copy_=EM(e.base_,e.scope_.immer_.useStrictShallowCopy_))}EE(EX,(e,t)=>{E$[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),E$.deleteProperty=function(e,t){return E$.set.call(this,e,t,void 0)},E$.set=function(e,t,n){return EX.set.call(this,e[0],t,n,e[0])};var EJ=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{let r;if("function"==typeof e&&"function"!=typeof t){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if("function"!=typeof t&&Ex(6),void 0!==n&&"function"!=typeof n&&Ex(7),Ew(e)){let i=EV(this),a=E0(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Ez(i):EF(i)}return EB(i,n),EH(r,i)}if(e&&"object"==typeof e)Ex(1,e);else{if(void 0===(r=t(e))&&(r=e),r===Em&&(r=void 0),this.autoFreeze_&&EP(r,!0),n){let t=[],i=[];ER("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return"function"==typeof e?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;Ew(e)||Ex(8),Eb(e)&&(Eb(t=e)||Ex(10,t),e=function e(t){let n;if(!Ew(t)||EL(t))return t;let r=t[Ev],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=EM(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=EM(t,!0);return EE(n,(t,r)=>{ES(n,t,e(r))},i),r&&(r.finalized_=!1),n}(t));let n=EV(this),r=E0(e,void 0);return r[Ev].isManual_=!0,EF(n),r}finishDraft(e,t){let n=e&&e[Ev];n&&n.isManual_||Ex(9);let{scope_:r}=n;return EB(r,t),EH(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=ER("Patches").applyPatches_;return Eb(e)?r(e,t):this.produce(e,e=>r(e,t))}};function E0(e,t){let n=ET(e)?ER("MapSet").proxyMap_(e,t):EA(e)?ER("MapSet").proxySet_(e,t):function(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:R,modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=EX;n&&(i=[r],a=E$);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}(e,t);return(t?t.scope_:R).drafts_.push(n),n}new EJ().produce;var E1={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},E2=kp({name:"tooltip",initialState:{itemInteraction:{click:E1,hover:E1},axisInteraction:{click:E1,hover:E1},keyboardInteraction:E1,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:kl()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:kl()},removeTooltipEntrySettings:{reducer(e,t){var n=NL(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:kl()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:E5,replaceTooltipEntrySettings:E3,removeTooltipEntrySettings:E4,setTooltipSettingsState:E6,setActiveMouseOverItemIndex:E8,mouseLeaveItem:E7,mouseLeaveChart:E9,setActiveClickItemIndex:Ce,setMouseOverAxisIndex:Ct,setMouseClickAxisIndex:Cn,setSyncInteraction:Cr,setKeyboardInteraction:Ci}=E2.actions,Ca=E2.reducer,Co=kp({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;null!=n&&(e.dataStartIndex=n),null!=r&&(e.dataEndIndex=r)}}}),{setChartData:Cs,setDataStartEndIndexes:Cl,setComputedData:Cc}=Co.actions,Cu=Co.reducer,Cd=kp({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=null!=(n=t.payload.top)?n:0,e.margin.right=null!=(r=t.payload.right)?r:0,e.margin.bottom=null!=(i=t.payload.bottom)?i:0,e.margin.left=null!=(a=t.payload.left)?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Ch,setLayout:Cf,setChartSize:Cp,setScale:Cm}=Cd.actions,Cg=Cd.reducer,Cv=e.i(30224),Cx=(0,em.createContext)(null),Cy=e=>e,Cb=()=>{var e=(0,em.useContext)(Cx);return e?e.store.dispatch:Cy},Cw=()=>{},Cj=()=>Cw,CN=(e,t)=>e===t;function Ck(e){var t=(0,em.useContext)(Cx);return(0,Cv.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Cj,t?t.store.getState:Cw,t?t.store.getState:Cw,t?e:Cw,CN)}var CE=e.i(42342),CC=e=>e.legend.settings;function C_(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function CS(e){return function(){return e}}function CT(e,t){if((i=e.length)>1)for(var n,r,i,a=1,o=e[t[0]],s=o.length;a<i;++a)for(r=o,o=e[t[a]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function CA(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function CO(e,t){return e[t]}function CM(e){let t=[];return t.key=e,t}function CP(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function CD(e){return Number.isFinite(e)}function CL(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function CI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function CR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CI(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function CB(e,t,n){return null==e||null==t?n:k0(t)?(0,kX.default)(e,t,n):"function"==typeof t?t(e):n}N0([e=>e.legend.payload,CC],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,CE.default)(r,n):r}),Array.prototype.slice;var Cz=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,CF=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},CV=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:u,ticks:d,niceTicks:h,axisType:f}=e;if(!o)return null;var p="scaleBand"===s&&o.bandwidth?o.bandwidth()/2:2,g=(t||n)&&"category"===i&&o.bandwidth?o.bandwidth()/p:0;return(g="angleAxis"===f&&a&&a.length>=2?2*kK(a[0]-a[1])*g:g,t&&(d||h))?(d||h||[]).map((e,t)=>({coordinate:o(r?r.indexOf(e):e)+g,value:e,offset:g,index:t})).filter(e=>!kZ(e.coordinate)):l&&c?c.map((e,t)=>({coordinate:o(e)+g,value:e,index:t,offset:g})):o.ticks&&!n&&null!=u?o.ticks(u).map((e,t)=>({coordinate:o(e)+g,value:e,offset:g,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+g,value:r?r[e]:e,index:t,offset:g}))},CU={sign:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0,s=0;s<n;++s){var l=e[s],c=null==l?void 0:l[i];if(null!=c){var u=c[1],d=c[0],h=kZ(u)?d:u;h>=0?(c[0]=a,c[1]=a+h,a=u):(c[0]=o,c[1]=o+h,o=u)}}}},expand:function(e,t){if((r=e.length)>0){for(var n,r,i,a=0,o=e[0].length;a<o;++a){for(i=n=0;n<r;++n)i+=e[n][a][1]||0;if(i)for(n=0;n<r;++n)e[n][a][1]/=i}CT(e,t)}},none:CT,silhouette:function(e,t){if((n=e.length)>0){for(var n,r=0,i=e[t[0]],a=i.length;r<a;++r){for(var o=0,s=0;o<n;++o)s+=e[o][r][1]||0;i[r][1]+=i[r][0]=-s/2}CT(e,t)}},wiggle:function(e,t){if((i=e.length)>0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,a=0,o=1;o<r;++o){for(var s=0,l=0,c=0;s<i;++s){for(var u=e[t[s]],d=u[o][1]||0,h=(d-(u[o-1][1]||0))/2,f=0;f<s;++f){var p=e[t[f]];h+=(p[o][1]||0)-(p[o-1][1]||0)}l+=d,c+=h*d}n[o-1][1]+=n[o-1][0]=a,l&&(a-=c/l)}n[o-1][1]+=n[o-1][0]=a,CT(e,t)}},positive:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0;o<n;++o){var s=e[o],l=null==s?void 0:s[i];if(null!=l){var c=kZ(l[1])?l[0]:l[1];c>=0?(l[0]=a,l[1]=a+c,a=l[1]):(l[0]=0,l[1]=0)}}}}};function CH(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&null!=i[t.dataKey]){var s=k6(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=CB(i,null==o?t.dataKey:o);return null==l?null:t.scale(l)}var CW=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,CY=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,CG=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,CE.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],c=i[o-1];a=Math.min(((null==l?void 0:l.coordinate)||0)-((null==c?void 0:c.coordinate)||0),a)}return a===1/0?0:a}return n?void 0:0};function CX(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return CR(CR({},t),{},{dataKey:n,payload:r,value:i,name:a})}function C$(e,t){return e?String(e):"string"==typeof t?t:void 0}var Cq=e=>e.layout.width,CK=e=>e.layout.height,CZ=e=>e.layout.scale,CQ=e=>e.layout.margin,CJ=N0(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),C0=N0(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function C1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C1(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var C5=N0([Cq,CK,CQ,e=>e.brush.height,function(e){return C0(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return C0(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return CJ(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return CJ(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},CC,e=>e.legend.size],(e,t,n,r,i,a,o,s,l,c)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=C2(C2({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),h=d.bottom;d.bottom+=r;var f=e-(d=((e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if(("vertical"===s||"horizontal"===s&&"middle"===o)&&"center"!==a&&kJ(e[a]))return CR(CR({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===s||"vertical"===s&&"center"===a)&&"middle"!==o&&kJ(e[o]))return CR(CR({},e),{},{[o]:e[o]+(i||0)})}return e})(d,l,c)).left-d.right,p=t-d.top-d.bottom;return C2(C2({brushBottom:h},d),{},{width:Math.max(f,0),height:Math.max(p,0)})}),C3=N0(C5,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),C4=N0(Cq,CK,(e,t)=>({x:0,y:0,width:e,height:t})),C6=(0,em.createContext)(null),C8=()=>null!=(0,em.useContext)(C6),C7=e=>e.brush,C9=N0([C7,C5,CQ],(e,t,n)=>({height:e.height,x:kJ(e.x)?e.x:t.left,y:kJ(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:kJ(e.width)?e.width:t.width})),_e=e.i(7670),_t=e.i(58723),_n=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if("u">typeof console&&console.warn&&(void 0===t&&console.warn("LogUtils requires an error message argument"),!e))if(void 0===t)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(t.replace(/%s/g,()=>r[a++]))}},_r=(e,t,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=kQ(r)?e:Number(r),l=kQ(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&null!=l&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},_i={width:0,height:0,overflow:"visible"},_a={width:0,overflowX:"visible"},_o={height:0,overflowY:"visible"},_s={};function _l(){return(_l=Object.assign.bind()).apply(null,arguments)}function _c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_c(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _d=(0,em.createContext)({width:-1,height:-1});function _h(e){var{children:t,width:n,height:r}=e,i=(0,em.useMemo)(()=>({width:n,height:r}),[n,r]);return CL(i.width)&&CL(i.height)?em.createElement(_d.Provider,{value:i},t):null}var _f=()=>(0,em.useContext)(_d),_p=(0,em.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:l,children:c,debounce:u=0,id:d,className:h,onResize:f,style:p={}}=e,g=(0,em.useRef)(null),v=(0,em.useRef)();v.current=f,(0,em.useImperativeHandle)(t,()=>g.current);var[x,y]=(0,em.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,em.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,em.useEffect)(()=>{if(null==g.current||"u"<typeof ResizeObserver)return k9;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;b(n,r),null==(t=v.current)||t.call(v,n,r)};u>0&&(e=(0,_t.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=g.current.getBoundingClientRect();return b(n,r),t.observe(g.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:w,containerHeight:j}=x;_n(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:N,calculatedHeight:k}=_r(w,j,{width:i,height:a,aspect:n,maxHeight:l});return _n(null!=N&&N>0||null!=k&&k>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",N,k,i,a,o,s,n),em.createElement("div",{id:d?"".concat(d):void 0,className:(0,_e.clsx)("recharts-responsive-container",h),style:_u(_u({},p),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},em.createElement("div",{style:(e=>{var{width:t,height:n}=e,r=kQ(t),i=kQ(n);return r&&i?_i:r?_a:i?_o:_s})({width:i,height:a})},em.createElement(_h,{width:N,height:k},c)))}),_m=(0,em.forwardRef)((e,t)=>{var n=_f();if(CL(n.width)&&CL(n.height))return e.children;var{width:r,height:i}=function(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return void 0===i&&void 0===a?(i="100%",a="100%"):void 0===i?i=r&&r>0?void 0:"100%":void 0===a&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=_r(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return kJ(a)&&kJ(o)?em.createElement(_h,{width:a,height:o},e.children):em.createElement(_p,_l({},e,{width:r,height:i,ref:t}))});function _g(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var _v=()=>{var e,t=C8(),n=Ck(C3),r=Ck(C9),i=null==(e=Ck(C7))?void 0:e.padding;return t&&r&&i?{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}:n},_x={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_y=()=>{var e;return null!=(e=Ck(C5))?e:_x},_b=e=>e.layout.layoutType,_w=e=>{var t=Cb(),n=C8(),{width:r,height:i}=e,a=_f(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,em.useEffect)(()=>{!n&&CL(o)&&CL(s)&&t(Cp({width:o,height:s}))},[t,n,o,s]),null},_j=e.i(66814);function _N(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function _k(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}e.s([],25212),e.i(25212),e.s([],67155),e.i(67155);class _E extends Map{constructor(e,t=__){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(_C(this,e))}has(e){return super.has(_C(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}(this,e))}}function _C({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function __(e){return null!==e&&"object"==typeof e?e.valueOf():e}let _S=Symbol("implicit");function _T(){var e=new _E,t=[],n=[],r=_S;function i(i){let a=e.get(i);if(void 0===a){if(r!==_S)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();for(let r of(t=[],e=new _E,n))e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return _T(t,n).unknown(r)},_N.apply(i,arguments),i}function _A(){var e,t,n=_T().unknown(void 0),r=n.domain,i=n.range,a=0,o=1,s=!1,l=0,c=0,u=.5;function d(){var n=r().length,d=o<a,h=d?o:a,f=d?a:o;e=(f-h)/Math.max(1,n-l+2*c),s&&(e=Math.floor(e)),h+=(f-h-e*(n-l))*u,t=e*(1-l),s&&(h=Math.round(h),t=Math.round(t));var p=(function(e,t,n){e*=1,t*=1,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);++r<i;)a[r]=e+r*n;return a})(n).map(function(t){return h+e*t});return i(d?p.reverse():p)}return delete n.unknown,n.domain=function(e){return arguments.length?(r(e),d()):r()},n.range=function(e){return arguments.length?([a,o]=e,a*=1,o*=1,d()):[a,o]},n.rangeRound=function(e){return[a,o]=e,a*=1,o*=1,s=!0,d()},n.bandwidth=function(){return t},n.step=function(){return e},n.round=function(e){return arguments.length?(s=!!e,d()):s},n.padding=function(e){return arguments.length?(l=Math.min(1,c=+e),d()):l},n.paddingInner=function(e){return arguments.length?(l=Math.min(1,e),d()):l},n.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},n.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},n.copy=function(){return _A(r(),[a,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},_N.apply(d(),arguments)}function _O(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return e(n())},t}(_A.apply(null,arguments).paddingInner(1))}let _M=Math.sqrt(50),_P=Math.sqrt(10),_D=Math.sqrt(2);function _L(e,t,n){let r,i,a,o=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(o)),l=o/Math.pow(10,s),c=l>=_M?10:l>=_P?5:l>=_D?2:1;return(s<0?(r=Math.round(e*(a=Math.pow(10,-s)/c)),i=Math.round(t*a),r/a<e&&++r,i/a>t&&--i,a=-a):(r=Math.round(e/(a=Math.pow(10,s)*c)),i=Math.round(t/a),r*a<e&&++r,i*a>t&&--i),i<r&&.5<=n&&n<2)?_L(e,t,2*n):[r,i,a]}function _I(e,t,n){if(t*=1,e*=1,!((n*=1)>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?_L(t,e,n):_L(e,t,n);if(!(a>=i))return[];let s=a-i+1,l=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)l[e]=-((a-e)/o);else for(let e=0;e<s;++e)l[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)l[e]=-((i+e)/o);else for(let e=0;e<s;++e)l[e]=(i+e)*o;return l}function _R(e,t,n){return _L(e*=1,t*=1,n*=1)[2]}function _B(e,t,n){t*=1,e*=1,n*=1;let r=t<e,i=r?_R(t,e,n):_R(e,t,n);return(r?-1:1)*(i<0?-(1/i):i)}function _z(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _F(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _V(e){let t,n,r;function i(e,r,a=0,o=e.length){if(a<o){if(0!==t(r,r))return o;do{let t=a+o>>>1;0>n(e[t],r)?a=t+1:o=t}while(a<o)}return a}return 2!==e.length?(t=_z,n=(t,n)=>_z(e(t),n),r=(t,n)=>e(t)-n):(t=e===_z||e===_F?e:_U,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i<a){if(0!==t(r,r))return a;do{let t=i+a>>>1;0>=n(e[t],r)?i=t+1:a=t}while(i<a)}return i}}}function _U(){return 0}function _H(e){return null===e?NaN:+e}let _W=_V(_z),_Y=_W.right;function _G(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _X(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _$(){}_W.left,_V(_H).center;var _q="\\s*([+-]?\\d+)\\s*",_K="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_Z="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_Q=/^#([0-9a-f]{3,8})$/,_J=RegExp(`^rgb\\(${_q},${_q},${_q}\\)$`),_0=RegExp(`^rgb\\(${_Z},${_Z},${_Z}\\)$`),_1=RegExp(`^rgba\\(${_q},${_q},${_q},${_K}\\)$`),_2=RegExp(`^rgba\\(${_Z},${_Z},${_Z},${_K}\\)$`),_5=RegExp(`^hsl\\(${_K},${_Z},${_Z}\\)$`),_3=RegExp(`^hsla\\(${_K},${_Z},${_Z},${_K}\\)$`),_4={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function _6(){return this.rgb().formatHex()}function _8(){return this.rgb().formatRgb()}function _7(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_Q.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?_9(t):3===n?new Sn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Se(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Se(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=_J.exec(e))?new Sn(t[1],t[2],t[3],1):(t=_0.exec(e))?new Sn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=_1.exec(e))?Se(t[1],t[2],t[3],t[4]):(t=_2.exec(e))?Se(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=_5.exec(e))?Sl(t[1],t[2]/100,t[3]/100,1):(t=_3.exec(e))?Sl(t[1],t[2]/100,t[3]/100,t[4]):_4.hasOwnProperty(e)?_9(_4[e]):"transparent"===e?new Sn(NaN,NaN,NaN,0):null}function _9(e){return new Sn(e>>16&255,e>>8&255,255&e,1)}function Se(e,t,n,r){return r<=0&&(e=t=n=NaN),new Sn(e,t,n,r)}function St(e,t,n,r){var i;return 1==arguments.length?((i=e)instanceof _$||(i=_7(i)),i)?new Sn((i=i.rgb()).r,i.g,i.b,i.opacity):new Sn:new Sn(e,t,n,null==r?1:r)}function Sn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Sr(){return`#${Ss(this.r)}${Ss(this.g)}${Ss(this.b)}`}function Si(){let e=Sa(this.opacity);return`${1===e?"rgb(":"rgba("}${So(this.r)}, ${So(this.g)}, ${So(this.b)}${1===e?")":`, ${e})`}`}function Sa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function So(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ss(e){return((e=So(e))<16?"0":"")+e.toString(16)}function Sl(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Su(e,t,n,r)}function Sc(e){if(e instanceof Su)return new Su(e.h,e.s,e.l,e.opacity);if(e instanceof _$||(e=_7(e)),!e)return new Su;if(e instanceof Su)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new Su(o,s,l,e.opacity)}function Su(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Sd(e){return(e=(e||0)%360)<0?e+360:e}function Sh(e){return Math.max(0,Math.min(1,e||0))}function Sf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function Sp(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}_G(_$,_7,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_6,formatHex:_6,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Sc(this).formatHsl()},formatRgb:_8,toString:_8}),_G(Sn,St,_X(_$,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Sn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Sn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Sn(So(this.r),So(this.g),So(this.b),Sa(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Sr,formatHex:Sr,formatHex8:function(){return`#${Ss(this.r)}${Ss(this.g)}${Ss(this.b)}${Ss((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:Si,toString:Si})),_G(Su,function(e,t,n,r){return 1==arguments.length?Sc(e):new Su(e,t,n,null==r?1:r)},_X(_$,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Su(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Su(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Sn(Sf(e>=240?e-240:e+120,i,r),Sf(e,i,r),Sf(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Su(Sd(this.h),Sh(this.s),Sh(this.l),Sa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Sa(this.opacity);return`${1===e?"hsl(":"hsla("}${Sd(this.h)}, ${100*Sh(this.s)}%, ${100*Sh(this.l)}%${1===e?")":`, ${e})`}`}}));let Sm=e=>()=>e;function Sg(e,t){var n=t-e;return n?function(t){return e+t*n}:Sm(isNaN(e)?t:e)}let Sv=function e(t){var n,r=1==(n=+t)?Sg:function(e,t){var r,i,a;return t-e?(r=e,i=t,r=Math.pow(r,a=n),i=Math.pow(i,a)-r,a=1/a,function(e){return Math.pow(r+e*i,a)}):Sm(isNaN(e)?t:e)};function i(e,t){var n=r((e=St(e)).r,(t=St(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=Sg(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function Sx(e){return function(t){var n,r,i=t.length,a=Array(i),o=Array(i),s=Array(i);for(n=0;n<i;++n)r=St(t[n]),a[n]=r.r||0,o[n]=r.g||0,s[n]=r.b||0;return a=e(a),o=e(o),s=e(s),r.opacity=1,function(e){return r.r=a(e),r.g=o(e),r.b=s(e),r+""}}}function Sy(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}Sx(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return Sp((n-r/t)*t,o,i,a,s)}}),Sx(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return Sp((n-r/t)*t,i,a,o,s)}});var Sb=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sw=RegExp(Sb.source,"g");function Sj(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?Sm(t):("number"===i?Sy:"string"===i?(r=_7(t))?(t=r,Sv):function(e,t){var n,r,i,a,o,s=Sb.lastIndex=Sw.lastIndex=0,l=-1,c=[],u=[];for(e+="",t+="";(i=Sb.exec(e))&&(a=Sw.exec(t));)(o=a.index)>s&&(o=t.slice(s,o),c[l]?c[l]+=o:c[++l]=o),(i=i[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,u.push({i:l,x:Sy(i,a)})),s=Sw.lastIndex;return s<t.length&&(o=t.slice(s),c[l]?c[l]+=o:c[++l]=o),c.length<2?u[0]?(n=u[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=u.length,function(e){for(var n,r=0;r<t;++r)c[(n=u[r]).i]=n.x(e);return c.join("")})}:t instanceof _7?Sv:t instanceof Date?function(e,t){var n=new Date;return e*=1,t*=1,function(r){return n.setTime(e*(1-r)+t*r),n}}:!ArrayBuffer.isView(n=t)||n instanceof DataView?Array.isArray(t)?function(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=Array(i),o=Array(r);for(n=0;n<i;++n)a[n]=Sj(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var n,r={},i={};for(n in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)n in e?r[n]=Sj(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}:Sy:function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}})(e,t)}function SN(e,t){return e*=1,t*=1,function(n){return Math.round(e*(1-n)+t*n)}}function Sk(e){return+e}var SE=[0,1];function SC(e){return e}function S_(e,t){var n;return(t-=e*=1)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n})}function SS(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=S_(i,r),a=n(o,a)):(r=S_(r,i),a=n(a,o)),function(e){return a(r(e))}}function ST(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=S_(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_Y(e,t,1,r)-1;return a[n](i[n](t))}}function SA(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function SO(){var e,t,n,r,i,a,o=SE,s=SE,l=Sj,c=SC;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==SC&&(e=o[0],t=o[l-1],e>t&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?ST:SS,i=a=null,d}function d(t){return null==t||isNaN(t*=1)?n:(i||(i=r(o.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,o.map(e),Sy)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,Sk),u()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=SN,u()},d.clamp=function(e){return arguments.length?(c=!!e||SC,u()):c!==SC},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}function SM(){return SO()(SC,SC)}function SP(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function SD(e){return(e=SP(Math.abs(e)))?e[1]:NaN}var SL=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function SI(e){var t;if(!(t=SL.exec(e)))throw Error("invalid format: "+e);return new SR({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function SR(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function SB(e,t){var n=SP(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+Array(i-r.length+2).join("0")}SI.prototype=SR.prototype,SR.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let Sz={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>SB(100*e,t),r:SB,s:function(e,t){var n=SP(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(B=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+Array(1-a).join("0")+SP(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function SF(e){return e}var SV=Array.prototype.map,SU=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function SH(e,t,n,r){var i,a,o=_B(e,t,n);switch((r=SI(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(a=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(SD(s)/3)))-SD(Math.abs(o))))||(r.precision=a),V(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(a=Math.max(0,SD(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=o)))-SD(i))+1)||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=Math.max(0,-SD(Math.abs(o))))||(r.precision=a-("%"===r.type)*2)}return F(r)}function SW(e){var t=e.domain;return e.ticks=function(e){var n=t();return _I(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return SH(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,s=a.length-1,l=a[o],c=a[s],u=10;for(c<l&&(i=l,l=c,c=i,i=o,o=s,s=i);u-- >0;){if((i=_R(l,c,n))===r)return a[o]=l,a[s]=c,t(a);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else if(i<0)l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i;else break;r=i}return e},e}function SY(){var e=SM();return e.copy=function(){return SA(e,SY())},_N.apply(e,arguments),SW(e)}function SG(e){var t;function n(e){return null==e||isNaN(e*=1)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,Sk),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return SG(e).unknown(t)},e=arguments.length?Array.from(e,Sk):[0,1],SW(n)}function SX(e,t){e=e.slice();var n,r=0,i=e.length-1,a=e[r],o=e[i];return o<a&&(n=r,r=i,i=n,n=a,a=o,o=n),e[r]=t.floor(a),e[i]=t.ceil(o),e}function S$(e){return Math.log(e)}function Sq(e){return Math.exp(e)}function SK(e){return-Math.log(-e)}function SZ(e){return-Math.exp(-e)}function SQ(e){return isFinite(e)?+("1e"+e):e<0?0:e}function SJ(e){return(t,n)=>-e(-t,n)}function S0(e){let t,n,r=e(S$,Sq),i=r.domain,a=10;function o(){var o,s;return t=(o=a)===Math.E?Math.log:10===o&&Math.log10||2===o&&Math.log2||(o=Math.log(o),e=>Math.log(e)/o),n=10===(s=a)?SQ:s===Math.E?Math.exp:e=>Math.pow(s,e),i()[0]<0?(t=SJ(t),n=SJ(n),e(SK,SZ)):e(S$,Sq),r}return r.base=function(e){return arguments.length?(a=+e,o()):a},r.domain=function(e){return arguments.length?(i(e),o()):i()},r.ticks=e=>{let r,o,s=i(),l=s[0],c=s[s.length-1],u=c<l;u&&([l,c]=[c,l]);let d=t(l),h=t(c),f=null==e?10:+e,p=[];if(!(a%1)&&h-d<f){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(r=1;r<a;++r)if(!((o=d<0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}}else for(;d<=h;++d)for(r=a-1;r>=1;--r)if(!((o=d>0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}2*p.length<f&&(p=_I(l,c,f))}else p=_I(d,h,Math.min(h-d,f)).map(n);return u?p.reverse():p},r.tickFormat=(e,i)=>{if(null==e&&(e=10),null==i&&(i=10===a?"s":","),"function"!=typeof i&&(a%1||null!=(i=SI(i)).precision||(i.trim=!0),i=F(i)),e===1/0)return i;let o=Math.max(1,a*e/r.ticks().length);return e=>{let r=e/n(Math.round(t(e)));return r*a<a-.5&&(r*=a),r<=o?i(e):""}},r.nice=()=>i(SX(i(),{floor:e=>n(Math.floor(t(e))),ceil:e=>n(Math.ceil(t(e)))})),r}function S1(){let e=S0(SO()).domain([1,10]);return e.copy=()=>SA(e,S1()).base(e.base()),_N.apply(e,arguments),e}function S2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function S5(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function S3(e){var t=1,n=e(S2(1),S5(t));return n.constant=function(n){return arguments.length?e(S2(t=+n),S5(t)):t},SW(n)}function S4(){var e=S3(SO());return e.copy=function(){return SA(e,S4()).constant(e.constant())},_N.apply(e,arguments)}function S6(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function S8(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function S7(e){return e<0?-e*e:e*e}function S9(e){var t=e(SC,SC),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(SC,SC):.5===n?e(S8,S7):e(S6(n),S6(1/n)):n},SW(t)}function Te(){var e=S9(SO());return e.copy=function(){return SA(e,Te()).exponent(e.exponent())},_N.apply(e,arguments),e}function Tt(){return Te.apply(null,arguments).exponent(.5)}function Tn(e){return Math.sign(e)*e*e}function Tr(){var e,t=SM(),n=[0,1],r=!1;function i(n){var i,a=Math.sign(i=t(n))*Math.sqrt(Math.abs(i));return isNaN(a)?e:r?Math.round(a):a}return i.invert=function(e){return t.invert(Tn(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain()},i.range=function(e){return arguments.length?(t.range((n=Array.from(e,Sk)).map(Tn)),i):n.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(r=!!e,i):r},i.clamp=function(e){return arguments.length?(t.clamp(e),i):t.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Tr(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},_N.apply(i,arguments),SW(i)}function Ti(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function Ta(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function To(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function Ts(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Tl(){var e,t=[],n=[],r=[];function i(){var e=0,i=Math.max(1,n.length);for(r=Array(i-1);++e<i;)r[e-1]=function(e,t,n=_H){if(!(!(r=e.length)||isNaN(t*=1))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(n(e[a+1],a+1,e)-o)*(i-a)}}(t,e/i);return a}function a(t){return null==t||isNaN(t*=1)?e:n[_Y(r,t)]}return a.invertExtent=function(e){var i=n.indexOf(e);return i<0?[NaN,NaN]:[i>0?r[i-1]:t[0],i<r.length?r[i]:t[t.length-1]]},a.domain=function(e){if(!arguments.length)return t.slice();for(let n of(t=[],e))null==n||isNaN(n*=1)||t.push(n);return t.sort(_z),i()},a.range=function(e){return arguments.length?(n=Array.from(e),i()):n.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return r.slice()},a.copy=function(){return Tl().domain(t).range(n).unknown(e)},_N.apply(a,arguments)}function Tc(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[_Y(i,t,0,r)]:e}function s(){var e=-1;for(i=Array(r);++e<r;)i[e]=((e+1)*n-(e-r)*t)/(r+1);return o}return o.domain=function(e){return arguments.length?([t,n]=e,t*=1,n*=1,s()):[t,n]},o.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,s()):a.slice()},o.invertExtent=function(e){var o=a.indexOf(e);return o<0?[NaN,NaN]:o<1?[t,i[0]]:o>=r?[i[r-1],n]:[i[o-1],i[o]]},o.unknown=function(t){return arguments.length&&(e=t),o},o.thresholds=function(){return i.slice()},o.copy=function(){return Tc().domain([t,n]).range(a).unknown(e)},_N.apply(SW(o),arguments)}function Tu(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[_Y(t,i,0,r)]:e}return i.domain=function(e){return arguments.length?(r=Math.min((t=Array.from(e)).length,n.length-1),i):t.slice()},i.range=function(e){return arguments.length?(n=Array.from(e),r=Math.min(t.length,n.length-1),i):n.slice()},i.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Tu().domain(t).range(n).unknown(e)},_N.apply(i,arguments)}F=(z=function(e){var t,n,r,i=void 0===e.grouping||void 0===e.thousands?SF:(t=SV.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(i-=s,i+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(n)}),a=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",s=void 0===e.decimal?".":e.decimal+"",l=void 0===e.numerals?SF:(r=SV.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return r[+e]})}),c=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",d=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=SI(e)).fill,n=e.align,r=e.sign,h=e.symbol,f=e.zero,p=e.width,g=e.comma,v=e.precision,x=e.trim,y=e.type;"n"===y?(g=!0,y="g"):Sz[y]||(void 0===v&&(v=12),x=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===h?a:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?c:"",j=Sz[y],N=/[defgprs%]/.test(y);function k(e){var a,o,c,h=b,k=w;if("c"===y)k=j(e)+k,e="";else{var E=(e*=1)<0||1/e<0;if(e=isNaN(e)?d:j(Math.abs(e),v),x&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r<n;++r)switch(e[r]){case".":i=t=r;break;case"0":0===i&&(i=r),t=r;break;default:if(!+e[r])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==r&&(E=!1),h=(E?"("===r?r:u:"-"===r||"("===r?"":r)+h,k=("s"===y?SU[8+B/3]:"")+k+(E&&"("===r?")":""),N){for(a=-1,o=e.length;++a<o;)if(48>(c=e.charCodeAt(a))||c>57){k=(46===c?s+e.slice(a+1):e.slice(a))+k,e=e.slice(0,a);break}}}g&&!f&&(e=i(e,1/0));var C=h.length+e.length+k.length,_=C<p?Array(p-C+1).join(t):"";switch(g&&f&&(e=i(_+e,_.length?p-k.length:1/0),_=""),n){case"<":e=h+e+k+_;break;case"=":e=h+_+e+k;break;case"^":e=_.slice(0,C=_.length>>1)+h+e+k+_.slice(C);break;default:e=_+h+e+k}return l(e)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),k.toString=function(){return e+""},k}return{format:h,formatPrefix:function(e,t){var n=h(((e=SI(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(SD(t)/3))),i=Math.pow(10,-r),a=SU[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,V=z.formatPrefix;let Td=new Date,Th=new Date;function Tf(e,t,n,r){function i(t){return e(t=0==arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o,s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r)||!(a>0))return s;do s.push(o=new Date(+n)),t(n,a),e(n);while(o<n&&n<r)return s},i.filter=n=>Tf(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Td.setTime(+t),Th.setTime(+r),e(Td),e(Th),Math.floor(n(Td,Th))),i.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?i.filter(r?t=>r(t)%e==0:t=>i.count(0,t)%e==0):i:null),i}let Tp=Tf(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Tp.every=e=>isFinite(e=Math.floor(e))&&e>0?Tf(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Tp.range;let Tm=Tf(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Tm.every=e=>isFinite(e=Math.floor(e))&&e>0?Tf(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,Tm.range;let Tg=Tf(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Tg.range;let Tv=Tf(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Tv.range;function Tx(e){return Tf(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}let Ty=Tx(0),Tb=Tx(1),Tw=Tx(2),Tj=Tx(3),TN=Tx(4),Tk=Tx(5),TE=Tx(6);function TC(e){return Tf(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/6048e5)}Ty.range,Tb.range,Tw.range,Tj.range,TN.range,Tk.range,TE.range;let T_=TC(0),TS=TC(1),TT=TC(2),TA=TC(3),TO=TC(4),TM=TC(5),TP=TC(6);T_.range,TS.range,TT.range,TA.range,TO.range,TM.range,TP.range;let TD=Tf(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1);TD.range;let TL=Tf(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);TL.range;let TI=Tf(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));TI.range;let TR=Tf(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getHours());TR.range;let TB=Tf(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());TB.range;let Tz=Tf(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());Tz.range;let TF=Tf(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());TF.range;let TV=Tf(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());TV.range;let TU=Tf(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function TH(e,t,n,r,i,a){let o=[[TV,1,1e3],[TV,5,5e3],[TV,15,15e3],[TV,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,36e5],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,864e5],[r,2,1728e5],[n,1,6048e5],[t,1,2592e6],[t,3,7776e6],[e,1,31536e6]];function s(t,n,r){let i=Math.abs(n-t)/r,a=_V(([,,e])=>e).right(o,i);if(a===o.length)return e.every(_B(t/31536e6,n/31536e6,r));if(0===a)return TU.every(Math.max(_B(t,n,r),1));let[s,l]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(l)}return[function(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&"function"==typeof n.range?n:s(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a},s]}TU.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?Tf(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):TU:null,TU.range;let[TW,TY]=TH(Tm,Tv,T_,TI,TB,TF),[TG,TX]=TH(Tp,Tg,Ty,TD,TR,Tz);function T$(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Tq(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function TK(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var TZ={"-":"",_:" ",0:"0"},TQ=/^\s*\d+/,TJ=/^%/,T0=/[\\^$*+?|[\]().{}]/g;function T1(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function T2(e){return e.replace(T0,"\\$&")}function T5(e){return RegExp("^(?:"+e.map(T2).join("|")+")","i")}function T3(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function T4(e,t,n){var r=TQ.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function T6(e,t,n){var r=TQ.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function T8(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function T7(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function T9(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Ae(e,t,n){var r=TQ.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function At(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function An(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Ar(e,t,n){var r=TQ.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Ai(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Aa(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Ao(e,t,n){var r=TQ.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function As(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Al(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Ac(e,t,n){var r=TQ.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Au(e,t,n){var r=TQ.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Ad(e,t,n){var r=TQ.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ah(e,t,n){var r=TJ.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Af(e,t,n){var r=TQ.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Ap(e,t,n){var r=TQ.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Am(e,t){return T1(e.getDate(),t,2)}function Ag(e,t){return T1(e.getHours(),t,2)}function Av(e,t){return T1(e.getHours()%12||12,t,2)}function Ax(e,t){return T1(1+TD.count(Tp(e),e),t,3)}function Ay(e,t){return T1(e.getMilliseconds(),t,3)}function Ab(e,t){return Ay(e,t)+"000"}function Aw(e,t){return T1(e.getMonth()+1,t,2)}function Aj(e,t){return T1(e.getMinutes(),t,2)}function AN(e,t){return T1(e.getSeconds(),t,2)}function Ak(e){var t=e.getDay();return 0===t?7:t}function AE(e,t){return T1(Ty.count(Tp(e)-1,e),t,2)}function AC(e){var t=e.getDay();return t>=4||0===t?TN(e):TN.ceil(e)}function A_(e,t){return e=AC(e),T1(TN.count(Tp(e),e)+(4===Tp(e).getDay()),t,2)}function AS(e){return e.getDay()}function AT(e,t){return T1(Tb.count(Tp(e)-1,e),t,2)}function AA(e,t){return T1(e.getFullYear()%100,t,2)}function AO(e,t){return T1((e=AC(e)).getFullYear()%100,t,2)}function AM(e,t){return T1(e.getFullYear()%1e4,t,4)}function AP(e,t){var n=e.getDay();return T1((e=n>=4||0===n?TN(e):TN.ceil(e)).getFullYear()%1e4,t,4)}function AD(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+T1(t/60|0,"0",2)+T1(t%60,"0",2)}function AL(e,t){return T1(e.getUTCDate(),t,2)}function AI(e,t){return T1(e.getUTCHours(),t,2)}function AR(e,t){return T1(e.getUTCHours()%12||12,t,2)}function AB(e,t){return T1(1+TL.count(Tm(e),e),t,3)}function Az(e,t){return T1(e.getUTCMilliseconds(),t,3)}function AF(e,t){return Az(e,t)+"000"}function AV(e,t){return T1(e.getUTCMonth()+1,t,2)}function AU(e,t){return T1(e.getUTCMinutes(),t,2)}function AH(e,t){return T1(e.getUTCSeconds(),t,2)}function AW(e){var t=e.getUTCDay();return 0===t?7:t}function AY(e,t){return T1(T_.count(Tm(e)-1,e),t,2)}function AG(e){var t=e.getUTCDay();return t>=4||0===t?TO(e):TO.ceil(e)}function AX(e,t){return e=AG(e),T1(TO.count(Tm(e),e)+(4===Tm(e).getUTCDay()),t,2)}function A$(e){return e.getUTCDay()}function Aq(e,t){return T1(TS.count(Tm(e)-1,e),t,2)}function AK(e,t){return T1(e.getUTCFullYear()%100,t,2)}function AZ(e,t){return T1((e=AG(e)).getUTCFullYear()%100,t,2)}function AQ(e,t){return T1(e.getUTCFullYear()%1e4,t,4)}function AJ(e,t){var n=e.getUTCDay();return T1((e=n>=4||0===n?TO(e):TO.ceil(e)).getUTCFullYear()%1e4,t,4)}function A0(){return"+0000"}function A1(){return"%"}function A2(e){return+e}function A5(e){return Math.floor(e/1e3)}function A3(e){return new Date(e)}function A4(e){return e instanceof Date?+e:+new Date(+e)}function A6(e,t,n,r,i,a,o,s,l,c){var u=SM(),d=u.invert,h=u.domain,f=c(".%L"),p=c(":%S"),g=c("%I:%M"),v=c("%I %p"),x=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function j(e){return(l(e)<e?f:s(e)<e?p:o(e)<e?g:a(e)<e?v:r(e)<e?i(e)<e?x:y:n(e)<e?b:w)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?h(Array.from(e,A4)):h().map(A3)},u.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},u.tickFormat=function(e,t){return null==t?j:c(t)},u.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(SX(n,e)):u},u.copy=function(){return SA(u,A6(e,t,n,r,i,a,o,s,l,c))},u}function A8(){return _N.apply(A6(TG,TX,Tp,Tg,Ty,TD,TR,Tz,TV,H).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function A7(){return _N.apply(A6(TW,TY,Tm,Tv,T_,TL,TB,TF,TV,W).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function A9(){var e,t,n,r,i,a=0,o=1,s=SC,l=!1;function c(t){return null==t||isNaN(t*=1)?i:s(0===n?.5:(t=(r(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,s=e(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([a,o]=i,e=r(a*=1),t=r(o*=1),n=e===t?0:1/(t-e),c):[a,o]},c.clamp=function(e){return arguments.length?(l=!!e,c):l},c.interpolator=function(e){return arguments.length?(s=e,c):s},c.range=u(Sj),c.rangeRound=u(SN),c.unknown=function(e){return arguments.length?(i=e,c):i},function(i){return r=i,e=i(a),t=i(o),n=e===t?0:1/(t-e),c}}function Oe(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ot(){var e=SW(A9()(SC));return e.copy=function(){return Oe(e,Ot())},_k.apply(e,arguments)}function On(){var e=S0(A9()).domain([1,10]);return e.copy=function(){return Oe(e,On()).base(e.base())},_k.apply(e,arguments)}function Or(){var e=S3(A9());return e.copy=function(){return Oe(e,Or()).constant(e.constant())},_k.apply(e,arguments)}function Oi(){var e=S9(A9());return e.copy=function(){return Oe(e,Oi()).exponent(e.exponent())},_k.apply(e,arguments)}function Oa(){return Oi.apply(null,arguments).exponent(.5)}function Oo(){var e=[],t=SC;function n(n){if(null!=n&&!isNaN(n*=1))return t((_Y(e,n,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let n of(e=[],t))null==n||isNaN(n*=1)||e.push(n);return e.sort(_z),n},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.range=function(){return e.map((n,r)=>t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>(function(e,t){if(!(!(n=(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t*=1)>=t&&(yield t);else{let n=-1;for(let r of e)null!=(r=t(r,++n,e))&&(r*=1)>=r&&(yield r)}}(e,void 0))).length)||isNaN(t*=1))){if(t<=0||n<2)return Ta(e);if(t>=1)return Ti(e);var n,r=(n-1)*t,i=Math.floor(r),a=Ti((function e(t,n,r=0,i=1/0,a){if(n=Math.floor(n),r=Math.floor(Math.max(0,r)),i=Math.floor(Math.min(t.length-1,i)),!(r<=n&&n<=i))return t;for(a=void 0===a?To:function(e=_z){if(e===_z)return To;if("function"!=typeof e)throw TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(a);i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1),d=Math.max(r,Math.floor(n-s*c/o+u)),h=Math.min(i,Math.floor(n+(o-s)*c/o+u));e(t,n,d,h,a)}let o=t[n],s=r,l=i;for(Ts(t,r,n),a(t[i],o)>0&&Ts(t,r,i);s<l;){for(Ts(t,s,l),++s,--l;0>a(t[s],o);)++s;for(;a(t[l],o)>0;)--l}0===a(t[r],o)?Ts(t,r,l):Ts(t,++l,i),l<=n&&(r=l+1),n<=l&&(i=l-1)}return t})(e,i).subarray(0,i+1));return a+(Ta(e.subarray(i+1))-a)*(r-i)}})(e,r/t))},n.copy=function(){return Oo(t).domain(e)},_k.apply(n,arguments)}function Os(){var e,t,n,r,i,a,o,s=0,l=.5,c=1,u=1,d=SC,h=!1;function f(e){return isNaN(e*=1)?o:(e=.5+((e=+a(e))-t)*(u*e<u*t?r:i),d(h?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,r,i;return arguments.length?([n,r,i]=t,d=function(e,t){void 0===t&&(t=e,e=Sj);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}(e,[n,r,i]),f):[d(0),d(.5),d(1)]}}return f.domain=function(o){return arguments.length?([s,l,c]=o,e=a(s*=1),t=a(l*=1),n=a(c*=1),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f):[s,l,c]},f.clamp=function(e){return arguments.length?(h=!!e,f):h},f.interpolator=function(e){return arguments.length?(d=e,f):d},f.range=p(Sj),f.rangeRound=p(SN),f.unknown=function(e){return arguments.length?(o=e,f):o},function(o){return a=o,e=o(s),t=o(l),n=o(c),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f}}function Ol(){var e=SW(Os()(SC));return e.copy=function(){return Oe(e,Ol())},_k.apply(e,arguments)}function Oc(){var e=S0(Os()).domain([.1,1,10]);return e.copy=function(){return Oe(e,Oc()).base(e.base())},_k.apply(e,arguments)}function Ou(){var e=S3(Os());return e.copy=function(){return Oe(e,Ou()).constant(e.constant())},_k.apply(e,arguments)}function Od(){var e=S9(Os());return e.copy=function(){return Oe(e,Od()).exponent(e.exponent())},_k.apply(e,arguments)}function Oh(){return Od.apply(null,arguments).exponent(.5)}H=(U=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=T5(i),u=T3(i),d=T5(a),h=T3(a),f=T5(o),p=T3(o),g=T5(s),v=T3(s),x=T5(l),y=T3(l),b={a:function(e){return o[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:Am,e:Am,f:Ab,g:AO,G:AP,H:Ag,I:Av,j:Ax,L:Ay,m:Aw,M:Aj,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:A2,s:A5,S:AN,u:Ak,U:AE,V:A_,w:AS,W:AT,x:null,X:null,y:AA,Y:AM,Z:AD,"%":A1},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:AL,e:AL,f:AF,g:AZ,G:AJ,H:AI,I:AR,j:AB,L:Az,m:AV,M:AU,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:A2,s:A5,S:AH,u:AW,U:AY,V:AX,w:A$,W:Aq,x:null,X:null,y:AK,Y:AQ,Z:A0,"%":A1},j={a:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=x.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return E(e,t,n,r)},d:Aa,e:Aa,f:Ad,g:At,G:Ae,H:As,I:As,j:Ao,L:Au,m:Ai,M:Al,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:Ar,Q:Af,s:Ap,S:Ac,u:T6,U:T8,V:T7,w:T4,W:T9,x:function(e,t,r){return E(e,n,t,r)},X:function(e,t,n){return E(e,r,t,n)},y:At,Y:Ae,Z:An,"%":Ah};function N(e,t){return function(n){var r,i,a,o=[],s=-1,l=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===e.charCodeAt(s)&&(o.push(e.slice(l,s)),null!=(i=TZ[r=e.charAt(++s)])?r=e.charAt(++s):i="e"===r?" ":"0",(a=t[r])&&(r=a(n,i)),o.push(r),l=s+1);return o.push(e.slice(l,s)),o.join("")}}function k(e,t){return function(n){var r,i,a=TK(1900,void 0,1);if(E(a,e,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(!t||"Z"in a||(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(r=(i=(r=Tq(TK(a.y,0,1))).getUTCDay())>4||0===i?TS.ceil(r):TS(r),r=TL.offset(r,(a.V-1)*7),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(r=(i=(r=T$(TK(a.y,0,1))).getDay())>4||0===i?Tb.ceil(r):Tb(r),r=TD.offset(r,(a.V-1)*7),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:+("W"in a)),i="Z"in a?Tq(TK(a.y,0,1)).getUTCDay():T$(TK(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,Tq(a)):T$(a)}}function E(e,t,n,r){for(var i,a,o=0,s=t.length,l=n.length;o<s;){if(r>=l)return -1;if(37===(i=t.charCodeAt(o++))){if(!(a=j[(i=t.charAt(o++))in TZ?t.charAt(o++):i])||(r=a(e,n,r))<0)return -1}else if(i!=n.charCodeAt(r++))return -1}return r}return b.x=N(n,b),b.X=N(r,b),b.c=N(t,b),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w),{format:function(e){var t=N(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=N(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,U.parse,W=U.utcFormat,U.utcParse,e.s(["scaleBand",0,_A,"scaleDiverging",0,Ol,"scaleDivergingLog",0,Oc,"scaleDivergingPow",0,Od,"scaleDivergingSqrt",0,Oh,"scaleDivergingSymlog",0,Ou,"scaleIdentity",0,SG,"scaleImplicit",0,_S,"scaleLinear",0,SY,"scaleLog",0,S1,"scaleOrdinal",0,_T,"scalePoint",0,_O,"scalePow",0,Te,"scaleQuantile",0,Tl,"scaleQuantize",0,Tc,"scaleRadial",0,Tr,"scaleSequential",0,Ot,"scaleSequentialLog",0,On,"scaleSequentialPow",0,Oi,"scaleSequentialQuantile",0,Oo,"scaleSequentialSqrt",0,Oa,"scaleSequentialSymlog",0,Or,"scaleSqrt",0,Tt,"scaleSymlog",0,S4,"scaleThreshold",0,Tu,"scaleTime",0,A8,"scaleUtc",0,A7,"tickFormat",0,SH],29061),e.i(29061),e.s(["scaleBand",0,_A,"scaleDiverging",0,Ol,"scaleDivergingLog",0,Oc,"scaleDivergingPow",0,Od,"scaleDivergingSqrt",0,Oh,"scaleDivergingSymlog",0,Ou,"scaleIdentity",0,SG,"scaleImplicit",0,_S,"scaleLinear",0,SY,"scaleLog",0,S1,"scaleOrdinal",0,_T,"scalePoint",0,_O,"scalePow",0,Te,"scaleQuantile",0,Tl,"scaleQuantize",0,Tc,"scaleRadial",0,Tr,"scaleSequential",0,Ot,"scaleSequentialLog",0,On,"scaleSequentialPow",0,Oi,"scaleSequentialQuantile",0,Oo,"scaleSequentialSqrt",0,Oa,"scaleSequentialSymlog",0,Or,"scaleSqrt",0,Tt,"scaleSymlog",0,S4,"scaleThreshold",0,Tu,"scaleTime",0,A8,"scaleUtc",0,A7,"tickFormat",0,SH],79357);var Of=e.i(79357),Op=e=>e.chartData,Om=N0([Op],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Og=(e,t,n,r)=>r?Om(e):Op(e);function Ov(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(CD(t)&&CD(n))return!0}return!1}function Ox(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Oy(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(CD(i))n=i;else if("function"==typeof i)return;if(CD(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(Ov(o))return o}}var Ob=e.i(51655),Ow=e=>e,Oj={},ON=e=>function t(){let n;return 0==arguments.length||1==arguments.length&&(n=arguments.length<=0?void 0:arguments[0],n===Oj)?t:e(...arguments)},Ok=(e,t)=>1===e?t:ON(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(e=>e!==Oj).length;return a>=e?t(...r):Ok(e-a,ON(function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t(...r.map(e=>e===Oj?n.shift():e),...n)}))}),OE=(e,t)=>{for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},OC=Ok((a=(e,t)=>Array.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,a),O_=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return Ow;var r=t.reverse(),i=r[0],a=r.slice(1);return function(){return a.reduce((e,t)=>t(e),i(...arguments))}};function OS(e){return 0===e?1:Math.floor(new Ob.default(e).abs().log(10).toNumber())+1}function OT(e,t,n){for(var r=new Ob.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var OA=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},OO=(e,t,n)=>{if(e.lte(0))return new Ob.default(0);var r=OS(e.toNumber()),i=new Ob.default(10).pow(r),a=e.div(i),o=1!==r?.05:.1,s=new Ob.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new Ob.default(t?s.toNumber():Math.ceil(s.toNumber()))},OM=function(e,t,n,r){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Ob.default(0),tickMin:new Ob.default(0),tickMax:new Ob.default(0)};var o=OO(new Ob.default(t).sub(e).div(n-1),r,a),s=Math.ceil((i=e<=0&&t>=0?new Ob.default(0):(i=new Ob.default(e).add(t).div(2)).sub(new Ob.default(i).mod(o))).sub(e).div(o).toNumber()),l=Math.ceil(new Ob.default(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?OM(e,t,n,r,a+1):(c<n&&(l=t>0?l+(n-c):l,s=t>0?s:s+(n-c)),{step:o,tickMin:i.sub(new Ob.default(s).mul(o)),tickMax:i.add(new Ob.default(l).mul(o))})},OP=function(e){var[t,n]=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(r,2),[o,s]=OA([t,n]);if(o===-1/0||s===1/0){var l=s===1/0?[o,...OE(0,r-1).map(()=>1/0)]:[...OE(0,r-1).map(()=>-1/0),s];return t>n?l.reverse():l}if(o===s){var c=new Ob.default(1),u=new Ob.default(o);if(!u.isint()&&i){var d=Math.abs(o);d<1?(c=new Ob.default(10).pow(OS(o)-1),u=new Ob.default(Math.floor(u.div(c).toNumber())).mul(c)):d>1&&(u=new Ob.default(Math.floor(o)))}else 0===o?u=new Ob.default(Math.floor((r-1)/2)):i||(u=new Ob.default(Math.floor(o)));var h=Math.floor((r-1)/2);return O_(OC(e=>u.add(new Ob.default(e-h).mul(c)).toNumber()),OE)(0,r)}var{step:f,tickMin:p,tickMax:g}=OM(o,s,a,i,0),v=OT(p,g.add(new Ob.default(.1).mul(f)),f);return t>n?v.reverse():v},OD=function(e,t){var[n,r]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,o]=OA([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),l=OO(new Ob.default(o).sub(a).div(s-1),i,0),c=[...OT(new Ob.default(a),new Ob.default(o),l),o];return!1===i&&(c=c.map(e=>Math.round(e))),n>r?c.reverse():c},OL=e=>e.rootProps.stackOffset,OI=e=>e.rootProps.reverseStackOrder,OR=e=>e.options.chartName,OB=e=>e.rootProps.syncId,Oz=e=>e.rootProps.syncMethod,OF=e=>e.options.eventEmitter;function OV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OU(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OV(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var OH=Math.PI/180,OW=(e,t,n,r)=>({x:e+Math.cos(-OH*r)*n,y:t+Math.sin(-OH*r)*n}),OY={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},OG={allowDecimals:!1,allowDuplicatedCategory:!0,angleAxisId:0,axisLine:!0,axisLineType:"polygon",cx:0,cy:0,orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"category",zIndex:OY.axis},OX={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,type:"number",zIndex:OY.axis},O$=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},Oq={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:OG.angleAxisId,includeHidden:!1,name:void 0,reversed:OG.reversed,scale:OG.scale,tick:OG.tick,tickCount:void 0,ticks:void 0,type:OG.type,unit:void 0},OK={allowDataOverflow:OX.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:OX.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OX.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OX.scale,tick:OX.tick,tickCount:OX.tickCount,ticks:void 0,type:OX.type,unit:void 0},OZ={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:OG.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OG.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OG.scale,tick:OG.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},OQ={allowDataOverflow:OX.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:OX.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OX.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OX.scale,tick:OX.tick,tickCount:OX.tickCount,ticks:void 0,type:"category",unit:void 0},OJ=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?OZ:Oq,O0=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?OQ:OK,O1=e=>e.polarOptions,O2=N0([Cq,CK,C5],function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2}),O5=N0([O1,O2],(e,t)=>{if(null!=e)return k5(e.innerRadius,t,0)}),O3=N0([O1,O2],(e,t)=>{if(null!=e)return k5(e.outerRadius,t,.8*t)}),O4=N0([O1],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});N0([OJ,O4],O$);var O6=N0([O2,O5,O3],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});N0([O0,O6],O$);var O8=N0([_b,O1,O5,O3,Cq,CK],(e,t,n,r,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=n&&null!=r){var{cx:o,cy:s,startAngle:l,endAngle:c}=t;return{cx:k5(o,i,i/2),cy:k5(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),O7=(e,t)=>t,O9=(e,t,n)=>n;function Me(e){return null==e?void 0:e.id}function Mt(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t,n=null!=(t=e.data)?t:r;if(null!=n&&0!==n.length){var s=Me(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(CB(t,a,null)),c=CB(t,e.dataKey,0);Object.assign(r=o.has(l)?o.get(l):{},{[s]:c}),o.set(l,r)})}}),Array.from(o.values())}function Mn(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var Mr=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function Mi(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var Ma=e=>{var t=_b(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},Mo=e=>e.tooltip.settings.axisId;function Ms(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ml(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ms(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ms(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Mc=[0,"auto"],Mu={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},Md=(e,t)=>e.cartesianAxis.xAxis[t],Mh=(e,t)=>{var n=Md(e,t);return null==n?Mu:n},Mf={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Mc,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},Mp=(e,t)=>e.cartesianAxis.yAxis[t],Mm=(e,t)=>{var n=Mp(e,t);return null==n?Mf:n},Mg={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Mv=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?Mg:n},Mx=(e,t,n)=>{switch(t){case"xAxis":return Mh(e,n);case"yAxis":return Mm(e,n);case"zAxis":return Mv(e,n);case"angleAxis":return OJ(e,n);case"radiusAxis":return O0(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},My=(e,t,n)=>{switch(t){case"xAxis":return Mh(e,n);case"yAxis":return Mm(e,n);case"angleAxis":return OJ(e,n);case"radiusAxis":return O0(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Mb=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function Mw(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var Mj=e=>e.graphicalItems.cartesianItems,MN=N0([O7,O9],Mw),Mk=(e,t,n)=>e.filter(n).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),ME=N0([Mj,Mx,MN],Mk,{memoizeOptions:{resultEqualityCheck:Mi}}),MC=N0([ME],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(Mn)),M_=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),MS=N0([ME],M_),MT=e=>e.map(e=>e.data).filter(Boolean).flat(1),MA=N0([ME],MT,{memoizeOptions:{resultEqualityCheck:Mi}}),MO=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},MM=N0([MA,Og],MO),MP=(e,t,n)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:CB(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:CB(e,t)}))):e.map(e=>({value:e})),MD=N0([MM,Mx,ME],MP);function ML(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function MI(e){if(k0(e)||e instanceof Date){var t=Number(e);if(CD(t))return t}}function MR(e){if(Array.isArray(e)){var t=[MI(e[0]),MI(e[1])];return Ov(t)?t:void 0}var n=MI(e);if(null!=n)return[n,n]}function MB(e){return e.map(MI).filter(k7)}var Mz=e=>{var t=Ma(e),n=Mo(e);return My(e,t,n)},MF=N0([Mz],e=>null==e?void 0:e.dataKey),MV=N0([MC,Og,Mz],Mt),MU=(e,t,n,r)=>Object.fromEntries(Object.entries(t.reduce((e,t)=>{if(null==t.stackId)return e;var n=e[t.stackId];return null==n&&(n=[]),n.push(t),e[t.stackId]=n,e},{})).map(t=>{var i,a,o,[s,l]=t,c=r?[...l].reverse():l,u=c.map(Me);return[s,{stackedData:(a=null!=(i=CU[n])?i:CT,(o=(function(){var e=CS([]),t=CA,n=CT,r=CO;function i(i){var a,o,s=Array.from(e.apply(this,arguments),CM),l=s.length,c=-1;for(let e of i)for(a=0,++c;a<l;++a)(s[a][c]=[0,+r(e,s[a].key,c,i)]).data=e;for(a=0,o=C_(t(s));a<l;++a)s[o[a]].index=a;return n(s,o),s}return i.keys=function(t){return arguments.length?(e="function"==typeof t?t:CS(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r="function"==typeof e?e:CS(+e),i):r},i.order=function(e){return arguments.length?(t=null==e?CA:"function"==typeof e?e:CS(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=null==e?CT:e,i):n},i})().keys(u).value((e,t)=>Number(CB(e,t,0))).order(CA).offset(a)(e)).forEach((t,n)=>{t.forEach((t,r)=>{var i=CB(e[r],u[n],0);Array.isArray(i)&&2===i.length&&kJ(i[0])&&kJ(i[1])&&(t[0]=i[0],t[1]=i[1])})}),o),graphicalItems:c}]})),MH=N0([MV,MC,OL,OI],MU),MW=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==r&&"zAxis"!==n){var o=((e,t,n)=>{if(null!=e){let r;return[(r=Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i,a=[Math.min(...i=CP(r,t,n).flat(2).filter(kJ)),Math.max(...i)];return CD(a[0])&&CD(a[1])?[Math.min(e[0],a[0]),Math.max(e[1],a[1])]:e},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]}})(e,i,a);if(null==o||0!==o[0]||0!==o[1])return o}},MY=N0([Mx],e=>e.allowDataOverflow),MG=e=>{var t;if(null==e||!("domain"in e))return Mc;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var n=MB(e.ticks);return[Math.min(...n),Math.max(...n)]}if("category"===e.type)return e.ticks.map(String)}return null!=(t=null==e?void 0:e.domain)?t:Mc},MX=N0([Mx],MG),M$=N0([MX,MY],Oy),Mq=N0([MH,Op,O7,M$],MW,{memoizeOptions:{resultEqualityCheck:Mr}}),MK=e=>e.errorBars,MZ=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);if(0!==r.length){var i=r.flat();return[Math.min(...i),Math.max(...i)]}},MQ=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s,l,c=null==(s=r[n.id])?void 0:s.filter(e=>ML(i,e)),u=CB(e,null!=(l=t.dataKey)?l:n.dataKey),d=!(!c||"number"!=typeof u||kZ(u))&&c.length?MB(c.flatMap(t=>{var n,r,i=CB(e,t.dataKey);if(Array.isArray(i)?[n,r]=i:n=r=i,CD(n)&&CD(r))return[u-n,u+r]})):[];if(d.length>=2){var h=Math.min(...d),f=Math.max(...d);(null==a||h<a)&&(a=h),(null==o||f>o)&&(o=f)}var p=MR(u);null!=p&&(a=null==a?p[0]:Math.min(a,p[0]),o=null==o?p[1]:Math.max(o,p[1]))})}),(null==t?void 0:t.dataKey)!=null&&e.forEach(e=>{var n=MR(CB(e,t.dataKey));null!=n&&(a=null==a?n[0]:Math.min(a,n[0]),o=null==o?n[1]:Math.max(o,n[1]))}),CD(a)&&CD(o))return[a,o]},MJ=N0([MM,Mx,MS,MK,O7],MQ,{memoizeOptions:{resultEqualityCheck:Mr}});function M0(e){var{value:t}=e;if(k0(t)||t instanceof Date)return t}var M1=e=>e.referenceElements.dots,M2=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),M5=N0([M1,O7,O9],M2),M3=e=>e.referenceElements.areas,M4=N0([M3,O7,O9],M2),M6=e=>e.referenceElements.lines,M8=N0([M6,O7,O9],M2),M7=(e,t)=>{if(null!=e){var n=MB(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},M9=N0(M5,O7,M7),Pe=(e,t)=>{if(null!=e){var n=MB(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pt=N0([M4,O7],Pe),Pn=(e,t)=>{if(null!=e){var n=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return MB([e.x]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:MB(n)}(e):function(e){if(null!=e.y)return MB([e.y]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:MB(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pr=N0([M8,O7],Pn),Pi=N0(M9,Pr,Pt,(e,t,n)=>MZ(e,n,t)),Pa=(e,t,n,r,i,a,o,s)=>null!=n?n:function(e,t,n){if(n||null!=t){if("function"==typeof e&&null!=t)try{var r=e(t,n);if(Ov(r))return Ox(r,t,n)}catch(e){}if(Array.isArray(e)&&2===e.length){var i,a,[o,s]=e;if("auto"===o)null!=t&&(i=Math.min(...t));else if(kJ(o))i=o;else if("function"==typeof o)try{null!=t&&(i=o(null==t?void 0:t[0]))}catch(e){}else if("string"==typeof o&&CW.test(o)){var l=CW.exec(o);if(null==l||null==l[1]||null==t)i=void 0;else{var c=+l[1];i=t[0]-c}}else i=null==t?void 0:t[0];if("auto"===s)null!=t&&(a=Math.max(...t));else if(kJ(s))a=s;else if("function"==typeof s)try{null!=t&&(a=s(null==t?void 0:t[1]))}catch(e){}else if("string"==typeof s&&CY.test(s)){var u=CY.exec(s);if(null==u||null==u[1]||null==t)a=void 0;else{var d=+u[1];a=t[1]+d}}else a=null==t?void 0:t[1];var h=[i,a];if(Ov(h))return null==t?h:Ox(h,t,n)}}}(t,"vertical"===o&&"xAxis"===s||"horizontal"===o&&"yAxis"===s?MZ(r,a,i):MZ(a,i),e.allowDataOverflow),Po=N0([Mx,MX,M$,Mq,MJ,Pi,_b,O7],Pa,{memoizeOptions:{resultEqualityCheck:Mr}}),Ps=[0,1],Pl=(e,t,n,r,i,a,o)=>{if(null!=e&&null!=n&&0!==n.length||void 0!==o){var s,l,{dataKey:c,type:u}=e,d=Cz(t,a);return d&&null==c?(0,_j.default)(0,null!=(l=null==n?void 0:n.length)?l:0):"category"===u?(s=r.map(M0).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&k3(s))?(0,_j.default)(0,r.length):e.allowDuplicatedCategory?s:Array.from(new Set(s))):"expand"===i?Ps:o}},Pc=N0([Mx,_b,MM,MD,OL,O7,Po],Pl),Pu=(e,t,n,r,i)=>{if(null!=e){var{scale:a,type:o}=e;if("auto"===a)return"radial"===t&&"radiusAxis"===i?"band":"radial"===t&&"angleAxis"===i?"linear":"category"===o&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":"category"===o?"band":"linear";if("string"==typeof a){var s="scale".concat(k8(a));return s in Of?s:"point"}}},Pd=N0([Mx,_b,Mb,OR,O7],Pu);function Ph(e,t,n,r){if(null!=n&&null!=r){if("function"==typeof e.scale)return e.scale.copy().domain(n).range(r);var i=function(e){if(null!=e){if(e in Of)return Of[e]();var t="scale".concat(k8(e));if(t in Of)return Of[t]()}}(t);if(null!=i){var a=i.domain(n).range(r);return(e=>{var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-1e-4,a=Math.max(r[0],r[1])+1e-4,o=e(t[0]),s=e(t[n-1]);(o<i||o>a||s<i||s>a)&&e.domain([t[0],t[n-1]])}})(a),a}}}var Pf=(e,t,n)=>{var r=MG(t);if("auto"===n||"linear"===n){if(null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&Ov(e))return OP(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&Ov(e))return OD(e,t.tickCount,t.allowDecimals)}},Pp=N0([Pc,My,Pd],Pf),Pm=(e,t,n,r)=>"angleAxis"!==r&&(null==e?void 0:e.type)==="number"&&Ov(t)&&Array.isArray(n)&&n.length>0?[Math.min(t[0],n[0]),Math.max(t[1],n[n.length-1])]:t,Pg=N0([Mx,Pc,Pp,O7],Pm),Pv=N0(MD,Mx,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(MB(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(null==i||null==a)return 1/0;var o=a-i;if(0===o)return 1/0;for(var s=0;s<r.length-1;s++){var l=r[s],c=r[s+1];null!=l&&null!=c&&(n=Math.min(n,c-l))}return n/o}}),Px=N0(Pv,_b,e=>e.rootProps.barCategoryGap,C5,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!CD(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=k5(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),Py=N0(Mh,(e,t,n)=>{var r=Mh(e,t);return null==r||"string"!=typeof r.padding?0:Px(e,"xAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{left:0,right:0};var n,r,{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!=(n=i.left)?n:0)+t,right:(null!=(r=i.right)?r:0)+t}}),Pb=N0(Mm,(e,t,n)=>{var r=Mm(e,t);return null==r||"string"!=typeof r.padding?0:Px(e,"yAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{top:0,bottom:0};var n,r,{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!=(n=i.top)?n:0)+t,bottom:(null!=(r=i.bottom)?r:0)+t}}),Pw=N0([C5,Py,C9,C7,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),Pj=N0([C5,_b,Pb,C9,C7,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:"horizontal"===t?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),PN=(e,t,n,r)=>{var i;switch(t){case"xAxis":return Pw(e,n,r);case"yAxis":return Pj(e,n,r);case"zAxis":return null==(i=Mv(e,n))?void 0:i.range;case"angleAxis":return O4(e);case"radiusAxis":return O6(e,n);default:return}},Pk=N0([Mx,PN],O$),PE=N0([Mx,Pd,Pg,Pk],Ph);function PC(e,t){return e.id<t.id?-1:+(e.id>t.id)}N0([ME,MK,O7],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>ML(n,e)));var P_=(e,t)=>t,PS=(e,t,n)=>n,PT=N0(CJ,P_,PS,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(PC)),PA=N0(C0,P_,PS,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(PC)),PO=(e,t)=>({width:e.width,height:t.height}),PM=N0(C5,Mh,PO),PP=N0(CK,C5,PT,P_,PS,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s=PO(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}})(t,r,e));var l="top"===r&&!i||"bottom"===r&&i;o[n.id]=a-Number(l)*s.height,a+=(l?-1:1)*s.height}),o}),PD=N0(Cq,C5,PA,P_,PS,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s={width:"number"==typeof n.width?n.width:60,height:t.height};null==a&&(a=((e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}})(t,r,e));var l="left"===r&&!i||"right"===r&&i;o[n.id]=a-Number(l)*s.width,a+=(l?-1:1)*s.width}),o}),PL=N0([C5,Mh,(e,t)=>{var n=Mh(e,t);if(null!=n)return PP(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),PI=N0([C5,Mm,(e,t)=>{var n=Mm(e,t);if(null!=n)return PD(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),PR=N0(C5,Mm,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),PB=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=Cz(e,r),l=t.map(e=>e.value);if(o&&s&&"category"===a&&i&&k3(l))return l}},Pz=N0([_b,MD,Mx,O7],PB),PF=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;if(Cz(e,r)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},PV=N0([_b,MD,My,O7],PF),PU=N0([_b,(e,t,n)=>{switch(t){case"xAxis":return Mh(e,n);case"yAxis":return Mm(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Pd,PE,Pz,PV,PN,Pp,O7],(e,t,n,r,i,a,o,s,l)=>{if(null!=t){var c=Cz(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:c,niceTicks:s,range:o,realScaleType:n,scale:r}}}),PH=N0([_b,My,Pd,PE,Pp,PN,Pz,PV,O7],(e,t,n,r,i,a,o,s,l)=>{if(null!=t&&null!=r){var c=Cz(e,l),{type:u,ticks:d,tickCount:h}=t,f="scaleBand"===n&&"function"==typeof r.bandwidth?r.bandwidth()/2:2,p="category"===u&&r.bandwidth?r.bandwidth()/f:0;p="angleAxis"===l&&null!=a&&a.length>=2?2*kK(a[0]-a[1])*p:p;var g=d||i;return g?g.map((e,t)=>({index:t,coordinate:r(o?o.indexOf(e):e)+p,value:e,offset:p})).filter(e=>CD(e.coordinate)):c&&s?s.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>CD(e.coordinate)):r.ticks?r.ticks(h).map(e=>({coordinate:r(e)+p,value:e,offset:p})):r.domain().map((e,t)=>({coordinate:r(e)+p,value:o?o[e]:e,index:t,offset:p}))}}),PW=N0([_b,My,PE,PN,Pz,PV,O7],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var s=Cz(e,o),{tickCount:l}=t,c=0;return(c="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*kK(r[0]-r[1])*c:c,s&&a)?a.map((e,t)=>({coordinate:n(e)+c,value:e,index:t,offset:c})):n.ticks?n.ticks(l).map(e=>({coordinate:n(e)+c,value:e,offset:c})):n.domain().map((e,t)=>({coordinate:n(e)+c,value:i?i[e]:e,index:t,offset:c}))}}),PY=N0(Mx,PE,(e,t)=>{if(null!=e&&null!=t)return Ml(Ml({},e),{},{scale:t})}),PG=N0([Mx,Pd,Pc,Pk],Ph);N0((e,t,n)=>Mv(e,n),PG,(e,t)=>{if(null!=e&&null!=t)return Ml(Ml({},e),{},{scale:t})});var PX=N0([_b,CJ,C0],(e,t,n)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),P$=e=>e.options.defaultTooltipEventType,Pq=e=>e.options.validateTooltipEventTypes;function PK(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function PZ(e,t){return PK(t,P$(e),Pq(e))}var PQ=(e,t)=>{var n,r=Number(t);if(!kZ(r)&&null!=t)return r>=0?null==e||null==(n=e[r])?void 0:n.value:void 0};function PJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P0(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?PJ(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P1=(e,t,n,r)=>{if(null==t)return E1;var i,a,o,s=(i=e,a=t,o=n,"axis"===a?"click"===o?i.axisInteraction.click:i.axisInteraction.hover:"click"===o?i.itemInteraction.click:i.itemInteraction.hover);if(null==s)return E1;if(s.active)return s;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var l=!0===e.settings.active;if(null!=s.index){if(l)return P0(P0({},s),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return P0(P0({},E1),{},{coordinate:s.coordinate})},P2=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!CD(a))return i;var o=Infinity;t.length>0&&(o=t.length-1);var s=Math.max(0,Math.min(a,o)),l=t[s];return null==l?String(s):!function(e,t,n){if(null==n||null==t)return!0;var r=CB(e,t);return!(null!=r&&Ov(n))||function(e,t){var n=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}(e),r=t[0],i=t[1];if(void 0===n)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}(r,n)}(l,n,r)?null:String(s)},P5=(e,t,n,r,i,a,o,s)=>{if(null!=a&&null!=s){var l=o[0],c=null==l?void 0:s(l.positions,a);if(null!=c)return c;var u=null==i?void 0:i[Number(a)];if(u)if("horizontal"===n)return{x:u.coordinate,y:(r.top+t)/2};else return{x:(r.left+e)/2,y:u.coordinate}}},P3=(e,t,n,r)=>{if("axis"===t)return e.tooltipItemPayloads;if(0===e.tooltipItemPayloads.length)return[];if(null==(i="hover"===n?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId)&&null!=r){var i,a=e.tooltipItemPayloads[0];return null!=a?[a]:[]}return e.tooltipItemPayloads.filter(e=>{var t;return(null==(t=e.settings)?void 0:t.graphicalItemId)===i})},P4=e=>e.options.tooltipPayloadSearcher,P6=e=>e.tooltip;function P8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P7(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P8(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P8(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P9=(e,t,n,r,i,a,o)=>{if(null!=t&&null!=a){var{chartData:s,computedData:l,dataStartIndex:c,dataEndIndex:u}=n;return e.reduce((e,n)=>{var d,h,f,{dataDefinedOnItem:p,settings:g}=n,v=null!=p?p:s,x=Array.isArray(v)?CP(v,c,u):v,y=null!=(d=null==g?void 0:g.dataKey)?d:r,b=null==g?void 0:g.nameKey;return Array.isArray(h=r&&Array.isArray(x)&&!Array.isArray(x[0])&&"axis"===o?k6(x,r,i):a(x,t,l,b))?h.forEach(t=>{var n=P7(P7({},g),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(CX({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:CB(t.payload,t.dataKey),name:t.name}))}):e.push(CX({tooltipEntrySettings:g,dataKey:y,payload:h,value:CB(h,y),name:null!=(f=CB(h,b))?f:null==g?void 0:g.name})),e},[])}},De=N0([Mz,_b,Mb,OR,Ma],Pu),Dt=N0([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Dn=N0([Ma,Mo],Mw),Dr=N0([Dt,Mz,Dn],Mk,{memoizeOptions:{resultEqualityCheck:Mi}}),Di=N0([Dr],e=>e.filter(Mn)),Da=N0([Dr],MT,{memoizeOptions:{resultEqualityCheck:Mi}}),Do=N0([Da,Op],MO),Ds=N0([Di,Op,Mz],Mt),Dl=N0([Do,Mz,Dr],MP),Dc=N0([Mz],MG),Du=N0([Mz],e=>e.allowDataOverflow),Dd=N0([Dc,Du],Oy),Dh=N0([Dr],e=>e.filter(Mn)),Df=N0([Ds,Dh,OL,OI],MU),Dp=N0([Df,Op,Ma,Dd],MW),Dm=N0([Dr],M_),Dg=N0([Do,Mz,Dm,MK,Ma],MQ,{memoizeOptions:{resultEqualityCheck:Mr}}),Dv=N0([M1,Ma,Mo],M2),Dx=N0([Dv,Ma],M7),Dy=N0([M3,Ma,Mo],M2),Db=N0([Dy,Ma],Pe),Dw=N0([M6,Ma,Mo],M2),Dj=N0([Dw,Ma],Pn),DN=N0([Dx,Dj,Db],MZ),Dk=N0([Mz,Dc,Dd,Dp,Dg,DN,_b,Ma],Pa),DE=N0([Mz,_b,Do,Dl,OL,Ma,Dk],Pl),DC=N0([DE,Mz,De],Pf),D_=N0([Mz,DE,DC,Ma],Pm),DS=e=>{var t=Ma(e),n=Mo(e);return PN(e,t,n,!1)},DT=N0([Mz,DS],O$),DA=N0([Mz,De,D_,DT],Ph),DO=N0([_b,Dl,Mz,Ma],PB),DM=N0([_b,Dl,Mz,Ma],PF),DP=N0([_b,Mz,De,DA,DS,DO,DM,Ma],(e,t,n,r,i,a,o,s)=>{if(t){var{type:l}=t,c=Cz(e,s);if(r){var u="scaleBand"===n&&r.bandwidth?r.bandwidth()/2:2,d="category"===l&&r.bandwidth?r.bandwidth()/u:0;return(d="angleAxis"===s&&null!=i&&(null==i?void 0:i.length)>=2?2*kK(i[0]-i[1])*d:d,c&&o)?o.map((e,t)=>({coordinate:r(e)+d,value:e,index:t,offset:d})):r.domain().map((e,t)=>({coordinate:r(e)+d,value:a?a[e]:e,index:t,offset:d}))}}}),DD=N0([P$,Pq,e=>e.tooltip.settings],(e,t,n)=>PK(n.shared,e,t)),DL=e=>e.tooltip.settings.trigger,DI=e=>e.tooltip.settings.defaultIndex,DR=N0([P6,DD,DL,DI],P1),DB=N0([DR,Do,MF,DE],P2),Dz=N0([DP,DB],PQ),DF=N0([DR],e=>{if(e)return e.dataKey});N0([DR],e=>{if(e)return e.graphicalItemId});var DV=N0([P6,DD,DL,DI],P3),DU=N0([Cq,CK,_b,C5,DP,DI,DV,P4],P5),DH=N0([DR,DU],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),DW=N0([DR],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),DY=N0([DV,DB,Op,MF,Dz,P4,DD],P9),DG=N0([DY],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});function DX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?DX(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Dq=(e,t,n,r,i)=>{var a=null!=(d=null==t?void 0:t.length)?d:0;if(a<=1||null==e)return 0;if("angleAxis"===r&&null!=i&&1e-6>=Math.abs(Math.abs(i[1]-i[0])-360))for(var o=0;o<a;o++){var s=o>0?null==(h=n[o-1])?void 0:h.coordinate:null==(f=n[a-1])?void 0:f.coordinate,l=null==(p=n[o])?void 0:p.coordinate,c=o>=a-1?null==(g=n[0])?void 0:g.coordinate:null==(v=n[o+1])?void 0:v.coordinate,u=void 0;if(null!=s&&null!=l&&null!=c)if(kK(l-s)!==kK(c-l)){var d,h,f,p,g,v,x,y=[];if(kK(c-l)===kK(i[1]-i[0])){u=c;var b=l+i[1]-i[0];y[0]=Math.min(b,(b+s)/2),y[1]=Math.max(b,(b+s)/2)}else{u=s;var w=c+i[1]-i[0];y[0]=Math.min(l,(w+l)/2),y[1]=Math.max(l,(w+l)/2)}var j=[Math.min(l,(u+l)/2),Math.max(l,(u+l)/2)];if(e>j[0]&&e<=j[1]||e>=y[0]&&e<=y[1])return null==(x=n[o])?void 0:x.index}else{var N,k=Math.min(s,c),E=Math.max(s,c);if(e>(k+l)/2&&e<=(E+l)/2)return null==(N=n[o])?void 0:N.index}}else if(t)for(var C=0;C<a;C++){var _=t[C];if(null!=_){var S=t[C+1],T=t[C-1];if(0===C&&null!=S&&e<=(_.coordinate+S.coordinate)/2||C===a-1&&null!=T&&e>(_.coordinate+T.coordinate)/2||C>0&&C<a-1&&null!=T&&null!=S&&e>(_.coordinate+T.coordinate)/2&&e<=(_.coordinate+S.coordinate)/2)return _.index}}return -1},DK=(e,t)=>t,DZ=(e,t,n)=>n,DQ=(e,t,n,r)=>r,DJ=N0(DP,e=>(0,CE.default)(e,e=>e.coordinate)),D0=N0([P6,DK,DZ,DQ],P1),D1=N0([D0,Do,MF,DE],P2),D2=N0([P6,DK,DZ,DQ],P3),D5=N0([Cq,CK,_b,C5,DP,DQ,D2,P4],P5),D3=N0([D0,D5],(e,t)=>{var n;return null!=(n=e.coordinate)?n:t}),D4=N0([DP,D1],PQ),D6=N0([D2,D1,Op,MF,D4,P4,DK],P9),D8=N0([D0,D1],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),D7=N0([(e,t)=>t,_b,O8,Ma,DT,DP,DJ,C5],(e,t,n,r,i,a,o,s)=>{if(e&&t&&r&&i&&a){if("horizontal"===t||"vertical"===t){if(!e||!r||!i||!a)return;if(function(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}(e,s)){var l=Dq("horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0,o,a,r,i),c=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("horizontal"===e)return{x:i.coordinate,y:r.chartY};if("vertical"===e)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}})(t,a,l,e);return{activeIndex:String(l),activeCoordinate:c}}return}if(e&&r&&i&&a&&n){var u=((e,t)=>{var n,{chartX:r,chartY:i}=e,{radius:a,angle:o}=((e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=((e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)})({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=Math.acos((n-i)/o);return r>a&&(s=2*Math.PI-s),{radius:o,angle:180*s/Math.PI,angleInRadian:s}})({x:r,y:i},t),{innerRadius:s,outerRadius:l}=t;if(a<s||a>l||0===a)return null;var{startAngle:c,endAngle:u}=(e=>{var{startAngle:t,endAngle:n}=e,r=Math.min(Math.floor(t/360),Math.floor(n/360));return{startAngle:t-360*r,endAngle:n-360*r}})(t),d=o;if(c<=u){for(;d>u;)d-=360;for(;d<c;)d+=360;n=d>=c&&d<=u}else{for(;d>c;)d-=360;for(;d<u;)d+=360;n=d>=u&&d<=c}return n?OU(OU({},t),{},{radius:a,angle:((e,t)=>{var{startAngle:n,endAngle:r}=t;return e+360*Math.min(Math.floor(n/360),Math.floor(r/360))})(d,t)}):null})(e,n);if(u){var d=Dq("centric"===t?u.angle:u.radius,o,a,r,i),h=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("centric"===e){var a=i.coordinate,{radius:o}=r;return D$(D$(D$({},r),OW(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:l}=r;return D$(D$(D$({},r),OW(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,d,u);return{activeIndex:String(d),activeCoordinate:h}}return}}}),D9=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Le=kr("mouseClick"),Lt=kY();Lt.startListening({actionCreator:Le,effect:(e,t)=>{var n=e.payload,r=D7(t.getState(),D9(n));(null==r?void 0:r.activeIndex)!=null&&t.dispatch(Cn({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Ln=kr("mouseMove"),Lr=kY(),Li=null;function La(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":"children"===e&&"object"==typeof t&&null!==t?"<<CHILDREN>>":t}function Lo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ls(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lo(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Lr.startListening({actionCreator:Ln,effect:(e,t)=>{var n=e.payload;null!==Li&&cancelAnimationFrame(Li);var r=D9(n);Li=requestAnimationFrame(()=>{var e=t.getState();if("axis"===PZ(e,e.tooltip.settings.shared)){var n=D7(e,r);(null==n?void 0:n.activeIndex)!=null?t.dispatch(Ct({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(E9())}Li=null})}});var Ll=kp({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:kl()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.xAxis[n.id]&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:kl()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:kl()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:kl()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.yAxis[n.id]&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:kl()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:kl()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:kl()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.zAxis[n.id]&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:kl()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:kl()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a=i.widthHistory||[];if(3===a.length&&a[0]===a[2]&&r===a[1]&&r!==i.width&&1>=Math.abs(r-a[0]))return;var o=[...a,r].slice(-3);e.yAxis[n]=Ls(Ls({},e.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:Lc,replaceXAxis:Lu,removeXAxis:Ld,addYAxis:Lh,replaceYAxis:Lf,removeYAxis:Lp,addZAxis:Lm,replaceZAxis:Lg,removeZAxis:Lv,updateYAxisWidth:Lx}=Ll.actions,Ly=Ll.reducer,Lb=kp({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:kl()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:kl()},removeCartesianGraphicalItem:{reducer(e,t){var n=NL(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:kl()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:kl()},removePolarGraphicalItem:{reducer(e,t){var n=NL(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:kl()}}}),{addCartesianGraphicalItem:Lw,replaceCartesianGraphicalItem:Lj,removeCartesianGraphicalItem:LN,addPolarGraphicalItem:Lk,removePolarGraphicalItem:LE}=Lb.actions,LC=Lb.reducer,L_=kp({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=NL(e).dots.findIndex(e=>e===t.payload);-1!==n&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=NL(e).areas.findIndex(e=>e===t.payload);-1!==n&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=NL(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:LS,removeDot:LT,addArea:LA,removeArea:LO,addLine:LM,removeLine:LP}=L_.actions,LD=L_.reducer,LL={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},LI=kp({name:"brush",initialState:LL,reducers:{setBrushSettings:(e,t)=>null==t.payload?LL:t.payload}}),{setBrushSettings:LR}=LI.actions,LB=LI.reducer,Lz=kp({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:kl()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:kl()},removeLegendPayload:{reducer(e,t){var n=NL(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:kl()}}}),{setLegendSize:LF,setLegendSettings:LV,addLegendPayload:LU,replaceLegendPayload:LH,removeLegendPayload:LW}=Lz.actions,LY=Lz.reducer,LG={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},LX=kp({name:"rootProps",initialState:LG,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(n=t.payload.barGap)?n:LG.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),L$=LX.reducer,{updateOptions:Lq}=LX.actions,LK=kp({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:LZ,removeRadiusAxis:LQ,addAngleAxis:LJ,removeAngleAxis:L0}=LK.actions,L1=LK.reducer,L2=kp({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:L5}=L2.actions,L3=L2.reducer,L4=kr("keyDown"),L6=kr("focus"),L8=kY();L8.startListening({actionCreator:L4,effect:(e,t)=>{var n=t.getState();if(!1===n.rootProps.accessibilityLayer)return;var{keyboardInteraction:r}=n.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=P2(r,Do(n),MF(n),DE(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var s=DP(n);if("Enter"===i){var l=D5(n,"axis","hover",String(r.index));t.dispatch(Ci({active:!r.active,activeIndex:r.index,activeCoordinate:l}));return}var c=o+("ArrowRight"===i?1:-1)*("left-to-right"===PX(n)?1:-1);if(null!=s&&!(c>=s.length)&&!(c<0)){var u=D5(n,"axis","hover",String(c));t.dispatch(Ci({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),L8.startListening({actionCreator:L6,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&null==r.index){var i=D5(n,"axis","hover",String("0"));t.dispatch(Ci({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var L7=kr("externalEvent"),L9=kY(),Ie=new Map;L9.startListening({actionCreator:L7,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=Ie.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:DH(e),activeDataKey:DF(e),activeIndex:DB(e),activeLabel:Dz(e),activeTooltipIndex:DB(e),isTooltipActive:DW(e)};n(a,r)}finally{Ie.delete(i)}});Ie.set(i,o)}}});var It=N0([P6],e=>e.tooltipItemPayloads),In=N0([It,P4,(e,t)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(e=>e.settings.graphicalItemId===r);if(null!=i){var{positions:a}=i;if(null!=a)return t(a,n)}}),Ir=kr("touchMove"),Ii=kY();Ii.startListening({actionCreator:Ir,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=PZ(r,r.tooltip.settings.shared);if("axis"===i){var a=n.touches[0];if(null==a)return;var o=D7(r,D9({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(null==o?void 0:o.activeIndex)!=null&&t.dispatch(Ct({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if("item"===i){var s,l=n.touches[0];if(null==document.elementFromPoint||null==l)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var u=c.getAttribute("data-recharts-item-index"),d=null!=(s=c.getAttribute("data-recharts-item-id"))?s:void 0,h=Dr(r).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:f}=h,p=In(r,u,d);t.dispatch(E8({activeDataKey:f,activeIndex:u,activeCoordinate:p,activeGraphicalItemId:d}))}}}});var Ia=kp({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:Io,replaceErrorBar:Is,removeErrorBar:Il}=Ia.actions,Ic=Ia.reducer,Iu={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Id(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ih(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Id(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Id(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var If={zIndexMap:Object.values(OY).reduce((e,t)=>Ih(Ih({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Ip=new Set(Object.values(OY)),Im=kp({name:"zIndex",initialState:If,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:kl()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Ip.has(n)&&delete e.zIndexMap[n])},prepare:kl()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:kl()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:kl()}}}),{registerZIndexPortal:Ig,unregisterZIndexPortal:Iv,registerZIndexPortalElement:Ix,unregisterZIndexPortalElement:Iy}=Im.actions,Ib=N8({brush:LB,cartesianAxis:Ly,chartData:Cu,errorBars:Ic,graphicalItems:LC,layout:Cg,legend:LY,options:En,polarAxis:L1,polarOptions:L3,referenceElements:LD,rootProps:L$,tooltip:Ca,zIndex:Im.reducer}),Iw=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart";return function(e){let t,n,r,i=function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new ki;return t&&("boolean"==typeof t?a.push(kt):a.push(ke(t.extraArgument))),a},{reducer:a,middleware:o,devTools:s=!0,duplicateMiddlewareCheck:l=!0,preloadedState:c,enhancers:u}=e||{};if("function"==typeof a)t=a;else if(N6(a))t=N8(a);else throw Error(kG(1));n="function"==typeof o?o(i):i();let d=N7;s&&(d=kn({trace:!1,..."object"==typeof s&&s}));let h=(r=function(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(N2(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=N7(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}(...n),function(e){let{autoBatch:t=!0}=e??{},n=new ki(r);return t&&n.push(ku("object"==typeof t?t:void 0)),n});return function e(t,n,r){if("function"!=typeof t)throw Error(N2(2));if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error(N2(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error(N2(1));return r(e)(t,n)}let i=t,a=n,o=new Map,s=o,l=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((e,t)=>{s.set(t,e)}))}function d(){if(c)throw Error(N2(3));return a}function h(e){if("function"!=typeof e)throw Error(N2(4));if(c)throw Error(N2(5));let t=!0;u();let n=l++;return s.set(n,e),function(){if(t){if(c)throw Error(N2(6));t=!1,u(),s.delete(n),o=null}}}function f(e){if(!N6(e))throw Error(N2(7));if(void 0===e.type)throw Error(N2(8));if("string"!=typeof e.type)throw Error(N2(17));if(c)throw Error(N2(9));try{c=!0,a=i(a,e)}finally{c=!1}return(o=s).forEach(e=>{e()}),e}return f({type:N4.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(N2(10));i=e,f({type:N4.REPLACE})},[N5]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(N2(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[N5](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:Ib,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([Lt.middleware,Lr.middleware,L8.middleware,L9.middleware,Ii.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(ku({type:"raf"}))},devTools:Iu.devToolsEnabled&&{serialize:{replacer:La},name:"recharts-".concat(t)}})};function Ij(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=C8(),a=(0,em.useRef)(null);return i?n:(null==a.current&&(a.current=Iw(t,r)),em.createElement(Eh,{context:Cx,store:a.current},n))}var IN=e=>{var{chartData:t}=e,n=Cb(),r=C8();return(0,em.useEffect)(()=>r?()=>{}:(n(Cs(t)),()=>{n(Cs(void 0))}),[t,n,r]),null},Ik=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function IE(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(Ik.has(n)){if(null==e[n]&&null==t[n])continue;if(!function(e,t){if(El(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!El(e[n[r]],t[n[r]]))return!1;return!0}(e[n],t[n]))return!1}else{var r,i;if(r=e[n],i=t[n],(null!=r||null!=i)&&("number"==typeof r&&"number"==typeof i?r!==i&&(r==r||i==i):r!==i))return!1}return!0}var IC=(0,em.memo)(function(e){var{layout:t,margin:n}=e,r=Cb(),i=C8();return(0,em.useEffect)(()=>{i||(r(Cf(t)),r(Ch(n)))},[r,i,t,n]),null},IE);function I_(e){var t=Cb();return(0,em.useEffect)(()=>{t(Lq(e))},[t,e]),null}var IS=()=>{var e;return null==(e=Ck(e=>e.rootProps.accessibilityLayer))||e},IT=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function IA(e){return"string"==typeof e&&IT.includes(e)}var IO=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"]);function IM(e){return"string"==typeof e&&IO.has(e)}function IP(e){return"string"==typeof e&&e.startsWith("data-")}function ID(e){if("object"!=typeof e||null===e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IM(n)||IP(n))&&(t[n]=e[n]);return t}function IL(e){return null==e?null:(0,em.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?ID(e.props):"object"!=typeof e||Array.isArray(e)?null:ID(e)}function II(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IM(n)||IP(n)||IA(n))&&(t[n]=e[n]);return t}var IR=["children","width","height","viewBox","className","style","title","desc"];function IB(){return(IB=Object.assign.bind()).apply(null,arguments)}var Iz=(0,em.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:c}=e,u=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,IR),d=a||{width:r,height:i,x:0,y:0},h=(0,_e.clsx)("recharts-surface",o);return em.createElement("svg",IB({},II(u),{className:h,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),em.createElement("title",null,l),em.createElement("desc",null,c),n)}),IF=N0(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(null!=t){var r=e[t];if(null!=r)return n?r.panoramaElement:r.element}}),IV=N0(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(OY)))).sort((e,t)=>e-t),{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}}});function IU(e){var{zIndex:t,isPanorama:n}=e,r=(0,em.useRef)(null),i=Cb();return(0,em.useLayoutEffect)(()=>(r.current&&i(Ix({zIndex:t,element:r.current,isPanorama:n})),()=>{i(Iy({zIndex:t,isPanorama:n}))}),[i,t,n]),em.createElement("g",{tabIndex:-1,ref:r})}function IH(e){var{children:t,isPanorama:n}=e,r=Ck(IV);if(!r||0===r.length)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return em.createElement(em.Fragment,null,i.map(e=>em.createElement(IU,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>em.createElement(IU,{key:e,zIndex:e,isPanorama:n})))}var IW=["children"];function IY(){return(IY=Object.assign.bind()).apply(null,arguments)}var IG={width:"100%",height:"100%",display:"block"},IX=(0,em.forwardRef)((e,t)=>{var n,r,i=Ck(Cq),a=Ck(CK),o=IS();if(!CL(i)||!CL(a))return null;var{children:s,otherAttributes:l,title:c,desc:u}=e;return null!=l&&(n="number"==typeof l.tabIndex?l.tabIndex:o?0:void 0,r="string"==typeof l.role?l.role:o?"application":void 0),em.createElement(Iz,IY({},l,{title:c,desc:u,role:r,tabIndex:n,width:i,height:a,style:IG,ref:t}),s)}),I$=e=>{var{children:t}=e,n=Ck(C9);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return em.createElement(Iz,{width:r,height:i,x:o,y:a},t)},Iq=(0,em.forwardRef)((e,t)=>{var{children:n}=e,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,IW);return C8()?em.createElement(I$,null,em.createElement(IH,{isPanorama:!0},n)):em.createElement(IX,IY({ref:t},r),em.createElement(IH,{isPanorama:!1},n))}),IK=new(e.i(29942)).default,IZ="recharts.syncEvent.tooltip",IQ="recharts.syncEvent.brush";function IJ(e){return e.tooltip.syncInteraction}var I0=["x","y"];function I1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I1(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var I5=(0,em.createContext)(null),I3=(0,em.createContext)(null);function I4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I6(){return(I6=Object.assign.bind()).apply(null,arguments)}var I8=()=>{var e,t,n,r,i,a,o,s,l,c,u,d;return e=Cb(),(0,em.useEffect)(()=>{e(Er())},[e]),t=Ck(OB),n=Ck(OF),r=Cb(),i=Ck(Oz),a=Ck(DP),o=Ck(_b),s=_v(),l=Ck(e=>e.rootProps.className),(0,em.useEffect)(()=>{if(null==t)return k9;var e=(e,l,c)=>{if(n!==c&&t===e){if("index"===i){if(s&&null!=l&&null!=(u=l.payload)&&u.coordinate&&l.payload.sourceViewBox){var u,d,h=l.payload.coordinate,{x:f,y:p}=h,g=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(h,I0),{x:v,y:x,width:y,height:b}=l.payload.sourceViewBox,w=I2(I2({},g),{},{x:s.x+(y?(f-v)/y:0)*s.width,y:s.y+(b?(p-x)/b:0)*s.height});r(I2(I2({},l),{},{payload:I2(I2({},l.payload),{},{coordinate:w})}))}else r(l);return}if(null!=a){if("function"==typeof i){var j=i(a,{activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate});d=a[j]}else"value"===i&&(d=a.find(e=>String(e.value)===l.payload.label));var{coordinate:N}=l.payload;if(null==d||!1===l.payload.active||null==N||null==s)return void r(Cr({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));var{x:k,y:E}=N,C=Math.min(k,s.x+s.width),_=Math.min(E,s.y+s.height),S={x:"horizontal"===o?d.coordinate:C,y:"horizontal"===o?_:d.coordinate};r(Cr({active:l.payload.active,coordinate:S,dataKey:l.payload.dataKey,index:String(d.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId}))}}};return IK.on(IZ,e),()=>{IK.off(IZ,e)}},[l,r,n,t,i,a,o,s]),c=Ck(OB),u=Ck(OF),d=Cb(),(0,em.useEffect)(()=>{if(null==c)return k9;var e=(e,t,n)=>{u!==n&&c===e&&d(Cl(t))};return IK.on(IQ,e),()=>{IK.off(IQ,e)}},[d,u,c]),null};function I7(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var I9=(0,em.forwardRef)((e,t)=>{var n,r,i=(0,em.useRef)(null),[a,o]=(0,em.useState)({containerWidth:I7(null==(n=e.style)?void 0:n.width),containerHeight:I7(null==(r=e.style)?void 0:r.height)}),s=(0,em.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e&&"u">typeof ResizeObserver){var{width:n,height:r}=e.getBoundingClientRect();s(n,r);var a=new ResizeObserver(e=>{var{width:t,height:n}=e[0].contentRect;s(t,n)});a.observe(e),i.current=a}},[t,s]);return(0,em.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[s]),em.createElement(em.Fragment,null,em.createElement(_w,{width:a.containerWidth,height:a.containerHeight}),em.createElement("div",I6({ref:l},e)))}),Re=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,em.useState)({containerWidth:I7(n),containerHeight:I7(r)}),o=(0,em.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return em.createElement(em.Fragment,null,em.createElement(_w,{width:i.containerWidth,height:i.containerHeight}),em.createElement("div",I6({ref:s},e)))}),Rt=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return em.createElement(em.Fragment,null,em.createElement(_w,{width:n,height:r}),em.createElement("div",I6({ref:t},e)))}),Rn=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return kQ(n)||kQ(r)?em.createElement(Re,I6({},e,{ref:t})):em.createElement(Rt,I6({},e,{ref:t}))}),Rr=(0,em.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:d,onMouseUp:h,onTouchEnd:f,onTouchMove:p,onTouchStart:g,style:v,width:x,responsive:y,dispatchTouchEvents:b=!0}=e,w=(0,em.useRef)(null),j=Cb(),[N,k]=(0,em.useState)(null),[E,C]=(0,em.useState)(null),_=function(){var e=Cb(),[t,n]=(0,em.useState)(null),r=Ck(CZ);return(0,em.useEffect)(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;CD(n)&&n!==r&&e(Cm(n))}},[t,e,r]),n}(),S=_f(),T=(null==S?void 0:S.width)>0?S.width:x,A=(null==S?void 0:S.height)>0?S.height:i,O=(0,em.useCallback)(e=>{_(e),"function"==typeof t&&t(e),k(e),C(e),null!=e&&(w.current=e)},[_,t,k,C]),M=(0,em.useCallback)(e=>{j(Le(e)),j(L7({handler:a,reactEvent:e}))},[j,a]),P=(0,em.useCallback)(e=>{j(Ln(e)),j(L7({handler:c,reactEvent:e}))},[j,c]),D=(0,em.useCallback)(e=>{j(E9()),j(L7({handler:u,reactEvent:e}))},[j,u]),L=(0,em.useCallback)(e=>{j(Ln(e)),j(L7({handler:d,reactEvent:e}))},[j,d]),I=(0,em.useCallback)(()=>{j(L6())},[j]),R=(0,em.useCallback)(e=>{j(L4(e.key))},[j]),B=(0,em.useCallback)(e=>{j(L7({handler:o,reactEvent:e}))},[j,o]),z=(0,em.useCallback)(e=>{j(L7({handler:s,reactEvent:e}))},[j,s]),F=(0,em.useCallback)(e=>{j(L7({handler:l,reactEvent:e}))},[j,l]),V=(0,em.useCallback)(e=>{j(L7({handler:h,reactEvent:e}))},[j,h]),U=(0,em.useCallback)(e=>{j(L7({handler:g,reactEvent:e}))},[j,g]),H=(0,em.useCallback)(e=>{b&&j(Ir(e)),j(L7({handler:p,reactEvent:e}))},[j,b,p]),W=(0,em.useCallback)(e=>{j(L7({handler:f,reactEvent:e}))},[j,f]);return em.createElement(I5.Provider,{value:N},em.createElement(I3.Provider,{value:E},em.createElement(!0===y?I9:Rn,{width:null!=T?T:null==v?void 0:v.width,height:null!=A?A:null==v?void 0:v.height,className:(0,_e.clsx)("recharts-wrapper",r),style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I4(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"relative",cursor:"default",width:T,height:A},v),onClick:M,onContextMenu:B,onDoubleClick:z,onFocus:I,onKeyDown:R,onMouseDown:F,onMouseEnter:P,onMouseLeave:D,onMouseMove:L,onMouseUp:V,onTouchEnd:W,onTouchMove:H,onTouchStart:U,ref:O},em.createElement(I8,null),n)))}),Ri=N0([C5],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Ra=N0([Ri,Cq,CK],(e,t,n)=>{if(e&&null!=t&&null!=n)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Ro=(0,em.createContext)(void 0),Rs=e=>{var{children:t}=e,[n]=(0,em.useState)("".concat(k2("recharts"),"-clip")),r=Ck(Ra);if(null==r)return null;var{x:i,y:a,width:o,height:s}=r;return em.createElement(Ro.Provider,{value:n},em.createElement("defs",null,em.createElement("clipPath",{id:n},em.createElement("rect",{x:i,y:a,height:s,width:o}))),t)},Rl=["width","height","responsive","children","className","style","compact","title","desc"],Rc=(0,em.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:c,desc:u}=e,d=ID(function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Rl));return l?em.createElement(em.Fragment,null,em.createElement(_w,{width:n,height:r}),em.createElement(Iq,{otherAttributes:d,title:c,desc:u},a)):em.createElement(Rr,{className:o,style:s,width:n,height:r,responsive:null!=i&&i,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},em.createElement(Iq,{otherAttributes:d,title:c,desc:u,ref:t},em.createElement(Rs,null,a)))});function Ru(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rd(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ru(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ru(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);return Object.keys(t).reduce((e,n)=>(void 0===e[n]&&void 0!==t[n]&&(e[n]=t[n]),e),n)}function Rh(){return(Rh=Object.assign.bind()).apply(null,arguments)}var Rf={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Rp=(0,em.forwardRef)(function(e,t){var n,r=Rd(e.categoricalChartProps,Rf),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,categoricalChartProps:l}=e;return em.createElement(Ij,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,eventEmitter:void 0}},reduxStoreName:null!=(n=l.id)?n:i},em.createElement(IN,{chartData:l.data}),em.createElement(IC,{layout:r.layout,margin:r.margin}),em.createElement(I_,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),em.createElement(Rc,Rh({},r,{ref:t})))}),Rm=["axis"],Rg=(0,em.forwardRef)((e,t)=>em.createElement(Rp,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Rm,tooltipPayloadSearcher:Ee,categoricalChartProps:e,ref:t})),Rv=em;function Rx(e){this._context=e}function Ry(e){return new Rx(e)}Rx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};let Rb=Math.PI,Rw=2*Rb,Rj=Rw-1e-6;function RN(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class Rk{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?RN:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return RN;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e*=1,t*=1,n*=1,r*=1,(i*=1)<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,l=r-t,c=a-e,u=o-t,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>1e-6)if(Math.abs(u*s-l*c)>1e-6&&i){let h=n-a,f=r-o,p=s*s+l*l,g=Math.sqrt(p),v=Math.sqrt(d),x=i*Math.tan((Rb-Math.acos((p+d-(h*h+f*f))/(2*g*v)))/2),y=x/v,b=x/g;Math.abs(y-1)>1e-6&&this._append`L${e+y*c},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*h>c*f)},${this._x1=e+b*s},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,a){if(e*=1,t*=1,n*=1,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,u=1^a,d=a?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${l},${c}`,n&&(d<0&&(d=d%Rw+Rw),d>Rj?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:d>1e-6&&this._append`A${n},${n},0,${+(d>=Rb)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n*=1}v${+r}h${-n}Z`}toString(){return this._}}function RE(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Rk(t)}function RC(e){return e[0]}function R_(e){return e[1]}function RS(e,t){var n=CS(!0),r=null,i=Ry,a=null,o=RE(s);function s(s){var l,c,u,d=(s=C_(s)).length,h=!1;for(null==r&&(a=i(u=o())),l=0;l<=d;++l)!(l<d&&n(c=s[l],l,s))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(c,l,s),+t(c,l,s));if(u)return a=null,u+""||null}return e="function"==typeof e?e:void 0===e?RC:CS(e),t="function"==typeof t?t:void 0===t?R_:CS(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:CS(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,null!=r&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(null==e?r=a=null:a=i(r=e),s):r},s}function RT(e,t,n){var r=null,i=CS(!0),a=null,o=Ry,s=null,l=RE(c);function c(c){var u,d,h,f,p,g=(c=C_(c)).length,v=!1,x=Array(g),y=Array(g);for(null==a&&(s=o(p=l())),u=0;u<=g;++u){if(!(u<g&&i(f=c[u],u,c))===v)if(v=!v)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=u-1;h>=d;--h)s.point(x[h],y[h]);s.lineEnd(),s.areaEnd()}v&&(x[u]=+e(f,u,c),y[u]=+t(f,u,c),s.point(r?+r(f,u,c):x[u],n?+n(f,u,c):y[u]))}if(p)return s=null,p+""||null}function u(){return RS().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?RC:CS(+e),t="function"==typeof t?t:void 0===t?CS(0):CS(+t),n="function"==typeof n?n:void 0===n?R_:CS(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:CS(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:CS(+e),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:CS(!!e),c):i},c.curve=function(e){return arguments.length?(o=e,null!=a&&(s=o(a)),c):o},c.context=function(e){return arguments.length?(null==e?a=s=null:s=o(a=e),c):a},c}function RA(){}function RO(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function RM(e){this._context=e}function RP(e){this._context=e}function RD(e){this._context=e}Rk.prototype,RM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:RO(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:RO(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RP.prototype={areaStart:RA,areaEnd:RA,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:RO(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:RO(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class RL{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function RI(e){this._context=e}RI.prototype={areaStart:RA,areaEnd:RA,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e*=1,t*=1,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function RR(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0);return((a<0?-1:1)+(o<0?-1:1))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs((a*i+o*r)/(r+i)))||0}function RB(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Rz(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function RF(e){this._context=e}function RV(e){this._context=new RU(e)}function RU(e){this._context=e}function RH(e){this._context=e}function RW(e){var t,n,r=e.length-1,i=Array(r),a=Array(r),o=Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(t=0,a[r-1]=(e[r]+i[r-1])/2;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function RY(e,t){this._context=e,this._t=t}RF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Rz(this,this._t0,RB(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t*=1,(e*=1)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Rz(this,RB(this,n=RR(this,e,t)),n);break;default:Rz(this,this._t0,n=RR(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(RV.prototype=Object.create(RF.prototype)).point=function(e,t){RF.prototype.point.call(this,t,e)},RU.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}},RH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=RW(e),i=RW(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},RY.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var RG=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,RX=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if((0,em.isValidElement)(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var r={};return Object.keys(n).forEach(e=>{IA(e)&&(r[e]=t||(t=>n[e](n,t)))}),r};function R$(){return(R$=Object.assign.bind()).apply(null,arguments)}function Rq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function RK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rq(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var RZ={curveBasisClosed:function(e){return new RP(e)},curveBasisOpen:function(e){return new RD(e)},curveBasis:function(e){return new RM(e)},curveBumpX:function(e){return new RL(e,!0)},curveBumpY:function(e){return new RL(e,!1)},curveLinearClosed:function(e){return new RI(e)},curveLinear:Ry,curveMonotoneX:function(e){return new RF(e)},curveMonotoneY:function(e){return new RV(e)},curveNatural:function(e){return new RH(e)},curveStep:function(e){return new RY(e,.5)},curveStepAfter:function(e){return new RY(e,1)},curveStepBefore:function(e){return new RY(e,0)}},RQ=e=>CD(e.x)&&CD(e.y),RJ=e=>null!=e.base&&RQ(e.base)&&RQ(e),R0=e=>e.x,R1=e=>e.y,R2=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Ck(_b);if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?(e=>{var{type:t="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=e,o=((e,t)=>{if("function"==typeof e)return e;var n="curve".concat(k8(e));return("curveMonotone"===n||"curveBump"===n)&&t?RZ["".concat(n).concat("vertical"===t?"Y":"X")]:RZ[n]||Ry})(t,i),s=a?n.filter(RQ):n;if(Array.isArray(r)){var l=n.map((e,t)=>RK(RK({},e),{},{base:r[t]}));return("vertical"===i?RT().y(R1).x1(R0).x0(e=>e.base.x):RT().x(R0).y1(R1).y0(e=>e.base.y)).defined(RJ).curve(o)(a?l.filter(RJ):l)}return("vertical"===i&&kJ(r)?RT().y(R1).x1(R0).x0(r):kJ(r)?RT().x(R0).y1(R1).y0(r):RS().x(R0).y(R1)).defined(RQ).curve(o)(s)})(o):r;return em.createElement("path",R$({},ID(e),RX(e),{className:(0,_e.clsx)("recharts-curve",t),d:null===s?void 0:s,ref:i}))},R5=["children","className"];function R3(){return(R3=Object.assign.bind()).apply(null,arguments)}var R4=em.forwardRef((e,t)=>{var{children:n,className:r}=e,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,R5),a=(0,_e.clsx)("recharts-layer",r);return em.createElement("g",R3({className:a},II(i),{ref:t}),n)}),R6=e.i(4178);function R8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var R7=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R8(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R8(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),R9=new class{constructor(e){!function(e,t,n){var r;(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"cache",new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;null!=n&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(R7.cacheSize),Be={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Bt="recharts_measurement_span",Bn=(e,t)=>{try{var n=document.getElementById(Bt);n||((n=document.createElement("span")).setAttribute("id",Bt),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Be,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(e){return{width:0,height:0}}},Br=function(e){var t,n,r,i,a,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Iu.isSsr)return{width:0,height:0};if(!R7.enableCache)return Bn(e,s);var l=(t=s.fontSize||"",n=s.fontFamily||"",r=s.fontWeight||"",i=s.fontStyle||"",a=s.letterSpacing||"",o=s.textTransform||"","".concat(e,"|").concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o)),c=R9.get(l);if(c)return c;var u=Bn(e,s);return R9.set(l,u),u},Bi=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Ba=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bo=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Bs=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Bl={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},Bc=["cm","mm","pt","pc","in","Q","px"];class Bu{static parse(e){var t,[,n,r]=null!=(t=Bs.exec(e))?t:[];return null==n?Bu.NaN:new Bu(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,kZ(e)&&(this.unit=""),""===t||Bo.test(t)||(this.num=NaN,this.unit=""),function(e){return Bc.includes(e)}(t)&&(this.num=function(e,t){return e*Bl[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new Bu(NaN,""):new Bu(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Bu(NaN,""):new Bu(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bu(NaN,""):new Bu(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bu(NaN,""):new Bu(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return kZ(this.num)}}function Bd(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!=(n=Bi.exec(t))?n:[],o=Bu.parse(null!=r?r:""),s=Bu.parse(null!=a?a:""),l="*"===i?o.multiply(s):o.divide(s);if(l.isNaN())return"NaN";t=t.replace(Bi,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=Ba.exec(t))?c:[],f=Bu.parse(null!=u?u:""),p=Bu.parse(null!=h?h:""),g="+"===d?f.add(p):f.subtract(p);if(g.isNaN())return"NaN";t=t.replace(Ba,g.toString())}return t}u="NaN",d=new Bu(NaN,""),(u="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(u,"string"))?s:s+"")in Bu?Object.defineProperty(Bu,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):Bu[u]=d;var Bh=/\(([^()]*)\)/;function Bf(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,n=e;null!=(t=Bh.exec(n));){var[,r]=t;n=n.replace(Bh,Bd(r))}return n}(t),t=Bd(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var Bp=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],Bm=["dx","dy","angle","className","breakAll"];function Bg(){return(Bg=Object.assign.bind()).apply(null,arguments)}function Bv(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Bx=/[ \f\n\r\t\v\u2028\u2029]+/,By=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];null!=t&&(i=n?t.toString().split(""):t.toString().split(Bx));var a=i.map(e=>({word:e,width:Br(e,r).width})),o=n?0:Br(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch(e){return null}},Bb=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];return s&&null!=o&&(null==t||r||s.width+o+n<Number(t))?(s.words.push(a),s.width+=o+n):e.push({words:[a],width:o}),e},[]),Bw=e=>e.reduce((e,t)=>e.width>t.width?e:t),Bj=(e,t,n,r,i,a,o,s)=>{var l=By({breakAll:n,style:r,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=Bb(l.wordsWithComputedWidth,a,o,s);return[c.length>i||Bw(c).width>Number(a),c]},BN=e=>[{words:null==e?[]:e.toString().split(Bx),width:void 0}],Bk="#808080",BE={angle:0,breakAll:!1,capHeight:"0.71em",fill:Bk,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},BC=(0,em.forwardRef)((e,t)=>{var n,r=Rd(e,BE),{x:i,y:a,lineHeight:o,capHeight:s,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,h=Bv(r,Bp),f=(0,em.useMemo)(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Iu.isSsr){var s=By({breakAll:a,children:r,style:i});if(!s)return BN(r);var{wordsWithComputedWidth:l,spaceWidth:c}=s;return((e,t,n,r,i)=>{var a,{maxLines:o,children:s,style:l,breakAll:c}=e,u=kJ(o),d=String(s),h=Bb(t,r,n,i);if(!u||i||!(h.length>o||Bw(h).width>Number(r)))return h;for(var f=0,p=d.length-1,g=0;f<=p&&g<=d.length-1;){var v=Math.floor((f+p)/2),[x,y]=Bj(d,v-1,c,l,o,r,n,i),[b]=Bj(d,v,c,l,o,r,n,i);if(x||b||(f=v+1),x&&b&&(p=v-1),!x&&b){a=y;break}g++}return a||h})({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return BN(r)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),{dx:p,dy:g,angle:v,className:x,breakAll:y}=h,b=Bv(h,Bm);if(!k0(i)||!k0(a)||0===f.length)return null;var w=Number(i)+(kJ(p)?p:0),j=Number(a)+(kJ(g)?g:0);if(!CD(w)||!CD(j))return null;switch(d){case"start":n=Bf("calc(".concat(s,")"));break;case"middle":n=Bf("calc(".concat((f.length-1)/2," * -").concat(o," + (").concat(s," / 2))"));break;default:n=Bf("calc(".concat(f.length-1," * -").concat(o,")"))}var N=[];if(c){var k=f[0].width,{width:E}=h;N.push("scale(".concat(kJ(E)&&kJ(k)?E/k:1,")"))}return v&&N.push("rotate(".concat(v,", ").concat(w,", ").concat(j,")")),N.length&&(b.transform=N.join(" ")),em.createElement("text",Bg({},II(b),{ref:t,x:w,y:j,className:(0,_e.clsx)("recharts-text",x),textAnchor:u,fill:l.includes("url")?Bk:l}),f.map((e,t)=>{var r=e.words.join(y?"":" ");return em.createElement("tspan",{x:w,dy:0===t?n:o,key:"".concat(r,"-").concat(t)},r)}))});function B_(e){var{zIndex:t,children:n}=e,r=void 0!==Ck(_b)&&void 0!==t&&0!==t,i=C8(),a=Cb();(0,em.useLayoutEffect)(()=>r?(a(Ig({zIndex:t})),()=>{a(Iv({zIndex:t}))}):k9,[a,t,r]);var o=Ck(e=>IF(e,t,i));return r?o?(0,e1.createPortal)(n,o):null:n}BC.displayName="Text";var BS=["labelRef"],BT=["content"];function BA(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function BO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BO(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BP(){return(BP=Object.assign.bind()).apply(null,arguments)}var BD=(0,em.createContext)(null),BL=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,em.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return em.createElement(BD.Provider,{value:l},s)},BI=()=>{var e=(0,em.useContext)(BD),t=_v();return e||_g(t)},BR=(0,em.createContext)(null),BB=e=>null!=e&&"function"==typeof e,Bz=e=>"cx"in e&&kJ(e.cx),BF={angle:0,offset:5,zIndex:OY.label,position:"middle",textBreakAll:!1};function BV(e){var t,n,r,i,a,o,s=Rd(e,BF),{viewBox:l,position:c,value:u,children:d,content:h,className:f="",textBreakAll:p,labelRef:g}=s,v=(t=(0,em.useContext)(BR),n=Ck(O8),t||n),x=BI();if(!(i=null==l?"center"===c?x:null!=v?v:x:Bz(l)?l:_g(l))||null==u&&null==d&&!(0,em.isValidElement)(h)&&"function"!=typeof h)return null;var y=BM(BM({},s),{},{viewBox:i});if((0,em.isValidElement)(h)){var{labelRef:b}=y,w=BA(y,BS);return(0,em.cloneElement)(h,w)}if("function"==typeof h){var{content:j}=y,N=BA(y,BT);if(a=(0,em.createElement)(h,N),(0,em.isValidElement)(a))return a}else a=(e=>{var{value:t,formatter:n}=e,r=null==e.children?t:e.children;return"function"==typeof n?n(r):r})(s);var k=II(s);if(Bz(i)){if("insideStart"===c||"insideEnd"===c||"end"===c)return((e,t,n,r,i)=>{var a,o,{offset:s,className:l}=e,{cx:c,cy:u,innerRadius:d,outerRadius:h,startAngle:f,endAngle:p,clockWise:g}=i,v=(d+h)/2,x=kK(p-f)*Math.min(Math.abs(p-f),360),y=x>=0?1:-1;switch(t){case"insideStart":a=f+y*s,o=g;break;case"insideEnd":a=p-y*s,o=!g;break;case"end":a=p+y*s,o=g;break;default:throw Error("Unsupported position ".concat(t))}o=x<=0?o:!o;var b=OW(c,u,v,a),w=OW(c,u,v,a+(o?1:-1)*359),j="M".concat(b.x,",").concat(b.y,"\n A").concat(v,",").concat(v,",0,1,").concat(+!o,",\n ").concat(w.x,",").concat(w.y),N=null==e.id?k2("recharts-radial-line-"):e.id;return em.createElement("text",BP({},r,{dominantBaseline:"central",className:(0,_e.clsx)("recharts-radial-bar-label",l)}),em.createElement("defs",null,em.createElement("path",{id:N,d:j})),em.createElement("textPath",{xlinkHref:"#".concat(N)},n))})(s,c,a,k,i);o=((e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:l}=e,c=(s+l)/2;if("outside"===n){var{x:u,y:d}=OW(r,i,o+t,c);return{x:u,y:d,textAnchor:u>=r?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var{x:h,y:f}=OW(r,i,(a+o)/2,c);return{x:h,y:f,textAnchor:"middle",verticalAnchor:"middle"}})(i,s.offset,s.position)}else o=((e,t)=>{var n,{parentViewBox:r,offset:i,position:a}=e;null==r||Bz(r)||(n=r);var{x:o,y:s,upperWidth:l,lowerWidth:c,height:u}=t,d=o+(l-c)/2,h=(o+d)/2,f=(l+c)/2,p=u>=0?1:-1,g=p*i,v=p>0?"end":"start",x=p>0?"start":"end",y=l>=0?1:-1,b=y*i,w=y>0?"end":"start",j=y>0?"start":"end";if("top"===a)return BM(BM({},{x:o+l/2,y:s-g,textAnchor:"middle",verticalAnchor:v}),n?{height:Math.max(s-n.y,0),width:l}:{});if("bottom"===a)return BM(BM({},{x:d+c/2,y:s+u+g,textAnchor:"middle",verticalAnchor:x}),n?{height:Math.max(n.y+n.height-(s+u),0),width:c}:{});if("left"===a){var N={x:h-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"};return BM(BM({},N),n?{width:Math.max(N.x-n.x,0),height:u}:{})}if("right"===a){var k={x:h+f+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"};return BM(BM({},k),n?{width:Math.max(n.x+n.width-k.x,0),height:u}:{})}var E=n?{width:f,height:u}:{};return"insideLeft"===a?BM({x:h+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"},E):"insideRight"===a?BM({x:h+f-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"},E):"insideTop"===a?BM({x:o+l/2,y:s+g,textAnchor:"middle",verticalAnchor:x},E):"insideBottom"===a?BM({x:d+c/2,y:s+u-g,textAnchor:"middle",verticalAnchor:v},E):"insideTopLeft"===a?BM({x:o+b,y:s+g,textAnchor:j,verticalAnchor:x},E):"insideTopRight"===a?BM({x:o+l-b,y:s+g,textAnchor:w,verticalAnchor:x},E):"insideBottomLeft"===a?BM({x:d+b,y:s+u-g,textAnchor:j,verticalAnchor:v},E):"insideBottomRight"===a?BM({x:d+c-b,y:s+u-g,textAnchor:w,verticalAnchor:v},E):a&&"object"==typeof a&&(kJ(a.x)||kQ(a.x))&&(kJ(a.y)||kQ(a.y))?BM({x:o+k5(a.x,f),y:s+k5(a.y,u),textAnchor:"end",verticalAnchor:"end"},E):BM({x:o+l/2,y:s+u/2,textAnchor:"middle",verticalAnchor:"middle"},E)})(s,i);return em.createElement(B_,{zIndex:s.zIndex},em.createElement(BC,BP({ref:g,className:(0,_e.clsx)("recharts-label",f)},k,o,{textAnchor:"start"===(r=k.textAnchor)||"middle"===r||"end"===r||"inherit"===r?k.textAnchor:o.textAnchor,breakAll:p}),a))}function BU(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return!0===e?em.createElement(BV,BP({key:"label-implicit"},r)):k0(e)?em.createElement(BV,BP({key:"label-implicit",value:e},r)):(0,em.isValidElement)(e)?e.type===BV?(0,em.cloneElement)(e,BM({key:"label-implicit"},r)):em.createElement(BV,BP({key:"label-implicit",content:e},r)):BB(e)?em.createElement(BV,BP({key:"label-implicit",content:e},r)):e&&"object"==typeof e?em.createElement(BV,BP({},e,{key:"label-implicit"},r)):null})(t,BI(),n)||null}BV.displayName="Label";var BH=["valueAccessor"],BW=["dataKey","clockWise","id","textBreakAll","zIndex"];function BY(){return(BY=Object.assign.bind()).apply(null,arguments)}function BG(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var BX=e=>Array.isArray(e.value)?(0,R6.default)(e.value):e.value,B$=(0,em.createContext)(void 0),Bq=B$.Provider,BK=(0,em.createContext)(void 0);function BZ(e){var{valueAccessor:t=BX}=e,n=BG(e,BH),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=BG(n,BW),c=(0,em.useContext)(B$),u=(0,em.useContext)(BK),d=c||u;return d&&d.length?em.createElement(B_,{zIndex:null!=s?s:OY.label},em.createElement(R4,{className:"recharts-label-list"},d.map((e,i)=>{var s,c=null==r?t(e,i):CB(e&&e.payload,r),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return em.createElement(BV,BY({key:"label-".concat(i)},II(e),l,u,{fill:null!=(s=n.fill)?s:e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))}))):null}function BQ(e){var{label:t}=e;return t?!0===t?em.createElement(BZ,{key:"labelList-implicit"}):em.isValidElement(t)||BB(t)?em.createElement(BZ,{key:"labelList-implicit",content:t}):"object"==typeof t?em.createElement(BZ,BY({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function BJ(){return(BJ=Object.assign.bind()).apply(null,arguments)}BK.Provider,BZ.displayName="LabelList";var B0=e=>{var{cx:t,cy:n,r,className:i}=e,a=(0,_e.clsx)("recharts-dot",i);return kJ(t)&&kJ(n)&&kJ(r)?em.createElement("circle",BJ({},ID(e),RX(e),{className:a,cx:t,cy:n,r:r})):null},B1=(e.i(79684),e=>!e||"object"!=typeof e||!("clipDot"in e)||!!e.clipDot),B2=["points"];function B5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function B3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B5(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B5(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function B4(){return(B4=Object.assign.bind()).apply(null,arguments)}function B6(e){var{option:t,dotProps:n,className:r}=e;if((0,em.isValidElement)(t))return(0,em.cloneElement)(t,n);if("function"==typeof t)return t(n);var i=(0,_e.clsx)(r,"boolean"!=typeof t?t.className:""),a=null!=n?n:{},{points:o}=a,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(a,B2);return em.createElement(B0,B4({},s,{className:i}))}function B8(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:l,zIndex:c=OY.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=B1(n),d=null==n?null:(0,em.isValidElement)(n)?II(n.props):"object"!=typeof n||Array.isArray(n)?null:II(n),h=t.map((e,r)=>{var s,l,c=B3(B3(B3({r:3},o),d),{},{index:r,cx:null!=(s=e.x)?s:void 0,cy:null!=(l=e.y)?l:void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return em.createElement(B6,{key:"dot-".concat(r),option:n,dotProps:c,className:i})}),f={};return s&&null!=l&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),em.createElement(B_,{zIndex:c},em.createElement(R4,B4({className:r},f),h))}function B7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function B9(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B7(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ze=e=>{var t,{point:n,childIndex:r,mainColor:i,activeDot:a,dataKey:o,clipPath:s}=e;if(!1===a||null==n.x||null==n.y)return null;var l=B9(B9(B9({},{index:r,dataKey:o,cx:n.x,cy:n.y,r:4,fill:null!=i?i:"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value}),IL(a)),RX(a));return t=(0,em.isValidElement)(a)?(0,em.cloneElement)(a,l):"function"==typeof a?a(l):em.createElement(B0,l),em.createElement(R4,{className:"recharts-active-dot",clipPath:s},t)};function zt(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=OY.activeDot}=e,s=Ck(DB),l=Ck(DG);if(null==t||null==l)return null;var c=t.find(e=>l.includes(e.payload));return null==c?null:em.createElement(B_,{zIndex:o},em.createElement(ze,{point:c,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function zn(e){var{tooltipEntrySettings:t}=e,n=Cb(),r=C8(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(E5(t)):i.current!==t&&n(E3({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(E4(i.current)),i.current=null)},[n]),null}function zr(e,t){var n,r,i=Ck(t=>Mh(t,e)),a=Ck(e=>Mm(e,t)),o=null!=(n=null==i?void 0:i.allowDataOverflow)?n:Mu.allowDataOverflow,s=null!=(r=null==a?void 0:a.allowDataOverflow)?r:Mf.allowDataOverflow;return{needClip:o||s,needClipX:o,needClipY:s}}function zi(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=Ck(Ra),{needClipX:a,needClipY:o,needClip:s}=zr(t,n);if(!s||!i)return null;var{x:l,y:c,width:u,height:d}=i;return em.createElement("clipPath",{id:"clipPath-".concat(r)},em.createElement("rect",{x:a?l:l-u/2,y:o?c:c-d/2,width:a?u:2*u,height:o?d:2*d}))}function za(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.xAxisId)?n:0}function zo(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.yAxisId)?n:0}var zs=(e,t,n)=>PY(e,"xAxis",za(e,t),n),zl=(e,t,n)=>PW(e,"xAxis",za(e,t),n),zc=(e,t,n)=>PY(e,"yAxis",zo(e,t),n),zu=(e,t,n)=>PW(e,"yAxis",zo(e,t),n),zd=N0([_b,zs,zc,zl,zu],(e,t,n,r,i)=>Cz(e,"xAxis")?CG(t,r,!1):CG(n,i,!1)),zh=N0([Mj,(e,t)=>t],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),zf=e=>Cz(_b(e),"xAxis")?"yAxis":"xAxis",zp=N0([zh,(e,t,n)=>MH(e,zf(e),"yAxis"===zf(e)?zo(e,t):za(e,t),n)],(e,t)=>{if(null!=e&&null!=t){var n,{stackId:r}=e,i=Me(e);if(null!=r&&null!=i){var a=null==(n=t[r])?void 0:n.stackedData,o=null==a?void 0:a.find(e=>e.key===i);if(null!=o)return o.map(e=>[e[0],e[1]])}}}),zm=N0([_b,zs,zc,zl,zu,zp,(e,t,n)=>n?Om(e):Op(e),zd,zh,e=>e.rootProps.baseValue],(e,t,n,r,i,a,o,s,l,c)=>{var u,{chartData:d,dataStartIndex:h,dataEndIndex:f}=o;if(null!=l&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=s){var{data:p}=l;if(null!=(u=p&&p.length>0?p:null==d?void 0:d.slice(h,f+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:i},stackedData:a,layout:o,chartBaseValue:s,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:h,yAxisTicks:f,bandSize:p}=e,g=a&&a.length,v=((e,t,n,r,i)=>{var a=null!=n?n:t;if(kJ(a))return a;var o="horizontal"===e?i:r,s=o.scale.domain();if("number"===o.type){var l=Math.max(s[0],s[1]),c=Math.min(s[0],s[1]);return"dataMin"===a?c:"dataMax"===a||l<0?l:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===a?s[0]:"dataMax"===a?s[1]:s[0]})(o,s,r,l,c),x="horizontal"===o,y=!1,b=u.map((e,t)=>{if(g)s=a[d+t];else{var r,o,s,u=CB(e,i);Array.isArray(u)?(s=u,y=!0):s=[v,u]}var b=null!=(r=null==(o=s)?void 0:o[1])?r:null,w=null==b||g&&!n&&null==CB(e,i);return x?{x:CH({axis:l,ticks:h,bandSize:p,entry:e,index:t}),y:w?null:c.scale(b),value:s,payload:e}:{x:w?null:l.scale(b),y:CH({axis:c,ticks:f,bandSize:p,entry:e,index:t}),value:s,payload:e}});return t=g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return x?{x:e.x,y:null!=t&&null!=e.y?c.scale(t):null,payload:e.payload}:{x:null!=t?l.scale(t):null,y:e.y,payload:e.payload}}):x?c.scale(v):l.scale(v),{points:b,baseLine:t,isRange:y}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:h,areaSettings:l,stackedData:a,displayedData:u,chartBaseValue:c,bandSize:s})}});function zg(e){var{legendPayload:t}=e,n=Cb(),r=C8(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(LU(t)):i.current!==t&&n(LH({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(LW(i.current)),i.current=null)},[n]),null}function zv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=(0,em.useRef)(k2(t)),r=(0,em.useRef)(e);return r.current!==e&&(n.current=k2(t),r.current=e),n.current}var zx=null!=(Y=em["useId".toString()])?Y:()=>{var[e]=em.useState(()=>k2("uid-"));return e},zy=(0,em.createContext)(void 0),zb=e=>{var t,n,{id:r,type:i,children:a}=e,o=(t="recharts-".concat(i),n=zx(),r||(t?"".concat(t,"-").concat(n):n));return em.createElement(zy.Provider,{value:o},a(o))},zw=(0,em.memo)(e=>{var t=Cb(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lw(e)):n.current!==e&&t(Lj({prev:n.current,next:e})),n.current=e},[t,e]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(LN(n.current)),n.current=null)},[t]),null});function zj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zj(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zk=(e,t,n)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(n)).join(","),zE=(e,t)=>Object.keys(t).reduce((n,r)=>zN(zN({},n),{},{[r]:e(r,t[r])}),{});function zC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function z_(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zC(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zS=(e,t,n)=>e+(t-e)*n,zT=e=>{var{from:t,to:n}=e;return t!==n},zA=(e,t,n)=>{var r=zE((t,n)=>{if(zT(n)){var[r,i]=e(n.from,n.to,n.velocity);return z_(z_({},n),{},{from:r,velocity:i})}return n},t);return n<1?zE((e,t)=>zT(t)&&null!=r[e]?z_(z_({},t),{},{velocity:zS(t.velocity,r[e].velocity,n),from:zS(t.from,r[e].from,n)}):t,t):zA(e,r,n-1)},zO=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],zM=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),zP=(e,t)=>n=>zM(zO(e,t),n),zD=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(1===t.length)switch(t[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:var r=(e=>{var t,n=e.split("(");if(2!==n.length||"cubic-bezier"!==n[0])return null;var r=null==(t=n[1])||null==(t=t.split(")")[0])?void 0:t.split(",");if(null==r||4!==r.length)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]})(t[0]);if(r)return r}return 4===t.length?t:[0,0,1,1]},zL=function(){return((e,t,n,r)=>{var i=zP(e,n),a=zP(t,r),o=t=>zM([...zO(e,n).map((e,t)=>e*t).slice(1),0],t),s=e=>e>1?1:e<0?0:e,l=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var l=i(n)-t,c=o(n);if(1e-4>Math.abs(l-t)||c<1e-4)break;n=s(n-l/c)}return a(n)};return l.isStepper=!1,l})(...zD(...arguments))},zI=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:n=8,dt:r=17}=e,i=(e,i,a)=>{var o=a+(-(e-i)*t-a*n)*r/1e3,s=a*r/1e3+e;return 1e-4>Math.abs(s-i)&&1e-4>Math.abs(o)?[i,0]:[s,o]};return i.isStepper=!0,i.dt=r,i};class zR{setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):"function"==typeof requestAnimationFrame&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{null!=r&&cancelAnimationFrame(r)}}}var zB=(0,em.createContext)(function(){var e,t,n,r,i;return e=new zR,t=()=>null,n=!1,r=null,i=a=>{if(!n){if(Array.isArray(a)){if(!a.length)return;var[o,...s]=a;if("number"==typeof o){r=e.setTimeout(i.bind(null,s),o);return}i(o),r=e.setTimeout(i.bind(null,s));return}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{n=!0},start:e=>{n=!1,r&&(r(),r=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e}}),zz={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},zF={t:0},zV={t:1};function zU(e){var t,n,r,i=Rd(e,zz),{isActive:a,canBegin:o,duration:s,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,f="auto"===a?!Iu.isSsr:a,p=(t=i.animationId,n=i.animationManager,r=(0,em.useContext)(zB),(0,em.useMemo)(()=>null!=n?n:r(t),[t,n,r])),[g,v]=(0,em.useState)(f?zF:zV),x=(0,em.useRef)(null);return(0,em.useEffect)(()=>{f||v(zV)},[f]),(0,em.useEffect)(()=>{if(!f||!o)return k9;var e=((e,t,n,r,i,a)=>{var o,s,l,c,u,d,h,f,p=[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e)));return null==n?()=>(i(z_(z_({},e),t)),()=>{}):!0===n.isStepper?(s=p.reduce((n,r)=>z_(z_({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,c=r=>{o||(o=r);var u=(r-o)/n.dt;s=zA(n,s,u),i(z_(z_(z_({},e),t),zE((e,t)=>t.from,s))),o=r,Object.values(s).filter(zT).length&&(l=a.setTimeout(c))},()=>(l=a.setTimeout(c),()=>{var e;null==(e=l)||e()})):(d=null,h=p.reduce((n,r)=>{var i=e[r],a=t[r];return null==i||null==a?n:z_(z_({},n),{},{[r]:[i,a]})},{}),f=o=>{u||(u=o);var s=(o-u)/r,l=zE((e,t)=>zS(...t,n(s)),h);if(i(z_(z_(z_({},e),t),l)),s<1)d=a.setTimeout(f);else{var c=zE((e,t)=>zS(...t,n(1)),h);i(z_(z_(z_({},e),t),c))}},()=>(d=a.setTimeout(f),()=>{var e;null==(e=d)||e()}))})(zF,zV,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zL(e);case"spring":return zI();default:if("cubic-bezier"===e.split("(")[0])return zL(e)}return"function"==typeof e?e:null})(l),s,v,p.getTimeoutController());return p.start([d,c,()=>{x.current=e()},s,u]),()=>{p.stop(),x.current&&x.current(),u()}},[f,o,s,l,c,d,u,p]),h(g.t)}function zH(e){var t=IL(e);if(null!=t){var{r:n,strokeWidth:r}=t,i=Number(n),a=Number(r);return(Number.isNaN(i)||i<0)&&(i=3),(Number.isNaN(a)||a<0)&&(a=2),{r:i,strokeWidth:a}}return{r:3,strokeWidth:2}}var zW=["id"],zY=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function zG(){return(zG=Object.assign.bind()).apply(null,arguments)}function zX(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function z$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z$(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zK(e,t){return e&&"none"!==e?e:t}var zZ=Rv.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:C$(o,t),hide:s,type:c,color:zK(r,a),unit:l,graphicalItemId:u}};return Rv.createElement(zn,{tooltipEntrySettings:d})});function zQ(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=ID(r);return Rv.createElement(B8,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function zJ(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return zq(zq({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return Rv.createElement(Bq,{value:t?i:void 0},n)}function z0(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:l,connectNulls:c,isRange:u}=a,{id:d}=a,h=zX(a,zW),f=ID(h),p=II(h);return Rv.createElement(Rv.Fragment,null,(null==t?void 0:t.length)>1&&Rv.createElement(R4,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},Rv.createElement(R2,zG({},p,{id:d,points:t,connectNulls:c,type:s,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),"none"!==l&&Rv.createElement(R2,zG({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:t})),"none"!==l&&u&&Rv.createElement(R2,zG({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:n}))),Rv.createElement(zQ,{points:t,props:h,clipPathId:i}))}function z1(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.y,l=null==(n=a[a.length-1])?void 0:n.y;if(!CD(s)||!CD(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.x||0));return(kJ(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.x||0),u)),kJ(u))?Rv.createElement("rect",{x:0,y:s<l?s:s-c,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function z2(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.x,l=null==(n=a[a.length-1])?void 0:n.x;if(!CD(s)||!CD(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.y||0));return(kJ(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.y||0),u)),kJ(u))?Rv.createElement("rect",{x:s<l?s:s-c,y:0,width:c,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function z5(e){var{alpha:t,layout:n,points:r,baseLine:i,strokeWidth:a}=e;return"vertical"===n?Rv.createElement(z1,{alpha:t,points:r,baseLine:i,strokeWidth:a}):Rv.createElement(z2,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function z3(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=e,{points:o,baseLine:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,onAnimationStart:h,onAnimationEnd:f}=r,p=zv((0,Rv.useMemo)(()=>({points:o,baseLine:s}),[o,s]),"recharts-area-"),g=(()=>{var e=Ck(_b);if("horizontal"===e||"vertical"===e)return e})(),[v,x]=(0,Rv.useState)(!1),y=(0,Rv.useCallback)(()=>{"function"==typeof f&&f(),x(!1)},[f]),b=(0,Rv.useCallback)(()=>{"function"==typeof h&&h(),x(!0)},[h]);if(null==g)return null;var w=i.current,j=a.current;return Rv.createElement(zJ,{showLabels:!v,points:o},r.children,Rv.createElement(zU,{animationId:p,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:y,onAnimationStart:b,key:p},e=>{if(w){var c,u=w.length/o.length,d=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(w[r]){var i=w[r];return zq(zq({},t),{},{x:k4(i.x,t.x,e),y:k4(i.y,t.y,e)})}return t});if(kJ(s))c=k4(j,s,e);else c=null==s||kZ(s)?k4(j,0,e):s.map((t,n)=>{var r=Math.floor(n*u);if(Array.isArray(j)&&j[r]){var i=j[r];return zq(zq({},t),{},{x:k4(i.x,t.x,e),y:k4(i.y,t.y,e)})}return t});return e>0&&(i.current=d,a.current=c),Rv.createElement(z0,{points:d,baseLine:c,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=s),Rv.createElement(R4,null,l&&Rv.createElement("defs",null,Rv.createElement("clipPath",{id:"animationClipPath-".concat(n)},Rv.createElement(z5,{alpha:e,points:o,baseLine:s,layout:g,strokeWidth:r.strokeWidth}))),Rv.createElement(R4,{clipPath:"url(#animationClipPath-".concat(n,")")},Rv.createElement(z0,{points:o,baseLine:s,needClip:t,clipPathId:n,props:r})))}),Rv.createElement(BQ,{label:r.label}))}function z4(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,Rv.useRef)(null),a=(0,Rv.useRef)();return Rv.createElement(z3,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class z6 extends Rv.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:l,width:c,height:u,id:d,baseLine:h,zIndex:f}=this.props;if(e)return null;var p=(0,_e.clsx)("recharts-area",r),{r:g,strokeWidth:v}=zH(t),x=B1(t),y=2*g+v,b=o?"url(#clipPath-".concat(x?"":"dots-").concat(d,")"):void 0;return Rv.createElement(B_,{zIndex:f},Rv.createElement(R4,{className:p},o&&Rv.createElement("defs",null,Rv.createElement(zi,{clipPathId:d,xAxisId:s,yAxisId:l}),!x&&Rv.createElement("clipPath",{id:"clipPath-dots-".concat(d)},Rv.createElement("rect",{x:a-y/2,y:i-y/2,width:c+y,height:u+y}))),Rv.createElement(z4,{needClip:o,clipPathId:d,props:this.props})),Rv.createElement(zt,{points:n,mainColor:zK(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}),this.props.isRange&&Array.isArray(h)&&Rv.createElement(zt,{points:h,mainColor:zK(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}))}}var z8={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:OY.area};function z7(e){var t,n=Rd(e,z8),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,fill:c,fillOpacity:u,hide:d,isAnimationActive:h,legendType:f,stroke:p,xAxisId:g,yAxisId:v}=n,x=zX(n,zY),y=Ck(_b),b=Ck(OR),{needClip:w}=zr(g,v),j=C8(),{points:N,isRange:k,baseLine:E}=null!=(t=Ck(t=>zm(t,e.id,j)))?t:{},C=Ck(Ra);if("horizontal"!==y&&"vertical"!==y||null==C||"AreaChart"!==b&&"ComposedChart"!==b)return null;var{height:_,width:S,x:T,y:A}=C;return N&&N.length?Rv.createElement(z6,zG({},x,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:E,connectNulls:s,dot:l,fill:c,fillOpacity:u,height:_,hide:d,layout:y,isAnimationActive:"auto"===h?!Iu.isSsr:h,isRange:k,legendType:f,needClip:w,points:N,stroke:p,width:S,left:T,top:A,xAxisId:g,yAxisId:v})):null}var z9=Rv.memo(function(e){var t=Rd(e,z8),n=C8();return Rv.createElement(zb,{id:t.id,type:"area"},e=>{var r;return Rv.createElement(Rv.Fragment,null,Rv.createElement(zg,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:zK(r,i),value:C$(n,t),payload:e}]})(t)}),Rv.createElement(zZ,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Rv.createElement(zw,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:null==(r=t.stackId)?void 0:String(r),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),Rv.createElement(z7,zG({},t,{id:e})))})},IE);z9.displayName="Area";class Fe{static create(e){return new Fe(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:t,position:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){if(n)switch(n){case"start":default:return this.scale(e);case"middle":var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(t){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a}return this.scale(e)}}isInRange(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}(h="symbol"==typeof(l=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(h="EPS","string"))?l:l+"")in Fe?Object.defineProperty(Fe,h,{value:1e-4,enumerable:!0,configurable:!0,writable:!0}):Fe[h]=1e-4;var Ft=function(e){var{width:t,height:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(r%180+180)%180*Math.PI/180,a=Math.atan(n/t);return Math.abs(i>a&&i<Math.PI-a?n/Math.sin(i):t/Math.cos(i))};function Fn(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];void 0!==i&&n.push(i)}return n}function Fr(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Fi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fi(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fo(e,t,n){var r,{tick:i,ticks:a,viewBox:o,minTickGap:s,orientation:l,interval:c,tickFormatter:u,unit:d,angle:h}=e;if(!a||!a.length||!i)return[];if(kJ(c)||Iu.isSsr)return null!=(r=Fn(a,(kJ(c)?c:0)+1))?r:[];var f="top"===l||"bottom"===l?"width":"height",p=d&&"width"===f?Br(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},g=(e,r)=>{var i,a="function"==typeof u?u(e.value,r):e.value;return"width"===f?(i=Br(a,{fontSize:t,letterSpacing:n}),Ft({width:i.width+p.width,height:i.height+p.height},h)):Br(a,{fontSize:t,letterSpacing:n})[f]},v=a.length>=2?kK(a[1].coordinate-a[0].coordinate):1,x=function(e,t,n){var r="width"===n,{x:i,y:a,width:o,height:s}=e;return 1===t?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}(o,v,f);return"equidistantPreserveStart"===c?function(e,t,n,r,i){for(var a,o=(r||[]).slice(),{start:s,end:l}=t,c=0,u=1,d=s;u<=o.length;)if(a=function(){var t,a=null==r?void 0:r[c];if(void 0===a)return{v:Fn(r,u)};var o=c,h=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=0===c||Fr(e,f,h,d,l);p||(c=0,d=s,u+=1),p&&(d=f+e*(h()/2+i),c+=u)}())return a.v;return[]}(v,x,g,a,s):"equidistantPreserveEnd"===c?function(e,t,n,r,i){var a=(r||[]).slice().length;if(0===a)return[];for(var{start:o,end:s}=t,l=1;l<=a;l++){for(var c=(a-1)%l,u=o,d=!0,h=c;h<a&&!function(){var t,a=r[h],o=h,l=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=h===c||Fr(e,f,l,u,s);if(!p)return d=!1,1;p&&(u=f+e*(l()/2+i))}();h+=l);if(d){for(var f=[],p=c;p<a;p+=l)f.push(r[p]);return f}}return[]}(v,x,g,a,s):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:l,end:c}=t;if(a){var u=r[s-1],d=n(u,s-1),h=e*(u.coordinate+e*d/2-c);o[s-1]=u=Fa(Fa({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&Fr(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),o[s-1]=Fa(Fa({},u),{},{isShow:!0}))}for(var f=a?s-1:s,p=function(t){var r,a=o[t],s=()=>(void 0===r&&(r=n(a,t)),r);if(0===t){var u=e*(a.coordinate-e*s()/2-l);o[t]=a=Fa(Fa({},a),{},{tickCoord:u<0?a.coordinate-u*e:a.coordinate})}else o[t]=a=Fa(Fa({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&Fr(e,a.tickCoord,s,l,c)&&(l=a.tickCoord+e*(s()/2+i),o[t]=Fa(Fa({},a),{},{isShow:!0}))},g=0;g<f;g++)p(g);return o}(v,x,g,a,s,"preserveStartEnd"===c):function(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=t,{end:l}=t,c=function(t){var r,c=a[t],u=()=>(void 0===r&&(r=n(c,t)),r);if(t===o-1){var d=e*(c.coordinate+e*u()/2-l);a[t]=c=Fa(Fa({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else a[t]=c=Fa(Fa({},c),{},{tickCoord:c.coordinate});null!=c.tickCoord&&Fr(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+i),a[t]=Fa(Fa({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return a}(v,x,g,a,s)).filter(e=>e.isShow)}var Fs=["axisLine","width","height","className","hide","ticks","axisType"];function Fl(){return(Fl=Object.assign.bind()).apply(null,arguments)}function Fc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fc(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fd={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:OY.axis};function Fh(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:l}=e;if(!s)return null;var c=Fu(Fu(Fu({},l),ID(s)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!o||"bottom"===a&&o);c=Fu(Fu({},c),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+("left"===a&&!o||"right"===a&&o);c=Fu(Fu({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return em.createElement("line",Fl({},c,{className:(0,_e.clsx)("recharts-cartesian-axis-line",(0,kX.default)(s,"className"))}))}function Ff(e){var t,{option:n,tickProps:r,value:i}=e,a=(0,_e.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(em.isValidElement(n))t=em.cloneElement(n,Fu(Fu({},r),{},{className:a}));else if("function"==typeof n)t=n(Fu(Fu({},r),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,_e.clsx)(o,null==n?void 0:n.className)),t=em.createElement(BC,Fl({},r,{className:o}),i)}return t}var Fp=(0,em.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:l,tickTextProps:c,orientation:u,mirror:d,x:h,y:f,width:p,height:g,tickSize:v,tickMargin:x,fontSize:y,letterSpacing:b,getTicksConfig:w,events:j,axisType:N}=e,k=Fo(Fu(Fu({},w),{},{ticks:n}),y,b),E=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(u,d),C=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),_=ID(w),S=IL(r),T={};"object"==typeof i&&(T=i);var A=Fu(Fu({},_),{},{fill:"none"},T),O=k.map(e=>Fu({entry:e},function(e,t,n,r,i,a,o,s,l){var c,u,d,h,f,p,g=s?-1:1,v=e.tickSize||o,x=kJ(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":c=u=e.coordinate,p=(d=(h=n+!s*i)-g*v)-g*l,f=x;break;case"left":d=h=e.coordinate,f=(c=(u=t+!s*r)-g*v)-g*l,p=x;break;case"right":d=h=e.coordinate,f=(c=(u=t+s*r)+g*v)+g*l,p=x;break;default:c=u=e.coordinate,p=(d=(h=n+s*i)+g*v)+g*l,f=x}return{line:{x1:c,y1:d,x2:u,y2:h},tick:{x:f,y:p}}}(e,h,f,p,g,u,v,d,x))),M=O.map(e=>{var{entry:t,line:n}=e;return em.createElement(R4,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&em.createElement("line",Fl({},A,n,{className:(0,_e.clsx)("recharts-cartesian-axis-tick-line",(0,kX.default)(i,"className"))})))}),P=O.map((e,t)=>{var{entry:n,tick:i}=e,u=Fu(Fu(Fu(Fu({textAnchor:E,verticalAnchor:C},_),{},{stroke:"none",fill:a},S),i),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:o,padding:l},c);return em.createElement(R4,Fl({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(n.value,"-").concat(n.coordinate,"-").concat(n.tickCoord)},((e,t,n)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];IA(i)&&"function"==typeof a&&(r||(r={}),r[i]=e=>(a(t,n,e),null))}),r})(j,n,t)),r&&em.createElement(Ff,{option:r,tickProps:u,value:"".concat("function"==typeof o?o(n.value,t):n.value).concat(s||"")}))});return em.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},P.length>0&&em.createElement(B_,{zIndex:OY.label},em.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},P)),M.length>0&&em.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},M))}),Fm=(0,em.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:l}=e,c=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Fs),[u,d]=(0,em.useState)(""),[h,f]=(0,em.useState)(""),p=(0,em.useRef)(null);(0,em.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0;return Math.round(o+(i+a)+s+(n?r:0))}return 0})({ticks:p.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=(0,em.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");p.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==u||a!==h)&&(d(i),f(a))}}},[u,h]);return o||null!=r&&r<=0||null!=i&&i<=0?null:em.createElement(B_,{zIndex:e.zIndex},em.createElement(R4,{className:(0,_e.clsx)("recharts-cartesian-axis",a)},em.createElement(Fh,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:ID(e)}),em.createElement(Fp,{ref:g,axisType:l,events:c,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),em.createElement(BL,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},em.createElement(BU,{label:e.label,labelRef:e.labelRef}),e.children)))}),Fg=em.forwardRef((e,t)=>{var n=Rd(e,Fd);return em.createElement(Fm,Fl({},n,{ref:t}))});Fg.displayName="CartesianAxis";var Fv=["domain","range"],Fx=["domain","range"];function Fy(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Fb(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function Fw(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=Fy(e,Fv),{domain:a,range:o}=t,s=Fy(t,Fx);return!!Fb(n,a)&&!!Fb(r,o)&&IE(i,s)}var Fj=["dangerouslySetInnerHTML","ticks","scale"],FN=["id","scale"];function Fk(){return(Fk=Object.assign.bind()).apply(null,arguments)}function FE(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FC(e){var t=Cb(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lc(e)):n.current!==e&&t(Lu({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Ld(n.current)),n.current=null)},[t]),null}var F_=e=>{var{xAxisId:t,className:n}=e,r=Ck(C4),i=C8(),a="xAxis",o=Ck(e=>PH(e,a,t,i)),s=Ck(e=>PM(e,t)),l=Ck(e=>PL(e,t)),c=Ck(e=>Md(e,t));if(null==s||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,f=FE(e,Fj),{id:p,scale:g}=c,v=FE(c,FN);return em.createElement(Fg,Fk({},f,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:(0,_e.clsx)("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:o,axisType:a}))},FS={allowDataOverflow:Mu.allowDataOverflow,allowDecimals:Mu.allowDecimals,allowDuplicatedCategory:Mu.allowDuplicatedCategory,angle:Mu.angle,axisLine:Fd.axisLine,height:Mu.height,hide:!1,includeHidden:Mu.includeHidden,interval:Mu.interval,minTickGap:Mu.minTickGap,mirror:Mu.mirror,orientation:Mu.orientation,padding:Mu.padding,reversed:Mu.reversed,scale:Mu.scale,tick:Mu.tick,tickCount:Mu.tickCount,tickLine:Fd.tickLine,tickSize:Fd.tickSize,type:Mu.type,xAxisId:0},FT=em.memo(e=>{var t=Rd(e,FS);return em.createElement(em.Fragment,null,em.createElement(FC,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),em.createElement(F_,t))},Fw);FT.displayName="XAxis";var FA=["dangerouslySetInnerHTML","ticks","scale"],FO=["id","scale"];function FM(){return(FM=Object.assign.bind()).apply(null,arguments)}function FP(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FD(e){var t=Cb(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lh(e)):n.current!==e&&t(Lf({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lp(n.current)),n.current=null)},[t]),null}var FL=e=>{var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,em.useRef)(null),o=(0,em.useRef)(null),s=Ck(C4),l=C8(),c=Cb(),u="yAxis",d=Ck(e=>PR(e,t)),h=Ck(e=>PI(e,t)),f=Ck(e=>PH(e,u,t,l)),p=Ck(e=>Mp(e,t));if((0,em.useLayoutEffect)(()=>{if(!("auto"!==r||!d||BB(i)||(0,em.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&c(Lx({id:t,width:n}))}}},[f,d,c,i,t,r,p]),null==d||null==h||null==p)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:x}=e,y=FP(e,FA),{id:b,scale:w}=p,j=FP(p,FO);return em.createElement(Fg,FM({},y,j,{ref:a,labelRef:o,x:h.x,y:h.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:d.width,height:d.height,className:(0,_e.clsx)("recharts-".concat(u," ").concat(u),n),viewBox:s,ticks:f,axisType:u}))},FI={allowDataOverflow:Mf.allowDataOverflow,allowDecimals:Mf.allowDecimals,allowDuplicatedCategory:Mf.allowDuplicatedCategory,angle:Mf.angle,axisLine:Fd.axisLine,hide:!1,includeHidden:Mf.includeHidden,interval:Mf.interval,minTickGap:Mf.minTickGap,mirror:Mf.mirror,orientation:Mf.orientation,padding:Mf.padding,reversed:Mf.reversed,scale:Mf.scale,tick:Mf.tick,tickCount:Mf.tickCount,tickLine:Fd.tickLine,tickSize:Fd.tickSize,type:Mf.type,width:Mf.width,yAxisId:0},FR=em.memo(e=>{var t=Rd(e,FI);return em.createElement(em.Fragment,null,em.createElement(FD,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),em.createElement(FL,t))},Fw);function FB(){return(FB=Object.assign.bind()).apply(null,arguments)}function Fz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fz(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fz(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FV(e){return Array.isArray(e)&&k0(e[0])&&k0(e[1])?e.join(" ~ "):e}FR.displayName="YAxis";var FU=e=>{var{separator:t=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:d,accessibilityLayer:h=!1}=e,f=FF({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=FF({margin:0},i),g=null!=u,v=g?u:"",x=(0,_e.clsx)("recharts-default-tooltip",l),y=(0,_e.clsx)("recharts-tooltip-label",c);return g&&d&&null!=a&&(v=d(u,a)),em.createElement("div",FB({className:x,style:f},h?{role:"status","aria-live":"assertive"}:{}),em.createElement("p",{className:y,style:p},em.isValidElement(v)?v:"".concat(v)),(()=>{if(a&&a.length){var e=(s?(0,CE.default)(a,s):a).map((e,n)=>{if("none"===e.type)return null;var i=e.formatter||o||FV,{value:s,name:l}=e,c=s,u=l,d=i(s,l,e,n,a);if(Array.isArray(d))[c,u]=d;else{if(null==d)return null;c=d}var h=FF({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},r);return em.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},k0(u)?em.createElement("span",{className:"recharts-tooltip-item-name"},u):null,k0(u)?em.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,em.createElement("span",{className:"recharts-tooltip-item-value"},c),em.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return em.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},FH=em,FW="recharts-tooltip-wrapper",FY={visibility:"hidden"};function FG(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&kJ(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var h=l[r];return null==h?0:o[r]?u<h?Math.max(d,h):Math.max(u,h):null==c?0:d+s>h+c?Math.max(u,h):Math.max(d,h)}function FX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FX(Object(n),!0).forEach(function(t){Fq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fq(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class FK extends FH.PureComponent{constructor(){super(...arguments),Fq(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),Fq(this,"handleKeyDown",e=>{if("Escape"===e.key){var t,n,r,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!=(t=null==(n=this.props.coordinate)?void 0:n.x)?t:0,y:null!=(r=null==(i=this.props.coordinate)?void 0:i.y)?r:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null==(e=this.props.coordinate)?void 0:e.x)!==this.state.dismissedAtCoordinate.x||(null==(t=this.props.coordinate)?void 0:t.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:t,animationDuration:n,animationEasing:r,children:i,coordinate:a,hasPayload:o,isAnimationActive:s,offset:l,position:c,reverseDirection:u,useTranslate3d:d,viewBox:h,wrapperStyle:f,lastBoundingBox:p,innerRef:g,hasPortalFromProps:v}=this.props,{cssClasses:x,cssProperties:y}=function(e){var t,n,r,{allowEscapeViewBox:i,coordinate:a,offsetTopLeft:o,position:s,reverseDirection:l,tooltipBox:c,useTranslate3d:u,viewBox:d}=e;return{cssProperties:t=c.height>0&&c.width>0&&a?function(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:n=FG({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),translateY:r=FG({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),useTranslate3d:u}):FY,cssClasses:function(e){var{coordinate:t,translateX:n,translateY:r}=e;return(0,_e.clsx)(FW,{["".concat(FW,"-right")]:kJ(n)&&t&&kJ(t.x)&&n>=t.x,["".concat(FW,"-left")]:kJ(n)&&t&&kJ(t.x)&&n<t.x,["".concat(FW,"-bottom")]:kJ(r)&&t&&kJ(t.y)&&r>=t.y,["".concat(FW,"-top")]:kJ(r)&&t&&kJ(t.y)&&r<t.y})}({translateX:n,translateY:r,coordinate:a})}}({allowEscapeViewBox:t,coordinate:a,offsetTopLeft:l,position:c,reverseDirection:u,tooltipBox:{height:p.height,width:p.width},useTranslate3d:d,viewBox:h}),b=v?{}:F$(F$({transition:s&&e?"transform ".concat(n,"ms ").concat(r):void 0},y),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&o?"visible":"hidden",position:"absolute",top:0,left:0}),w=F$(F$({},b),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},f);return FH.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:w,ref:g},i)}}var FZ=e.i(92809),FQ=["x","y","top","left","width","height","className"];function FJ(){return(FJ=Object.assign.bind()).apply(null,arguments)}function F0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var F1=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F0(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({x:t,y:n,top:r,left:i,width:a,height:o},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,FQ));return kJ(t)&&kJ(n)&&kJ(a)&&kJ(o)&&kJ(r)&&kJ(i)?em.createElement("path",FJ({},II(l),{className:(0,_e.clsx)("recharts-cross",s),d:"M".concat(t,",").concat(r,"v").concat(o,"M").concat(i,",").concat(n,"h").concat(a)})):null},F2=["radius"],F5=["radius"];function F3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F4(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F3(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F3(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F6(){return(F6=Object.assign.bind()).apply(null,arguments)}function F8(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function F7(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var F9=(e,t,n,r,i)=>{var a,o=k$(n),s=k$(r),l=Math.min(Math.abs(o)/2,Math.abs(s)/2),c=s>=0?1:-1,u=o>=0?1:-1,d=+(s>=0&&o>=0||s<0&&o<0);if(l>0&&i instanceof Array){for(var h=[0,0,0,0],f=0;f<4;f++)h[f]=i[f]>l?l:i[f];a=kq(G||(G=F7(["M",",",""])),e,t+c*h[0]),h[0]>0&&(a+=kq(X||(X=F7(["A ",",",",0,0,",",",",",""])),h[0],h[0],d,e+u*h[0],t)),a+=kq($||($=F7(["L ",",",""])),e+n-u*h[1],t),h[1]>0&&(a+=kq(q||(q=F7(["A ",",",",0,0,",",\n ",",",""])),h[1],h[1],d,e+n,t+c*h[1])),a+=kq(K||(K=F7(["L ",",",""])),e+n,t+r-c*h[2]),h[2]>0&&(a+=kq(Z||(Z=F7(["A ",",",",0,0,",",\n ",",",""])),h[2],h[2],d,e+n-u*h[2],t+r)),a+=kq(Q||(Q=F7(["L ",",",""])),e+u*h[3],t+r),h[3]>0&&(a+=kq(J||(J=F7(["A ",",",",0,0,",",\n ",",",""])),h[3],h[3],d,e,t+r-c*h[3])),a+="Z"}else if(l>0&&i===+i&&i>0){var p=Math.min(l,i);a=kq(ee||(ee=F7(["M ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",","," Z"])),e,t+c*p,p,p,d,e+u*p,t,e+n-u*p,t,p,p,d,e+n,t+c*p,e+n,t+r-c*p,p,p,d,e+n-u*p,t+r,e+u*p,t+r,p,p,d,e,t+r-c*p)}else a=kq(et||(et=F7(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return a},Ve={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Vt=e=>{var t=Rd(e,Ve),n=(0,em.useRef)(null),[r,i]=(0,em.useState)(-1);(0,em.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch(e){}},[]);var{x:a,y:o,width:s,height:l,radius:c,className:u}=t,{animationEasing:d,animationDuration:h,animationBegin:f,isAnimationActive:p,isUpdateAnimationActive:g}=t,v=(0,em.useRef)(s),x=(0,em.useRef)(l),y=(0,em.useRef)(a),b=(0,em.useRef)(o),w=zv((0,em.useMemo)(()=>({x:a,y:o,width:s,height:l,radius:c}),[a,o,s,l,c]),"rectangle-");if(a!==+a||o!==+o||s!==+s||l!==+l||0===s||0===l)return null;var j=(0,_e.clsx)("recharts-rectangle",u);if(!g){var N=II(t),{radius:k}=N,E=F8(N,F2);return em.createElement("path",F6({},E,{x:k$(a),y:k$(o),width:k$(s),height:k$(l),radius:"number"==typeof c?c:void 0,className:j,d:F9(a,o,s,l,c)}))}var C=v.current,_=x.current,S=y.current,T=b.current,A="0px ".concat(-1===r?1:r,"px"),O="".concat(r,"px 0px"),M=zk(["strokeDasharray"],h,"string"==typeof d?d:Ve.animationEasing);return em.createElement(zU,{animationId:w,key:w,canBegin:r>0,duration:h,easing:d,isActive:g,begin:f},e=>{var r,i=k4(C,s,e),u=k4(_,l,e),d=k4(S,a,e),h=k4(T,o,e);n.current&&(v.current=i,x.current=u,y.current=d,b.current=h),r=p?e>0?{transition:M,strokeDasharray:O}:{strokeDasharray:A}:{strokeDasharray:O};var f=II(t),{radius:g}=f,w=F8(f,F5);return em.createElement("path",F6({},w,{radius:"number"==typeof c?c:void 0,className:j,d:F9(d,h,i,u,c),ref:n,style:F4(F4({},r),t.style)}))})};function Vn(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[OW(t,n,r,i),OW(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function Vr(){return(Vr=Object.assign.bind()).apply(null,arguments)}function Vi(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Va=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:l}=e,c=s*(o?1:-1)+r,u=Math.asin(s/c)/OH,d=l?i:i+a*u,h=OW(t,n,c,d);return{center:h,circleTangency:OW(t,n,r,d),lineTangency:OW(t,n,c*Math.cos(u*OH),l?i-a*u:i),theta:u}},Vo=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=kK(o-a)*Math.min(Math.abs(o-a),359.999),l=a+s,c=OW(t,n,i,a),u=OW(t,n,i,l),d=kq(en||(en=Vi(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,i,i,+(Math.abs(s)>180),+(a>l),u.x,u.y);if(r>0){var h=OW(t,n,r,a),f=OW(t,n,r,l);d+=kq(er||(er=Vi(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),f.x,f.y,r,r,+(Math.abs(s)>180),+(a<=l),h.x,h.y)}else d+=kq(ei||(ei=Vi(["L ",","," Z"])),t,n);return d},Vs={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Vl=e=>{var t,n=Rd(e,Vs),{cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:s,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:h}=n;if(o<a||u===d)return null;var f=(0,_e.clsx)("recharts-sector",h),p=o-a,g=k5(s,p,0,!0);return t=g>0&&360>Math.abs(u-d)?(e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:l,endAngle:c}=e,u=kK(c-l),{circleTangency:d,lineTangency:h,theta:f}=Va({cx:t,cy:n,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:p,lineTangency:g,theta:v}=Va({cx:t,cy:n,radius:i,angle:c,sign:-u,cornerRadius:a,cornerIsExternal:s}),x=s?Math.abs(l-c):Math.abs(l-c)-f-v;if(x<0)return o?kq(ea||(ea=Vi(["M ",",","\n a",",",",0,0,1,",",0\n a",",",",0,0,1,",",0\n "])),h.x,h.y,a,a,2*a,a,a,-(2*a)):Vo({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var y=kq(eo||(eo=Vi(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),h.x,h.y,a,a,+(u<0),d.x,d.y,i,i,+(x>180),+(u<0),p.x,p.y,a,a,+(u<0),g.x,g.y);if(r>0){var{circleTangency:b,lineTangency:w,theta:j}=Va({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:N,lineTangency:k,theta:E}=Va({cx:t,cy:n,radius:r,angle:c,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),C=s?Math.abs(l-c):Math.abs(l-c)-j-E;if(C<0&&0===a)return"".concat(y,"L").concat(t,",").concat(n,"Z");y+=kq(es||(es=Vi(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),k.x,k.y,a,a,+(u<0),N.x,N.y,r,r,+(C>180),+(u>0),b.x,b.y,a,a,+(u<0),w.x,w.y)}else y+=kq(el||(el=Vi(["L",",","Z"])),t,n);return y})({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):Vo({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),em.createElement("path",Vr({},II(n),{className:f,d:t}))};function Vc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vc(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vd(){return(Vd=Object.assign.bind()).apply(null,arguments)}function Vh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vh(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vp(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,em.isValidElement)(t)?(0,em.cloneElement)(t,r):(0,em.createElement)(n,r)}function Vm(e){var t,n,r,i,a,{coordinate:o,payload:s,index:l,offset:c,tooltipAxisBandSize:u,layout:d,cursor:h,tooltipEventType:f,chartName:p}=e;if(!h||!o||"ScatterChart"!==p&&"axis"!==f)return null;if("ScatterChart"===p)r=o,i=F1,a=OY.cursorLine;else if("BarChart"===p)t=u/2,r={stroke:"none",fill:"#ccc",x:"horizontal"===d?o.x-t:c.left+.5,y:"horizontal"===d?c.top+.5:o.y-t,width:"horizontal"===d?u:c.width-1,height:"horizontal"===d?c.height-1:u},i=Vt,a=OY.cursorRectangle;else if("radial"===d&&RG(o)){var{cx:g,cy:v,radius:x,startAngle:y,endAngle:b}=Vn(o);r={cx:g,cy:v,startAngle:y,endAngle:b,innerRadius:x,outerRadius:x},i=Vl,a=OY.cursorLine}else r={points:function(e,t,n){if("horizontal"===e)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if("vertical"===e)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(RG(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,l=OW(r,i,a,s),c=OW(r,i,o,s);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return Vn(t)}}(d,o,c)},i=R2,a=OY.cursorLine;var w="object"==typeof h&&"className"in h?h.className:void 0,j=Vf(Vf(Vf(Vf({stroke:"#ccc",pointerEvents:"none"},c),r),IL(h)),{},{payload:s,payloadIndex:l,className:(0,_e.clsx)("recharts-tooltip-cursor",w)});return em.createElement(B_,{zIndex:null!=(n=e.zIndex)?n:a},em.createElement(Vp,{cursor:h,cursorComp:i,cursorProps:j}))}function Vg(e){var t,n,r,i=(t=Ck(Mz),n=Ck(DP),r=Ck(DA),t&&r?CG(Vu(Vu({},t),{},{scale:r}),n):CG(void 0,n)),a=_y(),o=Ck(_b),s=Ck(OR);return null==i||null==a||null==o||null==s?null:em.createElement(Vm,Vd({},e,{offset:a,layout:o,tooltipAxisBandSize:i,chartName:s}))}function Vv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vx(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vv(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vy(e){return e.dataKey}var Vb=[],Vw={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function Vj(e){var t,n,r,i,a,o,s,l,c,u,d,h=Rd(e,Vw),{active:f,allowEscapeViewBox:p,animationDuration:g,animationEasing:v,content:x,filterNull:y,isAnimationActive:b,offset:w,payloadUniqBy:j,position:N,reverseDirection:k,useTranslate3d:E,wrapperStyle:C,cursor:_,shared:S,trigger:T,defaultIndex:A,portal:O,axisId:M}=h,P=Cb(),D="number"==typeof A?String(A):A;(0,em.useEffect)(()=>{P(E6({shared:S,trigger:T,axisId:M,active:f,defaultIndex:D}))},[P,S,T,M,f,D]);var L=_v(),I=IS(),R=Ck(e=>PZ(e,S)),{activeIndex:B,isActive:z}=null!=(u=Ck(e=>D8(e,R,T,D)))?u:{},F=Ck(e=>D6(e,R,T,D)),V=Ck(e=>D4(e,R,T,D)),U=Ck(e=>D3(e,R,T,D)),H=(0,em.useContext)(I5),W=null!=(d=null!=f?f:z)&&d,[Y,G]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,n]=(0,em.useState)({height:0,left:0,top:0,width:0}),r=(0,em.useCallback)(e=>{if(null!=e){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}([F,W]),X="axis"===R?V:void 0;t=Ck(e=>((e,t,n)=>{if(null!=t){var r=P6(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(e,R,T)),n=Ck(OF),r=Ck(OB),i=Ck(Oz),o=null==(a=Ck(IJ))?void 0:a.active,s=_v(),(0,em.useEffect)(()=>{if(!o&&null!=r&&null!=n){var e=Cr({active:W,coordinate:U,dataKey:t,index:B,label:"number"==typeof X?String(X):X,sourceViewBox:s,graphicalItemId:void 0});IK.emit(IZ,r,e,n)}},[o,U,t,B,X,n,r,i,W,s]);var $=null!=O?O:H;if(null==$||null==L||null==R)return null;var q=null!=F?F:Vb;W||(q=Vb),y&&q.length&&(l=q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),q=!0===j?(0,FZ.default)(l,Vy):"function"==typeof j?(0,FZ.default)(l,j):l);var K=q.length>0,Z=em.createElement(FK,{allowEscapeViewBox:p,animationDuration:g,animationEasing:v,isAnimationActive:b,active:W,coordinate:U,hasPayload:K,offset:w,position:N,reverseDirection:k,useTranslate3d:E,viewBox:L,wrapperStyle:C,lastBoundingBox:Y,innerRef:G,hasPortalFromProps:!!O},(c=Vx(Vx({},h),{},{payload:q,label:X,active:W,activeIndex:B,coordinate:U,accessibilityLayer:I}),em.isValidElement(x)?em.cloneElement(x,c):"function"==typeof x?em.createElement(x,c):em.createElement(FU,c)));return em.createElement(em.Fragment,null,(0,e1.createPortal)(Z,$),W&&em.createElement(Vg,{cursor:_,tooltipEventType:R,coordinate:U,payload:q,index:B}))}var VN=["x1","y1","x2","y2","key"],Vk=["offset"],VE=["xAxisId","yAxisId"],VC=["xAxisId","yAxisId"];function V_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V_(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VT(){return(VT=Object.assign.bind()).apply(null,arguments)}function VA(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var VO=e=>{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return em.createElement("rect",{x:r,y:i,ry:s,width:a,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function VM(e){var{option:t,lineItemProps:n}=e;if(em.isValidElement(t))r=em.cloneElement(t,n);else if("function"==typeof t)r=t(n);else{var r,i,{x1:a,y1:o,x2:s,y2:l,key:c}=n,u=null!=(i=ID(VA(n,VN)))?i:{},{offset:d}=u,h=VA(u,Vk);r=em.createElement("line",VT({},h,{x1:a,y1:o,x2:s,y2:l,fill:"none",key:c}))}return r}function VP(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VA(e,VE),l=i.map((e,i)=>{var a=VS(VS({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(i),index:i});return em.createElement(VM,{key:"line-".concat(i),option:r,lineItemProps:a})});return em.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function VD(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VA(e,VC),l=i.map((e,i)=>{var a=VS(VS({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(i),index:i});return em.createElement(VM,{option:r,lineItemProps:a,key:"line-".concat(i)})});return em.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function VL(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:l=!0}=e;if(!l||!t||!t.length||null==s)return null;var c=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,s)=>{var l=c[s+1]?c[s+1]-e:i+o-e;if(l<=0)return null;var u=s%t.length;return em.createElement("rect",{key:"react-".concat(s),y:e,x:r,height:l,width:a,stroke:"none",fill:t[u],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function VI(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:l}=e;if(!t||!n||!n.length)return null;var c=l.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,t)=>{var l=c[t+1]?c[t+1]-e:i+o-e;if(l<=0)return null;var u=t%n.length;return em.createElement("rect",{key:"react-".concat(t),x:e,y:a,width:l,height:s,stroke:"none",fill:n[u],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var VR=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return CF(Fo(VS(VS(VS({},Fd),n),{},{ticks:CV(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},VB=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return CF(Fo(VS(VS(VS({},Fd),n),{},{ticks:CV(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},Vz={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:OY.grid};function VF(e){var t=Ck(Cq),n=Ck(CK),r=_y(),i=VS(VS({},Rd(e,Vz)),{},{x:kJ(e.x)?e.x:r.left,y:kJ(e.y)?e.y:r.top,width:kJ(e.width)?e.width:r.width,height:kJ(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:l,width:c,height:u,syncWithTicks:d,horizontalValues:h,verticalValues:f}=i,p=C8(),g=Ck(e=>PU(e,"xAxis",a,p)),v=Ck(e=>PU(e,"yAxis",o,p));if(!CL(c)||!CL(u)||!kJ(s)||!kJ(l))return null;var x=i.verticalCoordinatesGenerator||VR,y=i.horizontalCoordinatesGenerator||VB,{horizontalPoints:b,verticalPoints:w}=i;if((!b||!b.length)&&"function"==typeof y){var j=h&&h.length,N=y({yAxis:v?VS(VS({},v),{},{ticks:j?h:v.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!j||d);_n(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(b=N)}if((!w||!w.length)&&"function"==typeof x){var k=f&&f.length,E=x({xAxis:g?VS(VS({},g),{},{ticks:k?f:g.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!k||d);_n(Array.isArray(E),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(w=E)}return em.createElement(B_,{zIndex:i.zIndex},em.createElement("g",{className:"recharts-cartesian-grid"},em.createElement(VO,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),em.createElement(VL,VT({},i,{horizontalPoints:b})),em.createElement(VI,VT({},i,{verticalPoints:w})),em.createElement(VP,VT({},i,{offset:r,horizontalPoints:b,xAxis:g,yAxis:v})),em.createElement(VD,VT({},i,{offset:r,verticalPoints:w,xAxis:g,yAxis:v}))))}VF.displayName="CartesianGrid";let VV=["1h","12h","1d","7d","30d","90d"],VU="#8b5cf6",VH="#ec4899",VW="#6366f1",VY="#0074d9",VG="var(--chart-5)",VX="var(--muted-foreground)",V$={world:{label:"World",color:VU},experience:{label:"Experience",color:VH},observation:{label:"Observations",color:VW}};function Vq(e){if(e<1e3)return e.toString();if(e<1e6){let t=e/1e3;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}k`}if(e<1e9){let t=e/1e6;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}M`}let t=e/1e9;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}B`}function VK({value:e,className:t}){return(0,ep.jsx)("span",{className:t,title:e.toLocaleString(),children:Vq(e)})}function VZ({active:e,payload:t,label:n,valueLabel:r}){return e&&t&&0!==t.length?(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 bg-popover/95 backdrop-blur-sm px-3 py-2 shadow-md",children:[null!=n&&(0,ep.jsx)("div",{className:"text-[11px] font-medium text-foreground mb-1.5",children:n}),(0,ep.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color||e.payload?.fill}}),(0,ep.jsx)("span",{className:"text-muted-foreground",children:e.name||r||"Value"}),(0,ep.jsx)("span",{className:"ml-auto pl-3 font-semibold tabular-nums text-foreground",children:(e.value??0).toLocaleString()})]},t))})]}):null}function VQ({children:e}){return(0,ep.jsx)("h3",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em] mb-3",children:e})}function VJ(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let n=Math.floor(t/60);if(n<24)return`${n}h ago`;let r=Math.floor(n/24);return`${r}d ago`}function V0({done:e,total:t,doneColor:n}){let r=Math.round(100*(t>0?e/t:0));return(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"tabular-nums font-semibold text-foreground text-sm",children:e.toLocaleString()}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:[" / ",t.toLocaleString()]})]}),(0,ep.jsxs)("span",{className:"text-xs font-semibold tabular-nums text-foreground",children:[r,"%"]})]}),(0,ep.jsx)("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r}%`,backgroundColor:n}})})]})}function V1({title:e,items:t,emptyLabel:n}){let r=t.reduce((e,t)=>e+t.value,0);return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:e}),(0,ep.jsx)(VK,{value:r,className:"text-xs text-muted-foreground tabular-nums"})]}),0===r?(0,ep.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:n}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:t.filter(e=>e.value>0).map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/r*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ep.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:t.map(e=>(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ep.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ep.jsx)(VK,{value:e.value,className:"text-base font-semibold tabular-nums"}),(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:r>0?`${(e.value/r*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function V2({icon:e,label:t,value:n}){return(0,ep.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,ep.jsx)("div",{className:"p-2 rounded-md bg-muted",children:(0,ep.jsx)(e,{className:"w-4 h-4 text-muted-foreground"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:t}),(0,ep.jsx)(VK,{value:n,className:"text-2xl font-semibold text-foreground leading-tight tabular-nums block"})]})]})}let V5=["completed","in_progress","pending","failed","cancelled"],V3={completed:VG,in_progress:VY,pending:"var(--chart-4)",failed:"var(--destructive)",cancelled:VX},V4={completed:"Completed",in_progress:"In progress",pending:"Pending",failed:"Failed",cancelled:"Cancelled"};function V6({byStatus:e}){let t=V5.map(t=>({status:t,label:V4[t],value:e[t]||0,color:V3[t]}));for(let[n,r]of Object.entries(e))V5.includes(n)||t.push({status:n,label:n,value:r,color:VX});let n=t.reduce((e,t)=>e+t.value,0),r=t.filter(e=>e.value>0);return(0,ep.jsxs)(pv,{children:[(0,ep.jsxs)(px,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,ep.jsxs)(py,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(jR,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Operations"]}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(VK,{value:n})," total"]})]}),(0,ep.jsx)(pw,{children:0===n?(0,ep.jsx)("div",{className:"h-[100px] flex items-center justify-center text-sm text-muted-foreground",children:"No operations yet"}):(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:r.map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/n*100}%`,backgroundColor:e.color},title:`${e.label}: ${e.value.toLocaleString()}`},e.status))}),(0,ep.jsx)("div",{className:"space-y-1.5",children:r.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] flex-shrink-0",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-muted-foreground flex-1",children:e.label}),(0,ep.jsx)(VK,{value:e.value,className:"font-semibold tabular-nums text-foreground"}),(0,ep.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums w-9 text-right",children:[(e.value/n*100).toFixed(0),"%"]})]},e.status))})]})})]})}function V8({done:e,pending:t,failed:n,total:r,lastConsolidatedAt:i}){let[a,o]=(0,em.useState)(!1),s=n>0;return(0,ep.jsxs)(pv,{children:[(0,ep.jsx)(px,{className:"pb-2",children:(0,ep.jsx)(py,{className:"text-sm font-semibold",children:"Consolidation"})}),(0,ep.jsxs)(pw,{className:"space-y-4",children:[(0,ep.jsx)(V0,{done:e,total:r,doneColor:VG}),(0,ep.jsxs)("div",{className:"grid grid-cols-4 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jB.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Done"})]}),(0,ep.jsx)(VK,{value:e,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jc,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Pending"})]}),(0,ep.jsx)(VK,{value:t,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("button",{type:"button",onClick:()=>s&&o(!0),disabled:!s,className:`text-left space-y-0.5 rounded-md -mx-1 px-1 py-0.5 transition-colors ${s?"cursor-pointer hover:bg-red-500/10 focus:outline-none focus:ring-2 focus:ring-red-500/40":"cursor-default"}`,title:s?"View failed memories":void 0,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jz,{className:`w-3 h-3 ${s?"text-red-600 dark:text-red-400":"text-muted-foreground/50"}`}),(0,ep.jsx)("span",{className:`text-[10px] uppercase tracking-wider font-medium ${s?"text-red-600 dark:text-red-400":"text-muted-foreground"}`,children:"Failed"})]}),(0,ep.jsxs)("span",{className:`text-base font-semibold tabular-nums block ${s?"text-red-600 dark:text-red-400":"text-foreground"}`,children:[(0,ep.jsx)(VK,{value:n}),s&&(0,ep.jsx)(jF,{className:"inline w-3 h-3 ml-1 opacity-70"})]})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eW,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Last"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold text-foreground block leading-tight",children:VJ(i)})]})]})]}),(0,ep.jsx)(V7,{open:a,onOpenChange:o})]})}function V7({open:e,onOpenChange:t}){let{currentBank:n}=(0,ey.useBank)(),[r,i]=(0,em.useState)([]),[a,o]=(0,em.useState)(0),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(0);(0,em.useEffect)(()=>{if(!e||!n)return;let t=!1;return l(!0),eD.client.listMemories(n,{consolidationState:"failed",limit:200}).then(e=>{t||(i(e.items),o(e.total))}).catch(()=>{}).finally(()=>{t||l(!1)}),()=>{t=!0}},[e,n,d]);let f=async()=>{if(n){u(!0);try{let e=await eD.client.recoverConsolidation(n);e.retried_count>0&&await eD.client.triggerConsolidation(n),ev.toast.success(`Queued ${e.retried_count} memor${1===e.retried_count?"y":"ies"} for re-consolidation`),h(e=>e+1)}catch{}finally{u(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:e,onOpenChange:t,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(jz,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),"Failed consolidations"]}),(0,ep.jsx)(tH.DialogDescription,{children:"Source memories whose consolidation permanently failed. Recovery resets them so they are retried on the next consolidation run."})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:s?"Loading…":`${a} failed`}),(0,ep.jsxs)(eL.Button,{size:"sm",onClick:f,disabled:c||s||0===a,children:[(0,ep.jsx)(eU,{className:`w-3.5 h-3.5 mr-1.5 ${c?"animate-spin":""}`}),"Recover all"]})]}),(0,ep.jsx)("div",{className:"flex-1 min-h-0 overflow-auto border border-border rounded-md",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[140px]",children:"Failed at"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Type"}),(0,ep.jsx)(eJ,{children:"Text"})]})}),(0,ep.jsxs)(eZ,{children:[0===r.length&&!s&&(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:3,className:"text-center text-muted-foreground py-8",children:"No failed consolidations."})}),r.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"text-xs text-muted-foreground whitespace-nowrap",children:VJ(e.consolidation_failed_at)}),(0,ep.jsx)(e0,{className:"text-xs capitalize",children:e.fact_type}),(0,ep.jsxs)(e0,{className:"text-sm",children:[(0,ep.jsx)("div",{className:"line-clamp-2",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e.context})]})]},e.id))]})]})})]})})}function V9({models:e,lastConsolidatedAt:t}){let n=e.length,r=t?new Date(t).getTime():0,i=e.filter(e=>!r||!!e.last_refreshed_at&&new Date(e.last_refreshed_at).getTime()>=r).length,a=n-i;return(0,ep.jsxs)(pv,{children:[(0,ep.jsx)(px,{className:"pb-2",children:(0,ep.jsxs)(py,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(pN,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Mental Models"]})}),(0,ep.jsx)(pw,{className:"space-y-4",children:0===n?(0,ep.jsx)("div",{className:"text-sm text-muted-foreground py-4",children:"No mental models"}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(V0,{done:i,total:n,doneColor:VG}),(0,ep.jsxs)("div",{className:"grid grid-cols-3 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jB.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Up to date"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:i})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jc,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Stale"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:a})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(pN,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Total"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:n})]})]})]})})]})}let Ue={fontSize:11,fill:VX,fontWeight:500};function Ut(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,ew.useFeatures)(),n=t?.observations??!1,[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("7d"),[d,h]=(0,em.useState)({trunc:"day",buckets:[]}),[f,p]=(0,em.useState)({world:!0,experience:!0,observation:!0}),g=async()=>{if(e){l(!0);try{let[t,n]=await Promise.all([eD.client.getBankStats(e),eD.client.listMentalModels(e)]);i(t),o(n.items||[])}catch(e){console.error("Error loading bank stats:",e)}finally{l(!1)}}},v=async()=>{if(e)try{let t=await eD.client.getMemoriesTimeseries(e,c);h({trunc:t.trunc,buckets:t.buckets||[]})}catch(e){console.error("Error loading memories timeseries:",e)}};if((0,em.useEffect)(()=>{if(e){g();let e=setInterval(g,5e3);return()=>clearInterval(e)}},[e]),(0,em.useEffect)(()=>{if(e){v();let e=setInterval(v,5e3);return()=>clearInterval(e)}},[e,c]),s&&!r)return(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(eW,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})});if(!r)return null;let x=n?["world","experience","observation"]:["world","experience"],y=d.buckets.map(e=>{var t,n,r,i;let a,o;return{...e,label:(t=e.time,n=d.trunc,a=new Date(t),"day"===n?a.toLocaleDateString(void 0,{month:"short",day:"numeric"}):a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})),tooltipLabel:(r=e.time,i=d.trunc,o=new Date(r),"day"===i?o.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):o.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}}),b=y.reduce((e,t)=>e+x.reduce((e,n)=>e+(f[n]&&t[n]||0),0),0),w=Math.max(0,r.total_nodes-r.pending_consolidation);return(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)("section",{children:[(0,ep.jsx)(VQ,{children:"Memory store"}),(0,ep.jsx)(pv,{children:(0,ep.jsxs)(pw,{className:"p-0",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 md:divide-x divide-y md:divide-y-0 divide-border/60",children:[(0,ep.jsx)(V2,{icon:eE,label:"Memories",value:r.total_nodes}),(0,ep.jsx)(V2,{icon:jI,label:"Documents",value:r.total_documents}),(0,ep.jsx)(V2,{icon:jL,label:"Links",value:r.total_links})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 md:divide-x divide-y md:divide-y-0 divide-border/60 border-t border-border/60",children:[(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(V1,{title:"Memory composition",items:[{name:"World",value:r.nodes_by_fact_type?.world||0,color:VU},{name:"Experience",value:r.nodes_by_fact_type?.experience||0,color:VH},...n?[{name:"Observations",value:r.total_observations||0,color:VW}]:[]],emptyLabel:"No memories yet"})}),(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(V1,{title:"Link types",items:[{name:"Temporal",value:r.links_by_link_type?.temporal||0,color:"#009296"},{name:"Semantic",value:r.links_by_link_type?.semantic||0,color:VY},{name:"Entity",value:r.links_by_link_type?.entity||0,color:"#f59e0b"}],emptyLabel:"No links yet"})})]})]})})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(VQ,{children:"Consolidation"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsx)(V8,{done:w,pending:r.pending_consolidation,failed:r.failed_consolidation??0,total:r.total_nodes,lastConsolidatedAt:r.last_consolidated_at}),(0,ep.jsx)(V9,{models:a,lastConsolidatedAt:r.last_consolidated_at})]})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(VQ,{children:"Activity"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ep.jsxs)(pv,{className:"lg:col-span-2",children:[(0,ep.jsxs)(px,{className:"pb-2 space-y-2",children:[(0,ep.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,ep.jsx)(py,{className:"text-sm font-semibold",children:"Memories ingested"}),(0,ep.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:VV.map(e=>(0,ep.jsx)("button",{onClick:()=>u(e),className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors tabular-nums ${c===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("div",{className:"flex items-center gap-1.5",children:x.map(e=>{let t=V$[e],n=f[e];return(0,ep.jsxs)("button",{onClick:()=>p(t=>({...t,[e]:!t[e]})),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] font-medium transition-all ${n?"bg-muted text-foreground":"bg-transparent text-muted-foreground/60 hover:text-muted-foreground"}`,children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] transition-opacity",style:{backgroundColor:t.color,opacity:n?1:.3}}),t.label]},e)})}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(VK,{value:b})," total"]})]})]}),(0,ep.jsx)(pw,{children:0===y.length||0===b?(0,ep.jsx)("div",{className:"h-[180px] flex items-center justify-center text-sm text-muted-foreground",children:"No memories ingested in this period"}):(0,ep.jsx)("div",{className:"h-[180px]",children:(0,ep.jsx)(_m,{width:"100%",height:"100%",children:(0,ep.jsxs)(Rg,{data:y,margin:{top:8,right:8,bottom:0,left:-10},children:[(0,ep.jsx)("defs",{children:x.map(e=>(0,ep.jsxs)("linearGradient",{id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ep.jsx)("stop",{offset:"0%",stopColor:V$[e].color,stopOpacity:.35}),(0,ep.jsx)("stop",{offset:"100%",stopColor:V$[e].color,stopOpacity:0})]},e))}),(0,ep.jsx)(VF,{vertical:!1,stroke:"var(--border)",strokeOpacity:.5,strokeDasharray:"2 4"}),(0,ep.jsx)(FT,{dataKey:"label",tick:Ue,axisLine:!1,tickLine:!1,dy:4,minTickGap:20}),(0,ep.jsx)(FR,{tick:Ue,axisLine:!1,tickLine:!1,width:40,allowDecimals:!1,tickFormatter:e=>Vq(e)}),(0,ep.jsx)(Vj,{content:(0,ep.jsx)(VZ,{}),labelFormatter:(e,t)=>t?.[0]?.payload?.tooltipLabel||"",cursor:{stroke:VX,strokeWidth:1,strokeDasharray:"3 3"}}),x.map(e=>f[e]?(0,ep.jsx)(z9,{type:"monotone",dataKey:e,name:V$[e].label,stackId:"a",stroke:V$[e].color,strokeWidth:2,fill:`url(#grad-${e})`,isAnimationActive:!1},e):null)]})})})})]}),(0,ep.jsx)(V6,{byStatus:r.operations_by_status||{}})]})]})]})}var tV=tV;let Un=(0,eN.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Ur=(0,eN.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Ui=[{value:"all",label:"All types"},{value:"retain",label:"Retain"},{value:"consolidation",label:"Consolidation"},{value:"refresh_mental_model",label:"Mental Model Refresh"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}];function Ua(){let e,t,n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)([]),[o,s]=(0,em.useState)(0),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)(null),[h]=(0,em.useState)(10),[f,p]=(0,em.useState)(0),[g,v]=(0,em.useState)(null),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(null),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(null),M=(0,em.useCallback)(async(e=l,t=f,n=u)=>{if(r){w(!0);try{let i=await eD.client.listOperations(r,{status:e||void 0,type:n||void 0,limit:h,offset:t});a(i.operations||[]),s(i.total||0)}catch(e){console.error("Error loading operations:",e)}finally{w(!1)}}},[r,l,f,u,h]),P=e=>{p(e),M(l,e,u)},D=async e=>{if(r){v(e);try{await eD.client.cancelOperation(r,e),await M()}catch(e){}finally{v(null)}}},L=async e=>{if(r){y(e);try{await eD.client.retryOperation(r,e),await M()}catch(e){}finally{y(null)}}},I=async e=>{if(r){_(!0),E(!0),O(null);try{let t=await eD.client.getOperationStatus(r,e);N(t)}catch(e){console.error("Error loading operation details:",e),N({error:"Failed to load operation details"})}finally{_(!1)}}},R=async()=>{if(r&&j?.operation_id){T(!0);try{let e=j.operation_id,t=await eD.client.getOperationStatus(r,e,{includePayload:!0});N(t),O(e)}catch(e){console.error("Error loading raw payload:",e)}finally{T(!1)}}};return((0,em.useEffect)(()=>{if(r){M(l,f,u);let e=setInterval(()=>M(l,f,u),5e3);return()=>clearInterval(e)}},[r,l,f,u]),r)?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Background Operations"}),(0,ep.jsx)("button",{onClick:()=>M(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh operations",disabled:b,children:(0,ep.jsx)(eU,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${b?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[o," operation",1!==o?"s":"",l?` (${l})`:""]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(tR.Select,{value:u??"all",onValueChange:e=>{var t;d(t="all"===e?null:e),p(0),M(l,0,t)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All types"})}),(0,ep.jsx)(tR.SelectContent,{children:Ui.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{children:e.label}),"all"!==e.value&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground font-mono",children:e.value})]})},e.value))})]}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:[{value:null,label:"All"},{value:"pending",label:"Pending"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}].map(e=>(0,ep.jsx)("button",{onClick:()=>{var t;c(t=e.value),p(0),M(t,0,u)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${l===e.value?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e.label},e.value??"all"))})]})]}),(0,ep.jsx)("div",{children:i.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eJ,{children:"Type"}),(0,ep.jsx)(eJ,{children:"Created"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{className:"w-[80px]"})]})}),(0,ep.jsx)(eZ,{children:i.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${"failed"===e.status?"bg-red-500/5":""}`,onClick:()=>I(e.id),children:[(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,ep.jsx)(e0,{className:"font-medium",children:e.task_type}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"pending"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",title:e.error_message??void 0,children:[(0,ep.jsx)(jc,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"completed"]})]}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:t=>{t.stopPropagation(),D(e.id)},disabled:g===e.id,children:[g===e.id?(0,ep.jsx)(tV.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(e$.X,{className:"w-3 h-3 mr-1"}),g===e.id?"":"Cancel"]}),"failed"===e.status&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-blue-600 dark:hover:text-blue-400",onClick:t=>{t.stopPropagation(),L(e.id)},disabled:x===e.id,children:[x===e.id?(0,ep.jsx)(tV.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(Un,{className:"w-3 h-3 mr-1"}),x===e.id?"":"Retry"]})]})]},e.id))})]})}),o>h&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Showing ",f+1,"-",Math.min(f+h,o)," of"," ",o]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>P(Math.max(0,f-h)),disabled:0===f,children:"Previous"}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>P(f+h),disabled:f+h>=o,children:"Next"})]})]})]}):(0,ep.jsxs)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:["No ",l?`${l} `:"","operations"]})}),(0,ep.jsx)(tH.Dialog,{open:k,onOpenChange:E,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Operation Details"}),(0,ep.jsx)(tH.DialogDescription,{children:j?.operation_id&&(0,ep.jsx)("span",{className:"font-mono text-xs",children:j.operation_id})})]}),C?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tV.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):j?(0,ep.jsx)("div",{className:"space-y-4",children:j.error?(0,ep.jsx)("div",{className:"text-red-600 dark:text-red-400",children:j.error}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),(0,ep.jsxs)("div",{className:"mt-1",children:["pending"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"pending"]}),"failed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(jc,{className:"w-3 h-3"}),"failed"]}),"completed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"completed"]})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Type"}),(0,ep.jsx)("div",{className:"mt-1 font-mono text-sm",children:j.operation_type})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Created"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.created_at?new Date(j.created_at).toLocaleString():"N/A"})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Updated"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.updated_at?new Date(j.updated_at).toLocaleString():"N/A"})]}),j.completed_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Completed"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:new Date(j.completed_at).toLocaleString()})]}),j.result_metadata?.items_count!==void 0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Total Items"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.result_metadata.items_count})]})]}),j.result_metadata&&Object.keys(j.result_metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.result_metadata,null,2)})]}),j.error_message&&(0,ep.jsxs)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-red-600 dark:text-red-400 mb-1",children:"Error"}),(0,ep.jsx)("div",{className:"text-sm text-red-600/80 dark:text-red-400/80 font-mono",children:j.error_message})]}),j.child_operations&&j.child_operations.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Sub-batches (",j.result_metadata?.num_sub_batches||j.child_operations.length,")"]}),(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[60px]",children:"Index"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eJ,{className:"w-[80px]",children:"Items"}),(0,ep.jsx)(eJ,{children:"Status"})]})}),(0,ep.jsx)(eZ,{children:j.child_operations.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"text-sm",children:e.sub_batch_index}),(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.operation_id.substring(0,8)}),(0,ep.jsx)(e0,{className:"text-sm",children:e.items_count}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"pending"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400",title:e.error_message??void 0,children:[(0,ep.jsx)(jc,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"completed"]})]})]},e.operation_id))})]})]}),(e=A===j.operation_id,t=!!j.task_payload,n=!!j.result_metadata?.is_parent,(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Raw payload"}),!e&&(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:R,disabled:S,children:[S?(0,ep.jsx)(tV.default,{className:"w-3 h-3 mr-1 animate-spin"}):(0,ep.jsx)(Ur,{className:"w-3 h-3 mr-1"}),"Load raw"]})]}),t?(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.task_payload,null,2)}):e?(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"This is a parent operation — the raw payload is stored on each sub-batch. Open a child operation to inspect its payload.":"No raw payload stored for this operation."}):(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Shows the full parameters the operation was submitted with (may be large)."})]}))]})}):null]})})]}):null}var tV=tV;let Uo=(0,eN.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);function Us(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)("dashboard"),[s,l]=(0,em.useState)(""),[c,u]=(0,em.useState)(1),[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(!1),k=t.filter(e=>{if(!s)return!0;let t=s.toLowerCase();return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.source_query.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),E=async()=>{if(e){i(!0);try{let t=await eD.client.listMentalModels(e);n(t.items||[])}catch(e){console.error("Error loading mental models:",e)}finally{i(!1)}}},[C,_]=(0,em.useState)(new Set),S=async t=>{if(!e)return;let r=t.last_refreshed_at;_(e=>new Set(e).add(t.id));try{await eD.client.refreshMentalModel(e,t.id);for(let i=0;i<120;i++){await new Promise(e=>setTimeout(e,1e3));let i=await eD.client.getMentalModel(e,t.id);if(i.last_refreshed_at!==r){n(e=>e.map(e=>e.id===t.id?i:e)),f?.id===t.id&&p(i),ev.toast.success("Mental model refreshed");return}}ev.toast.error("Refresh timeout")}catch{}finally{_(e=>{let n=new Set(e);return n.delete(t.id),n})}},T=async()=>{if(e&&b){N(!0);try{await eD.client.deleteMentalModel(e,b.id),n(e=>e.filter(e=>e.id!==b.id)),f?.id===b.id&&p(null),w(null)}catch(e){}finally{N(!1)}}};if((0,em.useEffect)(()=>{e&&E()},[e]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&p(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,em.useEffect)(()=>{u(1)},[s]),!e)return(0,ep.jsx)(pv,{children:(0,ep.jsx)(pw,{className:"p-10 text-center",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to view mental models."})})});let A=Math.ceil(k.length/100),O=(c-1)*100,M=O+100,P=k.slice(O,M);return(0,ep.jsxs)("div",{children:[r?(0,ep.jsxs)("div",{className:"text-center py-12",children:[(0,ep.jsx)(eU,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Loading..."})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"mb-4",children:(0,ep.jsx)(eI.Input,{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:"Filter mental models by name, query, or content...",className:"max-w-md"})}),(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:s?`${k.length} of ${t.length} mental models`:`${t.length} mental model${1!==t.length?"s":""}`}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(eL.Button,{onClick:()=>h(!0),size:"sm",children:[(0,ep.jsx)(fI.Plus,{className:"w-4 h-4 mr-2"}),"Add Mental Model"]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>o("dashboard"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"dashboard"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(Uo,{className:"w-4 h-4"}),"Dashboard"]}),(0,ep.jsxs)("button",{onClick:()=>o("table"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"table"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eG,{className:"w-4 h-4"}),"Table"]})]})]})]}),k.length>0?(0,ep.jsxs)(ep.Fragment,{children:["dashboard"===a&&(0,ep.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:P.map(e=>(0,ep.jsx)(pv,{className:`cursor-pointer transition-all hover:shadow-md hover:border-primary/50 ${f?.id===e.id?"border-primary shadow-md":""}`,onClick:()=>p(e),children:(0,ep.jsxs)(pw,{className:"p-4",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("h3",{className:"font-semibold text-foreground mb-1 truncate",children:e.name}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate",children:e.id}),(0,ep.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium flex-shrink-0 ${e.trigger?.refresh_after_consolidation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-slate-500/10 text-slate-600 dark:text-slate-400"}`,children:e.trigger?.refresh_after_consolidation?"Auto Refresh":"Manual"})]})]}),(0,ep.jsx)(Ul,{m:e,refreshing:C.has(e.id),onEdit:e=>{y(e),v(!0)},onRefresh:S,onDelete:e=>w({id:e.id,name:e.name}),triggerClassName:"h-7 w-7 ml-2 flex-shrink-0"})]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.source_query}),(0,ep.jsxs)("div",{className:"relative mb-3 border-t border-border pt-3 max-h-40 overflow-hidden",children:[(0,ep.jsx)(wB,{children:e.content}),(0,ep.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent"})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between text-xs border-t border-border pt-3",children:[(0,ep.jsx)("div",{className:"flex items-center gap-2",children:e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex gap-1",children:[e.tags.slice(0,2).map(e=>(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e)),e.tags.length>2&&(0,ep.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-muted text-muted-foreground",children:["+",e.tags.length-2]})]})}),(0,ep.jsx)("div",{className:"text-muted-foreground",title:wU(e.last_refreshed_at),children:wV(e.last_refreshed_at)})]})]})},e.id))}),"table"===a&&(0,ep.jsxs)(eq,{className:"table-fixed",children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[20%]",children:"ID"}),(0,ep.jsx)(eJ,{className:"w-[20%]",children:"Name"}),(0,ep.jsx)(eJ,{className:"w-[35%]",children:"Source Query"}),(0,ep.jsx)(eJ,{className:"w-[15%]",children:"Last Refreshed"}),(0,ep.jsx)(eJ,{className:"w-[10%]"})]})}),(0,ep.jsx)(eZ,{children:P.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>p(e),children:[(0,ep.jsx)(e0,{className:"py-2",children:(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate block",children:e.id})}),(0,ep.jsx)(e0,{className:"py-2",children:(0,ep.jsx)("div",{className:"font-medium text-foreground",children:e.name})}),(0,ep.jsx)(e0,{className:"py-2",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground truncate",children:e.source_query})}),(0,ep.jsx)(e0,{className:"py-2 text-sm text-foreground",title:wU(e.last_refreshed_at),children:wV(e.last_refreshed_at)}),(0,ep.jsx)(e0,{className:"py-2",children:(0,ep.jsx)(Ul,{m:e,refreshing:C.has(e.id),onEdit:e=>{y(e),v(!0)},onRefresh:S,onDelete:e=>w({id:e.id,name:e.name})})})]},e.id))})]}),A>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[O+1,"-",Math.min(M,k.length)," of"," ",k.length]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.max(1,e-1)),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",A]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.min(A,e+1)),disabled:c===A,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(A),disabled:c===A,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-border rounded-lg text-center",children:[(0,ep.jsx)(ek,{className:"w-6 h-6 mx-auto mb-2 text-muted-foreground"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:s?"No mental models match your filter":"No mental models yet. Create a mental model to generate and save a summary from your memories."})]})]}),(0,ep.jsx)(Uc,{open:d,onClose:()=>h(!1),onCreated:()=>{h(!1),E()}}),(0,ep.jsx)(fY,{open:!!b,onOpenChange:e=>!e&&w(null),children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Mental Model"}),(0,ep.jsxs)(pn,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',b?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(pe,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(pi,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(pr,{onClick:T,disabled:j,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[j?(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),(0,ep.jsx)(wQ,{mentalModelId:f?.id??null,onClose:()=>p(null),onDelete:e=>w({id:e.id,name:e.name}),onEdit:e=>{y(e),v(!0)},onRefreshed:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e)}}),x&&(0,ep.jsx)(Uu,{open:g,mentalModel:x,onClose:()=>{v(!1),y(null)},onUpdated:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e),v(!1),y(null)}})]})}function Ul({m:e,refreshing:t,onEdit:n,onRefresh:r,onDelete:i,triggerClassName:a}){return(0,ep.jsxs)(gN,{children:[(0,ep.jsx)(gE,{asChild:!0,children:(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:`p-0 text-muted-foreground ${a??"h-8 w-8"}`,onClick:e=>e.stopPropagation(),"aria-label":"Actions",children:(0,ep.jsx)(gU,{className:"h-4 w-4"})})}),(0,ep.jsxs)(gB,{align:"end",onClick:e=>e.stopPropagation(),children:[(0,ep.jsxs)(gz,{onClick:()=>n(e),children:[(0,ep.jsx)(po,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(gz,{onClick:()=>r(e),disabled:t,children:[(0,ep.jsx)(eU,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),"Refresh Manually"]}),(0,ep.jsx)(gF,{}),(0,ep.jsxs)(gz,{onClick:()=>i(e),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(pa,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function Uc({open:e,onClose:t,onCreated:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),l=async()=>{if(r&&o.name.trim()&&o.sourceQuery.trim()){a(!0);try{let e,t=o.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),i=parseInt(o.maxTokens)||2048,a=o.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(o.tagGroups.trim())try{e=JSON.parse(o.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let l=o.recallMaxTokens.trim()?parseInt(o.recallMaxTokens,10):void 0,c=o.recallChunksMaxTokens.trim()?parseInt(o.recallChunksMaxTokens,10):void 0,u="true"===o.includeChunks||"false"!==o.includeChunks&&void 0;await eD.client.createMentalModel(r,{id:o.id.trim()||void 0,name:o.name.trim(),source_query:o.sourceQuery.trim(),tags:t.length>0?t:void 0,max_tokens:i,trigger:{mode:o.mode,refresh_after_consolidation:o.autoRefresh,fact_types:o.factTypes.length>0?o.factTypes:void 0,exclude_mental_models:o.excludeMentalModels||void 0,exclude_mental_model_ids:a.length>0?a:void 0,tags_match:o.tagsMatch||void 0,tag_groups:e,include_chunks:u,recall_max_tokens:l,recall_chunks_max_tokens:c}}),s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:e,onOpenChange:e=>{e||(s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),t())},children:(0,ep.jsxs)(tH.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Create Mental Model"}),(0,ep.jsx)(tH.DialogDescription,{children:"Create a mental model by running a query. The content will be auto-generated and can be refreshed later."})]}),(0,ep.jsxs)(tY.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(tY.TabsList,{className:"w-full",children:[(0,ep.jsx)(tY.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tY.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(tY.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"ID"}),(0,ep.jsx)(eI.Input,{value:o.id,onChange:e=>s({...o,id:e.target.value}),placeholder:"e.g., team-communication"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:o.name,onChange:e=>s({...o,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eI.Input,{value:o.sourceQuery,onChange:e=>s({...o,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.maxTokens,onChange:e=>s({...o,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tY.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(pd.Checkbox,{id:"auto-refresh",checked:o.autoRefresh,onCheckedChange:e=>s({...o,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tR.Select,{value:o.mode,onValueChange:e=>s({...o,mode:e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tR.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(pd.Checkbox,{id:"exclude-mental-models",checked:o.excludeMentalModels,onCheckedChange:e=>s({...o,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eI.Input,{value:o.excludeMentalModelIds,onChange:e=>s({...o,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eI.Input,{value:o.tags,onChange:e=>s({...o,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tR.Select,{value:o.tagsMatch,onValueChange:e=>s({...o,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tR.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(p_.Textarea,{value:o.tagGroups,onChange:e=>s({...o,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(pg,{value:o.factTypes,onChange:e=>s({...o,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tR.Select,{value:o.includeChunks||"default",onValueChange:e=>s({...o,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tR.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tR.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.recallMaxTokens,onChange:e=>s({...o,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.recallChunksMaxTokens,onChange:e=>s({...o,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:t,disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i||!o.name.trim()||!o.sourceQuery.trim(),children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}),"Generating..."]}):"Create"})]})]})})}function Uu({open:e,mentalModel:t,onClose:n,onUpdated:r}){let{currentBank:i}=(0,ey.useBank)(),[a,o]=(0,em.useState)(!1),s=()=>({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,mode:t.trigger?.mode||"full",factTypes:t.trigger?.fact_types||[],excludeMentalModels:t.trigger?.exclude_mental_models||!1,excludeMentalModelIds:(t.trigger?.exclude_mental_model_ids||[]).join(", "),tagsMatch:t.trigger?.tags_match||"",tagGroups:t.trigger?.tag_groups?JSON.stringify(t.trigger.tag_groups,null,2):"",includeChunks:t.trigger?.include_chunks===!0?"true":t.trigger?.include_chunks===!1?"false":"",recallMaxTokens:t.trigger?.recall_max_tokens!=null?String(t.trigger.recall_max_tokens):"",recallChunksMaxTokens:t.trigger?.recall_chunks_max_tokens!=null?String(t.trigger.recall_chunks_max_tokens):""}),[l,c]=(0,em.useState)(s);(0,em.useEffect)(()=>{e&&c(s())},[e,t]);let u=async()=>{if(i&&l.name.trim()&&l.sourceQuery.trim()){o(!0);try{let e,a=l.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),o=parseInt(l.maxTokens)||2048,s=l.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(l.tagGroups.trim())try{e=JSON.parse(l.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let c=l.recallMaxTokens.trim()?parseInt(l.recallMaxTokens,10):void 0,u=l.recallChunksMaxTokens.trim()?parseInt(l.recallChunksMaxTokens,10):void 0,d="true"===l.includeChunks||"false"!==l.includeChunks&&void 0,h=await eD.client.updateMentalModel(i,t.id,{name:l.name.trim(),source_query:l.sourceQuery.trim(),tags:a.length>0?a:void 0,max_tokens:o,trigger:{mode:l.mode,refresh_after_consolidation:l.autoRefresh,fact_types:l.factTypes.length>0?l.factTypes:void 0,exclude_mental_models:l.excludeMentalModels||void 0,exclude_mental_model_ids:s.length>0?s:void 0,tags_match:l.tagsMatch||void 0,tag_groups:e,include_chunks:d,recall_max_tokens:c,recall_chunks_max_tokens:u}});r(h),n()}catch(e){}finally{o(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:e,onOpenChange:e=>!e&&n(),children:(0,ep.jsxs)(tH.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Update Mental Model"}),(0,ep.jsx)(tH.DialogDescription,{children:"Update the mental model configuration. Changes will take effect immediately."})]}),(0,ep.jsxs)(tY.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(tY.TabsList,{className:"w-full",children:[(0,ep.jsx)(tY.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tY.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(tY.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)(eI.Input,{value:t.id,disabled:!0,className:"bg-muted"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:l.name,onChange:e=>c({...l,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eI.Input,{value:l.sourceQuery,onChange:e=>c({...l,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.maxTokens,onChange:e=>c({...l,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tY.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(pd.Checkbox,{id:"update-auto-refresh",checked:l.autoRefresh,onCheckedChange:e=>c({...l,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tR.Select,{value:l.mode,onValueChange:e=>c({...l,mode:e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tR.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(pd.Checkbox,{id:"update-exclude-mental-models",checked:l.excludeMentalModels,onCheckedChange:e=>c({...l,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eI.Input,{value:l.excludeMentalModelIds,onChange:e=>c({...l,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eI.Input,{value:l.tags,onChange:e=>c({...l,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tR.Select,{value:l.tagsMatch||"default",onValueChange:e=>c({...l,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tR.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(p_.Textarea,{value:l.tagGroups,onChange:e=>c({...l,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(pg,{value:l.factTypes,onChange:e=>c({...l,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tR.Select,{value:l.includeChunks||"default",onValueChange:e=>c({...l,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tR.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tR.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.recallMaxTokens,onChange:e=>c({...l,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.recallChunksMaxTokens,onChange:e=>c({...l,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:n,disabled:a,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:u,disabled:a||!l.name.trim()||!l.sourceQuery.trim(),children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}),"Updating..."]}):"Update"})]})]})})}let Ud=(0,eN.default)("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"}]]),Uh=(0,eN.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var tV=tV;let Uf=["consolidation.completed","retain.completed"],Up={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function Um(e){return Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key,e.value]))}function Ug(e){return{method:e.method,timeout_seconds:e.timeout_seconds,headers:Um(e.headers),params:Um(e.params)}}function Uv({label:e,pairs:t,onChange:n}){let r=(e,r,i)=>{n(t.map((t,n)=>n===e?{...t,[r]:i}:t))};return(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)(e8,{children:e}),(0,ep.jsxs)(eL.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>n([...t,{key:"",value:""}]),children:[(0,ep.jsx)(fI.Plus,{className:"w-3 h-3 mr-1"}),"Add"]})]}),t.length>0&&(0,ep.jsx)("div",{className:"space-y-1.5",children:t.map((e,i)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eI.Input,{placeholder:"Key",value:e.key,onChange:e=>r(i,"key",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)(eI.Input,{placeholder:"Value",value:e.value,onChange:e=>r(i,"value",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)("button",{type:"button",onClick:()=>n(t.filter((e,t)=>t!==i)),className:"text-muted-foreground hover:text-foreground shrink-0",children:(0,ep.jsx)(e$.X,{className:"w-4 h-4"})})]},i))})]})}function Ux({delivery:e,formatDate:t}){var n;let[r,i]=(0,em.useState)(!1),a=e.last_response_body||e.last_error;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)(eQ,{className:a?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>a&&i(e=>!e),children:[(0,ep.jsx)(e0,{className:"w-8 pl-3 pr-0",children:a?r?(0,ep.jsx)(w4.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,ep.jsx)(e0,{children:"completed"===(n=e.status)?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"delivered"]}):"pending"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"pending"]}):"failed"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(jc,{className:"w-3 h-3"}),"failed"]}):(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:n})}),(0,ep.jsx)(e0,{children:null!=e.last_response_status?(0,ep.jsx)("span",{className:`font-mono text-xs px-1.5 py-0.5 rounded border ${e.last_response_status>=200&&e.last_response_status<300?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"}`,children:e.last_response_status}):(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"—"})}),(0,ep.jsx)(e0,{className:"text-center text-sm",children:e.attempts}),(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.event_type}),(0,ep.jsx)(e0,{className:"text-xs text-muted-foreground whitespace-nowrap",children:t(e.created_at)})]}),r&&a&&(0,ep.jsx)(eQ,{className:"bg-muted/20 hover:bg-muted/20",children:(0,ep.jsx)(e0,{colSpan:6,className:"px-4 py-3",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[e.last_error&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Error"}),(0,ep.jsx)("p",{className:"font-mono text-xs text-red-600 dark:text-red-400 break-all",children:e.last_error})]}),e.last_response_body&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Response Body",e.last_attempt_at&&(0,ep.jsxs)("span",{className:"ml-2 normal-case font-normal",children:["· ",t(e.last_attempt_at)]})]}),(0,ep.jsx)("pre",{className:"font-mono text-xs bg-background rounded p-2 overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto border border-border",children:e.last_response_body})]})]})})})]})}function Uy(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(!1),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(null),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(Up),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(Up),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)([]),[I,R]=(0,em.useState)(!1),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(!1),U=async()=>{if(e){i(!0);try{let t=await eD.client.listWebhooks(e);n(t.items||[])}catch(e){console.error("Error loading webhooks:",e)}finally{i(!1)}}};(0,em.useEffect)(()=>{e&&U()},[e]);let H=async()=>{if(e&&g.url){l(!0);try{await eD.client.createWebhook(e,{url:g.url,secret:g.secret||void 0,event_types:g.event_types.length>0?g.event_types:void 0,enabled:g.enabled,http_config:Ug(g.http_config)}),o(!1),v(Up),p(!1),await U()}catch(e){}finally{l(!1)}}},W=async t=>{if(e){u(t),h(null);try{await eD.client.deleteWebhook(e,t),await U()}catch(e){}finally{u(null)}}},Y=async()=>{if(e&&b&&j.url){T(!0);try{let t={url:j.url,event_types:j.event_types,enabled:j.enabled,http_config:Ug(j.http_config)};C?t.secret=null:j.secret&&(t.secret=j.secret),await eD.client.updateWebhook(e,b.id,t),y(!1),await U()}catch{}finally{T(!1)}}},G=async t=>{if(e){P(t),O(!0),L([]),z(null),R(!0);try{let n=await eD.client.listWebhookDeliveries(e,t.id,50);L(n.items||[]),z(n.next_cursor??null)}catch(e){console.error("Error loading deliveries:",e)}finally{R(!1)}}},X=async()=>{if(e&&M&&B){V(!0);try{let t=await eD.client.listWebhookDeliveries(e,M.id,50,B);L(e=>[...e,...t.items||[]]),z(t.next_cursor??null)}catch(e){console.error("Error loading more deliveries:",e)}finally{V(!1)}}},$=e=>e?new Date(e).toLocaleString():"N/A";return e?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Webhooks"}),(0,ep.jsx)("button",{onClick:()=>U(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh webhooks",disabled:r,children:(0,ep.jsx)(eU,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${r?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[t.length," webhook",1!==t.length?"s":""]})]}),(0,ep.jsxs)(eL.Button,{size:"sm",onClick:()=>o(!0),children:[(0,ep.jsx)(fI.Plus,{className:"w-4 h-4 mr-2"}),"Add Webhook"]})]}),t.length>0?(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"URL"}),(0,ep.jsx)(eJ,{children:"Method"}),(0,ep.jsx)(eJ,{children:"Event Types"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{children:"Created At"}),(0,ep.jsx)(eJ,{className:"w-[120px]"})]})}),(0,ep.jsx)(eZ,{children:t.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,ep.jsx)("span",{title:e.url,children:e.url})}),(0,ep.jsx)(e0,{children:(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-muted text-muted-foreground border border-border",children:e.http_config?.method||"POST"})}),(0,ep.jsx)(e0,{children:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:e.event_types.length>0?e.event_types.map(e=>(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:e},e)):(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:"All events"})})}),(0,ep.jsx)(e0,{children:e.enabled?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"Enabled"]}):(0,ep.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:"Disabled"})}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground",children:$(e.created_at)}),(0,ep.jsx)(e0,{children:(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>G(e),title:"View deliveries",children:[(0,ep.jsx)(Ud,{className:"w-3 h-3 mr-1"}),"Deliveries"]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{let t;return w(e),void(N((t=e.http_config??{method:"POST",timeout_seconds:30,headers:{},params:{}},{url:e.url,secret:"",event_types:e.event_types,enabled:e.enabled,http_config:{method:t.method,timeout_seconds:t.timeout_seconds,headers:Object.entries(t.headers??{}).map(([e,t])=>({key:e,value:t})),params:Object.entries(t.params??{}).map(([e,t])=>({key:e,value:t}))}})),E(!1),_(!1),y(!0))},title:"Edit webhook",children:(0,ep.jsx)(po,{className:"w-3 h-3"})}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:()=>h(e),disabled:c===e.id,title:"Delete webhook",children:c===e.id?(0,ep.jsx)(tV.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(pa,{className:"w-3 h-3"})})]})})]},e.id))})]})}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No webhooks configured. Add a webhook to receive event notifications."}),(0,ep.jsx)(tH.Dialog,{open:a,onOpenChange:e=>{e||(v(Up),p(!1)),o(e)},children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Add Webhook"}),(0,ep.jsx)(tH.DialogDescription,{children:"Configure a webhook endpoint to receive event notifications."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eI.Input,{id:"webhook-url",type:"url",placeholder:"https://example.com/webhook",value:g.url,onChange:e=>v(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Method"}),(0,ep.jsxs)(tR.Select,{value:g.http_config.method,onValueChange:e=>v(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tR.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eI.Input,{id:"webhook-timeout",type:"number",min:1,max:300,value:g.http_config.timeout_seconds,onChange:e=>v(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"webhook-secret",children:["Secret ",(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eI.Input,{id:"webhook-secret",type:f?"text":"password",placeholder:"Signing secret",value:g.secret,onChange:e=>v(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>p(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:f?(0,ep.jsx)(Uh,{className:"w-4 h-4"}):(0,ep.jsx)(Ud,{className:"w-4 h-4"})})]})]}),(0,ep.jsx)(Uv,{label:"Custom Headers",pairs:g.http_config.headers,onChange:e=>v(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(Uv,{label:"Query Parameters",pairs:g.http_config.params,onChange:e=>v(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e8,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:Uf.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pd.Checkbox,{id:`event-${e}`,checked:g.event_types.includes(e),onCheckedChange:()=>{v(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}}),(0,ep.jsx)(e8,{htmlFor:`event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tI.Switch,{id:"webhook-enabled",checked:g.enabled,onCheckedChange:e=>v(t=>({...t,enabled:e}))}),(0,ep.jsx)(e8,{htmlFor:"webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>o(!1),disabled:s,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:H,disabled:s||!g.url,children:s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):"Create Webhook"})]})]})}),(0,ep.jsx)(tH.Dialog,{open:x,onOpenChange:e=>{e||(w(null),N(Up),E(!1),_(!1)),y(e)},children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Edit Webhook"}),(0,ep.jsx)(tH.DialogDescription,{children:"Update the webhook configuration."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"edit-webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eI.Input,{id:"edit-webhook-url",type:"url",placeholder:"https://example.com/webhook",value:j.url,onChange:e=>N(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Method"}),(0,ep.jsxs)(tR.Select,{value:j.http_config.method,onValueChange:e=>N(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tR.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"edit-webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eI.Input,{id:"edit-webhook-timeout",type:"number",min:1,max:300,value:j.http_config.timeout_seconds,onChange:e=>N(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"edit-webhook-secret",children:"Secret"}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eI.Input,{id:"edit-webhook-secret",type:k?"text":"password",placeholder:"Leave blank to keep existing",value:j.secret,disabled:C,onChange:e=>N(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>E(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:k?(0,ep.jsx)(Uh,{className:"w-4 h-4"}):(0,ep.jsx)(Ud,{className:"w-4 h-4"})})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ep.jsx)(pd.Checkbox,{id:"edit-clear-secret",checked:C,onCheckedChange:e=>{_(!!e),e&&N(e=>({...e,secret:""}))}}),(0,ep.jsx)(e8,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:"Clear existing secret"})]})]}),(0,ep.jsx)(Uv,{label:"Custom Headers",pairs:j.http_config.headers,onChange:e=>N(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(Uv,{label:"Query Parameters",pairs:j.http_config.params,onChange:e=>N(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e8,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:Uf.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pd.Checkbox,{id:`edit-event-${e}`,checked:j.event_types.includes(e),onCheckedChange:()=>N(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}),(0,ep.jsx)(e8,{htmlFor:`edit-event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tI.Switch,{id:"edit-webhook-enabled",checked:j.enabled,onCheckedChange:e=>N(t=>({...t,enabled:e}))}),(0,ep.jsx)(e8,{htmlFor:"edit-webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>y(!1),disabled:S,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:Y,disabled:S||!j.url,children:S?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),(0,ep.jsx)(tH.Dialog,{open:!!d,onOpenChange:e=>{e||h(null)},children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-md",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Delete Webhook"}),(0,ep.jsx)(tH.DialogDescription,{children:"Are you sure you want to delete this webhook? This action cannot be undone and all pending deliveries will be cancelled."})]}),d&&(0,ep.jsx)("div",{className:"py-2",children:(0,ep.jsx)("p",{className:"font-mono text-sm truncate text-muted-foreground bg-muted px-3 py-2 rounded-md border border-border",children:d.url})}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,ep.jsx)(eL.Button,{variant:"destructive",onClick:()=>d&&W(d.id),disabled:!!c,children:c?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete Webhook"})]})]})}),(0,ep.jsx)(tH.Dialog,{open:A,onOpenChange:e=>{e||(L([]),z(null)),O(e)},children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Webhook Deliveries"}),M&&(0,ep.jsx)(tH.DialogDescription,{className:"font-mono text-xs truncate",children:M.url})]}),I?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tV.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):D.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-8 pl-3 pr-0"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{children:"HTTP"}),(0,ep.jsx)(eJ,{className:"text-center",children:"Attempts"}),(0,ep.jsx)(eJ,{children:"Event"}),(0,ep.jsx)(eJ,{children:"Created At"})]})}),(0,ep.jsx)(eZ,{children:D.map(e=>(0,ep.jsx)(Ux,{delivery:e,formatDate:$},e.id))})]})}),B&&(0,ep.jsx)("div",{className:"flex justify-center pt-2",children:(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:X,disabled:F,children:[F&&(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Load more"]})})]}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No deliveries yet for this webhook."})]})})]}):null}var Ub=["axis"],Uw=(0,em.forwardRef)((e,t)=>em.createElement(Rp,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Ub,tooltipPayloadSearcher:Ee,categoricalChartProps:e,ref:t})),Uj=em,UN=["children"],Uk=(0,em.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function UE(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,UN);return em.createElement(Uk.Provider,{value:n},t)}var UC=(e,t,n,r)=>PY(e,"xAxis",t,r),U_=(e,t,n,r)=>PW(e,"xAxis",t,r),US=(e,t,n,r)=>PY(e,"yAxis",n,r),UT=(e,t,n,r)=>PW(e,"yAxis",n,r),UA=N0([_b,UC,US,U_,UT],(e,t,n,r,i)=>Cz(e,"xAxis")?CG(t,r,!1):CG(n,i,!1));function UO(e){return"line"===e.type}var UM=N0([Mj,(e,t,n,r,i)=>i],(e,t)=>e.filter(UO).find(e=>e.id===t)),UP=N0([_b,UC,US,U_,UT,UM,UA,Og],(e,t,n,r,i,a,o,s)=>{var l,{chartData:c,dataStartIndex:u,dataEndIndex:d}=s;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:h,data:f}=a;if(null!=(l=null!=f&&f.length>0?f:null==c?void 0:c.slice(u,d+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:l}=e;return l.map((e,l)=>{var c=CB(e,o);if("horizontal"===t)return{x:CH({axis:n,ticks:i,bandSize:s,entry:e,index:l}),y:null==c?null:r.scale(c),value:c,payload:e};var u=null==c?null:n.scale(c),d=CH({axis:r,ticks:a,bandSize:s,entry:e,index:l});return null==u||null==d?null:{x:u,y:d,value:c,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:h,bandSize:o,displayedData:l})}}),UD=e.i(7328);function UL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function UI(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?UL(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UR(){return(UR=Object.assign.bind()).apply(null,arguments)}function UB(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Uz=(e,t,n,r,i)=>{var a=n-r;return kq(ec||(ec=UB(["M ",",",""])),e,t)+kq(eu||(eu=UB(["L ",",",""])),e+n,t)+kq(ed||(ed=UB(["L ",",",""])),e+n-a/2,t+i)+kq(eh||(eh=UB(["L ",",",""])),e+n-a/2-r,t+i)+kq(ef||(ef=UB(["L ",","," Z"])),e,t)},UF={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},UV=e=>{var t=Rd(e,UF),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,em.useRef)(null),[f,p]=(0,em.useState)(-1),g=(0,em.useRef)(i),v=(0,em.useRef)(a),x=(0,em.useRef)(o),y=(0,em.useRef)(n),b=(0,em.useRef)(r),w=zv(e,"trapezoid-");if((0,em.useEffect)(()=>{if(h.current&&h.current.getTotalLength)try{var e=h.current.getTotalLength();e&&p(e)}catch(e){}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||0===i&&0===a||0===o)return null;var j=(0,_e.clsx)("recharts-trapezoid",s);if(!d)return em.createElement("g",null,em.createElement("path",UR({},II(t),{className:j,d:Uz(n,r,i,a,o)})));var N=g.current,k=v.current,E=x.current,C=y.current,_=b.current,S="0px ".concat(-1===f?1:f,"px"),T="".concat(f,"px 0px"),A=zk(["strokeDasharray"],c,l);return em.createElement(zU,{animationId:w,key:w,canBegin:f>0,duration:c,easing:l,isActive:d,begin:u},e=>{var s=k4(N,i,e),l=k4(k,a,e),c=k4(E,o,e),u=k4(C,n,e),d=k4(_,r,e);h.current&&(g.current=s,v.current=l,x.current=c,y.current=u,b.current=d);var f=e>0?{transition:A,strokeDasharray:T}:{strokeDasharray:S};return em.createElement("path",UR({},II(t),{className:j,d:Uz(u,d,s,l,c),ref:h,style:UI(UI({},f),t.style)}))})};let UU=Math.cos,UH=Math.sin,UW=Math.sqrt,UY=Math.PI,UG=2*UY;UW(3);let UX={draw(e,t){let n=UW(t/UY);e.moveTo(n,0),e.arc(0,0,n,0,UG)}},U$=UW(1/3),Uq=2*U$,UK=UH(UY/10)/UH(7*UY/10),UZ=UH(UG/10)*UK,UQ=-UU(UG/10)*UK,UJ=UW(3);UW(3);let U0=UW(3)/2,U1=1/UW(12),U2=(U1/2+1)*3;var U5=["type","size","sizeType"];function U3(){return(U3=Object.assign.bind()).apply(null,arguments)}function U4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U6(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?U4(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var U8={symbolCircle:UX,symbolCross:{draw(e,t){let n=UW(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},symbolDiamond:{draw(e,t){let n=UW(t/Uq),r=n*U$;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},symbolSquare:{draw(e,t){let n=UW(t),r=-n/2;e.rect(r,r,n,n)}},symbolStar:{draw(e,t){let n=UW(.8908130915292852*t),r=UZ*n,i=UQ*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=UG*t/5,o=UU(a),s=UH(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},symbolTriangle:{draw(e,t){let n=-UW(t/(3*UJ));e.moveTo(0,2*n),e.lineTo(-UJ*n,-n),e.lineTo(UJ*n,-n),e.closePath()}},symbolWye:{draw(e,t){let n=UW(t/U2),r=n/2,i=n*U1,a=n*U1+n,o=-r;e.moveTo(r,i),e.lineTo(r,a),e.lineTo(o,a),e.lineTo(-.5*r-U0*i,U0*r+-.5*i),e.lineTo(-.5*r-U0*a,U0*r+-.5*a),e.lineTo(-.5*o-U0*a,U0*o+-.5*a),e.lineTo(-.5*r+U0*i,-.5*i-U0*r),e.lineTo(-.5*r+U0*a,-.5*a-U0*r),e.lineTo(-.5*o+U0*a,-.5*a-U0*o),e.closePath()}}},U7=Math.PI/180,U9=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=U6(U6({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,U5)),{},{type:t,size:n,sizeType:r}),a="circle";"string"==typeof t&&(a=t);var{className:o,cx:s,cy:l}=i,c=II(i);return kJ(s)&&kJ(l)&&kJ(n)?em.createElement("path",U3({},c,{className:(0,_e.clsx)("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(l,")"),d:(()=>{var e,t=(e=a,U8["symbol".concat(k8(e))]||UX),i=(function(e,t){let n=null,r=RE(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:CS(e||UX),t="function"==typeof t?t:CS(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:CS(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i})().type(t).size(((e,t,n)=>{if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*U7;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.tan(r)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(n,r,a))();if(null!==i)return i})()})):null};U9.registerSymbol=(e,t)=>{U8["symbol".concat(k8(e))]=t};var He=["option","shapeType","activeClassName"];function Ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ht(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hr(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return em.createElement(Vt,n);case"trapezoid":return em.createElement(UV,n);case"sector":return em.createElement(Vl,n);case"symbols":if("symbols"===t)return em.createElement(U9,n);break;case"curve":return em.createElement(R2,n);default:return null}}function Hi(e){var t,{option:n,shapeType:r,activeClassName:i="recharts-active-shape"}=e,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,He);if((0,em.isValidElement)(n))t=(0,em.cloneElement)(n,Hn(Hn({},a),(0,em.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(a,a.index);else if((0,UD.default)(n)&&"boolean"!=typeof n){var o=Hn(Hn({},a),n);t=em.createElement(Hr,{shapeType:r,elementProps:o})}else t=em.createElement(Hr,{shapeType:r,elementProps:a});return a.isActive?em.createElement(R4,{className:i},t):t}var Ha=["id"],Ho=["type","layout","connectNulls","needClip","shape"],Hs=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hl(){return(Hl=Object.assign.bind()).apply(null,arguments)}function Hc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hc(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hd(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Hh=Uj.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:C$(o,t),hide:s,type:c,color:r,unit:l,graphicalItemId:u}};return Uj.createElement(zn,{tooltipEntrySettings:d})}),Hf=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function Hp(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,l=ID(Hd(r,Ha));return Uj.createElement(B8,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:l,needClip:o,clipPathId:t})}function Hm(e){var{showLabels:t,children:n,points:r}=e,i=(0,Uj.useMemo)(()=>null==r?void 0:r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Hu(Hu({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return Uj.createElement(Bq,{value:t?i:void 0},n)}function Hg(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:l,needClip:c,shape:u}=a,d=Hu(Hu({},II(Hd(a,Ho))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:s,connectNulls:l,strokeDasharray:null!=i?i:a.strokeDasharray});return Uj.createElement(Uj.Fragment,null,(null==r?void 0:r.length)>1&&Uj.createElement(Hi,Hl({shapeType:"curve",option:u},d,{pathRef:n})),Uj.createElement(Hp,{points:r,clipPathId:t,props:a}))}function Hv(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:h,width:f,height:p,onAnimationEnd:g,onAnimationStart:v}=n,x=i.current,y=zv(o,"recharts-line-"),b=(0,Uj.useRef)(y),[w,j]=(0,Uj.useState)(!1),N=(0,Uj.useCallback)(()=>{"function"==typeof g&&g(),j(!1)},[g]),k=(0,Uj.useCallback)(()=>{"function"==typeof v&&v(),j(!0)},[v]),E=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}(r.current),C=(0,Uj.useRef)(0);b.current!==y&&(C.current=a.current,b.current=y);var _=C.current;return Uj.createElement(Hm,{points:o,showLabels:!w},n.children,Uj.createElement(zU,{animationId:y,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:k,key:y},e=>{var c,u=Math.min(k4(_,E+_,e),E);if(c=l?s?((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return Hf(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,s=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>a){s=[...n.slice(0,l),a-c];break}var u=s.length%2==0?[0,o]:[o];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;i<t;++i)r=[...r,...n];return r}(n,i),...s,...u].map(e=>"".concat(e,"px")).join(", ")})(u,E,"".concat(s).split(/[,\s]+/gim).map(e=>parseFloat(e))):Hf(E,u):null==s?void 0:String(s),e>0&&E>0&&(i.current=o,a.current=Math.max(a.current,u)),x){var d=x.length/o.length,g=1===e?o:o.map((t,n)=>{var r=Math.floor(n*d);if(x[r]){var i=x[r];return Hu(Hu({},t),{},{x:k4(i.x,t.x,e),y:k4(i.y,t.y,e)})}return h?Hu(Hu({},t),{},{x:k4(2*f,t.x,e),y:k4(p/2,t.y,e)}):Hu(Hu({},t),{},{x:t.x,y:t.y})});return i.current=g,Uj.createElement(Hg,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:c})}return Uj.createElement(Hg,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),Uj.createElement(BQ,{label:n.label}))}function Hx(e){var{clipPathId:t,props:n}=e,r=(0,Uj.useRef)(null),i=(0,Uj.useRef)(0),a=(0,Uj.useRef)(null);return Uj.createElement(Hv,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var Hy=(e,t)=>{var n,r;return{x:null!=(n=e.x)?n:void 0,y:null!=(r=e.y)?r:void 0,value:e.value,errorVal:CB(e.payload,t)}};class Hb extends Uj.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:l,height:c,id:u,needClip:d,zIndex:h}=this.props;if(e)return null;var f=(0,_e.clsx)("recharts-line",r),{r:p,strokeWidth:g}=zH(t),v=B1(t),x=2*p+g,y=d?"url(#clipPath-".concat(v?"":"dots-").concat(u,")"):void 0;return Uj.createElement(B_,{zIndex:h},Uj.createElement(R4,{className:f},d&&Uj.createElement("defs",null,Uj.createElement(zi,{clipPathId:u,xAxisId:i,yAxisId:a}),!v&&Uj.createElement("clipPath",{id:"clipPath-dots-".concat(u)},Uj.createElement("rect",{x:s-x/2,y:o-x/2,width:l+x,height:c+x}))),Uj.createElement(UE,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:Hy,errorBarOffset:0},Uj.createElement(Hx,{props:this.props,clipPathId:u}))),Uj.createElement(zt,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}}var Hw={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:OY.line,type:"linear"};function Hj(e){var t=Rd(e,Hw),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,hide:c,isAnimationActive:u,label:d,legendType:h,xAxisId:f,yAxisId:p,id:g}=t,v=Hd(t,Hs),{needClip:x}=zr(f,p),y=Ck(Ra),b=Ck(_b),w=C8(),j=Ck(e=>UP(e,f,p,w,g));if("horizontal"!==b&&"vertical"!==b||null==j||null==y)return null;var{height:N,width:k,x:E,y:C}=y;return Uj.createElement(Hb,Hl({},v,{id:g,connectNulls:s,dot:l,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:c,label:d,legendType:h,xAxisId:f,yAxisId:p,points:j,layout:b,height:N,width:k,left:E,top:C,needClip:x}))}var HN=Uj.memo(function(e){var t=Rd(e,Hw),n=C8();return Uj.createElement(zb,{id:t.id,type:"line"},e=>Uj.createElement(Uj.Fragment,null,Uj.createElement(zg,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:C$(n,t),payload:e}]})(t)}),Uj.createElement(Hh,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Uj.createElement(zw,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),Uj.createElement(Hj,Hl({},t,{id:e}))))},IE);HN.displayName="Line";let Hk=[{value:"all",label:"All actions"},{value:"retain",label:"Retain"},{value:"recall",label:"Recall"},{value:"reflect",label:"Reflect"},{value:"create_bank",label:"Create Bank"},{value:"update_bank",label:"Update Bank"},{value:"delete_bank",label:"Delete Bank"},{value:"clear_memories",label:"Clear Memories"},{value:"consolidation",label:"Consolidation"},{value:"batch_retain",label:"Batch Retain"},{value:"create_mental_model",label:"Create Mental Model"},{value:"refresh_mental_model",label:"Refresh Mental Model"},{value:"delete_mental_model",label:"Delete Mental Model"},{value:"create_directive",label:"Create Directive"},{value:"delete_directive",label:"Delete Directive"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}],HE=[{value:"all",label:"All transports"},{value:"http",label:"HTTP"},{value:"mcp",label:"MCP"},{value:"system",label:"System"}],HC=[{value:"1d",label:"Today"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function H_(e,t){if(!e||!t)return"—";let n=new Date(e).getTime(),r=new Date(t).getTime()-n;return r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${(r/6e4).toFixed(1)}m`}function HS(e){return e?new Date(e).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function HT({transport:e}){let t={http:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",mcp:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",system:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300"};return(0,ep.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${t[e]||t.system}`,children:e})}function HA({bankId:e}){let[t,n]=(0,em.useState)("7d"),[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)("day"),[c,u]=(0,em.useState)(!1),d=(0,em.useCallback)(async(n=t,i=r)=>{u(!0);try{let t=await eD.client.getAuditLogStats(e,{period:n,action:i||void 0});o(t.buckets||[]),l(t.trunc||"day")}catch(e){console.error("Error loading audit stats:",e)}finally{u(!1)}},[e,t,r]);(0,em.useEffect)(()=>{d()},[e]);let h=a.map(e=>{var t;let n;return{time:(t=e.time,n=new Date(t),"hour"===s?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"short",day:"numeric"})),total:e.total}});return(0,ep.jsxs)(pv,{children:[(0,ep.jsxs)(px,{className:"pb-2 flex flex-row items-center justify-between space-y-0 gap-3",children:[(0,ep.jsx)(py,{className:"text-sm font-semibold",children:"Request Volume"}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(tR.Select,{value:r||"all",onValueChange:e=>{let n="all"===e?null:e;i(n),d(t,n)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:Hk.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),HC.map(e=>(0,ep.jsx)(eL.Button,{variant:t===e.value?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{n(e.value),d(e.value,r)},children:e.label},e.value))]})]}),(0,ep.jsx)(pw,{children:(0,ep.jsx)("div",{className:"h-[120px]",children:c?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading..."}):0===h.length?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No data for this period"}):(0,ep.jsx)(_m,{width:"100%",height:"100%",children:(0,ep.jsxs)(Uw,{data:h,margin:{top:5,right:5,bottom:0,left:5},children:[(0,ep.jsx)(FT,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,ep.jsx)(Vj,{contentStyle:{backgroundColor:"var(--popover)",border:"1px solid var(--border)",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,ep.jsx)(HN,{type:"monotone",dataKey:"total",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})})]})}function HO(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(0),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)("all"),[d]=(0,em.useState)(20),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)(!1),[v,x]=(0,em.useState)(null),[y,b]=(0,em.useState)(!1),w=(0,em.useCallback)(e=>{if("all"===e)return{};let t=new Date,n=new Date;return"1h"===e?n.setHours(t.getHours()-1):"1d"===e?n.setDate(t.getDate()-1):"7d"===e?n.setDate(t.getDate()-7):"30d"===e&&n.setDate(t.getDate()-30),{start_date:n.toISOString()}},[]),j=(0,em.useCallback)(async(t=a,r=s,o=c,l=h)=>{if(e){g(!0);try{let a=w(o),s=await eD.client.listAuditLogs(e,{action:t||void 0,transport:r||void 0,start_date:a.start_date,end_date:a.end_date,limit:d,offset:l});n(s.items||[]),i(s.total||0)}catch(e){console.error("Error loading audit logs:",e)}finally{g(!1)}}},[e,a,s,c,h,d,w]),N=e=>{f(e),j(a,s,c,e)};(0,em.useEffect)(()=>{e&&j(a,s,c,h)},[e]);let k=Math.ceil(r/d),E=Math.floor(h/d)+1;return e?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(HA,{bankId:e}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ep.jsxs)(tR.Select,{value:a||"all",onValueChange:e=>{let t="all"===e?null:e;o(t),f(0),j(t,s,c,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[180px]",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All actions"})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:Hk.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tR.Select,{value:s||"all",onValueChange:e=>{let t="all"===e?null:e;l(t),f(0),j(a,t,c,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[160px]",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All transports"})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HE.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tR.Select,{value:c,onValueChange:e=>{u(e),f(0),j(a,s,e,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[150px]",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{position:"popper",children:[(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All time"}),(0,ep.jsx)(tR.SelectItem,{value:"1h",children:"Last hour"}),(0,ep.jsx)(tR.SelectItem,{value:"1d",children:"Last 24 hours"}),(0,ep.jsx)(tR.SelectItem,{value:"7d",children:"Last 7 days"}),(0,ep.jsx)(tR.SelectItem,{value:"30d",children:"Last 30 days"})]})]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>j(a,s,c,h),disabled:p,children:[(0,ep.jsx)(eU,{className:`w-4 h-4 mr-1 ${p?"animate-spin":""}`}),"Refresh"]}),(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground ml-auto",children:[r," ",1===r?"entry":"entries"]})]}),(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[200px]",children:"Time"}),(0,ep.jsx)(eJ,{children:"Action"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Transport"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Duration"})]})}),(0,ep.jsx)(eZ,{children:0===t.length?(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:4,className:"text-center text-muted-foreground py-8",children:p?"Loading...":"No audit logs found"})}):t.map(e=>(0,ep.jsxs)(eQ,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{x(e),b(!0)},children:[(0,ep.jsx)(e0,{className:"text-sm font-mono",children:HS(e.started_at)}),(0,ep.jsx)(e0,{className:"font-medium",children:e.action}),(0,ep.jsx)(e0,{children:(0,ep.jsx)(HT,{transport:e.transport})}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground font-mono",children:H_(e.started_at,e.ended_at)})]},e.id))})]}),k>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Page ",E," of ",k]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>N(Math.max(0,h-d)),disabled:0===h,children:[(0,ep.jsx)(eS,{className:"w-4 h-4 mr-1"}),"Previous"]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>N(h+d),disabled:h+d>=r,children:["Next",(0,ep.jsx)(eT.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,ep.jsx)(tH.Dialog,{open:y,onOpenChange:b,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsx)(tH.DialogHeader,{children:(0,ep.jsxs)(tH.DialogTitle,{children:["Audit Log: ",v?.action]})}),v&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Action:"})," ",(0,ep.jsx)("span",{className:"font-medium",children:v.action})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Transport:"})," ",(0,ep.jsx)(HT,{transport:v.transport})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Started:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:HS(v.started_at)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:H_(v.started_at,v.ended_at)})]})]}),v.request&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Request"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.request,null,2)})]}),v.response&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Response"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.response,null,2)})]}),v.metadata&&Object.keys(v.metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:JSON.stringify(v.metadata,null,2)})]})]})]})})]}):null}let HM=(0,eN.default)("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"}]]);var tV=tV;e.s(["default",0,function(){(0,eg.useParams)();let e=(0,eg.useRouter)(),t=(0,eg.useSearchParams)(),{features:n}=(0,ew.useFeatures)(),{currentBank:r,setCurrentBank:i,loadBanks:a}=(0,ey.useBank)(),o=t.get("view")||"profile",s=t.get("subTab")||"world",l=t.get("bankConfigTab")||"general",c=n?.observations??!1,u=n?.bank_config_api??!1,[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),S=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=data&subTab=${t}`))},T=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=profile&bankConfigTab=${t}`))},A=async()=>{if(r){p(!0);try{await eD.client.deleteBank(r),h(!1),i(null),await a(),e.push("/")}catch(e){}finally{p(!1)}}},O=async()=>{if(r){y(!0);try{let e=await eD.client.clearObservations(r);v(!1),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{y(!1)}}},M=async()=>{if(r){_(!0);try{await eD.client.resetBankConfig(r),E(!1)}catch{}finally{_(!1)}}},P=async()=>{if(r){w(!0);try{await eD.client.triggerConsolidation(r)}catch(e){}finally{w(!1)}}},D=async()=>{if(r){N(!0);try{let e=await eD.client.recoverConsolidation(r);ev.toast.success(`Recovered ${e.retried_count} failed ${1===e.retried_count?"memory":"memories"} for re-consolidation`)}catch(e){}finally{N(!1)}}};return(0,ep.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,ep.jsx)(ex.BankSelector,{}),(0,ep.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,ep.jsx)(eP,{currentTab:o,onTabChange:t=>{r&&e.push((0,eb.bankRoute)(r,`?view=${t}`))}}),(0,ep.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:["profile"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Bank Configuration"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Manage bank settings, profile, and operations."})]}),(0,ep.jsxs)(gN,{children:[(0,ep.jsx)(gE,{asChild:!0,children:(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",children:["Actions",(0,ep.jsx)(gU,{className:"w-4 h-4 ml-2"})]})}),(0,ep.jsxs)(gB,{align:"end",className:"w-48",children:[(0,ep.jsxs)(gz,{onClick:async()=>{if(r)try{let e=await eD.client.exportBankTemplate(r),t=JSON.stringify(e,null,2);await navigator.clipboard.writeText(t),ev.toast.success("Template copied to clipboard")}catch{ev.toast.error("Failed to export template")}},children:[(0,ep.jsx)(HM,{className:"w-4 h-4 mr-2"}),"Export Template"]}),(0,ep.jsx)(gF,{}),(0,ep.jsxs)(gz,{onClick:P,disabled:b||!c,title:c?void 0:"Observations feature is not enabled",children:[b?(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(pN,{className:"w-4 h-4 mr-2"}),b?"Consolidating...":"Run Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(gz,{onClick:D,disabled:j||!c,title:c?void 0:"Observations feature is not enabled",children:[j?(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(Un,{className:"w-4 h-4 mr-2"}),j?"Recovering...":"Recover Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(gz,{onClick:()=>v(!0),disabled:!c,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:c?void 0:"Observations feature is not enabled",children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Clear Observations",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(gF,{}),(0,ep.jsxs)(gz,{onClick:()=>E(!0),disabled:!u,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:u?void 0:"Bank Config API is disabled",children:[(0,ep.jsx)(Un,{className:"w-4 h-4 mr-2"}),"Reset Configuration",!u&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(gF,{}),(0,ep.jsxs)(gz,{onClick:()=>h(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})]})]})]}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>T("general"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"general"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["General","general"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),u&&(0,ep.jsxs)("button",{onClick:()=>T("configuration"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"configuration"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Configuration","configuration"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("webhooks"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"webhooks"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Webhooks","webhooks"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("audit-logs"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"audit-logs"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Audit Logs","audit-logs"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["general"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Overview statistics and background operations for this memory bank."}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(Ut,{}),(0,ep.jsx)(Ua,{}),(0,ep.jsx)(jt,{hideReflectFields:!0})]})]}),"configuration"===l&&u&&(0,ep.jsx)("div",{className:"space-y-6",children:(0,ep.jsx)(jj,{})}),"webhooks"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Manage webhook endpoints to receive event notifications from this memory bank."}),(0,ep.jsx)(Uy,{})]}),"audit-logs"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"View audit trail of all operations performed on this memory bank."}),(0,ep.jsx)(HO,{})]})]})]}),"recall"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Analyze memory recall with detailed trace information and retrieval methods."}),(0,ep.jsx)(w8,{})]}),"reflect"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Run an agentic loop that autonomously gathers evidence and reasons through the lens of the bank's disposition to generate contextual responses."}),(0,ep.jsx)(w3,{})]}),"data"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Memories"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"View and explore different types of memories stored in this memory bank."}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>S("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["World Facts","world"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Experience","experience"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("observations"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"observations"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Observations",!c&&(0,ep.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"observations"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("mental-models"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"mental-models"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Mental Models","mental-models"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["world"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Objective facts about the world received from external sources."}),(0,ep.jsx)(fR,{factType:"world"},"world")]}),"experience"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"The bank's own actions, interactions, and first-person experiences."}),(0,ep.jsx)(fR,{factType:"experience"},"experience")]}),"observations"===s&&(c?(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Consolidated knowledge synthesized from facts — patterns, preferences, and learnings that emerge from accumulated evidence."}),(0,ep.jsx)(fR,{factType:"observation"},"observations")]}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-2",children:(0,ep.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ep.jsx)("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),(0,ep.jsx)("path",{d:"M12 8v4"}),(0,ep.jsx)("path",{d:"M12 16h.01"})]})}),(0,ep.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:"Observations Not Enabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-md",children:["Observations consolidation is disabled on this server. Set"," ",(0,ep.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_ENABLE_OBSERVATIONS=true"})," ","to enable."]})]})),"mental-models"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"User-curated summaries generated from queries — reusable knowledge snapshots that can be refreshed as memories evolve."}),(0,ep.jsx)(Us,{},"mental-models")]})]})]}),"documents"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Documents"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Manage documents and retain new memories."}),(0,ep.jsx)(pc,{})]}),"entities"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Entities"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Explore entities (people, organizations, places) mentioned in memories."}),(0,ep.jsx)(pu,{})]})]})})]}),(0,ep.jsx)(fY,{open:d,onOpenChange:h,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Memory Bank"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:f,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:A,disabled:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:f?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(fY,{open:k,onOpenChange:E,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Reset Configuration"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to reset all configuration overrides for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"All per-bank settings (retain, observations, reflect) will revert to server defaults. This does not affect memories, entities, or the bank profile."})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:C,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:M,disabled:C,children:C?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Resetting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(Un,{className:"w-4 h-4 mr-2"}),"Reset Configuration"]})})]})]})}),(0,ep.jsx)(fY,{open:g,onOpenChange:v,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Clear Observations"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:x,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:O,disabled:x,className:"bg-amber-500 text-white hover:bg-amber-600",children:x?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})})]})}],37578)}]);
7
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return em.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null};let f8=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(fX,{className:(0,eO.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));f8.displayName=fX.displayName;let f7=em.forwardRef(({className:e,...t},n)=>(0,ep.jsxs)(fG,{children:[(0,ep.jsx)(f8,{}),(0,ep.jsx)(fQ,{ref:n,className:(0,eO.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));f7.displayName=fQ.displayName;let f9=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eO.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...t});f9.displayName="AlertDialogHeader";let pe=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eO.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});pe.displayName="AlertDialogFooter";let pt=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f0,{ref:n,className:(0,eO.cn)("text-lg font-semibold",e),...t}));pt.displayName=f0.displayName;let pn=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f2,{ref:n,className:(0,eO.cn)("text-sm text-muted-foreground",e),...t}));pn.displayName=f2.displayName;let pr=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f5,{ref:n,className:(0,eO.cn)((0,eL.buttonVariants)(),e),...t}));pr.displayName=f5.displayName;let pi=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f4,{ref:n,className:(0,eO.cn)((0,eL.buttonVariants)({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));pi.displayName=f4.displayName;let pa=(0,eN.default)("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"}]]),po=(0,eN.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);function ps(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);if(i<30)return`${i}d ago`;let a=Math.floor(i/30);return a<12?`${a}mo ago`:`${Math.floor(a/12)}y ago`}function pl(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function pc({metadata:e}){let t=Object.entries(e);return 0===t.length?(0,ep.jsx)("span",{children:"-"}):(0,ep.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map(([e,t])=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",children:[e,"=",String(t)]},e)),t.length>3&&(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",t.length-3]})]})}function pu(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(""),[s,l]=(0,em.useState)(0),[c,u]=(0,em.useState)(1),d=Math.ceil(s/50),h=(c-1)*50,[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(""),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(""),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)(null),I=async(t=1)=>{if(e){i(!0);try{let r=await eD.client.listDocuments({bank_id:e,q:a,limit:50,offset:(t-1)*50});n(r.items||[]),l(r.total||0)}catch(e){}finally{i(!1)}}},R=e=>{u(e),I(e)},B=async t=>{if(e){v(!0),p({id:t}),w(!1),N(""),_(!1),T("");try{let n=await eD.client.getDocument(t,e);p(n)}catch(e){p(null)}finally{v(!1)}}},z=async()=>{if(!e||!M)return;let t=M.id;y(t),P(null);try{let n=await eD.client.deleteDocument(t,e);L({success:!0,message:`Deleted document and ${n.memory_units_deleted} memory units.`}),f?.id===t&&p(null),I(c)}catch(e){console.error("Error deleting document:",e),L({success:!1,message:"Error deleting document: "+e.message})}finally{y(null)}},F=()=>{w(!1),N("")},V=async()=>{if(!e||!f||!S.trim())return;let t=f.retain_params??{},n={content:S,document_id:f.id};t.context&&(n.context=t.context),t.event_date&&(n.timestamp=t.event_date),t.metadata&&Object.keys(t.metadata).length>0&&(n.metadata=t.metadata),f.tags&&f.tags.length>0&&(n.tags=f.tags),O(!0);try{await eD.client.retain({bank_id:e,items:[n],async:!1});let t=await eD.client.getDocument(f.id,e);p(t),_(!1),T(""),I(c)}catch(e){console.error("Error updating document content:",e)}finally{O(!1)}},U=async()=>{if(!e||!f)return;let t=j.split(",").map(e=>e.trim()).filter(e=>e.length>0);E(!0);try{await eD.client.updateDocument(f.id,e,t),p({...f,tags:t}),n(e=>e.map(e=>e.id===f.id?{...e,tags:t}:e)),w(!1),N("")}catch(e){console.error("Error updating document tags:",e)}finally{E(!1)}};return(0,em.useEffect)(()=>{e&&(u(1),I(1))},[e]),(0,em.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{u(1),I(1)},300);return()=>clearTimeout(t)},[a]),(0,ep.jsxs)("div",{children:[r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading documents..."})]})}):t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[s," ",1===s?"document":"documents"]}),(0,ep.jsxs)("div",{className:"w-full",children:[(0,ep.jsx)("div",{className:"px-5 mb-4",children:(0,ep.jsx)(eI.Input,{type:"text",value:a,onChange:e=>o(e.target.value),placeholder:"Search documents (ID)...",className:"max-w-2xl"})}),(0,ep.jsx)("div",{className:"overflow-x-auto px-5 pb-5",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"Document ID"}),(0,ep.jsx)(eJ,{children:"Created"}),(0,ep.jsx)(eJ,{children:"Updated"}),(0,ep.jsx)(eJ,{children:"Tags"}),(0,ep.jsx)(eJ,{children:"Metadata"}),(0,ep.jsx)(eJ,{children:"Size"}),(0,ep.jsx)(eJ,{children:"Memory Units"})]})}),(0,ep.jsx)(eZ,{children:t.length>0?t.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>B(e.id),children:[(0,ep.jsx)(e0,{className:"text-card-foreground font-mono text-xs break-all",children:e.id}),(0,ep.jsx)(e0,{className:"text-card-foreground",title:e.created_at?new Date(e.created_at).toLocaleString():"",children:e.created_at?ps(e.created_at):"N/A"}),(0,ep.jsx)(e0,{className:"text-card-foreground",title:e.updated_at?new Date(e.updated_at).toLocaleString():"",children:e.updated_at?ps(e.updated_at):"N/A"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.tags&&e.tags.length>0?(0,ep.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.tags.slice(0,3).map((e,t)=>(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t)),e.tags.length>3&&(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",e.tags.length-3]})]}):"-"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.document_metadata&&Object.keys(e.document_metadata).length>0?(0,ep.jsx)(pc,{metadata:e.document_metadata}):"-"}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:pl(e.text_length||0)}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.memory_unit_count})]},e.id)):(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:7,className:"text-center",children:'Click "Load Documents" to view data'})})})]})}),d>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t px-5",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[h+1,"-",Math.min(h+50,s)," of ",s]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>R(1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>R(c-1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",d]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>R(c+1),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>R(d),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No documents found"})]})}),t.length>0&&f&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[560px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,ep.jsxs)("div",{className:"p-5",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:"Document Details"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Original document text and metadata"})]}),(0,ep.jsxs)(eL.Button,{variant:"secondary",size:"sm",onClick:()=>p(null),className:"h-9 px-3 gap-2",children:[(0,ep.jsx)(e$.X,{className:"h-4 w-4"}),"Close"]})]}),g?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading document..."})]})}):(0,ep.jsxs)("div",{className:"space-y-5",children:[(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Document ID"}),(0,ep.jsx)("div",{className:"text-sm font-mono break-all text-card-foreground",children:f.id})]}),f.created_at&&(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:new Date(f.created_at).toLocaleString()})]}),f.updated_at&&(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Updated"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:new Date(f.updated_at).toLocaleString()})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Memory Units"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:f.memory_unit_count})]})]}),f.original_text&&(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Size"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:pl(new Blob([f.original_text]).size)})]}),f.retain_params&&(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg space-y-3",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase",children:"Retain Parameters"}),f.retain_params.context&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Context"}),(0,ep.jsx)("div",{className:"text-sm text-card-foreground",children:f.retain_params.context})]}),f.retain_params.event_date&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Event Date"}),(0,ep.jsx)("div",{className:"text-sm text-card-foreground",children:new Date(f.retain_params.event_date).toLocaleString()})]}),f.retain_params.metadata&&Object.keys(f.retain_params.metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Metadata"}),(0,ep.jsx)(pc,{metadata:f.retain_params.metadata})]})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase",children:"Tags"}),!b&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>{N((f?.tags??[]).join(", ")),w(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,ep.jsx)(po,{className:"h-3 w-3"}),"Edit"]})]}),b?(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(eI.Input,{value:j,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"text-sm h-8",onKeyDown:e=>{"Enter"===e.key&&U(),"Escape"===e.key&&F()},autoFocus:!0}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Comma-separated. Leave empty to remove all tags."}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eL.Button,{size:"sm",onClick:U,disabled:k,className:"h-7 px-3 gap-1 text-xs",children:[k?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(tF.Check,{className:"h-3 w-3"}),"Save"]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:F,disabled:k,className:"h-7 px-3 gap-1 text-xs",children:[(0,ep.jsx)(e$.X,{className:"h-3 w-3"}),"Cancel"]})]})]}):f.tags&&f.tags.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:f.tags.map((e,t)=>(0,ep.jsx)("span",{className:"text-sm px-3 py-1.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t))}):(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No tags"})]}),(0,ep.jsx)("div",{className:"pt-2 border-t border-border",children:(0,ep.jsxs)(eL.Button,{variant:"destructive",size:"sm",onClick:()=>{P({id:f.id,memoryCount:f.memory_unit_count})},className:"w-full gap-2",disabled:x===f.id,children:[x===f.id?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(pa,{className:"h-4 w-4"}),"Delete Document"]})}),void 0!==f.original_text&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase",children:"Original Text"}),!C&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>{T(f?.original_text??""),_(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,ep.jsx)(po,{className:"h-3 w-3"}),"Edit"]})]}),C?(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("textarea",{value:S,onChange:e=>T(e.target.value),className:"w-full min-h-[300px] max-h-[500px] p-4 bg-muted/50 rounded-lg border border-border text-sm font-mono leading-relaxed text-card-foreground resize-y",autoFocus:!0}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Saving will re-ingest this document via retain (upsert). Existing memory units for this document will be replaced."}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eL.Button,{size:"sm",onClick:V,disabled:A||!S.trim(),className:"h-7 px-3 gap-1 text-xs",children:[A?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(tF.Check,{className:"h-3 w-3"}),"Save"]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>{_(!1),T("")},disabled:A,className:"h-7 px-3 gap-1 text-xs",children:[(0,ep.jsx)(e$.X,{className:"h-3 w-3"}),"Cancel"]})]})]}):(0,ep.jsx)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border max-h-[400px] overflow-y-auto",children:(0,ep.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono leading-relaxed text-card-foreground",children:f.original_text})})]})]})]})}),(0,ep.jsx)(fY,{open:!!M,onOpenChange:e=>!e&&P(null),children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Document"}),(0,ep.jsxs)(pn,{children:["Are you sure you want to delete document"," ",(0,ep.jsxs)("span",{className:"font-mono font-semibold",children:['"',M?.id,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),"This will also delete"," ",M?.memoryCount!==void 0?(0,ep.jsxs)("span",{className:"font-semibold",children:[M.memoryCount," memory units"]}):"all memory units"," ","extracted from this document.",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{children:"Cancel"}),(0,ep.jsx)(pr,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),(0,ep.jsx)(fY,{open:!!D,onOpenChange:e=>!e&&L(null),children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:D?.success?"Document Deleted":"Error"}),(0,ep.jsx)(pn,{children:D?.message})]}),(0,ep.jsx)(pe,{children:(0,ep.jsx)(pr,{onClick:()=>L(null),children:"OK"})})]})})]})}function pd(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("relations"),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(1),[x,y]=(0,em.useState)(0),b=Math.ceil(x/50),w=(g-1)*50,j=async(t=1)=>{if(e){i(!0);try{let r=await eD.client.listEntities({bank_id:e,limit:50,offset:(t-1)*50});n(r.items||[]),y(r.total||0)}catch(e){}finally{i(!1)}}},N=async t=>{if(e){l(!0);try{let n=await eD.client.getEntity(t,e);o(n)}catch(e){}finally{l(!1)}}},k=e=>{v(e),j(e)},E=(0,em.useCallback)(async()=>{if(e){p(!0);try{let t=await eD.client.getEntityGraph({bank_id:e,limit:2e3,min_count:1});h(t)}catch(e){}finally{p(!1)}}},[e]);(0,em.useEffect)(()=>{e&&(v(1),j(1),o(null),h(null))},[e]),(0,em.useEffect)(()=>{"relations"!==c||!e||d||f||E()},[c,e,d,f,E]);let C=(0,em.useMemo)(()=>d?hG(d):{nodes:[],links:[]},[d]),_=(0,em.useMemo)(()=>{let e=new Map;for(let t of C.links){let n="number"==typeof t.weight&&t.weight>0?t.weight:1;e.set(t.source,(e.get(t.source)||0)+n),e.set(t.target,(e.get(t.target)||0)+n)}return e},[C]),S=(0,em.useMemo)(()=>{let e=1;for(let t of _.values())t>e&&(e=t);return e},[_]),T=(0,em.useCallback)(e=>3+11*Math.sqrt((_.get(e.id)||0)/S),[_,S]),A=(0,em.useMemo)(()=>{let e=d?.edges||[];if(!e.length)return null;let t=new Map,n=1/0,r=-1/0;for(let i of e){let e=i.data.lastCooccurred;if(!e)continue;let a=Date.parse(e);if(!Number.isNaN(a)){for(let e of[i.data.source,i.data.target]){let n=t.get(e);(void 0===n||a>n)&&t.set(e,a)}a<n&&(n=a),a>r&&(r=a)}}return Number.isFinite(n)&&Number.isFinite(r)&&r!==n?{times:t,minT:n,maxT:r}:null},[d]),O=(0,em.useCallback)(e=>{if(!A)return .5;let t=A.times.get(e.id);return void 0===t?0:(t-A.minT)/(A.maxT-A.minT)},[A]),M=(0,em.useCallback)(e=>{N(e.id)},[e]),P=e=>e?new Date(e).toLocaleDateString():"N/A";return(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"mb-4 flex items-center justify-end",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>u("relations"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"relations"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(fL,{className:"w-4 h-4"}),"Relations"]}),(0,ep.jsxs)("button",{onClick:()=>u("list"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"list"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eG,{className:"w-4 h-4"}),"List"]})]})}),"relations"===c&&(0,ep.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:f?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entity graph..."})]})}):C.nodes.length>0?(0,ep.jsx)(fD,{data:C,height:700,onNodeClick:M,nodeSizeFn:T,nodeHeatFn:A?O:void 0,heatLegendLabel:A?"recency · last co-occurrence":void 0,heatLegendEndpoints:A?[new Date(A.minT).toISOString().slice(0,10),new Date(A.maxT).toISOString().slice(0,10)]:void 0,sizeLegendLabel:"co-occurrences",compactLabels:!0}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entity co-occurrences yet"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Two entities co-occur when they appear in the same memory."})]})})}),"list"===c&&(0,ep.jsx)("div",{children:r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entities..."})]})}):t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[x," ",1===x?"entity":"entities"]}),(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"Name"}),(0,ep.jsx)(eJ,{children:"Mentions"}),(0,ep.jsx)(eJ,{children:"First Seen"}),(0,ep.jsx)(eJ,{children:"Last Seen"})]})}),(0,ep.jsx)(eZ,{children:t.map(e=>(0,ep.jsxs)(eQ,{onClick:()=>N(e.id),className:`cursor-pointer hover:bg-muted/50 ${a?.id===e.id?"bg-primary/10":""}`,children:[(0,ep.jsx)(e0,{className:"font-medium text-card-foreground",children:e.canonical_name}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:e.mention_count}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:P(e.first_seen)}),(0,ep.jsx)(e0,{className:"text-card-foreground",children:P(e.last_seen)})]},e.id))})]})}),b>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[w+1,"-",Math.min(w+50,x)," of ",x]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(1),disabled:1===g||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(g-1),disabled:1===g||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[g," / ",b]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(g+1),disabled:g===b||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>k(b),disabled:g===b||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entities found"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Entities are extracted from facts when memories are added."})]})})}),a&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,ep.jsxs)("div",{className:"p-5",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-card-foreground",children:a.canonical_name}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Entity details"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>o(null),className:"h-8 w-8 p-0",children:(0,ep.jsx)("span",{className:"text-lg",children:"x"})})]}),(0,ep.jsxs)("div",{className:"space-y-5",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentions"}),(0,ep.jsx)("div",{className:"text-lg font-semibold text-card-foreground",children:a.mention_count})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"First Seen"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:P(a.first_seen)})]})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Entity ID"}),(0,ep.jsx)("code",{className:"text-xs font-mono break-all text-muted-foreground",children:a.id})]})]})]})})]})}var ph=e.i(32089);let pf=["world","experience","observation"],pp={world:{label:"World",active:"bg-violet-500/15 text-violet-700 border-violet-400 dark:text-violet-300 dark:border-violet-500",inactive:"border-border text-muted-foreground hover:border-violet-300 hover:text-violet-600 dark:hover:text-violet-400",dot:"bg-violet-500"},experience:{label:"Experience",active:"bg-pink-500/15 text-pink-700 border-pink-400 dark:text-pink-300 dark:border-pink-500",inactive:"border-border text-muted-foreground hover:border-pink-300 hover:text-pink-600 dark:hover:text-pink-400",dot:"bg-pink-500"},observation:{label:"Observation",active:"bg-indigo-500/15 text-indigo-700 border-indigo-400 dark:text-indigo-300 dark:border-indigo-500",inactive:"border-border text-muted-foreground hover:border-indigo-300 hover:text-indigo-600 dark:hover:text-indigo-400",dot:"bg-indigo-500"}};function pm({ft:e,active:t,onToggle:n}){let r=pp[e];return(0,ep.jsxs)("button",{type:"button",onClick:n,className:(0,eO.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-all",t?r.active:r.inactive),children:[(0,ep.jsx)("span",{className:(0,eO.cn)("h-1.5 w-1.5 rounded-full",t?r.dot:"bg-muted-foreground/50")}),r.label]})}function pg({value:e,onChange:t,label:n="Fact types:"}){return(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:n}),(0,ep.jsx)("div",{className:"flex gap-1.5",children:pf.map(n=>(0,ep.jsx)(pm,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})]})}function pv({value:e,onChange:t}){return(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:pf.map(n=>(0,ep.jsx)(pm,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})}let px=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("rounded-xl bg-card text-card-foreground ring-1 ring-border/60 shadow-[0_1px_2px_rgba(0,0,0,0.04),0_2px_8px_-2px_rgba(0,0,0,0.06)] dark:ring-border/40 dark:shadow-[0_1px_2px_rgba(0,0,0,0.4),0_4px_16px_-4px_rgba(0,0,0,0.5)]",e),...t}));px.displayName="Card";let py=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("flex flex-col space-y-1.5 p-6",e),...t}));py.displayName="CardHeader";let pb=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-2xl font-semibold leading-none tracking-tight",e),...t}));pb.displayName="CardTitle";let pw=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-sm text-muted-foreground",e),...t}));pw.displayName="CardDescription";let pj=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("p-6 pt-0",e),...t}));pj.displayName="CardContent",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("flex items-center p-6 pt-0",e),...t})).displayName="CardFooter";var pN=e.i(52571);let pk=(0,eN.default)("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"}]]),pE=(0,eN.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),pC=(0,eN.default)("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"}]]),p_=(0,eN.default)("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"}]]);var pS=e.i(1864);"function"==typeof SuppressedError&&SuppressedError;var pT=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}},pA={"text/plain":"Text","text/html":"Url",default:"Text"},pO=function(e,t){var n,r,i,a,o,s,l,c,u=!1;t||(t={}),i=t.debug||!1;try{if(o=pT(),s=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=pA[t.format]||pA.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),l.addRange(s),!document.execCommand("copy"))throw Error("copy command was unsuccessful");u=!0}catch(o){i&&console.error("unable to copy using execCommand: ",o),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(o){i&&console.error("unable to copy using clipboardData: ",o),i&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",r=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",a=n.replace(/#{\s*key\s*}/g,r),window.prompt(a,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),c&&document.body.removeChild(c),o()}return u};function pM(e){return"[object Object]"===Object.prototype.toString.call(e)}function pP(e){return Array.isArray(e)?e.length:pM(e)?Object.keys(e).length:0}function pD(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=pP(e);if("function"==typeof r){let i=pR(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||pM(e)&&o>i)}function pL(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=Math.ceil(e.length/100);if("function"==typeof r){let i=pR(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||pM(e)&&o>i)}function pI(e,t,n){return"boolean"==typeof e?e:"number"==typeof e&&!!(t>e)||"collapsed"===e&&!!n||"expanded"===e&&!n}function pR(e,t){try{return e(...t)}catch(e){reportError(e)}}function pB(e){if(!0===e||pM(e)&&!0===e.add)return!0}function pz(e){if(!0===e||pM(e)&&!0===e.edit)return!0}function pF(e){if(!0===e||pM(e)&&!0===e.delete)return!0}function pV(e){return!e||void 0===e.add||!!e.add}function pU(e){return!e||void 0===e.edit||!!e.edit}function pH(e){return!e||void 0===e.delete||!!e.delete}function pW(e){return!e||void 0===e.enableClipboard||!!e.enableClipboard}function pY(){return(pY=Object.assign.bind()).apply(this,arguments)}var pG=function(e){return em.createElement("svg",pY({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),w||(w=em.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))};function pX(){return(pX=Object.assign.bind()).apply(this,arguments)}var p$=function(e){return em.createElement("svg",pX({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),j||(j=em.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))};function pq(){return(pq=Object.assign.bind()).apply(this,arguments)}var pK=function(e){return em.createElement("svg",pq({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),N||(N=em.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),k||(k=em.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function pZ({node:e,nodeMeta:t}){let{customizeCopy:n,CopyComponent:r,CopiedComponent:i}=(0,em.useContext)(ms),[a,o]=(0,em.useState)(!1),s=r=>{r.stopPropagation();let i=n(e,t);"string"==typeof i&&i&&function(e){var t,n,r,i;t=this,n=void 0,r=void 0,i=function*(){try{yield navigator.clipboard.writeText(e)}catch(t){pO(e)}},new(r||(r=Promise))(function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(o,s)}l((i=i.apply(t,n||[])).next())})}(i),o(!0),setTimeout(()=>o(!1),3e3)};return a?"function"==typeof i?(0,ep.jsx)(i,{className:"json-view--copy",style:{display:"inline-block"}}):(0,ep.jsx)(pK,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof r?(0,ep.jsx)(r,{onClick:s,className:"json-view--copy"}):(0,ep.jsx)(p$,{onClick:s,className:"json-view--copy"})}function pQ({indexOrName:e,value:t,depth:n,deleteHandle:r,editHandle:i,parent:a,parentPath:o}){let{displayArrayIndex:s}=(0,em.useContext)(ms),l=Array.isArray(a);return(0,ep.jsxs)("div",Object.assign({className:"json-view--pair"},{children:[!l||l&&s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",Object.assign({className:"number"==typeof e?"json-view--index":"json-view--property"},{children:e})),":"," "]}):(0,ep.jsx)(ep.Fragment,{}),(0,ep.jsx)(ma,{node:t,depth:n+1,deleteHandle:(e,t)=>r(e,t),editHandle:(e,t,n,r)=>i(e,t,n,r),parent:a,indexOrName:e,parentPath:o})]}))}function pJ(){return(pJ=Object.assign.bind()).apply(this,arguments)}var p0=function(e){return em.createElement("svg",pJ({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),E||(E=em.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),C||(C=em.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))};function p1(){return(p1=Object.assign.bind()).apply(this,arguments)}var p2=function(e){return em.createElement("svg",p1({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_||(_=em.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),S||(S=em.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))};function p5(){return(p5=Object.assign.bind()).apply(this,arguments)}var p3=function(e){return em.createElement("svg",p5({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),T||(T=em.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),A||(A=em.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))};function p4(){return(p4=Object.assign.bind()).apply(this,arguments)}var p6=function(e){return em.createElement("svg",p4({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),O||(O=em.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),M||(M=em.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function p8({originNode:e,node:t,depth:n,index:r,deleteHandle:i,customOptions:a,startIndex:o,parent:s,parentPath:l}){let{enableClipboard:c,src:u,onEdit:d,onChange:h,forceUpdate:f,displaySize:p,CustomOperation:g}=(0,em.useContext)(ms),v=[...l,String(r)],[x,y]=(0,em.useState)(!0),b=(0,em.useCallback)((t,r,i)=>{e[t]=r,d&&d({newValue:r,oldValue:i,depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),h&&h({type:"edit",depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),f()},[t,d,h,f]),w=t=>{e.splice(t,1),i&&i(t,l),f()},j=(0,ep.jsxs)(ep.Fragment,{children:[!x&&(0,ep.jsxs)("span",Object.assign({onClick:()=>y(!0),className:"jv-size-chevron"},{children:[pI(p,n,x)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[pP(t)," Items"]})),(0,ep.jsx)(pG,{className:"jv-chevron"})]})),!x&&c&&pW(a)&&(0,ep.jsx)(pZ,{node:t,nodeMeta:{depth:n,indexOrName:r,parent:s,parentPath:l,currentPath:v}}),"function"==typeof g?(0,ep.jsx)(g,{node:t}):null]});return(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{children:"["}),j,x?(0,ep.jsxs)("button",Object.assign({onClick:()=>y(!1),className:"jv-button"},{children:[o," ... ",o+t.length-1]})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:t.map((e,i)=>(0,ep.jsx)(pQ,{indexOrName:i+o,value:e,depth:n,parent:t,deleteHandle:w,editHandle:b,parentPath:l},String(r)+String(i)))})),(0,ep.jsx)("span",{children:"]"})]})}function p7({node:e,depth:t,deleteHandle:n,indexOrName:r,customOptions:i,parent:a,parentPath:o}){let s=void 0!==r?[...o,String(r)]:o,l=[];for(let t=0;t<e.length;t+=100)l.push(e.slice(t,t+100));let{collapsed:c,enableClipboard:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,CustomOperation:v,onChange:x,forceUpdate:y,displaySize:b}=(0,em.useContext)(ms),[w,j]=(0,em.useState)(pL(e,t,r,c,d,i));(0,em.useEffect)(()=>{j(pL(e,t,r,c,d,i))},[c,d]);let[N,k]=(0,em.useState)(!1),[E,C]=(0,em.useState)(!1),_=()=>{e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),y()},S=N||E,T=(0,ep.jsxs)(ep.Fragment,{children:[!w&&!S&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!0),className:"jv-size-chevron"},{children:[pI(b,t,w)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),(0,ep.jsx)(pG,{className:"jv-chevron"})]})),S&&(0,ep.jsx)(p3,{className:"json-view--edit",style:{display:"inline-block"},onClick:E?_:()=>{k(!1),n&&n(r,o),f&&f({value:e,depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o}),x&&x({type:"delete",depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o})}}),S&&(0,ep.jsx)(p6,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{k(!1),C(!1)}}),!w&&!S&&u&&pW(i)&&(0,ep.jsx)(pZ,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:a,parentPath:o,currentPath:s}}),!w&&!S&&pB(h)&&pV(i)&&(0,ep.jsx)(p2,{className:"json-view--edit",onClick:()=>{_()}}),!w&&!S&&pF(h)&&pH(i)&&n&&(0,ep.jsx)(p0,{className:"json-view--edit",onClick:()=>k(!0)}),"function"==typeof v?(0,ep.jsx)(v,{node:e}):null]});return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"["}),T,w?(0,ep.jsx)("button",Object.assign({onClick:()=>j(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:l.map((a,s)=>(0,ep.jsx)(p8,{originNode:e,node:a,depth:t,index:s,startIndex:100*s,deleteHandle:n,customOptions:i,parentPath:o},String(r)+String(s)))})),(0,ep.jsx)("span",{children:"]"}),w&&pI(b,t,w)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function p9({node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parent:a,parentPath:o}){let{collapsed:s,onCollapse:l,enableClipboard:c,ignoreLargeArray:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,onEdit:v,onChange:x,forceUpdate:y,displaySize:b,CustomOperation:w}=(0,em.useContext)(ms),j=void 0!==n?[...o,String(n)]:o;if(!u&&Array.isArray(e)&&e.length>100)return(0,ep.jsx)(p7,{node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parentPath:j});let N=pM(e),[k,E]=(0,em.useState)(pD(e,t,n,s,d,i)),C=r=>{null==l||l({isCollapsing:!r,node:e,depth:t,indexOrName:n}),E(r)};(0,em.useEffect)(()=>{C(pD(e,t,n,s,d,i))},[s,d]);let _=(0,em.useCallback)((n,r,i)=>{Array.isArray(e)?e[+n]=r:e&&(e[n]=r),v&&v({newValue:r,oldValue:i,depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),x&&x({type:"edit",depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),y()},[e,v,x,y]),S=t=>{Array.isArray(e)?e.splice(+t,1):e&&delete e[t],y()},[T,A]=(0,em.useState)(!1),[O,M]=(0,em.useState)(!1),P=(0,em.useRef)(null),D=()=>{var n;if(N){let r=null==(n=P.current)?void 0:n.value;r&&(e[r]=null,P.current&&(P.current.value=""),M(!1),g&&g({indexOrName:r,depth:t,src:p,parentType:"object",parentPath:j}),x&&x({type:"add",indexOrName:r,depth:t,src:p,parentType:"object",parentPath:j}))}else Array.isArray(e)&&(e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}));y()},L=T||O,I=()=>{A(!1),M(!1)},R=(0,ep.jsxs)(ep.Fragment,{children:[!k&&!L&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!0),className:"jv-size-chevron"},{children:[pI(b,t,k)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[pP(e)," Items"]})),(0,ep.jsx)(pG,{className:"jv-chevron"})]})),O&&N&&(0,ep.jsx)("input",{className:"json-view--input",placeholder:"property",ref:P,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),D()):"Escape"===e.key&&I()}}),L&&(0,ep.jsx)(p3,{className:"json-view--edit",style:{display:"inline-block"},onClick:O?D:()=>{A(!1),r&&r(n,j),f&&f({value:e,depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),x&&x({type:"delete",depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j})}}),L&&(0,ep.jsx)(p6,{className:"json-view--edit",style:{display:"inline-block"},onClick:I}),!k&&!L&&c&&pW(i)&&(0,ep.jsx)(pZ,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:a,parentPath:o,currentPath:j}}),!k&&!L&&pB(h)&&pV(i)&&(0,ep.jsx)(p2,{className:"json-view--edit",onClick:()=>{N?(M(!0),setTimeout(()=>{var e;return null==(e=P.current)?void 0:e.focus()})):D()}}),!k&&!L&&pF(h)&&pH(i)&&r&&(0,ep.jsx)(p0,{className:"json-view--edit",onClick:()=>A(!0)}),"function"==typeof w?(0,ep.jsx)(w,{node:e}):null]});return Array.isArray(e)?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"["}),R,k?(0,ep.jsx)("button",Object.assign({onClick:()=>C(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:e.map((r,i)=>(0,ep.jsx)(pQ,{indexOrName:i,value:r,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(i)))})),(0,ep.jsx)("span",{children:"]"}),k&&pI(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[pP(e)," Items"]}))]}):N?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"{"}),R,k?(0,ep.jsx)("button",Object.assign({onClick:()=>C(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([r,i])=>(0,ep.jsx)(pQ,{indexOrName:r,value:i,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(r)))})),(0,ep.jsx)("span",{children:"}"}),k&&pI(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[pP(e)," Items"]}))]}):(0,ep.jsx)("span",{children:String(e)})}let me=em.default.forwardRef(({str:e,className:t,ctrlClick:n},r)=>{let{collapseStringMode:i,collapseStringsAfterLength:a,customizeCollapseStringUI:o}=(0,em.useContext)(ms),[s,l]=(0,em.useState)(!0),c=(0,em.useRef)(null);a=a>0?a:0;let u=e.replace(/\s+/g," "),d="function"==typeof o?o(u,s):"string"==typeof o?o:"...",h=e=>{var t;if((e.ctrlKey||e.metaKey)&&n)n(e);else{let e=window.getSelection();if(e&&e.anchorOffset!==e.focusOffset&&(null==(t=e.anchorNode)?void 0:t.parentElement)===c.current)return;l(!s)}};if(e.length<=a)return(0,ep.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']}));if("address"===i)return e.length<=10?(0,ep.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']})):(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,6),d,u.slice(-4)]:e,'"']}));if("directly"===i)return(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,a),d]:e,'"']}));if("word"===i){let n=a,r=a+1,i=u,o=1;for(;;){if(/\W/.test(e[n])){i=e.slice(0,n);break}if(/\W/.test(e[r])){i=e.slice(0,r);break}if(6===o){i=e.slice(0,a);break}o++,n--,r++}return(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[i,d]:e,'"']}))}return(0,ep.jsxs)("span",Object.assign({ref:c,className:t},{children:['"',e,'"']}))});function mt(){return(mt=Object.assign.bind()).apply(this,arguments)}var mn=function(e){return em.createElement("svg",mt({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),P||(P=em.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))};function mr(){return(mr=Object.assign.bind()).apply(this,arguments)}var mi=function(e){return em.createElement("svg",mr({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),D||(D=em.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),L||(L=em.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function ma({node:e,depth:t,deleteHandle:n,indexOrName:r,parent:i,editHandle:a,parentPath:o}){let s,{collapseStringsAfterLength:l,enableClipboard:c,editable:u,src:d,onDelete:h,onChange:f,customizeNode:p,matchesURL:g,urlRegExp:v,EditComponent:x,DoneComponent:y,CancelComponent:b,CustomOperation:w}=(0,em.useContext)(ms);if("function"==typeof p&&(s=pR(p,[{node:e,depth:t,indexOrName:r}])),s){if((0,em.isValidElement)(s))return s;else if("function"==typeof s){let n=s;return(0,ep.jsx)(n,{node:e,depth:t,indexOrName:r})}}if(Array.isArray(e)||pM(e))return(0,ep.jsx)(p9,{parent:i,node:e,depth:t,indexOrName:r,deleteHandle:n,parentPath:o,customOptions:"object"==typeof s?s:void 0});{var j;let p=typeof e,N=void 0!==r?[...o,String(r)]:o,[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),S=(0,em.useRef)(null),T=()=>{E(!0),setTimeout(()=>{var e,t;null==(e=window.getSelection())||e.selectAllChildren(S.current),null==(t=S.current)||t.focus()})},A=(0,em.useCallback)(()=>{let t=S.current.innerText;try{let n=JSON.parse(t);a&&a(r,n,e,o)}catch(i){let n="string"===p?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t;a&&a(r,n,e,o)}E(!1)},[a,r,e,o,p]),O=()=>{E(!1),_(!1)},M=()=>{_(!1),n&&n(r,o),h&&h({value:e,depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",parentPath:o}),f&&f({depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",type:"delete",parentPath:o})},P=(0,em.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),A()):"Escape"===e.key&&O()},[A]),D=k||C,L=!D&&pz(u)&&pU(s)&&a?e=>{(e.ctrlKey||e.metaKey)&&T()}:void 0,I=(0,ep.jsxs)(ep.Fragment,{children:[D&&("function"==typeof y?(0,ep.jsx)(y,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?M:A}):(0,ep.jsx)(p3,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?M:A})),D&&("function"==typeof b?(0,ep.jsx)(b,{className:"json-view--edit",style:{display:"inline-block"},onClick:O}):(0,ep.jsx)(p6,{className:"json-view--edit",style:{display:"inline-block"},onClick:O})),!D&&c&&pW(s)&&(0,ep.jsx)(pZ,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:i,parentPath:o,currentPath:N}}),!D&&g&&"string"===p&&v.test(e)&&(!(j=s)||void 0===j.matchesURL||!!j.matchesURL)&&(0,ep.jsx)("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:(0,ep.jsx)(mi,{})})),!D&&pz(u)&&pU(s)&&a&&("function"==typeof x?(0,ep.jsx)(x,{className:"json-view--edit",onClick:T}):(0,ep.jsx)(mn,{className:"json-view--edit",onClick:T})),!D&&pF(u)&&pH(s)&&n&&(0,ep.jsx)(p0,{className:"json-view--edit",onClick:()=>_(!0)}),"function"==typeof w?(0,ep.jsx)(w,{node:e}):null]}),R="json-view--string";switch(p){case"number":case"bigint":R="json-view--number";break;case"boolean":R="json-view--boolean";break;case"object":R="json-view--null"}"string"==typeof(null==s?void 0:s.className)&&(R+=" "+s.className),C&&(R+=" json-view--deleting");let B=String(e);"bigint"===p&&(B+="n");let z=(0,em.useMemo)(()=>(0,ep.jsx)("span",{contentEditable:!0,className:R,dangerouslySetInnerHTML:{__html:"string"===p?`"${B}"`:B},ref:S,onKeyDown:P}),[B,p,P]);return"string"===p?(0,ep.jsxs)(ep.Fragment,{children:[k?z:e.length>l?(0,ep.jsx)(me,{str:e,ref:S,className:R,ctrlClick:L}):(0,ep.jsxs)("span",Object.assign({className:R,onClick:L},{children:['"',B,'"']})),I]}):(0,ep.jsxs)(ep.Fragment,{children:[k?z:(0,ep.jsx)("span",Object.assign({className:R,onClick:L},{children:B})),I]})}}let mo=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,ms=(0,em.createContext)({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:mo,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function ml({src:e,collapseStringsAfterLength:t=99,collapseStringMode:n="directly",customizeCollapseStringUI:r,collapseObjectsAfterLength:i=99,collapsed:a,onCollapse:o,enableClipboard:s=!0,editable:l=!1,onEdit:c,onDelete:u,onAdd:d,onChange:h,dark:f=!1,theme:p="default",customizeNode:g,customizeCopy:v=e=>(function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,(e,t)=>{switch(typeof t){case"bigint":return String(t)+"n";case"number":case"boolean":case"object":case"string":return t;default:return String(t)}},void 0)}catch(e){return`${e.name}: ${e.message}`||"JSON.stringify failed"}})(e),displaySize:x,displayArrayIndex:y=!0,style:b,className:w,matchesURL:j=!1,urlRegExp:N=mo,ignoreLargeArray:k=!1,CopyComponent:E,CopiedComponent:C,EditComponent:_,CancelComponent:S,DoneComponent:T,CustomOperation:A}){let[O,M]=(0,em.useState)(0),P=(0,em.useCallback)(()=>M(e=>++e),[]),[D,L]=(0,em.useState)(e);return(0,em.useEffect)(()=>L(e),[e]),(0,ep.jsx)(ms.Provider,Object.assign({value:{src:D,collapseStringsAfterLength:t,collapseStringMode:n,customizeCollapseStringUI:r,collapseObjectsAfterLength:i,collapsed:a,onCollapse:o,enableClipboard:s,editable:l,onEdit:c,onDelete:u,onAdd:d,onChange:h,forceUpdate:P,customizeNode:g,customizeCopy:v,displaySize:x,displayArrayIndex:y,matchesURL:j,urlRegExp:N,ignoreLargeArray:k,CopyComponent:E,CopiedComponent:C,EditComponent:_,CancelComponent:S,DoneComponent:T,CustomOperation:A}},{children:(0,ep.jsx)("code",Object.assign({className:"json-view"+(f?" dark":"")+(p&&"default"!==p?" json-view_"+p:"")+(w?" "+w:""),style:b},{children:(0,ep.jsx)(ma,{node:D,depth:1,editHandle:(e,t,n,r)=>{L(t),c&&c({newValue:t,oldValue:n,depth:1,src:D,indexOrName:e,parentType:null,parentPath:r}),h&&h({type:"edit",depth:1,src:D,indexOrName:e,parentType:null,parentPath:r})},deleteHandle:(e,t)=>{L(void 0),u&&u({value:D,depth:1,src:D,indexOrName:e,parentType:null,parentPath:t}),h&&h({depth:1,src:D,indexOrName:e,parentType:null,type:"delete",parentPath:t})},parentPath:[]})}))}))}var mc=e.i(26330),mu=e.i(3536),md=e.i(65491),mh=e.i(10772),mf=e.i(53660),mp=e.i(74606),mm=e.i(96626),mg=e.i(42727),mv=Symbol("radix.slottable");function mx(e){return em.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mv}var my=e.i(30207),mb=e.i(86312),mw=e.i(85369),mj=["Enter"," "],mN=["ArrowUp","PageDown","End"],mk=["ArrowDown","PageUp","Home",...mN],mE={ltr:[...mj,"ArrowRight"],rtl:[...mj,"ArrowLeft"]},mC={ltr:["ArrowLeft"],rtl:["ArrowRight"]},m_="Menu",[mS,mT,mA]=(0,ts.createCollection)(m_),[mO,mM]=(0,tt.createContextScope)(m_,[mA,mf.createPopperScope,mg.createRovingFocusGroupScope]),mP=(0,mf.createPopperScope)(),mD=(0,mg.createRovingFocusGroupScope)(),[mL,mI]=mO(m_),[mR,mB]=mO(m_),mz=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=mP(t),[l,c]=em.useState(null),u=em.useRef(!1),d=(0,my.useCallbackRef)(a),h=(0,tr.useDirection)(i);return em.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,ep.jsx)(mf.Root,{...s,children:(0,ep.jsx)(mL,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,ep.jsx)(mR,{scope:t,onClose:em.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};mz.displayName=m_;var mF=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=mP(n);return(0,ep.jsx)(mf.Anchor,{...i,...r,ref:t})});mF.displayName="MenuAnchor";var mV="MenuPortal",[mU,mH]=mO(mV,{forceMount:void 0}),mW=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=mI(mV,t);return(0,ep.jsx)(mU,{scope:t,forceMount:n,children:(0,ep.jsx)(mm.Presence,{present:n||a.open,children:(0,ep.jsx)(mp.Portal,{asChild:!0,container:i,children:r})})})};mW.displayName=mV;var mY="MenuContent",[mG,mX]=mO(mY),m$=em.forwardRef((e,t)=>{let n=mH(mY,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=mI(mY,e.__scopeMenu),o=mB(mY,e.__scopeMenu);return(0,ep.jsx)(mS.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(mm.Presence,{present:r||a.open,children:(0,ep.jsx)(mS.Slot,{scope:e.__scopeMenu,children:o.modal?(0,ep.jsx)(mq,{...i,ref:t}):(0,ep.jsx)(mK,{...i,ref:t})})})})}),mq=em.forwardRef((e,t)=>{let n=mI(mY,e.__scopeMenu),r=em.useRef(null),i=(0,te.useComposedRefs)(t,r);return em.useEffect(()=>{let e=r.current;if(e)return(0,mb.hideOthers)(e)},[]),(0,ep.jsx)(mQ,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,e9.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mK=em.forwardRef((e,t)=>{let n=mI(mY,e.__scopeMenu);return(0,ep.jsx)(mQ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),mZ=((o=em.forwardRef((e,t)=>{let{children:n,...r}=e;if(em.isValidElement(n)){var i;let e,a,o=(i=n,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...a}:"className"===r&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==em.Fragment&&(s.ref=t?(0,te.composeRefs)(t,o):o),em.cloneElement(n,s)}return em.Children.count(n)>1?em.Children.only(null):null})).displayName="MenuContent.ScrollLock.SlotClone",r=o,(i=em.forwardRef((e,t)=>{let{children:n,...i}=e,a=em.Children.toArray(n),o=a.find(mx);if(o){let e=o.props.children,n=a.map(t=>t!==o?t:em.Children.count(e)>1?em.Children.only(null):em.isValidElement(e)?e.props.children:null);return(0,ep.jsx)(r,{...i,ref:t,children:em.isValidElement(e)?em.cloneElement(e,void 0,n):null})}return(0,ep.jsx)(r,{...i,ref:t,children:n})})).displayName="MenuContent.ScrollLock.Slot",i),mQ=em.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...g}=e,v=mI(mY,n),x=mB(mY,n),y=mP(n),b=mD(n),w=mT(n),[j,N]=em.useState(null),k=em.useRef(null),E=(0,te.useComposedRefs)(t,k,v.onContentChange),C=em.useRef(0),_=em.useRef(""),S=em.useRef(0),T=em.useRef(null),A=em.useRef("right"),O=em.useRef(0),M=p?mw.RemoveScroll:em.Fragment;em.useEffect(()=>()=>window.clearTimeout(C.current),[]),(0,mu.useFocusGuards)();let P=em.useCallback(e=>{var t,n;return A.current===T.current?.side&&(t=e,!!(n=T.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],l=o.x,c=o.y,u=s.x,d=s.y;c>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,ep.jsx)(mG,{scope:n,searchRef:_,onItemEnter:em.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:em.useCallback(e=>{P(e)||(k.current?.focus(),N(null))},[P]),onTriggerLeave:em.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:S,onPointerGraceIntentChange:em.useCallback(e=>{T.current=e},[]),children:(0,ep.jsx)(M,{...p?{as:mZ,allowPinchZoom:!0}:void 0,children:(0,ep.jsx)(md.FocusScope,{asChild:!0,trapped:i,onMountAutoFocus:(0,e9.composeEventHandlers)(a,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,ep.jsx)(mc.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:(0,ep.jsx)(mg.Root,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:N,onEntryFocus:(0,e9.composeEventHandlers)(l,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ep.jsx)(mf.Content,{role:"menu","aria-orientation":"vertical","data-state":gp(v.open),"data-radix-menu-content":"",dir:x.dir,...y,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:(0,e9.composeEventHandlers)(g.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,a,o,s,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=_.current+i,a=w().filter(e=>!e.disabled),o=document.activeElement,s=a.find(e=>e.ref.current===o)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1,o=(r=Math.max(a,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(o=o.filter(e=>e!==n));let s=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==n?s:void 0}(a.map(e=>e.textValue),t,s),c=a.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(C.current),""!==t&&(C.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let a=k.current;if(e.target!==a||!mk.includes(e.key))return;e.preventDefault();let o=w().filter(e=>!e.disabled).map(e=>e.ref.current);mN.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,e9.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),_.current="")}),onPointerMove:(0,e9.composeEventHandlers)(e.onPointerMove,gv(e=>{let t=e.target,n=O.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>O.current?"right":"left",O.current=e.clientX)}))})})})})})})});m$.displayName=mY;var mJ=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(to.Primitive.div,{role:"group",...r,ref:t})});mJ.displayName="MenuGroup";var m0=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(to.Primitive.div,{...r,ref:t})});m0.displayName="MenuLabel";var m1="MenuItem",m2="menu.itemSelect",m5=em.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=em.useRef(null),o=mB(m1,e.__scopeMenu),s=mX(m1,e.__scopeMenu),l=(0,te.useComposedRefs)(t,a),c=em.useRef(!1);return(0,ep.jsx)(m3,{...i,ref:l,disabled:n,onClick:(0,e9.composeEventHandlers)(e.onClick,()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(m2,{bubbles:!0,cancelable:!0});e.addEventListener(m2,e=>r?.(e),{once:!0}),(0,to.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?c.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,e9.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,e9.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==s.searchRef.current;n||t&&" "===e.key||mj.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});m5.displayName=m1;var m3=em.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=mX(m1,n),s=mD(n),l=em.useRef(null),c=(0,te.useComposedRefs)(t,l),[u,d]=em.useState(!1),[h,f]=em.useState("");return em.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[a.children]),(0,ep.jsx)(mS.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,ep.jsx)(mg.Item,{asChild:!0,...s,focusable:!r,children:(0,ep.jsx)(to.Primitive.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:c,onPointerMove:(0,e9.composeEventHandlers)(e.onPointerMove,gv(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,e9.composeEventHandlers)(e.onPointerLeave,gv(e=>o.onItemLeave(e))),onFocus:(0,e9.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,e9.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),m4=em.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,ep.jsx)(gr,{scope:e.__scopeMenu,checked:n,children:(0,ep.jsx)(m5,{role:"menuitemcheckbox","aria-checked":gm(n)?"mixed":n,...i,ref:t,"data-state":gg(n),onSelect:(0,e9.composeEventHandlers)(i.onSelect,()=>r?.(!!gm(n)||!n),{checkForDefaultPrevented:!1})})})});m4.displayName="MenuCheckboxItem";var m6="MenuRadioGroup",[m8,m7]=mO(m6,{value:void 0,onValueChange:()=>{}}),m9=em.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=(0,my.useCallbackRef)(r);return(0,ep.jsx)(m8,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,ep.jsx)(mJ,{...i,ref:t})})});m9.displayName=m6;var ge="MenuRadioItem",gt=em.forwardRef((e,t)=>{let{value:n,...r}=e,i=m7(ge,e.__scopeMenu),a=n===i.value;return(0,ep.jsx)(gr,{scope:e.__scopeMenu,checked:a,children:(0,ep.jsx)(m5,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":gg(a),onSelect:(0,e9.composeEventHandlers)(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});gt.displayName=ge;var gn="MenuItemIndicator",[gr,gi]=mO(gn,{checked:!1}),ga=em.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=gi(gn,n);return(0,ep.jsx)(mm.Presence,{present:r||gm(a.checked)||!0===a.checked,children:(0,ep.jsx)(to.Primitive.span,{...i,ref:t,"data-state":gg(a.checked)})})});ga.displayName=gn;var go=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(to.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});go.displayName="MenuSeparator";var gs=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=mP(n);return(0,ep.jsx)(mf.Arrow,{...i,...r,ref:t})});gs.displayName="MenuArrow";var[gl,gc]=mO("MenuSub"),gu="MenuSubTrigger",gd=em.forwardRef((e,t)=>{let n=mI(gu,e.__scopeMenu),r=mB(gu,e.__scopeMenu),i=gc(gu,e.__scopeMenu),a=mX(gu,e.__scopeMenu),o=em.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=a,c={__scopeMenu:e.__scopeMenu},u=em.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return em.useEffect(()=>u,[u]),em.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]),(0,ep.jsx)(mF,{asChild:!0,...c,children:(0,ep.jsx)(m3,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":gp(n.open),...e,ref:(0,te.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:(0,e9.composeEventHandlers)(e.onPointerMove,gv(t=>{a.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,e9.composeEventHandlers)(e.onPointerLeave,gv(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,o=t[i?"left":"right"],l=t[i?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:(0,e9.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==a.searchRef.current;e.disabled||i&&" "===t.key||mE[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});gd.displayName=gu;var gh="MenuSubContent",gf=em.forwardRef((e,t)=>{let n=mH(mY,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=mI(mY,e.__scopeMenu),o=mB(mY,e.__scopeMenu),s=gc(gh,e.__scopeMenu),l=em.useRef(null),c=(0,te.useComposedRefs)(t,l);return(0,ep.jsx)(mS.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(mm.Presence,{present:r||a.open,children:(0,ep.jsx)(mS.Slot,{scope:e.__scopeMenu,children:(0,ep.jsx)(mQ,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:c,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,e9.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:(0,e9.composeEventHandlers)(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:(0,e9.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=mC[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});function gp(e){return e?"open":"closed"}function gm(e){return"indeterminate"===e}function gg(e){return gm(e)?"indeterminate":e?"checked":"unchecked"}function gv(e){return t=>"mouse"===t.pointerType?e(t):void 0}gf.displayName=gh;var gx="DropdownMenu",[gy,gb]=(0,tt.createContextScope)(gx,[mM]),gw=mM(),[gj,gN]=gy(gx),gk=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=gw(t),c=em.useRef(null),[u,d]=(0,tn.useControllableState)({prop:i,defaultProp:a??!1,onChange:o,caller:gx});return(0,ep.jsx)(gj,{scope:t,triggerId:(0,mh.useId)(),triggerRef:c,contentId:(0,mh.useId)(),open:u,onOpenChange:d,onOpenToggle:em.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,ep.jsx)(mz,{...l,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};gk.displayName=gx;var gE="DropdownMenuTrigger",gC=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=gN(gE,n),o=gw(n);return(0,ep.jsx)(mF,{asChild:!0,...o,children:(0,ep.jsx)(to.Primitive.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:(0,te.composeRefs)(t,a.triggerRef),onPointerDown:(0,e9.composeEventHandlers)(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:(0,e9.composeEventHandlers)(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});gC.displayName=gE;var g_=e=>{let{__scopeDropdownMenu:t,...n}=e,r=gw(t);return(0,ep.jsx)(mW,{...r,...n})};g_.displayName="DropdownMenuPortal";var gS="DropdownMenuContent",gT=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gN(gS,n),a=gw(n),o=em.useRef(!1);return(0,ep.jsx)(m$,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:(0,e9.composeEventHandlers)(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:(0,e9.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gT.displayName=gS,em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(mJ,{...i,...r,ref:t})}).displayName="DropdownMenuGroup";var gA=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(m0,{...i,...r,ref:t})});gA.displayName="DropdownMenuLabel";var gO=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(m5,{...i,...r,ref:t})});gO.displayName="DropdownMenuItem";var gM=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(m4,{...i,...r,ref:t})});gM.displayName="DropdownMenuCheckboxItem",em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(m9,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup";var gP=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(gt,{...i,...r,ref:t})});gP.displayName="DropdownMenuRadioItem";var gD=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(ga,{...i,...r,ref:t})});gD.displayName="DropdownMenuItemIndicator";var gL=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(go,{...i,...r,ref:t})});gL.displayName="DropdownMenuSeparator",em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(gs,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var gI=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(gd,{...i,...r,ref:t})});gI.displayName="DropdownMenuSubTrigger";var gR=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gw(n);return(0,ep.jsx)(gf,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gR.displayName="DropdownMenuSubContent";let gB=(0,eN.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);em.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,ep.jsxs)(gI,{ref:i,className:(0,eO.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,(0,ep.jsx)(eT.ChevronRight,{className:"ml-auto"})]})).displayName=gI.displayName,em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(gR,{ref:n,className:(0,eO.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})).displayName=gR.displayName;let gz=em.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,ep.jsx)(g_,{children:(0,ep.jsx)(gT,{ref:r,sideOffset:t,className:(0,eO.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));gz.displayName=gT.displayName;let gF=em.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(gO,{ref:r,className:(0,eO.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n}));gF.displayName=gO.displayName,em.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,ep.jsxs)(gM,{ref:i,className:(0,eO.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(gD,{children:(0,ep.jsx)(tF.Check,{className:"h-4 w-4"})})}),t]})).displayName=gM.displayName,em.forwardRef(({className:e,children:t,...n},r)=>(0,ep.jsxs)(gP,{ref:r,className:(0,eO.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(gD,{children:(0,ep.jsx)(gB,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=gP.displayName,em.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(gA,{ref:r,className:(0,eO.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n})).displayName=gA.displayName;let gV=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(gL,{ref:n,className:(0,eO.cn)("-mx-1 my-1 h-px bg-muted",e),...t}));gV.displayName=gL.displayName;var tV=tV;let gU=(0,eN.default)("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"}]]),gH=(0,eN.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);function gW(){}function gY(){}let gG=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gX=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,g$={};function gq(e,t){return((t||g$).jsx?gX:gG).test(e)}let gK=/[ \t\n\f\r]/g;function gZ(e){return""===e.replace(gK,"")}class gQ{constructor(e,t){this.attribute=t,this.property=e}}gQ.prototype.attribute="",gQ.prototype.booleanish=!1,gQ.prototype.boolean=!1,gQ.prototype.commaOrSpaceSeparated=!1,gQ.prototype.commaSeparated=!1,gQ.prototype.defined=!1,gQ.prototype.mustUseProperty=!1,gQ.prototype.number=!1,gQ.prototype.overloadedBoolean=!1,gQ.prototype.property="",gQ.prototype.spaceSeparated=!1,gQ.prototype.space=void 0;let gJ=0,g0=g8(),g1=g8(),g2=g8(),g5=g8(),g3=g8(),g4=g8(),g6=g8();function g8(){return 2**++gJ}e.s(["boolean",0,g0,"booleanish",0,g1,"commaOrSpaceSeparated",0,g6,"commaSeparated",0,g4,"number",0,g5,"overloadedBoolean",0,g2,"spaceSeparated",0,g3],744);var g7=e.i(744);let g9=Object.keys(g7);class ve extends gQ{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<g9.length;){const e=g9[i];!function(e,t,n){n&&(e[t]=n)}(this,g9[i],(n&g7[e])===g7[e])}}}function vt(e){return e.toLowerCase()}ve.prototype.defined=!0;let vn=/[A-Z]/g,vr=/-[a-z]/g,vi=/^data[-\w.:]+$/i;function va(e){return"-"+e.toLowerCase()}function vo(e){return e.charAt(1).toUpperCase()}let vs={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class vl{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function vc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new vl(n,r,t)}function vu(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ve(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[vt(r)]=r,n[vt(a.attribute)]=r}return new vl(t,n,e.space)}vl.prototype.normal={},vl.prototype.property={},vl.prototype.space=void 0;let vd=vu({properties:{ariaActiveDescendant:null,ariaAtomic:g1,ariaAutoComplete:null,ariaBusy:g1,ariaChecked:g1,ariaColCount:g5,ariaColIndex:g5,ariaColSpan:g5,ariaControls:g3,ariaCurrent:null,ariaDescribedBy:g3,ariaDetails:null,ariaDisabled:g1,ariaDropEffect:g3,ariaErrorMessage:null,ariaExpanded:g1,ariaFlowTo:g3,ariaGrabbed:g1,ariaHasPopup:null,ariaHidden:g1,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:g3,ariaLevel:g5,ariaLive:null,ariaModal:g1,ariaMultiLine:g1,ariaMultiSelectable:g1,ariaOrientation:null,ariaOwns:g3,ariaPlaceholder:null,ariaPosInSet:g5,ariaPressed:g1,ariaReadOnly:g1,ariaRelevant:null,ariaRequired:g1,ariaRoleDescription:g3,ariaRowCount:g5,ariaRowIndex:g5,ariaRowSpan:g5,ariaSelected:g1,ariaSetSize:g5,ariaSort:null,ariaValueMax:g5,ariaValueMin:g5,ariaValueNow:g5,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function vh(e,t){return t in e?e[t]:t}function vf(e,t){return vh(e,t.toLowerCase())}let vp=vu({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:g4,acceptCharset:g3,accessKey:g3,action:null,allow:null,allowFullScreen:g0,allowPaymentRequest:g0,allowUserMedia:g0,alt:null,as:null,async:g0,autoCapitalize:null,autoComplete:g3,autoFocus:g0,autoPlay:g0,blocking:g3,capture:null,charSet:null,checked:g0,cite:null,className:g3,cols:g5,colSpan:null,content:null,contentEditable:g1,controls:g0,controlsList:g3,coords:g5|g4,crossOrigin:null,data:null,dateTime:null,decoding:null,default:g0,defer:g0,dir:null,dirName:null,disabled:g0,download:g2,draggable:g1,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:g0,formTarget:null,headers:g3,height:g5,hidden:g2,high:g5,href:null,hrefLang:null,htmlFor:g3,httpEquiv:g3,id:null,imageSizes:null,imageSrcSet:null,inert:g0,inputMode:null,integrity:null,is:null,isMap:g0,itemId:null,itemProp:g3,itemRef:g3,itemScope:g0,itemType:g3,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:g0,low:g5,manifest:null,max:null,maxLength:g5,media:null,method:null,min:null,minLength:g5,multiple:g0,muted:g0,name:null,nonce:null,noModule:g0,noValidate:g0,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:g0,optimum:g5,pattern:null,ping:g3,placeholder:null,playsInline:g0,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:g0,referrerPolicy:null,rel:g3,required:g0,reversed:g0,rows:g5,rowSpan:g5,sandbox:g3,scope:null,scoped:g0,seamless:g0,selected:g0,shadowRootClonable:g0,shadowRootDelegatesFocus:g0,shadowRootMode:null,shape:null,size:g5,sizes:null,slot:null,span:g5,spellCheck:g1,src:null,srcDoc:null,srcLang:null,srcSet:null,start:g5,step:null,style:null,tabIndex:g5,target:null,title:null,translate:null,type:null,typeMustMatch:g0,useMap:null,value:g1,width:g5,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:g3,axis:null,background:null,bgColor:null,border:g5,borderColor:null,bottomMargin:g5,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:g0,declare:g0,event:null,face:null,frame:null,frameBorder:null,hSpace:g5,leftMargin:g5,link:null,longDesc:null,lowSrc:null,marginHeight:g5,marginWidth:g5,noResize:g0,noHref:g0,noShade:g0,noWrap:g0,object:null,profile:null,prompt:null,rev:null,rightMargin:g5,rules:null,scheme:null,scrolling:g1,standby:null,summary:null,text:null,topMargin:g5,valueType:null,version:null,vAlign:null,vLink:null,vSpace:g5,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:g0,disableRemotePlayback:g0,prefix:null,property:null,results:g5,security:null,unselectable:null},space:"html",transform:vf}),vm=vu({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:g6,accentHeight:g5,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:g5,amplitude:g5,arabicForm:null,ascent:g5,attributeName:null,attributeType:null,azimuth:g5,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:g5,by:null,calcMode:null,capHeight:g5,className:g3,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:g5,diffuseConstant:g5,direction:null,display:null,dur:null,divisor:g5,dominantBaseline:null,download:g0,dx:null,dy:null,edgeMode:null,editable:null,elevation:g5,enableBackground:null,end:null,event:null,exponent:g5,externalResourcesRequired:null,fill:null,fillOpacity:g5,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:g4,g2:g4,glyphName:g4,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:g5,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:g5,horizOriginX:g5,horizOriginY:g5,id:null,ideographic:g5,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:g5,k:g5,k1:g5,k2:g5,k3:g5,k4:g5,kernelMatrix:g6,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:g5,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:g5,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:g5,overlineThickness:g5,paintOrder:null,panose1:null,path:null,pathLength:g5,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:g3,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:g5,pointsAtY:g5,pointsAtZ:g5,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:g6,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:g6,rev:g6,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:g6,requiredFeatures:g6,requiredFonts:g6,requiredFormats:g6,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:g5,specularExponent:g5,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:g5,strikethroughThickness:g5,string:null,stroke:null,strokeDashArray:g6,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:g5,strokeOpacity:g5,strokeWidth:null,style:null,surfaceScale:g5,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:g6,tabIndex:g5,tableValues:null,target:null,targetX:g5,targetY:g5,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:g6,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:g5,underlineThickness:g5,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:g5,values:null,vAlphabetic:g5,vMathematical:g5,vectorEffect:null,vHanging:g5,vIdeographic:g5,version:null,vertAdvY:g5,vertOriginX:g5,vertOriginY:g5,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:g5,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vh}),vg=vu({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),vv=vu({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vf}),vx=vu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),vy=vc([vd,vp,vg,vv,vx],"html"),vb=vc([vd,vm,vg,vv,vx],"svg");var vw=e.i(15511);let vj=vk("end"),vN=vk("start");function vk(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function vE(e){return e&&"object"==typeof e?"position"in e||"type"in e?v_(e.position):"start"in e||"end"in e?v_(e):"line"in e||"column"in e?vC(e):"":""}function vC(e){return vS(e&&e.line)+":"+vS(e&&e.column)}function v_(e){return vC(e&&e.start)+"-"+vC(e&&e.end)}function vS(e){return e&&"number"==typeof e?e:1}class vT extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},a=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=vE(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vT.prototype.file="",vT.prototype.name="",vT.prototype.reason="",vT.prototype.message="",vT.prototype.stack="",vT.prototype.column=void 0,vT.prototype.line=void 0,vT.prototype.ancestors=void 0,vT.prototype.cause=void 0,vT.prototype.fatal=void 0,vT.prototype.place=void 0,vT.prototype.ruleId=void 0,vT.prototype.source=void 0;let vA={}.hasOwnProperty,vO=new Map,vM=/[A-Z]/g,vP=new Set(["table","tbody","thead","tfoot","tr"]),vD=new Set(["td","th"]),vL="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vI(e,t,n){var r,i,a,o,s,l,c,u,d;let h,f,p,g,v,x,y,b,w,j,N;return"element"===t.type?(r=e,i=t,a=n,f=h=r.schema,"svg"===i.tagName.toLowerCase()&&"html"===h.space&&(r.schema=vb),r.ancestors.push(i),p=vF(r,i.tagName,!1),g=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&vA.call(t.properties,r)){let a=function(e,t,n){let r=function(e,t){let n=vt(t),r=t,i=gQ;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&vi.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(vr,vo);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!vr.test(e)){let n=e.replace(vn,va);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=ve}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,vw.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new vT("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=vL+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)vA.call(e,t)&&(n[function(e){let t=e.replace(vM,vU);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?vs[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(a){let[r,o]=a;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof o&&vD.has(t.tagName)?n=o:i[r]=o}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(r,i),v=vz(r,i),vP.has(i.tagName)&&(v=v.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&gZ(e.value):gZ(e))})),vR(r,g,p,i),vB(g,v),r.ancestors.pop(),r.schema=h,r.create(i,p,g,a)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return gW("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}vV(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=n,y=x=o.schema,"svg"===s.name&&"html"===x.space&&(o.schema=vb),o.ancestors.push(s),b=null===s.name?o.Fragment:vF(o,s.name,!0),w=function(e,t){let n={};for(let r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];gW("ExpressionStatement"===t.type);let i=t.expression;gW("ObjectExpression"===i.type);let a=i.properties[0];gW("SpreadElement"===a.type),Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else vV(e,t.position);else{let i,a=r.name;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];gW("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else vV(e,t.position);else i=null===r.value||r.value;n[a]=i}return n}(o,s),j=vz(o,s),vR(o,w,b,s),vB(w,j),o.ancestors.pop(),o.schema=x,o.create(s,b,w,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vV(e,t.position)}(e,t):"root"===t.type?(c=e,u=t,d=n,vB(N={},vz(c,u)),c.create(u,c.Fragment,N,d)):"text"===t.type?t.value:void 0}function vR(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function vB(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function vz(e,t){let n=[],r=-1,i=e.passKeys?new Map:vO;for(;++r<t.children.length;){let a,o=t.children[r];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}let s=vI(e,o,a);void 0!==s&&n.push(s)}return n}function vF(e,t,n){let r;if(n)if(t.includes(".")){let e,n=t.split("."),i=-1;for(;++i<n.length;){let t=gq(n[i])?{type:"Identifier",name:n[i]}:{type:"Literal",value:n[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}gW(e,"always a result"),r=e}else r=gq(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){let t=r.value;return vA.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);vV(e)}function vV(e,t){let n=new vT("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=vL+"#cannot-handle-mdx-estrees-without-createevaluater",n}function vU(e){return"-"+e.toLowerCase()}let vH={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},vW={};function vY(e,t){let n=t||vW;return vG(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function vG(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return vX(e.children,t,n)}return Array.isArray(e)?vX(e,t,n):""}function vX(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=vG(e[i],t,n);return r.join("")}function v$(e,t,n,r){let i,a=e.length,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function vq(e,t){return e.length>0?(v$(e,e.length,0,t),e):t}let vK={}.hasOwnProperty;function vZ(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(vK.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];if(a)for(r in a){vK.call(i,r)||(i[r]=[]);let e=a[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);v$(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}function vQ(e){return null!==e&&e<-2}function vJ(e){return -2===e||-1===e||32===e}function v0(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function v1(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return vJ(r)?(e.enter(n),function r(o){return vJ(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}v0(/[A-Za-z]/),v0(/[\dA-Za-z]/),v0(/[#-'*+\--9=?A-Z^-~]/),v0(/\d/),v0(/[\dA-Fa-f]/),v0(/[!-/:-@[-`{-~]/),v0(/\p{P}|\p{S}/u),v0(/\s/);let v2={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),v1(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return vQ(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},v5={tokenize:function(e){let t,n,r,i=this,a=[],o=0;return s;function s(t){if(o<a.length){let n=a[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,c)(t)}return c(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&x();let r=i.events.length,a=r;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){n=i.events[a][1].end;break}v(o);let s=r;for(;s<i.events.length;)i.events[s][1].end={...n},s++;return v$(i.events,a+1,0,i.events.slice(r)),i.events.length=s,c(e)}return s(e)}function c(n){if(o===a.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return p(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(v3,u,d)(n)}function u(e){return t&&x(),v(o),h(e)}function d(e){return i.parser.lazy[i.now().line]=o!==a.length,r=i.now().offset,p(e)}function h(t){return i.containerState={},e.attempt(v3,f,p)(t)}function f(e){return o++,a.push([i.currentConstruct,i.containerState]),h(e)}function p(r){if(null===r){t&&x(),v(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){g(e.exit("chunkFlow"),!0),v(0),e.consume(n);return}return vQ(n)?(e.consume(n),g(e.exit("chunkFlow")),o=0,i.interrupt=void 0,s):(e.consume(n),t)}(r)}function g(e,a){let s=i.sliceStream(e);if(a&&s.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(s),i.parser.lazy[e.start.line]){let e,n,a=t.events.length;for(;a--;)if(t.events[a][1].start.offset<r&&(!t.events[a][1].end||t.events[a][1].end.offset>r))return;let s=i.events.length,l=s;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(v(o),a=s;a<i.events.length;)i.events[a][1].end={...n},a++;v$(i.events,l+1,0,i.events.slice(s)),i.events.length=a}}function v(t){let n=a.length;for(;n-- >t;){let t=a[n];i.containerState=t[1],t[0].exit.call(i,e)}a.length=t}function x(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},v3={tokenize:function(e,t,n){return v1(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},v4=xi(/[A-Za-z]/),v6=xi(/[\dA-Za-z]/),v8=xi(/[#-'*+\--9=?A-Z^-~]/),v7=xi(/\d/),v9=xi(/[\dA-Fa-f]/),xe=xi(/[!-/:-@[-`{-~]/);function xt(e){return null!==e&&e<-2}function xn(e){return null!==e&&(e<0||32===e)}function xr(e){return -2===e||-1===e||32===e}function xi(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xa(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return xr(r)?(e.enter(n),function r(o){return xr(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}xi(/\p{P}|\p{S}/u),xi(/\s/);let xo={partial:!0,tokenize:function(e,t,n){return function(t){return xr(t)?xa(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||xt(e)?t(e):n(e)}}};class xs{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&xl(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),xl(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),xl(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);xl(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);xl(this.left,t.reverse())}}}function xl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function xc(e){let t,n,r,i,a,o,s,l={},c=-1,u=new xs(e);for(;++c<u.length;){for(;c in l;)c=l[c];if(t=u.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],a=e.get(t)[2],o=t-1,s=[],l=i._tokenizer;!l&&(l=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let c=l.events,u=[],d={},h=-1,f=i,p=0,g=0,v=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(n=a.sliceStream(f),f.next||n.push(null),r&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=f,f=f.next}for(f=i;++h<c.length;)"exit"===c[h][0]&&"enter"===c[h-1][0]&&c[h][1].type===c[h-1][1].type&&c[h][1].start.line!==c[h][1].end.line&&(g=h+1,v.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),h=v.length;h--;){let t=c.slice(v[h],v[h+1]),n=s.pop();u.push([n,n+t.length-1]),e.splice(n,2,t)}for(u.reverse(),h=-1;++h<u.length;)d[p+u[h][0]]=p+u[h][1],p+=u[h][1]-u[h][0]-1;return d}(u,c)),c=l[c],s=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=u.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(u.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...u.get(n)[1].start},(a=u.slice(n,c)).unshift(t),u.splice(n,c-n+1,a))}}return v$(e,0,1/0,u.slice(0)),!s}let xu={resolve:function(e){return xc(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):xt(t)?e.check(xd,a,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function a(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},xd={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),xa(e,i,"linePrefix")};function i(i){if(null===i||xt(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},xh={tokenize:function(e){let t=this,n=e.attempt(xo,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,v1(e,e.attempt(this.parser.constructs.flow,r,e.attempt(xu,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},xf={resolveAll:xv()},xp=xg("string"),xm=xg("text");function xg(e){return{resolveAll:xv("text"===e?xx:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function xv(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function xx(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],a=t.sliceStream(i),o=a.length,s=-1,l=0;for(;o--;){let e=a[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let a={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}xw(/[A-Za-z]/),xw(/[\dA-Za-z]/),xw(/[#-'*+\--9=?A-Z^-~]/),xw(/\d/),xw(/[\dA-Fa-f]/),xw(/[!-/:-@[-`{-~]/);let xy=xw(/\p{P}|\p{S}/u),xb=xw(/\s/);function xw(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xj(e){return null===e||null!==e&&(e<0||32===e)||xb(e)?1:xy(e)?2:void 0}function xN(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}let xk={name:"attention",resolveAll:function(e,t){let n,r,i,a,o,s,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close){for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[u][1].start};xE(d,-s),xE(h,s),a={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:h},i={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:s>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[n][1].end={...a.start},e[u][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=vq(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=vq(l,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=vq(l,xN(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=vq(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=vq(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,v$(e,n-1,u-n+3,l),u=n+l.length-c-2;break}}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,a=xj(i);return function(o){return n=o,e.enter("attentionSequence"),function o(s){if(s===n)return e.consume(s),o;let l=e.exit("attentionSequence"),c=xj(s),u=!c||2===c&&a||r.includes(s),d=!a||2===a&&c||r.includes(i);return l._open=!!(42===n?u:u&&(a||!d)),l._close=!!(42===n?d:d&&(c||!u)),t(s)}(o)}}};function xE(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let xC={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return xr(t)?xa(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(xC,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return xr(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},x_={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return xe(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},xS=document.createElement("i");function xT(e){let t="&"+e+";";xS.innerHTML=t;let n=xS.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let xA={name:"characterReference",tokenize:function(e,t,n){let r,i,a=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=v6,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=v9,c):(e.enter("characterReferenceValue"),r=7,i=v7,c(t))}function c(s){if(59===s&&o){let r=e.exit("characterReferenceValue");return i!==v6||xT(a.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return i(s)&&o++<r?(e.consume(s),c):n(s)}}},xO={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xM={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),xr(t)?xa(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a>=s?(e.exit("codeFencedFenceSequence"),xr(i)?xa(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||xt(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,s=0;return function(t){var a;let c;return a=t,o=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=a,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s<3?n(i):(e.exit("codeFencedFenceSequence"),xr(i)?xa(e,l,"whitespace")(i):l(i))}(a)};function l(a){return null===a||xt(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(xO,u,p)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||xt(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):xr(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xa(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(a))}function c(t){return null===t||xt(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||xt(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function u(t){return e.attempt(a,p,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&xr(t)?xa(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||xt(t)?e.check(xO,u,p)(t):(e.enter("codeFlowValue"),function t(n){return null===n||xt(n)?(e.exit("codeFlowValue"),f(n)):(e.consume(n),t)}(t))}function p(n){return e.exit("codeFenced"),t(n)}}},xP={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),xa(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?a(n):xt(n)?e.attempt(xD,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||xt(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},xD={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):xt(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):xa(e,a,"linePrefix",5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):xt(e)?i(e):n(e)}}};function xL(e){return null!==e&&(e<32||127===e)}function xI(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xR(e,t,n,r,i,a,o,s,l){let c=l||1/0,u=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),d):null===t||32===t||41===t||xL(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),p(t))};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||null!==t&&t<-2?n(t):(e.consume(t),92===t?f:h)}function f(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function p(i){return!u&&(null===i||41===i||null!==i&&(i<0||32===i))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(i)):u<c&&40===i?(e.consume(i),u++,p):41===i?(e.consume(i),u--,p):null===i||32===i||40===i||xL(i)?n(i):(e.consume(i),92===i?g:p)}function g(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function xB(e){return null!==e&&e<-2}function xz(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xF(e,t,n,r,i,a){let o,s=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),c};function c(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):93===d?(e.exit(a),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):xB(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||xB(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),o||(o=-2!==t&&-1!==t&&32!==t),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function xV(e){return null!==e&&e<-2}function xU(e){return -2===e||-1===e||32===e}function xH(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xW(e,t,n,r,i,a){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,s):n(t)};function s(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){if(t===o)return e.exit(a),s(o);if(null===t)return n(t);if(xV(t)){var r,i;let n,a;return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r=l,i="linePrefix",n=1/0,a=0,function(t){return xU(t)?(e.enter(i),function t(o){return xU(o)&&a++<n?(e.consume(o),t):(e.exit(i),r(o))}(t)):r(t)}}return e.enter("chunkString",{contentType:"string"}),c(t)}function c(t){return t===o||null===t||xV(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===o||92===t?(e.consume(t),c):c(t)}}function xY(e){return -2===e||-1===e||32===e}function xG(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xX(e,t){let n;return function r(i){var a,o;if(null!==i&&i<-2)return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;if(xY(i)){let t,s;return(a=r,o=n?"linePrefix":"lineSuffix",t=1/0,s=0,function(n){return xY(n)?(e.enter(o),function n(r){return xY(r)&&s++<t?(e.consume(r),n):(e.exit(o),a(r))}(n)):a(n)})(i)}return t(i)}}function x$(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}xI(/[A-Za-z]/),xI(/[\dA-Za-z]/),xI(/[#-'*+\--9=?A-Z^-~]/),xI(/\d/),xI(/[\dA-Fa-f]/),xI(/[!-/:-@[-`{-~]/),xI(/\p{P}|\p{S}/u),xI(/\s/),xz(/[A-Za-z]/),xz(/[\dA-Za-z]/),xz(/[#-'*+\--9=?A-Z^-~]/),xz(/\d/),xz(/[\dA-Fa-f]/),xz(/[!-/:-@[-`{-~]/),xz(/\p{P}|\p{S}/u),xz(/\s/),xH(/[A-Za-z]/),xH(/[\dA-Za-z]/),xH(/[#-'*+\--9=?A-Z^-~]/),xH(/\d/),xH(/[\dA-Fa-f]/),xH(/[!-/:-@[-`{-~]/),xH(/\p{P}|\p{S}/u),xH(/\s/),xG(/[A-Za-z]/),xG(/[\dA-Za-z]/),xG(/[#-'*+\--9=?A-Z^-~]/),xG(/\d/),xG(/[\dA-Fa-f]/),xG(/[!-/:-@[-`{-~]/),xG(/\p{P}|\p{S}/u),xG(/\s/);let xq={partial:!0,tokenize:function(e,t,n){return function(t){return xn(t)?xX(e,r)(t):n(t)};function r(t){return xW(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return xr(t)?xa(e,a,"whitespace")(t):a(t)}function a(e){return null===e||xt(e)?t(e):n(e)}}},xK=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xZ=["pre","script","style","textarea"],xQ={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(xo,t,n)}}},xJ={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return xt(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},x0={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&v$(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,a,o=e.length,s=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){s=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},u={type:"labelText",start:{...e[r+s+2][1].end},end:{...e[i-2][1].start}};return a=vq(a=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+s+3)),a=vq(a,[["enter",u,t]]),a=vq(a,xN(t.parser.constructs.insideSpan.null,e.slice(r+s+4,i-3),t)),a=vq(a,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),a=vq(a,e.slice(i+1)),a=vq(a,[["exit",l,t]]),v$(e,r,e.length,a),e},tokenize:function(e,t,n){let r,i,a=this,o=a.events.length;for(;o--;)if(("labelImage"===a.events[o][1].type||"labelLink"===a.events[o][1].type)&&!a.events[o][1]._balanced){r=a.events[o][1];break}return function(t){return r?r._inactive?u(t):(i=a.parser.defined.includes(x$(a.sliceSerialize({start:r.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):n(t)};function s(t){return 40===t?e.attempt(x1,c,i?c:u)(t):91===t?e.attempt(x2,c,i?l:u)(t):i?c(t):u(t)}function l(t){return e.attempt(x5,c,u)(t)}function c(e){return t(e)}function u(e){return r._balanced=!0,n(e)}}},x1={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return xn(t)?xX(e,i)(t):i(t)}function i(t){return 41===t?c(t):xR(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return xn(t)?xX(e,s)(t):c(t)}function o(e){return n(e)}function s(t){return 34===t||39===t||40===t?xW(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return xn(t)?xX(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},x2={tokenize:function(e,t,n){let r=this;return function(t){return xF.call(r,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(x$(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},x5={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},x3={name:"labelStartImage",resolveAll:x0.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):n(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},x4={name:"labelStartLink",resolveAll:x0.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},x6={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),xa(e,t,"linePrefix")}}},x8={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(a){var o;return e.enter("thematicBreak"),r=o=a,function a(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),xr(n)?xa(e,a,"whitespace")(n):a(n))}(o)):i>=3&&(null===o||xt(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},x7={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(xo,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,xa(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!xr(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ye,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,xa(e,e.attempt(x7,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:v7(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(x8,n,s)(t):s(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return v7(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),s(i)):n(i)}(t)}return n(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(xo,r.interrupt?n:l,e.attempt(x9,u,c))}function l(e){return r.containerState.initialBlankLine=!0,a++,u(e)}function c(t){return xr(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},x9={partial:!0,tokenize:function(e,t,n){let r=this;return xa(e,function(e){let i=r.events[r.events.length-1];return!xr(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},ye={partial:!0,tokenize:function(e,t,n){let r=this;return xa(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},yt={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),i||"definition"!==e[a][1].type||(i=a);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let s,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){s="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||s)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),xr(n)?xa(e,a,"lineSuffix")(n):a(n))}(o)):n(t)};function a(r){return null===r||xt(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,xF.call(i,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function a(t){return(r=x$(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return xn(t)?xX(e,s)(t):s(t)}function s(t){return xR(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(xq,c,c)(t)}function c(t){return xr(t)?xa(e,u,"whitespace")(t):u(t)}function u(a){return null===a||xt(a)?(e.exit("definition"),i.parser.defined.push(r),t(a)):n(a)}}}},"disable",0,{null:[]},"document",0,{42:x7,43:x7,45:x7,48:x7,49:x7,50:x7,51:x7,52:x7,53:x7,54:x7,55:x7,56:x7,57:x7,62:xC},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,a=3;return"whitespace"===e[3][1].type&&(a+=2),i-2>a&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(a===i-1||i-4>a&&"whitespace"===e[i-2][1].type)&&(i-=a+1===i?2:4),i>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[i][1].end},r={type:"chunkText",start:e[a][1].start,end:e[i][1].end,contentType:"text"},v$(e,a,i-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var a;return e.enter("atxHeading"),a=i,e.enter("atxHeadingSequence"),function i(a){return 35===a&&r++<6?(e.consume(a),i):null===a||xn(a)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||xt(r)?(e.exit("atxHeading"),t(r)):xr(r)?xa(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||xn(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(a)):n(a)}(a)}}},42:x8,45:[yt,x8],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,a,o,s,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(o){return 33===o?(e.consume(o),u):47===o?(e.consume(o),i=!0,f):63===o?(e.consume(o),r=3,l.interrupt?t:P):v4(o)?(e.consume(o),a=String.fromCharCode(o),p):n(o)}function u(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,o=0,h):v4(i)?(e.consume(i),r=4,l.interrupt?t:P):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:P):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:E:h:n(r)}function f(t){return v4(t)?(e.consume(t),a=String.fromCharCode(t),p):n(t)}function p(o){if(null===o||47===o||62===o||xn(o)){let s=47===o,c=a.toLowerCase();return!s&&!i&&xZ.includes(c)?(r=1,l.interrupt?t(o):E(o)):xK.includes(a.toLowerCase())?(r=6,s)?(e.consume(o),g):l.interrupt?t(o):E(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return xr(n)?(e.consume(n),t):N(n)}(o):v(o))}return 45===o||v6(o)?(e.consume(o),a+=String.fromCharCode(o),p):n(o)}function g(r){return 62===r?(e.consume(r),l.interrupt?t:E):n(r)}function v(t){return 47===t?(e.consume(t),N):58===t||95===t||v4(t)?(e.consume(t),x):xr(t)?(e.consume(t),v):N(t)}function x(t){return 45===t||46===t||58===t||95===t||v6(t)?(e.consume(t),x):y(t)}function y(t){return 61===t?(e.consume(t),b):xr(t)?(e.consume(t),y):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),s=t,w):xr(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||xn(n)?y(n):(e.consume(n),t)}(t)}function w(t){return t===s?(e.consume(t),s=null,j):null===t||xt(t)?n(t):(e.consume(t),w)}function j(e){return 47===e||62===e||xr(e)?v(e):n(e)}function N(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||xt(t)?E(t):xr(t)?(e.consume(t),k):n(t)}function E(t){return 45===t&&2===r?(e.consume(t),T):60===t&&1===r?(e.consume(t),A):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),P):93===t&&5===r?(e.consume(t),M):xt(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(xQ,L,C)(t)):null===t||xt(t)?(e.exit("htmlFlowData"),C(t)):(e.consume(t),E)}function C(t){return e.check(xJ,_,L)(t)}function _(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||xt(t)?C(t):(e.enter("htmlFlowData"),E(t))}function T(t){return 45===t?(e.consume(t),P):E(t)}function A(t){return 47===t?(e.consume(t),a="",O):E(t)}function O(t){if(62===t){let n=a.toLowerCase();return xZ.includes(n)?(e.consume(t),D):E(t)}return v4(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),O):E(t)}function M(t){return 93===t?(e.consume(t),P):E(t)}function P(t){return 62===t?(e.consume(t),D):45===t&&2===r?(e.consume(t),P):E(t)}function D(t){return null===t||xt(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),D)}function L(n){return e.exit("htmlFlow"),t(n)}}},61:yt,95:x8,96:xM,126:xM},"flowInitial",0,{[-2]:xP,[-1]:xP,32:xP},"insideSpan",0,{null:[xk,xf]},"string",0,{38:xA,92:x_},"text",0,{[-5]:x6,[-4]:x6,[-3]:x6,33:x3,38:xA,42:xk,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return v4(t)?(e.consume(t),a):64===t?n(t):s(t)}function a(t){return 43===t||45===t||46===t||v6(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||v6(n))&&r++<32?(e.consume(n),t):(r=0,s(n))}(t)):s(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||null!==r&&(r<32||127===r)?n(r):(e.consume(r),o)}function s(t){return 64===t?(e.consume(t),l):v8(t)?(e.consume(t),s):n(t)}function l(i){return v6(i)?function i(a){return 46===a?(e.consume(a),r=0,l):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||v6(a))&&r++<63){let n=45===a?t:i;return e.consume(a),n}return n(a)}(a)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,a,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),w):63===t?(e.consume(t),y):v4(t)?(e.consume(t),N):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,f):v4(t)?(e.consume(t),x):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):xt(t)?(a=u,O(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),h):u(t)}function h(e){return 62===e?A(e):45===e?d(e):u(e)}function f(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?p:f):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),g):xt(t)?(a=p,O(t)):(e.consume(t),p)}function g(t){return 93===t?(e.consume(t),v):p(t)}function v(t){return 62===t?A(t):93===t?(e.consume(t),v):p(t)}function x(t){return null===t||62===t?A(t):xt(t)?(a=x,O(t)):(e.consume(t),x)}function y(t){return null===t?n(t):63===t?(e.consume(t),b):xt(t)?(a=y,O(t)):(e.consume(t),y)}function b(e){return 62===e?A(e):y(e)}function w(t){return v4(t)?(e.consume(t),j):n(t)}function j(t){return 45===t||v6(t)?(e.consume(t),j):function t(n){return xt(n)?(a=t,O(n)):xr(n)?(e.consume(n),t):A(n)}(t)}function N(t){return 45===t||v6(t)?(e.consume(t),N):47===t||62===t||xn(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),A):58===t||95===t||v4(t)?(e.consume(t),E):xt(t)?(a=k,O(t)):xr(t)?(e.consume(t),k):A(t)}function E(t){return 45===t||46===t||58===t||95===t||v6(t)?(e.consume(t),E):function t(n){return 61===n?(e.consume(n),C):xt(n)?(a=t,O(n)):xr(n)?(e.consume(n),t):k(n)}(t)}function C(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,_):xt(t)?(a=C,O(t)):xr(t)?(e.consume(t),C):(e.consume(t),S)}function _(t){return t===r?(e.consume(t),r=void 0,T):null===t?n(t):xt(t)?(a=_,O(t)):(e.consume(t),_)}function S(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||xn(t)?k(t):(e.consume(t),S)}function T(e){return 47===e||62===e||xn(e)?k(e):n(e)}function A(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function O(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),M}function M(t){return xr(t)?xa(e,P,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):P(t)}function P(t){return e.enter("htmlTextData"),a(t)}}}],91:x4,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return xt(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},x_],93:x0,95:xk,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),a++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",s(o))}(l)):xt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||xt(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var yn=e.i(4127);let yr=/[\0\t\n\r]/g;function yi(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let ya=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function yo(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return yi(n.slice(t?2:1),t?16:10)}return xT(n)||e}let ys={}.hasOwnProperty;function yl(e){return{line:e.line,column:e.column,offset:e.offset}}function yc(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+vE({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vE({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+vE({start:t.start,end:t.end})+") is still open")}function yu(e){let t=this;t.parser=function(n){var r,i;let a,o,s,l;return"string"!=typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(x),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(p),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(f),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(f,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(g),hardBreakTrailing:r(g),htmlFlow:r(v,i),htmlFlowData:c,htmlText:r(v,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(x),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(y),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(p),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){u.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){u.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:u,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=yi(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=xT(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=yl(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:u,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:u,data:u,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=x$(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:u,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:u,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(ya,yo),n.identifier=x$(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=yl(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),u.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=x$(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(ys.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:a,exit:s,buffer:i,resume:l,data:n},c=[],u=-1;for(;++u<e.length;)("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)&&("enter"===e[u][0]?c.push(u):u=function(e,t,n){let r,i,a,o,s=t-1,l=-1,c=!1;for(;++s<=n;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||a||(a=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=s;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}a&&(!i||a<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||s,0,["exit",r,t[2]]),s++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(s,0,["enter",i,t[2]]),s++,n++,a=void 0,o=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),u));for(u=-1;++u<e.length;){let n=t[e[u][0]];ys.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||yc).call(o,void 0,e[0])}for(r.position={start:yl(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:yl(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r};function r(e,t){return function(n){a.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:yl(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||yc).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+vE({start:e.start,end:e.end})+"): it’s not open");n.position.end=yl(e.end)}function l(){return vY(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:yl(e.start),end:void 0},t.push(n)),this.stack.push(n)}function u(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=yl(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function v(){return{type:"html",value:""}}function x(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!xc(e););return e}((function(e){let t={constructs:vZ([yn,...(e||{}).extensions||[]]),content:n(v2),defined:[],document:n(v5),flow:n(xh),lazy:{},string:n(xp),text:n(xm)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],l={attempt:p(function(e,t){g(e,t.from)}),check:p(f),consume:function(e){vQ(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),s.push(n),n},exit:function(e){let t=s.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:p(f,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a,o=e[r];if("string"==typeof o)a=o;else switch(o){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":" ";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(o)}n=-2===o,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=vq(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),u=u(t)}else u=u(n)}}(),null!==o[o.length-1])?[]:(g(t,0),c.events=xN(a,c.events,c),c.events)}},u=t.tokenize.call(c,l);return t.resolveAll&&a.push(t),c;function d(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,o)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[a].slice(0,o))}return n}(o,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e,t){t.restore()}function p(e,t){return function(n,i,a){var o;let u,d,f,p;return Array.isArray(n)?g(n):"tokenize"in n?g([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return g([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function g(e){return(u=e,d=0,0===e.length)?a:x(e[d])}function x(e){return function(n){let i,a,o,u,d;return(i=h(),a=c.previous,o=c.currentConstruct,u=c.events.length,d=Array.from(s),p={from:u,restore:function(){r=i,c.previous=a,c.currentConstruct=o,c.events.length=u,s=d,v()}},f=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,y,b)(n)}}function y(t){return e(f,p),i}function b(e){return(p.restore(),++d<u.length)?x(u[d]):a}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&v$(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,s="",l=!0,function(e,t,n){let r,i,c,u,d,h=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,s="",l&&(65279===e.charCodeAt(0)&&c++,l=void 0);c<e.length;){if(yr.lastIndex=c,u=(r=yr.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(u),!r){s=e.slice(c);break}if(10===d&&c===u&&a)h.push(-3),a=void 0;else switch(a&&(h.push(-5),a=void 0),c<u&&(h.push(e.slice(c,u)),o+=u-c),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:a=!0,o=1}c=u+1}return n&&(a&&h.push(-5),s&&h.push(s),h.push(null)),h})(n,r,!0))))}}let yd="object"==typeof self?self:globalThis,yh=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new yd[e](t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new yd[a](o),i)})(0)},{toString:yf}={},{keys:yp}=Object,ym=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=yf.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},yg=([e,t])=>0===e&&("function"===t||"symbol"===t),yv=(e,{json:t,lossy:n}={})=>{var r,i,a;let o,s,l=[];return(r=!(t||n),i=!!t,a=new Map,o=(e,t)=>{let n=l.push(e)-1;return a.set(t,n),n},s=e=>{if(a.has(e))return a.get(e);let[t,n]=ym(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(s(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return s(e.toJSON());let a=[],l=o([t,a],e);for(let t of yp(e))(r||!yg(ym(e[t])))&&a.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(yg(ym(t))||yg(ym(i))))&&n.push([s(t),s(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!yg(ym(t)))&&n.push(s(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},yx="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?yh(yv(e,t)):structuredClone(e):(e,t)=>yh(yv(e,t));yb(/[A-Za-z]/);let yy=yb(/[\dA-Za-z]/);function yb(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function yw(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o="";if(37===a&&yy(e.charCodeAt(n+1))&&yy(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function yj(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function yN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}yb(/[#-'*+\--9=?A-Z^-~]/),yb(/\d/),yb(/[\dA-Fa-f]/),yb(/[!-/:-@[-`{-~]/),yb(/\p{P}|\p{S}/u),yb(/\s/);let yk=function(e){var t,n;if(null==e)return yC;if("function"==typeof e)return yE(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=yk(e[n]);return yE(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,yE(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,yE(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function yE(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function yC(){return!0}let y_=[];function yS(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let a=yk(i),o=r?-1:1;(function e(i,s,l){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return u;function u(){var c;let u,d,h,f=y_;if((!t||a(i,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(c=n(i,l))?c:"number"==typeof c?[!0,c]:null==c?y_:[c])[0])return f;if("children"in i&&i.children&&i.children&&"skip"!==f[0])for(d=(r?i.children.length:-1)+o,h=l.concat(i);d>-1&&d<i.children.length;){if(!1===(u=e(i.children[d],d,h)())[0])return u;d="number"==typeof u[1]?u[1]:d+o}return f}})(e,void 0,[])()}function yT(e,t,n,r){let i,a,o;"function"==typeof t&&"function"!=typeof n?(a=void 0,o=t,i=n):(a=t,o=n,i=r),yS(e,a,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}function yA(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),a=i[0];a&&"text"===a.type?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function yO(e){let t=e.spread;return null==t?e.children.length>1:t}function yM(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let yP={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=yw(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),s=e.footnoteCounts.get(i);void 0===s?(s=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yA(e,t);let i={src:yw(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){let n={src:yw(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yA(e,t);let i={href:yw(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){let n={href:yw(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=yO(n[r])}return t}(n):yO(t),a={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<r.length;){let e=r[s];(i||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=vN(t.children[1]),o=vj(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",a=n&&"table"===n.type?n.align:void 0,o=a?a.length:t.children.length,s=-1,l=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(yM(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(yM(t.slice(i),i>0,!1)),a.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:yD,yaml:yD,definition:yD,footnoteDefinition:yD};function yD(){}let yL={}.hasOwnProperty,yI={};function yR(e,t){e.position&&(t.position=function(e){let t=vN(e),n=vj(e);if(t&&n)return{start:t,end:n}}(e))}function yB(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,yx(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function yz(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function yF(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function yV(e,t){let n,r,i,a,o=(n=t||yI,r=new Map,i=new Map,a={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=yF(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=yF(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:yB,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...yP,...n.handlers},one:function(e,t){let n=e.type,r=a.handlers[n];if(yL.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=yx(n);return r.children=a.all(e),r}return yx(e)}return(a.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(yL.call(n,"hProperties")||yL.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(a,e,t)},options:n,patch:yR,wrap:yz},yT(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||yj,r=e.options.footnoteBackLabel||yN,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),c=yw(o.toLowerCase()),u=0,d=[],h=e.footnoteCounts.get(o);for(;void 0!==h&&++u<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=a[a.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else a.push(...d);let p={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(a,!0)};e.patch(i,p),s.push(p)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...yx(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(gW("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function yU(e,t){return e&&"run"in e?async function(n,r){let i=yV(n,{file:r,...t});await e.run(i,r)}:function(n,r){return yV(n,{file:r,...e||t})}}function yH(e){if(e)throw e}var yW=e.i(4100);function yY(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let yG=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');yK(e);let r=0,i=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,s=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else o<0&&(n=!0,o=a+1),s>-1&&(e.codePointAt(a)===t.codePointAt(s--)?s<0&&(i=a):(s=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},yX=function(e){let t;if(yK(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},y$=function(e){let t;yK(e);let n=e.length,r=-1,i=0,a=-1,o=0;for(;n--;){let s=e.codePointAt(n);if(47===s){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===s?a<0?a=n:1!==o&&(o=1):a>-1&&(o=-1)}return a<0||r<0||0===o||1===o&&a===r-1&&a===i+1?"":e.slice(a,r)},yq=function(...e){var t;let n,r,i,a=-1;for(;++a<e.length;)yK(e[a]),e[a]&&(i=void 0===i?e[a]:i+"/"+e[a]);return void 0===i?".":(yK(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",a=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(i.length<2||2!==a||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",a=0):a=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,s=0;continue}}else if(i.length>0){i="",a=0,o=l,s=0;continue}}t&&(i=i.length>0?i+"/..":"..",a=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else 46===n&&s>-1?s++:s=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function yK(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function yZ(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let yQ=["history","path","basename","stem","extname","dirname"];class yJ{constructor(e){let t,n;t=e?yZ(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<yQ.length;){const e=yQ[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)yQ.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?yG(this.path):void 0}set basename(e){y1(e,"basename"),y0(e,"basename"),this.path=yq(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?yX(this.path):void 0}set dirname(e){y2(this.basename,"dirname"),this.path=yq(e||"",this.basename)}get extname(){return"string"==typeof this.path?y$(this.path):void 0}set extname(e){if(y0(e,"extname"),y2(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=yq(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){yZ(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!yZ(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),y1(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?yG(this.path,this.extname):void 0}set stem(e){y1(e,"stem"),y0(e,"stem"),this.path=yq(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new vT(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function y0(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function y1(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function y2(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let y5=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},y3={}.hasOwnProperty;class y4 extends y5{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(a,...o){let s=e[++n],l=-1;if(a)return void r(a);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let n;return function(...t){let a,o=e.length>t.length;o&&t.push(r);try{a=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(a&&a.then&&"function"==typeof a.then?a.then(i,r):a instanceof Error?r(a):i(a))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(s,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new y4,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,yW.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(y9("data",this.frozen),this.namespace[e]=t,this):y3.call(this.namespace,e)&&this.namespace[e]||void 0:e?(y9("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=bn(e),n=this.parser||this.Parser;return y8("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),y8("process",this.parser||this.Parser),y7("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=bn(e),o=n.parse(a);function s(e,n){e||!n?i(e):r?r(n):(gW(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(o,a,function(e,t,r){var i,a;if(e||!t||!r)return s(e);let o=n.stringify(t,r);"string"==typeof(i=o)||(a=i)&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a?r.value=o:r.result=o,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),y8("processSync",this.parser||this.Parser),y7("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,yH(e),t=r}),bt("processSync","process",n),gW(t,"we either bailed on an error or have a tree"),t}run(e,t,n){be(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){gW("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=bn(t);r.run(e,o,function(t,r,o){let s=r||e;t?a(t):i?i(s):(gW(n,"`done` is defined if `resolve` is not"),n(void 0,s,o))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){yH(e),n=t,r=!0}),bt("runSync","run",r),gW(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=bn(t),r=this.compiler||this.Compiler;return y7("stringify",r),be(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(y9("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?a(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(e.plugins),e.settings&&(r.settings=(0,yW.default)(!0,r.settings,e.settings))}function a(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];yY(o)&&yY(r)&&(r=(0,yW.default)(!0,o,r)),n[i]=[e,r,...a]}}}}let y6=new y4().freeze();function y8(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function y7(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function y9(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function be(e){if(!yY(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function bt(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function bn(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new yJ(e)}let br=[],bi={allowDangerousHtml:!0},ba=/^(https?|ircs?|mailto|xmpp)$/i,bo=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function bs(e){var t;let n,r,i,a,o,s=(n=(t=e).rehypePlugins||br,r=t.remarkPlugins||br,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...bi}:bi,y6().use(yu).use(r).use(yU,i).use(n)),l=(a=e.children||"",o=new yJ,"string"==typeof a?o.value=a:gY("Unexpected value `"+a+"` for `children` prop, expected `string`"),o);return function(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||bl;for(let e of bo)Object.hasOwn(t,e.from)&&gY("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return n&&a&&gY("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),yT(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return o?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in vH)if(Object.hasOwn(vH,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=vH[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let o=n?!n.includes(e.tagName):!!a&&a.includes(e.tagName);if(!o&&r&&"number"==typeof t&&(o=!r(e,t,i)),o&&i&&"number"==typeof t)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var n,r,i,a;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=s,r=t.jsxDEV,o=function(e,t,i,a){let o=Array.isArray(i.children),s=vN(e);return r(t,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:n,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,a=t.jsxs,o=function(e,t,n,r){let o=Array.isArray(n.children)?a:i;return r?o(t,n,r):o(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?vb:vy,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=vI(l,e,void 0);return c&&"string"!=typeof c?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}(e,{Fragment:ep.Fragment,components:i,ignoreInvalidStyle:!0,jsx:ep.jsx,jsxs:ep.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function bl(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||ba.test(e.slice(0,t))?e:""}function bc(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}bh(/[A-Za-z]/),bh(/[\dA-Za-z]/),bh(/[#-'*+\--9=?A-Z^-~]/),bh(/\d/),bh(/[\dA-Fa-f]/),bh(/[!-/:-@[-`{-~]/);let bu=bh(/\p{P}|\p{S}/u),bd=bh(/\s/);function bh(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let bf="phrasing",bp=["autolink","link","image","label"];function bm(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bg(e){this.config.enter.autolinkProtocol.call(this,e)}function bv(e){this.config.exit.autolinkProtocol.call(this,e)}function bx(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];gW("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function by(e){this.config.exit.autolinkEmail.call(this,e)}function bb(e){this.exit(e)}function bw(e){!function(e,t,n){let r=yk((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<i.length;)yS(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){let e=t[o],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,l=n.children.indexOf(e),c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(s!==n&&u.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(s<e.value.length&&u.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...u)):u=[e],l+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bj],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bN]],{ignore:["link","linkReference"]})}function bj(e,t,n,r,i){let a,o="";if(!bk(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),(a=n.split(".")).length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=bc(e,"("),a=bc(e,")");for(;-1!==r&&i>a;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),a++;return[e,n]}(n+r);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function bN(e,t,n,r){return!(!bk(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bk(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||bd(n)||bu(n))&&(!t||47!==n)}function bE(){this.buffer()}function bC(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function b_(){this.buffer()}function bS(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bT(e){let t=this.resume(),n=this.stack[this.stack.length-1];gW("footnoteReference"===n.type),n.identifier=x$(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bA(e){this.exit(e)}function bO(e){let t=this.resume(),n=this.stack[this.stack.length-1];gW("footnoteDefinition"===n.type),n.identifier=x$(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bM(e){this.exit(e)}function bP(e,t,n,r){let i=n.createTracker(r),a=i.move("[^"),o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]")}function bD(e,t,n){return 0===t?e:bL(e,t,n)}function bL(e,t,n){return(n?"":" ")+e}bP.peek=function(){return"["};let bI=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function bR(e){this.enter({type:"delete",children:[]},e)}function bB(e){this.exit(e)}function bz(e,t,n,r){let i=n.createTracker(r),a=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function bF(e){return e.length}function bV(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}bz.peek=function(){return"~"};function bU(e,t,n){let r=e.value||"",i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){let e,t=n.unsafe[a],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}bU.peek=function(){return"`"};yk(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let bH=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),a=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let o=a.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=n.createTracker(r);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,s.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?a:a+" ".repeat(o-a.length))+e});return l(),c};function bW(e){let t=e._align;gW(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function bY(e){this.exit(e),this.data.inTable=void 0}function bG(e){this.enter({type:"tableRow",children:[]},e)}function bX(e){this.exit(e)}function b$(e){this.enter({type:"tableCell",children:[]},e)}function bq(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,bK));let n=this.stack[this.stack.length-1];gW("inlineCode"===n.type),n.value=t,this.exit(e)}function bK(e,t){return"|"===t?t:e}function bZ(e){let t=this.stack[this.stack.length-2];gW("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function bQ(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];gW("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,i=t.children,a=-1;for(;++a<i.length;){let e=i[a];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function bJ(e,t,n,r){let i=e.children[0],a="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);a&&s.move(o);let l=bH(e,t,n,{...r,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let b0=b4(/[A-Za-z]/),b1=b4(/[\dA-Za-z]/);function b2(e){return null!==e&&(e<0||32===e)}b4(/[#-'*+\--9=?A-Z^-~]/),b4(/\d/),b4(/[\dA-Fa-f]/),b4(/[!-/:-@[-`{-~]/);let b5=b4(/\p{P}|\p{S}/u),b3=b4(/\s/);function b4(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let b6={tokenize:function(e,t,n){let r=0;return function t(a){return(87===a||119===a)&&r<3?(r++,e.consume(a),t):46===a&&3===r?(e.consume(a),i):n(a)};function i(e){return null===e?n(e):t(e)}},partial:!0},b8={tokenize:function(e,t,n){let r,i,a;return o;function o(t){return 46===t||95===t?e.check(b9,l,s)(t):null===t||b2(t)||b3(t)||45!==t&&b5(t)?l(t):(a=!0,e.consume(t),o)}function s(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),o}function l(e){return i||r||!a?n(e):t(e)}},partial:!0},b7={tokenize:function(e,t){let n=0,r=0;return i;function i(o){return 40===o?(n++,e.consume(o),i):41===o&&r<n?a(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(b9,t,a)(o):null===o||b2(o)||b3(o)?t(o):(e.consume(o),i)}function a(t){return 41===t&&r++,e.consume(t),i}},partial:!0},b9={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),a):93===o?(e.consume(o),i):60===o||null===o||b2(o)||b3(o)?t(o):n(o)}function i(e){return null===e||40===e||91===e||b2(e)||b3(e)?t(e):r(e)}function a(t){return b0(t)?function t(i){return 59===i?(e.consume(i),r):b0(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},we={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return b1(e)?n(e):t(e)}},partial:!0},wt={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!wo.call(r,r.previous)||wu(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(b6,e.attempt(b8,e.attempt(b7,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:wo},wn={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",a=!1;return function(t){return(72===t||104===t)&&ws.call(r,r.previous)&&!wu(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):n(t)};function o(t){if(b0(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),s}return n(t)}function s(t){return 47===t?(e.consume(t),a)?l:(a=!0,s):n(t)}function l(t){return null===t||null!==t&&(t<32||127===t)||b2(t)||b3(t)||b5(t)?n(t):e.attempt(b8,e.attempt(b7,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:ws},wr={name:"emailAutolink",tokenize:function(e,t,n){let r,i,a=this;return function(t){return!wc(t)||!wl.call(a,a.previous)||wu(a.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return wc(r)?(e.consume(r),t):64===r?(e.consume(r),o):n(r)}(t))};function o(t){return 46===t?e.check(we,l,s)(t):45===t||95===t||b1(t)?(i=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),r=!0,o}function l(o){return i&&r&&b0(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:wl},wi={},wa=48;for(;wa<123;)wi[wa]=wr,58==++wa?wa=65:91===wa&&(wa=97);function wo(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||b2(e)}function ws(e){return!b0(e)}function wl(e){return!(47===e||wc(e))}function wc(e){return 43===e||45===e||46===e||95===e||b1(e)}function wu(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function wd(e){return null!==e&&(e<0||32===e)}function wh(e){return -2===e||-1===e||32===e}function wf(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wp(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return wh(r)?(e.enter(n),function r(o){return wh(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}wi[43]=wr,wi[45]=wr,wi[46]=wr,wi[95]=wr,wi[72]=[wr,wn],wi[104]=[wr,wn],wi[87]=[wr,wt],wi[119]=[wr,wt],wf(/[A-Za-z]/),wf(/[\dA-Za-z]/),wf(/[#-'*+\--9=?A-Z^-~]/),wf(/\d/),wf(/[\dA-Fa-f]/),wf(/[!-/:-@[-`{-~]/),wf(/\p{P}|\p{S}/u),wf(/\s/);let wm={tokenize:function(e,t,n){let r=this;return wp(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function wg(e,t,n){let r,i=this,a=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;a--;){let e=i.events[a][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!r||!r._balanced)return n(a);let s=x$(i.sliceSerialize({start:r.end,end:i.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):n(a)}}function wv(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function wx(e,t,n){let r,i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!r||null===s||91===s||wd(s))return n(s);if(93===s){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return a.includes(x$(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return wd(s)||(r=!0),o++,e.consume(s),92===s?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function wy(e,t,n){let r,i,a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(s>999||93===t&&!i||null===t||91===t||wd(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=x$(a.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return wd(t)||(i=!0),s++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),s++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(r)||o.push(r),wp(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function wb(e,t,n){return e.check(xo,t,e.attempt(wm,t,n))}function ww(e){e.exit("gfmFootnoteDefinition")}function wj(e){return null!==e&&e<-2}function wN(e){return null!==e&&(e<0||32===e)}function wk(e){return -2===e||-1===e||32===e}function wE(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wC(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return wk(r)?(e.enter(n),function r(o){return wk(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}wE(/[A-Za-z]/),wE(/[\dA-Za-z]/),wE(/[#-'*+\--9=?A-Z^-~]/),wE(/\d/),wE(/[\dA-Fa-f]/),wE(/[!-/:-@[-`{-~]/),wE(/\p{P}|\p{S}/u),wE(/\s/);class w_{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function wS(e,t,n){let r,i=this,a=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,a="tableHead"===r||"tableRow"===r?y:s;return a===y&&i.parser.lazy[i.now().line]?n(e):a(e)};function s(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,o+=1),l(n)}function l(t){return null===t?n(t):wj(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):wk(t)?wC(e,l,"whitespace")(t):(o+=1,r&&(r=!1,a+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,l):(e.enter("data"),c(t))}function c(t){return null===t||124===t||wN(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,wk(t))?wC(e,h,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t)}function h(t){return 45===t||58===t?p(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return wk(t)?wC(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(o+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(o+=1,g(t)):null===t||wj(t)?x(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(n))}(t)):n(t)}function v(t){return wk(t)?wC(e,x,"whitespace")(t):x(t)}function x(i){if(124===i)return h(i);if(null===i||wj(i))return r&&a===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function y(t){return e.enter("tableRow"),b(t)}function b(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),b):null===n||wj(n)?(e.exit("tableRow"),t(n)):wk(n)?wC(e,b,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||wN(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?j:w)}function j(t){return 92===t||124===t?(e.consume(t),w):w(t)}}function wT(e,t){let n,r,i,a=-1,o=!0,s=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0,h=new w_;for(;++a<e.length;){let f=e[a],p=f[1];"enter"===f[0]?"tableHead"===p.type?(u=!1,0!==d&&(wO(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(o=!0,i=void 0,l=[0,0,0,0],c=[0,a+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",r,t]])),s="tableDelimiterRow"===p.type?2:r?3:1):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)?(o=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=wA(h,t,l,s,void 0,i),l=[0,0,0,0]),c[2]=a)):"tableCellDivider"===p.type&&(o?o=!1:(0!==l[1]&&(c[0]=c[1],i=wA(h,t,l,s,void 0,i)),c=[(l=c)[1],a,0,0])):"tableHead"===p.type?(u=!0,d=a):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=a,0!==l[1]?(c[0]=c[1],i=wA(h,t,l,s,a,i)):0!==c[1]&&(i=wA(h,t,c,s,a,i)),s=0):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(c[3]=a)}for(0!==d&&wO(h,t,d,n,r),h.consume(t.events),a=-1;++a<t.events.length;){let e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,a))}return e}function wA(e,t,n,r,i,a){0!==n[0]&&(a.end=Object.assign({},wM(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));let o=wM(t.events,n[1]);if(a={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",a,t]]),0!==n[2]){let i=wM(t.events,n[2]),a=wM(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(a.end=Object.assign({},wM(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function wO(e,t,n,r,i){let a=[],o=wM(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function wM(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}function wP(e){return -2===e||-1===e||32===e}function wD(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}wD(/[A-Za-z]/),wD(/[\dA-Za-z]/),wD(/[#-'*+\--9=?A-Z^-~]/),wD(/\d/),wD(/[\dA-Fa-f]/),wD(/[!-/:-@[-`{-~]/),wD(/\p{P}|\p{S}/u),wD(/\s/);let wL={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return null!==t&&(t<0||32===t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),a):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),a):n(t)}function a(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return null!==r&&r<-2?t(r):wP(r)?e.check({tokenize:wI},t,n)(r):n(r)}}};function wI(e,t,n){var r,i;let a,o;return r=function(e){return null===e?n(e):t(e)},i="whitespace",a=1/0,o=0,function(t){return wP(t)?(e.enter(i),function t(n){return wP(n)&&o++<a?(e.consume(n),t):(e.exit(i),r(n))}(t)):r(t)}}let wR={};function wB(e){let t,n,r,i=e||wR,a=this.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),s=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(vZ([{text:wi},{document:{91:{name:"gfmFootnoteDefinition",tokenize:wy,continuation:{tokenize:wb},exit:ww}},text:{91:{name:"gfmFootnoteCall",tokenize:wx},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wg,resolveTo:wv}}},(t=(i||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,a=this.events,o=0;return function(s){return 126===i&&"characterEscape"!==a[a.length-1][1].type?r(s):(e.enter("strikethroughSequenceTemporary"),function a(s){let l=xj(i);if(126===s)return o>1?r(s):(e.consume(s),o++,a);if(o<2&&!t)return r(s);let c=e.exit("strikethroughSequenceTemporary"),u=xj(s);return c._open=!u||2===u&&!!l,c._close=!l||2===l&&!!u,n(s)}(s))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",a,t]],s=t.parser.constructs.insideSpan.null;s&&v$(o,o.length,0,xN(s,e.slice(r+1,n),t)),v$(o,o.length,0,[["exit",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),v$(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:wS,resolveAll:wT}}},{text:{91:wL}}])),s.push([{transforms:[bw],enter:{literalAutolink:bm,literalAutolinkEmail:bg,literalAutolinkHttp:bg,literalAutolinkWww:bg},exit:{literalAutolink:bb,literalAutolinkEmail:by,literalAutolinkHttp:bv,literalAutolinkWww:bx}},{enter:{gfmFootnoteCallString:bE,gfmFootnoteCall:bC,gfmFootnoteDefinitionLabelString:b_,gfmFootnoteDefinition:bS},exit:{gfmFootnoteCallString:bT,gfmFootnoteCall:bA,gfmFootnoteDefinitionLabelString:bO,gfmFootnoteDefinition:bM}},{canContainEols:["delete"],enter:{strikethrough:bR},exit:{strikethrough:bB}},{enter:{table:bW,tableData:b$,tableHeader:b$,tableRow:bG},exit:{codeText:bq,table:bY,tableData:bX,tableHeader:bX,tableRow:bX}},{exit:{taskListCheckValueChecked:bZ,taskListCheckValueUnchecked:bZ,paragraph:bQ}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bf,notInConstruct:bp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bf,notInConstruct:bp},{character:":",before:"[ps]",after:"\\/",inConstruct:bf,notInConstruct:bp}]},(r=!1,i&&i.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,t,n,i){let a=n.createTracker(i),o=a.move("[^"),s=n.enter("footnoteDefinition"),l=n.enter("label");return o+=a.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,a.current()),r?bL:bD))),s(),o},footnoteReference:bP},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:bI}],handlers:{delete:bz}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=bU(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return s(function(e,t,n){let r=e.children,i=-1,a=[],o=t.enter("table");for(;++i<r.length;)a[i]=l(r[i],t,n);return o(),a}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=s([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function s(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||bF,a=[],o=[],s=[],l=[],c=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>c&&(c=e[u].length);++a<e[u].length;){var d;let o=null==(d=e[u][a])?"":String(d);if(!1!==n.alignDelimiters){let e=i(o);r[a]=e,(void 0===l[a]||e>l[a])&&(l[a]=e)}t.push(o)}o[u]=t,s[u]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<c;)a[h]=bV(r[h]);else{let e=bV(r);for(;++h<c;)a[h]=e}h=-1;let f=[],p=[];for(;++h<c;){let e=a[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),p[h]=i),f[h]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let g=[];for(;++u<o.length;){let e=o[u],t=s[u];h=-1;let r=[];for(;++h<c;){let i=e[h]||"",o="",s="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=a[h];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(s),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==c-1)&&r.push("|")}g.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return g.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,a=[],s=t.enter("tableRow");for(;++i<r.length;)a[i]=o(r[i],e,t,n);return s(),a}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:bJ}}]})}function wz({children:e,className:t}){return(0,ep.jsx)("div",{className:(0,eO.cn)("text-[13px] leading-6 text-foreground/90 space-y-2 [&>:first-child]:mt-0",t),children:(0,ep.jsx)(bs,{remarkPlugins:[wB],components:{h1:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h2:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h3:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),h4:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),p:e=>(0,ep.jsx)("p",{className:"my-1.5",...e}),ul:e=>(0,ep.jsx)("ul",{className:"list-disc pl-5 my-1.5 space-y-0.5",...e}),ol:e=>(0,ep.jsx)("ol",{className:"list-decimal pl-5 my-1.5 space-y-0.5",...e}),li:e=>(0,ep.jsx)("li",{className:"leading-6",...e}),strong:e=>(0,ep.jsx)("strong",{className:"font-semibold text-foreground",...e}),code:e=>(0,ep.jsx)("code",{className:"text-[12px] font-mono bg-muted/70 px-1 py-0.5 rounded",...e}),a:e=>(0,ep.jsx)("a",{className:"text-primary underline",...e}),table:e=>(0,ep.jsx)("div",{className:"overflow-x-auto my-2",children:(0,ep.jsx)("table",{className:"text-[12px] border-collapse",...e})}),th:e=>(0,ep.jsx)("th",{className:"text-left font-semibold px-2 py-1 border-b border-border",...e}),td:e=>(0,ep.jsx)("td",{className:"px-2 py-1 border-b border-border/50",...e})},children:e})})}var wF=e.i(59411),tV=tV;function wV({directiveId:e,onClose:t}){let n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(null),[o,s]=(0,em.useState)(!1),[l,c]=(0,em.useState)(null);(0,em.useEffect)(()=>{e&&r&&(async()=>{s(!0),c(null),a(null);try{let t=await eD.client.getDirective(r,e);a(t)}catch(e){console.error("Error loading directive:",e),c(e.message)}finally{s(!1)}})()},[e,r]);let u=null!==e;return(0,ep.jsx)(tH.Dialog,{open:u,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,ep.jsx)(wF.VisuallyHidden,{children:(0,ep.jsx)(tH.DialogTitle,{children:"Directive Details"})}),o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)(tV.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):l?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",l]})})}):i?(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-6",children:[(0,ep.jsxs)("div",{className:"pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:i.name}),!i.is_active&&(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-red-500/10 text-red-600 dark:text-red-400 text-xs font-medium",children:"Inactive"})]}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground/70",children:i.id})]}),(0,ep.jsxs)("div",{className:"flex gap-8",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:(n=new Date(i.created_at),`${n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Priority"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:i.priority})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Content"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bs,{remarkPlugins:[wB],children:i.content})})]}),i.tags&&i.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.tags.map((e,t)=>(0,ep.jsx)("span",{className:"px-2 py-0.5 bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded text-xs",children:e},t))})]})]}):null]})})}function wU(e){let t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(60>Math.abs(n))return n>=0?"just now":"in a moment";let r=n,i="second";for(let[e,t]of[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[1/0,"year"]]){if(Math.abs(r)<e)break;r/=e,i=t}return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-Math.round(r),i)}function wH(e){let t=new Date(e);return`${t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}function wW(e){return"directives"===e?{label:"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===e?{label:"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===e?{label:"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===e?{label:"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:"observation"===e?{label:"observation",color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"}:{label:e,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"}}let wY=["observation","experience","world","directives","mental-models"];function wG({based_on:e,onViewMemory:t,onViewDirective:n}){let r=(0,em.useMemo)(()=>{if(!e)return[];let t=Object.entries(e).map(([e,t])=>({factType:e,facts:t??[]})).filter(e=>e.facts.length>0);return t.sort((e,t)=>{let n=wY.indexOf(e.factType),r=wY.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),t},[e]);return 0===r.length?(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No based_on data."}):(0,ep.jsx)("div",{className:"space-y-4",children:r.map(e=>{let r=wW(e.factType);return(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${r.color}`,children:r.label}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.facts.length})]}),(0,ep.jsx)("ul",{className:"divide-y divide-border/50",children:e.facts.map((r,i)=>{let a="directives"===e.factType&&!!n||"directives"!==e.factType&&"mental-models"!==e.factType&&!!t;return(0,ep.jsxs)("li",{className:"group flex items-start gap-3 px-3 py-2 hover:bg-muted/30",children:[(0,ep.jsxs)("p",{className:"text-sm text-foreground leading-relaxed flex-1 min-w-0",children:[r.text,r.context&&(0,ep.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5",children:r.context})]}),a&&(0,ep.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===e.factType?n?.(r.id):t?.(r.id)},children:"View →"})]},r.id||i)})})]},e.factType)})})}function wX(e){return e.match(/\s+|[A-Za-z0-9_]+|[^\s\w]/g)||[]}function w$(e){return/^\s+$/.test(e)?" ":e}function wq(e,t){return e.map((e,n)=>"same"===e.type?(0,ep.jsx)("span",{children:e.text},n):(0,ep.jsx)("span",{className:"left"===t?"bg-red-500/25 text-red-800 dark:text-red-300 rounded-sm px-0.5":"bg-green-500/25 text-green-800 dark:text-green-300 rounded-sm px-0.5",children:e.text},n))}function wK({before:e,after:t}){let{left:n,right:r}=function(e,t){let n=e.split("\n"),r=t.split("\n"),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=i,c=a;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(s.push({type:"same",text:n[l-1]}),l--,c--):c>0&&(0===l||o[l][c-1]>=o[l-1][c])?(s.push({type:"added",text:r[c-1]}),c--):(s.push({type:"removed",text:n[l-1]}),l--);s.reverse();let u=[],d=[],h=0;for(;h<s.length;){let e=s[h];if("same"===e.type){u.push({type:"same",spans:[{type:"same",text:e.text}]}),d.push({type:"same",spans:[{type:"same",text:e.text}]}),h++;continue}let t=[],n=[];for(;h<s.length&&"same"!==s[h].type;)"removed"===s[h].type?t.push(s[h].text):n.push(s[h].text),h++;let r=Math.max(t.length,n.length);for(let e=0;e<r;e++){let r=e<t.length?t[e]:null,i=e<n.length?n[e]:null;if(null!==r&&null!==i){let e=function(e,t){let n=wX(e),r=wX(t),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=w$(n[e-1])===w$(r[t-1])?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=[],c=i,u=a,d=[],h=[];for(;c>0||u>0;)if(c>0&&u>0&&w$(n[c-1])===w$(r[u-1]))d.push({type:"same",text:n[c-1]}),h.push({type:"same",text:r[u-1]}),c--,u--;else if(u>0&&(0===c||o[c][u-1]>=o[c-1][u])){let e=r[u-1];h.push({type:/^\s+$/.test(e)?"same":"added",text:e}),u--}else{let e=n[c-1];d.push({type:/^\s+$/.test(e)?"same":"removed",text:e}),c--}for(;d.length;)s.push(d.pop());for(;h.length;)l.push(h.pop());return{left:s,right:l}}(r,i),t=e.left.some(e=>"same"!==e.type)?"removed":"same",n=e.right.some(e=>"same"!==e.type)?"added":"same";u.push({type:t,spans:e.left}),d.push({type:n,spans:e.right})}else null!==r?(u.push({type:"removed",spans:[{type:"removed",text:r}]}),d.push({type:"same",spans:[{type:"same",text:""}]})):null!==i&&(u.push({type:"same",spans:[{type:"same",text:""}]}),d.push({type:"added",spans:[{type:"added",text:i}]}))}}return{left:u,right:d}}(e,t);return n.some(e=>"same"!==e.type)||r.some(e=>"same"!==e.type)?(0,ep.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border border border-border rounded-md overflow-hidden text-xs font-mono",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"px-3 py-1.5 bg-muted text-muted-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:"Before"}),n.map((e,t)=>(0,ep.jsx)("div",{className:`px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem] ${"removed"===e.type?"bg-red-500/5":""}`,children:wq(e.spans,"left")},t))]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"px-3 py-1.5 bg-muted text-muted-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:"After"}),r.map((e,t)=>(0,ep.jsx)("div",{className:`px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem] ${"added"===e.type?"bg-green-500/5":""}`,children:wq(e.spans,"right")},t))]})]}):(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"unchanged"})}function wZ({before:e,after:t,onViewMemory:n,onViewDirective:r}){let i=(0,em.useMemo)(()=>{let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]),r=[];for(let i of n){let n=(e?.[i]??[]).filter(Boolean),a=(t?.[i]??[]).filter(Boolean),o=new Set(n.map(e=>e.id)),s=new Set(a.map(e=>e.id)),l=a.filter(e=>!o.has(e.id)),c=n.filter(e=>!s.has(e.id)),u=a.filter(e=>o.has(e.id));(0!==l.length||0!==c.length||0!==u.length)&&r.push({factType:i,added:l,removed:c,kept:u})}return r.sort((e,t)=>{let n=wY.indexOf(e.factType),r=wY.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),r},[e,t]);if(0===i.length)return(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No based_on data."});let a=(e,t,i)=>(0,ep.jsxs)("li",{className:`group flex items-start gap-2 px-3 py-2 ${"added"===i?"bg-green-500/10 border-l-2 border-green-500":"removed"===i?"bg-red-500/10 border-l-2 border-red-500 text-muted-foreground line-through decoration-red-500/50":""}`,children:[(0,ep.jsx)("span",{className:`font-mono text-sm shrink-0 ${"added"===i?"text-green-600 dark:text-green-400":"removed"===i?"text-red-600 dark:text-red-400":"text-muted-foreground/40"}`,children:"added"===i?"+":"removed"===i?"−":" "}),(0,ep.jsxs)("p",{className:"text-sm leading-relaxed flex-1 min-w-0",children:[e.text,e.context&&(0,ep.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5 no-underline",children:e.context})]}),("directives"===t&&!!r||"directives"!==t&&"mental-models"!==t&&!!n)&&"removed"!==i&&(0,ep.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===t?r(e.id):n(e.id)},children:"View →"})]},`${i}-${e.id}`);return(0,ep.jsx)("div",{className:"space-y-4",children:i.map(e=>{let t=wW(e.factType);return(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${t.color}`,children:t.label}),e.added.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400",children:["+",e.added.length]}),e.removed.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-red-600 dark:text-red-400",children:["−",e.removed.length]}),e.kept.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.kept.length," kept"]})]}),(0,ep.jsxs)("ul",{className:"divide-y divide-border/40",children:[e.added.map(t=>a(t,e.factType,"added")),e.removed.map(t=>a(t,e.factType,"removed")),e.kept.map(t=>a(t,e.factType,"kept"))]})]},e.factType)})})}function wQ({history:e,currentContent:t,currentBasedOn:n,onViewMemory:r,onViewDirective:i}){let[a,o]=(0,em.useState)(0),s=e[a],l=0===a?t:e[a-1].previous_content??"",c=s.previous_reflect_response?.based_on,u=0===a?n:e[a-1].previous_reflect_response?.based_on,d=s.previous_reflect_response??null;return(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-a]})," →"," ",(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-a+1,0===a?" (current)":""]})," ","· changed ",new Date(s.changed_at).toLocaleString()]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:a===e.length-1,onClick:()=>o(a+1),children:(0,ep.jsx)(eS,{className:"h-3.5 w-3.5"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===a,onClick:()=>o(a-1),children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w3,{children:"Content diff"}),null!==s.previous_content?(0,ep.jsx)(wK,{before:s.previous_content,after:l}):(0,ep.jsx)("div",{className:"border border-border rounded-lg p-3",children:(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"Previous content not available"})})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w3,{children:"Based on diff"}),d?.based_on?(0,ep.jsx)(wZ,{before:c,after:u,onViewMemory:r,onViewDirective:i}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"Not captured for this version (recorded before reflect snapshots were tracked)."})]})]})}function wJ({mentalModelId:e,onClose:t,onEdit:n,onDelete:r,onRefreshed:i,initialTab:a="content"}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(a),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(null),[k,E]=(0,em.useState)(null),[C,_]=(0,em.useState)(!1);(0,em.useEffect)(()=>{e&&o&&(async()=>{u(!0),h(null),l(null),E(null),p(a);try{let t=await eD.client.getMentalModel(o,e);l(t)}catch(e){console.error("Error loading mental model:",e),h(e.message)}finally{u(!1)}})()},[e,o,a]),(0,em.useEffect)(()=>{"history"===f&&s&&o&&null===k&&(async()=>{_(!0);try{let e=await eD.client.getMentalModelHistory(o,s.id);E(e)}catch(e){console.error("Error loading mental model history:",e),E([])}finally{_(!1)}})()},[f,s,o,k]);let S=async()=>{if(o&&s){y(!0);try{let e=await eD.client.getMentalModel(o,s.id);l(e),E(null)}catch(e){console.error("Error reloading mental model:",e)}finally{y(!1)}}},T=async()=>{if(!o||!s)return;v(!0);let e=s.last_refreshed_at;try{await eD.client.refreshMentalModel(o,s.id);let t=0,n=async()=>{t++;try{let r=await eD.client.getMentalModel(o,s.id);if(r.last_refreshed_at!==e){l(r),E(null),i?.(r),v(!1);return}if(t>=120){v(!1),ev.toast.error("Refresh timeout",{description:"Refresh is taking longer than expected. Check the operations list for status."});return}setTimeout(n,1e3)}catch(e){console.error("Error polling mental model:",e),v(!1)}};setTimeout(n,1e3)}catch{v(!1)}},A=null!==e,O=s?.reflect_response?.based_on,M=O?Object.values(O).reduce((e,t)=>e+(t?.length??0),0):0;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tH.Dialog,{open:A,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tH.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,ep.jsx)(tH.DialogHeader,{className:"pr-10",children:(0,ep.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"truncate",children:s?.name??"Mental Model"}),s&&(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:S,disabled:x,title:"Reload data",children:(0,ep.jsx)(eU,{className:`h-3.5 w-3.5 ${x?"animate-spin":""}`})}),s?.trigger?.refresh_after_consolidation&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-500/10 text-green-600 dark:text-green-400 text-xs font-medium",children:[(0,ep.jsx)(gU,{className:"w-3 h-3"}),"Auto refresh"]})]})}),c?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsx)(tV.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):d?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",d]})})}):s?(0,ep.jsxs)(tY.Tabs,{value:f,onValueChange:e=>p(e),className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ep.jsxs)(tY.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ep.jsxs)(tY.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,ep.jsxs)(tY.TabsTrigger,{value:"configuration",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),"Configuration"]}),(0,ep.jsxs)(tY.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(tU,{className:"w-3.5 h-3.5"}),"History"]})]}),(0,ep.jsxs)(gk,{children:[(0,ep.jsx)(gC,{asChild:!0,children:(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:g,"aria-label":"Actions",children:(0,ep.jsx)(gH,{className:"h-4 w-4"})})}),(0,ep.jsxs)(gz,{align:"end",children:[n&&(0,ep.jsxs)(gF,{onClick:()=>n(s),children:[(0,ep.jsx)(po,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(gF,{onClick:T,disabled:g,children:[(0,ep.jsx)(eU,{className:"h-4 w-4 mr-2"}),"Refresh Manually"]}),r&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(gV,{}),(0,ep.jsxs)(gF,{onClick:()=>r(s),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(pa,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsxs)(tY.TabsContent,{value:"content",className:"mt-0 space-y-6",children:[(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),(0,ep.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:"Stored content"}),(0,ep.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",s.content.length.toLocaleString()," chars"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[!0===s.is_stale?(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-amber-500/15 text-amber-700 dark:text-amber-400",title:"New memories in this mental model's scope have been ingested since it was last refreshed",children:"Stale"}):!1===s.is_stale?(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-green-500/15 text-green-700 dark:text-green-400",title:"No new memories in this mental model's scope since it was last refreshed",children:"In sync"}):null,(0,ep.jsxs)("span",{title:wH(s.last_refreshed_at),className:"flex items-center gap-1",children:[(0,ep.jsx)(eU,{className:"w-3 h-3"}),"Last refreshed ",wU(s.last_refreshed_at)]})]})]}),(0,ep.jsx)(wz,{className:"p-4",children:s.content})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(w3,{children:["Based On",M>0?` (${M})`:""]}),s.reflect_response?(0,ep.jsx)(wG,{based_on:O,onViewMemory:e=>w(e),onViewDirective:e=>N(e)}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:'No source data available. Click "Refresh" to regenerate with source tracking.'})]})]}),(0,ep.jsx)(tY.TabsContent,{value:"configuration",className:"mt-0",children:(0,ep.jsx)(w5,{mentalModel:s})}),(0,ep.jsx)(tY.TabsContent,{value:"history",className:"mt-0",children:C?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tV.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):k&&k.length>0?(0,ep.jsx)(wQ,{history:k,currentContent:s.content,currentBasedOn:O,onViewMemory:e=>w(e),onViewDirective:e=>N(e)}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No history recorded yet."})})]})]}):null]})}),b&&(0,ep.jsx)(tQ,{memoryId:b,onClose:()=>w(null)}),j&&(0,ep.jsx)(wV,{directiveId:j,onClose:()=>N(null)})]})}function w0({label:e,value:t}){return(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w3,{children:e}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:t})]})}function w1({title:e,icon:t,children:n}){return(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t,e]}),(0,ep.jsx)("div",{className:"p-4 space-y-4",children:n})]})}function w2({label:e,color:t}){return(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-xs ${t??"bg-muted text-foreground border border-border/60"}`,children:e})}function w5({mentalModel:e}){let t=e.trigger??{refresh_after_consolidation:!1},n=t.fact_types??[],r=t.tag_groups??[],i=t.exclude_mental_model_ids??[];return(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsxs)(w1,{title:"Identity",icon:(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(w0,{label:"ID",value:(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:e.id})}),(0,ep.jsx)(w0,{label:"Name",value:e.name}),e.source_query&&(0,ep.jsx)(w0,{label:"Source Query",value:e.source_query}),(0,ep.jsx)(w0,{label:"Tags",value:e.tags?.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,ep.jsx)(w2,{label:e,color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"},e))}):(0,ep.jsx)("span",{className:"text-muted-foreground italic text-sm",children:"none"})})]}),(0,ep.jsxs)(w1,{title:"Timing",icon:(0,ep.jsx)(eU,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(w0,{label:"Created",value:wH(e.created_at)}),(0,ep.jsx)(w0,{label:"Last Refreshed",value:(0,ep.jsx)("span",{title:wH(e.last_refreshed_at),children:wU(e.last_refreshed_at)})}),(0,ep.jsx)(w0,{label:"Max Tokens",value:e.max_tokens.toLocaleString()})]}),(0,ep.jsxs)(w1,{title:"Refresh Trigger",icon:(0,ep.jsx)(gU,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(w0,{label:"Refresh mode",value:"delta"===t.mode?(0,ep.jsx)(w2,{label:"Delta",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}):(0,ep.jsx)(w2,{label:"Full"})}),(0,ep.jsx)(w0,{label:"Auto-refresh after consolidation",value:t.refresh_after_consolidation?(0,ep.jsx)(w2,{label:"Enabled",color:"bg-green-500/10 text-green-600 dark:text-green-400"}):(0,ep.jsx)(w2,{label:"Disabled"})}),(0,ep.jsx)(w0,{label:"Fact types",value:n.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(e=>{let t=wW(e);return(0,ep.jsx)(w2,{label:t.label,color:t.color},e)})}):(0,ep.jsx)("span",{className:"text-muted-foreground italic text-sm",children:"all"})}),(0,ep.jsx)(w0,{label:"Exclude mental models",value:t.exclude_mental_models?"Yes":"No"}),i.length>0&&(0,ep.jsx)(w0,{label:"Excluded IDs",value:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(e=>(0,ep.jsx)("code",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted border border-border/60",children:e},e))})})]}),(0,ep.jsxs)(w1,{title:"Recall Parameters",icon:(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(w0,{label:"Include chunks",value:null==t.include_chunks?"default":t.include_chunks?"Yes":"No"}),(0,ep.jsx)(w0,{label:"Recall max tokens",value:null!=t.recall_max_tokens?t.recall_max_tokens.toLocaleString():"default"}),(0,ep.jsx)(w0,{label:"Recall chunks max tokens",value:null!=t.recall_chunks_max_tokens?t.recall_chunks_max_tokens.toLocaleString():"default"}),(0,ep.jsx)(w0,{label:"Tags match",value:t.tags_match?(0,ep.jsx)(w2,{label:t.tags_match}):"default"})]}),r.length>0&&(0,ep.jsx)("div",{className:"md:col-span-2",children:(0,ep.jsx)(w1,{title:"Tag Groups",icon:(0,ep.jsx)(eA,{className:"w-3.5 h-3.5"}),children:(0,ep.jsx)("pre",{className:"text-xs font-mono bg-muted/40 rounded p-3 overflow-x-auto border border-border/60",children:JSON.stringify(r,null,2)})})})]})}function w3({children:e}){return(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:e})}function w4(){let e,t,n,r,i,a,o,s,l,c,u,{currentBank:d}=(0,ey.useBank)(),[h,f]=(0,em.useState)(""),[p,g]=(0,em.useState)("mid"),[v,x]=(0,em.useState)(4096),[y,b]=(0,em.useState)(!0),[w,j]=(0,em.useState)(!0),[N,k]=(0,em.useState)("answer"),[E,C]=(0,em.useState)(null),[_,S]=(0,em.useState)(!1),[T,A]=(0,em.useState)(""),[O,M]=(0,em.useState)("any"),[P,D]=(0,em.useState)([]),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(""),[z,F]=(0,em.useState)(""),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(!1),[Y,G]=(0,em.useState)(null),[X,$]=(0,em.useState)(null),[q,K]=(0,em.useState)(null),[Z,Q]=(0,em.useState)(!1),[J,ee]=(0,em.useState)(null),[et,en]=(0,em.useState)(null),[er,ei]=(0,em.useState)(!1),[ea,eo]=(0,em.useState)(null),[es,el]=(0,em.useState)("world"),ec="General Feedback",eu=async e=>{if(ee(e),en(null),d&&e?.id){ei(!0);try{let t=await eD.client.listObservations(d),n=t.items?.find(t=>t.id===e.id);en(n||e)}catch(t){console.error("Failed to load observation:",t),en(e)}finally{ei(!1)}}},ed=async()=>{if(d&&z.trim()){U(!0);try{let e=await eD.client.listDirectives(d),t=e.items?.find(e=>e.name===ec);if(t){let e=t.content?`${t.content}
8
+ ${z.trim()}`:z.trim();await eD.client.updateDirective(d,t.id,{content:e})}else await eD.client.createDirective(d,{name:ec,content:z.trim()});F(""),W(!0),setTimeout(()=>W(!1),3e3)}catch(e){}finally{U(!1)}}},eh=async()=>{if(d&&h){S(!0),k("answer");try{let e=T.split(",").map(e=>e.trim()).filter(e=>e.length>0),t=R.split(",").map(e=>e.trim()).filter(e=>e.length>0),n=await eD.client.reflect({bank_id:d,query:h,budget:p,max_tokens:v,include_facts:y,include_tool_calls:w,...e.length>0&&{tags:e,tags_match:O},...P.length>0&&{fact_types:P},...L&&{exclude_mental_models:!0},...t.length>0&&{exclude_mental_model_ids:t}});C(n)}catch(e){}finally{S(!1)}}};return d?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(px,{children:(0,ep.jsxs)(pj,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ek,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"text",value:h,onChange:e=>f(e.target.value),placeholder:"What would you like to reflect on?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&eh()})]}),(0,ep.jsx)(eL.Button,{onClick:eh,disabled:_||!h,className:"h-12 px-8",children:_?"Reflecting...":"Reflect"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Budget:"}),(0,ep.jsxs)(tR.Select,{value:p,onValueChange:e=>g(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tR.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tR.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eI.Input,{type:"number",value:v,onChange:e=>x(parseInt(e.target.value)||4096),className:"w-24 h-8"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(ph.Checkbox,{checked:y,onCheckedChange:e=>b(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Source"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(ph.Checkbox,{checked:w,onCheckedChange:e=>j(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Tools"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(eX,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eI.Input,{type:"text",value:T,onChange:e=>A(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tR.Select,{value:O,onValueChange:e=>M(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(pg,{value:P,onChange:D}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(ph.Checkbox,{checked:L,onCheckedChange:e=>I(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Exclude mental models"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Exclude IDs:"}),(0,ep.jsx)(eI.Input,{type:"text",value:R,onChange:e=>B(e.target.value),placeholder:"model-a, model-b",className:"h-8 w-48"})]})]})]})}),_&&(0,ep.jsx)(px,{children:(0,ep.jsxs)(pj,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Reflecting on memories..."})]})}),!_&&E&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[E.usage&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Input tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.usage.input_tokens?.toLocaleString()})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Output tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.usage.output_tokens?.toLocaleString()})]})]}),E.trace?.tool_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Tool calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.trace.tool_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",E.trace.tool_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),E.trace?.llm_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"LLM calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:E.trace.llm_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",E.trace.llm_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["answer","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>k(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${N===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"answer"===e?"Answer":"trace"===e?"Trace":"JSON"},e))})]}),"answer"===N&&(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)(px,{children:[(0,ep.jsx)(py,{children:(0,ep.jsx)(pb,{children:"Answer"})}),(0,ep.jsx)(pj,{children:(0,ep.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bs,{remarkPlugins:[wB],children:E.text})})})]}),(0,ep.jsxs)(px,{className:"border-blue-200 dark:border-blue-800",children:[(0,ep.jsxs)(py,{className:"py-4",children:[(0,ep.jsxs)(pb,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(pE,{className:"w-4 h-4"}),"Add Directive"]}),(0,ep.jsx)(pw,{className:"text-xs",children:"Hard rules injected into prompts that the agent must follow"})]}),(0,ep.jsx)(pj,{className:"pt-0",children:H?(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,ep.jsx)("span",{className:"text-lg",children:"✓"}),(0,ep.jsxs)("span",{className:"text-sm font-medium",children:["Directive saved to ",ec]})]}):(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsx)(pS.Textarea,{value:z,onChange:e=>F(e.target.value),placeholder:"e.g., Always respond in formal English...",className:"flex-1 min-h-[60px] resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&ed()}}),(0,ep.jsx)(eL.Button,{onClick:ed,disabled:V||!z.trim(),className:"self-end",children:V?"Saving...":"Save"})]})})]})]}),"trace"===N&&(0,ep.jsxs)("div",{className:"space-y-4",children:[E.observations_created&&E.observations_created.length>0&&(0,ep.jsxs)(px,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsxs)(py,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,ep.jsxs)(pb,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(pk,{className:"w-4 h-4 text-emerald-600"}),"Observations Created (",E.observations_created.length,")"]}),(0,ep.jsx)(pw,{className:"text-xs",children:"New observations learned during this reflection"})]}),(0,ep.jsx)(pj,{className:"pt-4",children:(0,ep.jsx)("div",{className:"space-y-2",children:E.observations_created.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-emerald-50 dark:bg-emerald-950/50 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsx)("div",{className:"font-medium text-sm text-emerald-900 dark:text-emerald-100",children:e.name}),(0,ep.jsx)("div",{className:"text-xs text-emerald-700 dark:text-emerald-300 mt-1",children:e.description}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-2 font-mono",children:["ID: ",e.id]})]},t))})})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,ep.jsxs)(px,{className:"h-fit",children:[(0,ep.jsxs)(py,{className:"pb-3",children:[(0,ep.jsx)(pb,{className:"text-base",children:"Execution Trace"}),(0,ep.jsxs)(pw,{className:"text-xs",children:[E.iterations||0," iteration",1!==(E.iterations||0)?"s":""," •"," ",(E.trace?.llm_calls?.reduce((e,t)=>e+t.duration_ms,0)||0)+(E.trace?.tool_calls?.reduce((e,t)=>e+t.duration_ms,0)||0),"ms total"]})]}),(0,ep.jsx)(pj,{children:w?E.trace?.llm_calls&&E.trace.llm_calls.length>0||E.trace?.tool_calls&&E.trace.tool_calls.length>0?(0,ep.jsx)("div",{className:"max-h-[500px] overflow-y-auto pr-2",children:(e=E.trace?.llm_calls||[],t=E.trace?.tool_calls||[],n=[],e.forEach((r,i)=>{let a=t.filter(e=>e.iteration===i+1),o=i===e.length-1,s=r.scope.includes("final")||o&&0===a.length,l=s?e.length:i+1;n.push({type:"llm",llm:r,iteration:l,isFinal:s}),a.length>0&&n.push({type:"tools",tools:a,iteration:i+1})}),n.map((e,t)=>(0,ep.jsxs)("div",{className:"relative",children:[t<n.length-1&&(0,ep.jsx)("div",{className:"absolute left-3 top-6 bottom-0 w-0.5 bg-border"}),"llm"===e.type?(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${e.isFinal?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-primary/10 text-primary"}`,children:e.isFinal?(0,ep.jsx)(tF.Check,{className:"w-3.5 h-3.5",strokeWidth:2.5}):(0,ep.jsx)("span",{className:"text-[10px] font-semibold",children:e.iteration})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("span",{className:"font-medium text-sm",children:e.isFinal?"Response generated":"Agent decided"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),e.llm.duration_ms,"ms"]})]}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.isFinal?"Final answer":"Called tools below"})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-blue-500/15 text-blue-600 dark:text-blue-400 flex-shrink-0",children:(0,ep.jsx)(p_,{className:"w-3 h-3",fill:"currentColor"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Executing ",e.tools?.length," tool",e.tools?.length!==1?"s":""]}),e.tools?.map((e,t)=>(0,ep.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/50",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.tool}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),e.duration_ms,"ms"]})]}),(0,ep.jsxs)("div",{className:"p-2 space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Input:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(ml,{src:e.input,collapsed:1,theme:"default"})})]}),e.output&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Output:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(ml,{src:e.output,collapsed:1,theme:"default"})})]})]})]},t))]})]})]},t)))}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(pN.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"No operations"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"No LLM or tool calls were made during this reflection."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(pN.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Tool Calls" to see trace.'})]})]})})]}),(0,ep.jsxs)(px,{className:"h-fit",children:[(0,ep.jsxs)(py,{className:"pb-3",children:[(0,ep.jsx)(pb,{className:"text-base",children:"Based On"}),(0,ep.jsxs)(pw,{className:"text-xs",children:[(E.based_on?.memories?.length||0)+(E.based_on?.observations?.filter(e=>"directive"!==e.subtype)?.length||0)+(E.based_on?.directives?.length||0)," ","items used"]})]}),(0,ep.jsx)(pj,{children:y?E.based_on?.memories&&E.based_on.memories.length>0||E.based_on?.mental_models&&E.based_on.mental_models.length>0||E.based_on?.directives&&E.based_on.directives.length>0||E.based_on?.observations&&E.based_on.observations.length>0?(i=(r=E.based_on?.memories||[]).filter(e=>"world"===e.type),a=r.filter(e=>"experience"===e.type),o=E.based_on?.mental_models||[],s=(E.based_on?.observations||[]).filter(e=>"directive"!==e.subtype),c=[{id:"directives",label:"Directives",count:(l=E.based_on?.directives||[]).length},{id:"mental_models",label:"Mental Models",count:o.length},{id:"observations",label:"Observations",count:s.length},{id:"world",label:"World",count:i.length},{id:"experience",label:"Experience",count:a.length}],u=(()=>{switch(es){case"directives":return l;case"mental_models":return o;case"observations":return s;case"world":return i;case"experience":return a;default:return[]}})(),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1 mb-4",children:c.map(e=>(0,ep.jsxs)("button",{onClick:()=>el(e.id),className:`flex-1 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${es===e.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.label," (",e.count,")"]},e.id))}),u.length>0?(0,ep.jsx)("div",{className:"max-h-[400px] overflow-y-auto pr-2 space-y-3",children:u.map((e,t)=>{let n,r;return(0,ep.jsx)("div",{className:`p-4 bg-muted/50 rounded-lg border border-border/50 ${"directives"!==es?"cursor-pointer hover:bg-muted/80 transition-colors":""}`,onClick:()=>{"directives"!==es&&("observations"===es?eu(e):"mental_models"===es?eo(e.id):G(e.id))},children:"directives"===es?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.content&&(0,ep.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.content})]}):"observations"===es?(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}):"mental_models"===es?(r=(n=e.text?.indexOf(": ")??-1)>0?e.text.slice(0,n):e.id,(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:r}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:e.id})]})):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:e.context})]})},e.id||t)})}):(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground text-center py-4",children:["No ",es," items"]})]})):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,ep.jsx)(pN.Info,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-amber-900 dark:text-amber-100",children:"No facts found"}),(0,ep.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 mt-0.5",children:"No memories were used to generate this answer."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(pN.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Source" to see memories.'})]})]})})]})]})]}),"json"===N&&(0,ep.jsxs)(px,{children:[(0,ep.jsx)(py,{children:(0,ep.jsx)(pb,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(pj,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(ml,{src:E,collapsed:2,theme:"default"})})})]})]}),!_&&!E&&(0,ep.jsx)(px,{className:"border-dashed",children:(0,ep.jsxs)(pj,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ek,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a question above to query the memory bank and generate a disposition-aware response."})]})}),(0,ep.jsx)(tQ,{memoryId:Y,onClose:()=>G(null)}),X&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pC,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"icon",onClick:()=>{$(null),K(null)},children:(0,ep.jsx)(e$.X,{className:"w-4 h-4"})})]}),Z?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),(0,ep.jsx)("p",{className:"mt-1 font-medium",children:q?.name||X.name})]}),q?.description&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),(0,ep.jsx)("p",{className:"mt-1 text-sm",children:q.description})]}),q?.tags&&q.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:q.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eX,{className:"w-2.5 h-2.5"}),e]},e))})]}),(q?.content||X.content)&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Content"}),(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:q?.content||X.content})})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:X.id})]})]})]})}),J&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pk,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Observation"})]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"icon",onClick:()=>{ee(null),en(null)},children:(0,ep.jsx)(e$.X,{className:"w-4 h-4"})})]}),er?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Text"}),(0,ep.jsx)("div",{className:"mt-1 prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bs,{remarkPlugins:[wB],children:et?.text||J.text})})]}),et?.tags&&et.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:et.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eX,{className:"w-2.5 h-2.5"}),e]},e))})]}),et?.source_memories&&et.source_memories.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Source Memories (",et.source_memories.length,")"]}),(0,ep.jsx)("div",{className:"space-y-2",children:et.source_memories.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.text||("string"==typeof e?e:"")})},t))})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:J.id})]})]})]})}),(0,ep.jsx)(wJ,{mentalModelId:ea,onClose:()=>eo(null)})]}):(0,ep.jsx)(px,{className:"border-dashed",children:(0,ep.jsxs)(pj,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eE,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start reflecting."})]})})}var w6=e.i(64659);let w8=(0,eN.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function w7(){let e,t,n,r,i,a,o,s,l,c,u,d,h,f,{currentBank:p}=(0,ey.useBank)(),[g,v]=(0,em.useState)(""),[x,y]=(0,em.useState)(["world"]),[b,w]=(0,em.useState)("mid"),[j,N]=(0,em.useState)(4096),[k,E]=(0,em.useState)(""),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(""),[M,P]=(0,em.useState)("any"),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),[U,H]=(0,em.useState)(null),[W,Y]=(0,em.useState)(!1),[G,X]=(0,em.useState)("results"),[$,q]=(0,em.useState)(null),[K,Z]=(0,em.useState)(new Set),[Q,J]=(0,em.useState)(new Set),ee=e=>{Z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},et=e=>{J(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},en=e=>{let t=e.id||e.node_id;q(D?.find(e=>e.id===t||e.node_id===t)||e)},er=async()=>{if(!p)return void ev.toast.error("Validation error",{description:"Please select a memory bank first"});if(g){if(0===x.length)return void ev.toast.error("Validation error",{description:"Please select at least one type (World, Experience, or Observations)"});Y(!0);try{let e=A.split(",").map(e=>e.trim()).filter(e=>e.length>0),t={bank_id:p,query:g,types:x,budget:b,max_tokens:j,trace:!0,include:{entities:S?{max_tokens:500}:null,chunks:C?{max_tokens:8192}:null},...k&&{query_timestamp:k},...e.length>0&&{tags:e,tags_match:M}},n=await eD.client.recall(t);L(n.results||[]),R(n.entities||null),z(n.chunks||null),V(n.observations||null),H(n.trace||null),X("results")}catch(e){}finally{Y(!1)}}};return p?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(px,{children:(0,ep.jsxs)(pj,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ej.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"text",value:g,onChange:e=>v(e.target.value),placeholder:"What would you like to recall?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&er()})]}),(0,ep.jsx)(eL.Button,{onClick:er,disabled:W||!g,className:"h-12 px-8",children:W?"Searching...":"Recall"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(pg,{value:x,onChange:y,label:"Types:"}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(gU,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsxs)(tR.Select,{value:b,onValueChange:e=>w(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tR.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tR.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eI.Input,{type:"number",value:j,onChange:e=>N(parseInt(e.target.value)),className:"w-24 h-8"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eW,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eI.Input,{type:"datetime-local",value:k,onChange:e=>E(e.target.value),className:"h-8",placeholder:"Query date"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(ph.Checkbox,{checked:C,onCheckedChange:e=>_(e)}),(0,ep.jsx)(eC.FileText,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Chunks"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(ph.Checkbox,{checked:S,onCheckedChange:e=>T(e)}),(0,ep.jsx)(e_,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Entities"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(eX,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eI.Input,{type:"text",value:A,onChange:e=>O(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tR.Select,{value:M,onValueChange:e=>P(e),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]})]})}),W&&(0,ep.jsx)(px,{children:(0,ep.jsxs)(pj,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Searching memories..."})]})}),!W&&D&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U?.summary&&(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Results:"}),(0,ep.jsx)("span",{className:"font-semibold",children:D.length})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"}),(0,ep.jsxs)("span",{className:"font-semibold",children:[U.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Nodes visited:"}),(0,ep.jsx)("span",{className:"font-semibold",children:U.summary.total_nodes_visited})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>X(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${G===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===e?"Results":"trace"===e?"Trace":"JSON"},e))})]}),"results"===G&&(0,ep.jsxs)("div",{className:"space-y-4",children:[F&&F.length>0&&(0,ep.jsxs)(px,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,ep.jsx)(py,{className:"py-3",children:(0,ep.jsxs)(pb,{className:"text-base flex items-center gap-2",children:[(0,ep.jsx)(eE,{className:"h-4 w-4 text-orange-500"}),(0,ep.jsx)("span",{children:"Observations"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",F.length,")"]})]})}),(0,ep.jsx)(pj,{className:"pt-0 space-y-2",children:F.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-background rounded-lg border border-orange-500/20",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-orange-500/10 text-orange-600",children:"Observation"}),(0,ep.jsxs)("span",{children:["Proof count: ",e.proof_count||1]}),(0,ep.jsxs)("span",{children:["Relevance: ",(e.relevance||0).toFixed(3)]})]})]},e.id||t))})]}),(0,ep.jsx)("div",{className:"space-y-3",children:0!==D.length||F&&0!==F.length?D.map((e,t)=>{let n=U?.visits?.find(t=>t.node_id===e.id),r=n?n.weights.final_weight:e.score||0;return(0,ep.jsx)(px,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>q(e),children:(0,ep.jsx)(pj,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-semibold text-primary",children:t+1})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:e.type||"world"}),e.context&&(0,ep.jsx)("span",{className:"truncate max-w-xs",children:e.context}),e.occurred_start&&(0,ep.jsx)("span",{children:new Date(e.occurred_start).toLocaleDateString()})]})]}),(0,ep.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,ep.jsx)("div",{className:"text-sm font-semibold",children:(r??0).toFixed(3)}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground",children:"score"})]}),(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)}):(0,ep.jsx)(px,{children:(0,ep.jsxs)(pj,{className:"flex flex-col items-center justify-center py-12",children:[(0,ep.jsx)(ej.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No memories found for this query."})]})})})]}),"trace"===G&&U&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U.retrieval_results&&U.retrieval_results.length>0&&(e={},U.retrieval_results.forEach(t=>{let n=t.fact_type||"all";e[n]||(e[n]=[]),e[n].push(t)}),t=Object.keys(e),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,ep.jsx)("span",{children:"PARALLEL RETRIEVAL"}),(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:t.map((t,n)=>{let r=e[t],i=`lane-${t}`,a=K.has(i),o=r.reduce((e,t)=>e+(t.results?.length||0),0),s=Math.max(...r.map(e=>e.duration_seconds||0)),l={world:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/30"},experience:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},opinion:{bg:"bg-purple-500/10",text:"text-purple-500",border:"border-purple-500/30"},all:{bg:"bg-gray-500/10",text:"text-gray-500",border:"border-gray-500/30"}},c=l[t]||l.all;return(0,ep.jsx)(px,{className:`transition-colors ${a?"border-primary":c.border}`,children:(0,ep.jsxs)(pj,{className:"py-3 px-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>ee(i),children:[(0,ep.jsx)("div",{className:`w-8 h-8 rounded-lg ${c.bg} flex items-center justify-center`,children:(0,ep.jsx)("span",{className:`text-sm font-bold ${c.text} capitalize`,children:t.charAt(0).toUpperCase()})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground capitalize",children:t}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r.length," methods"]})]}),(0,ep.jsx)("div",{className:"flex gap-1.5 mt-1",children:r.map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-muted text-muted-foreground capitalize",children:[e.method_name,": ",e.results?.length||0]},t))})]}),(0,ep.jsxs)("div",{className:"text-right",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:o}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[s.toFixed(2),"s"]})]}),a?(0,ep.jsx)(w6.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]}),a&&(0,ep.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,ep.jsx)("div",{className:`grid gap-3 ${1===r.length?"grid-cols-1":2===r.length?"grid-cols-2":3===r.length?"grid-cols-3":"grid-cols-4"}`,children:r.map((e,t)=>{let n,r,a,o,s=`${i}-method-${t}`,l=K.has(s),c=e.results||[];return(0,ep.jsxs)("div",{className:"flex flex-col",children:[(0,ep.jsxs)("div",{className:`p-3 rounded-lg cursor-pointer transition-colors ${l?"bg-primary/10 border border-primary":"bg-muted/50 hover:bg-muted"}`,onClick:e=>{e.stopPropagation(),ee(s)},children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:e.method_name}),"temporal"===e.method_name&&e.metadata?.constraint&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,ep.jsx)(eR,{className:"h-3 w-3"}),e.metadata.constraint.start?new Date(e.metadata.constraint.start).toLocaleDateString():"any"," → ",e.metadata.constraint.end?new Date(e.metadata.constraint.end).toLocaleDateString():"any"]})]}),l?(0,ep.jsx)(w6.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),(0,ep.jsxs)("div",{className:"flex items-end justify-between",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:c.length}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[e.duration_seconds?.toFixed(2),"s"]})]})]}),l&&c.length>0&&(n=`results-${s}`,a=(r=Q.has(n))?c:c.slice(0,5),o=c.length>5,(0,ep.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[a.map((e,t)=>(0,ep.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:e.text}),(0,ep.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(e.score||e.similarity||0).toFixed(4)})})]})]})},t)),o&&(0,ep.jsx)("button",{className:"w-full text-[10px] text-primary hover:text-primary/80 py-1.5 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(n)},children:r?"Show less":`View all ${c.length} results`})]}))]},s)})})})]})},i)})}),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)("div",{className:"flex items-center gap-2",children:t.map((e,t)=>{let n={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,ep.jsx)("div",{className:"flex flex-col items-center",children:(0,ep.jsx)("div",{className:`w-1 h-4 ${n[e]||n.all} rounded-full opacity-50`})},t)})})}),(0,ep.jsx)("div",{className:"flex justify-center",children:(0,ep.jsx)(w8,{className:"h-5 w-5 text-muted-foreground/50"})})]})),U.rrf_merged&&(n="rrf-merge",r=K.has(n),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(px,{className:`cursor-pointer transition-colors ${r?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(n),children:(0,ep.jsx)(pj,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"RRF Fusion"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"merge"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Reciprocal Rank Fusion of all retrieval results"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.rrf_merged.length}),r?(0,ep.jsx)(w6.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),r&&U.rrf_merged.length>0&&(i="results-rrf",o=(a=Q.has(i))?U.rrf_merged:U.rrf_merged.slice(0,5),s=U.rrf_merged.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[o.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:["RRF Score: ",(e.rrf_score||e.score||0).toFixed(4)]})]})]})},t)),s&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(i)},children:a?"Show less":`View all ${U.rrf_merged.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(w8,{className:"h-4 w-4 text-muted-foreground/50"})})]})),U.reranked&&(l="reranking",c=K.has(l),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(px,{className:`cursor-pointer transition-colors ${c?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(l),children:(0,ep.jsx)(pj,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Combined Scoring"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"rerank"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,ep.jsx)("span",{className:"font-mono text-xs",children:"ce × recency_boost(±10%) × temporal_boost(±10%)"})})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.reranked.length}),c?(0,ep.jsx)(w6.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),c&&U.reranked.length>0&&(u="results-rerank",h=(d=Q.has(u))?U.reranked:U.reranked.slice(0,5),f=U.reranked.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[h.map((e,t)=>{let n=e.score_components||{};return(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(e.rerank_score||e.score||0).toFixed(4)]}),void 0!==n.cross_encoder_score_normalized&&(0,ep.jsxs)("span",{title:"Cross-encoder score (primary relevance signal)",children:["CE: ",n.cross_encoder_score_normalized.toFixed(3)]}),void 0!==n.temporal&&.5!==n.temporal&&(0,ep.jsxs)("span",{title:"Temporal proximity boost (±10% — only active for temporal queries)",children:["Tmp: ",n.temporal.toFixed(3)]}),void 0!==n.recency&&(0,ep.jsxs)("span",{title:"Recency boost (±10% — based on memory age)",children:["Rec: ",n.recency.toFixed(3)]})]})]})]})},t)}),f&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(u)},children:d?"Show less":`View all ${U.reranked.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(w8,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,ep.jsx)(px,{className:"border-primary bg-primary/5",children:(0,ep.jsx)(pj,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Final Results"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:"output"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Top results after all processing steps"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-primary",children:D?.length||0})]})})})]}),"json"===G&&(0,ep.jsxs)(px,{children:[(0,ep.jsx)(py,{children:(0,ep.jsx)(pb,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(pj,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(ml,{src:{results:D,...I&&{entities:I},...B&&{chunks:B},...F&&{observations:F},trace:U},collapsed:2,theme:"default"})})})]})]}),!W&&!D&&(0,ep.jsx)(px,{className:"border-dashed",children:(0,ep.jsxs)(pj,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ej.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a query above to search through your memories. Use filters to narrow down by fact type, budget, and more."})]})}),$&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsx)(tJ,{memory:$,onClose:()=>q(null),inPanel:!0,bankId:p||void 0})})]}):(0,ep.jsx)(px,{className:"border-dashed",children:(0,ep.jsxs)(pj,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eE,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start recalling."})]})})}let w9=(0,eN.default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var je=e.i(82458),je=je,tV=tV;let jt={skepticism:{label:"Skepticism",shortLabel:"S",description:"How skeptical vs trusting when forming observations",lowLabel:"Trusting",highLabel:"Skeptical"},literalism:{label:"Literalism",shortLabel:"L",description:"How literally to interpret information when forming observations",lowLabel:"Flexible",highLabel:"Literal"},empathy:{label:"Empathy",shortLabel:"E",description:"How much to consider emotional context when forming observations",lowLabel:"Detached",highLabel:"Empathetic"}};function jn({hideReflectFields:e=!1}){let t=(0,eg.useRouter)(),{currentBank:n,setCurrentBank:r,loadBanks:i}=(0,ey.useBank)(),{features:a}=(0,ew.useFeatures)();a?.observations;let[o,s]=(0,em.useState)(null),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)([]),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)([]),[v,x]=(0,em.useState)(0),[y,b]=(0,em.useState)(!1),[w,j]=(0,em.useState)(!1),[N,k]=(0,em.useState)(!1),[E,C]=(0,em.useState)(!1),[_,S]=(0,em.useState)(null),[T,A]=(0,em.useState)(null),[O,M]=(0,em.useState)(!1),[P,D]=(0,em.useState)(!1),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(!1),[z,F]=(0,em.useState)(!1),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(null),[Y]=(0,em.useState)(10),[G,X]=(0,em.useState)(0),[$,q]=(0,em.useState)(null),K=async(e=H,t=G)=>{if(n)try{let r=await eD.client.listOperations(n,{status:e||void 0,limit:Y,offset:t});d(r.operations||[]),f(r.total||0)}catch(e){console.error("Error loading operations:",e)}},Z=async(e=!1)=>{if(n){if(e){try{let[e,t,r]=await Promise.all([eD.client.getBankStats(n),eD.client.listDirectives(n),eD.client.listMentalModels(n)]);c(e),g(t.items||[]),x(r.items?.length||0)}catch(e){console.error("Error refreshing stats:",e)}return}b(!0);try{let[e,t,r,i]=await Promise.all([eD.client.getBankProfile(n),eD.client.getBankStats(n),eD.client.listDirectives(n),eD.client.listMentalModels(n)]);s(e),c(t),g(r.items||[]),x(i.items?.length||0),await K()}catch(e){}finally{b(!1)}}},Q=async()=>{if(n){I(!0);try{await eD.client.deleteBank(n),D(!1),r(null),await i(),t.push("/")}catch(e){}finally{I(!1)}}},J=async()=>{if(n){F(!0);try{let e=await eD.client.clearObservations(n);B(!1),await Z(),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{F(!1)}}},ee=async()=>{if(n&&T){M(!0);try{await eD.client.deleteDirective(n,T.id),g(e=>e.filter(e=>e.id!==T.id)),_?.id===T.id&&S(null),A(null)}catch(e){}finally{M(!1)}}};return((0,em.useEffect)(()=>{if(n){Z();let e=setInterval(()=>Z(!0),5e3);return()=>clearInterval(e)}},[n]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&S(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),n)?y&&!o?(0,ep.jsx)(px,{children:(0,ep.jsxs)(pj,{className:"text-center py-10",children:[(0,ep.jsx)(eW,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,ep.jsx)("div",{className:"text-lg text-muted-foreground",children:"Loading profile..."})]})}):(0,ep.jsxs)("div",{className:"space-y-6",children:[!e&&(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ep.jsxs)(px,{children:[(0,ep.jsx)(py,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(pb,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(pk,{className:"w-5 h-5 text-primary"}),"Disposition Profile"]}),(0,ep.jsx)(pw,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)(eL.Button,{onClick:()=>j(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(po,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(pj,{children:o&&(0,ep.jsx)("div",{className:"space-y-4",children:Object.keys(jt).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:jt[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:jt[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o.disposition[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:jt[e].lowLabel}),(0,ep.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(o.disposition[e]-1)/4*100}%`}})}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:jt[e].highLabel})]})]},e))})})]}),(0,ep.jsxs)(px,{children:[(0,ep.jsx)(py,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(pb,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(w9,{className:"w-5 h-5 text-primary"}),"Mission"]}),(0,ep.jsx)(pw,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)(eL.Button,{onClick:()=>k(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(po,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(pj,{children:(0,ep.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:o?.mission||"No mission set. Set a mission to derive structural mental models and personalize reflect responses."})})]})]}),(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,ep.jsx)(je.default,{className:"w-5 h-5 text-rose-500"}),"Directives"]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"Hard rules that must be followed during reflect"})]}),(0,ep.jsxs)(eL.Button,{onClick:()=>C(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,ep.jsx)(fI.Plus,{className:"w-4 h-4 mr-1"}),"Add"]})]}),p.length>0?(0,ep.jsx)("div",{className:"grid grid-cols-2 gap-3",children:p.map(e=>(0,ep.jsx)(px,{className:`cursor-pointer transition-colors border-rose-500/30 ${_?.id===e.id?"bg-rose-500/10 border-rose-500":"hover:bg-rose-500/5"}`,onClick:()=>S(e),children:(0,ep.jsx)(pj,{className:"p-3",children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)(je.default,{className:"w-4 h-4 text-rose-500 shrink-0 mt-0.5"}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.name}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:e.content}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[(0,ep.jsx)(eX,{className:"w-3 h-3 text-muted-foreground"}),e.tags.map(e=>(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:e},e))]})]})]})})},e.id))}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-rose-500/30 rounded-lg text-center",children:[(0,ep.jsx)(je.default,{className:"w-6 h-6 mx-auto mb-2 text-rose-500/50"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"No directives yet. Directives are hard rules that must be followed during reflect."})]})]}),(0,ep.jsx)(fY,{open:P,onOpenChange:D,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Memory Bank"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."}),l&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_nodes," memories, ",l.total_documents," ","documents, and ",l.total_links," links."]})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:L,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:Q,disabled:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:L?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eU,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(fY,{open:R,onOpenChange:B,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Clear Observations"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."}),l&&l.total_observations>0&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_observations," observations."]})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:z,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:J,disabled:z,className:"bg-amber-500 text-white hover:bg-amber-600",children:z?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})}),(0,ep.jsx)(ja,{open:E,mode:"create",onClose:()=>C(!1),onCreated:e=>{g(t=>[e,...t]),C(!1)}}),(0,ep.jsx)(fY,{open:!!T,onOpenChange:e=>!e&&A(null),children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Directive"}),(0,ep.jsxs)(pn,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',T?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(pe,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(pi,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(pr,{onClick:ee,disabled:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[O?(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),_&&(0,ep.jsx)(jo,{directive:_,onClose:()=>S(null),onDelete:()=>A({id:_.id,name:_.name}),onUpdated:e=>{g(t=>t.map(t=>t.id===e.id?e:t)),S(e)}}),w&&o&&(0,ep.jsx)(jr,{disposition:o.disposition,onClose:()=>j(!1),onSaved:async()=>{await Z(),j(!1)}}),N&&o&&(0,ep.jsx)(ji,{mission:o.mission||"",onClose:()=>k(!1),onSaved:async()=>{await Z(),k(!1)}})]}):(0,ep.jsx)(px,{children:(0,ep.jsxs)(pj,{className:"p-10 text-center",children:[(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Please select a memory bank from the dropdown above to view its profile."})]})})}function jr({disposition:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eD.client.updateBankConfig(r,{disposition_skepticism:o.skepticism,disposition_literalism:o.literalism,disposition_empathy:o.empathy}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Edit Disposition Traits"}),(0,ep.jsx)(tH.DialogDescription,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)("div",{className:"space-y-4 py-4",children:Object.keys(jt).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:jt[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:jt[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,ep.jsx)("span",{children:jt[e].lowLabel}),(0,ep.jsx)("span",{children:jt[e].highLabel})]}),(0,ep.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:o[e],onChange:t=>s(n=>({...n,[e]:parseInt(t.target.value)})),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]},e))}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eU,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function ji({mission:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eD.client.updateBankConfig(r,{reflect_mission:o||null}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Edit Mission"}),(0,ep.jsx)(tH.DialogDescription,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)("div",{className:"space-y-2 py-4",children:(0,ep.jsx)(pS.Textarea,{value:o,onChange:e=>s(e.target.value),placeholder:"e.g., I am a PM for the engineering team. I help coordinate sprints and track project progress...",rows:8,className:"resize-none"})}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eU,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function ja({open:e,mode:t,directive:n,onClose:r,onCreated:i,onSaved:a}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)({name:"",content:"",tags:""});(0,em.useEffect)(()=>{"edit"===t&&n?u({name:n.name,content:n.content,tags:(n.tags||[]).join(", ")}):"create"===t&&u({name:"",content:"",tags:""})},[e,t,n]);let d=async()=>{if(o&&c.name.trim()&&c.content.trim()){l(!0);try{let e=c.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0);if("create"===t){let t=await eD.client.createDirective(o,{name:c.name.trim(),content:c.content.trim(),tags:e.length>0?e:void 0});u({name:"",content:"",tags:""}),i?.(t)}else if(n){let t=await eD.client.updateDirective(o,n.id,{name:c.name.trim(),content:c.content.trim(),tags:e});a?.(t),r()}}catch(e){}finally{l(!1)}}},h=()=>{"create"===t&&u({name:"",content:"",tags:""}),r()};return(0,ep.jsx)(tH.Dialog,{open:e,onOpenChange:e=>!e&&h(),children:(0,ep.jsxs)(tH.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(je.default,{className:"w-5 h-5 text-rose-500"}),"create"===t?"Create":"Edit"," Directive"]}),(0,ep.jsx)(tH.DialogDescription,{children:"Directives are hard rules that must be followed during reflect."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"e.g., Competitor Policy"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Rule *"}),(0,ep.jsx)(pS.Textarea,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:"e.g., Never mention competitor products directly.",className:"min-h-[120px]"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("label",{className:"text-sm font-medium text-foreground",children:["Tags ",(0,ep.jsx)("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),(0,ep.jsx)(eI.Input,{value:c.tags,onChange:e=>u({...c,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:h,disabled:s,children:"Cancel"}),(0,ep.jsxs)(eL.Button,{onClick:d,disabled:s||!c.name.trim()||!c.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[s?(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"create"===t?"Create":"Save"]})]})]})})}function jo({directive:e,onClose:t,onDelete:n,onUpdated:r}){let[i,a]=(0,em.useState)(!1);return(0,ep.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l-2 border-rose-500 shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:[(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-8 pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)(je.default,{className:"w-5 h-5 text-rose-500"}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:e.name}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:()=>a(!0),className:"h-7 w-7 p-0",children:(0,ep.jsx)(po,{className:"h-3.5 w-3.5"})})]}),(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-rose-500/10 text-rose-600 dark:text-rose-400",children:"directive"})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 text-muted-foreground hover:text-rose-500",children:(0,ep.jsx)(pa,{className:"h-4 w-4"})}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(e$.X,{className:"h-4 w-4"})})]})]}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Rule"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bs,{remarkPlugins:[wB],children:e.content})})]}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tags.map(e=>(0,ep.jsx)("span",{className:"px-2 py-1 rounded bg-muted text-muted-foreground text-sm",children:e},e))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"ID"}),(0,ep.jsx)("code",{className:"text-sm font-mono break-all text-muted-foreground",children:e.id})]})]})]}),(0,ep.jsx)(ja,{open:i,mode:"edit",directive:e,onClose:()=>a(!1),onSaved:r})]})}let js=(0,e4.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),jl=em.forwardRef(({className:e,variant:t,...n},r)=>(0,ep.jsx)("div",{ref:r,role:"alert",className:(0,eO.cn)(js({variant:t}),e),...n}));jl.displayName="Alert",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("h5",{ref:n,className:(0,eO.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let jc=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eO.cn)("text-sm [&_p]:leading-relaxed",e),...t}));jc.displayName="AlertDescription";var tV=tV;let ju=(0,eN.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),jd=[{value:"HARM_CATEGORY_HARASSMENT",label:"Harassment"},{value:"HARM_CATEGORY_HATE_SPEECH",label:"Hate Speech"},{value:"HARM_CATEGORY_SEXUALLY_EXPLICIT",label:"Sexually Explicit"},{value:"HARM_CATEGORY_DANGEROUS_CONTENT",label:"Dangerous Content"}],jh=[{value:"HARM_BLOCK_THRESHOLD_UNSPECIFIED",label:"Unspecified (use Gemini default)"},{value:"OFF",label:"Off (filter disabled)"},{value:"BLOCK_NONE",label:"Block none"},{value:"BLOCK_LOW_AND_ABOVE",label:"Block low & above"},{value:"BLOCK_MEDIUM_AND_ABOVE",label:"Block medium & above"},{value:"BLOCK_ONLY_HIGH",label:"Block only high"}],jf=jd.map(e=>({category:e.value,threshold:"BLOCK_NONE"})),jp=[{label:"Core",tools:["retain","sync_retain","recall","reflect"]},{label:"Bank management",tools:["list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories"]},{label:"Mental models",tools:["list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model"]},{label:"Directives",tools:["list_directives","create_directive","delete_directive"]},{label:"Memories",tools:["list_memories","get_memory","delete_memory"]},{label:"Documents",tools:["list_documents","get_document","delete_document"]},{label:"Operations",tools:["list_operations","get_operation","cancel_operation"]},{label:"Tags",tools:["list_tags"]}],jm=jp.flatMap(e=>e.tools);function jg(e){return Array.isArray(e)?e:e&&"object"==typeof e&&Array.isArray(e.attributes)?e.attributes:null}function jv(e){return{retain_chunk_size:e.retain_chunk_size??null,retain_extraction_mode:e.retain_extraction_mode??null,retain_mission:e.retain_mission??null,retain_custom_instructions:e.retain_custom_instructions??null,entities_allow_free_form:e.entities_allow_free_form??null,entity_labels:jg(e.entity_labels)}}function jx(e){return{retain_default_strategy:e.retain_default_strategy??null,retain_strategies:e.retain_strategies??null}}function jy(e){return{enable_observations:e.enable_observations??null,consolidation_llm_batch_size:e.consolidation_llm_batch_size??null,consolidation_source_facts_max_tokens:e.consolidation_source_facts_max_tokens??null,consolidation_source_facts_max_tokens_per_observation:e.consolidation_source_facts_max_tokens_per_observation??null,observations_mission:e.observations_mission??null,max_observations_per_scope:e.max_observations_per_scope??null}}function jb(e){return{mcp_enabled_tools:e.mcp_enabled_tools??null}}function jw(e){return{llm_gemini_safety_settings:e.llm_gemini_safety_settings??null}}let jj={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function jN(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,ew.useFeatures)(),n=t?.bank_config_api??!0,[r,i]=(0,em.useState)(!0),[a,o]=(0,em.useState)({}),[s,l]=(0,em.useState)(jj),[c,u]=(0,em.useState)(jv({})),[d,h]=(0,em.useState)(jx({})),[f,p]=(0,em.useState)(jy({})),[g,v]=(0,em.useState)(jj),[x,y]=(0,em.useState)(jb({})),[b,w]=(0,em.useState)(jw({})),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),U=(0,em.useMemo)(()=>JSON.stringify(c)!==JSON.stringify(jv(a))||JSON.stringify(d)!==JSON.stringify(jx(a)),[c,d,a]),H=(0,em.useMemo)(()=>JSON.stringify(f)!==JSON.stringify(jy(a)),[f,a]),W=(0,em.useMemo)(()=>JSON.stringify(g)!==JSON.stringify(s),[g,s]),Y=(0,em.useMemo)(()=>JSON.stringify(x)!==JSON.stringify(jb(a)),[x,a]),G=(0,em.useMemo)(()=>JSON.stringify(b)!==JSON.stringify(jw(a)),[b,a]);(0,em.useEffect)(()=>{e&&X()},[e]);let X=async()=>{if(e){i(!0);try{let[t,n]=await Promise.all([eD.client.getBankConfig(e),eD.client.getBankProfile(e)]),r=t.config,i={reflect_mission:n.mission??"",disposition_skepticism:r.disposition_skepticism??n.disposition?.skepticism??3,disposition_literalism:r.disposition_literalism??n.disposition?.literalism??3,disposition_empathy:r.disposition_empathy??n.disposition?.empathy??3};o(r),l(i),u(jv(r)),h(jx(r)),p(jy(r)),v(i),y(jb(r)),w(jw(r))}catch(e){console.error("Failed to load bank data:",e)}finally{i(!1)}}},$=async()=>{if(e){N(!0),P(null);try{let t={...c,...d};await eD.client.updateBankConfig(e,t),o(e=>({...e,...t}))}catch(e){P(e.message||"Failed to save retain settings")}finally{N(!1)}}},q=async()=>{if(e){E(!0),L(null);try{await eD.client.updateBankConfig(e,f),o(e=>({...e,...f}))}catch(e){L(e.message||"Failed to save observations settings")}finally{E(!1)}}},K=async()=>{if(e){_(!0),R(null);try{await eD.client.updateBankConfig(e,{reflect_mission:g.reflect_mission||null,disposition_skepticism:g.disposition_skepticism,disposition_literalism:g.disposition_literalism,disposition_empathy:g.disposition_empathy}),l(g)}catch(e){R(e.message||"Failed to save reflect settings")}finally{_(!1)}}},Z=async()=>{if(e){T(!0),z(null);try{await eD.client.updateBankConfig(e,x),o(e=>({...e,...x}))}catch(e){z(e.message||"Failed to save MCP settings")}finally{T(!1)}}},Q=async()=>{if(e){O(!0),V(null);try{await eD.client.updateBankConfig(e,b),o(e=>({...e,...b}))}catch(e){V(e.message||"Failed to save Gemini settings")}finally{O(!1)}}};return e?n?r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tV.default,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,ep.jsx)(ep.Fragment,{children:(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)(jA,{title:"Retain",description:"Default extraction settings and named strategies. Pass a strategy name on retain requests to override defaults per-item.",error:M,dirty:U,saving:j,onSave:$,children:[(0,ep.jsx)(jO,{label:"Default strategy",description:"Applied automatically when no strategy is specified on a request.",children:(0,ep.jsxs)(tR.Select,{value:d.retain_default_strategy??"__none__",onValueChange:e=>h(t=>({...t,retain_default_strategy:"__none__"===e?null:e})),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"__none__",children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"Default"})}),Object.keys(d.retain_strategies??{}).map(e=>(0,ep.jsx)(tR.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jS,{defaultValues:c,onDefaultChange:e=>u(t=>({...t,...e})),strategies:d.retain_strategies,onStrategiesChange:e=>h(t=>({...t,retain_strategies:e}))})]}),(0,ep.jsxs)(jA,{title:"Observations",description:"Control how facts are synthesized into durable observations",error:D,dirty:H,saving:k,onSave:q,children:[(0,ep.jsx)(jO,{label:"Enable Observations",description:"Enable automatic consolidation of facts into observations",children:(0,ep.jsx)("div",{className:"flex justify-end",children:(0,ep.jsx)(tI.Switch,{checked:f.enable_observations??!1,onCheckedChange:e=>p(t=>({...t,enable_observations:e}))})})}),(0,ep.jsx)(jM,{label:"Mission",description:"What this bank should synthesise into durable observations. Replaces the built-in consolidation rules — leave blank to use the server default.",value:f.observations_mission??"",onChange:e=>p(t=>({...t,observations_mission:e||null})),placeholder:"e.g. Observations are stable facts about people and projects. Always include preferences, skills, and recurring patterns. Ignore one-off events and ephemeral state.",rows:3}),(0,ep.jsx)(jO,{label:"LLM Batch Size",description:"Number of facts sent to the LLM in a single consolidation call. Higher values reduce LLM calls at the cost of larger prompts. Leave blank to use the server default.",children:(0,ep.jsx)(eI.Input,{type:"number",min:1,max:64,value:f.consolidation_llm_batch_size??"",onChange:e=>p(t=>({...t,consolidation_llm_batch_size:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jO,{label:"Source Facts Max Tokens",description:"Total token budget for source facts included with observations during consolidation. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jO,{label:"Source Facts Max Tokens Per Observation",description:"Per-observation token cap for source facts during consolidation. Each observation gets at most this many tokens of source facts. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens_per_observation??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens_per_observation:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jO,{label:"Max Observations Per Scope",description:"Maximum number of observations allowed per tag scope. When the limit is reached, only updates and deletes are allowed. Observations with no tags are not subject to this limit. -1 = unlimited.",children:(0,ep.jsx)(eI.Input,{type:"number",min:-1,value:f.max_observations_per_scope??"",onChange:e=>p(t=>({...t,max_observations_per_scope:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})})]}),(0,ep.jsxs)(jA,{title:"Reflect",description:"Shape how the bank reasons and responds in reflect operations",error:I,dirty:W,saving:C,onSave:K,children:[(0,ep.jsx)(jM,{label:"Mission",description:"Agent identity and purpose. Used as framing context in reflect.",value:g.reflect_mission,onChange:e=>v(t=>({...t,reflect_mission:e})),placeholder:"e.g. You are a senior engineering assistant. Always ground answers in documented decisions and rationale. Ignore speculation. Be direct and precise.",rows:3}),(0,ep.jsx)(jP,{label:"Skepticism",description:"How skeptical vs trusting when evaluating claims",lowLabel:"Trusting",highLabel:"Skeptical",value:g.disposition_skepticism,onChange:e=>v(t=>({...t,disposition_skepticism:e}))}),(0,ep.jsx)(jP,{label:"Literalism",description:"How literally to interpret information",lowLabel:"Flexible",highLabel:"Literal",value:g.disposition_literalism,onChange:e=>v(t=>({...t,disposition_literalism:e}))}),(0,ep.jsx)(jP,{label:"Empathy",description:"How much to weight emotional context",lowLabel:"Detached",highLabel:"Empathetic",value:g.disposition_empathy,onChange:e=>v(t=>({...t,disposition_empathy:e}))})]}),(0,ep.jsxs)(jA,{title:"MCP Tools",description:"Restrict which MCP tools this bank exposes to agents",error:B,dirty:Y,saving:S,onSave:Z,children:[(0,ep.jsx)(jO,{label:"Restrict tools",description:"When off, all tools are available. When on, only the selected tools can be invoked for this bank.",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tI.Switch,{checked:null!==x.mcp_enabled_tools,onCheckedChange:e=>y({mcp_enabled_tools:e?[...jm]:null})}),(0,ep.jsx)(e8,{className:"text-xs text-muted-foreground",children:null!==x.mcp_enabled_tools?"Enabled":"Disabled"})]})}),null!==x.mcp_enabled_tools&&(0,ep.jsx)(jT,{selected:x.mcp_enabled_tools,onChange:e=>y({mcp_enabled_tools:e})})]}),(0,ep.jsx)(jA,{title:"Models",description:"Provider-specific model settings",error:F,dirty:G,saving:A,onSave:Q,children:(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsx)("p",{className:"text-sm font-semibold",children:"Gemini / Vertex AI"}),(0,ep.jsxs)("div",{className:"pl-4 border-l-2 border-border/40 space-y-4",children:[(0,ep.jsx)(jO,{label:"Safety settings",description:(0,ep.jsxs)(ep.Fragment,{children:["When off, Gemini's default safety thresholds are used. When on, configure thresholds per harm category."," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tI.Switch,{checked:null!==b.llm_gemini_safety_settings,onCheckedChange:e=>w({llm_gemini_safety_settings:e?[...jf]:null})}),(0,ep.jsx)(e8,{className:"text-xs text-muted-foreground",children:null!==b.llm_gemini_safety_settings?"Custom":"Default"})]})}),null!==b.llm_gemini_safety_settings&&(0,ep.jsx)(jL,{value:b.llm_gemini_safety_settings,onChange:e=>w({llm_gemini_safety_settings:e})})]})]})})]})}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,ep.jsx)("p",{className:"text-base font-medium text-foreground",children:"Bank configuration is disabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-sm",children:["Set"," ",(0,ep.jsx)("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:"HINDSIGHT_API_ENABLE_BANK_CONFIG_API=true"})," ","to enable per-bank configuration."]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No bank selected"})})}let jk=["concise","verbose","verbatim","chunks","custom"],jE="__inherit__";function jC({values:e,onChange:t,isOverride:n=!1}){let r=e.retain_extraction_mode??(n?jE:""),i="custom"===e.retain_extraction_mode;return(0,ep.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,ep.jsx)(jO,{label:"Extraction Mode",description:"How aggressively to extract facts. concise = selective, verbose = capture everything, verbatim = store chunks as-is (still extract entities/time), chunks = no LLM, custom = write your own rules.",children:(0,ep.jsxs)(tR.Select,{value:r,onValueChange:e=>t({retain_extraction_mode:e===jE?null:e||null}),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tR.SelectValue,{placeholder:n?"Inherited from default":void 0})}),(0,ep.jsxs)(tR.SelectContent,{children:[n&&(0,ep.jsx)(tR.SelectItem,{value:jE,children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"inherited"})}),jk.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jO,{label:"Chunk Size",description:"Size of text chunks for processing (characters)",children:(0,ep.jsx)(eI.Input,{type:"number",min:500,max:8e3,value:e.retain_chunk_size??"",onChange:e=>t({retain_chunk_size:e.target.value?parseFloat(e.target.value):null}),placeholder:n?"Inherited from default":void 0})}),(0,ep.jsx)(jM,{label:"Mission",description:"What this bank should pay attention to during extraction. Steers the LLM without replacing the extraction rules.",value:e.retain_mission??"",onChange:e=>t({retain_mission:e||null}),placeholder:n?"Inherited from default":"e.g. Always include technical decisions, API design choices, and architectural trade-offs.",rows:3}),i&&(0,ep.jsx)(jM,{label:"Custom Extraction Prompt",description:"Replaces the built-in extraction rules entirely. Only active when Extraction Mode is set to custom.",value:e.retain_custom_instructions??"",onChange:e=>t({retain_custom_instructions:e||null}),rows:5}),(0,ep.jsx)(jO,{label:"Free Form Entities",description:"Extract regular named entities (people, places, concepts) alongside entity labels. Disable to restrict extraction to entity labels only.",children:(0,ep.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,ep.jsx)(e8,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:e.entities_allow_free_form??!0?"Enabled":"Disabled"}),(0,ep.jsx)(tI.Switch,{checked:e.entities_allow_free_form??!0,onCheckedChange:e=>t({entities_allow_free_form:e})})]})}),(0,ep.jsx)(jD,{value:e.entity_labels??[],onChange:e=>t({entity_labels:e.length>0?e:null})})]})}function j_(e){return e?Object.entries(e).map(([e,t],n)=>({id:n,name:e,values:{retain_extraction_mode:t.retain_extraction_mode??null,retain_chunk_size:t.retain_chunk_size??null,retain_mission:t.retain_mission??null,retain_custom_instructions:t.retain_custom_instructions??null,entities_allow_free_form:t.entities_allow_free_form??null,entity_labels:jg(t.entity_labels)}})):[]}function jS({defaultValues:e,onDefaultChange:t,strategies:n,onStrategiesChange:r}){let[i,a]=(0,em.useState)(()=>j_(n)),[o,s]=(0,em.useState)("default"),[l,c]=(0,em.useState)(null),u=(0,em.useRef)(!1),d=JSON.stringify(n);(0,em.useEffect)(()=>{if(u.current){u.current=!1;return}a(j_(n))},[d]);let h=e=>{u.current=!0,a(e),r(function(e){let t={};for(let n of e){if(!n.name.trim())continue;let e={};null!==n.values.retain_extraction_mode&&(e.retain_extraction_mode=n.values.retain_extraction_mode),null!==n.values.retain_chunk_size&&(e.retain_chunk_size=n.values.retain_chunk_size),n.values.retain_mission&&(e.retain_mission=n.values.retain_mission),n.values.retain_custom_instructions&&(e.retain_custom_instructions=n.values.retain_custom_instructions),null!==n.values.entities_allow_free_form&&(e.entities_allow_free_form=n.values.entities_allow_free_form),null!==n.values.entity_labels&&(e.entity_labels=n.values.entity_labels),t[n.name.trim()]=e}return Object.keys(t).length>0?t:null}(e))},f=(e,t)=>{h(i.map(n=>n.id===e?{...n,...t}:n))},p="default"!==o?i.find(e=>e.id===o):null;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"border-b border-border px-6 flex items-stretch gap-1 flex-wrap",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>s("default"),className:`relative py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px ${"default"===o?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,children:"Default"}),i.map(e=>(0,ep.jsxs)("div",{className:`relative flex items-center gap-2 py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px cursor-pointer ${o===e.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,onClick:()=>s(e.id),children:[(0,ep.jsx)("span",{className:"font-mono",children:e.name||(0,ep.jsx)("span",{className:"italic font-normal opacity-50",children:"unnamed"})}),(0,ep.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e)},className:"opacity-40 hover:opacity-100 hover:text-destructive transition-opacity text-base leading-none",children:"×"})]},e.id)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let e=Date.now();h([...i,{id:e,name:"",values:{retain_extraction_mode:null,retain_chunk_size:null,retain_mission:null,retain_custom_instructions:null,entities_allow_free_form:null,entity_labels:null}}]),s(e)},className:"py-3 px-3 text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1.5",children:[(0,ep.jsx)(fI.Plus,{className:"h-3.5 w-3.5"}),"Add strategy"]})]}),(0,ep.jsx)("div",{children:"default"===o?(0,ep.jsx)(jC,{values:e,onChange:t}):p?(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"px-6 py-3 flex items-center gap-3 border-b border-border/40",children:[(0,ep.jsx)("label",{className:"text-xs text-muted-foreground shrink-0",children:"Name"}),(0,ep.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ep.jsx)(eI.Input,{value:p.name,onChange:e=>f(p.id,{name:e.target.value}),placeholder:"strategy name (e.g. fast)",className:`h-7 text-xs font-mono max-w-[200px] ${!p.name.trim()?"border-destructive focus-visible:ring-destructive":""}`}),!p.name.trim()&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Name is required"})]})]}),(0,ep.jsx)(jC,{values:p.values,onChange:e=>f(p.id,{values:{...p.values,...e}}),isOverride:!0})]}):null}),(0,ep.jsx)(fY,{open:null!==l,onOpenChange:e=>{e||c(null)},children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsxs)(pt,{children:["Delete strategy “",l?.name||"unnamed","”?"]}),(0,ep.jsx)(pn,{children:"This will remove the strategy and all its overrides. This cannot be undone."})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{children:"Cancel"}),(0,ep.jsx)(pr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(l){var e;e=l.id,h(i.filter(t=>t.id!==e)),o===e&&s("default"),c(null)}},children:"Delete"})]})]})})]})}function jT({selected:e,onChange:t}){let n=new Set(e),r=jm.every(e=>n.has(e)),i=0===e.length;return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.length," of ",jm.length," tools enabled"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(r?[]:[...jm])},className:"text-xs text-primary hover:underline",children:r?"Deselect all":"Select all"})]}),(0,ep.jsx)("div",{className:"space-y-4",children:jp.map(e=>{let r=e.tools.filter(e=>n.has(e)).length===e.tools.length;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e.label}),(0,ep.jsx)("button",{type:"button",onClick:()=>{let i=new Set(n);r?e.tools.forEach(e=>i.delete(e)):e.tools.forEach(e=>i.add(e)),t(jm.filter(e=>i.has(e)))},className:"text-xs text-primary hover:underline",children:r?"Deselect":"Select all"})]}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tools.map(e=>{let r=n.has(e);return(0,ep.jsx)("button",{type:"button",onClick:()=>{let r;(r=new Set(n)).has(e)?r.delete(e):r.add(e),t(jm.filter(e=>r.has(e)))},className:`px-2.5 py-1 rounded text-xs font-mono transition-colors border ${r?"bg-primary text-primary-foreground border-primary":"bg-muted/30 text-muted-foreground border-border/40 hover:border-primary/40"}`,children:e},e)})})]},e.label)})}),i&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Warning: no tools selected — agents will be blocked from all MCP calls for this bank."})]})}function jA({title:e,description:t,children:n,error:r,dirty:i,saving:a,onSave:o}){return(0,ep.jsxs)("section",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:e}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:t})]}),(0,ep.jsxs)(px,{className:"bg-muted/20 border-border/40",children:[(0,ep.jsx)("div",{className:"divide-y divide-border/40",children:n}),r&&(0,ep.jsx)("div",{className:"px-6 pb-2 pt-2",children:(0,ep.jsxs)(jl,{variant:"destructive",children:[(0,ep.jsx)(ju,{className:"h-4 w-4"}),(0,ep.jsx)(jc,{children:r})]})}),(0,ep.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,ep.jsx)(eL.Button,{size:"sm",disabled:!i||a,onClick:o,children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save changes"})})]})]})}function jO({label:e,description:t,children:n}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)("div",{className:"md:w-64 shrink-0",children:n})]})})}function jM({label:e,description:t,value:n,onChange:r,placeholder:i,rows:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)(pS.Textarea,{value:n,onChange:e=>r(e.target.value),placeholder:i,rows:a??3,className:"font-mono text-sm"})]})})}function jP({label:e,description:t,lowLabel:n,highLabel:r,value:i,onChange:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[n&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right shrink-0",children:n}),(0,ep.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,ep.jsx)("button",{type:"button",onClick:()=>a(e),className:`w-4 h-4 rounded-full transition-colors hover:opacity-80 ${e<=i?"bg-primary":"bg-muted"}`},e))}),r&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-20 shrink-0",children:r}),(0,ep.jsxs)("span",{className:"text-xs font-mono text-muted-foreground ml-1 shrink-0",children:[i,"/5"]})]})]})})}function jD({value:e,onChange:t}){let[n,r]=(0,em.useState)({}),i=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))},a=(t,n,r)=>{let a=e[t].values.map((e,t)=>t===n?{...e,...r}:e);i(t,{values:a})};return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:"Entity Labels"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Classification labels extracted at retain time. Leave empty to disable."})]}),e.length>0&&(0,ep.jsxs)("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full shrink-0",children:[e.length," group",1!==e.length?"s":""]})]}),0===e.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No entity labels defined."}),(0,ep.jsx)("div",{className:"space-y-2",children:e.map((o,s)=>{let l=n[s]??!1,c="text"===o.type,u=!c;return(0,ep.jsxs)("div",{className:"border border-border/50 rounded-md bg-background",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>r(e=>({...e,[s]:!l})),className:"text-muted-foreground hover:text-foreground shrink-0",disabled:c,children:l&&u?(0,ep.jsx)(w6.ChevronDown,{className:"h-4 w-4"}):(0,ep.jsx)(eT.ChevronRight,{className:`h-4 w-4 ${c?"opacity-30":""}`})}),(0,ep.jsx)(eI.Input,{placeholder:"key (e.g. pedagogy)",value:o.key,onChange:e=>i(s,{key:e.target.value}),className:"h-8 text-xs font-mono w-36 shrink-0"}),(0,ep.jsx)(eI.Input,{placeholder:c?"description / examples":"description",value:o.description,onChange:e=>i(s,{description:e.target.value}),className:"h-8 text-xs flex-1 min-w-0"}),(0,ep.jsxs)(tR.Select,{value:o.type,onValueChange:e=>i(s,{type:e,..."text"===e?{values:[]}:{}}),children:[(0,ep.jsx)(tR.SelectTrigger,{className:"h-8 text-xs w-32 shrink-0",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"value",className:"text-xs",children:"Single value"}),(0,ep.jsx)(tR.SelectItem,{value:"multi-values",className:"text-xs",children:"Multi-values"}),(0,ep.jsx)(tR.SelectItem,{value:"text",className:"text-xs",children:"Free text"})]})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 cursor-pointer select-none",children:[(0,ep.jsx)(ph.Checkbox,{checked:o.tag,onCheckedChange:e=>i(s,{tag:!!e}),className:"h-4 w-4"}),"tag"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(e.filter((e,t)=>t!==s)),r(e=>{let t={...e};return delete t[s],t})},className:"text-muted-foreground hover:text-destructive shrink-0",children:(0,ep.jsx)(pa,{className:"h-3.5 w-3.5"})})]}),l&&u&&(0,ep.jsxs)("div",{className:"px-3 pb-3 space-y-1 border-t border-border/30 pt-2",children:[0===o.values.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic pl-5",children:"No values yet."}),o.values.map((t,n)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 pl-5",children:[(0,ep.jsx)(eI.Input,{placeholder:"value",value:t.value,onChange:e=>a(s,n,{value:e.target.value}),className:"h-8 text-xs font-mono w-32 shrink-0"}),(0,ep.jsx)(eI.Input,{placeholder:"description",value:t.description,onChange:e=>a(s,n,{description:e.target.value}),className:"h-8 text-xs flex-1 min-w-0"}),(0,ep.jsx)("button",{type:"button",onClick:()=>{i(s,{values:e[s].values.filter((e,t)=>t!==n)})},className:"text-muted-foreground hover:text-destructive shrink-0",children:(0,ep.jsx)(pa,{className:"h-3.5 w-3.5"})})]},n)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{i(s,{values:[...e[s].values,{value:"",description:""}]})},className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground pl-5 mt-1",children:[(0,ep.jsx)(fI.Plus,{className:"h-3 w-3"}),"Add value"]})]})]},s)})}),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let n=[...e,{key:"",description:"",type:"value",optional:!0,tag:!1,values:[]}];t(n),r(e=>({...e,[n.length-1]:!0}))},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,ep.jsx)(fI.Plus,{className:"h-3.5 w-3.5"}),"Add attribute"]})]})}function jL({value:e,onChange:t}){let n=t=>e.find(e=>e.category===t)?.threshold??"BLOCK_MEDIUM_AND_ABOVE";return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:['Set the blocking threshold for each harm category. "Off" disables the filter entirely (default for Gemini 2.5+). Lower thresholds block more content.'," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:jd.map(e=>(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,ep.jsx)("span",{className:"text-sm",children:e.label}),(0,ep.jsxs)(tR.Select,{value:n(e.value),onValueChange:r=>{var i;return i=e.value,void t(jd.map(e=>({category:e.value,threshold:e.value===i?r:n(e.value)})))},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsx)(tR.SelectContent,{children:jh.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,className:"text-xs",children:e.label},e.value))})]})]},e.value))})]})}let jI=(0,eN.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),jR=(0,eN.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),jB=(0,eN.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var jz=e.i(23287),jz=jz;let jF=(0,eN.default)("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"}]]),jV=(0,eN.default)("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"}]]);e.i(34471);var jU=Symbol.for("immer-nothing"),jH=Symbol.for("immer-draftable"),jW=Symbol.for("immer-state");function jY(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var jG=Object,jX=jG.getPrototypeOf,j$="constructor",jq="prototype",jK="configurable",jZ="enumerable",jQ="writable",jJ="value",j0=e=>!!e&&!!e[jW];function j1(e){return!!e&&(j3(e)||Ne(e)||!!e[jH]||!!e[j$]?.[jH]||Nt(e)||Nn(e))}var j2=jG[jq][j$].toString(),j5=new WeakMap;function j3(e){if(!e||!Nr(e))return!1;let t=jX(e);if(null===t||t===jG[jq])return!0;let n=jG.hasOwnProperty.call(t,j$)&&t[j$];if(n===Object)return!0;if(!Ni(n))return!1;let r=j5.get(n);return void 0===r&&(r=Function.toString.call(n),j5.set(n,r)),r===j2}function j4(e,t,n=!0){0===j6(e)?(n?Reflect.ownKeys(e):jG.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function j6(e){let t=e[jW];return t?t.type_:Ne(e)?1:Nt(e)?2:3*!!Nn(e)}var j8=(e,t,n=j6(e))=>2===n?e.has(t):jG[jq].hasOwnProperty.call(e,t),j7=(e,t,n=j6(e))=>2===n?e.get(t):e[t],j9=(e,t,n,r=j6(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},Ne=Array.isArray,Nt=e=>e instanceof Map,Nn=e=>e instanceof Set,Nr=e=>"object"==typeof e,Ni=e=>"function"==typeof e,Na=e=>e.modified_?e.copy_:e.base_;function No(e,t){if(Nt(e))return new Map(e);if(Nn(e))return new Set(e);if(Ne(e))return Array[jq].slice.call(e);let n=j3(e);if(!0!==t&&("class_only"!==t||n)){let t=jX(e);if(null!==t&&n)return{...e};let r=jG.create(t);return jG.assign(r,e)}{let t=jG.getOwnPropertyDescriptors(e);delete t[jW];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a[jQ]&&(a[jQ]=!0,a[jK]=!0),(a.get||a.set)&&(t[i]={[jK]:!0,[jQ]:!0,[jZ]:a[jZ],[jJ]:e[i]})}return jG.create(jX(e),t)}}function Ns(e,t=!1){return Nc(e)||j0(e)||!j1(e)||(j6(e)>1&&jG.defineProperties(e,{set:Nl,add:Nl,clear:Nl,delete:Nl}),jG.freeze(e),t&&j4(e,(e,t)=>{Ns(t,!0)},!1)),e}var Nl={[jJ]:function(){jY(2)}};function Nc(e){return!(null!==e&&Nr(e))||jG.isFrozen(e)}var Nu="MapSet",Nd="Patches",Nh="ArrayMethods",Nf={};function Np(e){let t=Nf[e];return t||jY(0,e),t}var Nm=e=>!!Nf[e];function Ng(e,t){t&&(e.patchPlugin_=Np(Nd),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Nv(e){Nx(e),e.drafts_.forEach(Nb),e.drafts_=null}function Nx(e){e===I&&(I=e.parent_)}var Ny=e=>I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Nm(Nu)?Np(Nu):void 0,arrayMethodsPlugin_:Nm(Nh)?Np(Nh):void 0};function Nb(e){let t=e[jW];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Nw(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(void 0!==e&&e!==n){n[jW].modified_&&(Nv(t),jY(4)),j1(e)&&(e=Nj(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[jW].base_,e,t)}else e=Nj(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ns(t,n)}(t,e,!0),Nv(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==jU?e:void 0}function Nj(e,t){if(Nc(t))return t;let n=t[jW];if(!n)return NS(t,e.handledSet_,e);if(!Nk(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);N_(n,e)}return n.copy_}function NN(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Nk=(e,t)=>e.scope_===t,NE=[];function NC(e,t,n,r){let i=e.copy_||e.base_,a=e.type_;if(void 0!==r&&j7(i,r,a)===t)return void j9(i,r,n,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;j4(i,(e,n)=>{if(j0(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}for(let r of e.draftLocations_.get(t)??NE)j9(i,r,n,a)}function N_(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}NN(e)}}function NS(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||j0(e)||t.has(e)||!j1(e)||Nc(e)||(t.add(e),j4(e,(r,i)=>{if(j0(i)){let t=i[jW];Nk(t,n)&&(j9(e,r,Na(t),e.type_),NN(t))}else j1(i)&&NS(i,t,n)})),e}var NT={get(e,t){let n;if(t===jW)return e;let r=e.scope_.arrayMethodsPlugin_,i=1===e.type_&&"string"==typeof t;if(i&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let a=e.copy_||e.base_;if(!j8(a,t,e.type_)){var o;let n;return o=e,(n=NM(a,t))?jJ in n?n[jJ]:n.get?.call(o.draft_):void 0}let s=a[t];if(e.finalized_||!j1(s)||i&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(n=+t)&&String(n)===t)return s;if(s===NO(e.base_,t)){ND(e);let n=1===e.type_?+t:t,r=NL(e.scope_,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in(e.copy_||e.base_),ownKeys:e=>Reflect.ownKeys(e.copy_||e.base_),set(e,t,n){let r=NM(e.copy_||e.base_,t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=NO(e.copy_||e.base_,t),i=r?.[jW];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||j8(e.base_,t,e.type_)))return!0;ND(e),NP(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_.set(t,!0),!function(e,t,n){let{scope_:r}=e;if(j0(n)){let i=n[jW];Nk(i,r)&&i.callbacks_.push(function(){ND(e),NC(e,n,Na(i),t)})}else j1(n)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(n)&&NS(n,r.handledSet_,r):j7(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&NS(j7(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n),!0)},deleteProperty:(e,t)=>(ND(e),void 0!==NO(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),NP(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=e.copy_||e.base_,r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[jQ]:!0,[jK]:1!==e.type_||"length"!==t,[jZ]:r[jZ],[jJ]:n[t]}:r},defineProperty(){jY(11)},getPrototypeOf:e=>jX(e.base_),setPrototypeOf(){jY(12)}},NA={};for(let e in NT){let t=NT[e];NA[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function NO(e,t){let n=e[jW];return(n?n.copy_||n.base_:e)[t]}function NM(e,t){if(!(t in e))return;let n=jX(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=jX(n)}}function NP(e){!e.modified_&&(e.modified_=!0,e.parent_&&NP(e.parent_))}function ND(e){e.copy_||(e.assigned_=new Map,e.copy_=No(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function NL(e,t,n,r){let[i,a]=Nt(t)?Np(Nu).proxyMap_(t,n):Nn(t)?Np(Nu).proxySet_(t,n):function(e,t){let n=Ne(e),r={type_:+!!n,scope_:t?t.scope_:I,modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=NT;n&&(i=[r],a=NA);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}(t,n);if((n?.scope_??I).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&void 0!==r)n.callbacks_.push(function(e){if(!a||!Nk(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=Na(a);NC(n,a.draft_??a,t,r),N_(a,e)});else a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)});return i}function NI(e){return j0(e)||jY(10,e),function e(t){let n;if(!j1(t)||Nc(t))return t;let r=t[jW],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=No(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=No(t,!0);return j4(n,(t,r)=>{j9(n,t,e(r))},i),r&&(r.finalized_=!1),n}(e)}NA.deleteProperty=function(e,t){return NA.set.call(this,e,t,void 0)},NA.set=function(e,t,n){return NT.set.call(this,e[0],t,n,e[0])};var NR=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{let r;if(Ni(e)&&!Ni(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if(Ni(t)||jY(6),void 0===n||Ni(n)||jY(7),j1(e)){let i=Ny(this),a=NL(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Nv(i):Nx(i)}return Ng(i,n),Nw(r,i)}if(e&&Nr(e))jY(1,e);else{if(void 0===(r=t(e))&&(r=e),r===jU&&(r=void 0),this.autoFreeze_&&Ns(r,!0),n){let t=[],i=[];Np(Nd).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return Ni(e)?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},(e=>"boolean"==typeof e)(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),(e=>"boolean"==typeof e)(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),(e=>"boolean"==typeof e)(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){j1(e)||jY(8),j0(e)&&(e=NI(e));let t=Ny(this),n=NL(t,e,void 0);return n[jW].isManual_=!0,Nx(t),n}finishDraft(e,t){let n=e&&e[jW];n&&n.isManual_||jY(9);let{scope_:r}=n;return Ng(r,t),Nw(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Np(Nd).applyPatches_;return j0(e)?r(e,t):this.produce(e,e=>r(e,t))}}().produce,NB=e=>Array.isArray(e)?e:[e],Nz=0,NF=class{revision=Nz;_value;_lastValue;_isEqual=NV;constructor(e,t=NV){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++Nz)}};function NV(e,t){return e===t}function NU(e){return e instanceof NF||console.warn("Not a valid cell! ",e),e.value}var NH=(e,t)=>!1;function NW(){return function(e=NV){return new NF(null,e)}(NH)}var NY=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=NW()),NU(t)};Symbol();var NG=0,NX=Object.getPrototypeOf({}),N$=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,Nq);tag=NW();tags={};children={};collectionTag=null;id=NG++},Nq={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in NX)return r;if("object"==typeof r&&null!==r){var i;let n=e.children[t];return void 0===n&&(n=e.children[t]=Array.isArray(i=r)?new NK(i):new N$(i)),n.tag&&NU(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=NW()).value=r),NU(n),r}})(),ownKeys:e=>(NY(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},NK=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],NZ);tag=NW();tags={};children={};collectionTag=null;id=NG++},NZ={get:([e],t)=>("length"===t&&NY(e),Nq.get(e,t)),ownKeys:([e])=>Nq.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>Nq.getOwnPropertyDescriptor(e,t),has:([e],t)=>Nq.has(e,t)},NQ="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function NJ(){return{s:0,v:void 0,o:null,p:null}}function N0(e,t={}){let n,r=NJ(),{resultEqualityCheck:i}=t,a=0;function o(){let t,o=r,{length:s}=arguments;for(let e=0;e<s;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=o.o;null===e&&(o.o=e=new WeakMap);let n=e.get(t);void 0===n?(o=NJ(),e.set(t,o)):o=n}else{let e=o.p;null===e&&(o.p=e=new Map);let n=e.get(t);void 0===n?(o=NJ(),e.set(t,o)):o=n}}let l=o;if(1===o.s)t=o.v;else if(t=e.apply(null,arguments),a++,i){let e=n?.deref?.()??n;null!=e&&i(e,t)&&(t=e,0!==a&&a--),n="object"==typeof t&&null!==t||"function"==typeof t?new NQ(t):t}return l.s=1,l.v=t,t}return o.clearCache=()=>{r=NJ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}var N1=function(e,...t){let n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r,i=0,a=0,o={},s=e.pop();"object"==typeof s&&(o=s,s=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);let{memoize:l,memoizeOptions:c=[],argsMemoize:u=N0,argsMemoizeOptions:d=[],devModeChecks:h={}}={...n,...o},f=NB(c),p=NB(d),g=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${n}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),v=l(function(){return i++,s.apply(null,arguments)},...f);return Object.assign(u(function(){a++;let e=function(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(g,arguments);return r=v.apply(null,e)},...p),{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>r,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:l,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}(N0),N2=Object.assign((e,t=N1)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>N2});function N5(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var N3="function"==typeof Symbol&&Symbol.observable||"@@observable",N4=()=>Math.random().toString(36).substring(7).split("").join("."),N6={INIT:`@@redux/INIT${N4()}`,REPLACE:`@@redux/REPLACE${N4()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${N4()}`};function N8(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function N7(e){let t,n=Object.keys(e),r={};for(let t=0;t<n.length;t++){let i=n[t];"function"==typeof e[i]&&(r[i]=e[i])}let i=Object.keys(r);try{Object.keys(r).forEach(e=>{let t=r[e];if(void 0===t(void 0,{type:N6.INIT}))throw Error(N5(12));if(void 0===t(void 0,{type:N6.PROBE_UNKNOWN_ACTION()}))throw Error(N5(13))})}catch(e){t=e}return function(e={},n){if(t)throw t;let a=!1,o={};for(let t=0;t<i.length;t++){let s=i[t],l=r[s],c=e[s],u=l(c,n);if(void 0===u)throw n&&n.type,Error(N5(14));o[s]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?o:e}}function N9(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function ke(e){return N8(e)&&"type"in e&&"string"==typeof e.type}function kt(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var kn=kt(),kr="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?N9:N9.apply(null,arguments)};function ki(e,t){function n(...r){if(t){let n=t(...r);if(!n)throw Error(kX(0));return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ke(t)&&t.type===e,n}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ka=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function ko(e){return j1(e)?NR(e,()=>{}):e}function ks(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var kl="RTK_autoBatch",kc=()=>e=>({payload:e,meta:{[kl]:!0}}),ku=e=>t=>{setTimeout(t,e)},kd=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"u">typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:ku(10):"callback"===e.type?e.queueNotification:ku(e.timeout),c=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return(a=!(i=!e?.meta?.[kl]))&&!o&&(o=!0,l(c)),r.dispatch(e)}finally{i=!0}}})};function kh(e){let t,n={},r=[],i={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(kX(28));if(r in n)throw Error(kX(29));return n[r]=t,i},addAsyncThunk:(e,t)=>(t.pending&&(n[e.pending.type]=t.pending),t.rejected&&(n[e.rejected.type]=t.rejected),t.fulfilled&&(n[e.fulfilled.type]=t.fulfilled),t.settled&&r.push({matcher:e.settled,reducer:t.settled}),i),addMatcher:(e,t)=>(r.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(t=e,i)};return e(i),[n,r,t]}var kf=Symbol.for("rtk-slice-createasyncthunk"),kp=((c=kp||{}).reducer="reducer",c.reducerWithPrepare="reducerWithPrepare",c.asyncThunk="asyncThunk",c),km=function({creators:e}={}){let t=e?.asyncThunk?.[kf];return function(e){let n,{name:r,reducerPath:i=r}=e;if(!r)throw Error(kX(11));let a=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(a),s={},l={},c={},u=[],d={addCase(e,t){let n="string"==typeof e?e:e.type;if(!n)throw Error(kX(12));if(n in l)throw Error(kX(13));return l[n]=t,d},addMatcher:(e,t)=>(u.push({matcher:e,reducer:t}),d),exposeAction:(e,t)=>(c[e]=t,d),exposeCaseReducer:(e,t)=>(s[e]=t,d)};function h(){let[t={},n=[],r]="function"==typeof e.extraReducers?kh(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let n,[r,i,a]=kh(t);if("function"==typeof e)n=()=>ko(e());else{let t=ko(e);n=()=>t}function o(e=n(),t){let s=[r[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===s.filter(e=>!!e).length&&(s=[a]),s.reduce((e,n)=>{if(n)if(j0(e)){let r=n(e,t);return void 0===r?e:r}else{if(j1(e))return NR(e,e=>n(e,t));let r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e},e)}return o.getInitialState=n,o}(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of u)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}o.forEach(n=>{let i=a[n],o={reducerName:n,type:`${r}/${n}`,createNotation:"function"==typeof e.reducers};"asyncThunk"===i._reducerDefinitionType?function({type:e,reducerName:t},n,r,i){if(!i)throw Error(kX(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),l&&r.addCase(d.rejected,l),c&&r.addMatcher(d.settled,c),r.exposeCaseReducer(t,{fulfilled:o||kg,pending:s||kg,rejected:l||kg,settled:c||kg})}(o,i,d,t):function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&"reducerWithPrepare"!==r._reducerDefinitionType)throw Error(kX(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ki(e,o):ki(e))}(o,i,d)});let f=e=>e,p=new Map,g=new WeakMap;function v(e,t){return n||(n=h()),n(e,t)}function x(){return n||(n=h()),n.getInitialState()}function y(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=ks(g,r,x)),i}function i(t=f){let r=ks(p,n,()=>new WeakMap);return ks(r,t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=function(e,t,n,r){function i(a,...o){let s=t(a);return void 0===s&&r&&(s=n()),e(s,...o)}return i.unwrapped=e,i}(a,t,()=>ks(g,t,x),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let b={name:r,reducer:v,actions:c,caseReducers:s,getInitialState:x,...y(i),injectInto(e,{reducerPath:t,...n}={}){let r=t??i;return e.inject({reducerPath:r,reducer:v},n),{...b,...y(r,!0)}}};return b}}();function kg(){}var kv="listener",kx="completed",ky="cancelled",kb=`task-${ky}`,kw=`task-${kx}`,kj=`${kv}-${ky}`,kN=`${kv}-${kx}`,kk=class{constructor(e){this.code=e,this.message=`task ${ky} (reason: ${e})`}name="TaskAbortError";message},kE=(e,t)=>{if("function"!=typeof e)throw TypeError(kX(32))},kC=()=>{},k_=(e,t=kC)=>(e.catch(t),e),kS=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),kT=e=>{if(e.aborted)throw new kk(e.reason)};function kA(e,t){let n=kC;return new Promise((r,i)=>{let a=()=>i(new kk(e.reason));e.aborted?a():(n=kS(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=kC})}var kO=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof kk?"cancelled":"rejected",error:e}}finally{t?.()}},kM=e=>t=>k_(kA(e,t).then(t=>(kT(e),t))),kP=e=>{let t=kM(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:kD}=Object,kL={},kI="listenerMiddleware",kR=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=ki(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(i);else throw Error(kX(21));return kE(a,"options.listener"),{predicate:i,type:t,effect:a}},kB=kD(e=>{let{type:t,predicate:n,effect:r}=kR(e);return{id:((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(kX(22))}}},{withTypes:()=>kB}),kz=(e,t)=>{let{type:n,effect:r,predicate:i}=kR(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},kF=e=>{e.pending.forEach(e=>{e.abort(kj)})},kV=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},kU=kD(ki(`${kI}/add`),{withTypes:()=>kU}),kH=ki(`${kI}/removeAll`),kW=kD(ki(`${kI}/remove`),{withTypes:()=>kW}),kY=(...e)=>{console.error(`${kI}/error`,...e)},kG=(e={})=>{let t=new Map,n=new Map,{extra:r,onError:i=kY}=e;kE(i,"onError");let a=e=>{var n;return(n=kz(t,e)??kB(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),e?.cancelActive&&kF(n)}};kD(a,{withTypes:()=>a});let o=e=>{let n=kz(t,e);return n&&(n.unsubscribe(),e.cancelActive&&kF(n)),!!n};kD(o,{withTypes:()=>o});let s=async(e,o,s,l)=>{var c,u;let d,h=new AbortController,f=(c=h.signal,d=async(e,t)=>{kT(c);let n=()=>{},r=[new Promise((t,r)=>{let i=a({predicate:e,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});n=()=>{i(),r()}})];null!=t&&r.push(new Promise(e=>setTimeout(e,t,null)));try{let e=await kA(c,Promise.race(r));return kT(c),e}finally{n()}},(e,t)=>k_(d(e,t))),p=[];try{let i;e.pending.add(h),i=n.get(e)??0,n.set(e,i+1),await Promise.resolve(e.effect(o,kD({},s,{getOriginalState:l,condition:(e,t)=>f(e,t).then(Boolean),take:f,delay:kP(h.signal),pause:kM(h.signal),extra:r,signal:h.signal,fork:(u=h.signal,(e,t)=>{kE(e,"taskExecutor");let n=new AbortController;kS(u,()=>n.abort(u.reason));let r=kO(async()=>{kT(u),kT(n.signal);let t=await e({pause:kM(n.signal),delay:kP(n.signal),signal:n.signal});return kT(n.signal),t},()=>n.abort(kw));return t?.autoJoin&&p.push(r.catch(kC)),{result:kM(u)(r),cancel(){n.abort(kb)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==h&&(e.abort(kj),n.delete(e))})},cancel:()=>{h.abort(kj),e.pending.delete(h)},throwIfCancelled:()=>{kT(h.signal)}})))}catch(e){e instanceof kk||kV(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(p),h.abort(kN),1===(t=n.get(e)??1)?n.delete(e):n.set(e,t-1),e.pending.delete(h)}},l=()=>{for(let e of n.keys())kF(e);t.clear()};return{middleware:e=>n=>r=>{let c;if(!ke(r))return n(r);if(kU.match(r))return a(r.payload);if(kH.match(r))return void l();if(kW.match(r))return o(r.payload);let u=e.getState(),d=()=>{if(u===kL)throw Error(kX(23));return u};try{if(c=n(r),t.size>0){let n=e.getState();for(let a of Array.from(t.values())){let t=!1;try{t=a.predicate(r,n,u)}catch(e){t=!1,kV(i,e,{raisedBy:"predicate"})}t&&s(a,r,e,d)}}}finally{u=kL}return c},startListening:a,stopListening:o,clearListeners:l}};function kX(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");var k$=e.i(92068);function kq(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function kK(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((e,t,r)=>{var i=n[r-1];return"string"==typeof i?e+i+t:void 0!==i?e+kq(i)+t:e+t},"")}var kZ=e=>0===e?0:e>0?1:-1,kQ=e=>"number"==typeof e&&e!=+e,kJ=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,k0=e=>("number"==typeof e||e instanceof Number)&&!kQ(e),k1=e=>k0(e)||"string"==typeof e,k2=0,k5=e=>{var t=++k2;return"".concat(e||"").concat(t)},k3=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!k0(e)&&"string"!=typeof e)return r;if(kJ(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return kQ(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},k4=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(n[String(e[r])])return!0;else n[String(e[r])]=!0;return!1};function k6(e,t,n){return k0(e)&&k0(t)?kq(e+n*(t-e)):t}function k8(e,t,n){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,k$.default)(e,t))===n)}var k7=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function k9(e){return null!=e}function Ee(){}function Et(e,t){if(t){var n=Number.parseInt(t,10);if(!kQ(n))return null==e?void 0:e[n]}}var En=km({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Er=En.reducer,{createEventEmitter:Ei}=En.actions,Ea=(e.i(13027),{notify(){},get:()=>[]}),Eo="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Es="u">typeof navigator&&"ReactNative"===navigator.product,El=Eo||Es?em.useLayoutEffect:em.useEffect;function Ec(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var Eu=Symbol.for("react-redux-context"),Ed="u">typeof globalThis?globalThis:{},Eh=function(){if(!em.createContext)return{};let e=Ed[Eu]??=new Map,t=e.get(em.createContext);return t||(t=em.createContext(null),e.set(em.createContext,t)),t}(),Ef=function(e){let{children:t,context:n,serverState:r,store:i}=e,a=em.useMemo(()=>{let e=function(e){let t,n=Ea,r=0,i=!1;function a(){l.onStateChange&&l.onStateChange()}function o(){if(r++,!t){let r,i;t=e.subscribe(a),r=null,i=null,n={clear(){r=null,i=null},notify(){let e=r;for(;e;)e.callback(),e=e.next},get(){let e=[],t=r;for(;t;)e.push(t),t=t.next;return e},subscribe(e){let t=!0,n=i={callback:e,next:null,prev:i};return n.prev?n.prev.next=n:r=n,function(){t&&null!==r&&(t=!1,n.next?n.next.prev=n.prev:i=n.prev,n.prev?n.prev.next=n.next:r=n.next)}}}}}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=Ea)}let l={addNestedSub:function(e){o();let t=n.subscribe(e),r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:a,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,o())},tryUnsubscribe:function(){i&&(i=!1,s())},getListeners:()=>n};return l}(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=em.useMemo(()=>i.getState(),[i]);return El(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]),em.createElement((n||Eh).Provider,{value:a},t)};function Ep(e=Eh){return function(){return em.useContext(e)}}var Em=Ep(),Eg=Symbol.for("immer-nothing"),Ev=Symbol.for("immer-draftable"),Ex=Symbol.for("immer-state");function Ey(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Eb=Object.getPrototypeOf;function Ew(e){return!!e&&!!e[Ex]}function Ej(e){return!!e&&(EE(e)||Array.isArray(e)||!!e[Ev]||!!e.constructor?.[Ev]||EA(e)||EO(e))}var EN=Object.prototype.constructor.toString(),Ek=new WeakMap;function EE(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=Ek.get(n);return void 0===r&&(r=Function.toString.call(n),Ek.set(n,r)),r===EN}function EC(e,t,n=!0){0===E_(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function E_(e){let t=e[Ex];return t?t.type_:Array.isArray(e)?1:EA(e)?2:3*!!EO(e)}function ES(e,t){return 2===E_(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ET(e,t,n){let r=E_(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function EA(e){return e instanceof Map}function EO(e){return e instanceof Set}function EM(e){return e.copy_||e.base_}function EP(e,t){if(EA(e))return new Map(e);if(EO(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=EE(e);if(!0!==t&&("class_only"!==t||n)){let t=Eb(e);return null!==t&&n?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[Ex];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Eb(e),t)}}function ED(e,t=!1){return EI(e)||Ew(e)||!Ej(e)||(E_(e)>1&&Object.defineProperties(e,{set:EL,add:EL,clear:EL,delete:EL}),Object.freeze(e),t&&Object.values(e).forEach(e=>ED(e,!0))),e}var EL={value:function(){Ey(2)}};function EI(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var ER={};function EB(e){let t=ER[e];return t||Ey(0,e),t}function Ez(e,t){t&&(EB("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function EF(e){EV(e),e.drafts_.forEach(EH),e.drafts_=null}function EV(e){e===R&&(R=e.parent_)}function EU(e){return R={drafts_:[],parent_:R,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function EH(e){let t=e[Ex];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function EW(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ex].modified_&&(EF(t),Ey(4)),Ej(e)&&(e=EY(t,e),t.parent_||EX(t,e)),t.patches_&&EB("Patches").generateReplacementPatches_(n[Ex].base_,e,t.patches_,t.inversePatches_)):e=EY(t,n,[]),EF(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Eg?e:void 0}function EY(e,t,n){if(EI(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[Ex];if(!i)return EC(t,(r,a)=>EG(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return EX(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;3===i.type_&&(a=new Set(t),t.clear(),o=!0),EC(a,(r,a)=>EG(e,i,t,r,a,n,o),r),EX(e,t,!1),n&&e.patches_&&EB("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function EG(e,t,n,r,i,a,o){if(null==i||"object"!=typeof i&&!o)return;let s=EI(i);if(!s||o){if(Ew(i)){let o=EY(e,i,a&&t&&3!==t.type_&&!ES(t.assigned_,r)?a.concat(r):void 0);if(ET(n,r,o),!Ew(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(Ej(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;EY(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&(EA(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&EX(e,i)}}}function EX(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ED(t,n)}var E$={get(e,t){if(t===Ex)return e;let n=EM(e);if(!ES(n,t)){var r;let i;return r=e,(i=EZ(n,t))?"value"in i?i.value:i.get?.call(r.draft_):void 0}let i=n[t];return e.finalized_||!Ej(i)?i:i===EK(e.base_,t)?(EJ(e),e.copy_[t]=E1(i,e)):i},has:(e,t)=>t in EM(e),ownKeys:e=>Reflect.ownKeys(EM(e)),set(e,t,n){let r=EZ(EM(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=EK(EM(e),t),i=r?.[Ex];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||ES(e.base_,t)))return!0;EJ(e),EQ(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty:(e,t)=>(void 0!==EK(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,EJ(e),EQ(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=EM(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ey(11)},getPrototypeOf:e=>Eb(e.base_),setPrototypeOf(){Ey(12)}},Eq={};function EK(e,t){let n=e[Ex];return(n?EM(n):e)[t]}function EZ(e,t){if(!(t in e))return;let n=Eb(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Eb(n)}}function EQ(e){!e.modified_&&(e.modified_=!0,e.parent_&&EQ(e.parent_))}function EJ(e){e.copy_||(e.copy_=EP(e.base_,e.scope_.immer_.useStrictShallowCopy_))}EC(E$,(e,t)=>{Eq[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Eq.deleteProperty=function(e,t){return Eq.set.call(this,e,t,void 0)},Eq.set=function(e,t,n){return E$.set.call(this,e[0],t,n,e[0])};var E0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{let r;if("function"==typeof e&&"function"!=typeof t){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if("function"!=typeof t&&Ey(6),void 0!==n&&"function"!=typeof n&&Ey(7),Ej(e)){let i=EU(this),a=E1(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?EF(i):EV(i)}return Ez(i,n),EW(r,i)}if(e&&"object"==typeof e)Ey(1,e);else{if(void 0===(r=t(e))&&(r=e),r===Eg&&(r=void 0),this.autoFreeze_&&ED(r,!0),n){let t=[],i=[];EB("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return"function"==typeof e?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;Ej(e)||Ey(8),Ew(e)&&(Ew(t=e)||Ey(10,t),e=function e(t){let n;if(!Ej(t)||EI(t))return t;let r=t[Ex],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=EP(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=EP(t,!0);return EC(n,(t,r)=>{ET(n,t,e(r))},i),r&&(r.finalized_=!1),n}(t));let n=EU(this),r=E1(e,void 0);return r[Ex].isManual_=!0,EV(n),r}finishDraft(e,t){let n=e&&e[Ex];n&&n.isManual_||Ey(9);let{scope_:r}=n;return Ez(r,t),EW(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=EB("Patches").applyPatches_;return Ew(e)?r(e,t):this.produce(e,e=>r(e,t))}};function E1(e,t){let n=EA(e)?EB("MapSet").proxyMap_(e,t):EO(e)?EB("MapSet").proxySet_(e,t):function(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:R,modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=E$;n&&(i=[r],a=Eq);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}(e,t);return(t?t.scope_:R).drafts_.push(n),n}new E0().produce;var E2={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},E5=km({name:"tooltip",initialState:{itemInteraction:{click:E2,hover:E2},axisInteraction:{click:E2,hover:E2},keyboardInteraction:E2,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:kc()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NI(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:kc()},removeTooltipEntrySettings:{reducer(e,t){var n=NI(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:kc()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:E3,replaceTooltipEntrySettings:E4,removeTooltipEntrySettings:E6,setTooltipSettingsState:E8,setActiveMouseOverItemIndex:E7,mouseLeaveItem:E9,mouseLeaveChart:Ce,setActiveClickItemIndex:Ct,setMouseOverAxisIndex:Cn,setMouseClickAxisIndex:Cr,setSyncInteraction:Ci,setKeyboardInteraction:Ca}=E5.actions,Co=E5.reducer,Cs=km({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;null!=n&&(e.dataStartIndex=n),null!=r&&(e.dataEndIndex=r)}}}),{setChartData:Cl,setDataStartEndIndexes:Cc,setComputedData:Cu}=Cs.actions,Cd=Cs.reducer,Ch=km({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=null!=(n=t.payload.top)?n:0,e.margin.right=null!=(r=t.payload.right)?r:0,e.margin.bottom=null!=(i=t.payload.bottom)?i:0,e.margin.left=null!=(a=t.payload.left)?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Cf,setLayout:Cp,setChartSize:Cm,setScale:Cg}=Ch.actions,Cv=Ch.reducer,Cx=e.i(30224),Cy=(0,em.createContext)(null),Cb=e=>e,Cw=()=>{var e=(0,em.useContext)(Cy);return e?e.store.dispatch:Cb},Cj=()=>{},CN=()=>Cj,Ck=(e,t)=>e===t;function CE(e){var t=(0,em.useContext)(Cy);return(0,Cx.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:CN,t?t.store.getState:Cj,t?t.store.getState:Cj,t?e:Cj,Ck)}var CC=e.i(42342),C_=e=>e.legend.settings;function CS(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function CT(e){return function(){return e}}function CA(e,t){if((i=e.length)>1)for(var n,r,i,a=1,o=e[t[0]],s=o.length;a<i;++a)for(r=o,o=e[t[a]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function CO(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function CM(e,t){return e[t]}function CP(e){let t=[];return t.key=e,t}function CD(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function CL(e){return Number.isFinite(e)}function CI(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function CR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function CB(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CR(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Cz(e,t,n){return null==e||null==t?n:k1(t)?(0,k$.default)(e,t,n):"function"==typeof t?t(e):n}N1([e=>e.legend.payload,C_],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,CC.default)(r,n):r}),Array.prototype.slice;var CF=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,CV=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},CU=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:u,ticks:d,niceTicks:h,axisType:f}=e;if(!o)return null;var p="scaleBand"===s&&o.bandwidth?o.bandwidth()/2:2,g=(t||n)&&"category"===i&&o.bandwidth?o.bandwidth()/p:0;return(g="angleAxis"===f&&a&&a.length>=2?2*kZ(a[0]-a[1])*g:g,t&&(d||h))?(d||h||[]).map((e,t)=>({coordinate:o(r?r.indexOf(e):e)+g,value:e,offset:g,index:t})).filter(e=>!kQ(e.coordinate)):l&&c?c.map((e,t)=>({coordinate:o(e)+g,value:e,index:t,offset:g})):o.ticks&&!n&&null!=u?o.ticks(u).map((e,t)=>({coordinate:o(e)+g,value:e,offset:g,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+g,value:r?r[e]:e,index:t,offset:g}))},CH={sign:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0,s=0;s<n;++s){var l=e[s],c=null==l?void 0:l[i];if(null!=c){var u=c[1],d=c[0],h=kQ(u)?d:u;h>=0?(c[0]=a,c[1]=a+h,a=u):(c[0]=o,c[1]=o+h,o=u)}}}},expand:function(e,t){if((r=e.length)>0){for(var n,r,i,a=0,o=e[0].length;a<o;++a){for(i=n=0;n<r;++n)i+=e[n][a][1]||0;if(i)for(n=0;n<r;++n)e[n][a][1]/=i}CA(e,t)}},none:CA,silhouette:function(e,t){if((n=e.length)>0){for(var n,r=0,i=e[t[0]],a=i.length;r<a;++r){for(var o=0,s=0;o<n;++o)s+=e[o][r][1]||0;i[r][1]+=i[r][0]=-s/2}CA(e,t)}},wiggle:function(e,t){if((i=e.length)>0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,a=0,o=1;o<r;++o){for(var s=0,l=0,c=0;s<i;++s){for(var u=e[t[s]],d=u[o][1]||0,h=(d-(u[o-1][1]||0))/2,f=0;f<s;++f){var p=e[t[f]];h+=(p[o][1]||0)-(p[o-1][1]||0)}l+=d,c+=h*d}n[o-1][1]+=n[o-1][0]=a,l&&(a-=c/l)}n[o-1][1]+=n[o-1][0]=a,CA(e,t)}},positive:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0;o<n;++o){var s=e[o],l=null==s?void 0:s[i];if(null!=l){var c=kQ(l[1])?l[0]:l[1];c>=0?(l[0]=a,l[1]=a+c,a=l[1]):(l[0]=0,l[1]=0)}}}}};function CW(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&null!=i[t.dataKey]){var s=k8(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=Cz(i,null==o?t.dataKey:o);return null==l?null:t.scale(l)}var CY=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,CG=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,CX=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,CC.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],c=i[o-1];a=Math.min(((null==l?void 0:l.coordinate)||0)-((null==c?void 0:c.coordinate)||0),a)}return a===1/0?0:a}return n?void 0:0};function C$(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return CB(CB({},t),{},{dataKey:n,payload:r,value:i,name:a})}function Cq(e,t){return e?String(e):"string"==typeof t?t:void 0}var CK=e=>e.layout.width,CZ=e=>e.layout.height,CQ=e=>e.layout.scale,CJ=e=>e.layout.margin,C0=N1(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),C1=N1(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function C2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C5(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C2(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var C3=N1([CK,CZ,CJ,e=>e.brush.height,function(e){return C1(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return C1(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return C0(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return C0(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},C_,e=>e.legend.size],(e,t,n,r,i,a,o,s,l,c)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=C5(C5({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),h=d.bottom;d.bottom+=r;var f=e-(d=((e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if(("vertical"===s||"horizontal"===s&&"middle"===o)&&"center"!==a&&k0(e[a]))return CB(CB({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===s||"vertical"===s&&"center"===a)&&"middle"!==o&&k0(e[o]))return CB(CB({},e),{},{[o]:e[o]+(i||0)})}return e})(d,l,c)).left-d.right,p=t-d.top-d.bottom;return C5(C5({brushBottom:h},d),{},{width:Math.max(f,0),height:Math.max(p,0)})}),C4=N1(C3,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),C6=N1(CK,CZ,(e,t)=>({x:0,y:0,width:e,height:t})),C8=(0,em.createContext)(null),C7=()=>null!=(0,em.useContext)(C8),C9=e=>e.brush,_e=N1([C9,C3,CJ],(e,t,n)=>({height:e.height,x:k0(e.x)?e.x:t.left,y:k0(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:k0(e.width)?e.width:t.width})),_t=e.i(7670),_n=e.i(58723),_r=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if("u">typeof console&&console.warn&&(void 0===t&&console.warn("LogUtils requires an error message argument"),!e))if(void 0===t)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(t.replace(/%s/g,()=>r[a++]))}},_i=(e,t,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=kJ(r)?e:Number(r),l=kJ(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&null!=l&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},_a={width:0,height:0,overflow:"visible"},_o={width:0,overflowX:"visible"},_s={height:0,overflowY:"visible"},_l={};function _c(){return(_c=Object.assign.bind()).apply(null,arguments)}function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_u(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _h=(0,em.createContext)({width:-1,height:-1});function _f(e){var{children:t,width:n,height:r}=e,i=(0,em.useMemo)(()=>({width:n,height:r}),[n,r]);return CI(i.width)&&CI(i.height)?em.createElement(_h.Provider,{value:i},t):null}var _p=()=>(0,em.useContext)(_h),_m=(0,em.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:l,children:c,debounce:u=0,id:d,className:h,onResize:f,style:p={}}=e,g=(0,em.useRef)(null),v=(0,em.useRef)();v.current=f,(0,em.useImperativeHandle)(t,()=>g.current);var[x,y]=(0,em.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,em.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,em.useEffect)(()=>{if(null==g.current||"u"<typeof ResizeObserver)return Ee;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;b(n,r),null==(t=v.current)||t.call(v,n,r)};u>0&&(e=(0,_n.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=g.current.getBoundingClientRect();return b(n,r),t.observe(g.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:w,containerHeight:j}=x;_r(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:N,calculatedHeight:k}=_i(w,j,{width:i,height:a,aspect:n,maxHeight:l});return _r(null!=N&&N>0||null!=k&&k>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",N,k,i,a,o,s,n),em.createElement("div",{id:d?"".concat(d):void 0,className:(0,_t.clsx)("recharts-responsive-container",h),style:_d(_d({},p),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},em.createElement("div",{style:(e=>{var{width:t,height:n}=e,r=kJ(t),i=kJ(n);return r&&i?_a:r?_o:i?_s:_l})({width:i,height:a})},em.createElement(_f,{width:N,height:k},c)))}),_g=(0,em.forwardRef)((e,t)=>{var n=_p();if(CI(n.width)&&CI(n.height))return e.children;var{width:r,height:i}=function(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return void 0===i&&void 0===a?(i="100%",a="100%"):void 0===i?i=r&&r>0?void 0:"100%":void 0===a&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=_i(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return k0(a)&&k0(o)?em.createElement(_f,{width:a,height:o},e.children):em.createElement(_m,_c({},e,{width:r,height:i,ref:t}))});function _v(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var _x=()=>{var e,t=C7(),n=CE(C4),r=CE(_e),i=null==(e=CE(C9))?void 0:e.padding;return t&&r&&i?{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}:n},_y={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_b=()=>{var e;return null!=(e=CE(C3))?e:_y},_w=e=>e.layout.layoutType,_j=e=>{var t=Cw(),n=C7(),{width:r,height:i}=e,a=_p(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,em.useEffect)(()=>{!n&&CI(o)&&CI(s)&&t(Cm({width:o,height:s}))},[t,n,o,s]),null},_N=e.i(66814);function _k(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function _E(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}e.s([],25212),e.i(25212),e.s([],67155),e.i(67155);class _C extends Map{constructor(e,t=_S){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(__(this,e))}has(e){return super.has(__(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}(this,e))}}function __({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _S(e){return null!==e&&"object"==typeof e?e.valueOf():e}let _T=Symbol("implicit");function _A(){var e=new _C,t=[],n=[],r=_T;function i(i){let a=e.get(i);if(void 0===a){if(r!==_T)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();for(let r of(t=[],e=new _C,n))e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return _A(t,n).unknown(r)},_k.apply(i,arguments),i}function _O(){var e,t,n=_A().unknown(void 0),r=n.domain,i=n.range,a=0,o=1,s=!1,l=0,c=0,u=.5;function d(){var n=r().length,d=o<a,h=d?o:a,f=d?a:o;e=(f-h)/Math.max(1,n-l+2*c),s&&(e=Math.floor(e)),h+=(f-h-e*(n-l))*u,t=e*(1-l),s&&(h=Math.round(h),t=Math.round(t));var p=(function(e,t,n){e*=1,t*=1,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);++r<i;)a[r]=e+r*n;return a})(n).map(function(t){return h+e*t});return i(d?p.reverse():p)}return delete n.unknown,n.domain=function(e){return arguments.length?(r(e),d()):r()},n.range=function(e){return arguments.length?([a,o]=e,a*=1,o*=1,d()):[a,o]},n.rangeRound=function(e){return[a,o]=e,a*=1,o*=1,s=!0,d()},n.bandwidth=function(){return t},n.step=function(){return e},n.round=function(e){return arguments.length?(s=!!e,d()):s},n.padding=function(e){return arguments.length?(l=Math.min(1,c=+e),d()):l},n.paddingInner=function(e){return arguments.length?(l=Math.min(1,e),d()):l},n.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},n.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},n.copy=function(){return _O(r(),[a,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},_k.apply(d(),arguments)}function _M(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return e(n())},t}(_O.apply(null,arguments).paddingInner(1))}let _P=Math.sqrt(50),_D=Math.sqrt(10),_L=Math.sqrt(2);function _I(e,t,n){let r,i,a,o=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(o)),l=o/Math.pow(10,s),c=l>=_P?10:l>=_D?5:l>=_L?2:1;return(s<0?(r=Math.round(e*(a=Math.pow(10,-s)/c)),i=Math.round(t*a),r/a<e&&++r,i/a>t&&--i,a=-a):(r=Math.round(e/(a=Math.pow(10,s)*c)),i=Math.round(t/a),r*a<e&&++r,i*a>t&&--i),i<r&&.5<=n&&n<2)?_I(e,t,2*n):[r,i,a]}function _R(e,t,n){if(t*=1,e*=1,!((n*=1)>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?_I(t,e,n):_I(e,t,n);if(!(a>=i))return[];let s=a-i+1,l=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)l[e]=-((a-e)/o);else for(let e=0;e<s;++e)l[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)l[e]=-((i+e)/o);else for(let e=0;e<s;++e)l[e]=(i+e)*o;return l}function _B(e,t,n){return _I(e*=1,t*=1,n*=1)[2]}function _z(e,t,n){t*=1,e*=1,n*=1;let r=t<e,i=r?_B(t,e,n):_B(e,t,n);return(r?-1:1)*(i<0?-(1/i):i)}function _F(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _V(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _U(e){let t,n,r;function i(e,r,a=0,o=e.length){if(a<o){if(0!==t(r,r))return o;do{let t=a+o>>>1;0>n(e[t],r)?a=t+1:o=t}while(a<o)}return a}return 2!==e.length?(t=_F,n=(t,n)=>_F(e(t),n),r=(t,n)=>e(t)-n):(t=e===_F||e===_V?e:_H,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i<a){if(0!==t(r,r))return a;do{let t=i+a>>>1;0>=n(e[t],r)?i=t+1:a=t}while(i<a)}return i}}}function _H(){return 0}function _W(e){return null===e?NaN:+e}let _Y=_U(_F),_G=_Y.right;function _X(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _$(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _q(){}_Y.left,_U(_W).center;var _K="\\s*([+-]?\\d+)\\s*",_Z="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_Q="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_J=/^#([0-9a-f]{3,8})$/,_0=RegExp(`^rgb\\(${_K},${_K},${_K}\\)$`),_1=RegExp(`^rgb\\(${_Q},${_Q},${_Q}\\)$`),_2=RegExp(`^rgba\\(${_K},${_K},${_K},${_Z}\\)$`),_5=RegExp(`^rgba\\(${_Q},${_Q},${_Q},${_Z}\\)$`),_3=RegExp(`^hsl\\(${_Z},${_Q},${_Q}\\)$`),_4=RegExp(`^hsla\\(${_Z},${_Q},${_Q},${_Z}\\)$`),_6={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function _8(){return this.rgb().formatHex()}function _7(){return this.rgb().formatRgb()}function _9(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_J.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Se(t):3===n?new Sr(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?St(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?St(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=_0.exec(e))?new Sr(t[1],t[2],t[3],1):(t=_1.exec(e))?new Sr(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=_2.exec(e))?St(t[1],t[2],t[3],t[4]):(t=_5.exec(e))?St(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=_3.exec(e))?Sc(t[1],t[2]/100,t[3]/100,1):(t=_4.exec(e))?Sc(t[1],t[2]/100,t[3]/100,t[4]):_6.hasOwnProperty(e)?Se(_6[e]):"transparent"===e?new Sr(NaN,NaN,NaN,0):null}function Se(e){return new Sr(e>>16&255,e>>8&255,255&e,1)}function St(e,t,n,r){return r<=0&&(e=t=n=NaN),new Sr(e,t,n,r)}function Sn(e,t,n,r){var i;return 1==arguments.length?((i=e)instanceof _q||(i=_9(i)),i)?new Sr((i=i.rgb()).r,i.g,i.b,i.opacity):new Sr:new Sr(e,t,n,null==r?1:r)}function Sr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Si(){return`#${Sl(this.r)}${Sl(this.g)}${Sl(this.b)}`}function Sa(){let e=So(this.opacity);return`${1===e?"rgb(":"rgba("}${Ss(this.r)}, ${Ss(this.g)}, ${Ss(this.b)}${1===e?")":`, ${e})`}`}function So(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ss(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sl(e){return((e=Ss(e))<16?"0":"")+e.toString(16)}function Sc(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Sd(e,t,n,r)}function Su(e){if(e instanceof Sd)return new Sd(e.h,e.s,e.l,e.opacity);if(e instanceof _q||(e=_9(e)),!e)return new Sd;if(e instanceof Sd)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new Sd(o,s,l,e.opacity)}function Sd(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Sh(e){return(e=(e||0)%360)<0?e+360:e}function Sf(e){return Math.max(0,Math.min(1,e||0))}function Sp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function Sm(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}_X(_q,_9,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_8,formatHex:_8,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Su(this).formatHsl()},formatRgb:_7,toString:_7}),_X(Sr,Sn,_$(_q,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Sr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Sr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Sr(Ss(this.r),Ss(this.g),Ss(this.b),So(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Si,formatHex:Si,formatHex8:function(){return`#${Sl(this.r)}${Sl(this.g)}${Sl(this.b)}${Sl((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:Sa,toString:Sa})),_X(Sd,function(e,t,n,r){return 1==arguments.length?Su(e):new Sd(e,t,n,null==r?1:r)},_$(_q,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Sd(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Sd(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Sr(Sp(e>=240?e-240:e+120,i,r),Sp(e,i,r),Sp(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Sd(Sh(this.h),Sf(this.s),Sf(this.l),So(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=So(this.opacity);return`${1===e?"hsl(":"hsla("}${Sh(this.h)}, ${100*Sf(this.s)}%, ${100*Sf(this.l)}%${1===e?")":`, ${e})`}`}}));let Sg=e=>()=>e;function Sv(e,t){var n=t-e;return n?function(t){return e+t*n}:Sg(isNaN(e)?t:e)}let Sx=function e(t){var n,r=1==(n=+t)?Sv:function(e,t){var r,i,a;return t-e?(r=e,i=t,r=Math.pow(r,a=n),i=Math.pow(i,a)-r,a=1/a,function(e){return Math.pow(r+e*i,a)}):Sg(isNaN(e)?t:e)};function i(e,t){var n=r((e=Sn(e)).r,(t=Sn(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=Sv(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function Sy(e){return function(t){var n,r,i=t.length,a=Array(i),o=Array(i),s=Array(i);for(n=0;n<i;++n)r=Sn(t[n]),a[n]=r.r||0,o[n]=r.g||0,s[n]=r.b||0;return a=e(a),o=e(o),s=e(s),r.opacity=1,function(e){return r.r=a(e),r.g=o(e),r.b=s(e),r+""}}}function Sb(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}Sy(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return Sm((n-r/t)*t,o,i,a,s)}}),Sy(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return Sm((n-r/t)*t,i,a,o,s)}});var Sw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sj=RegExp(Sw.source,"g");function SN(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?Sg(t):("number"===i?Sb:"string"===i?(r=_9(t))?(t=r,Sx):function(e,t){var n,r,i,a,o,s=Sw.lastIndex=Sj.lastIndex=0,l=-1,c=[],u=[];for(e+="",t+="";(i=Sw.exec(e))&&(a=Sj.exec(t));)(o=a.index)>s&&(o=t.slice(s,o),c[l]?c[l]+=o:c[++l]=o),(i=i[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,u.push({i:l,x:Sb(i,a)})),s=Sj.lastIndex;return s<t.length&&(o=t.slice(s),c[l]?c[l]+=o:c[++l]=o),c.length<2?u[0]?(n=u[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=u.length,function(e){for(var n,r=0;r<t;++r)c[(n=u[r]).i]=n.x(e);return c.join("")})}:t instanceof _9?Sx:t instanceof Date?function(e,t){var n=new Date;return e*=1,t*=1,function(r){return n.setTime(e*(1-r)+t*r),n}}:!ArrayBuffer.isView(n=t)||n instanceof DataView?Array.isArray(t)?function(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=Array(i),o=Array(r);for(n=0;n<i;++n)a[n]=SN(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var n,r={},i={};for(n in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)n in e?r[n]=SN(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}:Sb:function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}})(e,t)}function Sk(e,t){return e*=1,t*=1,function(n){return Math.round(e*(1-n)+t*n)}}function SE(e){return+e}var SC=[0,1];function S_(e){return e}function SS(e,t){var n;return(t-=e*=1)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n})}function ST(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=SS(i,r),a=n(o,a)):(r=SS(r,i),a=n(a,o)),function(e){return a(r(e))}}function SA(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=SS(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_G(e,t,1,r)-1;return a[n](i[n](t))}}function SO(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function SM(){var e,t,n,r,i,a,o=SC,s=SC,l=SN,c=S_;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==S_&&(e=o[0],t=o[l-1],e>t&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?SA:ST,i=a=null,d}function d(t){return null==t||isNaN(t*=1)?n:(i||(i=r(o.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,o.map(e),Sb)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,SE),u()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=Sk,u()},d.clamp=function(e){return arguments.length?(c=!!e||S_,u()):c!==S_},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}function SP(){return SM()(S_,S_)}function SD(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function SL(e){return(e=SD(Math.abs(e)))?e[1]:NaN}var SI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function SR(e){var t;if(!(t=SI.exec(e)))throw Error("invalid format: "+e);return new SB({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function SB(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Sz(e,t){var n=SD(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+Array(i-r.length+2).join("0")}SR.prototype=SB.prototype,SB.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let SF={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Sz(100*e,t),r:Sz,s:function(e,t){var n=SD(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(B=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+Array(1-a).join("0")+SD(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function SV(e){return e}var SU=Array.prototype.map,SH=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function SW(e,t,n,r){var i,a,o=_z(e,t,n);switch((r=SR(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(a=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(SL(s)/3)))-SL(Math.abs(o))))||(r.precision=a),V(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(a=Math.max(0,SL(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=o)))-SL(i))+1)||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=Math.max(0,-SL(Math.abs(o))))||(r.precision=a-("%"===r.type)*2)}return F(r)}function SY(e){var t=e.domain;return e.ticks=function(e){var n=t();return _R(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return SW(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,s=a.length-1,l=a[o],c=a[s],u=10;for(c<l&&(i=l,l=c,c=i,i=o,o=s,s=i);u-- >0;){if((i=_B(l,c,n))===r)return a[o]=l,a[s]=c,t(a);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else if(i<0)l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i;else break;r=i}return e},e}function SG(){var e=SP();return e.copy=function(){return SO(e,SG())},_k.apply(e,arguments),SY(e)}function SX(e){var t;function n(e){return null==e||isNaN(e*=1)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,SE),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return SX(e).unknown(t)},e=arguments.length?Array.from(e,SE):[0,1],SY(n)}function S$(e,t){e=e.slice();var n,r=0,i=e.length-1,a=e[r],o=e[i];return o<a&&(n=r,r=i,i=n,n=a,a=o,o=n),e[r]=t.floor(a),e[i]=t.ceil(o),e}function Sq(e){return Math.log(e)}function SK(e){return Math.exp(e)}function SZ(e){return-Math.log(-e)}function SQ(e){return-Math.exp(-e)}function SJ(e){return isFinite(e)?+("1e"+e):e<0?0:e}function S0(e){return(t,n)=>-e(-t,n)}function S1(e){let t,n,r=e(Sq,SK),i=r.domain,a=10;function o(){var o,s;return t=(o=a)===Math.E?Math.log:10===o&&Math.log10||2===o&&Math.log2||(o=Math.log(o),e=>Math.log(e)/o),n=10===(s=a)?SJ:s===Math.E?Math.exp:e=>Math.pow(s,e),i()[0]<0?(t=S0(t),n=S0(n),e(SZ,SQ)):e(Sq,SK),r}return r.base=function(e){return arguments.length?(a=+e,o()):a},r.domain=function(e){return arguments.length?(i(e),o()):i()},r.ticks=e=>{let r,o,s=i(),l=s[0],c=s[s.length-1],u=c<l;u&&([l,c]=[c,l]);let d=t(l),h=t(c),f=null==e?10:+e,p=[];if(!(a%1)&&h-d<f){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(r=1;r<a;++r)if(!((o=d<0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}}else for(;d<=h;++d)for(r=a-1;r>=1;--r)if(!((o=d>0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}2*p.length<f&&(p=_R(l,c,f))}else p=_R(d,h,Math.min(h-d,f)).map(n);return u?p.reverse():p},r.tickFormat=(e,i)=>{if(null==e&&(e=10),null==i&&(i=10===a?"s":","),"function"!=typeof i&&(a%1||null!=(i=SR(i)).precision||(i.trim=!0),i=F(i)),e===1/0)return i;let o=Math.max(1,a*e/r.ticks().length);return e=>{let r=e/n(Math.round(t(e)));return r*a<a-.5&&(r*=a),r<=o?i(e):""}},r.nice=()=>i(S$(i(),{floor:e=>n(Math.floor(t(e))),ceil:e=>n(Math.ceil(t(e)))})),r}function S2(){let e=S1(SM()).domain([1,10]);return e.copy=()=>SO(e,S2()).base(e.base()),_k.apply(e,arguments),e}function S5(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function S3(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function S4(e){var t=1,n=e(S5(1),S3(t));return n.constant=function(n){return arguments.length?e(S5(t=+n),S3(t)):t},SY(n)}function S6(){var e=S4(SM());return e.copy=function(){return SO(e,S6()).constant(e.constant())},_k.apply(e,arguments)}function S8(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function S7(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function S9(e){return e<0?-e*e:e*e}function Te(e){var t=e(S_,S_),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(S_,S_):.5===n?e(S7,S9):e(S8(n),S8(1/n)):n},SY(t)}function Tt(){var e=Te(SM());return e.copy=function(){return SO(e,Tt()).exponent(e.exponent())},_k.apply(e,arguments),e}function Tn(){return Tt.apply(null,arguments).exponent(.5)}function Tr(e){return Math.sign(e)*e*e}function Ti(){var e,t=SP(),n=[0,1],r=!1;function i(n){var i,a=Math.sign(i=t(n))*Math.sqrt(Math.abs(i));return isNaN(a)?e:r?Math.round(a):a}return i.invert=function(e){return t.invert(Tr(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain()},i.range=function(e){return arguments.length?(t.range((n=Array.from(e,SE)).map(Tr)),i):n.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(r=!!e,i):r},i.clamp=function(e){return arguments.length?(t.clamp(e),i):t.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Ti(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},_k.apply(i,arguments),SY(i)}function Ta(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function To(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Ts(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function Tl(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Tc(){var e,t=[],n=[],r=[];function i(){var e=0,i=Math.max(1,n.length);for(r=Array(i-1);++e<i;)r[e-1]=function(e,t,n=_W){if(!(!(r=e.length)||isNaN(t*=1))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(n(e[a+1],a+1,e)-o)*(i-a)}}(t,e/i);return a}function a(t){return null==t||isNaN(t*=1)?e:n[_G(r,t)]}return a.invertExtent=function(e){var i=n.indexOf(e);return i<0?[NaN,NaN]:[i>0?r[i-1]:t[0],i<r.length?r[i]:t[t.length-1]]},a.domain=function(e){if(!arguments.length)return t.slice();for(let n of(t=[],e))null==n||isNaN(n*=1)||t.push(n);return t.sort(_F),i()},a.range=function(e){return arguments.length?(n=Array.from(e),i()):n.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return r.slice()},a.copy=function(){return Tc().domain(t).range(n).unknown(e)},_k.apply(a,arguments)}function Tu(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[_G(i,t,0,r)]:e}function s(){var e=-1;for(i=Array(r);++e<r;)i[e]=((e+1)*n-(e-r)*t)/(r+1);return o}return o.domain=function(e){return arguments.length?([t,n]=e,t*=1,n*=1,s()):[t,n]},o.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,s()):a.slice()},o.invertExtent=function(e){var o=a.indexOf(e);return o<0?[NaN,NaN]:o<1?[t,i[0]]:o>=r?[i[r-1],n]:[i[o-1],i[o]]},o.unknown=function(t){return arguments.length&&(e=t),o},o.thresholds=function(){return i.slice()},o.copy=function(){return Tu().domain([t,n]).range(a).unknown(e)},_k.apply(SY(o),arguments)}function Td(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[_G(t,i,0,r)]:e}return i.domain=function(e){return arguments.length?(r=Math.min((t=Array.from(e)).length,n.length-1),i):t.slice()},i.range=function(e){return arguments.length?(n=Array.from(e),r=Math.min(t.length,n.length-1),i):n.slice()},i.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Td().domain(t).range(n).unknown(e)},_k.apply(i,arguments)}F=(z=function(e){var t,n,r,i=void 0===e.grouping||void 0===e.thousands?SV:(t=SU.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(i-=s,i+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(n)}),a=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",s=void 0===e.decimal?".":e.decimal+"",l=void 0===e.numerals?SV:(r=SU.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return r[+e]})}),c=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",d=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=SR(e)).fill,n=e.align,r=e.sign,h=e.symbol,f=e.zero,p=e.width,g=e.comma,v=e.precision,x=e.trim,y=e.type;"n"===y?(g=!0,y="g"):SF[y]||(void 0===v&&(v=12),x=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===h?a:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?c:"",j=SF[y],N=/[defgprs%]/.test(y);function k(e){var a,o,c,h=b,k=w;if("c"===y)k=j(e)+k,e="";else{var E=(e*=1)<0||1/e<0;if(e=isNaN(e)?d:j(Math.abs(e),v),x&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r<n;++r)switch(e[r]){case".":i=t=r;break;case"0":0===i&&(i=r),t=r;break;default:if(!+e[r])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==r&&(E=!1),h=(E?"("===r?r:u:"-"===r||"("===r?"":r)+h,k=("s"===y?SH[8+B/3]:"")+k+(E&&"("===r?")":""),N){for(a=-1,o=e.length;++a<o;)if(48>(c=e.charCodeAt(a))||c>57){k=(46===c?s+e.slice(a+1):e.slice(a))+k,e=e.slice(0,a);break}}}g&&!f&&(e=i(e,1/0));var C=h.length+e.length+k.length,_=C<p?Array(p-C+1).join(t):"";switch(g&&f&&(e=i(_+e,_.length?p-k.length:1/0),_=""),n){case"<":e=h+e+k+_;break;case"=":e=h+_+e+k;break;case"^":e=_.slice(0,C=_.length>>1)+h+e+k+_.slice(C);break;default:e=_+h+e+k}return l(e)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),k.toString=function(){return e+""},k}return{format:h,formatPrefix:function(e,t){var n=h(((e=SR(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(SL(t)/3))),i=Math.pow(10,-r),a=SH[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,V=z.formatPrefix;let Th=new Date,Tf=new Date;function Tp(e,t,n,r){function i(t){return e(t=0==arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o,s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r)||!(a>0))return s;do s.push(o=new Date(+n)),t(n,a),e(n);while(o<n&&n<r)return s},i.filter=n=>Tp(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Th.setTime(+t),Tf.setTime(+r),e(Th),e(Tf),Math.floor(n(Th,Tf))),i.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?i.filter(r?t=>r(t)%e==0:t=>i.count(0,t)%e==0):i:null),i}let Tm=Tp(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Tm.every=e=>isFinite(e=Math.floor(e))&&e>0?Tp(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Tm.range;let Tg=Tp(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Tg.every=e=>isFinite(e=Math.floor(e))&&e>0?Tp(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,Tg.range;let Tv=Tp(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Tv.range;let Tx=Tp(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Tx.range;function Ty(e){return Tp(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}let Tb=Ty(0),Tw=Ty(1),Tj=Ty(2),TN=Ty(3),Tk=Ty(4),TE=Ty(5),TC=Ty(6);function T_(e){return Tp(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/6048e5)}Tb.range,Tw.range,Tj.range,TN.range,Tk.range,TE.range,TC.range;let TS=T_(0),TT=T_(1),TA=T_(2),TO=T_(3),TM=T_(4),TP=T_(5),TD=T_(6);TS.range,TT.range,TA.range,TO.range,TM.range,TP.range,TD.range;let TL=Tp(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1);TL.range;let TI=Tp(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);TI.range;let TR=Tp(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));TR.range;let TB=Tp(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getHours());TB.range;let Tz=Tp(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());Tz.range;let TF=Tp(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());TF.range;let TV=Tp(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());TV.range;let TU=Tp(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());TU.range;let TH=Tp(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function TW(e,t,n,r,i,a){let o=[[TU,1,1e3],[TU,5,5e3],[TU,15,15e3],[TU,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,36e5],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,864e5],[r,2,1728e5],[n,1,6048e5],[t,1,2592e6],[t,3,7776e6],[e,1,31536e6]];function s(t,n,r){let i=Math.abs(n-t)/r,a=_U(([,,e])=>e).right(o,i);if(a===o.length)return e.every(_z(t/31536e6,n/31536e6,r));if(0===a)return TH.every(Math.max(_z(t,n,r),1));let[s,l]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(l)}return[function(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&"function"==typeof n.range?n:s(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a},s]}TH.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?Tp(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):TH:null,TH.range;let[TY,TG]=TW(Tg,Tx,TS,TR,Tz,TV),[TX,T$]=TW(Tm,Tv,Tb,TL,TB,TF);function Tq(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function TK(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function TZ(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var TQ={"-":"",_:" ",0:"0"},TJ=/^\s*\d+/,T0=/^%/,T1=/[\\^$*+?|[\]().{}]/g;function T2(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function T5(e){return e.replace(T1,"\\$&")}function T3(e){return RegExp("^(?:"+e.map(T5).join("|")+")","i")}function T4(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function T6(e,t,n){var r=TJ.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function T8(e,t,n){var r=TJ.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function T7(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function T9(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Ae(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function At(e,t,n){var r=TJ.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function An(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ar(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Ai(e,t,n){var r=TJ.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Aa(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Ao(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function As(e,t,n){var r=TJ.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Al(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Ac(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Au(e,t,n){var r=TJ.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Ad(e,t,n){var r=TJ.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Ah(e,t,n){var r=TJ.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Af(e,t,n){var r=T0.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Ap(e,t,n){var r=TJ.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Am(e,t,n){var r=TJ.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Ag(e,t){return T2(e.getDate(),t,2)}function Av(e,t){return T2(e.getHours(),t,2)}function Ax(e,t){return T2(e.getHours()%12||12,t,2)}function Ay(e,t){return T2(1+TL.count(Tm(e),e),t,3)}function Ab(e,t){return T2(e.getMilliseconds(),t,3)}function Aw(e,t){return Ab(e,t)+"000"}function Aj(e,t){return T2(e.getMonth()+1,t,2)}function AN(e,t){return T2(e.getMinutes(),t,2)}function Ak(e,t){return T2(e.getSeconds(),t,2)}function AE(e){var t=e.getDay();return 0===t?7:t}function AC(e,t){return T2(Tb.count(Tm(e)-1,e),t,2)}function A_(e){var t=e.getDay();return t>=4||0===t?Tk(e):Tk.ceil(e)}function AS(e,t){return e=A_(e),T2(Tk.count(Tm(e),e)+(4===Tm(e).getDay()),t,2)}function AT(e){return e.getDay()}function AA(e,t){return T2(Tw.count(Tm(e)-1,e),t,2)}function AO(e,t){return T2(e.getFullYear()%100,t,2)}function AM(e,t){return T2((e=A_(e)).getFullYear()%100,t,2)}function AP(e,t){return T2(e.getFullYear()%1e4,t,4)}function AD(e,t){var n=e.getDay();return T2((e=n>=4||0===n?Tk(e):Tk.ceil(e)).getFullYear()%1e4,t,4)}function AL(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+T2(t/60|0,"0",2)+T2(t%60,"0",2)}function AI(e,t){return T2(e.getUTCDate(),t,2)}function AR(e,t){return T2(e.getUTCHours(),t,2)}function AB(e,t){return T2(e.getUTCHours()%12||12,t,2)}function Az(e,t){return T2(1+TI.count(Tg(e),e),t,3)}function AF(e,t){return T2(e.getUTCMilliseconds(),t,3)}function AV(e,t){return AF(e,t)+"000"}function AU(e,t){return T2(e.getUTCMonth()+1,t,2)}function AH(e,t){return T2(e.getUTCMinutes(),t,2)}function AW(e,t){return T2(e.getUTCSeconds(),t,2)}function AY(e){var t=e.getUTCDay();return 0===t?7:t}function AG(e,t){return T2(TS.count(Tg(e)-1,e),t,2)}function AX(e){var t=e.getUTCDay();return t>=4||0===t?TM(e):TM.ceil(e)}function A$(e,t){return e=AX(e),T2(TM.count(Tg(e),e)+(4===Tg(e).getUTCDay()),t,2)}function Aq(e){return e.getUTCDay()}function AK(e,t){return T2(TT.count(Tg(e)-1,e),t,2)}function AZ(e,t){return T2(e.getUTCFullYear()%100,t,2)}function AQ(e,t){return T2((e=AX(e)).getUTCFullYear()%100,t,2)}function AJ(e,t){return T2(e.getUTCFullYear()%1e4,t,4)}function A0(e,t){var n=e.getUTCDay();return T2((e=n>=4||0===n?TM(e):TM.ceil(e)).getUTCFullYear()%1e4,t,4)}function A1(){return"+0000"}function A2(){return"%"}function A5(e){return+e}function A3(e){return Math.floor(e/1e3)}function A4(e){return new Date(e)}function A6(e){return e instanceof Date?+e:+new Date(+e)}function A8(e,t,n,r,i,a,o,s,l,c){var u=SP(),d=u.invert,h=u.domain,f=c(".%L"),p=c(":%S"),g=c("%I:%M"),v=c("%I %p"),x=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function j(e){return(l(e)<e?f:s(e)<e?p:o(e)<e?g:a(e)<e?v:r(e)<e?i(e)<e?x:y:n(e)<e?b:w)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?h(Array.from(e,A6)):h().map(A4)},u.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},u.tickFormat=function(e,t){return null==t?j:c(t)},u.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(S$(n,e)):u},u.copy=function(){return SO(u,A8(e,t,n,r,i,a,o,s,l,c))},u}function A7(){return _k.apply(A8(TX,T$,Tm,Tv,Tb,TL,TB,TF,TU,H).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function A9(){return _k.apply(A8(TY,TG,Tg,Tx,TS,TI,Tz,TV,TU,W).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Oe(){var e,t,n,r,i,a=0,o=1,s=S_,l=!1;function c(t){return null==t||isNaN(t*=1)?i:s(0===n?.5:(t=(r(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,s=e(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([a,o]=i,e=r(a*=1),t=r(o*=1),n=e===t?0:1/(t-e),c):[a,o]},c.clamp=function(e){return arguments.length?(l=!!e,c):l},c.interpolator=function(e){return arguments.length?(s=e,c):s},c.range=u(SN),c.rangeRound=u(Sk),c.unknown=function(e){return arguments.length?(i=e,c):i},function(i){return r=i,e=i(a),t=i(o),n=e===t?0:1/(t-e),c}}function Ot(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function On(){var e=SY(Oe()(S_));return e.copy=function(){return Ot(e,On())},_E.apply(e,arguments)}function Or(){var e=S1(Oe()).domain([1,10]);return e.copy=function(){return Ot(e,Or()).base(e.base())},_E.apply(e,arguments)}function Oi(){var e=S4(Oe());return e.copy=function(){return Ot(e,Oi()).constant(e.constant())},_E.apply(e,arguments)}function Oa(){var e=Te(Oe());return e.copy=function(){return Ot(e,Oa()).exponent(e.exponent())},_E.apply(e,arguments)}function Oo(){return Oa.apply(null,arguments).exponent(.5)}function Os(){var e=[],t=S_;function n(n){if(null!=n&&!isNaN(n*=1))return t((_G(e,n,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let n of(e=[],t))null==n||isNaN(n*=1)||e.push(n);return e.sort(_F),n},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.range=function(){return e.map((n,r)=>t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>(function(e,t){if(!(!(n=(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t*=1)>=t&&(yield t);else{let n=-1;for(let r of e)null!=(r=t(r,++n,e))&&(r*=1)>=r&&(yield r)}}(e,void 0))).length)||isNaN(t*=1))){if(t<=0||n<2)return To(e);if(t>=1)return Ta(e);var n,r=(n-1)*t,i=Math.floor(r),a=Ta((function e(t,n,r=0,i=1/0,a){if(n=Math.floor(n),r=Math.floor(Math.max(0,r)),i=Math.floor(Math.min(t.length-1,i)),!(r<=n&&n<=i))return t;for(a=void 0===a?Ts:function(e=_F){if(e===_F)return Ts;if("function"!=typeof e)throw TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(a);i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1),d=Math.max(r,Math.floor(n-s*c/o+u)),h=Math.min(i,Math.floor(n+(o-s)*c/o+u));e(t,n,d,h,a)}let o=t[n],s=r,l=i;for(Tl(t,r,n),a(t[i],o)>0&&Tl(t,r,i);s<l;){for(Tl(t,s,l),++s,--l;0>a(t[s],o);)++s;for(;a(t[l],o)>0;)--l}0===a(t[r],o)?Tl(t,r,l):Tl(t,++l,i),l<=n&&(r=l+1),n<=l&&(i=l-1)}return t})(e,i).subarray(0,i+1));return a+(To(e.subarray(i+1))-a)*(r-i)}})(e,r/t))},n.copy=function(){return Os(t).domain(e)},_E.apply(n,arguments)}function Ol(){var e,t,n,r,i,a,o,s=0,l=.5,c=1,u=1,d=S_,h=!1;function f(e){return isNaN(e*=1)?o:(e=.5+((e=+a(e))-t)*(u*e<u*t?r:i),d(h?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,r,i;return arguments.length?([n,r,i]=t,d=function(e,t){void 0===t&&(t=e,e=SN);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}(e,[n,r,i]),f):[d(0),d(.5),d(1)]}}return f.domain=function(o){return arguments.length?([s,l,c]=o,e=a(s*=1),t=a(l*=1),n=a(c*=1),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f):[s,l,c]},f.clamp=function(e){return arguments.length?(h=!!e,f):h},f.interpolator=function(e){return arguments.length?(d=e,f):d},f.range=p(SN),f.rangeRound=p(Sk),f.unknown=function(e){return arguments.length?(o=e,f):o},function(o){return a=o,e=o(s),t=o(l),n=o(c),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f}}function Oc(){var e=SY(Ol()(S_));return e.copy=function(){return Ot(e,Oc())},_E.apply(e,arguments)}function Ou(){var e=S1(Ol()).domain([.1,1,10]);return e.copy=function(){return Ot(e,Ou()).base(e.base())},_E.apply(e,arguments)}function Od(){var e=S4(Ol());return e.copy=function(){return Ot(e,Od()).constant(e.constant())},_E.apply(e,arguments)}function Oh(){var e=Te(Ol());return e.copy=function(){return Ot(e,Oh()).exponent(e.exponent())},_E.apply(e,arguments)}function Of(){return Oh.apply(null,arguments).exponent(.5)}H=(U=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=T3(i),u=T4(i),d=T3(a),h=T4(a),f=T3(o),p=T4(o),g=T3(s),v=T4(s),x=T3(l),y=T4(l),b={a:function(e){return o[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:Ag,e:Ag,f:Aw,g:AM,G:AD,H:Av,I:Ax,j:Ay,L:Ab,m:Aj,M:AN,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:A5,s:A3,S:Ak,u:AE,U:AC,V:AS,w:AT,W:AA,x:null,X:null,y:AO,Y:AP,Z:AL,"%":A2},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:AI,e:AI,f:AV,g:AQ,G:A0,H:AR,I:AB,j:Az,L:AF,m:AU,M:AH,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:A5,s:A3,S:AW,u:AY,U:AG,V:A$,w:Aq,W:AK,x:null,X:null,y:AZ,Y:AJ,Z:A1,"%":A2},j={a:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=x.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return E(e,t,n,r)},d:Ao,e:Ao,f:Ah,g:An,G:At,H:Al,I:Al,j:As,L:Ad,m:Aa,M:Ac,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:Ai,Q:Ap,s:Am,S:Au,u:T8,U:T7,V:T9,w:T6,W:Ae,x:function(e,t,r){return E(e,n,t,r)},X:function(e,t,n){return E(e,r,t,n)},y:An,Y:At,Z:Ar,"%":Af};function N(e,t){return function(n){var r,i,a,o=[],s=-1,l=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===e.charCodeAt(s)&&(o.push(e.slice(l,s)),null!=(i=TQ[r=e.charAt(++s)])?r=e.charAt(++s):i="e"===r?" ":"0",(a=t[r])&&(r=a(n,i)),o.push(r),l=s+1);return o.push(e.slice(l,s)),o.join("")}}function k(e,t){return function(n){var r,i,a=TZ(1900,void 0,1);if(E(a,e,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(!t||"Z"in a||(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(r=(i=(r=TK(TZ(a.y,0,1))).getUTCDay())>4||0===i?TT.ceil(r):TT(r),r=TI.offset(r,(a.V-1)*7),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(r=(i=(r=Tq(TZ(a.y,0,1))).getDay())>4||0===i?Tw.ceil(r):Tw(r),r=TL.offset(r,(a.V-1)*7),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:+("W"in a)),i="Z"in a?TK(TZ(a.y,0,1)).getUTCDay():Tq(TZ(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,TK(a)):Tq(a)}}function E(e,t,n,r){for(var i,a,o=0,s=t.length,l=n.length;o<s;){if(r>=l)return -1;if(37===(i=t.charCodeAt(o++))){if(!(a=j[(i=t.charAt(o++))in TQ?t.charAt(o++):i])||(r=a(e,n,r))<0)return -1}else if(i!=n.charCodeAt(r++))return -1}return r}return b.x=N(n,b),b.X=N(r,b),b.c=N(t,b),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w),{format:function(e){var t=N(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=N(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,U.parse,W=U.utcFormat,U.utcParse,e.s(["scaleBand",0,_O,"scaleDiverging",0,Oc,"scaleDivergingLog",0,Ou,"scaleDivergingPow",0,Oh,"scaleDivergingSqrt",0,Of,"scaleDivergingSymlog",0,Od,"scaleIdentity",0,SX,"scaleImplicit",0,_T,"scaleLinear",0,SG,"scaleLog",0,S2,"scaleOrdinal",0,_A,"scalePoint",0,_M,"scalePow",0,Tt,"scaleQuantile",0,Tc,"scaleQuantize",0,Tu,"scaleRadial",0,Ti,"scaleSequential",0,On,"scaleSequentialLog",0,Or,"scaleSequentialPow",0,Oa,"scaleSequentialQuantile",0,Os,"scaleSequentialSqrt",0,Oo,"scaleSequentialSymlog",0,Oi,"scaleSqrt",0,Tn,"scaleSymlog",0,S6,"scaleThreshold",0,Td,"scaleTime",0,A7,"scaleUtc",0,A9,"tickFormat",0,SW],29061),e.i(29061),e.s(["scaleBand",0,_O,"scaleDiverging",0,Oc,"scaleDivergingLog",0,Ou,"scaleDivergingPow",0,Oh,"scaleDivergingSqrt",0,Of,"scaleDivergingSymlog",0,Od,"scaleIdentity",0,SX,"scaleImplicit",0,_T,"scaleLinear",0,SG,"scaleLog",0,S2,"scaleOrdinal",0,_A,"scalePoint",0,_M,"scalePow",0,Tt,"scaleQuantile",0,Tc,"scaleQuantize",0,Tu,"scaleRadial",0,Ti,"scaleSequential",0,On,"scaleSequentialLog",0,Or,"scaleSequentialPow",0,Oa,"scaleSequentialQuantile",0,Os,"scaleSequentialSqrt",0,Oo,"scaleSequentialSymlog",0,Oi,"scaleSqrt",0,Tn,"scaleSymlog",0,S6,"scaleThreshold",0,Td,"scaleTime",0,A7,"scaleUtc",0,A9,"tickFormat",0,SW],79357);var Op=e.i(79357),Om=e=>e.chartData,Og=N1([Om],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Ov=(e,t,n,r)=>r?Og(e):Om(e);function Ox(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(CL(t)&&CL(n))return!0}return!1}function Oy(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Ob(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(CL(i))n=i;else if("function"==typeof i)return;if(CL(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(Ox(o))return o}}var Ow=e.i(51655),Oj=e=>e,ON={},Ok=e=>function t(){let n;return 0==arguments.length||1==arguments.length&&(n=arguments.length<=0?void 0:arguments[0],n===ON)?t:e(...arguments)},OE=(e,t)=>1===e?t:Ok(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(e=>e!==ON).length;return a>=e?t(...r):OE(e-a,Ok(function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t(...r.map(e=>e===ON?n.shift():e),...n)}))}),OC=(e,t)=>{for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},O_=OE((a=(e,t)=>Array.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,a),OS=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return Oj;var r=t.reverse(),i=r[0],a=r.slice(1);return function(){return a.reduce((e,t)=>t(e),i(...arguments))}};function OT(e){return 0===e?1:Math.floor(new Ow.default(e).abs().log(10).toNumber())+1}function OA(e,t,n){for(var r=new Ow.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var OO=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},OM=(e,t,n)=>{if(e.lte(0))return new Ow.default(0);var r=OT(e.toNumber()),i=new Ow.default(10).pow(r),a=e.div(i),o=1!==r?.05:.1,s=new Ow.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new Ow.default(t?s.toNumber():Math.ceil(s.toNumber()))},OP=function(e,t,n,r){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Ow.default(0),tickMin:new Ow.default(0),tickMax:new Ow.default(0)};var o=OM(new Ow.default(t).sub(e).div(n-1),r,a),s=Math.ceil((i=e<=0&&t>=0?new Ow.default(0):(i=new Ow.default(e).add(t).div(2)).sub(new Ow.default(i).mod(o))).sub(e).div(o).toNumber()),l=Math.ceil(new Ow.default(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?OP(e,t,n,r,a+1):(c<n&&(l=t>0?l+(n-c):l,s=t>0?s:s+(n-c)),{step:o,tickMin:i.sub(new Ow.default(s).mul(o)),tickMax:i.add(new Ow.default(l).mul(o))})},OD=function(e){var[t,n]=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(r,2),[o,s]=OO([t,n]);if(o===-1/0||s===1/0){var l=s===1/0?[o,...OC(0,r-1).map(()=>1/0)]:[...OC(0,r-1).map(()=>-1/0),s];return t>n?l.reverse():l}if(o===s){var c=new Ow.default(1),u=new Ow.default(o);if(!u.isint()&&i){var d=Math.abs(o);d<1?(c=new Ow.default(10).pow(OT(o)-1),u=new Ow.default(Math.floor(u.div(c).toNumber())).mul(c)):d>1&&(u=new Ow.default(Math.floor(o)))}else 0===o?u=new Ow.default(Math.floor((r-1)/2)):i||(u=new Ow.default(Math.floor(o)));var h=Math.floor((r-1)/2);return OS(O_(e=>u.add(new Ow.default(e-h).mul(c)).toNumber()),OC)(0,r)}var{step:f,tickMin:p,tickMax:g}=OP(o,s,a,i,0),v=OA(p,g.add(new Ow.default(.1).mul(f)),f);return t>n?v.reverse():v},OL=function(e,t){var[n,r]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,o]=OO([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),l=OM(new Ow.default(o).sub(a).div(s-1),i,0),c=[...OA(new Ow.default(a),new Ow.default(o),l),o];return!1===i&&(c=c.map(e=>Math.round(e))),n>r?c.reverse():c},OI=e=>e.rootProps.stackOffset,OR=e=>e.rootProps.reverseStackOrder,OB=e=>e.options.chartName,Oz=e=>e.rootProps.syncId,OF=e=>e.rootProps.syncMethod,OV=e=>e.options.eventEmitter;function OU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OU(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var OW=Math.PI/180,OY=(e,t,n,r)=>({x:e+Math.cos(-OW*r)*n,y:t+Math.sin(-OW*r)*n}),OG={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},OX={allowDecimals:!1,allowDuplicatedCategory:!0,angleAxisId:0,axisLine:!0,axisLineType:"polygon",cx:0,cy:0,orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"category",zIndex:OG.axis},O$={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,type:"number",zIndex:OG.axis},Oq=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},OK={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:OX.angleAxisId,includeHidden:!1,name:void 0,reversed:OX.reversed,scale:OX.scale,tick:OX.tick,tickCount:void 0,ticks:void 0,type:OX.type,unit:void 0},OZ={allowDataOverflow:O$.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:O$.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O$.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O$.scale,tick:O$.tick,tickCount:O$.tickCount,ticks:void 0,type:O$.type,unit:void 0},OQ={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:OX.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OX.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OX.scale,tick:OX.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},OJ={allowDataOverflow:O$.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:O$.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O$.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O$.scale,tick:O$.tick,tickCount:O$.tickCount,ticks:void 0,type:"category",unit:void 0},O0=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?OQ:OK,O1=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?OJ:OZ,O2=e=>e.polarOptions,O5=N1([CK,CZ,C3],function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2}),O3=N1([O2,O5],(e,t)=>{if(null!=e)return k3(e.innerRadius,t,0)}),O4=N1([O2,O5],(e,t)=>{if(null!=e)return k3(e.outerRadius,t,.8*t)}),O6=N1([O2],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});N1([O0,O6],Oq);var O8=N1([O5,O3,O4],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});N1([O1,O8],Oq);var O7=N1([_w,O2,O3,O4,CK,CZ],(e,t,n,r,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=n&&null!=r){var{cx:o,cy:s,startAngle:l,endAngle:c}=t;return{cx:k3(o,i,i/2),cy:k3(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),O9=(e,t)=>t,Me=(e,t,n)=>n;function Mt(e){return null==e?void 0:e.id}function Mn(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t,n=null!=(t=e.data)?t:r;if(null!=n&&0!==n.length){var s=Mt(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(Cz(t,a,null)),c=Cz(t,e.dataKey,0);Object.assign(r=o.has(l)?o.get(l):{},{[s]:c}),o.set(l,r)})}}),Array.from(o.values())}function Mr(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var Mi=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function Ma(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var Mo=e=>{var t=_w(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},Ms=e=>e.tooltip.settings.axisId;function Ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ml(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ml(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Mu=[0,"auto"],Md={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},Mh=(e,t)=>e.cartesianAxis.xAxis[t],Mf=(e,t)=>{var n=Mh(e,t);return null==n?Md:n},Mp={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Mu,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},Mm=(e,t)=>e.cartesianAxis.yAxis[t],Mg=(e,t)=>{var n=Mm(e,t);return null==n?Mp:n},Mv={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Mx=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?Mv:n},My=(e,t,n)=>{switch(t){case"xAxis":return Mf(e,n);case"yAxis":return Mg(e,n);case"zAxis":return Mx(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return O1(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Mb=(e,t,n)=>{switch(t){case"xAxis":return Mf(e,n);case"yAxis":return Mg(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return O1(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Mw=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function Mj(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var MN=e=>e.graphicalItems.cartesianItems,Mk=N1([O9,Me],Mj),ME=(e,t,n)=>e.filter(n).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),MC=N1([MN,My,Mk],ME,{memoizeOptions:{resultEqualityCheck:Ma}}),M_=N1([MC],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(Mr)),MS=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),MT=N1([MC],MS),MA=e=>e.map(e=>e.data).filter(Boolean).flat(1),MO=N1([MC],MA,{memoizeOptions:{resultEqualityCheck:Ma}}),MM=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},MP=N1([MO,Ov],MM),MD=(e,t,n)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:Cz(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:Cz(e,t)}))):e.map(e=>({value:e})),ML=N1([MP,My,MC],MD);function MI(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function MR(e){if(k1(e)||e instanceof Date){var t=Number(e);if(CL(t))return t}}function MB(e){if(Array.isArray(e)){var t=[MR(e[0]),MR(e[1])];return Ox(t)?t:void 0}var n=MR(e);if(null!=n)return[n,n]}function Mz(e){return e.map(MR).filter(k9)}var MF=e=>{var t=Mo(e),n=Ms(e);return Mb(e,t,n)},MV=N1([MF],e=>null==e?void 0:e.dataKey),MU=N1([M_,Ov,MF],Mn),MH=(e,t,n,r)=>Object.fromEntries(Object.entries(t.reduce((e,t)=>{if(null==t.stackId)return e;var n=e[t.stackId];return null==n&&(n=[]),n.push(t),e[t.stackId]=n,e},{})).map(t=>{var i,a,o,[s,l]=t,c=r?[...l].reverse():l,u=c.map(Mt);return[s,{stackedData:(a=null!=(i=CH[n])?i:CA,(o=(function(){var e=CT([]),t=CO,n=CA,r=CM;function i(i){var a,o,s=Array.from(e.apply(this,arguments),CP),l=s.length,c=-1;for(let e of i)for(a=0,++c;a<l;++a)(s[a][c]=[0,+r(e,s[a].key,c,i)]).data=e;for(a=0,o=CS(t(s));a<l;++a)s[o[a]].index=a;return n(s,o),s}return i.keys=function(t){return arguments.length?(e="function"==typeof t?t:CT(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r="function"==typeof e?e:CT(+e),i):r},i.order=function(e){return arguments.length?(t=null==e?CO:"function"==typeof e?e:CT(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=null==e?CA:e,i):n},i})().keys(u).value((e,t)=>Number(Cz(e,t,0))).order(CO).offset(a)(e)).forEach((t,n)=>{t.forEach((t,r)=>{var i=Cz(e[r],u[n],0);Array.isArray(i)&&2===i.length&&k0(i[0])&&k0(i[1])&&(t[0]=i[0],t[1]=i[1])})}),o),graphicalItems:c}]})),MW=N1([MU,M_,OI,OR],MH),MY=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==r&&"zAxis"!==n){var o=((e,t,n)=>{if(null!=e){let r;return[(r=Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i,a=[Math.min(...i=CD(r,t,n).flat(2).filter(k0)),Math.max(...i)];return CL(a[0])&&CL(a[1])?[Math.min(e[0],a[0]),Math.max(e[1],a[1])]:e},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]}})(e,i,a);if(null==o||0!==o[0]||0!==o[1])return o}},MG=N1([My],e=>e.allowDataOverflow),MX=e=>{var t;if(null==e||!("domain"in e))return Mu;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var n=Mz(e.ticks);return[Math.min(...n),Math.max(...n)]}if("category"===e.type)return e.ticks.map(String)}return null!=(t=null==e?void 0:e.domain)?t:Mu},M$=N1([My],MX),Mq=N1([M$,MG],Ob),MK=N1([MW,Om,O9,Mq],MY,{memoizeOptions:{resultEqualityCheck:Mi}}),MZ=e=>e.errorBars,MQ=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);if(0!==r.length){var i=r.flat();return[Math.min(...i),Math.max(...i)]}},MJ=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s,l,c=null==(s=r[n.id])?void 0:s.filter(e=>MI(i,e)),u=Cz(e,null!=(l=t.dataKey)?l:n.dataKey),d=!(!c||"number"!=typeof u||kQ(u))&&c.length?Mz(c.flatMap(t=>{var n,r,i=Cz(e,t.dataKey);if(Array.isArray(i)?[n,r]=i:n=r=i,CL(n)&&CL(r))return[u-n,u+r]})):[];if(d.length>=2){var h=Math.min(...d),f=Math.max(...d);(null==a||h<a)&&(a=h),(null==o||f>o)&&(o=f)}var p=MB(u);null!=p&&(a=null==a?p[0]:Math.min(a,p[0]),o=null==o?p[1]:Math.max(o,p[1]))})}),(null==t?void 0:t.dataKey)!=null&&e.forEach(e=>{var n=MB(Cz(e,t.dataKey));null!=n&&(a=null==a?n[0]:Math.min(a,n[0]),o=null==o?n[1]:Math.max(o,n[1]))}),CL(a)&&CL(o))return[a,o]},M0=N1([MP,My,MT,MZ,O9],MJ,{memoizeOptions:{resultEqualityCheck:Mi}});function M1(e){var{value:t}=e;if(k1(t)||t instanceof Date)return t}var M2=e=>e.referenceElements.dots,M5=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),M3=N1([M2,O9,Me],M5),M4=e=>e.referenceElements.areas,M6=N1([M4,O9,Me],M5),M8=e=>e.referenceElements.lines,M7=N1([M8,O9,Me],M5),M9=(e,t)=>{if(null!=e){var n=Mz(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pe=N1(M3,O9,M9),Pt=(e,t)=>{if(null!=e){var n=Mz(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pn=N1([M6,O9],Pt),Pr=(e,t)=>{if(null!=e){var n=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return Mz([e.x]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:Mz(n)}(e):function(e){if(null!=e.y)return Mz([e.y]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:Mz(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pi=N1([M7,O9],Pr),Pa=N1(Pe,Pi,Pn,(e,t,n)=>MQ(e,n,t)),Po=(e,t,n,r,i,a,o,s)=>null!=n?n:function(e,t,n){if(n||null!=t){if("function"==typeof e&&null!=t)try{var r=e(t,n);if(Ox(r))return Oy(r,t,n)}catch(e){}if(Array.isArray(e)&&2===e.length){var i,a,[o,s]=e;if("auto"===o)null!=t&&(i=Math.min(...t));else if(k0(o))i=o;else if("function"==typeof o)try{null!=t&&(i=o(null==t?void 0:t[0]))}catch(e){}else if("string"==typeof o&&CY.test(o)){var l=CY.exec(o);if(null==l||null==l[1]||null==t)i=void 0;else{var c=+l[1];i=t[0]-c}}else i=null==t?void 0:t[0];if("auto"===s)null!=t&&(a=Math.max(...t));else if(k0(s))a=s;else if("function"==typeof s)try{null!=t&&(a=s(null==t?void 0:t[1]))}catch(e){}else if("string"==typeof s&&CG.test(s)){var u=CG.exec(s);if(null==u||null==u[1]||null==t)a=void 0;else{var d=+u[1];a=t[1]+d}}else a=null==t?void 0:t[1];var h=[i,a];if(Ox(h))return null==t?h:Oy(h,t,n)}}}(t,"vertical"===o&&"xAxis"===s||"horizontal"===o&&"yAxis"===s?MQ(r,a,i):MQ(a,i),e.allowDataOverflow),Ps=N1([My,M$,Mq,MK,M0,Pa,_w,O9],Po,{memoizeOptions:{resultEqualityCheck:Mi}}),Pl=[0,1],Pc=(e,t,n,r,i,a,o)=>{if(null!=e&&null!=n&&0!==n.length||void 0!==o){var s,l,{dataKey:c,type:u}=e,d=CF(t,a);return d&&null==c?(0,_N.default)(0,null!=(l=null==n?void 0:n.length)?l:0):"category"===u?(s=r.map(M1).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&k4(s))?(0,_N.default)(0,r.length):e.allowDuplicatedCategory?s:Array.from(new Set(s))):"expand"===i?Pl:o}},Pu=N1([My,_w,MP,ML,OI,O9,Ps],Pc),Pd=(e,t,n,r,i)=>{if(null!=e){var{scale:a,type:o}=e;if("auto"===a)return"radial"===t&&"radiusAxis"===i?"band":"radial"===t&&"angleAxis"===i?"linear":"category"===o&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":"category"===o?"band":"linear";if("string"==typeof a){var s="scale".concat(k7(a));return s in Op?s:"point"}}},Ph=N1([My,_w,Mw,OB,O9],Pd);function Pf(e,t,n,r){if(null!=n&&null!=r){if("function"==typeof e.scale)return e.scale.copy().domain(n).range(r);var i=function(e){if(null!=e){if(e in Op)return Op[e]();var t="scale".concat(k7(e));if(t in Op)return Op[t]()}}(t);if(null!=i){var a=i.domain(n).range(r);return(e=>{var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-1e-4,a=Math.max(r[0],r[1])+1e-4,o=e(t[0]),s=e(t[n-1]);(o<i||o>a||s<i||s>a)&&e.domain([t[0],t[n-1]])}})(a),a}}}var Pp=(e,t,n)=>{var r=MX(t);if("auto"===n||"linear"===n){if(null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&Ox(e))return OD(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&Ox(e))return OL(e,t.tickCount,t.allowDecimals)}},Pm=N1([Pu,Mb,Ph],Pp),Pg=(e,t,n,r)=>"angleAxis"!==r&&(null==e?void 0:e.type)==="number"&&Ox(t)&&Array.isArray(n)&&n.length>0?[Math.min(t[0],n[0]),Math.max(t[1],n[n.length-1])]:t,Pv=N1([My,Pu,Pm,O9],Pg),Px=N1(ML,My,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(Mz(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(null==i||null==a)return 1/0;var o=a-i;if(0===o)return 1/0;for(var s=0;s<r.length-1;s++){var l=r[s],c=r[s+1];null!=l&&null!=c&&(n=Math.min(n,c-l))}return n/o}}),Py=N1(Px,_w,e=>e.rootProps.barCategoryGap,C3,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!CL(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=k3(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),Pb=N1(Mf,(e,t,n)=>{var r=Mf(e,t);return null==r||"string"!=typeof r.padding?0:Py(e,"xAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{left:0,right:0};var n,r,{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!=(n=i.left)?n:0)+t,right:(null!=(r=i.right)?r:0)+t}}),Pw=N1(Mg,(e,t,n)=>{var r=Mg(e,t);return null==r||"string"!=typeof r.padding?0:Py(e,"yAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{top:0,bottom:0};var n,r,{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!=(n=i.top)?n:0)+t,bottom:(null!=(r=i.bottom)?r:0)+t}}),Pj=N1([C3,Pb,_e,C9,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),PN=N1([C3,_w,Pw,_e,C9,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:"horizontal"===t?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Pk=(e,t,n,r)=>{var i;switch(t){case"xAxis":return Pj(e,n,r);case"yAxis":return PN(e,n,r);case"zAxis":return null==(i=Mx(e,n))?void 0:i.range;case"angleAxis":return O6(e);case"radiusAxis":return O8(e,n);default:return}},PE=N1([My,Pk],Oq),PC=N1([My,Ph,Pv,PE],Pf);function P_(e,t){return e.id<t.id?-1:+(e.id>t.id)}N1([MC,MZ,O9],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>MI(n,e)));var PS=(e,t)=>t,PT=(e,t,n)=>n,PA=N1(C0,PS,PT,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(P_)),PO=N1(C1,PS,PT,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(P_)),PM=(e,t)=>({width:e.width,height:t.height}),PP=N1(C3,Mf,PM),PD=N1(CZ,C3,PA,PS,PT,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s=PM(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}})(t,r,e));var l="top"===r&&!i||"bottom"===r&&i;o[n.id]=a-Number(l)*s.height,a+=(l?-1:1)*s.height}),o}),PL=N1(CK,C3,PO,PS,PT,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s={width:"number"==typeof n.width?n.width:60,height:t.height};null==a&&(a=((e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}})(t,r,e));var l="left"===r&&!i||"right"===r&&i;o[n.id]=a-Number(l)*s.width,a+=(l?-1:1)*s.width}),o}),PI=N1([C3,Mf,(e,t)=>{var n=Mf(e,t);if(null!=n)return PD(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),PR=N1([C3,Mg,(e,t)=>{var n=Mg(e,t);if(null!=n)return PL(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),PB=N1(C3,Mg,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),Pz=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=CF(e,r),l=t.map(e=>e.value);if(o&&s&&"category"===a&&i&&k4(l))return l}},PF=N1([_w,ML,My,O9],Pz),PV=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;if(CF(e,r)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},PU=N1([_w,ML,Mb,O9],PV),PH=N1([_w,(e,t,n)=>{switch(t){case"xAxis":return Mf(e,n);case"yAxis":return Mg(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Ph,PC,PF,PU,Pk,Pm,O9],(e,t,n,r,i,a,o,s,l)=>{if(null!=t){var c=CF(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:c,niceTicks:s,range:o,realScaleType:n,scale:r}}}),PW=N1([_w,Mb,Ph,PC,Pm,Pk,PF,PU,O9],(e,t,n,r,i,a,o,s,l)=>{if(null!=t&&null!=r){var c=CF(e,l),{type:u,ticks:d,tickCount:h}=t,f="scaleBand"===n&&"function"==typeof r.bandwidth?r.bandwidth()/2:2,p="category"===u&&r.bandwidth?r.bandwidth()/f:0;p="angleAxis"===l&&null!=a&&a.length>=2?2*kZ(a[0]-a[1])*p:p;var g=d||i;return g?g.map((e,t)=>({index:t,coordinate:r(o?o.indexOf(e):e)+p,value:e,offset:p})).filter(e=>CL(e.coordinate)):c&&s?s.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>CL(e.coordinate)):r.ticks?r.ticks(h).map(e=>({coordinate:r(e)+p,value:e,offset:p})):r.domain().map((e,t)=>({coordinate:r(e)+p,value:o?o[e]:e,index:t,offset:p}))}}),PY=N1([_w,Mb,PC,Pk,PF,PU,O9],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var s=CF(e,o),{tickCount:l}=t,c=0;return(c="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*kZ(r[0]-r[1])*c:c,s&&a)?a.map((e,t)=>({coordinate:n(e)+c,value:e,index:t,offset:c})):n.ticks?n.ticks(l).map(e=>({coordinate:n(e)+c,value:e,offset:c})):n.domain().map((e,t)=>({coordinate:n(e)+c,value:i?i[e]:e,index:t,offset:c}))}}),PG=N1(My,PC,(e,t)=>{if(null!=e&&null!=t)return Mc(Mc({},e),{},{scale:t})}),PX=N1([My,Ph,Pu,PE],Pf);N1((e,t,n)=>Mx(e,n),PX,(e,t)=>{if(null!=e&&null!=t)return Mc(Mc({},e),{},{scale:t})});var P$=N1([_w,C0,C1],(e,t,n)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),Pq=e=>e.options.defaultTooltipEventType,PK=e=>e.options.validateTooltipEventTypes;function PZ(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function PQ(e,t){return PZ(t,Pq(e),PK(e))}var PJ=(e,t)=>{var n,r=Number(t);if(!kQ(r)&&null!=t)return r>=0?null==e||null==(n=e[r])?void 0:n.value:void 0};function P0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P0(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P2=(e,t,n,r)=>{if(null==t)return E2;var i,a,o,s=(i=e,a=t,o=n,"axis"===a?"click"===o?i.axisInteraction.click:i.axisInteraction.hover:"click"===o?i.itemInteraction.click:i.itemInteraction.hover);if(null==s)return E2;if(s.active)return s;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var l=!0===e.settings.active;if(null!=s.index){if(l)return P1(P1({},s),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return P1(P1({},E2),{},{coordinate:s.coordinate})},P5=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!CL(a))return i;var o=Infinity;t.length>0&&(o=t.length-1);var s=Math.max(0,Math.min(a,o)),l=t[s];return null==l?String(s):!function(e,t,n){if(null==n||null==t)return!0;var r=Cz(e,t);return!(null!=r&&Ox(n))||function(e,t){var n=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}(e),r=t[0],i=t[1];if(void 0===n)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}(r,n)}(l,n,r)?null:String(s)},P3=(e,t,n,r,i,a,o,s)=>{if(null!=a&&null!=s){var l=o[0],c=null==l?void 0:s(l.positions,a);if(null!=c)return c;var u=null==i?void 0:i[Number(a)];if(u)if("horizontal"===n)return{x:u.coordinate,y:(r.top+t)/2};else return{x:(r.left+e)/2,y:u.coordinate}}},P4=(e,t,n,r)=>{if("axis"===t)return e.tooltipItemPayloads;if(0===e.tooltipItemPayloads.length)return[];if(null==(i="hover"===n?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId)&&null!=r){var i,a=e.tooltipItemPayloads[0];return null!=a?[a]:[]}return e.tooltipItemPayloads.filter(e=>{var t;return(null==(t=e.settings)?void 0:t.graphicalItemId)===i})},P6=e=>e.options.tooltipPayloadSearcher,P8=e=>e.tooltip;function P7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P9(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P7(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var De=(e,t,n,r,i,a,o)=>{if(null!=t&&null!=a){var{chartData:s,computedData:l,dataStartIndex:c,dataEndIndex:u}=n;return e.reduce((e,n)=>{var d,h,f,{dataDefinedOnItem:p,settings:g}=n,v=null!=p?p:s,x=Array.isArray(v)?CD(v,c,u):v,y=null!=(d=null==g?void 0:g.dataKey)?d:r,b=null==g?void 0:g.nameKey;return Array.isArray(h=r&&Array.isArray(x)&&!Array.isArray(x[0])&&"axis"===o?k8(x,r,i):a(x,t,l,b))?h.forEach(t=>{var n=P9(P9({},g),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(C$({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:Cz(t.payload,t.dataKey),name:t.name}))}):e.push(C$({tooltipEntrySettings:g,dataKey:y,payload:h,value:Cz(h,y),name:null!=(f=Cz(h,b))?f:null==g?void 0:g.name})),e},[])}},Dt=N1([MF,_w,Mw,OB,Mo],Pd),Dn=N1([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Dr=N1([Mo,Ms],Mj),Di=N1([Dn,MF,Dr],ME,{memoizeOptions:{resultEqualityCheck:Ma}}),Da=N1([Di],e=>e.filter(Mr)),Do=N1([Di],MA,{memoizeOptions:{resultEqualityCheck:Ma}}),Ds=N1([Do,Om],MM),Dl=N1([Da,Om,MF],Mn),Dc=N1([Ds,MF,Di],MD),Du=N1([MF],MX),Dd=N1([MF],e=>e.allowDataOverflow),Dh=N1([Du,Dd],Ob),Df=N1([Di],e=>e.filter(Mr)),Dp=N1([Dl,Df,OI,OR],MH),Dm=N1([Dp,Om,Mo,Dh],MY),Dg=N1([Di],MS),Dv=N1([Ds,MF,Dg,MZ,Mo],MJ,{memoizeOptions:{resultEqualityCheck:Mi}}),Dx=N1([M2,Mo,Ms],M5),Dy=N1([Dx,Mo],M9),Db=N1([M4,Mo,Ms],M5),Dw=N1([Db,Mo],Pt),Dj=N1([M8,Mo,Ms],M5),DN=N1([Dj,Mo],Pr),Dk=N1([Dy,DN,Dw],MQ),DE=N1([MF,Du,Dh,Dm,Dv,Dk,_w,Mo],Po),DC=N1([MF,_w,Ds,Dc,OI,Mo,DE],Pc),D_=N1([DC,MF,Dt],Pp),DS=N1([MF,DC,D_,Mo],Pg),DT=e=>{var t=Mo(e),n=Ms(e);return Pk(e,t,n,!1)},DA=N1([MF,DT],Oq),DO=N1([MF,Dt,DS,DA],Pf),DM=N1([_w,Dc,MF,Mo],Pz),DP=N1([_w,Dc,MF,Mo],PV),DD=N1([_w,MF,Dt,DO,DT,DM,DP,Mo],(e,t,n,r,i,a,o,s)=>{if(t){var{type:l}=t,c=CF(e,s);if(r){var u="scaleBand"===n&&r.bandwidth?r.bandwidth()/2:2,d="category"===l&&r.bandwidth?r.bandwidth()/u:0;return(d="angleAxis"===s&&null!=i&&(null==i?void 0:i.length)>=2?2*kZ(i[0]-i[1])*d:d,c&&o)?o.map((e,t)=>({coordinate:r(e)+d,value:e,index:t,offset:d})):r.domain().map((e,t)=>({coordinate:r(e)+d,value:a?a[e]:e,index:t,offset:d}))}}}),DL=N1([Pq,PK,e=>e.tooltip.settings],(e,t,n)=>PZ(n.shared,e,t)),DI=e=>e.tooltip.settings.trigger,DR=e=>e.tooltip.settings.defaultIndex,DB=N1([P8,DL,DI,DR],P2),Dz=N1([DB,Ds,MV,DC],P5),DF=N1([DD,Dz],PJ),DV=N1([DB],e=>{if(e)return e.dataKey});N1([DB],e=>{if(e)return e.graphicalItemId});var DU=N1([P8,DL,DI,DR],P4),DH=N1([CK,CZ,_w,C3,DD,DR,DU,P6],P3),DW=N1([DB,DH],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),DY=N1([DB],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),DG=N1([DU,Dz,Om,MV,DF,P6,DL],De),DX=N1([DG],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});function D$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D$(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var DK=(e,t,n,r,i)=>{var a=null!=(d=null==t?void 0:t.length)?d:0;if(a<=1||null==e)return 0;if("angleAxis"===r&&null!=i&&1e-6>=Math.abs(Math.abs(i[1]-i[0])-360))for(var o=0;o<a;o++){var s=o>0?null==(h=n[o-1])?void 0:h.coordinate:null==(f=n[a-1])?void 0:f.coordinate,l=null==(p=n[o])?void 0:p.coordinate,c=o>=a-1?null==(g=n[0])?void 0:g.coordinate:null==(v=n[o+1])?void 0:v.coordinate,u=void 0;if(null!=s&&null!=l&&null!=c)if(kZ(l-s)!==kZ(c-l)){var d,h,f,p,g,v,x,y=[];if(kZ(c-l)===kZ(i[1]-i[0])){u=c;var b=l+i[1]-i[0];y[0]=Math.min(b,(b+s)/2),y[1]=Math.max(b,(b+s)/2)}else{u=s;var w=c+i[1]-i[0];y[0]=Math.min(l,(w+l)/2),y[1]=Math.max(l,(w+l)/2)}var j=[Math.min(l,(u+l)/2),Math.max(l,(u+l)/2)];if(e>j[0]&&e<=j[1]||e>=y[0]&&e<=y[1])return null==(x=n[o])?void 0:x.index}else{var N,k=Math.min(s,c),E=Math.max(s,c);if(e>(k+l)/2&&e<=(E+l)/2)return null==(N=n[o])?void 0:N.index}}else if(t)for(var C=0;C<a;C++){var _=t[C];if(null!=_){var S=t[C+1],T=t[C-1];if(0===C&&null!=S&&e<=(_.coordinate+S.coordinate)/2||C===a-1&&null!=T&&e>(_.coordinate+T.coordinate)/2||C>0&&C<a-1&&null!=T&&null!=S&&e>(_.coordinate+T.coordinate)/2&&e<=(_.coordinate+S.coordinate)/2)return _.index}}return -1},DZ=(e,t)=>t,DQ=(e,t,n)=>n,DJ=(e,t,n,r)=>r,D0=N1(DD,e=>(0,CC.default)(e,e=>e.coordinate)),D1=N1([P8,DZ,DQ,DJ],P2),D2=N1([D1,Ds,MV,DC],P5),D5=N1([P8,DZ,DQ,DJ],P4),D3=N1([CK,CZ,_w,C3,DD,DJ,D5,P6],P3),D4=N1([D1,D3],(e,t)=>{var n;return null!=(n=e.coordinate)?n:t}),D6=N1([DD,D2],PJ),D8=N1([D5,D2,Om,MV,D6,P6,DZ],De),D7=N1([D1,D2],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),D9=N1([(e,t)=>t,_w,O7,Mo,DA,DD,D0,C3],(e,t,n,r,i,a,o,s)=>{if(e&&t&&r&&i&&a){if("horizontal"===t||"vertical"===t){if(!e||!r||!i||!a)return;if(function(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}(e,s)){var l=DK("horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0,o,a,r,i),c=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("horizontal"===e)return{x:i.coordinate,y:r.chartY};if("vertical"===e)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}})(t,a,l,e);return{activeIndex:String(l),activeCoordinate:c}}return}if(e&&r&&i&&a&&n){var u=((e,t)=>{var n,{chartX:r,chartY:i}=e,{radius:a,angle:o}=((e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=((e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)})({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=Math.acos((n-i)/o);return r>a&&(s=2*Math.PI-s),{radius:o,angle:180*s/Math.PI,angleInRadian:s}})({x:r,y:i},t),{innerRadius:s,outerRadius:l}=t;if(a<s||a>l||0===a)return null;var{startAngle:c,endAngle:u}=(e=>{var{startAngle:t,endAngle:n}=e,r=Math.min(Math.floor(t/360),Math.floor(n/360));return{startAngle:t-360*r,endAngle:n-360*r}})(t),d=o;if(c<=u){for(;d>u;)d-=360;for(;d<c;)d+=360;n=d>=c&&d<=u}else{for(;d>c;)d-=360;for(;d<u;)d+=360;n=d>=u&&d<=c}return n?OH(OH({},t),{},{radius:a,angle:((e,t)=>{var{startAngle:n,endAngle:r}=t;return e+360*Math.min(Math.floor(n/360),Math.floor(r/360))})(d,t)}):null})(e,n);if(u){var d=DK("centric"===t?u.angle:u.radius,o,a,r,i),h=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("centric"===e){var a=i.coordinate,{radius:o}=r;return Dq(Dq(Dq({},r),OY(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:l}=r;return Dq(Dq(Dq({},r),OY(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,d,u);return{activeIndex:String(d),activeCoordinate:h}}return}}}),Le=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Lt=ki("mouseClick"),Ln=kG();Ln.startListening({actionCreator:Lt,effect:(e,t)=>{var n=e.payload,r=D9(t.getState(),Le(n));(null==r?void 0:r.activeIndex)!=null&&t.dispatch(Cr({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Lr=ki("mouseMove"),Li=kG(),La=null;function Lo(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":"children"===e&&"object"==typeof t&&null!==t?"<<CHILDREN>>":t}function Ls(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ll(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ls(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ls(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Li.startListening({actionCreator:Lr,effect:(e,t)=>{var n=e.payload;null!==La&&cancelAnimationFrame(La);var r=Le(n);La=requestAnimationFrame(()=>{var e=t.getState();if("axis"===PQ(e,e.tooltip.settings.shared)){var n=D9(e,r);(null==n?void 0:n.activeIndex)!=null?t.dispatch(Cn({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(Ce())}La=null})}});var Lc=km({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:kc()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.xAxis[n.id]&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:kc()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:kc()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:kc()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.yAxis[n.id]&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:kc()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:kc()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:kc()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.zAxis[n.id]&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:kc()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:kc()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a=i.widthHistory||[];if(3===a.length&&a[0]===a[2]&&r===a[1]&&r!==i.width&&1>=Math.abs(r-a[0]))return;var o=[...a,r].slice(-3);e.yAxis[n]=Ll(Ll({},e.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:Lu,replaceXAxis:Ld,removeXAxis:Lh,addYAxis:Lf,replaceYAxis:Lp,removeYAxis:Lm,addZAxis:Lg,replaceZAxis:Lv,removeZAxis:Lx,updateYAxisWidth:Ly}=Lc.actions,Lb=Lc.reducer,Lw=km({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:kc()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NI(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:kc()},removeCartesianGraphicalItem:{reducer(e,t){var n=NI(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:kc()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:kc()},removePolarGraphicalItem:{reducer(e,t){var n=NI(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:kc()}}}),{addCartesianGraphicalItem:Lj,replaceCartesianGraphicalItem:LN,removeCartesianGraphicalItem:Lk,addPolarGraphicalItem:LE,removePolarGraphicalItem:LC}=Lw.actions,L_=Lw.reducer,LS=km({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=NI(e).dots.findIndex(e=>e===t.payload);-1!==n&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=NI(e).areas.findIndex(e=>e===t.payload);-1!==n&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=NI(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:LT,removeDot:LA,addArea:LO,removeArea:LM,addLine:LP,removeLine:LD}=LS.actions,LL=LS.reducer,LI={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},LR=km({name:"brush",initialState:LI,reducers:{setBrushSettings:(e,t)=>null==t.payload?LI:t.payload}}),{setBrushSettings:LB}=LR.actions,Lz=LR.reducer,LF=km({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:kc()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NI(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:kc()},removeLegendPayload:{reducer(e,t){var n=NI(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:kc()}}}),{setLegendSize:LV,setLegendSettings:LU,addLegendPayload:LH,replaceLegendPayload:LW,removeLegendPayload:LY}=LF.actions,LG=LF.reducer,LX={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},L$=km({name:"rootProps",initialState:LX,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(n=t.payload.barGap)?n:LX.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),Lq=L$.reducer,{updateOptions:LK}=L$.actions,LZ=km({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:LQ,removeRadiusAxis:LJ,addAngleAxis:L0,removeAngleAxis:L1}=LZ.actions,L2=LZ.reducer,L5=km({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:L3}=L5.actions,L4=L5.reducer,L6=ki("keyDown"),L8=ki("focus"),L7=kG();L7.startListening({actionCreator:L6,effect:(e,t)=>{var n=t.getState();if(!1===n.rootProps.accessibilityLayer)return;var{keyboardInteraction:r}=n.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=P5(r,Ds(n),MV(n),DC(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var s=DD(n);if("Enter"===i){var l=D3(n,"axis","hover",String(r.index));t.dispatch(Ca({active:!r.active,activeIndex:r.index,activeCoordinate:l}));return}var c=o+("ArrowRight"===i?1:-1)*("left-to-right"===P$(n)?1:-1);if(null!=s&&!(c>=s.length)&&!(c<0)){var u=D3(n,"axis","hover",String(c));t.dispatch(Ca({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),L7.startListening({actionCreator:L8,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&null==r.index){var i=D3(n,"axis","hover",String("0"));t.dispatch(Ca({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var L9=ki("externalEvent"),Ie=kG(),It=new Map;Ie.startListening({actionCreator:L9,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=It.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:DW(e),activeDataKey:DV(e),activeIndex:Dz(e),activeLabel:DF(e),activeTooltipIndex:Dz(e),isTooltipActive:DY(e)};n(a,r)}finally{It.delete(i)}});It.set(i,o)}}});var In=N1([P8],e=>e.tooltipItemPayloads),Ir=N1([In,P6,(e,t)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(e=>e.settings.graphicalItemId===r);if(null!=i){var{positions:a}=i;if(null!=a)return t(a,n)}}),Ii=ki("touchMove"),Ia=kG();Ia.startListening({actionCreator:Ii,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=PQ(r,r.tooltip.settings.shared);if("axis"===i){var a=n.touches[0];if(null==a)return;var o=D9(r,Le({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(null==o?void 0:o.activeIndex)!=null&&t.dispatch(Cn({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if("item"===i){var s,l=n.touches[0];if(null==document.elementFromPoint||null==l)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var u=c.getAttribute("data-recharts-item-index"),d=null!=(s=c.getAttribute("data-recharts-item-id"))?s:void 0,h=Di(r).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:f}=h,p=Ir(r,u,d);t.dispatch(E7({activeDataKey:f,activeIndex:u,activeCoordinate:p,activeGraphicalItemId:d}))}}}});var Io=km({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:Is,replaceErrorBar:Il,removeErrorBar:Ic}=Io.actions,Iu=Io.reducer,Id={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Ih(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function If(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ih(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ih(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ip={zIndexMap:Object.values(OG).reduce((e,t)=>If(If({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Im=new Set(Object.values(OG)),Ig=km({name:"zIndex",initialState:Ip,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:kc()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Im.has(n)&&delete e.zIndexMap[n])},prepare:kc()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:kc()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:kc()}}}),{registerZIndexPortal:Iv,unregisterZIndexPortal:Ix,registerZIndexPortalElement:Iy,unregisterZIndexPortalElement:Ib}=Ig.actions,Iw=N7({brush:Lz,cartesianAxis:Lb,chartData:Cd,errorBars:Iu,graphicalItems:L_,layout:Cv,legend:LG,options:Er,polarAxis:L2,polarOptions:L4,referenceElements:LL,rootProps:Lq,tooltip:Co,zIndex:Ig.reducer}),Ij=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart";return function(e){let t,n,r,i=function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new ka;return t&&("boolean"==typeof t?a.push(kn):a.push(kt(t.extraArgument))),a},{reducer:a,middleware:o,devTools:s=!0,duplicateMiddlewareCheck:l=!0,preloadedState:c,enhancers:u}=e||{};if("function"==typeof a)t=a;else if(N8(a))t=N7(a);else throw Error(kX(1));n="function"==typeof o?o(i):i();let d=N9;s&&(d=kr({trace:!1,..."object"==typeof s&&s}));let h=(r=function(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(N5(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=N9(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}(...n),function(e){let{autoBatch:t=!0}=e??{},n=new ka(r);return t&&n.push(kd("object"==typeof t?t:void 0)),n});return function e(t,n,r){if("function"!=typeof t)throw Error(N5(2));if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error(N5(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error(N5(1));return r(e)(t,n)}let i=t,a=n,o=new Map,s=o,l=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((e,t)=>{s.set(t,e)}))}function d(){if(c)throw Error(N5(3));return a}function h(e){if("function"!=typeof e)throw Error(N5(4));if(c)throw Error(N5(5));let t=!0;u();let n=l++;return s.set(n,e),function(){if(t){if(c)throw Error(N5(6));t=!1,u(),s.delete(n),o=null}}}function f(e){if(!N8(e))throw Error(N5(7));if(void 0===e.type)throw Error(N5(8));if("string"!=typeof e.type)throw Error(N5(17));if(c)throw Error(N5(9));try{c=!0,a=i(a,e)}finally{c=!1}return(o=s).forEach(e=>{e()}),e}return f({type:N6.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(N5(10));i=e,f({type:N6.REPLACE})},[N3]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(N5(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[N3](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:Iw,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([Ln.middleware,Li.middleware,L7.middleware,Ie.middleware,Ia.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(kd({type:"raf"}))},devTools:Id.devToolsEnabled&&{serialize:{replacer:Lo},name:"recharts-".concat(t)}})};function IN(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=C7(),a=(0,em.useRef)(null);return i?n:(null==a.current&&(a.current=Ij(t,r)),em.createElement(Ef,{context:Cy,store:a.current},n))}var Ik=e=>{var{chartData:t}=e,n=Cw(),r=C7();return(0,em.useEffect)(()=>r?()=>{}:(n(Cl(t)),()=>{n(Cl(void 0))}),[t,n,r]),null},IE=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function IC(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(IE.has(n)){if(null==e[n]&&null==t[n])continue;if(!function(e,t){if(Ec(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Ec(e[n[r]],t[n[r]]))return!1;return!0}(e[n],t[n]))return!1}else{var r,i;if(r=e[n],i=t[n],(null!=r||null!=i)&&("number"==typeof r&&"number"==typeof i?r!==i&&(r==r||i==i):r!==i))return!1}return!0}var I_=(0,em.memo)(function(e){var{layout:t,margin:n}=e,r=Cw(),i=C7();return(0,em.useEffect)(()=>{i||(r(Cp(t)),r(Cf(n)))},[r,i,t,n]),null},IC);function IS(e){var t=Cw();return(0,em.useEffect)(()=>{t(LK(e))},[t,e]),null}var IT=()=>{var e;return null==(e=CE(e=>e.rootProps.accessibilityLayer))||e},IA=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function IO(e){return"string"==typeof e&&IA.includes(e)}var IM=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"]);function IP(e){return"string"==typeof e&&IM.has(e)}function ID(e){return"string"==typeof e&&e.startsWith("data-")}function IL(e){if("object"!=typeof e||null===e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IP(n)||ID(n))&&(t[n]=e[n]);return t}function II(e){return null==e?null:(0,em.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?IL(e.props):"object"!=typeof e||Array.isArray(e)?null:IL(e)}function IR(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IP(n)||ID(n)||IO(n))&&(t[n]=e[n]);return t}var IB=["children","width","height","viewBox","className","style","title","desc"];function Iz(){return(Iz=Object.assign.bind()).apply(null,arguments)}var IF=(0,em.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:c}=e,u=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,IB),d=a||{width:r,height:i,x:0,y:0},h=(0,_t.clsx)("recharts-surface",o);return em.createElement("svg",Iz({},IR(u),{className:h,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),em.createElement("title",null,l),em.createElement("desc",null,c),n)}),IV=N1(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(null!=t){var r=e[t];if(null!=r)return n?r.panoramaElement:r.element}}),IU=N1(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(OG)))).sort((e,t)=>e-t),{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}}});function IH(e){var{zIndex:t,isPanorama:n}=e,r=(0,em.useRef)(null),i=Cw();return(0,em.useLayoutEffect)(()=>(r.current&&i(Iy({zIndex:t,element:r.current,isPanorama:n})),()=>{i(Ib({zIndex:t,isPanorama:n}))}),[i,t,n]),em.createElement("g",{tabIndex:-1,ref:r})}function IW(e){var{children:t,isPanorama:n}=e,r=CE(IU);if(!r||0===r.length)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return em.createElement(em.Fragment,null,i.map(e=>em.createElement(IH,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>em.createElement(IH,{key:e,zIndex:e,isPanorama:n})))}var IY=["children"];function IG(){return(IG=Object.assign.bind()).apply(null,arguments)}var IX={width:"100%",height:"100%",display:"block"},I$=(0,em.forwardRef)((e,t)=>{var n,r,i=CE(CK),a=CE(CZ),o=IT();if(!CI(i)||!CI(a))return null;var{children:s,otherAttributes:l,title:c,desc:u}=e;return null!=l&&(n="number"==typeof l.tabIndex?l.tabIndex:o?0:void 0,r="string"==typeof l.role?l.role:o?"application":void 0),em.createElement(IF,IG({},l,{title:c,desc:u,role:r,tabIndex:n,width:i,height:a,style:IX,ref:t}),s)}),Iq=e=>{var{children:t}=e,n=CE(_e);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return em.createElement(IF,{width:r,height:i,x:o,y:a},t)},IK=(0,em.forwardRef)((e,t)=>{var{children:n}=e,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,IY);return C7()?em.createElement(Iq,null,em.createElement(IW,{isPanorama:!0},n)):em.createElement(I$,IG({ref:t},r),em.createElement(IW,{isPanorama:!1},n))}),IZ=new(e.i(29942)).default,IQ="recharts.syncEvent.tooltip",IJ="recharts.syncEvent.brush";function I0(e){return e.tooltip.syncInteraction}var I1=["x","y"];function I2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I5(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I2(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var I3=(0,em.createContext)(null),I4=(0,em.createContext)(null);function I6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I8(){return(I8=Object.assign.bind()).apply(null,arguments)}var I7=()=>{var e,t,n,r,i,a,o,s,l,c,u,d;return e=Cw(),(0,em.useEffect)(()=>{e(Ei())},[e]),t=CE(Oz),n=CE(OV),r=Cw(),i=CE(OF),a=CE(DD),o=CE(_w),s=_x(),l=CE(e=>e.rootProps.className),(0,em.useEffect)(()=>{if(null==t)return Ee;var e=(e,l,c)=>{if(n!==c&&t===e){if("index"===i){if(s&&null!=l&&null!=(u=l.payload)&&u.coordinate&&l.payload.sourceViewBox){var u,d,h=l.payload.coordinate,{x:f,y:p}=h,g=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(h,I1),{x:v,y:x,width:y,height:b}=l.payload.sourceViewBox,w=I5(I5({},g),{},{x:s.x+(y?(f-v)/y:0)*s.width,y:s.y+(b?(p-x)/b:0)*s.height});r(I5(I5({},l),{},{payload:I5(I5({},l.payload),{},{coordinate:w})}))}else r(l);return}if(null!=a){if("function"==typeof i){var j=i(a,{activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate});d=a[j]}else"value"===i&&(d=a.find(e=>String(e.value)===l.payload.label));var{coordinate:N}=l.payload;if(null==d||!1===l.payload.active||null==N||null==s)return void r(Ci({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));var{x:k,y:E}=N,C=Math.min(k,s.x+s.width),_=Math.min(E,s.y+s.height),S={x:"horizontal"===o?d.coordinate:C,y:"horizontal"===o?_:d.coordinate};r(Ci({active:l.payload.active,coordinate:S,dataKey:l.payload.dataKey,index:String(d.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId}))}}};return IZ.on(IQ,e),()=>{IZ.off(IQ,e)}},[l,r,n,t,i,a,o,s]),c=CE(Oz),u=CE(OV),d=Cw(),(0,em.useEffect)(()=>{if(null==c)return Ee;var e=(e,t,n)=>{u!==n&&c===e&&d(Cc(t))};return IZ.on(IJ,e),()=>{IZ.off(IJ,e)}},[d,u,c]),null};function I9(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Re=(0,em.forwardRef)((e,t)=>{var n,r,i=(0,em.useRef)(null),[a,o]=(0,em.useState)({containerWidth:I9(null==(n=e.style)?void 0:n.width),containerHeight:I9(null==(r=e.style)?void 0:r.height)}),s=(0,em.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e&&"u">typeof ResizeObserver){var{width:n,height:r}=e.getBoundingClientRect();s(n,r);var a=new ResizeObserver(e=>{var{width:t,height:n}=e[0].contentRect;s(t,n)});a.observe(e),i.current=a}},[t,s]);return(0,em.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[s]),em.createElement(em.Fragment,null,em.createElement(_j,{width:a.containerWidth,height:a.containerHeight}),em.createElement("div",I8({ref:l},e)))}),Rt=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,em.useState)({containerWidth:I9(n),containerHeight:I9(r)}),o=(0,em.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return em.createElement(em.Fragment,null,em.createElement(_j,{width:i.containerWidth,height:i.containerHeight}),em.createElement("div",I8({ref:s},e)))}),Rn=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return em.createElement(em.Fragment,null,em.createElement(_j,{width:n,height:r}),em.createElement("div",I8({ref:t},e)))}),Rr=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return kJ(n)||kJ(r)?em.createElement(Rt,I8({},e,{ref:t})):em.createElement(Rn,I8({},e,{ref:t}))}),Ri=(0,em.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:d,onMouseUp:h,onTouchEnd:f,onTouchMove:p,onTouchStart:g,style:v,width:x,responsive:y,dispatchTouchEvents:b=!0}=e,w=(0,em.useRef)(null),j=Cw(),[N,k]=(0,em.useState)(null),[E,C]=(0,em.useState)(null),_=function(){var e=Cw(),[t,n]=(0,em.useState)(null),r=CE(CQ);return(0,em.useEffect)(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;CL(n)&&n!==r&&e(Cg(n))}},[t,e,r]),n}(),S=_p(),T=(null==S?void 0:S.width)>0?S.width:x,A=(null==S?void 0:S.height)>0?S.height:i,O=(0,em.useCallback)(e=>{_(e),"function"==typeof t&&t(e),k(e),C(e),null!=e&&(w.current=e)},[_,t,k,C]),M=(0,em.useCallback)(e=>{j(Lt(e)),j(L9({handler:a,reactEvent:e}))},[j,a]),P=(0,em.useCallback)(e=>{j(Lr(e)),j(L9({handler:c,reactEvent:e}))},[j,c]),D=(0,em.useCallback)(e=>{j(Ce()),j(L9({handler:u,reactEvent:e}))},[j,u]),L=(0,em.useCallback)(e=>{j(Lr(e)),j(L9({handler:d,reactEvent:e}))},[j,d]),I=(0,em.useCallback)(()=>{j(L8())},[j]),R=(0,em.useCallback)(e=>{j(L6(e.key))},[j]),B=(0,em.useCallback)(e=>{j(L9({handler:o,reactEvent:e}))},[j,o]),z=(0,em.useCallback)(e=>{j(L9({handler:s,reactEvent:e}))},[j,s]),F=(0,em.useCallback)(e=>{j(L9({handler:l,reactEvent:e}))},[j,l]),V=(0,em.useCallback)(e=>{j(L9({handler:h,reactEvent:e}))},[j,h]),U=(0,em.useCallback)(e=>{j(L9({handler:g,reactEvent:e}))},[j,g]),H=(0,em.useCallback)(e=>{b&&j(Ii(e)),j(L9({handler:p,reactEvent:e}))},[j,b,p]),W=(0,em.useCallback)(e=>{j(L9({handler:f,reactEvent:e}))},[j,f]);return em.createElement(I3.Provider,{value:N},em.createElement(I4.Provider,{value:E},em.createElement(!0===y?Re:Rr,{width:null!=T?T:null==v?void 0:v.width,height:null!=A?A:null==v?void 0:v.height,className:(0,_t.clsx)("recharts-wrapper",r),style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I6(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I6(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"relative",cursor:"default",width:T,height:A},v),onClick:M,onContextMenu:B,onDoubleClick:z,onFocus:I,onKeyDown:R,onMouseDown:F,onMouseEnter:P,onMouseLeave:D,onMouseMove:L,onMouseUp:V,onTouchEnd:W,onTouchMove:H,onTouchStart:U,ref:O},em.createElement(I7,null),n)))}),Ra=N1([C3],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Ro=N1([Ra,CK,CZ],(e,t,n)=>{if(e&&null!=t&&null!=n)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Rs=(0,em.createContext)(void 0),Rl=e=>{var{children:t}=e,[n]=(0,em.useState)("".concat(k5("recharts"),"-clip")),r=CE(Ro);if(null==r)return null;var{x:i,y:a,width:o,height:s}=r;return em.createElement(Rs.Provider,{value:n},em.createElement("defs",null,em.createElement("clipPath",{id:n},em.createElement("rect",{x:i,y:a,height:s,width:o}))),t)},Rc=["width","height","responsive","children","className","style","compact","title","desc"],Ru=(0,em.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:c,desc:u}=e,d=IL(function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Rc));return l?em.createElement(em.Fragment,null,em.createElement(_j,{width:n,height:r}),em.createElement(IK,{otherAttributes:d,title:c,desc:u},a)):em.createElement(Ri,{className:o,style:s,width:n,height:r,responsive:null!=i&&i,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},em.createElement(IK,{otherAttributes:d,title:c,desc:u,ref:t},em.createElement(Rl,null,a)))});function Rd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rh(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rd(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);return Object.keys(t).reduce((e,n)=>(void 0===e[n]&&void 0!==t[n]&&(e[n]=t[n]),e),n)}function Rf(){return(Rf=Object.assign.bind()).apply(null,arguments)}var Rp={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Rm=(0,em.forwardRef)(function(e,t){var n,r=Rh(e.categoricalChartProps,Rp),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,categoricalChartProps:l}=e;return em.createElement(IN,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,eventEmitter:void 0}},reduxStoreName:null!=(n=l.id)?n:i},em.createElement(Ik,{chartData:l.data}),em.createElement(I_,{layout:r.layout,margin:r.margin}),em.createElement(IS,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),em.createElement(Ru,Rf({},r,{ref:t})))}),Rg=["axis"],Rv=(0,em.forwardRef)((e,t)=>em.createElement(Rm,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Rg,tooltipPayloadSearcher:Et,categoricalChartProps:e,ref:t})),Rx=em;function Ry(e){this._context=e}function Rb(e){return new Ry(e)}Ry.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};let Rw=Math.PI,Rj=2*Rw,RN=Rj-1e-6;function Rk(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class RE{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?Rk:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return Rk;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e*=1,t*=1,n*=1,r*=1,(i*=1)<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,l=r-t,c=a-e,u=o-t,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>1e-6)if(Math.abs(u*s-l*c)>1e-6&&i){let h=n-a,f=r-o,p=s*s+l*l,g=Math.sqrt(p),v=Math.sqrt(d),x=i*Math.tan((Rw-Math.acos((p+d-(h*h+f*f))/(2*g*v)))/2),y=x/v,b=x/g;Math.abs(y-1)>1e-6&&this._append`L${e+y*c},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*h>c*f)},${this._x1=e+b*s},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,a){if(e*=1,t*=1,n*=1,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,u=1^a,d=a?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${l},${c}`,n&&(d<0&&(d=d%Rj+Rj),d>RN?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:d>1e-6&&this._append`A${n},${n},0,${+(d>=Rw)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n*=1}v${+r}h${-n}Z`}toString(){return this._}}function RC(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new RE(t)}function R_(e){return e[0]}function RS(e){return e[1]}function RT(e,t){var n=CT(!0),r=null,i=Rb,a=null,o=RC(s);function s(s){var l,c,u,d=(s=CS(s)).length,h=!1;for(null==r&&(a=i(u=o())),l=0;l<=d;++l)!(l<d&&n(c=s[l],l,s))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(c,l,s),+t(c,l,s));if(u)return a=null,u+""||null}return e="function"==typeof e?e:void 0===e?R_:CT(e),t="function"==typeof t?t:void 0===t?RS:CT(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:CT(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:CT(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:CT(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,null!=r&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(null==e?r=a=null:a=i(r=e),s):r},s}function RA(e,t,n){var r=null,i=CT(!0),a=null,o=Rb,s=null,l=RC(c);function c(c){var u,d,h,f,p,g=(c=CS(c)).length,v=!1,x=Array(g),y=Array(g);for(null==a&&(s=o(p=l())),u=0;u<=g;++u){if(!(u<g&&i(f=c[u],u,c))===v)if(v=!v)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=u-1;h>=d;--h)s.point(x[h],y[h]);s.lineEnd(),s.areaEnd()}v&&(x[u]=+e(f,u,c),y[u]=+t(f,u,c),s.point(r?+r(f,u,c):x[u],n?+n(f,u,c):y[u]))}if(p)return s=null,p+""||null}function u(){return RT().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?R_:CT(+e),t="function"==typeof t?t:void 0===t?CT(0):CT(+t),n="function"==typeof n?n:void 0===n?RS:CT(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:CT(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:CT(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:CT(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:CT(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:CT(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:CT(+e),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:CT(!!e),c):i},c.curve=function(e){return arguments.length?(o=e,null!=a&&(s=o(a)),c):o},c.context=function(e){return arguments.length?(null==e?a=s=null:s=o(a=e),c):a},c}function RO(){}function RM(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function RP(e){this._context=e}function RD(e){this._context=e}function RL(e){this._context=e}RE.prototype,RP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:RM(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:RM(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RD.prototype={areaStart:RO,areaEnd:RO,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:RM(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RL.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:RM(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class RI{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function RR(e){this._context=e}RR.prototype={areaStart:RO,areaEnd:RO,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e*=1,t*=1,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function RB(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0);return((a<0?-1:1)+(o<0?-1:1))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs((a*i+o*r)/(r+i)))||0}function Rz(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function RF(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function RV(e){this._context=e}function RU(e){this._context=new RH(e)}function RH(e){this._context=e}function RW(e){this._context=e}function RY(e){var t,n,r=e.length-1,i=Array(r),a=Array(r),o=Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(t=0,a[r-1]=(e[r]+i[r-1])/2;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function RG(e,t){this._context=e,this._t=t}RV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:RF(this,this._t0,Rz(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t*=1,(e*=1)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,RF(this,Rz(this,n=RB(this,e,t)),n);break;default:RF(this,this._t0,n=RB(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(RU.prototype=Object.create(RV.prototype)).point=function(e,t){RV.prototype.point.call(this,t,e)},RH.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}},RW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=RY(e),i=RY(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},RG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var RX=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,R$=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if((0,em.isValidElement)(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var r={};return Object.keys(n).forEach(e=>{IO(e)&&(r[e]=t||(t=>n[e](n,t)))}),r};function Rq(){return(Rq=Object.assign.bind()).apply(null,arguments)}function RK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function RZ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?RK(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RK(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var RQ={curveBasisClosed:function(e){return new RD(e)},curveBasisOpen:function(e){return new RL(e)},curveBasis:function(e){return new RP(e)},curveBumpX:function(e){return new RI(e,!0)},curveBumpY:function(e){return new RI(e,!1)},curveLinearClosed:function(e){return new RR(e)},curveLinear:Rb,curveMonotoneX:function(e){return new RV(e)},curveMonotoneY:function(e){return new RU(e)},curveNatural:function(e){return new RW(e)},curveStep:function(e){return new RG(e,.5)},curveStepAfter:function(e){return new RG(e,1)},curveStepBefore:function(e){return new RG(e,0)}},RJ=e=>CL(e.x)&&CL(e.y),R0=e=>null!=e.base&&RJ(e.base)&&RJ(e),R1=e=>e.x,R2=e=>e.y,R5=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=CE(_w);if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?(e=>{var{type:t="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=e,o=((e,t)=>{if("function"==typeof e)return e;var n="curve".concat(k7(e));return("curveMonotone"===n||"curveBump"===n)&&t?RQ["".concat(n).concat("vertical"===t?"Y":"X")]:RQ[n]||Rb})(t,i),s=a?n.filter(RJ):n;if(Array.isArray(r)){var l=n.map((e,t)=>RZ(RZ({},e),{},{base:r[t]}));return("vertical"===i?RA().y(R2).x1(R1).x0(e=>e.base.x):RA().x(R1).y1(R2).y0(e=>e.base.y)).defined(R0).curve(o)(a?l.filter(R0):l)}return("vertical"===i&&k0(r)?RA().y(R2).x1(R1).x0(r):k0(r)?RA().x(R1).y1(R2).y0(r):RT().x(R1).y(R2)).defined(RJ).curve(o)(s)})(o):r;return em.createElement("path",Rq({},IL(e),R$(e),{className:(0,_t.clsx)("recharts-curve",t),d:null===s?void 0:s,ref:i}))},R3=["children","className"];function R4(){return(R4=Object.assign.bind()).apply(null,arguments)}var R6=em.forwardRef((e,t)=>{var{children:n,className:r}=e,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,R3),a=(0,_t.clsx)("recharts-layer",r);return em.createElement("g",R4({className:a},IR(i),{ref:t}),n)}),R8=e.i(4178);function R7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var R9=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R7(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),Be=new class{constructor(e){!function(e,t,n){var r;(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"cache",new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;null!=n&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(R9.cacheSize),Bt={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Bn="recharts_measurement_span",Br=(e,t)=>{try{var n=document.getElementById(Bn);n||((n=document.createElement("span")).setAttribute("id",Bn),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Bt,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(e){return{width:0,height:0}}},Bi=function(e){var t,n,r,i,a,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Id.isSsr)return{width:0,height:0};if(!R9.enableCache)return Br(e,s);var l=(t=s.fontSize||"",n=s.fontFamily||"",r=s.fontWeight||"",i=s.fontStyle||"",a=s.letterSpacing||"",o=s.textTransform||"","".concat(e,"|").concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o)),c=Be.get(l);if(c)return c;var u=Br(e,s);return Be.set(l,u),u},Ba=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bo=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bs=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Bl=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Bc={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},Bu=["cm","mm","pt","pc","in","Q","px"];class Bd{static parse(e){var t,[,n,r]=null!=(t=Bl.exec(e))?t:[];return null==n?Bd.NaN:new Bd(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,kQ(e)&&(this.unit=""),""===t||Bs.test(t)||(this.num=NaN,this.unit=""),function(e){return Bu.includes(e)}(t)&&(this.num=function(e,t){return e*Bc[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new Bd(NaN,""):new Bd(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Bd(NaN,""):new Bd(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bd(NaN,""):new Bd(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bd(NaN,""):new Bd(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return kQ(this.num)}}function Bh(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!=(n=Ba.exec(t))?n:[],o=Bd.parse(null!=r?r:""),s=Bd.parse(null!=a?a:""),l="*"===i?o.multiply(s):o.divide(s);if(l.isNaN())return"NaN";t=t.replace(Ba,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=Bo.exec(t))?c:[],f=Bd.parse(null!=u?u:""),p=Bd.parse(null!=h?h:""),g="+"===d?f.add(p):f.subtract(p);if(g.isNaN())return"NaN";t=t.replace(Bo,g.toString())}return t}u="NaN",d=new Bd(NaN,""),(u="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(u,"string"))?s:s+"")in Bd?Object.defineProperty(Bd,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):Bd[u]=d;var Bf=/\(([^()]*)\)/;function Bp(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,n=e;null!=(t=Bf.exec(n));){var[,r]=t;n=n.replace(Bf,Bh(r))}return n}(t),t=Bh(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var Bm=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],Bg=["dx","dy","angle","className","breakAll"];function Bv(){return(Bv=Object.assign.bind()).apply(null,arguments)}function Bx(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var By=/[ \f\n\r\t\v\u2028\u2029]+/,Bb=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];null!=t&&(i=n?t.toString().split(""):t.toString().split(By));var a=i.map(e=>({word:e,width:Bi(e,r).width})),o=n?0:Bi(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch(e){return null}},Bw=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];return s&&null!=o&&(null==t||r||s.width+o+n<Number(t))?(s.words.push(a),s.width+=o+n):e.push({words:[a],width:o}),e},[]),Bj=e=>e.reduce((e,t)=>e.width>t.width?e:t),BN=(e,t,n,r,i,a,o,s)=>{var l=Bb({breakAll:n,style:r,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=Bw(l.wordsWithComputedWidth,a,o,s);return[c.length>i||Bj(c).width>Number(a),c]},Bk=e=>[{words:null==e?[]:e.toString().split(By),width:void 0}],BE="#808080",BC={angle:0,breakAll:!1,capHeight:"0.71em",fill:BE,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},B_=(0,em.forwardRef)((e,t)=>{var n,r=Rh(e,BC),{x:i,y:a,lineHeight:o,capHeight:s,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,h=Bx(r,Bm),f=(0,em.useMemo)(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Id.isSsr){var s=Bb({breakAll:a,children:r,style:i});if(!s)return Bk(r);var{wordsWithComputedWidth:l,spaceWidth:c}=s;return((e,t,n,r,i)=>{var a,{maxLines:o,children:s,style:l,breakAll:c}=e,u=k0(o),d=String(s),h=Bw(t,r,n,i);if(!u||i||!(h.length>o||Bj(h).width>Number(r)))return h;for(var f=0,p=d.length-1,g=0;f<=p&&g<=d.length-1;){var v=Math.floor((f+p)/2),[x,y]=BN(d,v-1,c,l,o,r,n,i),[b]=BN(d,v,c,l,o,r,n,i);if(x||b||(f=v+1),x&&b&&(p=v-1),!x&&b){a=y;break}g++}return a||h})({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return Bk(r)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),{dx:p,dy:g,angle:v,className:x,breakAll:y}=h,b=Bx(h,Bg);if(!k1(i)||!k1(a)||0===f.length)return null;var w=Number(i)+(k0(p)?p:0),j=Number(a)+(k0(g)?g:0);if(!CL(w)||!CL(j))return null;switch(d){case"start":n=Bp("calc(".concat(s,")"));break;case"middle":n=Bp("calc(".concat((f.length-1)/2," * -").concat(o," + (").concat(s," / 2))"));break;default:n=Bp("calc(".concat(f.length-1," * -").concat(o,")"))}var N=[];if(c){var k=f[0].width,{width:E}=h;N.push("scale(".concat(k0(E)&&k0(k)?E/k:1,")"))}return v&&N.push("rotate(".concat(v,", ").concat(w,", ").concat(j,")")),N.length&&(b.transform=N.join(" ")),em.createElement("text",Bv({},IR(b),{ref:t,x:w,y:j,className:(0,_t.clsx)("recharts-text",x),textAnchor:u,fill:l.includes("url")?BE:l}),f.map((e,t)=>{var r=e.words.join(y?"":" ");return em.createElement("tspan",{x:w,dy:0===t?n:o,key:"".concat(r,"-").concat(t)},r)}))});function BS(e){var{zIndex:t,children:n}=e,r=void 0!==CE(_w)&&void 0!==t&&0!==t,i=C7(),a=Cw();(0,em.useLayoutEffect)(()=>r?(a(Iv({zIndex:t})),()=>{a(Ix({zIndex:t}))}):Ee,[a,t,r]);var o=CE(e=>IV(e,t,i));return r?o?(0,e1.createPortal)(n,o):null:n}B_.displayName="Text";var BT=["labelRef"],BA=["content"];function BO(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function BM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BM(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BD(){return(BD=Object.assign.bind()).apply(null,arguments)}var BL=(0,em.createContext)(null),BI=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,em.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return em.createElement(BL.Provider,{value:l},s)},BR=()=>{var e=(0,em.useContext)(BL),t=_x();return e||_v(t)},BB=(0,em.createContext)(null),Bz=e=>null!=e&&"function"==typeof e,BF=e=>"cx"in e&&k0(e.cx),BV={angle:0,offset:5,zIndex:OG.label,position:"middle",textBreakAll:!1};function BU(e){var t,n,r,i,a,o,s=Rh(e,BV),{viewBox:l,position:c,value:u,children:d,content:h,className:f="",textBreakAll:p,labelRef:g}=s,v=(t=(0,em.useContext)(BB),n=CE(O7),t||n),x=BR();if(!(i=null==l?"center"===c?x:null!=v?v:x:BF(l)?l:_v(l))||null==u&&null==d&&!(0,em.isValidElement)(h)&&"function"!=typeof h)return null;var y=BP(BP({},s),{},{viewBox:i});if((0,em.isValidElement)(h)){var{labelRef:b}=y,w=BO(y,BT);return(0,em.cloneElement)(h,w)}if("function"==typeof h){var{content:j}=y,N=BO(y,BA);if(a=(0,em.createElement)(h,N),(0,em.isValidElement)(a))return a}else a=(e=>{var{value:t,formatter:n}=e,r=null==e.children?t:e.children;return"function"==typeof n?n(r):r})(s);var k=IR(s);if(BF(i)){if("insideStart"===c||"insideEnd"===c||"end"===c)return((e,t,n,r,i)=>{var a,o,{offset:s,className:l}=e,{cx:c,cy:u,innerRadius:d,outerRadius:h,startAngle:f,endAngle:p,clockWise:g}=i,v=(d+h)/2,x=kZ(p-f)*Math.min(Math.abs(p-f),360),y=x>=0?1:-1;switch(t){case"insideStart":a=f+y*s,o=g;break;case"insideEnd":a=p-y*s,o=!g;break;case"end":a=p+y*s,o=g;break;default:throw Error("Unsupported position ".concat(t))}o=x<=0?o:!o;var b=OY(c,u,v,a),w=OY(c,u,v,a+(o?1:-1)*359),j="M".concat(b.x,",").concat(b.y,"\n A").concat(v,",").concat(v,",0,1,").concat(+!o,",\n ").concat(w.x,",").concat(w.y),N=null==e.id?k5("recharts-radial-line-"):e.id;return em.createElement("text",BD({},r,{dominantBaseline:"central",className:(0,_t.clsx)("recharts-radial-bar-label",l)}),em.createElement("defs",null,em.createElement("path",{id:N,d:j})),em.createElement("textPath",{xlinkHref:"#".concat(N)},n))})(s,c,a,k,i);o=((e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:l}=e,c=(s+l)/2;if("outside"===n){var{x:u,y:d}=OY(r,i,o+t,c);return{x:u,y:d,textAnchor:u>=r?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var{x:h,y:f}=OY(r,i,(a+o)/2,c);return{x:h,y:f,textAnchor:"middle",verticalAnchor:"middle"}})(i,s.offset,s.position)}else o=((e,t)=>{var n,{parentViewBox:r,offset:i,position:a}=e;null==r||BF(r)||(n=r);var{x:o,y:s,upperWidth:l,lowerWidth:c,height:u}=t,d=o+(l-c)/2,h=(o+d)/2,f=(l+c)/2,p=u>=0?1:-1,g=p*i,v=p>0?"end":"start",x=p>0?"start":"end",y=l>=0?1:-1,b=y*i,w=y>0?"end":"start",j=y>0?"start":"end";if("top"===a)return BP(BP({},{x:o+l/2,y:s-g,textAnchor:"middle",verticalAnchor:v}),n?{height:Math.max(s-n.y,0),width:l}:{});if("bottom"===a)return BP(BP({},{x:d+c/2,y:s+u+g,textAnchor:"middle",verticalAnchor:x}),n?{height:Math.max(n.y+n.height-(s+u),0),width:c}:{});if("left"===a){var N={x:h-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"};return BP(BP({},N),n?{width:Math.max(N.x-n.x,0),height:u}:{})}if("right"===a){var k={x:h+f+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"};return BP(BP({},k),n?{width:Math.max(n.x+n.width-k.x,0),height:u}:{})}var E=n?{width:f,height:u}:{};return"insideLeft"===a?BP({x:h+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"},E):"insideRight"===a?BP({x:h+f-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"},E):"insideTop"===a?BP({x:o+l/2,y:s+g,textAnchor:"middle",verticalAnchor:x},E):"insideBottom"===a?BP({x:d+c/2,y:s+u-g,textAnchor:"middle",verticalAnchor:v},E):"insideTopLeft"===a?BP({x:o+b,y:s+g,textAnchor:j,verticalAnchor:x},E):"insideTopRight"===a?BP({x:o+l-b,y:s+g,textAnchor:w,verticalAnchor:x},E):"insideBottomLeft"===a?BP({x:d+b,y:s+u-g,textAnchor:j,verticalAnchor:v},E):"insideBottomRight"===a?BP({x:d+c-b,y:s+u-g,textAnchor:w,verticalAnchor:v},E):a&&"object"==typeof a&&(k0(a.x)||kJ(a.x))&&(k0(a.y)||kJ(a.y))?BP({x:o+k3(a.x,f),y:s+k3(a.y,u),textAnchor:"end",verticalAnchor:"end"},E):BP({x:o+l/2,y:s+u/2,textAnchor:"middle",verticalAnchor:"middle"},E)})(s,i);return em.createElement(BS,{zIndex:s.zIndex},em.createElement(B_,BD({ref:g,className:(0,_t.clsx)("recharts-label",f)},k,o,{textAnchor:"start"===(r=k.textAnchor)||"middle"===r||"end"===r||"inherit"===r?k.textAnchor:o.textAnchor,breakAll:p}),a))}function BH(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return!0===e?em.createElement(BU,BD({key:"label-implicit"},r)):k1(e)?em.createElement(BU,BD({key:"label-implicit",value:e},r)):(0,em.isValidElement)(e)?e.type===BU?(0,em.cloneElement)(e,BP({key:"label-implicit"},r)):em.createElement(BU,BD({key:"label-implicit",content:e},r)):Bz(e)?em.createElement(BU,BD({key:"label-implicit",content:e},r)):e&&"object"==typeof e?em.createElement(BU,BD({},e,{key:"label-implicit"},r)):null})(t,BR(),n)||null}BU.displayName="Label";var BW=["valueAccessor"],BY=["dataKey","clockWise","id","textBreakAll","zIndex"];function BG(){return(BG=Object.assign.bind()).apply(null,arguments)}function BX(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var B$=e=>Array.isArray(e.value)?(0,R8.default)(e.value):e.value,Bq=(0,em.createContext)(void 0),BK=Bq.Provider,BZ=(0,em.createContext)(void 0);function BQ(e){var{valueAccessor:t=B$}=e,n=BX(e,BW),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=BX(n,BY),c=(0,em.useContext)(Bq),u=(0,em.useContext)(BZ),d=c||u;return d&&d.length?em.createElement(BS,{zIndex:null!=s?s:OG.label},em.createElement(R6,{className:"recharts-label-list"},d.map((e,i)=>{var s,c=null==r?t(e,i):Cz(e&&e.payload,r),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return em.createElement(BU,BG({key:"label-".concat(i)},IR(e),l,u,{fill:null!=(s=n.fill)?s:e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))}))):null}function BJ(e){var{label:t}=e;return t?!0===t?em.createElement(BQ,{key:"labelList-implicit"}):em.isValidElement(t)||Bz(t)?em.createElement(BQ,{key:"labelList-implicit",content:t}):"object"==typeof t?em.createElement(BQ,BG({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function B0(){return(B0=Object.assign.bind()).apply(null,arguments)}BZ.Provider,BQ.displayName="LabelList";var B1=e=>{var{cx:t,cy:n,r,className:i}=e,a=(0,_t.clsx)("recharts-dot",i);return k0(t)&&k0(n)&&k0(r)?em.createElement("circle",B0({},IL(e),R$(e),{className:a,cx:t,cy:n,r:r})):null},B2=(e.i(79684),e=>!e||"object"!=typeof e||!("clipDot"in e)||!!e.clipDot),B5=["points"];function B3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function B4(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B3(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B3(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function B6(){return(B6=Object.assign.bind()).apply(null,arguments)}function B8(e){var{option:t,dotProps:n,className:r}=e;if((0,em.isValidElement)(t))return(0,em.cloneElement)(t,n);if("function"==typeof t)return t(n);var i=(0,_t.clsx)(r,"boolean"!=typeof t?t.className:""),a=null!=n?n:{},{points:o}=a,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(a,B5);return em.createElement(B1,B6({},s,{className:i}))}function B7(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:l,zIndex:c=OG.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=B2(n),d=null==n?null:(0,em.isValidElement)(n)?IR(n.props):"object"!=typeof n||Array.isArray(n)?null:IR(n),h=t.map((e,r)=>{var s,l,c=B4(B4(B4({r:3},o),d),{},{index:r,cx:null!=(s=e.x)?s:void 0,cy:null!=(l=e.y)?l:void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return em.createElement(B8,{key:"dot-".concat(r),option:n,dotProps:c,className:i})}),f={};return s&&null!=l&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),em.createElement(BS,{zIndex:c},em.createElement(R6,B6({className:r},f),h))}function B9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B9(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zt=e=>{var t,{point:n,childIndex:r,mainColor:i,activeDot:a,dataKey:o,clipPath:s}=e;if(!1===a||null==n.x||null==n.y)return null;var l=ze(ze(ze({},{index:r,dataKey:o,cx:n.x,cy:n.y,r:4,fill:null!=i?i:"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value}),II(a)),R$(a));return t=(0,em.isValidElement)(a)?(0,em.cloneElement)(a,l):"function"==typeof a?a(l):em.createElement(B1,l),em.createElement(R6,{className:"recharts-active-dot",clipPath:s},t)};function zn(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=OG.activeDot}=e,s=CE(Dz),l=CE(DX);if(null==t||null==l)return null;var c=t.find(e=>l.includes(e.payload));return null==c?null:em.createElement(BS,{zIndex:o},em.createElement(zt,{point:c,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function zr(e){var{tooltipEntrySettings:t}=e,n=Cw(),r=C7(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(E3(t)):i.current!==t&&n(E4({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(E6(i.current)),i.current=null)},[n]),null}function zi(e,t){var n,r,i=CE(t=>Mf(t,e)),a=CE(e=>Mg(e,t)),o=null!=(n=null==i?void 0:i.allowDataOverflow)?n:Md.allowDataOverflow,s=null!=(r=null==a?void 0:a.allowDataOverflow)?r:Mp.allowDataOverflow;return{needClip:o||s,needClipX:o,needClipY:s}}function za(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=CE(Ro),{needClipX:a,needClipY:o,needClip:s}=zi(t,n);if(!s||!i)return null;var{x:l,y:c,width:u,height:d}=i;return em.createElement("clipPath",{id:"clipPath-".concat(r)},em.createElement("rect",{x:a?l:l-u/2,y:o?c:c-d/2,width:a?u:2*u,height:o?d:2*d}))}function zo(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.xAxisId)?n:0}function zs(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.yAxisId)?n:0}var zl=(e,t,n)=>PG(e,"xAxis",zo(e,t),n),zc=(e,t,n)=>PY(e,"xAxis",zo(e,t),n),zu=(e,t,n)=>PG(e,"yAxis",zs(e,t),n),zd=(e,t,n)=>PY(e,"yAxis",zs(e,t),n),zh=N1([_w,zl,zu,zc,zd],(e,t,n,r,i)=>CF(e,"xAxis")?CX(t,r,!1):CX(n,i,!1)),zf=N1([MN,(e,t)=>t],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),zp=e=>CF(_w(e),"xAxis")?"yAxis":"xAxis",zm=N1([zf,(e,t,n)=>MW(e,zp(e),"yAxis"===zp(e)?zs(e,t):zo(e,t),n)],(e,t)=>{if(null!=e&&null!=t){var n,{stackId:r}=e,i=Mt(e);if(null!=r&&null!=i){var a=null==(n=t[r])?void 0:n.stackedData,o=null==a?void 0:a.find(e=>e.key===i);if(null!=o)return o.map(e=>[e[0],e[1]])}}}),zg=N1([_w,zl,zu,zc,zd,zm,(e,t,n)=>n?Og(e):Om(e),zh,zf,e=>e.rootProps.baseValue],(e,t,n,r,i,a,o,s,l,c)=>{var u,{chartData:d,dataStartIndex:h,dataEndIndex:f}=o;if(null!=l&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=s){var{data:p}=l;if(null!=(u=p&&p.length>0?p:null==d?void 0:d.slice(h,f+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:i},stackedData:a,layout:o,chartBaseValue:s,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:h,yAxisTicks:f,bandSize:p}=e,g=a&&a.length,v=((e,t,n,r,i)=>{var a=null!=n?n:t;if(k0(a))return a;var o="horizontal"===e?i:r,s=o.scale.domain();if("number"===o.type){var l=Math.max(s[0],s[1]),c=Math.min(s[0],s[1]);return"dataMin"===a?c:"dataMax"===a||l<0?l:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===a?s[0]:"dataMax"===a?s[1]:s[0]})(o,s,r,l,c),x="horizontal"===o,y=!1,b=u.map((e,t)=>{if(g)s=a[d+t];else{var r,o,s,u=Cz(e,i);Array.isArray(u)?(s=u,y=!0):s=[v,u]}var b=null!=(r=null==(o=s)?void 0:o[1])?r:null,w=null==b||g&&!n&&null==Cz(e,i);return x?{x:CW({axis:l,ticks:h,bandSize:p,entry:e,index:t}),y:w?null:c.scale(b),value:s,payload:e}:{x:w?null:l.scale(b),y:CW({axis:c,ticks:f,bandSize:p,entry:e,index:t}),value:s,payload:e}});return t=g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return x?{x:e.x,y:null!=t&&null!=e.y?c.scale(t):null,payload:e.payload}:{x:null!=t?l.scale(t):null,y:e.y,payload:e.payload}}):x?c.scale(v):l.scale(v),{points:b,baseLine:t,isRange:y}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:h,areaSettings:l,stackedData:a,displayedData:u,chartBaseValue:c,bandSize:s})}});function zv(e){var{legendPayload:t}=e,n=Cw(),r=C7(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(LH(t)):i.current!==t&&n(LW({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(LY(i.current)),i.current=null)},[n]),null}function zx(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=(0,em.useRef)(k5(t)),r=(0,em.useRef)(e);return r.current!==e&&(n.current=k5(t),r.current=e),n.current}var zy=null!=(Y=em["useId".toString()])?Y:()=>{var[e]=em.useState(()=>k5("uid-"));return e},zb=(0,em.createContext)(void 0),zw=e=>{var t,n,{id:r,type:i,children:a}=e,o=(t="recharts-".concat(i),n=zy(),r||(t?"".concat(t,"-").concat(n):n));return em.createElement(zb.Provider,{value:o},a(o))},zj=(0,em.memo)(e=>{var t=Cw(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lj(e)):n.current!==e&&t(LN({prev:n.current,next:e})),n.current=e},[t,e]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lk(n.current)),n.current=null)},[t]),null});function zN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zN(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zE=(e,t,n)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(n)).join(","),zC=(e,t)=>Object.keys(t).reduce((n,r)=>zk(zk({},n),{},{[r]:e(r,t[r])}),{});function z_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z_(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zT=(e,t,n)=>e+(t-e)*n,zA=e=>{var{from:t,to:n}=e;return t!==n},zO=(e,t,n)=>{var r=zC((t,n)=>{if(zA(n)){var[r,i]=e(n.from,n.to,n.velocity);return zS(zS({},n),{},{from:r,velocity:i})}return n},t);return n<1?zC((e,t)=>zA(t)&&null!=r[e]?zS(zS({},t),{},{velocity:zT(t.velocity,r[e].velocity,n),from:zT(t.from,r[e].from,n)}):t,t):zO(e,r,n-1)},zM=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],zP=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),zD=(e,t)=>n=>zP(zM(e,t),n),zL=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(1===t.length)switch(t[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:var r=(e=>{var t,n=e.split("(");if(2!==n.length||"cubic-bezier"!==n[0])return null;var r=null==(t=n[1])||null==(t=t.split(")")[0])?void 0:t.split(",");if(null==r||4!==r.length)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]})(t[0]);if(r)return r}return 4===t.length?t:[0,0,1,1]},zI=function(){return((e,t,n,r)=>{var i=zD(e,n),a=zD(t,r),o=t=>zP([...zM(e,n).map((e,t)=>e*t).slice(1),0],t),s=e=>e>1?1:e<0?0:e,l=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var l=i(n)-t,c=o(n);if(1e-4>Math.abs(l-t)||c<1e-4)break;n=s(n-l/c)}return a(n)};return l.isStepper=!1,l})(...zL(...arguments))},zR=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:n=8,dt:r=17}=e,i=(e,i,a)=>{var o=a+(-(e-i)*t-a*n)*r/1e3,s=a*r/1e3+e;return 1e-4>Math.abs(s-i)&&1e-4>Math.abs(o)?[i,0]:[s,o]};return i.isStepper=!0,i.dt=r,i};class zB{setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):"function"==typeof requestAnimationFrame&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{null!=r&&cancelAnimationFrame(r)}}}var zz=(0,em.createContext)(function(){var e,t,n,r,i;return e=new zB,t=()=>null,n=!1,r=null,i=a=>{if(!n){if(Array.isArray(a)){if(!a.length)return;var[o,...s]=a;if("number"==typeof o){r=e.setTimeout(i.bind(null,s),o);return}i(o),r=e.setTimeout(i.bind(null,s));return}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{n=!0},start:e=>{n=!1,r&&(r(),r=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e}}),zF={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},zV={t:0},zU={t:1};function zH(e){var t,n,r,i=Rh(e,zF),{isActive:a,canBegin:o,duration:s,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,f="auto"===a?!Id.isSsr:a,p=(t=i.animationId,n=i.animationManager,r=(0,em.useContext)(zz),(0,em.useMemo)(()=>null!=n?n:r(t),[t,n,r])),[g,v]=(0,em.useState)(f?zV:zU),x=(0,em.useRef)(null);return(0,em.useEffect)(()=>{f||v(zU)},[f]),(0,em.useEffect)(()=>{if(!f||!o)return Ee;var e=((e,t,n,r,i,a)=>{var o,s,l,c,u,d,h,f,p=[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e)));return null==n?()=>(i(zS(zS({},e),t)),()=>{}):!0===n.isStepper?(s=p.reduce((n,r)=>zS(zS({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,c=r=>{o||(o=r);var u=(r-o)/n.dt;s=zO(n,s,u),i(zS(zS(zS({},e),t),zC((e,t)=>t.from,s))),o=r,Object.values(s).filter(zA).length&&(l=a.setTimeout(c))},()=>(l=a.setTimeout(c),()=>{var e;null==(e=l)||e()})):(d=null,h=p.reduce((n,r)=>{var i=e[r],a=t[r];return null==i||null==a?n:zS(zS({},n),{},{[r]:[i,a]})},{}),f=o=>{u||(u=o);var s=(o-u)/r,l=zC((e,t)=>zT(...t,n(s)),h);if(i(zS(zS(zS({},e),t),l)),s<1)d=a.setTimeout(f);else{var c=zC((e,t)=>zT(...t,n(1)),h);i(zS(zS(zS({},e),t),c))}},()=>(d=a.setTimeout(f),()=>{var e;null==(e=d)||e()}))})(zV,zU,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zI(e);case"spring":return zR();default:if("cubic-bezier"===e.split("(")[0])return zI(e)}return"function"==typeof e?e:null})(l),s,v,p.getTimeoutController());return p.start([d,c,()=>{x.current=e()},s,u]),()=>{p.stop(),x.current&&x.current(),u()}},[f,o,s,l,c,d,u,p]),h(g.t)}function zW(e){var t=II(e);if(null!=t){var{r:n,strokeWidth:r}=t,i=Number(n),a=Number(r);return(Number.isNaN(i)||i<0)&&(i=3),(Number.isNaN(a)||a<0)&&(a=2),{r:i,strokeWidth:a}}return{r:3,strokeWidth:2}}var zY=["id"],zG=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function zX(){return(zX=Object.assign.bind()).apply(null,arguments)}function z$(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function zq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zq(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zZ(e,t){return e&&"none"!==e?e:t}var zQ=Rx.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Cq(o,t),hide:s,type:c,color:zZ(r,a),unit:l,graphicalItemId:u}};return Rx.createElement(zr,{tooltipEntrySettings:d})});function zJ(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=IL(r);return Rx.createElement(B7,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function z0(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return zK(zK({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return Rx.createElement(BK,{value:t?i:void 0},n)}function z1(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:l,connectNulls:c,isRange:u}=a,{id:d}=a,h=z$(a,zY),f=IL(h),p=IR(h);return Rx.createElement(Rx.Fragment,null,(null==t?void 0:t.length)>1&&Rx.createElement(R6,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},Rx.createElement(R5,zX({},p,{id:d,points:t,connectNulls:c,type:s,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),"none"!==l&&Rx.createElement(R5,zX({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:t})),"none"!==l&&u&&Rx.createElement(R5,zX({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:n}))),Rx.createElement(zJ,{points:t,props:h,clipPathId:i}))}function z2(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.y,l=null==(n=a[a.length-1])?void 0:n.y;if(!CL(s)||!CL(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.x||0));return(k0(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.x||0),u)),k0(u))?Rx.createElement("rect",{x:0,y:s<l?s:s-c,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function z5(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.x,l=null==(n=a[a.length-1])?void 0:n.x;if(!CL(s)||!CL(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.y||0));return(k0(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.y||0),u)),k0(u))?Rx.createElement("rect",{x:s<l?s:s-c,y:0,width:c,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function z3(e){var{alpha:t,layout:n,points:r,baseLine:i,strokeWidth:a}=e;return"vertical"===n?Rx.createElement(z2,{alpha:t,points:r,baseLine:i,strokeWidth:a}):Rx.createElement(z5,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function z4(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=e,{points:o,baseLine:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,onAnimationStart:h,onAnimationEnd:f}=r,p=zx((0,Rx.useMemo)(()=>({points:o,baseLine:s}),[o,s]),"recharts-area-"),g=(()=>{var e=CE(_w);if("horizontal"===e||"vertical"===e)return e})(),[v,x]=(0,Rx.useState)(!1),y=(0,Rx.useCallback)(()=>{"function"==typeof f&&f(),x(!1)},[f]),b=(0,Rx.useCallback)(()=>{"function"==typeof h&&h(),x(!0)},[h]);if(null==g)return null;var w=i.current,j=a.current;return Rx.createElement(z0,{showLabels:!v,points:o},r.children,Rx.createElement(zH,{animationId:p,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:y,onAnimationStart:b,key:p},e=>{if(w){var c,u=w.length/o.length,d=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(w[r]){var i=w[r];return zK(zK({},t),{},{x:k6(i.x,t.x,e),y:k6(i.y,t.y,e)})}return t});if(k0(s))c=k6(j,s,e);else c=null==s||kQ(s)?k6(j,0,e):s.map((t,n)=>{var r=Math.floor(n*u);if(Array.isArray(j)&&j[r]){var i=j[r];return zK(zK({},t),{},{x:k6(i.x,t.x,e),y:k6(i.y,t.y,e)})}return t});return e>0&&(i.current=d,a.current=c),Rx.createElement(z1,{points:d,baseLine:c,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=s),Rx.createElement(R6,null,l&&Rx.createElement("defs",null,Rx.createElement("clipPath",{id:"animationClipPath-".concat(n)},Rx.createElement(z3,{alpha:e,points:o,baseLine:s,layout:g,strokeWidth:r.strokeWidth}))),Rx.createElement(R6,{clipPath:"url(#animationClipPath-".concat(n,")")},Rx.createElement(z1,{points:o,baseLine:s,needClip:t,clipPathId:n,props:r})))}),Rx.createElement(BJ,{label:r.label}))}function z6(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,Rx.useRef)(null),a=(0,Rx.useRef)();return Rx.createElement(z4,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class z8 extends Rx.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:l,width:c,height:u,id:d,baseLine:h,zIndex:f}=this.props;if(e)return null;var p=(0,_t.clsx)("recharts-area",r),{r:g,strokeWidth:v}=zW(t),x=B2(t),y=2*g+v,b=o?"url(#clipPath-".concat(x?"":"dots-").concat(d,")"):void 0;return Rx.createElement(BS,{zIndex:f},Rx.createElement(R6,{className:p},o&&Rx.createElement("defs",null,Rx.createElement(za,{clipPathId:d,xAxisId:s,yAxisId:l}),!x&&Rx.createElement("clipPath",{id:"clipPath-dots-".concat(d)},Rx.createElement("rect",{x:a-y/2,y:i-y/2,width:c+y,height:u+y}))),Rx.createElement(z6,{needClip:o,clipPathId:d,props:this.props})),Rx.createElement(zn,{points:n,mainColor:zZ(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}),this.props.isRange&&Array.isArray(h)&&Rx.createElement(zn,{points:h,mainColor:zZ(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}))}}var z7={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:OG.area};function z9(e){var t,n=Rh(e,z7),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,fill:c,fillOpacity:u,hide:d,isAnimationActive:h,legendType:f,stroke:p,xAxisId:g,yAxisId:v}=n,x=z$(n,zG),y=CE(_w),b=CE(OB),{needClip:w}=zi(g,v),j=C7(),{points:N,isRange:k,baseLine:E}=null!=(t=CE(t=>zg(t,e.id,j)))?t:{},C=CE(Ro);if("horizontal"!==y&&"vertical"!==y||null==C||"AreaChart"!==b&&"ComposedChart"!==b)return null;var{height:_,width:S,x:T,y:A}=C;return N&&N.length?Rx.createElement(z8,zX({},x,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:E,connectNulls:s,dot:l,fill:c,fillOpacity:u,height:_,hide:d,layout:y,isAnimationActive:"auto"===h?!Id.isSsr:h,isRange:k,legendType:f,needClip:w,points:N,stroke:p,width:S,left:T,top:A,xAxisId:g,yAxisId:v})):null}var Fe=Rx.memo(function(e){var t=Rh(e,z7),n=C7();return Rx.createElement(zw,{id:t.id,type:"area"},e=>{var r;return Rx.createElement(Rx.Fragment,null,Rx.createElement(zv,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:zZ(r,i),value:Cq(n,t),payload:e}]})(t)}),Rx.createElement(zQ,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Rx.createElement(zj,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:null==(r=t.stackId)?void 0:String(r),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),Rx.createElement(z9,zX({},t,{id:e})))})},IC);Fe.displayName="Area";class Ft{static create(e){return new Ft(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:t,position:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){if(n)switch(n){case"start":default:return this.scale(e);case"middle":var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(t){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a}return this.scale(e)}}isInRange(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}(h="symbol"==typeof(l=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(h="EPS","string"))?l:l+"")in Ft?Object.defineProperty(Ft,h,{value:1e-4,enumerable:!0,configurable:!0,writable:!0}):Ft[h]=1e-4;var Fn=function(e){var{width:t,height:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(r%180+180)%180*Math.PI/180,a=Math.atan(n/t);return Math.abs(i>a&&i<Math.PI-a?n/Math.sin(i):t/Math.cos(i))};function Fr(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];void 0!==i&&n.push(i)}return n}function Fi(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Fa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fa(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fs(e,t,n){var r,{tick:i,ticks:a,viewBox:o,minTickGap:s,orientation:l,interval:c,tickFormatter:u,unit:d,angle:h}=e;if(!a||!a.length||!i)return[];if(k0(c)||Id.isSsr)return null!=(r=Fr(a,(k0(c)?c:0)+1))?r:[];var f="top"===l||"bottom"===l?"width":"height",p=d&&"width"===f?Bi(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},g=(e,r)=>{var i,a="function"==typeof u?u(e.value,r):e.value;return"width"===f?(i=Bi(a,{fontSize:t,letterSpacing:n}),Fn({width:i.width+p.width,height:i.height+p.height},h)):Bi(a,{fontSize:t,letterSpacing:n})[f]},v=a.length>=2?kZ(a[1].coordinate-a[0].coordinate):1,x=function(e,t,n){var r="width"===n,{x:i,y:a,width:o,height:s}=e;return 1===t?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}(o,v,f);return"equidistantPreserveStart"===c?function(e,t,n,r,i){for(var a,o=(r||[]).slice(),{start:s,end:l}=t,c=0,u=1,d=s;u<=o.length;)if(a=function(){var t,a=null==r?void 0:r[c];if(void 0===a)return{v:Fr(r,u)};var o=c,h=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=0===c||Fi(e,f,h,d,l);p||(c=0,d=s,u+=1),p&&(d=f+e*(h()/2+i),c+=u)}())return a.v;return[]}(v,x,g,a,s):"equidistantPreserveEnd"===c?function(e,t,n,r,i){var a=(r||[]).slice().length;if(0===a)return[];for(var{start:o,end:s}=t,l=1;l<=a;l++){for(var c=(a-1)%l,u=o,d=!0,h=c;h<a&&!function(){var t,a=r[h],o=h,l=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=h===c||Fi(e,f,l,u,s);if(!p)return d=!1,1;p&&(u=f+e*(l()/2+i))}();h+=l);if(d){for(var f=[],p=c;p<a;p+=l)f.push(r[p]);return f}}return[]}(v,x,g,a,s):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:l,end:c}=t;if(a){var u=r[s-1],d=n(u,s-1),h=e*(u.coordinate+e*d/2-c);o[s-1]=u=Fo(Fo({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&Fi(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),o[s-1]=Fo(Fo({},u),{},{isShow:!0}))}for(var f=a?s-1:s,p=function(t){var r,a=o[t],s=()=>(void 0===r&&(r=n(a,t)),r);if(0===t){var u=e*(a.coordinate-e*s()/2-l);o[t]=a=Fo(Fo({},a),{},{tickCoord:u<0?a.coordinate-u*e:a.coordinate})}else o[t]=a=Fo(Fo({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&Fi(e,a.tickCoord,s,l,c)&&(l=a.tickCoord+e*(s()/2+i),o[t]=Fo(Fo({},a),{},{isShow:!0}))},g=0;g<f;g++)p(g);return o}(v,x,g,a,s,"preserveStartEnd"===c):function(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=t,{end:l}=t,c=function(t){var r,c=a[t],u=()=>(void 0===r&&(r=n(c,t)),r);if(t===o-1){var d=e*(c.coordinate+e*u()/2-l);a[t]=c=Fo(Fo({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else a[t]=c=Fo(Fo({},c),{},{tickCoord:c.coordinate});null!=c.tickCoord&&Fi(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+i),a[t]=Fo(Fo({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return a}(v,x,g,a,s)).filter(e=>e.isShow)}var Fl=["axisLine","width","height","className","hide","ticks","axisType"];function Fc(){return(Fc=Object.assign.bind()).apply(null,arguments)}function Fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fu(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fh={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:OG.axis};function Ff(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:l}=e;if(!s)return null;var c=Fd(Fd(Fd({},l),IL(s)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!o||"bottom"===a&&o);c=Fd(Fd({},c),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+("left"===a&&!o||"right"===a&&o);c=Fd(Fd({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return em.createElement("line",Fc({},c,{className:(0,_t.clsx)("recharts-cartesian-axis-line",(0,k$.default)(s,"className"))}))}function Fp(e){var t,{option:n,tickProps:r,value:i}=e,a=(0,_t.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(em.isValidElement(n))t=em.cloneElement(n,Fd(Fd({},r),{},{className:a}));else if("function"==typeof n)t=n(Fd(Fd({},r),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,_t.clsx)(o,null==n?void 0:n.className)),t=em.createElement(B_,Fc({},r,{className:o}),i)}return t}var Fm=(0,em.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:l,tickTextProps:c,orientation:u,mirror:d,x:h,y:f,width:p,height:g,tickSize:v,tickMargin:x,fontSize:y,letterSpacing:b,getTicksConfig:w,events:j,axisType:N}=e,k=Fs(Fd(Fd({},w),{},{ticks:n}),y,b),E=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(u,d),C=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),_=IL(w),S=II(r),T={};"object"==typeof i&&(T=i);var A=Fd(Fd({},_),{},{fill:"none"},T),O=k.map(e=>Fd({entry:e},function(e,t,n,r,i,a,o,s,l){var c,u,d,h,f,p,g=s?-1:1,v=e.tickSize||o,x=k0(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":c=u=e.coordinate,p=(d=(h=n+!s*i)-g*v)-g*l,f=x;break;case"left":d=h=e.coordinate,f=(c=(u=t+!s*r)-g*v)-g*l,p=x;break;case"right":d=h=e.coordinate,f=(c=(u=t+s*r)+g*v)+g*l,p=x;break;default:c=u=e.coordinate,p=(d=(h=n+s*i)+g*v)+g*l,f=x}return{line:{x1:c,y1:d,x2:u,y2:h},tick:{x:f,y:p}}}(e,h,f,p,g,u,v,d,x))),M=O.map(e=>{var{entry:t,line:n}=e;return em.createElement(R6,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&em.createElement("line",Fc({},A,n,{className:(0,_t.clsx)("recharts-cartesian-axis-tick-line",(0,k$.default)(i,"className"))})))}),P=O.map((e,t)=>{var{entry:n,tick:i}=e,u=Fd(Fd(Fd(Fd({textAnchor:E,verticalAnchor:C},_),{},{stroke:"none",fill:a},S),i),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:o,padding:l},c);return em.createElement(R6,Fc({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(n.value,"-").concat(n.coordinate,"-").concat(n.tickCoord)},((e,t,n)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];IO(i)&&"function"==typeof a&&(r||(r={}),r[i]=e=>(a(t,n,e),null))}),r})(j,n,t)),r&&em.createElement(Fp,{option:r,tickProps:u,value:"".concat("function"==typeof o?o(n.value,t):n.value).concat(s||"")}))});return em.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},P.length>0&&em.createElement(BS,{zIndex:OG.label},em.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},P)),M.length>0&&em.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},M))}),Fg=(0,em.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:l}=e,c=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Fl),[u,d]=(0,em.useState)(""),[h,f]=(0,em.useState)(""),p=(0,em.useRef)(null);(0,em.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0;return Math.round(o+(i+a)+s+(n?r:0))}return 0})({ticks:p.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=(0,em.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");p.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==u||a!==h)&&(d(i),f(a))}}},[u,h]);return o||null!=r&&r<=0||null!=i&&i<=0?null:em.createElement(BS,{zIndex:e.zIndex},em.createElement(R6,{className:(0,_t.clsx)("recharts-cartesian-axis",a)},em.createElement(Ff,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:IL(e)}),em.createElement(Fm,{ref:g,axisType:l,events:c,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),em.createElement(BI,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},em.createElement(BH,{label:e.label,labelRef:e.labelRef}),e.children)))}),Fv=em.forwardRef((e,t)=>{var n=Rh(e,Fh);return em.createElement(Fg,Fc({},n,{ref:t}))});Fv.displayName="CartesianAxis";var Fx=["domain","range"],Fy=["domain","range"];function Fb(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Fw(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function Fj(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=Fb(e,Fx),{domain:a,range:o}=t,s=Fb(t,Fy);return!!Fw(n,a)&&!!Fw(r,o)&&IC(i,s)}var FN=["dangerouslySetInnerHTML","ticks","scale"],Fk=["id","scale"];function FE(){return(FE=Object.assign.bind()).apply(null,arguments)}function FC(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function F_(e){var t=Cw(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lu(e)):n.current!==e&&t(Ld({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lh(n.current)),n.current=null)},[t]),null}var FS=e=>{var{xAxisId:t,className:n}=e,r=CE(C6),i=C7(),a="xAxis",o=CE(e=>PW(e,a,t,i)),s=CE(e=>PP(e,t)),l=CE(e=>PI(e,t)),c=CE(e=>Mh(e,t));if(null==s||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,f=FC(e,FN),{id:p,scale:g}=c,v=FC(c,Fk);return em.createElement(Fv,FE({},f,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:(0,_t.clsx)("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:o,axisType:a}))},FT={allowDataOverflow:Md.allowDataOverflow,allowDecimals:Md.allowDecimals,allowDuplicatedCategory:Md.allowDuplicatedCategory,angle:Md.angle,axisLine:Fh.axisLine,height:Md.height,hide:!1,includeHidden:Md.includeHidden,interval:Md.interval,minTickGap:Md.minTickGap,mirror:Md.mirror,orientation:Md.orientation,padding:Md.padding,reversed:Md.reversed,scale:Md.scale,tick:Md.tick,tickCount:Md.tickCount,tickLine:Fh.tickLine,tickSize:Fh.tickSize,type:Md.type,xAxisId:0},FA=em.memo(e=>{var t=Rh(e,FT);return em.createElement(em.Fragment,null,em.createElement(F_,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),em.createElement(FS,t))},Fj);FA.displayName="XAxis";var FO=["dangerouslySetInnerHTML","ticks","scale"],FM=["id","scale"];function FP(){return(FP=Object.assign.bind()).apply(null,arguments)}function FD(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FL(e){var t=Cw(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lf(e)):n.current!==e&&t(Lp({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lm(n.current)),n.current=null)},[t]),null}var FI=e=>{var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,em.useRef)(null),o=(0,em.useRef)(null),s=CE(C6),l=C7(),c=Cw(),u="yAxis",d=CE(e=>PB(e,t)),h=CE(e=>PR(e,t)),f=CE(e=>PW(e,u,t,l)),p=CE(e=>Mm(e,t));if((0,em.useLayoutEffect)(()=>{if(!("auto"!==r||!d||Bz(i)||(0,em.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&c(Ly({id:t,width:n}))}}},[f,d,c,i,t,r,p]),null==d||null==h||null==p)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:x}=e,y=FD(e,FO),{id:b,scale:w}=p,j=FD(p,FM);return em.createElement(Fv,FP({},y,j,{ref:a,labelRef:o,x:h.x,y:h.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:d.width,height:d.height,className:(0,_t.clsx)("recharts-".concat(u," ").concat(u),n),viewBox:s,ticks:f,axisType:u}))},FR={allowDataOverflow:Mp.allowDataOverflow,allowDecimals:Mp.allowDecimals,allowDuplicatedCategory:Mp.allowDuplicatedCategory,angle:Mp.angle,axisLine:Fh.axisLine,hide:!1,includeHidden:Mp.includeHidden,interval:Mp.interval,minTickGap:Mp.minTickGap,mirror:Mp.mirror,orientation:Mp.orientation,padding:Mp.padding,reversed:Mp.reversed,scale:Mp.scale,tick:Mp.tick,tickCount:Mp.tickCount,tickLine:Fh.tickLine,tickSize:Fh.tickSize,type:Mp.type,width:Mp.width,yAxisId:0},FB=em.memo(e=>{var t=Rh(e,FR);return em.createElement(em.Fragment,null,em.createElement(FL,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),em.createElement(FI,t))},Fj);function Fz(){return(Fz=Object.assign.bind()).apply(null,arguments)}function FF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FV(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FF(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FU(e){return Array.isArray(e)&&k1(e[0])&&k1(e[1])?e.join(" ~ "):e}FB.displayName="YAxis";var FH=e=>{var{separator:t=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:d,accessibilityLayer:h=!1}=e,f=FV({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=FV({margin:0},i),g=null!=u,v=g?u:"",x=(0,_t.clsx)("recharts-default-tooltip",l),y=(0,_t.clsx)("recharts-tooltip-label",c);return g&&d&&null!=a&&(v=d(u,a)),em.createElement("div",Fz({className:x,style:f},h?{role:"status","aria-live":"assertive"}:{}),em.createElement("p",{className:y,style:p},em.isValidElement(v)?v:"".concat(v)),(()=>{if(a&&a.length){var e=(s?(0,CC.default)(a,s):a).map((e,n)=>{if("none"===e.type)return null;var i=e.formatter||o||FU,{value:s,name:l}=e,c=s,u=l,d=i(s,l,e,n,a);if(Array.isArray(d))[c,u]=d;else{if(null==d)return null;c=d}var h=FV({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},r);return em.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},k1(u)?em.createElement("span",{className:"recharts-tooltip-item-name"},u):null,k1(u)?em.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,em.createElement("span",{className:"recharts-tooltip-item-value"},c),em.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return em.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},FW=em,FY="recharts-tooltip-wrapper",FG={visibility:"hidden"};function FX(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&k0(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var h=l[r];return null==h?0:o[r]?u<h?Math.max(d,h):Math.max(u,h):null==c?0:d+s>h+c?Math.max(u,h):Math.max(d,h)}function F$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F$(Object(n),!0).forEach(function(t){FK(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FK(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class FZ extends FW.PureComponent{constructor(){super(...arguments),FK(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),FK(this,"handleKeyDown",e=>{if("Escape"===e.key){var t,n,r,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!=(t=null==(n=this.props.coordinate)?void 0:n.x)?t:0,y:null!=(r=null==(i=this.props.coordinate)?void 0:i.y)?r:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null==(e=this.props.coordinate)?void 0:e.x)!==this.state.dismissedAtCoordinate.x||(null==(t=this.props.coordinate)?void 0:t.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:t,animationDuration:n,animationEasing:r,children:i,coordinate:a,hasPayload:o,isAnimationActive:s,offset:l,position:c,reverseDirection:u,useTranslate3d:d,viewBox:h,wrapperStyle:f,lastBoundingBox:p,innerRef:g,hasPortalFromProps:v}=this.props,{cssClasses:x,cssProperties:y}=function(e){var t,n,r,{allowEscapeViewBox:i,coordinate:a,offsetTopLeft:o,position:s,reverseDirection:l,tooltipBox:c,useTranslate3d:u,viewBox:d}=e;return{cssProperties:t=c.height>0&&c.width>0&&a?function(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:n=FX({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),translateY:r=FX({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),useTranslate3d:u}):FG,cssClasses:function(e){var{coordinate:t,translateX:n,translateY:r}=e;return(0,_t.clsx)(FY,{["".concat(FY,"-right")]:k0(n)&&t&&k0(t.x)&&n>=t.x,["".concat(FY,"-left")]:k0(n)&&t&&k0(t.x)&&n<t.x,["".concat(FY,"-bottom")]:k0(r)&&t&&k0(t.y)&&r>=t.y,["".concat(FY,"-top")]:k0(r)&&t&&k0(t.y)&&r<t.y})}({translateX:n,translateY:r,coordinate:a})}}({allowEscapeViewBox:t,coordinate:a,offsetTopLeft:l,position:c,reverseDirection:u,tooltipBox:{height:p.height,width:p.width},useTranslate3d:d,viewBox:h}),b=v?{}:Fq(Fq({transition:s&&e?"transform ".concat(n,"ms ").concat(r):void 0},y),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&o?"visible":"hidden",position:"absolute",top:0,left:0}),w=Fq(Fq({},b),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},f);return FW.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:w,ref:g},i)}}var FQ=e.i(92809),FJ=["x","y","top","left","width","height","className"];function F0(){return(F0=Object.assign.bind()).apply(null,arguments)}function F1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var F2=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F1(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({x:t,y:n,top:r,left:i,width:a,height:o},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,FJ));return k0(t)&&k0(n)&&k0(a)&&k0(o)&&k0(r)&&k0(i)?em.createElement("path",F0({},IR(l),{className:(0,_t.clsx)("recharts-cross",s),d:"M".concat(t,",").concat(r,"v").concat(o,"M").concat(i,",").concat(n,"h").concat(a)})):null},F5=["radius"],F3=["radius"];function F4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F6(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F4(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F4(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F8(){return(F8=Object.assign.bind()).apply(null,arguments)}function F7(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function F9(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Ve=(e,t,n,r,i)=>{var a,o=kq(n),s=kq(r),l=Math.min(Math.abs(o)/2,Math.abs(s)/2),c=s>=0?1:-1,u=o>=0?1:-1,d=+(s>=0&&o>=0||s<0&&o<0);if(l>0&&i instanceof Array){for(var h=[0,0,0,0],f=0;f<4;f++)h[f]=i[f]>l?l:i[f];a=kK(G||(G=F9(["M",",",""])),e,t+c*h[0]),h[0]>0&&(a+=kK(X||(X=F9(["A ",",",",0,0,",",",",",""])),h[0],h[0],d,e+u*h[0],t)),a+=kK($||($=F9(["L ",",",""])),e+n-u*h[1],t),h[1]>0&&(a+=kK(q||(q=F9(["A ",",",",0,0,",",\n ",",",""])),h[1],h[1],d,e+n,t+c*h[1])),a+=kK(K||(K=F9(["L ",",",""])),e+n,t+r-c*h[2]),h[2]>0&&(a+=kK(Z||(Z=F9(["A ",",",",0,0,",",\n ",",",""])),h[2],h[2],d,e+n-u*h[2],t+r)),a+=kK(Q||(Q=F9(["L ",",",""])),e+u*h[3],t+r),h[3]>0&&(a+=kK(J||(J=F9(["A ",",",",0,0,",",\n ",",",""])),h[3],h[3],d,e,t+r-c*h[3])),a+="Z"}else if(l>0&&i===+i&&i>0){var p=Math.min(l,i);a=kK(ee||(ee=F9(["M ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",","," Z"])),e,t+c*p,p,p,d,e+u*p,t,e+n-u*p,t,p,p,d,e+n,t+c*p,e+n,t+r-c*p,p,p,d,e+n-u*p,t+r,e+u*p,t+r,p,p,d,e,t+r-c*p)}else a=kK(et||(et=F9(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return a},Vt={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Vn=e=>{var t=Rh(e,Vt),n=(0,em.useRef)(null),[r,i]=(0,em.useState)(-1);(0,em.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch(e){}},[]);var{x:a,y:o,width:s,height:l,radius:c,className:u}=t,{animationEasing:d,animationDuration:h,animationBegin:f,isAnimationActive:p,isUpdateAnimationActive:g}=t,v=(0,em.useRef)(s),x=(0,em.useRef)(l),y=(0,em.useRef)(a),b=(0,em.useRef)(o),w=zx((0,em.useMemo)(()=>({x:a,y:o,width:s,height:l,radius:c}),[a,o,s,l,c]),"rectangle-");if(a!==+a||o!==+o||s!==+s||l!==+l||0===s||0===l)return null;var j=(0,_t.clsx)("recharts-rectangle",u);if(!g){var N=IR(t),{radius:k}=N,E=F7(N,F5);return em.createElement("path",F8({},E,{x:kq(a),y:kq(o),width:kq(s),height:kq(l),radius:"number"==typeof c?c:void 0,className:j,d:Ve(a,o,s,l,c)}))}var C=v.current,_=x.current,S=y.current,T=b.current,A="0px ".concat(-1===r?1:r,"px"),O="".concat(r,"px 0px"),M=zE(["strokeDasharray"],h,"string"==typeof d?d:Vt.animationEasing);return em.createElement(zH,{animationId:w,key:w,canBegin:r>0,duration:h,easing:d,isActive:g,begin:f},e=>{var r,i=k6(C,s,e),u=k6(_,l,e),d=k6(S,a,e),h=k6(T,o,e);n.current&&(v.current=i,x.current=u,y.current=d,b.current=h),r=p?e>0?{transition:M,strokeDasharray:O}:{strokeDasharray:A}:{strokeDasharray:O};var f=IR(t),{radius:g}=f,w=F7(f,F3);return em.createElement("path",F8({},w,{radius:"number"==typeof c?c:void 0,className:j,d:Ve(d,h,i,u,c),ref:n,style:F6(F6({},r),t.style)}))})};function Vr(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[OY(t,n,r,i),OY(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function Vi(){return(Vi=Object.assign.bind()).apply(null,arguments)}function Va(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Vo=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:l}=e,c=s*(o?1:-1)+r,u=Math.asin(s/c)/OW,d=l?i:i+a*u,h=OY(t,n,c,d);return{center:h,circleTangency:OY(t,n,r,d),lineTangency:OY(t,n,c*Math.cos(u*OW),l?i-a*u:i),theta:u}},Vs=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=kZ(o-a)*Math.min(Math.abs(o-a),359.999),l=a+s,c=OY(t,n,i,a),u=OY(t,n,i,l),d=kK(en||(en=Va(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,i,i,+(Math.abs(s)>180),+(a>l),u.x,u.y);if(r>0){var h=OY(t,n,r,a),f=OY(t,n,r,l);d+=kK(er||(er=Va(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),f.x,f.y,r,r,+(Math.abs(s)>180),+(a<=l),h.x,h.y)}else d+=kK(ei||(ei=Va(["L ",","," Z"])),t,n);return d},Vl={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Vc=e=>{var t,n=Rh(e,Vl),{cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:s,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:h}=n;if(o<a||u===d)return null;var f=(0,_t.clsx)("recharts-sector",h),p=o-a,g=k3(s,p,0,!0);return t=g>0&&360>Math.abs(u-d)?(e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:l,endAngle:c}=e,u=kZ(c-l),{circleTangency:d,lineTangency:h,theta:f}=Vo({cx:t,cy:n,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:p,lineTangency:g,theta:v}=Vo({cx:t,cy:n,radius:i,angle:c,sign:-u,cornerRadius:a,cornerIsExternal:s}),x=s?Math.abs(l-c):Math.abs(l-c)-f-v;if(x<0)return o?kK(ea||(ea=Va(["M ",",","\n a",",",",0,0,1,",",0\n a",",",",0,0,1,",",0\n "])),h.x,h.y,a,a,2*a,a,a,-(2*a)):Vs({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var y=kK(eo||(eo=Va(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),h.x,h.y,a,a,+(u<0),d.x,d.y,i,i,+(x>180),+(u<0),p.x,p.y,a,a,+(u<0),g.x,g.y);if(r>0){var{circleTangency:b,lineTangency:w,theta:j}=Vo({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:N,lineTangency:k,theta:E}=Vo({cx:t,cy:n,radius:r,angle:c,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),C=s?Math.abs(l-c):Math.abs(l-c)-j-E;if(C<0&&0===a)return"".concat(y,"L").concat(t,",").concat(n,"Z");y+=kK(es||(es=Va(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),k.x,k.y,a,a,+(u<0),N.x,N.y,r,r,+(C>180),+(u>0),b.x,b.y,a,a,+(u<0),w.x,w.y)}else y+=kK(el||(el=Va(["L",",","Z"])),t,n);return y})({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):Vs({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),em.createElement("path",Vi({},IR(n),{className:f,d:t}))};function Vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vu(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vh(){return(Vh=Object.assign.bind()).apply(null,arguments)}function Vf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vf(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vm(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,em.isValidElement)(t)?(0,em.cloneElement)(t,r):(0,em.createElement)(n,r)}function Vg(e){var t,n,r,i,a,{coordinate:o,payload:s,index:l,offset:c,tooltipAxisBandSize:u,layout:d,cursor:h,tooltipEventType:f,chartName:p}=e;if(!h||!o||"ScatterChart"!==p&&"axis"!==f)return null;if("ScatterChart"===p)r=o,i=F2,a=OG.cursorLine;else if("BarChart"===p)t=u/2,r={stroke:"none",fill:"#ccc",x:"horizontal"===d?o.x-t:c.left+.5,y:"horizontal"===d?c.top+.5:o.y-t,width:"horizontal"===d?u:c.width-1,height:"horizontal"===d?c.height-1:u},i=Vn,a=OG.cursorRectangle;else if("radial"===d&&RX(o)){var{cx:g,cy:v,radius:x,startAngle:y,endAngle:b}=Vr(o);r={cx:g,cy:v,startAngle:y,endAngle:b,innerRadius:x,outerRadius:x},i=Vc,a=OG.cursorLine}else r={points:function(e,t,n){if("horizontal"===e)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if("vertical"===e)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(RX(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,l=OY(r,i,a,s),c=OY(r,i,o,s);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return Vr(t)}}(d,o,c)},i=R5,a=OG.cursorLine;var w="object"==typeof h&&"className"in h?h.className:void 0,j=Vp(Vp(Vp(Vp({stroke:"#ccc",pointerEvents:"none"},c),r),II(h)),{},{payload:s,payloadIndex:l,className:(0,_t.clsx)("recharts-tooltip-cursor",w)});return em.createElement(BS,{zIndex:null!=(n=e.zIndex)?n:a},em.createElement(Vm,{cursor:h,cursorComp:i,cursorProps:j}))}function Vv(e){var t,n,r,i=(t=CE(MF),n=CE(DD),r=CE(DO),t&&r?CX(Vd(Vd({},t),{},{scale:r}),n):CX(void 0,n)),a=_b(),o=CE(_w),s=CE(OB);return null==i||null==a||null==o||null==s?null:em.createElement(Vg,Vh({},e,{offset:a,layout:o,tooltipAxisBandSize:i,chartName:s}))}function Vx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vy(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vx(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vx(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vb(e){return e.dataKey}var Vw=[],Vj={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function VN(e){var t,n,r,i,a,o,s,l,c,u,d,h=Rh(e,Vj),{active:f,allowEscapeViewBox:p,animationDuration:g,animationEasing:v,content:x,filterNull:y,isAnimationActive:b,offset:w,payloadUniqBy:j,position:N,reverseDirection:k,useTranslate3d:E,wrapperStyle:C,cursor:_,shared:S,trigger:T,defaultIndex:A,portal:O,axisId:M}=h,P=Cw(),D="number"==typeof A?String(A):A;(0,em.useEffect)(()=>{P(E8({shared:S,trigger:T,axisId:M,active:f,defaultIndex:D}))},[P,S,T,M,f,D]);var L=_x(),I=IT(),R=CE(e=>PQ(e,S)),{activeIndex:B,isActive:z}=null!=(u=CE(e=>D7(e,R,T,D)))?u:{},F=CE(e=>D8(e,R,T,D)),V=CE(e=>D6(e,R,T,D)),U=CE(e=>D4(e,R,T,D)),H=(0,em.useContext)(I3),W=null!=(d=null!=f?f:z)&&d,[Y,G]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,n]=(0,em.useState)({height:0,left:0,top:0,width:0}),r=(0,em.useCallback)(e=>{if(null!=e){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}([F,W]),X="axis"===R?V:void 0;t=CE(e=>((e,t,n)=>{if(null!=t){var r=P8(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(e,R,T)),n=CE(OV),r=CE(Oz),i=CE(OF),o=null==(a=CE(I0))?void 0:a.active,s=_x(),(0,em.useEffect)(()=>{if(!o&&null!=r&&null!=n){var e=Ci({active:W,coordinate:U,dataKey:t,index:B,label:"number"==typeof X?String(X):X,sourceViewBox:s,graphicalItemId:void 0});IZ.emit(IQ,r,e,n)}},[o,U,t,B,X,n,r,i,W,s]);var $=null!=O?O:H;if(null==$||null==L||null==R)return null;var q=null!=F?F:Vw;W||(q=Vw),y&&q.length&&(l=q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),q=!0===j?(0,FQ.default)(l,Vb):"function"==typeof j?(0,FQ.default)(l,j):l);var K=q.length>0,Z=em.createElement(FZ,{allowEscapeViewBox:p,animationDuration:g,animationEasing:v,isAnimationActive:b,active:W,coordinate:U,hasPayload:K,offset:w,position:N,reverseDirection:k,useTranslate3d:E,viewBox:L,wrapperStyle:C,lastBoundingBox:Y,innerRef:G,hasPortalFromProps:!!O},(c=Vy(Vy({},h),{},{payload:q,label:X,active:W,activeIndex:B,coordinate:U,accessibilityLayer:I}),em.isValidElement(x)?em.cloneElement(x,c):"function"==typeof x?em.createElement(x,c):em.createElement(FH,c)));return em.createElement(em.Fragment,null,(0,e1.createPortal)(Z,$),W&&em.createElement(Vv,{cursor:_,tooltipEventType:R,coordinate:U,payload:q,index:B}))}var Vk=["x1","y1","x2","y2","key"],VE=["offset"],VC=["xAxisId","yAxisId"],V_=["xAxisId","yAxisId"];function VS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VT(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VS(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VS(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VA(){return(VA=Object.assign.bind()).apply(null,arguments)}function VO(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var VM=e=>{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return em.createElement("rect",{x:r,y:i,ry:s,width:a,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function VP(e){var{option:t,lineItemProps:n}=e;if(em.isValidElement(t))r=em.cloneElement(t,n);else if("function"==typeof t)r=t(n);else{var r,i,{x1:a,y1:o,x2:s,y2:l,key:c}=n,u=null!=(i=IL(VO(n,Vk)))?i:{},{offset:d}=u,h=VO(u,VE);r=em.createElement("line",VA({},h,{x1:a,y1:o,x2:s,y2:l,fill:"none",key:c}))}return r}function VD(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VO(e,VC),l=i.map((e,i)=>{var a=VT(VT({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(i),index:i});return em.createElement(VP,{key:"line-".concat(i),option:r,lineItemProps:a})});return em.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function VL(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VO(e,V_),l=i.map((e,i)=>{var a=VT(VT({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(i),index:i});return em.createElement(VP,{option:r,lineItemProps:a,key:"line-".concat(i)})});return em.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function VI(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:l=!0}=e;if(!l||!t||!t.length||null==s)return null;var c=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,s)=>{var l=c[s+1]?c[s+1]-e:i+o-e;if(l<=0)return null;var u=s%t.length;return em.createElement("rect",{key:"react-".concat(s),y:e,x:r,height:l,width:a,stroke:"none",fill:t[u],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function VR(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:l}=e;if(!t||!n||!n.length)return null;var c=l.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,t)=>{var l=c[t+1]?c[t+1]-e:i+o-e;if(l<=0)return null;var u=t%n.length;return em.createElement("rect",{key:"react-".concat(t),x:e,y:a,width:l,height:s,stroke:"none",fill:n[u],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var VB=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return CV(Fs(VT(VT(VT({},Fh),n),{},{ticks:CU(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},Vz=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return CV(Fs(VT(VT(VT({},Fh),n),{},{ticks:CU(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},VF={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:OG.grid};function VV(e){var t=CE(CK),n=CE(CZ),r=_b(),i=VT(VT({},Rh(e,VF)),{},{x:k0(e.x)?e.x:r.left,y:k0(e.y)?e.y:r.top,width:k0(e.width)?e.width:r.width,height:k0(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:l,width:c,height:u,syncWithTicks:d,horizontalValues:h,verticalValues:f}=i,p=C7(),g=CE(e=>PH(e,"xAxis",a,p)),v=CE(e=>PH(e,"yAxis",o,p));if(!CI(c)||!CI(u)||!k0(s)||!k0(l))return null;var x=i.verticalCoordinatesGenerator||VB,y=i.horizontalCoordinatesGenerator||Vz,{horizontalPoints:b,verticalPoints:w}=i;if((!b||!b.length)&&"function"==typeof y){var j=h&&h.length,N=y({yAxis:v?VT(VT({},v),{},{ticks:j?h:v.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!j||d);_r(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(b=N)}if((!w||!w.length)&&"function"==typeof x){var k=f&&f.length,E=x({xAxis:g?VT(VT({},g),{},{ticks:k?f:g.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!k||d);_r(Array.isArray(E),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(w=E)}return em.createElement(BS,{zIndex:i.zIndex},em.createElement("g",{className:"recharts-cartesian-grid"},em.createElement(VM,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),em.createElement(VI,VA({},i,{horizontalPoints:b})),em.createElement(VR,VA({},i,{verticalPoints:w})),em.createElement(VD,VA({},i,{offset:r,horizontalPoints:b,xAxis:g,yAxis:v})),em.createElement(VL,VA({},i,{offset:r,verticalPoints:w,xAxis:g,yAxis:v}))))}VV.displayName="CartesianGrid";let VU=["1h","12h","1d","7d","30d","90d"],VH="#8b5cf6",VW="#ec4899",VY="#6366f1",VG="#0074d9",VX="var(--chart-5)",V$="var(--muted-foreground)",Vq={world:{label:"World",color:VH},experience:{label:"Experience",color:VW},observation:{label:"Observations",color:VY}};function VK(e){if(e<1e3)return e.toString();if(e<1e6){let t=e/1e3;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}k`}if(e<1e9){let t=e/1e6;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}M`}let t=e/1e9;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}B`}function VZ({value:e,className:t}){return(0,ep.jsx)("span",{className:t,title:e.toLocaleString(),children:VK(e)})}function VQ({active:e,payload:t,label:n,valueLabel:r}){return e&&t&&0!==t.length?(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 bg-popover/95 backdrop-blur-sm px-3 py-2 shadow-md",children:[null!=n&&(0,ep.jsx)("div",{className:"text-[11px] font-medium text-foreground mb-1.5",children:n}),(0,ep.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color||e.payload?.fill}}),(0,ep.jsx)("span",{className:"text-muted-foreground",children:e.name||r||"Value"}),(0,ep.jsx)("span",{className:"ml-auto pl-3 font-semibold tabular-nums text-foreground",children:(e.value??0).toLocaleString()})]},t))})]}):null}function VJ({children:e}){return(0,ep.jsx)("h3",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em] mb-3",children:e})}function V0(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let n=Math.floor(t/60);if(n<24)return`${n}h ago`;let r=Math.floor(n/24);return`${r}d ago`}function V1({done:e,total:t,doneColor:n}){let r=Math.round(100*(t>0?e/t:0));return(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"tabular-nums font-semibold text-foreground text-sm",children:e.toLocaleString()}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:[" / ",t.toLocaleString()]})]}),(0,ep.jsxs)("span",{className:"text-xs font-semibold tabular-nums text-foreground",children:[r,"%"]})]}),(0,ep.jsx)("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r}%`,backgroundColor:n}})})]})}function V2({title:e,items:t,emptyLabel:n}){let r=t.reduce((e,t)=>e+t.value,0);return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:e}),(0,ep.jsx)(VZ,{value:r,className:"text-xs text-muted-foreground tabular-nums"})]}),0===r?(0,ep.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:n}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:t.filter(e=>e.value>0).map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/r*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ep.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:t.map(e=>(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ep.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ep.jsx)(VZ,{value:e.value,className:"text-base font-semibold tabular-nums"}),(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:r>0?`${(e.value/r*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function V5({icon:e,label:t,value:n}){return(0,ep.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,ep.jsx)("div",{className:"p-2 rounded-md bg-muted",children:(0,ep.jsx)(e,{className:"w-4 h-4 text-muted-foreground"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:t}),(0,ep.jsx)(VZ,{value:n,className:"text-2xl font-semibold text-foreground leading-tight tabular-nums block"})]})]})}let V3=["completed","in_progress","pending","failed","cancelled"],V4={completed:VX,in_progress:VG,pending:"var(--chart-4)",failed:"var(--destructive)",cancelled:V$},V6={completed:"Completed",in_progress:"In progress",pending:"Pending",failed:"Failed",cancelled:"Cancelled"};function V8({byStatus:e}){let t=V3.map(t=>({status:t,label:V6[t],value:e[t]||0,color:V4[t]}));for(let[n,r]of Object.entries(e))V3.includes(n)||t.push({status:n,label:n,value:r,color:V$});let n=t.reduce((e,t)=>e+t.value,0),r=t.filter(e=>e.value>0);return(0,ep.jsxs)(px,{children:[(0,ep.jsxs)(py,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,ep.jsxs)(pb,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(jB,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Operations"]}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(VZ,{value:n})," total"]})]}),(0,ep.jsx)(pj,{children:0===n?(0,ep.jsx)("div",{className:"h-[100px] flex items-center justify-center text-sm text-muted-foreground",children:"No operations yet"}):(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:r.map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/n*100}%`,backgroundColor:e.color},title:`${e.label}: ${e.value.toLocaleString()}`},e.status))}),(0,ep.jsx)("div",{className:"space-y-1.5",children:r.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] flex-shrink-0",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-muted-foreground flex-1",children:e.label}),(0,ep.jsx)(VZ,{value:e.value,className:"font-semibold tabular-nums text-foreground"}),(0,ep.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums w-9 text-right",children:[(e.value/n*100).toFixed(0),"%"]})]},e.status))})]})})]})}function V7({done:e,pending:t,failed:n,total:r,lastConsolidatedAt:i}){let[a,o]=(0,em.useState)(!1),s=n>0;return(0,ep.jsxs)(px,{children:[(0,ep.jsx)(py,{className:"pb-2",children:(0,ep.jsx)(pb,{className:"text-sm font-semibold",children:"Consolidation"})}),(0,ep.jsxs)(pj,{className:"space-y-4",children:[(0,ep.jsx)(V1,{done:e,total:r,doneColor:VX}),(0,ep.jsxs)("div",{className:"grid grid-cols-4 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jz.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Done"})]}),(0,ep.jsx)(VZ,{value:e,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(ju,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Pending"})]}),(0,ep.jsx)(VZ,{value:t,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("button",{type:"button",onClick:()=>s&&o(!0),disabled:!s,className:`text-left space-y-0.5 rounded-md -mx-1 px-1 py-0.5 transition-colors ${s?"cursor-pointer hover:bg-red-500/10 focus:outline-none focus:ring-2 focus:ring-red-500/40":"cursor-default"}`,title:s?"View failed memories":void 0,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jF,{className:`w-3 h-3 ${s?"text-red-600 dark:text-red-400":"text-muted-foreground/50"}`}),(0,ep.jsx)("span",{className:`text-[10px] uppercase tracking-wider font-medium ${s?"text-red-600 dark:text-red-400":"text-muted-foreground"}`,children:"Failed"})]}),(0,ep.jsxs)("span",{className:`text-base font-semibold tabular-nums block ${s?"text-red-600 dark:text-red-400":"text-foreground"}`,children:[(0,ep.jsx)(VZ,{value:n}),s&&(0,ep.jsx)(jV,{className:"inline w-3 h-3 ml-1 opacity-70"})]})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eW,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Last"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold text-foreground block leading-tight",children:V0(i)})]})]})]}),(0,ep.jsx)(V9,{open:a,onOpenChange:o})]})}function V9({open:e,onOpenChange:t}){let{currentBank:n}=(0,ey.useBank)(),[r,i]=(0,em.useState)([]),[a,o]=(0,em.useState)(0),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(0);(0,em.useEffect)(()=>{if(!e||!n)return;let t=!1;return l(!0),eD.client.listMemories(n,{consolidationState:"failed",limit:200}).then(e=>{t||(i(e.items),o(e.total))}).catch(()=>{}).finally(()=>{t||l(!1)}),()=>{t=!0}},[e,n,d]);let f=async()=>{if(n){u(!0);try{let e=await eD.client.recoverConsolidation(n);e.retried_count>0&&await eD.client.triggerConsolidation(n),ev.toast.success(`Queued ${e.retried_count} memor${1===e.retried_count?"y":"ies"} for re-consolidation`),h(e=>e+1)}catch{}finally{u(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:e,onOpenChange:t,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsxs)(tH.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(jF,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),"Failed consolidations"]}),(0,ep.jsx)(tH.DialogDescription,{children:"Source memories whose consolidation permanently failed. Recovery resets them so they are retried on the next consolidation run."})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:s?"Loading…":`${a} failed`}),(0,ep.jsxs)(eL.Button,{size:"sm",onClick:f,disabled:c||s||0===a,children:[(0,ep.jsx)(eU,{className:`w-3.5 h-3.5 mr-1.5 ${c?"animate-spin":""}`}),"Recover all"]})]}),(0,ep.jsx)("div",{className:"flex-1 min-h-0 overflow-auto border border-border rounded-md",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[140px]",children:"Failed at"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Type"}),(0,ep.jsx)(eJ,{children:"Text"})]})}),(0,ep.jsxs)(eZ,{children:[0===r.length&&!s&&(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:3,className:"text-center text-muted-foreground py-8",children:"No failed consolidations."})}),r.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"text-xs text-muted-foreground whitespace-nowrap",children:V0(e.consolidation_failed_at)}),(0,ep.jsx)(e0,{className:"text-xs capitalize",children:e.fact_type}),(0,ep.jsxs)(e0,{className:"text-sm",children:[(0,ep.jsx)("div",{className:"line-clamp-2",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e.context})]})]},e.id))]})]})})]})})}function Ue({models:e,lastConsolidatedAt:t}){let n=e.length,r=t?new Date(t).getTime():0,i=e.filter(e=>!r||!!e.last_refreshed_at&&new Date(e.last_refreshed_at).getTime()>=r).length,a=n-i;return(0,ep.jsxs)(px,{children:[(0,ep.jsx)(py,{className:"pb-2",children:(0,ep.jsxs)(pb,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(pk,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Mental Models"]})}),(0,ep.jsx)(pj,{className:"space-y-4",children:0===n?(0,ep.jsx)("div",{className:"text-sm text-muted-foreground py-4",children:"No mental models"}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(V1,{done:i,total:n,doneColor:VX}),(0,ep.jsxs)("div",{className:"grid grid-cols-3 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jz.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Up to date"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:i})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(ju,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Stale"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:a})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(pk,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Total"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:n})]})]})]})})]})}let Ut={fontSize:11,fill:V$,fontWeight:500};function Un(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,ew.useFeatures)(),n=t?.observations??!1,[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("7d"),[d,h]=(0,em.useState)({trunc:"day",buckets:[]}),[f,p]=(0,em.useState)({world:!0,experience:!0,observation:!0}),g=async()=>{if(e){l(!0);try{let[t,n]=await Promise.all([eD.client.getBankStats(e),eD.client.listMentalModels(e)]);i(t),o(n.items||[])}catch(e){console.error("Error loading bank stats:",e)}finally{l(!1)}}},v=async()=>{if(e)try{let t=await eD.client.getMemoriesTimeseries(e,c);h({trunc:t.trunc,buckets:t.buckets||[]})}catch(e){console.error("Error loading memories timeseries:",e)}};if((0,em.useEffect)(()=>{if(e){g();let e=setInterval(g,5e3);return()=>clearInterval(e)}},[e]),(0,em.useEffect)(()=>{if(e){v();let e=setInterval(v,5e3);return()=>clearInterval(e)}},[e,c]),s&&!r)return(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(eW,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})});if(!r)return null;let x=n?["world","experience","observation"]:["world","experience"],y=d.buckets.map(e=>{var t,n,r,i;let a,o;return{...e,label:(t=e.time,n=d.trunc,a=new Date(t),"day"===n?a.toLocaleDateString(void 0,{month:"short",day:"numeric"}):a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})),tooltipLabel:(r=e.time,i=d.trunc,o=new Date(r),"day"===i?o.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):o.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}}),b=y.reduce((e,t)=>e+x.reduce((e,n)=>e+(f[n]&&t[n]||0),0),0),w=Math.max(0,r.total_nodes-r.pending_consolidation);return(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)("section",{children:[(0,ep.jsx)(VJ,{children:"Memory store"}),(0,ep.jsx)(px,{children:(0,ep.jsxs)(pj,{className:"p-0",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 md:divide-x divide-y md:divide-y-0 divide-border/60",children:[(0,ep.jsx)(V5,{icon:eE,label:"Memories",value:r.total_nodes}),(0,ep.jsx)(V5,{icon:jR,label:"Documents",value:r.total_documents}),(0,ep.jsx)(V5,{icon:jI,label:"Links",value:r.total_links})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 md:divide-x divide-y md:divide-y-0 divide-border/60 border-t border-border/60",children:[(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(V2,{title:"Memory composition",items:[{name:"World",value:r.nodes_by_fact_type?.world||0,color:VH},{name:"Experience",value:r.nodes_by_fact_type?.experience||0,color:VW},...n?[{name:"Observations",value:r.total_observations||0,color:VY}]:[]],emptyLabel:"No memories yet"})}),(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(V2,{title:"Link types",items:[{name:"Temporal",value:r.links_by_link_type?.temporal||0,color:"#009296"},{name:"Semantic",value:r.links_by_link_type?.semantic||0,color:VG},{name:"Entity",value:r.links_by_link_type?.entity||0,color:"#f59e0b"}],emptyLabel:"No links yet"})})]})]})})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(VJ,{children:"Consolidation"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsx)(V7,{done:w,pending:r.pending_consolidation,failed:r.failed_consolidation??0,total:r.total_nodes,lastConsolidatedAt:r.last_consolidated_at}),(0,ep.jsx)(Ue,{models:a,lastConsolidatedAt:r.last_consolidated_at})]})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(VJ,{children:"Activity"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ep.jsxs)(px,{className:"lg:col-span-2",children:[(0,ep.jsxs)(py,{className:"pb-2 space-y-2",children:[(0,ep.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,ep.jsx)(pb,{className:"text-sm font-semibold",children:"Memories ingested"}),(0,ep.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:VU.map(e=>(0,ep.jsx)("button",{onClick:()=>u(e),className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors tabular-nums ${c===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("div",{className:"flex items-center gap-1.5",children:x.map(e=>{let t=Vq[e],n=f[e];return(0,ep.jsxs)("button",{onClick:()=>p(t=>({...t,[e]:!t[e]})),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] font-medium transition-all ${n?"bg-muted text-foreground":"bg-transparent text-muted-foreground/60 hover:text-muted-foreground"}`,children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] transition-opacity",style:{backgroundColor:t.color,opacity:n?1:.3}}),t.label]},e)})}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(VZ,{value:b})," total"]})]})]}),(0,ep.jsx)(pj,{children:0===y.length||0===b?(0,ep.jsx)("div",{className:"h-[180px] flex items-center justify-center text-sm text-muted-foreground",children:"No memories ingested in this period"}):(0,ep.jsx)("div",{className:"h-[180px]",children:(0,ep.jsx)(_g,{width:"100%",height:"100%",children:(0,ep.jsxs)(Rv,{data:y,margin:{top:8,right:8,bottom:0,left:-10},children:[(0,ep.jsx)("defs",{children:x.map(e=>(0,ep.jsxs)("linearGradient",{id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ep.jsx)("stop",{offset:"0%",stopColor:Vq[e].color,stopOpacity:.35}),(0,ep.jsx)("stop",{offset:"100%",stopColor:Vq[e].color,stopOpacity:0})]},e))}),(0,ep.jsx)(VV,{vertical:!1,stroke:"var(--border)",strokeOpacity:.5,strokeDasharray:"2 4"}),(0,ep.jsx)(FA,{dataKey:"label",tick:Ut,axisLine:!1,tickLine:!1,dy:4,minTickGap:20}),(0,ep.jsx)(FB,{tick:Ut,axisLine:!1,tickLine:!1,width:40,allowDecimals:!1,tickFormatter:e=>VK(e)}),(0,ep.jsx)(VN,{content:(0,ep.jsx)(VQ,{}),labelFormatter:(e,t)=>t?.[0]?.payload?.tooltipLabel||"",cursor:{stroke:V$,strokeWidth:1,strokeDasharray:"3 3"}}),x.map(e=>f[e]?(0,ep.jsx)(Fe,{type:"monotone",dataKey:e,name:Vq[e].label,stackId:"a",stroke:Vq[e].color,strokeWidth:2,fill:`url(#grad-${e})`,isAnimationActive:!1},e):null)]})})})})]}),(0,ep.jsx)(V8,{byStatus:r.operations_by_status||{}})]})]})]})}var tV=tV;let Ur=(0,eN.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Ui=(0,eN.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Ua=[{value:"all",label:"All types"},{value:"retain",label:"Retain"},{value:"consolidation",label:"Consolidation"},{value:"refresh_mental_model",label:"Mental Model Refresh"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}];function Uo(){let e,t,n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)([]),[o,s]=(0,em.useState)(0),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)(null),[h]=(0,em.useState)(10),[f,p]=(0,em.useState)(0),[g,v]=(0,em.useState)(null),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(null),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(null),M=(0,em.useCallback)(async(e=l,t=f,n=u)=>{if(r){w(!0);try{let i=await eD.client.listOperations(r,{status:e||void 0,type:n||void 0,limit:h,offset:t});a(i.operations||[]),s(i.total||0)}catch(e){console.error("Error loading operations:",e)}finally{w(!1)}}},[r,l,f,u,h]),P=e=>{p(e),M(l,e,u)},D=async e=>{if(r){v(e);try{await eD.client.cancelOperation(r,e),await M()}catch(e){}finally{v(null)}}},L=async e=>{if(r){y(e);try{await eD.client.retryOperation(r,e),await M()}catch(e){}finally{y(null)}}},I=async e=>{if(r){_(!0),E(!0),O(null);try{let t=await eD.client.getOperationStatus(r,e);N(t)}catch(e){console.error("Error loading operation details:",e),N({error:"Failed to load operation details"})}finally{_(!1)}}},R=async()=>{if(r&&j?.operation_id){T(!0);try{let e=j.operation_id,t=await eD.client.getOperationStatus(r,e,{includePayload:!0});N(t),O(e)}catch(e){console.error("Error loading raw payload:",e)}finally{T(!1)}}};return((0,em.useEffect)(()=>{if(r){M(l,f,u);let e=setInterval(()=>M(l,f,u),5e3);return()=>clearInterval(e)}},[r,l,f,u]),r)?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Background Operations"}),(0,ep.jsx)("button",{onClick:()=>M(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh operations",disabled:b,children:(0,ep.jsx)(eU,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${b?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[o," operation",1!==o?"s":"",l?` (${l})`:""]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(tR.Select,{value:u??"all",onValueChange:e=>{var t;d(t="all"===e?null:e),p(0),M(l,0,t)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All types"})}),(0,ep.jsx)(tR.SelectContent,{children:Ua.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{children:e.label}),"all"!==e.value&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground font-mono",children:e.value})]})},e.value))})]}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:[{value:null,label:"All"},{value:"pending",label:"Pending"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}].map(e=>(0,ep.jsx)("button",{onClick:()=>{var t;c(t=e.value),p(0),M(t,0,u)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${l===e.value?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e.label},e.value??"all"))})]})]}),(0,ep.jsx)("div",{children:i.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eJ,{children:"Type"}),(0,ep.jsx)(eJ,{children:"Created"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{className:"w-[80px]"})]})}),(0,ep.jsx)(eZ,{children:i.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${"failed"===e.status?"bg-red-500/5":""}`,onClick:()=>I(e.id),children:[(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,ep.jsx)(e0,{className:"font-medium",children:e.task_type}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"pending"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",title:e.error_message??void 0,children:[(0,ep.jsx)(ju,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"completed"]})]}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:t=>{t.stopPropagation(),D(e.id)},disabled:g===e.id,children:[g===e.id?(0,ep.jsx)(tV.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(e$.X,{className:"w-3 h-3 mr-1"}),g===e.id?"":"Cancel"]}),"failed"===e.status&&(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-blue-600 dark:hover:text-blue-400",onClick:t=>{t.stopPropagation(),L(e.id)},disabled:x===e.id,children:[x===e.id?(0,ep.jsx)(tV.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(Ur,{className:"w-3 h-3 mr-1"}),x===e.id?"":"Retry"]})]})]},e.id))})]})}),o>h&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Showing ",f+1,"-",Math.min(f+h,o)," of"," ",o]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>P(Math.max(0,f-h)),disabled:0===f,children:"Previous"}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>P(f+h),disabled:f+h>=o,children:"Next"})]})]})]}):(0,ep.jsxs)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:["No ",l?`${l} `:"","operations"]})}),(0,ep.jsx)(tH.Dialog,{open:k,onOpenChange:E,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Operation Details"}),(0,ep.jsx)(tH.DialogDescription,{children:j?.operation_id&&(0,ep.jsx)("span",{className:"font-mono text-xs",children:j.operation_id})})]}),C?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tV.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):j?(0,ep.jsx)("div",{className:"space-y-4",children:j.error?(0,ep.jsx)("div",{className:"text-red-600 dark:text-red-400",children:j.error}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),(0,ep.jsxs)("div",{className:"mt-1",children:["pending"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"pending"]}),"failed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(ju,{className:"w-3 h-3"}),"failed"]}),"completed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"completed"]})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Type"}),(0,ep.jsx)("div",{className:"mt-1 font-mono text-sm",children:j.operation_type})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Created"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.created_at?new Date(j.created_at).toLocaleString():"N/A"})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Updated"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.updated_at?new Date(j.updated_at).toLocaleString():"N/A"})]}),j.completed_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Completed"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:new Date(j.completed_at).toLocaleString()})]}),j.result_metadata?.items_count!==void 0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Total Items"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.result_metadata.items_count})]})]}),j.result_metadata&&Object.keys(j.result_metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.result_metadata,null,2)})]}),j.error_message&&(0,ep.jsxs)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-red-600 dark:text-red-400 mb-1",children:"Error"}),(0,ep.jsx)("div",{className:"text-sm text-red-600/80 dark:text-red-400/80 font-mono",children:j.error_message})]}),j.child_operations&&j.child_operations.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Sub-batches (",j.result_metadata?.num_sub_batches||j.child_operations.length,")"]}),(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[60px]",children:"Index"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eJ,{className:"w-[80px]",children:"Items"}),(0,ep.jsx)(eJ,{children:"Status"})]})}),(0,ep.jsx)(eZ,{children:j.child_operations.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"text-sm",children:e.sub_batch_index}),(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.operation_id.substring(0,8)}),(0,ep.jsx)(e0,{className:"text-sm",children:e.items_count}),(0,ep.jsxs)(e0,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"pending"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400",title:e.error_message??void 0,children:[(0,ep.jsx)(ju,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"completed"]})]})]},e.operation_id))})]})]}),(e=A===j.operation_id,t=!!j.task_payload,n=!!j.result_metadata?.is_parent,(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Raw payload"}),!e&&(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:R,disabled:S,children:[S?(0,ep.jsx)(tV.default,{className:"w-3 h-3 mr-1 animate-spin"}):(0,ep.jsx)(Ui,{className:"w-3 h-3 mr-1"}),"Load raw"]})]}),t?(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.task_payload,null,2)}):e?(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"This is a parent operation — the raw payload is stored on each sub-batch. Open a child operation to inspect its payload.":"No raw payload stored for this operation."}):(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Shows the full parameters the operation was submitted with (may be large)."})]}))]})}):null]})})]}):null}var tV=tV;let Us=(0,eN.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);function Ul(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)("dashboard"),[s,l]=(0,em.useState)(""),[c,u]=(0,em.useState)(1),[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(!1),k=t.filter(e=>{if(!s)return!0;let t=s.toLowerCase();return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.source_query.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),E=async()=>{if(e){i(!0);try{let t=await eD.client.listMentalModels(e);n(t.items||[])}catch(e){console.error("Error loading mental models:",e)}finally{i(!1)}}},[C,_]=(0,em.useState)(new Set),S=async t=>{if(!e)return;let r=t.last_refreshed_at;_(e=>new Set(e).add(t.id));try{await eD.client.refreshMentalModel(e,t.id);for(let i=0;i<120;i++){await new Promise(e=>setTimeout(e,1e3));let i=await eD.client.getMentalModel(e,t.id);if(i.last_refreshed_at!==r){n(e=>e.map(e=>e.id===t.id?i:e)),f?.id===t.id&&p(i),ev.toast.success("Mental model refreshed");return}}ev.toast.error("Refresh timeout")}catch{}finally{_(e=>{let n=new Set(e);return n.delete(t.id),n})}},T=async()=>{if(e&&b){N(!0);try{await eD.client.deleteMentalModel(e,b.id),n(e=>e.filter(e=>e.id!==b.id)),f?.id===b.id&&p(null),w(null)}catch(e){}finally{N(!1)}}};if((0,em.useEffect)(()=>{e&&E()},[e]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&p(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,em.useEffect)(()=>{u(1)},[s]),!e)return(0,ep.jsx)(px,{children:(0,ep.jsx)(pj,{className:"p-10 text-center",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to view mental models."})})});let A=Math.ceil(k.length/100),O=(c-1)*100,M=O+100,P=k.slice(O,M);return(0,ep.jsxs)("div",{children:[r?(0,ep.jsxs)("div",{className:"text-center py-12",children:[(0,ep.jsx)(eU,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Loading..."})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"mb-4",children:(0,ep.jsx)(eI.Input,{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:"Filter mental models by name, query, or content...",className:"max-w-md"})}),(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:s?`${k.length} of ${t.length} mental models`:`${t.length} mental model${1!==t.length?"s":""}`}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(eL.Button,{onClick:()=>h(!0),size:"sm",children:[(0,ep.jsx)(fI.Plus,{className:"w-4 h-4 mr-2"}),"Add Mental Model"]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>o("dashboard"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"dashboard"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(Us,{className:"w-4 h-4"}),"Dashboard"]}),(0,ep.jsxs)("button",{onClick:()=>o("table"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"table"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eG,{className:"w-4 h-4"}),"Table"]})]})]})]}),k.length>0?(0,ep.jsxs)(ep.Fragment,{children:["dashboard"===a&&(0,ep.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:P.map(e=>(0,ep.jsx)(px,{className:`cursor-pointer transition-all hover:shadow-md hover:border-primary/50 ${f?.id===e.id?"border-primary shadow-md":""}`,onClick:()=>p(e),children:(0,ep.jsxs)(pj,{className:"p-4",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("h3",{className:"font-semibold text-foreground mb-1 truncate",children:e.name}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate",children:e.id}),(0,ep.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium flex-shrink-0 ${e.trigger?.refresh_after_consolidation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-slate-500/10 text-slate-600 dark:text-slate-400"}`,children:e.trigger?.refresh_after_consolidation?"Auto Refresh":"Manual"})]})]}),(0,ep.jsx)(Uc,{m:e,refreshing:C.has(e.id),onEdit:e=>{y(e),v(!0)},onRefresh:S,onDelete:e=>w({id:e.id,name:e.name}),triggerClassName:"h-7 w-7 ml-2 flex-shrink-0"})]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.source_query}),(0,ep.jsxs)("div",{className:"relative mb-3 border-t border-border pt-3 max-h-40 overflow-hidden",children:[(0,ep.jsx)(wz,{children:e.content}),(0,ep.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent"})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between text-xs border-t border-border pt-3",children:[(0,ep.jsx)("div",{className:"flex items-center gap-2",children:e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex gap-1",children:[e.tags.slice(0,2).map(e=>(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e)),e.tags.length>2&&(0,ep.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-muted text-muted-foreground",children:["+",e.tags.length-2]})]})}),(0,ep.jsx)("div",{className:"text-muted-foreground",title:wH(e.last_refreshed_at),children:wU(e.last_refreshed_at)})]})]})},e.id))}),"table"===a&&(0,ep.jsxs)(eq,{className:"table-fixed",children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[20%]",children:"ID"}),(0,ep.jsx)(eJ,{className:"w-[20%]",children:"Name"}),(0,ep.jsx)(eJ,{className:"w-[35%]",children:"Source Query"}),(0,ep.jsx)(eJ,{className:"w-[15%]",children:"Last Refreshed"}),(0,ep.jsx)(eJ,{className:"w-[10%]"})]})}),(0,ep.jsx)(eZ,{children:P.map(e=>(0,ep.jsxs)(eQ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>p(e),children:[(0,ep.jsx)(e0,{className:"py-2",children:(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate block",children:e.id})}),(0,ep.jsx)(e0,{className:"py-2",children:(0,ep.jsx)("div",{className:"font-medium text-foreground",children:e.name})}),(0,ep.jsx)(e0,{className:"py-2",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground truncate",children:e.source_query})}),(0,ep.jsx)(e0,{className:"py-2 text-sm text-foreground",title:wH(e.last_refreshed_at),children:wU(e.last_refreshed_at)}),(0,ep.jsx)(e0,{className:"py-2",children:(0,ep.jsx)(Uc,{m:e,refreshing:C.has(e.id),onEdit:e=>{y(e),v(!0)},onRefresh:S,onDelete:e=>w({id:e.id,name:e.name})})})]},e.id))})]}),A>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[O+1,"-",Math.min(M,k.length)," of"," ",k.length]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.max(1,e-1)),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",A]}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.min(A,e+1)),disabled:c===A,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eT.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eL.Button,{variant:"outline",size:"sm",onClick:()=>u(A),disabled:c===A,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eV,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-border rounded-lg text-center",children:[(0,ep.jsx)(ek,{className:"w-6 h-6 mx-auto mb-2 text-muted-foreground"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:s?"No mental models match your filter":"No mental models yet. Create a mental model to generate and save a summary from your memories."})]})]}),(0,ep.jsx)(Uu,{open:d,onClose:()=>h(!1),onCreated:()=>{h(!1),E()}}),(0,ep.jsx)(fY,{open:!!b,onOpenChange:e=>!e&&w(null),children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Mental Model"}),(0,ep.jsxs)(pn,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',b?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(pe,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(pi,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(pr,{onClick:T,disabled:j,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[j?(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),(0,ep.jsx)(wJ,{mentalModelId:f?.id??null,onClose:()=>p(null),onDelete:e=>w({id:e.id,name:e.name}),onEdit:e=>{y(e),v(!0)},onRefreshed:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e)}}),x&&(0,ep.jsx)(Ud,{open:g,mentalModel:x,onClose:()=>{v(!1),y(null)},onUpdated:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e),v(!1),y(null)}})]})}function Uc({m:e,refreshing:t,onEdit:n,onRefresh:r,onDelete:i,triggerClassName:a}){return(0,ep.jsxs)(gk,{children:[(0,ep.jsx)(gC,{asChild:!0,children:(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:`p-0 text-muted-foreground ${a??"h-8 w-8"}`,onClick:e=>e.stopPropagation(),"aria-label":"Actions",children:(0,ep.jsx)(gH,{className:"h-4 w-4"})})}),(0,ep.jsxs)(gz,{align:"end",onClick:e=>e.stopPropagation(),children:[(0,ep.jsxs)(gF,{onClick:()=>n(e),children:[(0,ep.jsx)(po,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(gF,{onClick:()=>r(e),disabled:t,children:[(0,ep.jsx)(eU,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),"Refresh Manually"]}),(0,ep.jsx)(gV,{}),(0,ep.jsxs)(gF,{onClick:()=>i(e),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(pa,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function Uu({open:e,onClose:t,onCreated:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),l=async()=>{if(r&&o.name.trim()&&o.sourceQuery.trim()){a(!0);try{let e,t=o.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),i=parseInt(o.maxTokens)||2048,a=o.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(o.tagGroups.trim())try{e=JSON.parse(o.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let l=o.recallMaxTokens.trim()?parseInt(o.recallMaxTokens,10):void 0,c=o.recallChunksMaxTokens.trim()?parseInt(o.recallChunksMaxTokens,10):void 0,u="true"===o.includeChunks||"false"!==o.includeChunks&&void 0;await eD.client.createMentalModel(r,{id:o.id.trim()||void 0,name:o.name.trim(),source_query:o.sourceQuery.trim(),tags:t.length>0?t:void 0,max_tokens:i,trigger:{mode:o.mode,refresh_after_consolidation:o.autoRefresh,fact_types:o.factTypes.length>0?o.factTypes:void 0,exclude_mental_models:o.excludeMentalModels||void 0,exclude_mental_model_ids:a.length>0?a:void 0,tags_match:o.tagsMatch||void 0,tag_groups:e,include_chunks:u,recall_max_tokens:l,recall_chunks_max_tokens:c}}),s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:e,onOpenChange:e=>{e||(s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),t())},children:(0,ep.jsxs)(tH.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Create Mental Model"}),(0,ep.jsx)(tH.DialogDescription,{children:"Create a mental model by running a query. The content will be auto-generated and can be refreshed later."})]}),(0,ep.jsxs)(tY.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(tY.TabsList,{className:"w-full",children:[(0,ep.jsx)(tY.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tY.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(tY.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"ID"}),(0,ep.jsx)(eI.Input,{value:o.id,onChange:e=>s({...o,id:e.target.value}),placeholder:"e.g., team-communication"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:o.name,onChange:e=>s({...o,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eI.Input,{value:o.sourceQuery,onChange:e=>s({...o,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.maxTokens,onChange:e=>s({...o,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tY.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(ph.Checkbox,{id:"auto-refresh",checked:o.autoRefresh,onCheckedChange:e=>s({...o,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tR.Select,{value:o.mode,onValueChange:e=>s({...o,mode:e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tR.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(ph.Checkbox,{id:"exclude-mental-models",checked:o.excludeMentalModels,onCheckedChange:e=>s({...o,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eI.Input,{value:o.excludeMentalModelIds,onChange:e=>s({...o,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eI.Input,{value:o.tags,onChange:e=>s({...o,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tR.Select,{value:o.tagsMatch,onValueChange:e=>s({...o,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tR.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(pS.Textarea,{value:o.tagGroups,onChange:e=>s({...o,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(pv,{value:o.factTypes,onChange:e=>s({...o,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tR.Select,{value:o.includeChunks||"default",onValueChange:e=>s({...o,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tR.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tR.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.recallMaxTokens,onChange:e=>s({...o,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:o.recallChunksMaxTokens,onChange:e=>s({...o,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:t,disabled:i,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:l,disabled:i||!o.name.trim()||!o.sourceQuery.trim(),children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}),"Generating..."]}):"Create"})]})]})})}function Ud({open:e,mentalModel:t,onClose:n,onUpdated:r}){let{currentBank:i}=(0,ey.useBank)(),[a,o]=(0,em.useState)(!1),s=()=>({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,mode:t.trigger?.mode||"full",factTypes:t.trigger?.fact_types||[],excludeMentalModels:t.trigger?.exclude_mental_models||!1,excludeMentalModelIds:(t.trigger?.exclude_mental_model_ids||[]).join(", "),tagsMatch:t.trigger?.tags_match||"",tagGroups:t.trigger?.tag_groups?JSON.stringify(t.trigger.tag_groups,null,2):"",includeChunks:t.trigger?.include_chunks===!0?"true":t.trigger?.include_chunks===!1?"false":"",recallMaxTokens:t.trigger?.recall_max_tokens!=null?String(t.trigger.recall_max_tokens):"",recallChunksMaxTokens:t.trigger?.recall_chunks_max_tokens!=null?String(t.trigger.recall_chunks_max_tokens):""}),[l,c]=(0,em.useState)(s);(0,em.useEffect)(()=>{e&&c(s())},[e,t]);let u=async()=>{if(i&&l.name.trim()&&l.sourceQuery.trim()){o(!0);try{let e,a=l.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),o=parseInt(l.maxTokens)||2048,s=l.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(l.tagGroups.trim())try{e=JSON.parse(l.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let c=l.recallMaxTokens.trim()?parseInt(l.recallMaxTokens,10):void 0,u=l.recallChunksMaxTokens.trim()?parseInt(l.recallChunksMaxTokens,10):void 0,d="true"===l.includeChunks||"false"!==l.includeChunks&&void 0,h=await eD.client.updateMentalModel(i,t.id,{name:l.name.trim(),source_query:l.sourceQuery.trim(),tags:a.length>0?a:void 0,max_tokens:o,trigger:{mode:l.mode,refresh_after_consolidation:l.autoRefresh,fact_types:l.factTypes.length>0?l.factTypes:void 0,exclude_mental_models:l.excludeMentalModels||void 0,exclude_mental_model_ids:s.length>0?s:void 0,tags_match:l.tagsMatch||void 0,tag_groups:e,include_chunks:d,recall_max_tokens:c,recall_chunks_max_tokens:u}});r(h),n()}catch(e){}finally{o(!1)}}};return(0,ep.jsx)(tH.Dialog,{open:e,onOpenChange:e=>!e&&n(),children:(0,ep.jsxs)(tH.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Update Mental Model"}),(0,ep.jsx)(tH.DialogDescription,{children:"Update the mental model configuration. Changes will take effect immediately."})]}),(0,ep.jsxs)(tY.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(tY.TabsList,{className:"w-full",children:[(0,ep.jsx)(tY.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tY.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(tY.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)(eI.Input,{value:t.id,disabled:!0,className:"bg-muted"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eI.Input,{value:l.name,onChange:e=>c({...l,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eI.Input,{value:l.sourceQuery,onChange:e=>c({...l,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.maxTokens,onChange:e=>c({...l,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tY.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(ph.Checkbox,{id:"update-auto-refresh",checked:l.autoRefresh,onCheckedChange:e=>c({...l,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tR.Select,{value:l.mode,onValueChange:e=>c({...l,mode:e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tR.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(ph.Checkbox,{id:"update-exclude-mental-models",checked:l.excludeMentalModels,onCheckedChange:e=>c({...l,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eI.Input,{value:l.excludeMentalModelIds,onChange:e=>c({...l,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eI.Input,{value:l.tags,onChange:e=>c({...l,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tR.Select,{value:l.tagsMatch||"default",onValueChange:e=>c({...l,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tR.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tR.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(pS.Textarea,{value:l.tagGroups,onChange:e=>c({...l,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(pv,{value:l.factTypes,onChange:e=>c({...l,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tR.Select,{value:l.includeChunks||"default",onValueChange:e=>c({...l,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tR.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tR.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.recallMaxTokens,onChange:e=>c({...l,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eI.Input,{type:"number",value:l.recallChunksMaxTokens,onChange:e=>c({...l,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:n,disabled:a,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:u,disabled:a||!l.name.trim()||!l.sourceQuery.trim(),children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 animate-spin mr-1"}),"Updating..."]}):"Update"})]})]})})}let Uh=(0,eN.default)("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"}]]),Uf=(0,eN.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var tV=tV;let Up=["consolidation.completed","retain.completed"],Um={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function Ug(e){return Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key,e.value]))}function Uv(e){return{method:e.method,timeout_seconds:e.timeout_seconds,headers:Ug(e.headers),params:Ug(e.params)}}function Ux({label:e,pairs:t,onChange:n}){let r=(e,r,i)=>{n(t.map((t,n)=>n===e?{...t,[r]:i}:t))};return(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)(e8,{children:e}),(0,ep.jsxs)(eL.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>n([...t,{key:"",value:""}]),children:[(0,ep.jsx)(fI.Plus,{className:"w-3 h-3 mr-1"}),"Add"]})]}),t.length>0&&(0,ep.jsx)("div",{className:"space-y-1.5",children:t.map((e,i)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eI.Input,{placeholder:"Key",value:e.key,onChange:e=>r(i,"key",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)(eI.Input,{placeholder:"Value",value:e.value,onChange:e=>r(i,"value",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)("button",{type:"button",onClick:()=>n(t.filter((e,t)=>t!==i)),className:"text-muted-foreground hover:text-foreground shrink-0",children:(0,ep.jsx)(e$.X,{className:"w-4 h-4"})})]},i))})]})}function Uy({delivery:e,formatDate:t}){var n;let[r,i]=(0,em.useState)(!1),a=e.last_response_body||e.last_error;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)(eQ,{className:a?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>a&&i(e=>!e),children:[(0,ep.jsx)(e0,{className:"w-8 pl-3 pr-0",children:a?r?(0,ep.jsx)(w6.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)(eT.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,ep.jsx)(e0,{children:"completed"===(n=e.status)?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"delivered"]}):"pending"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"pending"]}):"failed"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(ju,{className:"w-3 h-3"}),"failed"]}):(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:n})}),(0,ep.jsx)(e0,{children:null!=e.last_response_status?(0,ep.jsx)("span",{className:`font-mono text-xs px-1.5 py-0.5 rounded border ${e.last_response_status>=200&&e.last_response_status<300?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"}`,children:e.last_response_status}):(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"—"})}),(0,ep.jsx)(e0,{className:"text-center text-sm",children:e.attempts}),(0,ep.jsx)(e0,{className:"font-mono text-xs text-muted-foreground",children:e.event_type}),(0,ep.jsx)(e0,{className:"text-xs text-muted-foreground whitespace-nowrap",children:t(e.created_at)})]}),r&&a&&(0,ep.jsx)(eQ,{className:"bg-muted/20 hover:bg-muted/20",children:(0,ep.jsx)(e0,{colSpan:6,className:"px-4 py-3",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[e.last_error&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Error"}),(0,ep.jsx)("p",{className:"font-mono text-xs text-red-600 dark:text-red-400 break-all",children:e.last_error})]}),e.last_response_body&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Response Body",e.last_attempt_at&&(0,ep.jsxs)("span",{className:"ml-2 normal-case font-normal",children:["· ",t(e.last_attempt_at)]})]}),(0,ep.jsx)("pre",{className:"font-mono text-xs bg-background rounded p-2 overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto border border-border",children:e.last_response_body})]})]})})})]})}function Ub(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(!1),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(null),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(Um),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(Um),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)([]),[I,R]=(0,em.useState)(!1),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(!1),U=async()=>{if(e){i(!0);try{let t=await eD.client.listWebhooks(e);n(t.items||[])}catch(e){console.error("Error loading webhooks:",e)}finally{i(!1)}}};(0,em.useEffect)(()=>{e&&U()},[e]);let H=async()=>{if(e&&g.url){l(!0);try{await eD.client.createWebhook(e,{url:g.url,secret:g.secret||void 0,event_types:g.event_types.length>0?g.event_types:void 0,enabled:g.enabled,http_config:Uv(g.http_config)}),o(!1),v(Um),p(!1),await U()}catch(e){}finally{l(!1)}}},W=async t=>{if(e){u(t),h(null);try{await eD.client.deleteWebhook(e,t),await U()}catch(e){}finally{u(null)}}},Y=async()=>{if(e&&b&&j.url){T(!0);try{let t={url:j.url,event_types:j.event_types,enabled:j.enabled,http_config:Uv(j.http_config)};C?t.secret=null:j.secret&&(t.secret=j.secret),await eD.client.updateWebhook(e,b.id,t),y(!1),await U()}catch{}finally{T(!1)}}},G=async t=>{if(e){P(t),O(!0),L([]),z(null),R(!0);try{let n=await eD.client.listWebhookDeliveries(e,t.id,50);L(n.items||[]),z(n.next_cursor??null)}catch(e){console.error("Error loading deliveries:",e)}finally{R(!1)}}},X=async()=>{if(e&&M&&B){V(!0);try{let t=await eD.client.listWebhookDeliveries(e,M.id,50,B);L(e=>[...e,...t.items||[]]),z(t.next_cursor??null)}catch(e){console.error("Error loading more deliveries:",e)}finally{V(!1)}}},$=e=>e?new Date(e).toLocaleString():"N/A";return e?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Webhooks"}),(0,ep.jsx)("button",{onClick:()=>U(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh webhooks",disabled:r,children:(0,ep.jsx)(eU,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${r?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[t.length," webhook",1!==t.length?"s":""]})]}),(0,ep.jsxs)(eL.Button,{size:"sm",onClick:()=>o(!0),children:[(0,ep.jsx)(fI.Plus,{className:"w-4 h-4 mr-2"}),"Add Webhook"]})]}),t.length>0?(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{children:"URL"}),(0,ep.jsx)(eJ,{children:"Method"}),(0,ep.jsx)(eJ,{children:"Event Types"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{children:"Created At"}),(0,ep.jsx)(eJ,{className:"w-[120px]"})]})}),(0,ep.jsx)(eZ,{children:t.map(e=>(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(e0,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,ep.jsx)("span",{title:e.url,children:e.url})}),(0,ep.jsx)(e0,{children:(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-muted text-muted-foreground border border-border",children:e.http_config?.method||"POST"})}),(0,ep.jsx)(e0,{children:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:e.event_types.length>0?e.event_types.map(e=>(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:e},e)):(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:"All events"})})}),(0,ep.jsx)(e0,{children:e.enabled?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"Enabled"]}):(0,ep.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:"Disabled"})}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground",children:$(e.created_at)}),(0,ep.jsx)(e0,{children:(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsxs)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>G(e),title:"View deliveries",children:[(0,ep.jsx)(Uh,{className:"w-3 h-3 mr-1"}),"Deliveries"]}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{let t;return w(e),void(N((t=e.http_config??{method:"POST",timeout_seconds:30,headers:{},params:{}},{url:e.url,secret:"",event_types:e.event_types,enabled:e.enabled,http_config:{method:t.method,timeout_seconds:t.timeout_seconds,headers:Object.entries(t.headers??{}).map(([e,t])=>({key:e,value:t})),params:Object.entries(t.params??{}).map(([e,t])=>({key:e,value:t}))}})),E(!1),_(!1),y(!0))},title:"Edit webhook",children:(0,ep.jsx)(po,{className:"w-3 h-3"})}),(0,ep.jsx)(eL.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:()=>h(e),disabled:c===e.id,title:"Delete webhook",children:c===e.id?(0,ep.jsx)(tV.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(pa,{className:"w-3 h-3"})})]})})]},e.id))})]})}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No webhooks configured. Add a webhook to receive event notifications."}),(0,ep.jsx)(tH.Dialog,{open:a,onOpenChange:e=>{e||(v(Um),p(!1)),o(e)},children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Add Webhook"}),(0,ep.jsx)(tH.DialogDescription,{children:"Configure a webhook endpoint to receive event notifications."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eI.Input,{id:"webhook-url",type:"url",placeholder:"https://example.com/webhook",value:g.url,onChange:e=>v(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Method"}),(0,ep.jsxs)(tR.Select,{value:g.http_config.method,onValueChange:e=>v(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tR.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eI.Input,{id:"webhook-timeout",type:"number",min:1,max:300,value:g.http_config.timeout_seconds,onChange:e=>v(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"webhook-secret",children:["Secret ",(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eI.Input,{id:"webhook-secret",type:f?"text":"password",placeholder:"Signing secret",value:g.secret,onChange:e=>v(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>p(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:f?(0,ep.jsx)(Uf,{className:"w-4 h-4"}):(0,ep.jsx)(Uh,{className:"w-4 h-4"})})]})]}),(0,ep.jsx)(Ux,{label:"Custom Headers",pairs:g.http_config.headers,onChange:e=>v(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(Ux,{label:"Query Parameters",pairs:g.http_config.params,onChange:e=>v(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e8,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:Up.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(ph.Checkbox,{id:`event-${e}`,checked:g.event_types.includes(e),onCheckedChange:()=>{v(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}}),(0,ep.jsx)(e8,{htmlFor:`event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tI.Switch,{id:"webhook-enabled",checked:g.enabled,onCheckedChange:e=>v(t=>({...t,enabled:e}))}),(0,ep.jsx)(e8,{htmlFor:"webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>o(!1),disabled:s,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:H,disabled:s||!g.url,children:s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):"Create Webhook"})]})]})}),(0,ep.jsx)(tH.Dialog,{open:x,onOpenChange:e=>{e||(w(null),N(Um),E(!1),_(!1)),y(e)},children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Edit Webhook"}),(0,ep.jsx)(tH.DialogDescription,{children:"Update the webhook configuration."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e8,{htmlFor:"edit-webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eI.Input,{id:"edit-webhook-url",type:"url",placeholder:"https://example.com/webhook",value:j.url,onChange:e=>N(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{children:"Method"}),(0,ep.jsxs)(tR.Select,{value:j.http_config.method,onValueChange:e=>N(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tR.SelectTrigger,{children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{children:[(0,ep.jsx)(tR.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tR.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"edit-webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eI.Input,{id:"edit-webhook-timeout",type:"number",min:1,max:300,value:j.http_config.timeout_seconds,onChange:e=>N(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e8,{htmlFor:"edit-webhook-secret",children:"Secret"}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eI.Input,{id:"edit-webhook-secret",type:k?"text":"password",placeholder:"Leave blank to keep existing",value:j.secret,disabled:C,onChange:e=>N(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>E(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:k?(0,ep.jsx)(Uf,{className:"w-4 h-4"}):(0,ep.jsx)(Uh,{className:"w-4 h-4"})})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ep.jsx)(ph.Checkbox,{id:"edit-clear-secret",checked:C,onCheckedChange:e=>{_(!!e),e&&N(e=>({...e,secret:""}))}}),(0,ep.jsx)(e8,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:"Clear existing secret"})]})]}),(0,ep.jsx)(Ux,{label:"Custom Headers",pairs:j.http_config.headers,onChange:e=>N(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(Ux,{label:"Query Parameters",pairs:j.http_config.params,onChange:e=>N(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e8,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:Up.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(ph.Checkbox,{id:`edit-event-${e}`,checked:j.event_types.includes(e),onCheckedChange:()=>N(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}),(0,ep.jsx)(e8,{htmlFor:`edit-event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tI.Switch,{id:"edit-webhook-enabled",checked:j.enabled,onCheckedChange:e=>N(t=>({...t,enabled:e}))}),(0,ep.jsx)(e8,{htmlFor:"edit-webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>y(!1),disabled:S,children:"Cancel"}),(0,ep.jsx)(eL.Button,{onClick:Y,disabled:S||!j.url,children:S?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),(0,ep.jsx)(tH.Dialog,{open:!!d,onOpenChange:e=>{e||h(null)},children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-md",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Delete Webhook"}),(0,ep.jsx)(tH.DialogDescription,{children:"Are you sure you want to delete this webhook? This action cannot be undone and all pending deliveries will be cancelled."})]}),d&&(0,ep.jsx)("div",{className:"py-2",children:(0,ep.jsx)("p",{className:"font-mono text-sm truncate text-muted-foreground bg-muted px-3 py-2 rounded-md border border-border",children:d.url})}),(0,ep.jsxs)(tH.DialogFooter,{children:[(0,ep.jsx)(eL.Button,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,ep.jsx)(eL.Button,{variant:"destructive",onClick:()=>d&&W(d.id),disabled:!!c,children:c?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete Webhook"})]})]})}),(0,ep.jsx)(tH.Dialog,{open:A,onOpenChange:e=>{e||(L([]),z(null)),O(e)},children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tH.DialogHeader,{children:[(0,ep.jsx)(tH.DialogTitle,{children:"Webhook Deliveries"}),M&&(0,ep.jsx)(tH.DialogDescription,{className:"font-mono text-xs truncate",children:M.url})]}),I?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tV.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):D.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-8 pl-3 pr-0"}),(0,ep.jsx)(eJ,{children:"Status"}),(0,ep.jsx)(eJ,{children:"HTTP"}),(0,ep.jsx)(eJ,{className:"text-center",children:"Attempts"}),(0,ep.jsx)(eJ,{children:"Event"}),(0,ep.jsx)(eJ,{children:"Created At"})]})}),(0,ep.jsx)(eZ,{children:D.map(e=>(0,ep.jsx)(Uy,{delivery:e,formatDate:$},e.id))})]})}),B&&(0,ep.jsx)("div",{className:"flex justify-center pt-2",children:(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:X,disabled:F,children:[F&&(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Load more"]})})]}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No deliveries yet for this webhook."})]})})]}):null}var Uw=["axis"],Uj=(0,em.forwardRef)((e,t)=>em.createElement(Rm,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Uw,tooltipPayloadSearcher:Et,categoricalChartProps:e,ref:t})),UN=em,Uk=["children"],UE=(0,em.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function UC(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Uk);return em.createElement(UE.Provider,{value:n},t)}var U_=(e,t,n,r)=>PG(e,"xAxis",t,r),US=(e,t,n,r)=>PY(e,"xAxis",t,r),UT=(e,t,n,r)=>PG(e,"yAxis",n,r),UA=(e,t,n,r)=>PY(e,"yAxis",n,r),UO=N1([_w,U_,UT,US,UA],(e,t,n,r,i)=>CF(e,"xAxis")?CX(t,r,!1):CX(n,i,!1));function UM(e){return"line"===e.type}var UP=N1([MN,(e,t,n,r,i)=>i],(e,t)=>e.filter(UM).find(e=>e.id===t)),UD=N1([_w,U_,UT,US,UA,UP,UO,Ov],(e,t,n,r,i,a,o,s)=>{var l,{chartData:c,dataStartIndex:u,dataEndIndex:d}=s;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:h,data:f}=a;if(null!=(l=null!=f&&f.length>0?f:null==c?void 0:c.slice(u,d+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:l}=e;return l.map((e,l)=>{var c=Cz(e,o);if("horizontal"===t)return{x:CW({axis:n,ticks:i,bandSize:s,entry:e,index:l}),y:null==c?null:r.scale(c),value:c,payload:e};var u=null==c?null:n.scale(c),d=CW({axis:r,ticks:a,bandSize:s,entry:e,index:l});return null==u||null==d?null:{x:u,y:d,value:c,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:h,bandSize:o,displayedData:l})}}),UL=e.i(7328);function UI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function UR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?UI(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UB(){return(UB=Object.assign.bind()).apply(null,arguments)}function Uz(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var UF=(e,t,n,r,i)=>{var a=n-r;return kK(ec||(ec=Uz(["M ",",",""])),e,t)+kK(eu||(eu=Uz(["L ",",",""])),e+n,t)+kK(ed||(ed=Uz(["L ",",",""])),e+n-a/2,t+i)+kK(eh||(eh=Uz(["L ",",",""])),e+n-a/2-r,t+i)+kK(ef||(ef=Uz(["L ",","," Z"])),e,t)},UV={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},UU=e=>{var t=Rh(e,UV),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,em.useRef)(null),[f,p]=(0,em.useState)(-1),g=(0,em.useRef)(i),v=(0,em.useRef)(a),x=(0,em.useRef)(o),y=(0,em.useRef)(n),b=(0,em.useRef)(r),w=zx(e,"trapezoid-");if((0,em.useEffect)(()=>{if(h.current&&h.current.getTotalLength)try{var e=h.current.getTotalLength();e&&p(e)}catch(e){}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||0===i&&0===a||0===o)return null;var j=(0,_t.clsx)("recharts-trapezoid",s);if(!d)return em.createElement("g",null,em.createElement("path",UB({},IR(t),{className:j,d:UF(n,r,i,a,o)})));var N=g.current,k=v.current,E=x.current,C=y.current,_=b.current,S="0px ".concat(-1===f?1:f,"px"),T="".concat(f,"px 0px"),A=zE(["strokeDasharray"],c,l);return em.createElement(zH,{animationId:w,key:w,canBegin:f>0,duration:c,easing:l,isActive:d,begin:u},e=>{var s=k6(N,i,e),l=k6(k,a,e),c=k6(E,o,e),u=k6(C,n,e),d=k6(_,r,e);h.current&&(g.current=s,v.current=l,x.current=c,y.current=u,b.current=d);var f=e>0?{transition:A,strokeDasharray:T}:{strokeDasharray:S};return em.createElement("path",UB({},IR(t),{className:j,d:UF(u,d,s,l,c),ref:h,style:UR(UR({},f),t.style)}))})};let UH=Math.cos,UW=Math.sin,UY=Math.sqrt,UG=Math.PI,UX=2*UG;UY(3);let U$={draw(e,t){let n=UY(t/UG);e.moveTo(n,0),e.arc(0,0,n,0,UX)}},Uq=UY(1/3),UK=2*Uq,UZ=UW(UG/10)/UW(7*UG/10),UQ=UW(UX/10)*UZ,UJ=-UH(UX/10)*UZ,U0=UY(3);UY(3);let U1=UY(3)/2,U2=1/UY(12),U5=(U2/2+1)*3;var U3=["type","size","sizeType"];function U4(){return(U4=Object.assign.bind()).apply(null,arguments)}function U6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U8(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?U6(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U6(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var U7={symbolCircle:U$,symbolCross:{draw(e,t){let n=UY(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},symbolDiamond:{draw(e,t){let n=UY(t/UK),r=n*Uq;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},symbolSquare:{draw(e,t){let n=UY(t),r=-n/2;e.rect(r,r,n,n)}},symbolStar:{draw(e,t){let n=UY(.8908130915292852*t),r=UQ*n,i=UJ*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=UX*t/5,o=UH(a),s=UW(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},symbolTriangle:{draw(e,t){let n=-UY(t/(3*U0));e.moveTo(0,2*n),e.lineTo(-U0*n,-n),e.lineTo(U0*n,-n),e.closePath()}},symbolWye:{draw(e,t){let n=UY(t/U5),r=n/2,i=n*U2,a=n*U2+n,o=-r;e.moveTo(r,i),e.lineTo(r,a),e.lineTo(o,a),e.lineTo(-.5*r-U1*i,U1*r+-.5*i),e.lineTo(-.5*r-U1*a,U1*r+-.5*a),e.lineTo(-.5*o-U1*a,U1*o+-.5*a),e.lineTo(-.5*r+U1*i,-.5*i-U1*r),e.lineTo(-.5*r+U1*a,-.5*a-U1*r),e.lineTo(-.5*o+U1*a,-.5*a-U1*o),e.closePath()}}},U9=Math.PI/180,He=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=U8(U8({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,U3)),{},{type:t,size:n,sizeType:r}),a="circle";"string"==typeof t&&(a=t);var{className:o,cx:s,cy:l}=i,c=IR(i);return k0(s)&&k0(l)&&k0(n)?em.createElement("path",U4({},c,{className:(0,_t.clsx)("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(l,")"),d:(()=>{var e,t=(e=a,U7["symbol".concat(k7(e))]||U$),i=(function(e,t){let n=null,r=RC(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:CT(e||U$),t="function"==typeof t?t:CT(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:CT(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:CT(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i})().type(t).size(((e,t,n)=>{if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*U9;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.tan(r)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(n,r,a))();if(null!==i)return i})()})):null};He.registerSymbol=(e,t)=>{U7["symbol".concat(k7(e))]=t};var Ht=["option","shapeType","activeClassName"];function Hn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hn(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hi(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return em.createElement(Vn,n);case"trapezoid":return em.createElement(UU,n);case"sector":return em.createElement(Vc,n);case"symbols":if("symbols"===t)return em.createElement(He,n);break;case"curve":return em.createElement(R5,n);default:return null}}function Ha(e){var t,{option:n,shapeType:r,activeClassName:i="recharts-active-shape"}=e,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Ht);if((0,em.isValidElement)(n))t=(0,em.cloneElement)(n,Hr(Hr({},a),(0,em.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(a,a.index);else if((0,UL.default)(n)&&"boolean"!=typeof n){var o=Hr(Hr({},a),n);t=em.createElement(Hi,{shapeType:r,elementProps:o})}else t=em.createElement(Hi,{shapeType:r,elementProps:a});return a.isActive?em.createElement(R6,{className:i},t):t}var Ho=["id"],Hs=["type","layout","connectNulls","needClip","shape"],Hl=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hc(){return(Hc=Object.assign.bind()).apply(null,arguments)}function Hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hu(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hh(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Hf=UN.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Cq(o,t),hide:s,type:c,color:r,unit:l,graphicalItemId:u}};return UN.createElement(zr,{tooltipEntrySettings:d})}),Hp=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function Hm(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,l=IL(Hh(r,Ho));return UN.createElement(B7,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:l,needClip:o,clipPathId:t})}function Hg(e){var{showLabels:t,children:n,points:r}=e,i=(0,UN.useMemo)(()=>null==r?void 0:r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Hd(Hd({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return UN.createElement(BK,{value:t?i:void 0},n)}function Hv(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:l,needClip:c,shape:u}=a,d=Hd(Hd({},IR(Hh(a,Hs))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:s,connectNulls:l,strokeDasharray:null!=i?i:a.strokeDasharray});return UN.createElement(UN.Fragment,null,(null==r?void 0:r.length)>1&&UN.createElement(Ha,Hc({shapeType:"curve",option:u},d,{pathRef:n})),UN.createElement(Hm,{points:r,clipPathId:t,props:a}))}function Hx(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:h,width:f,height:p,onAnimationEnd:g,onAnimationStart:v}=n,x=i.current,y=zx(o,"recharts-line-"),b=(0,UN.useRef)(y),[w,j]=(0,UN.useState)(!1),N=(0,UN.useCallback)(()=>{"function"==typeof g&&g(),j(!1)},[g]),k=(0,UN.useCallback)(()=>{"function"==typeof v&&v(),j(!0)},[v]),E=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}(r.current),C=(0,UN.useRef)(0);b.current!==y&&(C.current=a.current,b.current=y);var _=C.current;return UN.createElement(Hg,{points:o,showLabels:!w},n.children,UN.createElement(zH,{animationId:y,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:k,key:y},e=>{var c,u=Math.min(k6(_,E+_,e),E);if(c=l?s?((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return Hp(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,s=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>a){s=[...n.slice(0,l),a-c];break}var u=s.length%2==0?[0,o]:[o];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;i<t;++i)r=[...r,...n];return r}(n,i),...s,...u].map(e=>"".concat(e,"px")).join(", ")})(u,E,"".concat(s).split(/[,\s]+/gim).map(e=>parseFloat(e))):Hp(E,u):null==s?void 0:String(s),e>0&&E>0&&(i.current=o,a.current=Math.max(a.current,u)),x){var d=x.length/o.length,g=1===e?o:o.map((t,n)=>{var r=Math.floor(n*d);if(x[r]){var i=x[r];return Hd(Hd({},t),{},{x:k6(i.x,t.x,e),y:k6(i.y,t.y,e)})}return h?Hd(Hd({},t),{},{x:k6(2*f,t.x,e),y:k6(p/2,t.y,e)}):Hd(Hd({},t),{},{x:t.x,y:t.y})});return i.current=g,UN.createElement(Hv,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:c})}return UN.createElement(Hv,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),UN.createElement(BJ,{label:n.label}))}function Hy(e){var{clipPathId:t,props:n}=e,r=(0,UN.useRef)(null),i=(0,UN.useRef)(0),a=(0,UN.useRef)(null);return UN.createElement(Hx,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var Hb=(e,t)=>{var n,r;return{x:null!=(n=e.x)?n:void 0,y:null!=(r=e.y)?r:void 0,value:e.value,errorVal:Cz(e.payload,t)}};class Hw extends UN.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:l,height:c,id:u,needClip:d,zIndex:h}=this.props;if(e)return null;var f=(0,_t.clsx)("recharts-line",r),{r:p,strokeWidth:g}=zW(t),v=B2(t),x=2*p+g,y=d?"url(#clipPath-".concat(v?"":"dots-").concat(u,")"):void 0;return UN.createElement(BS,{zIndex:h},UN.createElement(R6,{className:f},d&&UN.createElement("defs",null,UN.createElement(za,{clipPathId:u,xAxisId:i,yAxisId:a}),!v&&UN.createElement("clipPath",{id:"clipPath-dots-".concat(u)},UN.createElement("rect",{x:s-x/2,y:o-x/2,width:l+x,height:c+x}))),UN.createElement(UC,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:Hb,errorBarOffset:0},UN.createElement(Hy,{props:this.props,clipPathId:u}))),UN.createElement(zn,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}}var Hj={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:OG.line,type:"linear"};function HN(e){var t=Rh(e,Hj),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,hide:c,isAnimationActive:u,label:d,legendType:h,xAxisId:f,yAxisId:p,id:g}=t,v=Hh(t,Hl),{needClip:x}=zi(f,p),y=CE(Ro),b=CE(_w),w=C7(),j=CE(e=>UD(e,f,p,w,g));if("horizontal"!==b&&"vertical"!==b||null==j||null==y)return null;var{height:N,width:k,x:E,y:C}=y;return UN.createElement(Hw,Hc({},v,{id:g,connectNulls:s,dot:l,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:c,label:d,legendType:h,xAxisId:f,yAxisId:p,points:j,layout:b,height:N,width:k,left:E,top:C,needClip:x}))}var Hk=UN.memo(function(e){var t=Rh(e,Hj),n=C7();return UN.createElement(zw,{id:t.id,type:"line"},e=>UN.createElement(UN.Fragment,null,UN.createElement(zv,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:Cq(n,t),payload:e}]})(t)}),UN.createElement(Hf,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),UN.createElement(zj,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),UN.createElement(HN,Hc({},t,{id:e}))))},IC);Hk.displayName="Line";let HE=[{value:"all",label:"All actions"},{value:"retain",label:"Retain"},{value:"recall",label:"Recall"},{value:"reflect",label:"Reflect"},{value:"create_bank",label:"Create Bank"},{value:"update_bank",label:"Update Bank"},{value:"delete_bank",label:"Delete Bank"},{value:"clear_memories",label:"Clear Memories"},{value:"consolidation",label:"Consolidation"},{value:"batch_retain",label:"Batch Retain"},{value:"create_mental_model",label:"Create Mental Model"},{value:"refresh_mental_model",label:"Refresh Mental Model"},{value:"delete_mental_model",label:"Delete Mental Model"},{value:"create_directive",label:"Create Directive"},{value:"delete_directive",label:"Delete Directive"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}],HC=[{value:"all",label:"All transports"},{value:"http",label:"HTTP"},{value:"mcp",label:"MCP"},{value:"system",label:"System"}],H_=[{value:"1d",label:"Today"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function HS(e,t){if(!e||!t)return"—";let n=new Date(e).getTime(),r=new Date(t).getTime()-n;return r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${(r/6e4).toFixed(1)}m`}function HT(e){return e?new Date(e).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function HA({transport:e}){let t={http:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",mcp:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",system:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300"};return(0,ep.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${t[e]||t.system}`,children:e})}function HO({bankId:e}){let[t,n]=(0,em.useState)("7d"),[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)("day"),[c,u]=(0,em.useState)(!1),d=(0,em.useCallback)(async(n=t,i=r)=>{u(!0);try{let t=await eD.client.getAuditLogStats(e,{period:n,action:i||void 0});o(t.buckets||[]),l(t.trunc||"day")}catch(e){console.error("Error loading audit stats:",e)}finally{u(!1)}},[e,t,r]);(0,em.useEffect)(()=>{d()},[e]);let h=a.map(e=>{var t;let n;return{time:(t=e.time,n=new Date(t),"hour"===s?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"short",day:"numeric"})),total:e.total}});return(0,ep.jsxs)(px,{children:[(0,ep.jsxs)(py,{className:"pb-2 flex flex-row items-center justify-between space-y-0 gap-3",children:[(0,ep.jsx)(pb,{className:"text-sm font-semibold",children:"Request Volume"}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(tR.Select,{value:r||"all",onValueChange:e=>{let n="all"===e?null:e;i(n),d(t,n)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HE.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),H_.map(e=>(0,ep.jsx)(eL.Button,{variant:t===e.value?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{n(e.value),d(e.value,r)},children:e.label},e.value))]})]}),(0,ep.jsx)(pj,{children:(0,ep.jsx)("div",{className:"h-[120px]",children:c?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading..."}):0===h.length?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No data for this period"}):(0,ep.jsx)(_g,{width:"100%",height:"100%",children:(0,ep.jsxs)(Uj,{data:h,margin:{top:5,right:5,bottom:0,left:5},children:[(0,ep.jsx)(FA,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,ep.jsx)(VN,{contentStyle:{backgroundColor:"var(--popover)",border:"1px solid var(--border)",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,ep.jsx)(Hk,{type:"monotone",dataKey:"total",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})})]})}function HM(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(0),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)("all"),[d]=(0,em.useState)(20),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)(!1),[v,x]=(0,em.useState)(null),[y,b]=(0,em.useState)(!1),w=(0,em.useCallback)(e=>{if("all"===e)return{};let t=new Date,n=new Date;return"1h"===e?n.setHours(t.getHours()-1):"1d"===e?n.setDate(t.getDate()-1):"7d"===e?n.setDate(t.getDate()-7):"30d"===e&&n.setDate(t.getDate()-30),{start_date:n.toISOString()}},[]),j=(0,em.useCallback)(async(t=a,r=s,o=c,l=h)=>{if(e){g(!0);try{let a=w(o),s=await eD.client.listAuditLogs(e,{action:t||void 0,transport:r||void 0,start_date:a.start_date,end_date:a.end_date,limit:d,offset:l});n(s.items||[]),i(s.total||0)}catch(e){console.error("Error loading audit logs:",e)}finally{g(!1)}}},[e,a,s,c,h,d,w]),N=e=>{f(e),j(a,s,c,e)};(0,em.useEffect)(()=>{e&&j(a,s,c,h)},[e]);let k=Math.ceil(r/d),E=Math.floor(h/d)+1;return e?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(HO,{bankId:e}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ep.jsxs)(tR.Select,{value:a||"all",onValueChange:e=>{let t="all"===e?null:e;o(t),f(0),j(t,s,c,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[180px]",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All actions"})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HE.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tR.Select,{value:s||"all",onValueChange:e=>{let t="all"===e?null:e;l(t),f(0),j(a,t,c,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[160px]",children:(0,ep.jsx)(tR.SelectValue,{placeholder:"All transports"})}),(0,ep.jsx)(tR.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HC.map(e=>(0,ep.jsx)(tR.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tR.Select,{value:c,onValueChange:e=>{u(e),f(0),j(a,s,e,0)},children:[(0,ep.jsx)(tR.SelectTrigger,{className:"w-[150px]",children:(0,ep.jsx)(tR.SelectValue,{})}),(0,ep.jsxs)(tR.SelectContent,{position:"popper",children:[(0,ep.jsx)(tR.SelectItem,{value:"all",children:"All time"}),(0,ep.jsx)(tR.SelectItem,{value:"1h",children:"Last hour"}),(0,ep.jsx)(tR.SelectItem,{value:"1d",children:"Last 24 hours"}),(0,ep.jsx)(tR.SelectItem,{value:"7d",children:"Last 7 days"}),(0,ep.jsx)(tR.SelectItem,{value:"30d",children:"Last 30 days"})]})]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>j(a,s,c,h),disabled:p,children:[(0,ep.jsx)(eU,{className:`w-4 h-4 mr-1 ${p?"animate-spin":""}`}),"Refresh"]}),(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground ml-auto",children:[r," ",1===r?"entry":"entries"]})]}),(0,ep.jsxs)(eq,{children:[(0,ep.jsx)(eK,{children:(0,ep.jsxs)(eQ,{children:[(0,ep.jsx)(eJ,{className:"w-[200px]",children:"Time"}),(0,ep.jsx)(eJ,{children:"Action"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Transport"}),(0,ep.jsx)(eJ,{className:"w-[100px]",children:"Duration"})]})}),(0,ep.jsx)(eZ,{children:0===t.length?(0,ep.jsx)(eQ,{children:(0,ep.jsx)(e0,{colSpan:4,className:"text-center text-muted-foreground py-8",children:p?"Loading...":"No audit logs found"})}):t.map(e=>(0,ep.jsxs)(eQ,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{x(e),b(!0)},children:[(0,ep.jsx)(e0,{className:"text-sm font-mono",children:HT(e.started_at)}),(0,ep.jsx)(e0,{className:"font-medium",children:e.action}),(0,ep.jsx)(e0,{children:(0,ep.jsx)(HA,{transport:e.transport})}),(0,ep.jsx)(e0,{className:"text-sm text-muted-foreground font-mono",children:HS(e.started_at,e.ended_at)})]},e.id))})]}),k>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Page ",E," of ",k]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>N(Math.max(0,h-d)),disabled:0===h,children:[(0,ep.jsx)(eS,{className:"w-4 h-4 mr-1"}),"Previous"]}),(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",onClick:()=>N(h+d),disabled:h+d>=r,children:["Next",(0,ep.jsx)(eT.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,ep.jsx)(tH.Dialog,{open:y,onOpenChange:b,children:(0,ep.jsxs)(tH.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsx)(tH.DialogHeader,{children:(0,ep.jsxs)(tH.DialogTitle,{children:["Audit Log: ",v?.action]})}),v&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Action:"})," ",(0,ep.jsx)("span",{className:"font-medium",children:v.action})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Transport:"})," ",(0,ep.jsx)(HA,{transport:v.transport})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Started:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:HT(v.started_at)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:HS(v.started_at,v.ended_at)})]})]}),v.request&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Request"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.request,null,2)})]}),v.response&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Response"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.response,null,2)})]}),v.metadata&&Object.keys(v.metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:JSON.stringify(v.metadata,null,2)})]})]})]})})]}):null}let HP=(0,eN.default)("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"}]]);var tV=tV;e.s(["default",0,function(){(0,eg.useParams)();let e=(0,eg.useRouter)(),t=(0,eg.useSearchParams)(),{features:n}=(0,ew.useFeatures)(),{currentBank:r,setCurrentBank:i,loadBanks:a}=(0,ey.useBank)(),o=t.get("view")||"profile",s=t.get("subTab")||"world",l=t.get("bankConfigTab")||"general",c=n?.observations??!1,u=n?.bank_config_api??!1,[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(!1),[k,E]=(0,em.useState)(!1),[C,_]=(0,em.useState)(!1),S=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=data&subTab=${t}`))},T=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=profile&bankConfigTab=${t}`))},A=async()=>{if(r){p(!0);try{await eD.client.deleteBank(r),h(!1),i(null),await a(),e.push("/")}catch(e){}finally{p(!1)}}},O=async()=>{if(r){y(!0);try{let e=await eD.client.clearObservations(r);v(!1),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{y(!1)}}},M=async()=>{if(r){_(!0);try{await eD.client.resetBankConfig(r),E(!1)}catch{}finally{_(!1)}}},P=async()=>{if(r){w(!0);try{await eD.client.triggerConsolidation(r)}catch(e){}finally{w(!1)}}},D=async()=>{if(r){N(!0);try{let e=await eD.client.recoverConsolidation(r);ev.toast.success(`Recovered ${e.retried_count} failed ${1===e.retried_count?"memory":"memories"} for re-consolidation`)}catch(e){}finally{N(!1)}}};return(0,ep.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,ep.jsx)(ex.BankSelector,{}),(0,ep.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,ep.jsx)(eP,{currentTab:o,onTabChange:t=>{r&&e.push((0,eb.bankRoute)(r,`?view=${t}`))}}),(0,ep.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:["profile"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Bank Configuration"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Manage bank settings, profile, and operations."})]}),(0,ep.jsxs)(gk,{children:[(0,ep.jsx)(gC,{asChild:!0,children:(0,ep.jsxs)(eL.Button,{variant:"outline",size:"sm",children:["Actions",(0,ep.jsx)(gH,{className:"w-4 h-4 ml-2"})]})}),(0,ep.jsxs)(gz,{align:"end",className:"w-48",children:[(0,ep.jsxs)(gF,{onClick:async()=>{if(r)try{let e=await eD.client.exportBankTemplate(r),t=JSON.stringify(e,null,2);await navigator.clipboard.writeText(t),ev.toast.success("Template copied to clipboard")}catch{ev.toast.error("Failed to export template")}},children:[(0,ep.jsx)(HP,{className:"w-4 h-4 mr-2"}),"Export Template"]}),(0,ep.jsx)(gV,{}),(0,ep.jsxs)(gF,{onClick:P,disabled:b||!c,title:c?void 0:"Observations feature is not enabled",children:[b?(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(pk,{className:"w-4 h-4 mr-2"}),b?"Consolidating...":"Run Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(gF,{onClick:D,disabled:j||!c,title:c?void 0:"Observations feature is not enabled",children:[j?(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(Ur,{className:"w-4 h-4 mr-2"}),j?"Recovering...":"Recover Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(gF,{onClick:()=>v(!0),disabled:!c,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:c?void 0:"Observations feature is not enabled",children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Clear Observations",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(gV,{}),(0,ep.jsxs)(gF,{onClick:()=>E(!0),disabled:!u,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:u?void 0:"Bank Config API is disabled",children:[(0,ep.jsx)(Ur,{className:"w-4 h-4 mr-2"}),"Reset Configuration",!u&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(gV,{}),(0,ep.jsxs)(gF,{onClick:()=>h(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})]})]})]}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>T("general"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"general"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["General","general"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),u&&(0,ep.jsxs)("button",{onClick:()=>T("configuration"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"configuration"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Configuration","configuration"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("webhooks"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"webhooks"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Webhooks","webhooks"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("audit-logs"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"audit-logs"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Audit Logs","audit-logs"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["general"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Overview statistics and background operations for this memory bank."}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(Un,{}),(0,ep.jsx)(Uo,{}),(0,ep.jsx)(jn,{hideReflectFields:!0})]})]}),"configuration"===l&&u&&(0,ep.jsx)("div",{className:"space-y-6",children:(0,ep.jsx)(jN,{})}),"webhooks"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Manage webhook endpoints to receive event notifications from this memory bank."}),(0,ep.jsx)(Ub,{})]}),"audit-logs"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"View audit trail of all operations performed on this memory bank."}),(0,ep.jsx)(HM,{})]})]})]}),"recall"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Analyze memory recall with detailed trace information and retrieval methods."}),(0,ep.jsx)(w7,{})]}),"reflect"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Run an agentic loop that autonomously gathers evidence and reasons through the lens of the bank's disposition to generate contextual responses."}),(0,ep.jsx)(w4,{})]}),"data"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Memories"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"View and explore different types of memories stored in this memory bank."}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>S("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["World Facts","world"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Experience","experience"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("observations"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"observations"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Observations",!c&&(0,ep.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"observations"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("mental-models"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"mental-models"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Mental Models","mental-models"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["world"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Objective facts about the world received from external sources."}),(0,ep.jsx)(fR,{factType:"world"},"world")]}),"experience"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"The bank's own actions, interactions, and first-person experiences."}),(0,ep.jsx)(fR,{factType:"experience"},"experience")]}),"observations"===s&&(c?(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Consolidated knowledge synthesized from facts — patterns, preferences, and learnings that emerge from accumulated evidence."}),(0,ep.jsx)(fR,{factType:"observation"},"observations")]}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-2",children:(0,ep.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ep.jsx)("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),(0,ep.jsx)("path",{d:"M12 8v4"}),(0,ep.jsx)("path",{d:"M12 16h.01"})]})}),(0,ep.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:"Observations Not Enabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-md",children:["Observations consolidation is disabled on this server. Set"," ",(0,ep.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_ENABLE_OBSERVATIONS=true"})," ","to enable."]})]})),"mental-models"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"User-curated summaries generated from queries — reusable knowledge snapshots that can be refreshed as memories evolve."}),(0,ep.jsx)(Ul,{},"mental-models")]})]})]}),"documents"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Documents"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Manage documents and retain new memories."}),(0,ep.jsx)(pu,{})]}),"entities"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Entities"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Explore entities (people, organizations, places) mentioned in memories."}),(0,ep.jsx)(pd,{})]})]})})]}),(0,ep.jsx)(fY,{open:d,onOpenChange:h,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Delete Memory Bank"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:f,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:A,disabled:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:f?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(fY,{open:k,onOpenChange:E,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Reset Configuration"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to reset all configuration overrides for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"All per-bank settings (retain, observations, reflect) will revert to server defaults. This does not affect memories, entities, or the bank profile."})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:C,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:M,disabled:C,children:C?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Resetting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(Ur,{className:"w-4 h-4 mr-2"}),"Reset Configuration"]})})]})]})}),(0,ep.jsx)(fY,{open:g,onOpenChange:v,children:(0,ep.jsxs)(f7,{children:[(0,ep.jsxs)(f9,{children:[(0,ep.jsx)(pt,{children:"Clear Observations"}),(0,ep.jsx)(pn,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."})]})})]}),(0,ep.jsxs)(pe,{children:[(0,ep.jsx)(pi,{disabled:x,children:"Cancel"}),(0,ep.jsx)(pr,{onClick:O,disabled:x,className:"bg-amber-500 text-white hover:bg-amber-600",children:x?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tV.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pa,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})})]})}],37578)}]);