From 8d9069d8f61029a53db2bea1aca477e3996b5443 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Sun, 6 Sep 2026 22:26:24 -0700 Subject: [PATCH 1/3] feat(ui): a screen for connecting telemetry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed in as an administrator, nothing in the product said where to send telemetry or how to authenticate. The endpoint and token were shown once during first-run setup and were unreachable afterwards, so anyone who liked what they saw could not take the next step and point their own collector at it. The capability was already there — GET /api/settings/ingest and the admin-gated rotate endpoint have existed all along, with an audit event. What was missing was any way to reach them. Connect telemetry states the endpoint and the header, then gives the collector block with this instance's own endpoint already in it and the token left as ${FANOUT_INGEST_TOKEN}, because a secret pasted into a config file is a secret in version control. The token section says what is true — only the hash is stored, so an existing token cannot be shown — and offers rotation behind a confirmation that names the consequence: any collector still sending with the old token is rejected until it is updated. The new token is revealed once. A viewer sees the connection details and the configuration, since every role can read ingest metadata; only an administrator sees the rotate control. An instance with no token yet says it is rejecting telemetry and offers to issue one, rather than showing an empty card. Reported in #232 (P1 item 6). Claude-Session: https://claude.ai/code/session_017ovmTezqzvxVP8P9MGDQNk --- internal/ui/dist/assets/Tooltip-BJiO7C_G.js | 1 + .../dist/assets/WarningCircle.es-DDq2AFnK.js | 1 + internal/ui/dist/assets/api-Be5Lq4YA.js | 41 +++++ internal/ui/dist/assets/auth-BeUORN-q.js | 1 + internal/ui/dist/assets/auth-DNoFbJyG.js | 1 - .../{chat-B0CA6UcR.js => chat-DuN0TFYv.js} | 6 +- .../ui/dist/assets/chat._threadId-DjTlEgB5.js | 1 - .../ui/dist/assets/chat._threadId-DvqxaiRx.js | 1 + .../ui/dist/assets/chat.index-DjTlEgB5.js | 1 - .../ui/dist/assets/chat.index-DvqxaiRx.js | 1 + internal/ui/dist/assets/copy-Bzg2uCpz.js | 1 + internal/ui/dist/assets/copy-tlUaIRYM.js | 1 - ...oard-BdaKmdJW.js => dashboard-7dM548yK.js} | 32 ++-- ...js => dashboards._dashboardId-DT7kwfWv.js} | 2 +- .../dist/assets/dashboards.index-DZaR38po.js | 1 - .../dist/assets/dashboards.index-Ds_9_kmf.js | 1 + .../{index-BDUrV3R6.js => index-DGL83-Oj.js} | 8 +- ...-DQwCEkc1.js => mcp-app-frame-BZJusU6-.js} | 2 +- .../ui/dist/assets/preload-helper-BL3qEkUh.js | 1 + .../ui/dist/assets/preload-helper-xxyQ8-YB.js | 1 - ...{routes-wwkRMEW5.js => routes-D1xQhcK4.js} | 2 +- internal/ui/dist/assets/settings-D0Y7fLFc.js | 16 ++ internal/ui/dist/assets/tokens-6to9Eext.js | 41 ----- internal/ui/dist/assets/tokens-CvbGYJRX.js | 1 + internal/ui/dist/index.html | 10 +- ui/host/src/routeTree.gen.ts | 21 +++ ui/host/src/routes/settings.tsx | 6 + ui/host/src/settings.test.tsx | 96 ++++++++++ ui/host/src/settings.tsx | 173 ++++++++++++++++++ ui/host/src/shell.tsx | 18 +- ui/links.ts | 13 ++ 31 files changed, 422 insertions(+), 80 deletions(-) create mode 100644 internal/ui/dist/assets/Tooltip-BJiO7C_G.js create mode 100644 internal/ui/dist/assets/WarningCircle.es-DDq2AFnK.js create mode 100644 internal/ui/dist/assets/api-Be5Lq4YA.js create mode 100644 internal/ui/dist/assets/auth-BeUORN-q.js delete mode 100644 internal/ui/dist/assets/auth-DNoFbJyG.js rename internal/ui/dist/assets/{chat-B0CA6UcR.js => chat-DuN0TFYv.js} (83%) delete mode 100644 internal/ui/dist/assets/chat._threadId-DjTlEgB5.js create mode 100644 internal/ui/dist/assets/chat._threadId-DvqxaiRx.js delete mode 100644 internal/ui/dist/assets/chat.index-DjTlEgB5.js create mode 100644 internal/ui/dist/assets/chat.index-DvqxaiRx.js create mode 100644 internal/ui/dist/assets/copy-Bzg2uCpz.js delete mode 100644 internal/ui/dist/assets/copy-tlUaIRYM.js rename internal/ui/dist/assets/{dashboard-BdaKmdJW.js => dashboard-7dM548yK.js} (55%) rename internal/ui/dist/assets/{dashboards._dashboardId-8CsBOcHC.js => dashboards._dashboardId-DT7kwfWv.js} (53%) delete mode 100644 internal/ui/dist/assets/dashboards.index-DZaR38po.js create mode 100644 internal/ui/dist/assets/dashboards.index-Ds_9_kmf.js rename internal/ui/dist/assets/{index-BDUrV3R6.js => index-DGL83-Oj.js} (89%) rename internal/ui/dist/assets/{mcp-app-frame-DQwCEkc1.js => mcp-app-frame-BZJusU6-.js} (99%) create mode 100644 internal/ui/dist/assets/preload-helper-BL3qEkUh.js delete mode 100644 internal/ui/dist/assets/preload-helper-xxyQ8-YB.js rename internal/ui/dist/assets/{routes-wwkRMEW5.js => routes-D1xQhcK4.js} (69%) create mode 100644 internal/ui/dist/assets/settings-D0Y7fLFc.js delete mode 100644 internal/ui/dist/assets/tokens-6to9Eext.js create mode 100644 internal/ui/dist/assets/tokens-CvbGYJRX.js create mode 100644 ui/host/src/routes/settings.tsx create mode 100644 ui/host/src/settings.test.tsx create mode 100644 ui/host/src/settings.tsx create mode 100644 ui/links.ts diff --git a/internal/ui/dist/assets/Tooltip-BJiO7C_G.js b/internal/ui/dist/assets/Tooltip-BJiO7C_G.js new file mode 100644 index 000000000..a0564b9a7 --- /dev/null +++ b/internal/ui/dist/assets/Tooltip-BJiO7C_G.js @@ -0,0 +1 @@ +import{$ as e,C as t,K as n,N as r,Q as i,St as a,X as o,Y as s,at as c,dt as l,et as u,gt as d,ht as f,j as p,k as m,mt as h,nt as g,v as _,x as v,z as y}from"./brand-MzZ03bSa.js";var b=a(f(),1),x=h(),S=a(d(),1);function C(e){return Array.isArray(e)||e===null?!1:typeof e==`object`&&e.type!==S.Fragment}function w(e){let t=(0,S.createContext)(null);return[t,()=>{let n=(0,S.use)(t);if(n===null)throw Error(e);return n}]}var T={app:100,modal:200,popover:300,overlay:400,max:9999};function E(e){return T[e]}function D(e){let t=(0,S.useRef)(e);return(0,S.useEffect)(()=>{t.current=e}),(0,S.useMemo)(()=>((...e)=>t.current?.(...e)),[])}function O(e,t){let{delay:n,flushOnUnmount:r,leading:i,maxWait:a}=typeof t==`number`?{delay:t,flushOnUnmount:!1,leading:!1,maxWait:void 0}:t,o=D(e),s=(0,S.useRef)(0),c=(0,S.useRef)(0),l=(0,S.useRef)(null),u=(0,S.useMemo)(()=>{let e=Object.assign((...t)=>{window.clearTimeout(s.current),l.current=t;let r=e._isFirstCall;e._isFirstCall=!1;function u(){window.clearTimeout(s.current),window.clearTimeout(c.current),s.current=0,c.current=0,e._isFirstCall=!0,e._hasPendingCallback=!1}function d(){a!==void 0&&c.current===0&&(c.current=window.setTimeout(()=>{if(s.current!==0){let e=l.current;u(),o(...e)}},a))}if(i&&r){o(...t),e.flush=()=>{s.current!==0&&(u(),o(...t))},e.cancel=()=>{u()},s.current=window.setTimeout(()=>{u()},n),d();return}if(i&&!r){e._hasPendingCallback=!0,e.flush=()=>{s.current!==0&&(u(),o(...t))},e.cancel=()=>{u()},s.current=window.setTimeout(()=>{u()},n),d();return}e._hasPendingCallback=!0;let f=()=>{s.current!==0&&(u(),o(...t))};e.flush=f,e.cancel=()=>{u()},s.current=window.setTimeout(f,n),d()},{flush:()=>{},cancel:()=>{},isPending:()=>e._hasPendingCallback,_isFirstCall:!0,_hasPendingCallback:!1});return e},[o,n,i,a]);return(0,S.useEffect)(()=>()=>{r?u.flush():u.cancel()},[u,r]),u}function k(e){return e?.props?.ref}function A(e){let t=S.Children.toArray(e);return t.length!==1||!C(t[0])?null:t[0]}function j(e,t){return Array.isArray(e)?[...e].reduce((e,n)=>({...e,...j(n,t)}),{}):typeof e==`function`?e(t):e??{}}var M=(0,S.createContext)({dir:`ltr`,toggleDirection:()=>{},setDirection:()=>{}});function N(){return(0,S.use)(M)}var[P,F]=w(`ScrollArea.Root component was not found in tree`);function I(e,t){let n=(0,S.useEffectEvent)(t);g(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e])}function ee(e){let{style:t,...n}=e,r=F(),[i,a]=(0,S.useState)(0),[o,s]=(0,S.useState)(0),c=!!(i&&o);return I(r.scrollbarX,()=>{let e=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(e),s(e)}),I(r.scrollbarY,()=>{let e=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(e),a(e)}),c?(0,x.jsx)(`div`,{...n,style:{...t,width:i,height:o}}):null}function te(e){let t=F(),n=!!(t.scrollbarX&&t.scrollbarY);return t.type!==`scroll`&&n?(0,x.jsx)(ee,{...e}):null}var ne={scrollHideDelay:1e3,type:`hover`};function re(t){let{type:n,scrollHideDelay:r,scrollbars:i,getStyles:a,ref:o,...s}=p(`ScrollAreaRoot`,ne,t),[c,l]=(0,S.useState)(null),[u,d]=(0,S.useState)(null),[f,m]=(0,S.useState)(null),[h,g]=(0,S.useState)(null),[_,y]=(0,S.useState)(null),[b,C]=(0,S.useState)(0),[w,T]=(0,S.useState)(0),[E,D]=(0,S.useState)(!1),[O,k]=(0,S.useState)(!1),A=e(o,l);return(0,x.jsx)(P,{value:{type:n,scrollHideDelay:r,scrollArea:c,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:E,onScrollbarXEnabledChange:D,scrollbarY:_,onScrollbarYChange:y,scrollbarYEnabled:O,onScrollbarYEnabledChange:k,onCornerWidthChange:C,onCornerHeightChange:T,getStyles:a},children:(0,x.jsx)(v,{...s,ref:A,__vars:{"--sa-corner-width":i===`xy`?`${b}px`:`0px`,"--sa-corner-height":i===`xy`?`${w}px`:`0px`}})})}re.displayName=`@mantine/core/ScrollAreaRoot`;function ie(e,t){let n=e/t;return Number.isNaN(n)?0:n}function ae(e){let t=ie(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function oe(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function L(e,[t,n]){return Math.min(n,Math.max(t,e))}function se(e,t,n=`ltr`){let r=ae(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=L(e,n===`ltr`?[0,o]:[o*-1,0]);return oe([0,o],[0,s])(c)}function ce(e,t,n,r=`ltr`){let i=ae(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return oe([c,l],d)(e)}function le(e,t){return e>0&&e{e?.(r),(n===!1||!r.defaultPrevented)&&t?.(r)}}var[de,fe]=w(`ScrollAreaScrollbar was not found in tree`);function pe(t){let{sizes:n,hasThumb:r,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:s,onDragScroll:c,onWheelScroll:l,onResize:u,ref:d,...f}=t,p=F(),[m,h]=(0,S.useState)(null),g=e(d,h),_=(0,S.useRef)(null),v=(0,S.useRef)(``),{viewport:y}=p,b=n.content-n.viewport,C=(0,S.useEffectEvent)(l),w=D(s),T=O(u,10),E=e=>{if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;c({x:t,y:n})}};return(0,S.useEffect)(()=>{let e=e=>{let t=e.target;m?.contains(t)&&C(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b]),(0,S.useEffect)(w,[n,w]),I(m,T),I(p.content,T),(0,x.jsx)(de,{value:{scrollbar:m,hasThumb:r,onThumbChange:D(i),onThumbPointerUp:D(a),onThumbPositionChange:w,onThumbPointerDown:D(o)},children:(0,x.jsx)(`div`,{...f,ref:g,"data-mantine-scrollbar":!0,style:{position:`absolute`,...f.style},onPointerDown:R(t.onPointerDown,e=>{e.preventDefault(),e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,E(e))}),onPointerMove:R(t.onPointerMove,E),onPointerUp:R(t.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(e.preventDefault(),t.releasePointerCapture(e.pointerId))}),onLostPointerCapture:()=>{document.body.style.webkitUserSelect=v.current,_.current=null}})})}var me=t=>{let{sizes:n,onSizesChange:r,style:i,ref:a,...o}=t,s=F(),[c,l]=(0,S.useState)(),u=(0,S.useRef)(null),d=e(a,u,s.onScrollbarXChange);return(0,S.useEffect)(()=>{u.current&&l(getComputedStyle(u.current))},[u]),(0,x.jsx)(pe,{"data-orientation":`horizontal`,...o,ref:d,sizes:n,style:{...i,"--sa-thumb-width":`${ae(n)}px`},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,n)=>{if(s.viewport){let r=s.viewport.scrollLeft+e.deltaX;t.onWheelScroll(r),le(r,n)&&e.preventDefault()}},onResize:()=>{u.current&&s.viewport&&c&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:ue(c.paddingLeft),paddingEnd:ue(c.paddingRight)}})}})};me.displayName=`@mantine/core/ScrollAreaScrollbarX`;function he(t){let{sizes:n,onSizesChange:r,style:i,ref:a,...o}=t,s=F(),[c,l]=(0,S.useState)(),u=(0,S.useRef)(null),d=e(a,u,s.onScrollbarYChange);return(0,S.useEffect)(()=>{u.current&&l(window.getComputedStyle(u.current))},[]),(0,x.jsx)(pe,{...o,"data-orientation":`vertical`,ref:d,sizes:n,style:{"--sa-thumb-height":`${ae(n)}px`,...i},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,n)=>{if(s.viewport){let r=s.viewport.scrollTop+e.deltaY;t.onWheelScroll(r),le(r,n)&&e.preventDefault()}},onResize:()=>{u.current&&s.viewport&&c&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:ue(c.paddingTop),paddingEnd:ue(c.paddingBottom)}})}})}he.displayName=`@mantine/core/ScrollAreaScrollbarY`;function z(e){let{orientation:t=`vertical`,...n}=e,{dir:r}=N(),i=F(),a=(0,S.useRef)(null),o=(0,S.useRef)(0),[s,c]=(0,S.useState)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=ie(s.viewport,s.content),u={...n,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>{a.current=e},onThumbPointerUp:()=>{o.current=0},onThumbPointerDown:e=>{o.current=e}},d=(e,t)=>ce(e,o.current,s,t);return t===`horizontal`?(0,x.jsx)(me,{...u,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=se(e,s,r);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,r))}}):t===`vertical`?(0,x.jsx)(he,{...u,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=se(e,s);s.scrollbar.size===0?a.current.style.setProperty(`--thumb-opacity`,`0`):a.current.style.setProperty(`--thumb-opacity`,`1`),a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}z.displayName=`@mantine/core/ScrollAreaScrollbarVisible`;function ge(e){let t=F(),{forceMount:n,...r}=e,[i,a]=(0,S.useState)(!1),o=e.orientation===`horizontal`,s=O(()=>{if(t.viewport){let e=t.viewport.offsetWidth{let{scrollArea:e}=r,t=0;if(e){let n=()=>{window.clearTimeout(t),a(!0)},i=()=>{t=window.setTimeout(()=>a(!1),r.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,i),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,i)}}},[r.scrollArea,r.scrollHideDelay]),t||i?(0,x.jsx)(ge,{"data-state":i?`visible`:`hidden`,...n}):null}_e.displayName=`@mantine/core/ScrollAreaScrollbarHover`;function ve(e){let{forceMount:t,...n}=e,r=F(),i=e.orientation===`horizontal`,[a,o]=(0,S.useState)(`hidden`),s=O(()=>o(`idle`),100);return(0,S.useEffect)(()=>{if(a===`idle`){let e=window.setTimeout(()=>o(`hidden`),r.scrollHideDelay);return()=>window.clearTimeout(e)}},[a,r.scrollHideDelay]),(0,S.useEffect)(()=>{let{viewport:e}=r,t=i?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(o(`scrolling`),s()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[r.viewport,i,s]),t||a!==`hidden`?(0,x.jsx)(z,{"data-state":a===`hidden`?`hidden`:`visible`,...n,onPointerEnter:R(e.onPointerEnter,()=>o(`interacting`)),onPointerLeave:R(e.onPointerLeave,()=>o(`idle`))}):null}function ye(e){let{forceMount:t,...n}=e,r=F(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=r,o=e.orientation===`horizontal`;return(0,S.useEffect)(()=>(o?i(!0):a(!0),()=>{o?i(!1):a(!1)}),[o,i,a]),r.type===`hover`?(0,x.jsx)(_e,{...n,forceMount:t}):r.type===`scroll`?(0,x.jsx)(ve,{...n,forceMount:t}):r.type===`auto`?(0,x.jsx)(ge,{...n,forceMount:t}):r.type===`always`?(0,x.jsx)(z,{...n}):null}ye.displayName=`@mantine/core/ScrollAreaScrollbar`;function B(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)}function be(t){let{style:n,ref:r,...i}=t,a=F(),o=fe(),{onThumbPositionChange:s}=o,c=e(r,o.onThumbChange),l=(0,S.useRef)(void 0),u=O(()=>{l.current&&=(l.current(),void 0)},100);return(0,S.useEffect)(()=>{let{viewport:e}=a;if(e){let t=()=>{if(u(),!l.current){let t=B(e,s);l.current=t,s()}};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,x.jsx)(`div`,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--sa-thumb-width)`,height:`var(--sa-thumb-height)`,...n},onPointerDownCapture:R(t.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:R(t.onPointerUp,o.onThumbPointerUp)})}be.displayName=`@mantine/core/ScrollAreaThumb`;function xe(e){let{forceMount:t,...n}=e,r=fe();return t||r.hasThumb?(0,x.jsx)(be,{...n}):null}xe.displayName=`@mantine/core/ScrollAreaThumb`;function Se({children:t,style:n,ref:r,onWheel:i,...a}){let o=F(),s=e(r,o.onViewportChange),c=e=>{if(i?.(e),o.scrollbarXEnabled&&o.viewport&&e.shiftKey){let{scrollTop:t,scrollHeight:n,clientHeight:r,scrollWidth:i,clientWidth:a}=o.viewport,s=t<1,c=t>=n-r-1;i>a&&(s||c)&&e.stopPropagation()}};return(0,x.jsx)(v,{...a,ref:s,onWheel:c,"data-scrollarea-viewport":!0,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...n},children:(0,x.jsx)(`div`,{...o.getStyles(`content`),ref:o.onContentChange,children:t})})}Se.displayName=`@mantine/core/ScrollAreaViewport`;var Ce={root:`m_d57069b5`,content:`m_b1336c6`,viewport:`m_c0783ff9`,viewportInner:`m_f8f631dd`,scrollbar:`m_c44ba933`,thumb:`m_d8b5e363`,corner:`m_21657268`};function we(){return typeof window<`u`}function Te(e){return Ee(e)?(e.nodeName||``).toLowerCase():`#document`}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function H(e){return((Ee(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ee(e){return we()?e instanceof Node||e instanceof V(e).Node:!1}function U(e){return we()?e instanceof Element||e instanceof V(e).Element:!1}function W(e){return we()?e instanceof HTMLElement||e instanceof V(e).HTMLElement:!1}function De(e){return!we()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}function Oe(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=G(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ke(e){return/^(table|td|th)$/.test(Te(e))}function Ae(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var je=/transform|translate|scale|rotate|perspective|filter/,Me=/paint|layout|strict|content/,Ne=e=>!!e&&e!==`none`,Pe;function Fe(e){let t=U(e)?G(e):e;return Ne(t.transform)||Ne(t.translate)||Ne(t.scale)||Ne(t.rotate)||Ne(t.perspective)||!Le()&&(Ne(t.backdropFilter)||Ne(t.filter))||je.test(t.willChange||``)||Me.test(t.contain||``)}function Ie(e){let t=Be(e);for(;W(t)&&!Re(t);){if(Fe(t))return t;if(Ae(t))return null;t=Be(t)}return null}function Le(){return Pe??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Pe}function Re(e){return/^(html|body|#document)$/.test(Te(e))}function G(e){return V(e).getComputedStyle(e)}function ze(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Be(e){if(Te(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||De(e)&&e.host||H(e);return De(t)?t.host:t}function Ve(e){let t=Be(e);return Re(t)?(e.ownerDocument||e).body:W(t)&&Oe(t)?t:Ve(t)}function He(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ve(e),i=r===e.ownerDocument?.body,a=V(r);if(i){let e=Ue(a);return t.concat(a,a.visualViewport||[],Oe(r)?r:[],e&&n?He(e):[])}return t.concat(r,He(r,[],n))}function Ue(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var We=[`top`,`right`,`bottom`,`left`],K=Math.min,q=Math.max,Ge=Math.round,Ke=Math.floor,qe=e=>({x:e,y:e}),Je={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ye(e,t,n){return q(e,K(t,n))}function J(e,t){return typeof e==`function`?e(t):e}function Y(e){return e.split(`-`)[0]}function Xe(e){return e.split(`-`)[1]}function Ze(e){return e===`x`?`y`:`x`}function Qe(e){return e===`y`?`height`:`width`}function X(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $e(e){return Ze(X(e))}function et(e,t,n){n===void 0&&(n=!1);let r=Xe(e),i=$e(e),a=Qe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=lt(o)),[o,lt(o)]}function tt(e){let t=lt(e);return[nt(e),t,nt(t)]}function nt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rt=[`left`,`right`],it=[`right`,`left`],at=[`top`,`bottom`],ot=[`bottom`,`top`];function st(e,t,n){switch(e){case`top`:case`bottom`:return n?t?it:rt:t?rt:it;case`left`:case`right`:return t?at:ot;default:return[]}}function ct(e,t,n,r){let i=Xe(e),a=st(Y(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nt)))),a}function lt(e){let t=Y(e);return Je[t]+e.slice(t.length)}function ut(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function dt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ut(e)}function ft(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pt(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function mt(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function ht(){return/apple/i.test(navigator.vendor)}function gt(){return pt().toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints}function _t(){return mt().includes(`jsdom/`)}var vt=`data-floating-ui-focusable`,yt=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function bt(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function xt(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&De(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function St(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Ct(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function wt(e){return e.matches(`html,body`)}function Tt(e){return e?.ownerDocument||document}function Et(e){return W(e)&&e.matches(yt)}function Dt(e){if(!e||_t())return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Ot(e){return e?e.hasAttribute(vt)?e:e.querySelector(`[`+vt+`]`)||e:null}function kt(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...kt(e,t.id,n)])}function At(e){return`nativeEvent`in e}function jt(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var Z=typeof document<`u`?S.useLayoutEffect:function(){},Mt={...S};function Nt(e){let t=S.useRef(e);return Z(()=>{t.current=e}),t}var Pt=Mt.useInsertionEffect||(e=>e());function Q(e){let t=S.useRef(()=>{});return Pt(()=>{t.current=e}),S.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Ft(e,t,n){let{reference:r,floating:i}=e,a=X(t),o=$e(t),s=Qe(o),c=Y(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Xe(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function It(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=J(t,e),p=dt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ft(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ft(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Lt=50,Rt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:It},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ft(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=J(e,t)||{};if(l==null)return{};let d=dt(u),f={x:n,y:r},p=$e(i),m=Qe(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=K(d[_],T),D=K(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Ye(E,k,O),j=!c.arrow&&Xe(i)!=null&&k!==A&&a.reference[m]/2-(ke<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===X(t)||T.every(e=>X(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=X(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Vt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ht(e){return We.some(t=>e[t]>=0)}var Ut=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=J(e,t);switch(i){case`referenceHidden`:{let e=Vt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ht(e)}}}case`escaped`:{let e=Vt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ht(e)}}}default:return{}}}}};function Wt(e){let t=K(...e.map(e=>e.left)),n=K(...e.map(e=>e.top)),r=q(...e.map(e=>e.right)),i=q(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function Gt(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;er.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>ft(Wt(e)))}var Kt=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:a,strategy:o}=t,{padding:s=2,x:c,y:l}=J(e,t),u=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]);if(!u.length)return{};let d=Gt(u),f=ft(Wt(u)),p=dt(s);function m(){if(d.length===2&&(d[0].left>d[1].right||d[1].left>d[0].right)&&c!=null&&l!=null)return d.find(e=>c>e.left-p.left&&ce.top-p.top&&l=2){if(X(n)===`y`){let e=d[0],t=d[d.length-1],r=Y(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left;return ft({x:o,y:i,width:(r?e.right:t.right)-o,height:a-i})}let e=Y(n)===`left`,t=q(...d.map(e=>e.right)),r=K(...d.map(e=>e.left)),i=d.filter(n=>e?n.left===r:n.right===t),a=i[0].top,o=i[i.length-1].bottom;return ft({x:r,y:a,width:t-r,height:o-a})}return f}let h=await a.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},qt=new Set([`left`,`top`]);async function Jt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Y(n),s=Xe(n),c=X(n)===`y`,l=qt.has(o)?-1:1,u=a&&c?-1:1,d=J(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Yt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Jt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Xt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=J(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=X(i),p=Ze(f),m=u[p],h=u[f],g=(e,t)=>Ye(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Zt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=J(e,t),u={x:n,y:r},d=X(i),f=Ze(d),p=u[f],m=u[d],h=J(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=qt.has(Y(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},Qt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=J(e,t),c=await i.detectOverflow(t,s),l=Y(n),u=Xe(n),d=X(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=K(p-c[m],g),y=K(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*q(c.left,c.right):S=p-2*q(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function $t(e){let t=G(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=W(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ge(n)!==a||Ge(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function en(e){return U(e)?e:e.contextElement}function tn(e){let t=en(e);if(!W(t))return qe(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$t(t),o=(a?Ge(n.width):n.width)/r,s=(a?Ge(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var nn=qe(0);function rn(e){let t=V(e);return!Le()||!t.visualViewport?nn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function an(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===V(e)}function on(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=en(e),o=qe(1);t&&(r?U(r)&&(o=tn(r)):o=tn(e));let s=an(a,n,r)?rn(a):qe(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=V(a),t=U(r)?V(r):r,n=e,i=Ue(n);for(;i&&t!==n;){let e=tn(i),t=i.getBoundingClientRect(),r=G(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=V(i),i=Ue(n)}}return ft({width:u,height:d,x:c,y:l})}function sn(e,t){let n=ze(e).scrollLeft;return t?t.left+n:on(H(e)).left+n}function cn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-sn(e,n),y:n.top+t.scrollTop}}function ln(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=H(r),s=t?Ae(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=qe(1),u=qe(0),d=W(r);if((d||!a)&&((Te(r)!==`body`||Oe(o))&&(c=ze(r)),d)){let e=on(r);l=tn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?cn(o,c):qe(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function un(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function dn(e){let t=ze(e),n=e.ownerDocument.body,r=q(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=q(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+sn(e),o=-t.scrollTop;return G(n).direction===`rtl`&&(a+=q(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var fn=25;function pn(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=V(e),a=H(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Le()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(sn(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=fn&&(s-=o)}return{width:s,height:c,x:l,y:u}}function mn(e,t){let n=on(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=tn(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function hn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=pn(e,n,t);else if(t===`document`)r=dn(H(e));else if(U(t))r=mn(t,n);else{let n=rn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ft(r)}function gn(e,t){let n=t.get(e);if(n)return n;let r=He(e,[],!1).filter(e=>U(e)&&Te(e)!==`body`),i=null,a=G(e).position===`fixed`,o=a?Be(e):e;for(;U(o)&&!Re(o);){let e=G(o),t=Fe(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Be(o)}return t.set(e,r),r}function _n(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ae(t)?[]:gn(t,this._c):[].concat(n),r],o=hn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=V(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function On(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=en(e),u=i||a?[...l?He(l):[],...t?He(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Dn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?on(e):null;c&&g();function g(){let t=on(e);h&&!En(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var kn=Yt,An=Xt,jn=Bt,Mn=Qt,Nn=Ut,Pn=zt,Fn=Kt,In=Zt,Ln=(e,t,n)=>{let r=new Map,i=n??{},a={...Tn,...i.platform,_c:r};return Rt(e,t,{...i,platform:a})},Rn=typeof document<`u`?S.useLayoutEffect:function(){};function zn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!zn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!zn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Bn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vn(e,t){let n=Bn(e);return Math.round(t*n)/n}function Hn(e){let t=S.useRef(e);return Rn(()=>{t.current=e}),t}function Un(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=S.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=S.useState(r);zn(f,r)||p(r);let[m,h]=S.useState(null),[g,_]=S.useState(null),v=S.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),y=S.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),x=a||m,C=o||g,w=S.useRef(null),T=S.useRef(null),E=S.useRef(u),D=c!=null,O=Hn(c),k=Hn(i),A=Hn(l),j=S.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),Ln(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!zn(E.current,t)&&(E.current=t,b.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Rn(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=S.useRef(!1);Rn(()=>(M.current=!0,()=>{M.current=!1}),[]),Rn(()=>{if(x&&(w.current=x),C&&(T.current=C),x&&C){if(O.current)return O.current(x,C,j);j()}},[x,C,j,O,D]);let N=S.useMemo(()=>({reference:w,floating:T,setReference:v,setFloating:y}),[v,y]),P=S.useMemo(()=>({reference:x,floating:C}),[x,C]),F=S.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Vn(P.floating,u.x),r=Vn(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Bn(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return S.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Wn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Pn({element:r.current,padding:i}).fn(n):r?Pn({element:r,padding:i}).fn(n):{}}}},Gn=(e,t)=>{let n=kn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kn=(e,t)=>{let n=An(e);return{name:n.name,fn:n.fn,options:[e,t]}},qn=(e,t)=>({fn:In(e).fn,options:[e,t]}),Jn=(e,t)=>{let n=jn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yn=(e,t)=>{let n=Mn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xn=(e,t)=>{let n=Nn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zn=(e,t)=>{let n=Fn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qn=(e,t)=>{let n=Wn(e);return{name:n.name,fn:n.fn,options:[e,t]}};function $n(e){let t=S.useRef(void 0),n=S.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return S.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}var er=`data-floating-ui-focusable`,tr=`active`,nr=`selected`,rr=`ArrowLeft`,ir=`ArrowRight`,ar=`ArrowUp`,or=`ArrowDown`,sr=[rr,ir],cr=[ar,or];[...sr,...cr];var lr={...S},ur=!1,dr=0,fr=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+dr++;function pr(){let[e,t]=S.useState(()=>ur?fr():void 0);return Z(()=>{e??t(fr())},[]),S.useEffect(()=>{ur=!0},[]),e}var mr=lr.useId||pr;function hr(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var gr=S.createContext(null),_r=S.createContext(null),vr=()=>S.useContext(gr)?.id||null,yr=()=>S.useContext(_r);function br(e){return`data-floating-ui-`+e}function $(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var xr=br(`safe-polygon`);function Sr(e,t,n){if(n&&!jt(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function Cr(e){return typeof e==`function`?e():e}function wr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,p=yr(),m=vr(),h=Nt(l),g=Nt(c),_=Nt(n),v=Nt(d),y=S.useRef(),b=S.useRef(-1),x=S.useRef(),C=S.useRef(-1),w=S.useRef(!0),T=S.useRef(!1),E=S.useRef(()=>{}),D=S.useRef(!1),O=Q(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});S.useEffect(()=>{if(!s)return;function e(e){let{open:t}=e;t||($(b),$(C),w.current=!0,D.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),S.useEffect(()=>{if(!s||!h.current||!n)return;function e(e){O()&&r(!1,e,`hover`)}let t=Tt(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,O]);let k=S.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Sr(g.current,`close`,y.current);i&&!x.current?($(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&($(b),r(!1,e,n))},[g,r]),A=Q(()=>{E.current(),x.current=void 0}),j=Q(()=>{if(T.current){let e=Tt(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(xr),T.current=!1}}),M=Q(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);S.useEffect(()=>{if(!s)return;function e(e){if($(b),w.current=!1,u&&!jt(y.current)||Cr(v.current)>0&&!Sr(g.current,`open`))return;let t=Sr(g.current,`open`,y.current);t?b.current=window.setTimeout(()=>{_.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(M()){j();return}E.current();let t=Tt(o.floating);if($(C),D.current=!1,h.current&&i.current.floatingContext){n||$(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){j(),A(),M()||k(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),E.current=()=>{t.removeEventListener(`mousemove`,r)};return}(y.current!==`touch`||!xt(o.floating,e.relatedTarget))&&k(e)}function a(e){M()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){j(),A(),M()||k(e)}})(e))}function c(){$(b)}function l(e){M()||k(e,!1)}if(U(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),f&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,c),i.addEventListener(`mouseleave`,l)),()=>{n&&r.removeEventListener(`mouseleave`,a),f&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,c),i.removeEventListener(`mouseleave`,l))}}},[o,s,e,u,f,k,A,j,r,n,_,p,g,h,i,M,v]),Z(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&O()){T.current=!0;let e=o.floating;if(U(o.domReference)&&e){var t;let n=Tt(o.floating).body;n.setAttribute(xr,``);let r=o.domReference,i=p==null||(t=p.nodesRef.current.find(e=>e.id===m))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,m,o,p,h,O]),Z(()=>{n||(y.current=void 0,D.current=!1,A(),j())},[n,A,j]),S.useEffect(()=>()=>{A(),$(b),$(C),j()},[s,o.domReference,A,j]);let N=S.useMemo(()=>{function e(e){y.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!w.current&&!_.current&&r(!0,t,`hover`)}(!u||jt(y.current))&&(n||Cr(v.current)===0||D.current&&e.movementX**2+e.movementY**2<2||($(C),y.current===`touch`?i():(D.current=!0,C.current=window.setTimeout(i,Cr(v.current)))))}}},[u,r,n,_,v]);return S.useMemo(()=>s?{reference:N}:{},[s,N])}var Tr=()=>{},Er=S.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Tr,setState:Tr,isInstantPhase:!1}),Dr=()=>S.useContext(Er);function Or(e){let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=S.useReducer((e,t)=>({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=S.useRef(null),s=S.useCallback(e=>{a({currentId:e})},[]);return Z(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||a({isInstantPhase:!0}):(i.isInstantPhase&&a({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),(0,x.jsx)(Er.Provider,{value:S.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,s]),children:t})}function kr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,floatingId:i}=e,{id:a,enabled:o=!0}=t,s=a??i,c=Dr(),{currentId:l,setCurrentId:u,initialDelay:d,setState:f,timeoutMs:p}=c;return Z(()=>{o&&l&&(f({delay:{open:1,close:Sr(d,`close`)}}),l!==s&&r(!1))},[o,s,r,f,l,d]),Z(()=>{function e(){r(!1),f({delay:d,currentId:null})}if(o&&l&&!n&&l===s){if(p){let t=window.setTimeout(e,p);return()=>{clearTimeout(t)}}e()}},[o,n,f,l,s,r,d,p]),Z(()=>{o&&u!==Tr&&n&&u(s)},[o,n,u,s]),c}function Ar(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&De(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function jr(e){return`composedPath`in e?e.composedPath()[0]:e.target}var Mr={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Nr={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},Pr=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function Fr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:i,dataRef:a}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`pointerdown`,referencePress:u=!1,referencePressEvent:d=`pointerdown`,ancestorScroll:f=!1,bubbles:p,capture:m}=t,h=yr(),g=Q(typeof c==`function`?c:()=>!1),_=typeof c==`function`?g:c,v=S.useRef(!1),{escapeKey:y,outsidePress:b}=Pr(p),{escapeKey:x,outsidePress:C}=Pr(m),w=S.useRef(!1),T=Q(e=>{if(!n||!o||!s||e.key!==`Escape`||w.current)return;let t=a.current.floatingContext?.nodeId,i=h?kt(h.nodesRef.current,t):[];if(!y&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}r(!1,At(e)?e.nativeEvent:e,`escape-key`)}),E=Q(e=>{var t;let n=()=>{var t;T(e),(t=St(e))==null||t.removeEventListener(`keydown`,n)};(t=St(e))==null||t.addEventListener(`keydown`,n)}),D=Q(e=>{let t=a.current.insideReactTree;a.current.insideReactTree=!1;let n=v.current;if(v.current=!1,l===`click`&&n||t||typeof _==`function`&&!_(e))return;let o=St(e),s=`[`+br(`inert`)+`]`,c=Tt(i.floating).querySelectorAll(s),u=U(o)?o:null;for(;u&&!Re(u);){let e=Be(u);if(Re(e)||!U(e))break;u=e}if(c.length&&U(o)&&!wt(o)&&!xt(o,i.floating)&&Array.from(c).every(e=>!xt(u,e)))return;if(W(o)&&A){let t=Re(o),n=G(o),r=/auto|scroll/,i=t||r.test(n.overflowX),a=t||r.test(n.overflowY),s=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,c=a&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),d=s&&e.offsetY>o.clientHeight;if(u||d)return}let d=a.current.floatingContext?.nodeId,f=h&&kt(h.nodesRef.current,d).some(t=>Ct(e,t.context?.elements.floating));if(Ct(e,i.floating)||Ct(e,i.domReference)||f)return;let p=h?kt(h.nodesRef.current,d):[];if(p.length>0){let e=!0;if(p.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}r(!1,e,`outside-press`)}),O=Q(e=>{var t;let n=()=>{var t;D(e),(t=St(e))==null||t.removeEventListener(l,n)};(t=St(e))==null||t.addEventListener(l,n)});S.useEffect(()=>{if(!n||!o)return;a.current.__escapeKeyBubbles=y,a.current.__outsidePressBubbles=b;let e=-1;function t(e){r(!1,e,`ancestor-scroll`)}function c(){window.clearTimeout(e),w.current=!0}function u(){e=window.setTimeout(()=>{w.current=!1},Le()?5:0)}let d=Tt(i.floating);s&&(d.addEventListener(`keydown`,x?E:T,x),d.addEventListener(`compositionstart`,c),d.addEventListener(`compositionend`,u)),_&&d.addEventListener(l,C?O:D,C);let p=[];return f&&(U(i.domReference)&&(p=He(i.domReference)),U(i.floating)&&(p=p.concat(He(i.floating))),!U(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(He(i.reference.contextElement)))),p=p.filter(e=>e!==d.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t)}),()=>{s&&(d.removeEventListener(`keydown`,x?E:T,x),d.removeEventListener(`compositionstart`,c),d.removeEventListener(`compositionend`,u)),_&&d.removeEventListener(l,C?O:D,C),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[a,i,s,_,l,n,r,f,o,y,b,T,x,E,D,C,O]),S.useEffect(()=>{a.current.insideReactTree=!1},[a,_,l]);let k=S.useMemo(()=>({onKeyDown:T,...u&&{[Mr[d]]:e=>{r(!1,e.nativeEvent,`reference-press`)},...d!==`click`&&{onClick(e){r(!1,e.nativeEvent,`reference-press`)}}}}),[T,r,u,d]),A=S.useMemo(()=>{function e(e){e.button===0&&(v.current=!0)}return{onKeyDown:T,onMouseDown:e,onMouseUp:e,[Nr[l]]:()=>{a.current.insideReactTree=!0}}},[T,l,a]);return S.useMemo(()=>o?{reference:k,floating:A}:{},[o,k,A])}function Ir(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=mr(),a=S.useRef({}),[o]=S.useState(()=>hr()),s=vr()!=null,[c,l]=S.useState(r.reference),u=Q((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=S.useMemo(()=>({setPositionReference:l}),[]),f=S.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return S.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function Lr(e){let{elements:t,...n}=e===void 0?{}:e,{nodeId:r}=n,i=Ir({...n,elements:{reference:t?.reference??null,floating:t?.floating??null}}),a=n.rootContext||i,o=a.elements,[s,c]=S.useState(null),[l,u]=S.useState(null),d=o?.domReference||s,f=S.useRef(null),p=yr();Z(()=>{d&&(f.current=d)},[d]);let m=Un({...n,elements:{...o,...l&&{reference:l}}}),h=S.useCallback(e=>{let t=U(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=S.useCallback(e=>{(U(e)||e===null)&&(f.current=e,c(e)),(U(m.refs.reference.current)||m.refs.reference.current===null||e!==null&&!U(e))&&m.refs.setReference(e)},[m.refs]),_=S.useMemo(()=>({...m.refs,setReference:g,setPositionReference:h,domReference:f}),[m.refs,g,h]),v=S.useMemo(()=>({...m.elements,domReference:d}),[m.elements,d]),y=S.useMemo(()=>({...m,...a,refs:_,elements:v,nodeId:r}),[m,_,v,r,a]);return Z(()=>{a.dataRef.current.floatingContext=y;let e=p?.nodesRef.current.find(e=>e.id===r);e&&(e.context=y)}),S.useMemo(()=>({...m,context:y,refs:_,elements:v}),[m,_,v,y])}function Rr(){return gt()&&ht()}function zr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,events:i,dataRef:a,elements:o}=e,{enabled:s=!0,visibleOnly:c=!0}=t,l=S.useRef(!1),u=S.useRef(-1),d=S.useRef(!0);S.useEffect(()=>{if(!s)return;let e=V(o.domReference);function t(){!n&&W(o.domReference)&&o.domReference===bt(Tt(o.domReference))&&(l.current=!0)}function r(){d.current=!0}function i(){d.current=!1}return e.addEventListener(`blur`,t),Rr()&&(e.addEventListener(`keydown`,r,!0),e.addEventListener(`pointerdown`,i,!0)),()=>{e.removeEventListener(`blur`,t),Rr()&&(e.removeEventListener(`keydown`,r,!0),e.removeEventListener(`pointerdown`,i,!0))}},[o.domReference,n,s]),S.useEffect(()=>{if(!s)return;function e(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(l.current=!0)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[i,s]),S.useEffect(()=>()=>{$(u)},[]);let f=S.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(e){if(l.current)return;let t=St(e.nativeEvent);if(c&&U(t)){if(Rr()&&!e.relatedTarget){if(!d.current&&!Et(t))return}else if(!Dt(t))return}r(!0,e.nativeEvent,`focus`)},onBlur(e){l.current=!1;let t=e.relatedTarget,n=e.nativeEvent,i=U(t)&&t.hasAttribute(br(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;u.current=window.setTimeout(()=>{let e=bt(o.domReference?o.domReference.ownerDocument:document);(t||e!==o.domReference)&&(xt(a.current.floatingContext?.refs.floating.current,e)||xt(o.domReference,e)||i||r(!1,n,`focus`))})}}),[a,o.domReference,r,c]);return S.useMemo(()=>s?{reference:f}:{},[s,f])}function Br(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[tr]:t,[nr]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[er]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[tr,nr].includes(n))){if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}}),e),{})}}function Vr(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=S.useCallback(t=>Br(t,e,`reference`),t),a=S.useCallback(t=>Br(t,e,`floating`),n),o=S.useCallback(t=>Br(t,e,`item`),r);return S.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var Hr=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Ur(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=mr(),c=r.domReference?.id||s,l=S.useMemo(()=>Ot(r.floating)?.id||i,[r.floating,i]),u=Hr.get(o)??o,d=vr()!=null,f=S.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=S.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=S.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return S.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}function Wr(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Wr(e,t.id,n)])}function Gr(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function Kr(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function qr(e){e===void 0&&(e={});let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i={current:-1},a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=e=>{let{x:n,y:o,placement:s,elements:c,onClose:u,nodeId:d,tree:f}=e;return function(e){function p(){$(i),u()}if($(i),!c.domReference||!c.floating||s==null||n==null||o==null)return;let{clientX:m,clientY:h}=e,g=[m,h],_=jr(e),v=e.type===`mouseleave`,y=Ar(c.floating,_),b=Ar(c.domReference,_),x=c.domReference.getBoundingClientRect(),S=c.floating.getBoundingClientRect(),C=s.split(`-`)[0],w=n>S.right-S.width/2,T=o>S.bottom-S.height/2,E=Kr(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&U(e.relatedTarget)&&Ar(c.floating,e.relatedTarget)||f&&Wr(f.nodesRef.current,d).length)return;if(C===`top`&&o>=x.bottom-1||C===`bottom`&&o<=x.top+1||C===`left`&&n>=x.right-1||C===`right`&&n<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]]}function P(e){let[n,r]=e;switch(C){case`top`:return[[D?n+t/2:w?n+t*4:n-t*4,r+t+1],[D?n-t/2:w?n+t*4:n-t*4,r+t+1],[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]];case`bottom`:return[[D?n+t/2:w?n+t*4:n-t*4,r-t],[D?n-t/2:w?n+t*4:n-t*4,r-t],[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]];case`left`:{let e=[n+t+1,O?r+t/2:T?r+t*4:r-t*4],i=[n+t+1,O?r-t/2:T?r+t*4:r-t*4];return[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom],e,i]}case`right`:return[[n-t,O?r+t/2:T?r+t*4:r-t*4],[n-t,O?r-t/2:T?r+t*4:r-t*4],[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]]}}if(!Gr([m,h],N)){if(a&&!E)return p();if(!v&&r){let t=l(e.clientX,e.clientY);if(t!==null&&t<.1)return p()}Gr([m,h],P([n,o]))?!a&&r&&(i.current=window.setTimeout(p,40)):p()}}};return u.__options={blockPointerEvents:n},u}var Jr={scrollHideDelay:1e3,type:`hover`,scrollbars:`xy`},Yr=o((e,{scrollbarSize:t,overscrollBehavior:n,scrollbars:r})=>{let i=n;return n&&r&&(r===`x`?i=`${n} auto`:r===`y`&&(i=`auto ${n}`)),{root:{"--scrollarea-scrollbar-size":l(t),"--scrollarea-over-scroll-behavior":i}}}),Xr=t(e=>{let t=p(`ScrollArea`,Jr,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,scrollbarSize:s,vars:c,type:l,scrollHideDelay:u,viewportProps:d,viewportRef:f,onScrollPositionChange:h,children:_,offsetScrollbars:v,scrollbars:y,onBottomReached:b,onTopReached:C,onLeftReached:w,onRightReached:T,overscrollBehavior:E,startScrollPosition:D,verticalScrollbarPosition:O,attributes:k,...A}=t,[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(!1),[F,ee]=(0,S.useState)(!1),ne=(0,S.useRef)(!0),ie=(0,S.useRef)(!1),ae=(0,S.useRef)(!0),oe=(0,S.useRef)(!1),L=m({name:`ScrollArea`,props:t,classes:Ce,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:k,vars:c,varsResolver:Yr}),se=(0,S.useRef)(null),[ce,le]=(0,S.useState)(null),ue=$n([f,se,(0,S.useCallback)(e=>{le(t=>t===e?t:e)},[])]);return I(v===`present`?ce:null,()=>{let e=se.current;e&&(P(e.scrollHeight>e.clientHeight),ee(e.scrollWidth>e.clientWidth))}),g(()=>{D&&se.current&&se.current.scrollTo({left:D.x??0,top:D.y??0})},[]),(0,x.jsxs)(re,{getStyles:L,type:l===`never`?`always`:l,scrollHideDelay:u,scrollbars:y,...L(`root`),...A,children:[(0,x.jsx)(Se,{...d,...L(`viewport`,{style:d?.style}),ref:ue,"data-offset-scrollbars":v===!0?`xy`:v||void 0,"data-scrollbars":y||void 0,"data-vertical-scrollbar-position":O||void 0,"data-horizontal-hidden":v===`present`&&!F?`true`:void 0,"data-vertical-hidden":v===`present`&&!N?`true`:void 0,onScroll:e=>{d?.onScroll?.(e),h?.({x:e.currentTarget.scrollLeft,y:e.currentTarget.scrollTop});let{scrollTop:t,scrollHeight:n,clientHeight:r,scrollLeft:i,scrollWidth:a,clientWidth:o}=e.currentTarget,s=t-(n-r)>=-.8,c=t===0;s&&!ie.current&&b?.(),c&&!ne.current&&C?.(),ie.current=s,ne.current=c;let l=i-(a-o)>=-.8,u=i===0;l&&!oe.current&&T?.(),u&&!ae.current&&w?.(),oe.current=l,ae.current=u},children:_}),(y===`xy`||y===`x`)&&(0,x.jsx)(ye,{...L(`scrollbar`),orientation:`horizontal`,"data-vertical-scrollbar-position":O||void 0,"data-hidden":l===`never`||v===`present`&&!F||void 0,forceMount:!0,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:(0,x.jsx)(xe,{...L(`thumb`)})}),(y===`xy`||y===`y`)&&(0,x.jsx)(ye,{...L(`scrollbar`),orientation:`vertical`,"data-vertical-scrollbar-position":O||void 0,"data-hidden":l===`never`||v===`present`&&!N||void 0,forceMount:!0,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:(0,x.jsx)(xe,{...L(`thumb`)})}),(0,x.jsx)(te,{...L(`corner`),"data-vertical-scrollbar-position":O||void 0,"data-hovered":j||void 0,"data-hidden":l===`never`||void 0})]})});Xr.displayName=`@mantine/core/ScrollArea`;var Zr=t(e=>{let{children:t,classNames:n,styles:r,scrollbarSize:i,scrollHideDelay:a,type:o,dir:s,offsetScrollbars:c,overscrollBehavior:l,viewportRef:u,onScrollPositionChange:d,unstyled:f,variant:m,viewportProps:h,scrollbars:g,style:_,vars:y,onBottomReached:b,onTopReached:C,startScrollPosition:w,verticalScrollbarPosition:T,onOverflowChange:E,...D}=p(`ScrollAreaAutosize`,Jr,e),O=(0,S.useRef)(null),[k,A]=(0,S.useState)(null),j=$n([u,O,(0,S.useCallback)(e=>{A(t=>t===e?t:e)},[])]),M=(0,S.useRef)(!1),N=(0,S.useRef)(!1),P=(0,S.useEffectEvent)(()=>{let e=O.current;if(!e||!E)return;let t=e.scrollHeight>e.clientHeight;t!==M.current&&(N.current?E(t):(N.current=!0,t&&E(!0)),M.current=t)});return I(E?k:null,P),(0,x.jsx)(v,{...D,variant:m,style:[{display:`flex`,overflow:`hidden`},_],children:(0,x.jsx)(v,{style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`,...g===`y`&&{minWidth:0},...g===`x`&&{minHeight:0},...g===`xy`&&{minWidth:0,minHeight:0},...g===!1&&{minWidth:0,minHeight:0}},children:(0,x.jsx)(Xr,{classNames:n,styles:r,scrollHideDelay:a,scrollbarSize:i,type:o,dir:s,offsetScrollbars:c,overscrollBehavior:l,viewportRef:j,onScrollPositionChange:d,unstyled:f,variant:m,viewportProps:h,vars:y,scrollbars:g,onBottomReached:b,onTopReached:C,startScrollPosition:w,verticalScrollbarPosition:T,"data-autosize":`true`,children:t})})})});Xr.classes=Ce,Xr.varsResolver=Yr,Zr.displayName=`@mantine/core/ScrollAreaAutosize`,Zr.classes=Ce,Xr.Autosize=Zr;function Qr(e,t,n,r){return e===`center`||r===`center`?{top:t}:e===`end`?{bottom:n}:e===`start`?{top:n}:{}}function $r(e,t,n,r,i){return e===`center`||r===`center`?{left:t}:e===`end`?{[i===`ltr`?`right`:`left`]:n}:e===`start`?{[i===`ltr`?`left`:`right`]:n}:{}}var ei={bottom:`borderTopLeftRadius`,left:`borderTopRightRadius`,right:`borderBottomLeftRadius`,top:`borderBottomRightRadius`};function ti({position:e,arrowSize:t,dir:n}){let[r,i]=e.split(`-`);if(!i)return;let a={width:t,height:t,position:`absolute`};if(r===`bottom`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,top:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(100% 0%, 0% 100%, 100% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`}}if(r===`top`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,bottom:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(0% 0%, 100% 0%, 0% 100%)`}}if(r===`left`)return{...a,right:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 0% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`};if(r===`right`)return{...a,left:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(100% 0%, 0% 100%, 100% 100%)`}}function ni({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,arrowX:a,arrowY:o,dir:s}){if(i===`merge`){let n=ti({position:e,arrowSize:t,dir:s});if(n)return n}let[c,l=`center`]=e.split(`-`),u={width:t,height:t,transform:`rotate(45deg)`,position:`absolute`,[ei[c]]:r},d=-t/2;return c===`left`?{...u,...Qr(l,o,n,i),right:d,borderLeftColor:`transparent`,borderBottomColor:`transparent`,clipPath:`polygon(100% 0, 0 0, 100% 100%)`}:c===`right`?{...u,...Qr(l,o,n,i),left:d,borderRightColor:`transparent`,borderTopColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 100%)`}:c===`top`?{...u,...$r(l,a,n,i,s),bottom:d,borderTopColor:`transparent`,borderLeftColor:`transparent`,clipPath:`polygon(0 100%, 100% 100%, 100% 0)`}:c===`bottom`?{...u,...$r(l,a,n,i,s),top:d,borderBottomColor:`transparent`,borderRightColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 0)`}:{}}function ri({position:e,dir:t}){let[n,r]=e.split(`-`);if(!r)return;let i=r===`start`&&t===`ltr`||r===`end`&&t===`rtl`;if(n===`bottom`)return i?{borderTopLeftRadius:0}:{borderTopRightRadius:0};if(n===`top`)return i?{borderBottomLeftRadius:0}:{borderBottomRightRadius:0};if(n===`left`)return r===`start`?{borderTopRightRadius:0}:{borderBottomRightRadius:0};if(n===`right`)return r===`start`?{borderTopLeftRadius:0}:{borderBottomLeftRadius:0}}function ii({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,visible:a,arrowX:o,arrowY:s,style:c,...l}){let{dir:u}=N();return a?(0,x.jsx)(`div`,{role:`presentation`,...l,style:{...c,...ni({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,dir:u,arrowX:o,arrowY:s})}}):null}ii.displayName=`@mantine/core/FloatingArrow`;function ai(e,t){if(e===`rtl`&&(t.includes(`right`)||t.includes(`left`))){let[e,n]=t.split(`-`),r=e===`right`?`left`:`right`;return n===void 0?r:`${r}-${n}`}return t}function oi(e){let t=document.createElement(`div`);return t.setAttribute(`data-portal`,`true`),typeof e.className==`string`&&t.classList.add(...e.className.split(` `).filter(Boolean)),typeof e.style==`object`&&Object.assign(t.style,e.style),typeof e.id==`string`&&t.setAttribute(`id`,e.id),t}function si({target:e,reuseTargetNode:t,...n}){if(e)return typeof e==`string`?document.querySelector(e)||oi(n):e;if(t){let e=document.querySelector(`[data-mantine-shared-portal-node]`);if(e)return e;let t=oi(n);return t.setAttribute(`data-mantine-shared-portal-node`,`true`),document.body.appendChild(t),t}return oi(n)}var ci={reuseTargetNode:!0},li=t(e=>{let{children:t,target:n,reuseTargetNode:r,ref:a,...o}=p(`Portal`,ci,e),[s,c]=(0,S.useState)(!1),l=(0,S.useRef)(null);return g(()=>(c(!0),l.current=si({target:n,reuseTargetNode:r,...o}),i(a,l.current),!n&&!r&&l.current&&document.body.appendChild(l.current),()=>{!n&&!r&&l.current&&document.body.removeChild(l.current)}),[n]),!s||!l.current?null:(0,b.createPortal)((0,x.jsx)(x.Fragment,{children:t}),l.current)});li.displayName=`@mantine/core/Portal`;var ui=t(({withinPortal:e=!0,children:t,...n})=>y()===`test`||!e?(0,x.jsx)(x.Fragment,{children:t}):(0,x.jsx)(li,{...n,children:t}));ui.displayName=`@mantine/core/OptionalPortal`;var di={duration:100,transition:`fade`};function fi(e,t){return{...di,...t,...e}}function pi({offset:e,position:t,defaultOpened:n}){let[r,i]=(0,S.useState)(n),a=(0,S.useRef)(null),{x:o,y:s,elements:c,refs:l,update:u,placement:d}=Lr({placement:t,middleware:[Kn({crossAxis:!0,padding:5,rootBoundary:`document`})]}),f=d.includes(`right`)?e:t.includes(`left`)?e*-1:0,p=d.includes(`bottom`)?e:t.includes(`top`)?e*-1:0,m=(0,S.useCallback)(({clientX:e,clientY:t})=>{Number.isFinite(e)&&Number.isFinite(t)&&l.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:e,y:t,left:e+f,top:t+p,right:e,bottom:t}}})},[c.reference]);return(0,S.useEffect)(()=>{if(l.floating.current){let e=a.current;e.addEventListener(`mousemove`,m);let t=He(l.floating.current);return t.forEach(e=>{e.addEventListener(`scroll`,u)}),()=>{e.removeEventListener(`mousemove`,m),t.forEach(e=>{e.removeEventListener(`scroll`,u)})}}},[c.reference,l.floating.current,u,m,r]),{handleMouseMove:m,x:o,y:s,opened:r,setOpened:i,boundaryRef:a,floating:l.setFloating}}var mi={tooltip:`m_1b3c8819`,arrow:`m_f898399f`},hi={refProp:`ref`,withinPortal:!0,offset:10,position:`right`,zIndex:E(`popover`)},gi=o((e,{radius:t,color:r})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:c(t),"--tooltip-bg":r?n(r,e):void 0,"--tooltip-color":r?`var(--mantine-color-white)`:void 0}})),_i=t(t=>{let n=p(`TooltipFloating`,hi,t),{children:i,refProp:a,withinPortal:o,style:s,className:c,classNames:l,styles:u,unstyled:d,radius:f,color:h,label:g,offset:_,position:y,multiline:b,zIndex:C,disabled:w,defaultOpened:T,variant:E,vars:D,portalProps:O,attributes:M,ref:N,...P}=n,F=r(),I=m({name:`TooltipFloating`,props:n,classes:mi,className:c,style:s,classNames:l,styles:u,unstyled:d,attributes:M,rootSelector:`tooltip`,vars:D,varsResolver:gi}),{handleMouseMove:ee,x:te,y:ne,opened:re,boundaryRef:ie,floating:ae,setOpened:oe}=pi({offset:_,position:y,defaultOpened:T}),L=A(i);if(!L)throw Error(`[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported`);let se=e(ie,k(L),N),ce=L.props,le=e=>{ce.onMouseEnter?.(e),ee(e),oe(!0)},ue=e=>{ce.onMouseLeave?.(e),oe(!1)};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ui,{...O,withinPortal:o,children:(0,x.jsx)(v,{...P,...I(`tooltip`,{style:{...j(s,F),zIndex:C,display:!w&&re?`block`:`none`,top:Number.isFinite(ne)?Math.round(ne):``,left:Number.isFinite(te)?Math.round(te):``}}),variant:E,ref:ae,mod:{multiline:b},children:g})}),(0,S.cloneElement)(L,{...ce,[a]:se,onMouseEnter:le,onMouseLeave:ue})]})});_i.classes=mi,_i.varsResolver=gi,_i.displayName=`@mantine/core/TooltipFloating`;var vi=(0,S.createContext)({withinGroup:!1}),yi={openDelay:0,closeDelay:0};function bi(e){let{openDelay:t,closeDelay:n,children:r}=p(`TooltipGroup`,yi,e);return(0,x.jsx)(vi,{value:{withinGroup:!0},children:(0,x.jsx)(Or,{delay:{open:t,close:n},children:r})})}bi.displayName=`@mantine/core/TooltipGroup`,bi.extend=e=>e;function xi(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Si(e){let t=xi(e.middlewares),n=[Gn(e.offset)];return t.shift&&n.push(Kn(typeof t.shift==`boolean`?{padding:8}:{padding:8,...t.shift})),t.flip&&n.push(typeof t.flip==`boolean`?Jn():Jn(t.flip)),n.push(Qn({element:e.arrowRef,padding:e.arrowOffset})),t.inline?n.push(typeof t.inline==`boolean`?Zn():Zn(t.inline)):e.inline&&n.push(Zn()),n}function Ci(e){let[t,n]=(0,S.useState)(e.defaultOpened),r=typeof e.opened==`boolean`?e.opened:t,i=(0,S.use)(vi).withinGroup,a=u(),o=(0,S.useCallback)(e=>{n(e),e&&v(a)},[a]),{x:s,y:c,context:l,refs:d,placement:f,middlewareData:{arrow:{x:p,y:m}={}}}=Lr({strategy:e.strategy,placement:e.position,open:r,onOpenChange:o,middleware:Si(e),whileElementsMounted:On}),{delay:h,currentId:_,setCurrentId:v}=kr(l,{id:a}),{getReferenceProps:y,getFloatingProps:b}=Vr([wr(l,{enabled:e.events?.hover,delay:i?h:{open:e.openDelay,close:e.closeDelay},mouseOnly:!e.events?.touch,handleClose:e.interactive?qr():null}),zr(l,{enabled:e.events?.focus,visibleOnly:!0}),Ur(l,{role:`tooltip`}),Fr(l,{enabled:e.opened===void 0})]),x=(0,S.useRef)(f);g(()=>{x.current!==f&&(x.current=f,e.onPositionChange?.(f))},[f]);let C=r&&_&&_!==a;return{x:s,y:c,arrowX:p,arrowY:m,reference:d.setReference,floating:d.setFloating,getFloatingProps:b,getReferenceProps:y,isGroupPhase:C,opened:r,placement:f}}var wi={position:`top`,refProp:`ref`,withinPortal:!0,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,offset:5,transitionProps:{duration:100,transition:`fade`},events:{hover:!0,focus:!1,touch:!1},zIndex:E(`popover`),middlewares:{flip:!0,shift:!0,inline:!1}},Ti=o((e,{radius:t,color:n,variant:r,autoContrast:i})=>{let a=e.variantColorResolver({theme:e,color:n||e.primaryColor,autoContrast:i,variant:r||`filled`});return{tooltip:{"--tooltip-radius":t===void 0?void 0:c(t),"--tooltip-bg":n?a.background:void 0,"--tooltip-color":n?a.color:void 0}}}),Ei=t(t=>{let n=p(`Tooltip`,wi,t),{children:r,position:i,refProp:a,label:o,openDelay:c,closeDelay:l,onPositionChange:u,opened:d,defaultOpened:f,withinPortal:h,radius:g,color:y,classNames:b,styles:C,unstyled:w,style:T,className:E,withArrow:D,arrowSize:O,arrowOffset:j,arrowRadius:M,arrowPosition:P,offset:F,transitionProps:I,multiline:ee,events:te,interactive:ne,zIndex:re,disabled:ie,onClick:ae,onMouseEnter:oe,onMouseLeave:L,inline:se,variant:ce,keepMounted:le,vars:ue,portalProps:R,mod:de,floatingStrategy:fe,middlewares:pe,autoContrast:me,attributes:he,target:z,ref:ge,..._e}=n,{dir:ve}=N(),ye=(0,S.useRef)(null),B=Ci({position:ai(ve,i),closeDelay:l,openDelay:c,onPositionChange:u,opened:d,defaultOpened:f,events:te,interactive:ne,arrowRef:ye,arrowOffset:j,offset:typeof F==`number`?F+(D?O/2:0):F,inline:se,strategy:fe,middlewares:pe});(0,S.useEffect)(()=>{let e=z instanceof HTMLElement?z:typeof z==`string`?document.querySelector(z):z?.current||null;e&&B.reference(e)},[z,B]);let be=m({name:`Tooltip`,props:n,classes:mi,className:E,style:T,classNames:b,styles:C,unstyled:w,attributes:he,rootSelector:`tooltip`,vars:ue,varsResolver:Ti}),xe=A(r);if(!z&&!xe)throw Error(`[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported`);let Se=be(`tooltip`),Ce=ne&&!ie&&!!B.opened,we=P===`merge`&&D?ri({position:B.placement,dir:ve}):void 0;if(z){let e=fi(I,{duration:100,transition:`fade`});return(0,x.jsx)(x.Fragment,{children:(0,x.jsx)(ui,{...R,withinPortal:h,children:(0,x.jsx)(_,{...e,keepMounted:le,mounted:!ie&&!!B.opened,duration:B.isGroupPhase?10:e.duration,children:e=>(0,x.jsxs)(v,{..._e,"data-fixed":fe===`fixed`||void 0,variant:ce,mod:[{multiline:ee,interactive:Ce},de],...Se,...B.getFloatingProps({ref:B.floating,className:Se.className,style:{...Se.style,...e,...we,zIndex:re,top:B.y??0,left:B.x??0}}),children:[o,(0,x.jsx)(ii,{ref:ye,arrowX:B.arrowX,arrowY:B.arrowY,visible:D,position:B.placement,arrowSize:O,arrowOffset:j,arrowRadius:M,arrowPosition:P,...be(`arrow`)})]})})})})}let Te=xe.props,V=e(B.reference,k(xe),ge),H=fi(I,{duration:100,transition:`fade`});return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ui,{...R,withinPortal:h,children:(0,x.jsx)(_,{...H,keepMounted:le,mounted:!ie&&!!B.opened,duration:B.isGroupPhase?10:H.duration,children:e=>(0,x.jsxs)(v,{..._e,"data-fixed":fe===`fixed`||void 0,variant:ce,mod:[{multiline:ee,interactive:Ce},de],...B.getFloatingProps({ref:B.floating,className:be(`tooltip`).className,style:{...be(`tooltip`).style,...e,...we,zIndex:re,top:B.y??0,left:B.x??0}}),children:[o,(0,x.jsx)(ii,{ref:ye,arrowX:B.arrowX,arrowY:B.arrowY,visible:D,position:B.placement,arrowSize:O,arrowOffset:j,arrowRadius:M,arrowPosition:P,...be(`arrow`)})]})})}),(0,S.cloneElement)(xe,B.getReferenceProps({onClick:ae,onMouseEnter:oe,onMouseLeave:L,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,...Te,className:s(E,Te.className),[a]:V}))]})});Ei.classes=mi,Ei.varsResolver=Ti,Ei.displayName=`@mantine/core/Tooltip`,Ei.Floating=_i,Ei.Group=bi;export{E as C,k as S,C as T,Kn as _,ri as a,N as b,Lr as c,Qn as d,Jn as f,Gn as g,qn as h,ii as i,wr as l,Zn as m,ui as n,Xr as o,Xn as p,ai as r,qr as s,Ei as t,Vr as u,Yn as v,w,A as x,On as y}; \ No newline at end of file diff --git a/internal/ui/dist/assets/WarningCircle.es-DDq2AFnK.js b/internal/ui/dist/assets/WarningCircle.es-DDq2AFnK.js new file mode 100644 index 000000000..2da6a032e --- /dev/null +++ b/internal/ui/dist/assets/WarningCircle.es-DDq2AFnK.js @@ -0,0 +1 @@ +import{St as e,a as t,gt as n}from"./brand-MzZ03bSa.js";import{O as r,T as i,_ as a,h as o,p as s,s as c,w as l,x as u}from"./api-Be5Lq4YA.js";var d=class extends o{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),l(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&a(t.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??c();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){s.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},f=e(n(),1);function p(e,t){let n=r(t),[a]=f.useState(()=>new d(n,e));f.useEffect(()=>{a.setOptions(e)},[a,e]);let o=f.useSyncExternalStore(f.useCallback(e=>a.subscribe(s.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),c=f.useCallback((...e)=>{a.mutate(e[0],e[1]).catch(u)},[a]);if(o.error&&i(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}var m=new Map([[`bold`,f.createElement(f.Fragment,null,f.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,f.createElement(f.Fragment,null,f.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),f.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,f.createElement(f.Fragment,null,f.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,f.createElement(f.Fragment,null,f.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,f.createElement(f.Fragment,null,f.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,f.createElement(f.Fragment,null,f.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),h=f.forwardRef((e,n)=>f.createElement(t,{ref:n,...e,weights:m}));h.displayName=`WarningCircleIcon`;var g=h;export{p as n,g as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/api-Be5Lq4YA.js b/internal/ui/dist/assets/api-Be5Lq4YA.js new file mode 100644 index 000000000..bce949b9e --- /dev/null +++ b/internal/ui/dist/assets/api-Be5Lq4YA.js @@ -0,0 +1,41 @@ +import{$ as e,C as t,S as n,St as r,U as i,X as a,Y as o,Z as s,at as c,ct as l,dt as u,et as d,g as f,gt as p,j as m,k as h,mt as g,ot as _,st as v,tt as y,v as b,x,y as S}from"./brand-MzZ03bSa.js";import{i as C}from"./auth-BeUORN-q.js";import{C as w,n as ee,o as te,w as ne,x as T}from"./Tooltip-BJiO7C_G.js";var E=r(p(),1);function re({opened:e,shouldReturnFocus:t=!0}){let n=(0,E.useRef)(null),r=()=>{n.current&&`focus`in n.current&&typeof n.current.focus==`function`&&n.current?.focus({preventScroll:!0})};return y(()=>{let i=-1,a=e=>{e.key===`Tab`&&window.clearTimeout(i)};if(document.addEventListener(`keydown`,a),e)n.current=document.activeElement;else if(t){let e=document.activeElement;i=window.setTimeout(()=>{let t=document.activeElement;(t===null||t===document.body||t===e)&&r()},10)}return()=>{window.clearTimeout(i),document.removeEventListener(`keydown`,a)}},[e,t]),r}var ie=/input|select|textarea|button|object/,ae=`a, input, select, textarea, button, object, [tabindex]`;function oe(e){return e.style.display===`none`}function se(e){if(e.getAttribute(`aria-hidden`)||e.getAttribute(`hidden`)||e.getAttribute(`type`)===`hidden`)return!1;let t=e;for(;t&&t!==document.body&&t.nodeType!==11;){if(oe(t))return!1;t=t.parentNode}return!0}function ce(e){let t=e.getAttribute(`tabindex`);return t===null&&(t=void 0),parseInt(t,10)}function le(e){let t=e.nodeName.toLowerCase(),n=!Number.isNaN(ce(e));return(ie.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&se(e)}function ue(e){let t=ce(e);return(Number.isNaN(t)||t>=0)&&le(e)}function de(e){return Array.from(e.querySelectorAll(ae)).filter(ue)}function fe(e,t){let n=de(e);if(!n.length){t.preventDefault();return}let r=n[t.shiftKey?0:n.length-1],i=e.getRootNode(),a=r===i.activeElement||e===i.activeElement,o=i.activeElement;if(o.tagName===`INPUT`&&o.getAttribute(`type`)===`radio`&&(a=n.filter(e=>e.getAttribute(`type`)===`radio`&&e.getAttribute(`name`)===o.getAttribute(`name`)).includes(r)),!a)return;t.preventDefault();let s=n[t.shiftKey?n.length-1:0];s&&s.focus()}function pe(e=!0){let t=(0,E.useRef)(null),n=e=>{let t=e.querySelector(`[data-autofocus]`);if(!t){let n=Array.from(e.querySelectorAll(ae));t=n.find(ue)||n.find(le)||null,!t&&le(e)&&(t=e)}t?t.focus({preventScroll:!0}):console.warn(`[@mantine/hooks/use-focus-trap] Failed to find focusable element within provided node`,e)},r=(0,E.useCallback)(r=>{if(e){if(r===null){t.current=null;return}t.current!==r&&(setTimeout(()=>{r.getRootNode()?n(r):console.warn(`[@mantine/hooks/use-focus-trap] Ref node is not part of the dom`,r)}),t.current=r)}},[e]);return(0,E.useEffect)(()=>{if(!e)return;t.current&&setTimeout(()=>{t.current&&n(t.current)});let r=e=>{e.key===`Tab`&&t.current&&fe(t.current,e)};return document.addEventListener(`keydown`,r),()=>document.removeEventListener(`keydown`,r)},[e]),r}function me(e,t,n){let r=(0,E.useEffectEvent)(t);(0,E.useEffect)(()=>(window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)),[e])}var D=g(),he={root:`m_515a97f8`},O=t(e=>{let t=m(`VisuallyHidden`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t;return(0,D.jsx)(x,{component:`span`,...h({name:`VisuallyHidden`,classes:he,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c})(`root`),...l})});O.classes=he,O.displayName=`@mantine/core/VisuallyHidden`;var ge={root:`m_9814e45f`},_e={zIndex:w(`modal`)},ve=a((e,{gradient:t,color:n,backgroundOpacity:r,blur:a,radius:o,zIndex:s})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&i(n||`#000`,r??.6)||void 0,"--overlay-filter":a?`blur(${u(a)})`:void 0,"--overlay-radius":o===void 0?void 0:c(o),"--overlay-z-index":s?.toString()}})),k=n(e=>{let t=m(`Overlay`,_e,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,fixed:c,center:l,children:u,radius:d,zIndex:f,gradient:p,blur:g,color:_,backgroundOpacity:v,mod:y,attributes:b,...S}=t;return(0,D.jsx)(x,{...h({name:`Overlay`,props:t,classes:ge,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:b,vars:s,varsResolver:ve})(`root`),mod:[{center:l,fixed:c},y],...S,children:u})});k.classes=ge,k.varsResolver=ve,k.displayName=`@mantine/core/Overlay`;function A({children:t,active:n=!0,refProp:r=`ref`,innerRef:i}){let a=e(pe(n),i),o=T(t);return o?(0,E.cloneElement)(o,{[r]:a}):t}function ye(e){return(0,D.jsx)(O,{tabIndex:-1,"data-autofocus":!0,...e})}A.displayName=`@mantine/core/FocusTrap`,ye.displayName=`@mantine/core/FocusTrapInitialFocus`,A.InitialFocus=ye;var[be,j]=ne(`ModalBase component was not found in tree`);function xe({opened:e,transitionDuration:t}){let[n,r]=(0,E.useState)(e),i=(0,E.useRef)(-1),a=s()?0:t;return(0,E.useEffect)(()=>(e?(r(!0),window.clearTimeout(i.current)):a===0?r(!1):i.current=window.setTimeout(()=>r(!1),a),()=>window.clearTimeout(i.current)),[e,a]),n}function Se({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:i,onClose:a,returnFocus:o}){let s=d(e),[c,l]=(0,E.useState)(!1),[u,f]=(0,E.useState)(!1),p=xe({opened:n,transitionDuration:typeof t?.duration==`number`?t?.duration:200});return me(`keydown`,e=>{e.key===`Escape`&&i&&!e.isComposing&&n&&e.target?.getAttribute(`data-mantine-stop-propagation`)!==`true`&&a()},{capture:!0}),re({opened:n,shouldReturnFocus:r&&o}),{_id:s,titleMounted:c,bodyMounted:u,shouldLockScroll:p,setTitleMounted:l,setBodyMounted:f}}var M=function(){return M=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return Xe;var t=Qe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},et=Ye(),P=`data-scroll-locked`,tt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` + .${Ee} { + overflow: hidden ${r}; + padding-right: ${s}px ${r}; + } + body[${P}] { + overflow: hidden ${r}; + overscroll-behavior: contain; + ${[t&&`position: relative ${r};`,n===`margin`&&` + padding-left: ${i}px; + padding-top: ${a}px; + padding-right: ${o}px; + margin-left:0; + margin-top:0; + margin-right: ${s}px ${r}; + `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} + } + + .${N} { + right: ${s}px ${r}; + } + + .${Te} { + margin-right: ${s}px ${r}; + } + + .${N} .${N} { + right: 0 ${r}; + } + + .${Te} .${Te} { + margin-right: 0 ${r}; + } + + body[${P}] { + ${De}: ${s}px; + } +`},nt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},rt=function(){E.useEffect(function(){return document.body.setAttribute(P,(nt()+1).toString()),function(){var e=nt()-1;e<=0?document.body.removeAttribute(P):document.body.setAttribute(P,e.toString())}},[])},it=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;rt();var a=E.useMemo(function(){return $e(i)},[i]);return E.createElement(et,{styles:tt(a,!t,i,n?``:`!important`)})},at=!1;if(typeof window<`u`)try{var F=Object.defineProperty({},"passive",{get:function(){return at=!0,!0}});window.addEventListener(`test`,F,F),window.removeEventListener(`test`,F,F)}catch{at=!1}var I=at?{passive:!1}:!1,ot=function(e){return e.tagName===`TEXTAREA`},st=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!ot(e)&&n[t]===`visible`)},ct=function(e){return st(e,`overflowY`)},lt=function(e){return st(e,`overflowX`)},ut=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),pt(e,r)){var i=mt(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},dt=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},ft=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},pt=function(e,t){return e===`v`?ct(t):lt(t)},mt=function(e,t){return e===`v`?dt(t):ft(t)},ht=function(e,t){return e===`h`&&t===`rtl`?-1:1},gt=function(e,t,n,r,i){var a=ht(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=mt(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&pt(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},L=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},_t=function(e){return[e.deltaX,e.deltaY]},vt=function(e){return e&&`current`in e?e.current:e},yt=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bt=function(e){return` + .block-interactivity-${e} {pointer-events: none;} + .allow-interactivity-${e} {pointer-events: all;} +`},xt=0,R=[];function St(e){var t=E.useRef([]),n=E.useRef([0,0]),r=E.useRef(),i=E.useState(xt++)[0],a=E.useState(Ye)[0],o=E.useRef(e);E.useEffect(function(){o.current=e},[e]),E.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=we([e.lockRef.current],(e.shards||[]).map(vt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=E.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=L(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ut(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ut(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return gt(h,t,e,h===`h`?s:c,!0)},[]),c=E.useCallback(function(e){var n=e;if(R.length&&R[R.length-1]===a){var r=`deltaY`in n?_t(n):L(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&yt(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(vt).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=E.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ct(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=E.useCallback(function(e){n.current=L(e),r.current=void 0},[]),d=E.useCallback(function(t){l(t.type,_t(t),t.target,s(t,e.lockRef.current))},[]),f=E.useCallback(function(t){l(t.type,L(t),t.target,s(t,e.lockRef.current))},[]);E.useEffect(function(){return R.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,I),document.addEventListener(`touchmove`,c,I),document.addEventListener(`touchstart`,u,I),function(){R=R.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,I),document.removeEventListener(`touchmove`,c,I),document.removeEventListener(`touchstart`,u,I)}},[]);var p=e.removeScrollBar,m=e.inert;return E.createElement(E.Fragment,null,m?E.createElement(a,{styles:bt(i)}):null,p?E.createElement(it,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ct(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var wt=ze(Be,St),Tt=E.forwardRef(function(e,t){return E.createElement(He,M({},e,{ref:t,sideCar:wt}))});Tt.classNames=He.classNames;function Et({keepMounted:e,keepMountedMode:t=`activity`,opened:n,onClose:r,id:i,transitionProps:a,onExitTransitionEnd:o,onEnterTransitionEnd:s,trapFocus:c,closeOnEscape:u,returnFocus:d,closeOnClickOutside:f,withinPortal:p,portalProps:m,lockScroll:h,children:g,zIndex:v,shadow:y,padding:b,__vars:S,unstyled:C,removeScrollProps:te,...ne}){let{_id:T,titleMounted:E,bodyMounted:re,shouldLockScroll:ie,setTitleMounted:ae,setBodyMounted:oe}=Se({id:i,transitionProps:a,opened:n,trapFocus:c,closeOnEscape:u,onClose:r,returnFocus:d}),{key:se,...ce}=te||{};return(0,D.jsx)(ee,{...m,withinPortal:p,children:(0,D.jsx)(be,{value:{opened:n,onClose:r,closeOnClickOutside:f,onExitTransitionEnd:o,onEnterTransitionEnd:s,transitionProps:{...a,keepMounted:e,keepMountedMode:t},getTitleId:()=>`${T}-title`,getBodyId:()=>`${T}-body`,titleMounted:E,bodyMounted:re,setTitleMounted:ae,setBodyMounted:oe,trapFocus:c,closeOnEscape:u,zIndex:v,unstyled:C},children:(0,D.jsx)(Tt,{enabled:ie&&h,...ce,children:(0,D.jsx)(x,{...ne,id:T,__vars:{...S,"--mb-z-index":(v||w(`modal`)).toString(),"--mb-shadow":_(y),"--mb-padding":l(b)},children:g})},se)})})}Et.displayName=`@mantine/core/ModalBase`;function Dt(){let e=j();return(0,E.useEffect)(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var z={title:`m_615af6c9`,header:`m_b5489c3c`,inner:`m_60c222c7`,content:`m_fd1ab0aa`,close:`m_606cb269`,body:`m_5df29311`};function Ot({className:e,...t}){let n=Dt(),r=j();return(0,D.jsx)(x,{id:n,className:o({[z.body]:!r.unstyled},e),...t})}Ot.displayName=`@mantine/core/ModalBaseBody`;function kt({className:e,onClick:t,...n}){let r=j();return(0,D.jsx)(f,{...n,onClick:e=>{r.onClose(),t?.(e)},className:o({[z.close]:!r.unstyled},e),unstyled:r.unstyled})}kt.displayName=`@mantine/core/ModalBaseCloseButton`;function At({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:i,ref:a,...s}){let c=j();return(0,D.jsx)(b,{mounted:c.opened,transition:`pop`,...c.transitionProps,onExited:()=>{c.onExitTransitionEnd?.(),c.transitionProps?.onExited?.()},onEntered:()=>{c.onEnterTransitionEnd?.(),c.transitionProps?.onEntered?.()},...e,children:e=>(0,D.jsx)(`div`,{...n,className:o({[z.inner]:!c.unstyled},n.className),children:(0,D.jsx)(A,{active:c.opened&&c.trapFocus,innerRef:a,children:(0,D.jsx)(S,{...s,component:`section`,role:`dialog`,tabIndex:-1,"aria-modal":!0,"aria-describedby":c.bodyMounted?c.getBodyId():void 0,"aria-labelledby":c.titleMounted?c.getTitleId():void 0,style:[i,e],className:o({[z.content]:!c.unstyled},t),unstyled:c.unstyled,children:s.children})})})})}At.displayName=`@mantine/core/ModalBaseContent`;function jt({className:e,...t}){let n=j();return(0,D.jsx)(x,{component:`header`,className:o({[z.header]:!n.unstyled},e),...t})}jt.displayName=`@mantine/core/ModalBaseHeader`;var Mt={duration:200,timingFunction:`ease`,transition:`fade`};function Nt(e){let t=j();return{...Mt,...t.transitionProps,...e}}function Pt({onClick:e,transitionProps:t,style:n,visible:r,...i}){let a=j(),o=Nt(t);return(0,D.jsx)(b,{mounted:r===void 0?a.opened:r,...o,transition:`fade`,children:t=>(0,D.jsx)(k,{fixed:!0,style:[n,t],zIndex:a.zIndex,unstyled:a.unstyled,onClick:t=>{e?.(t),a.closeOnClickOutside&&a.onClose()},...i})})}Pt.displayName=`@mantine/core/ModalBaseOverlay`;function Ft(){let e=j();return(0,E.useEffect)(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}function It({className:e,...t}){let n=Ft(),r=j();return(0,D.jsx)(x,{component:`h2`,className:o({[z.title]:!r.unstyled},e),id:n,...t})}It.displayName=`@mantine/core/ModalBaseTitle`;function Lt({children:e}){return(0,D.jsx)(D.Fragment,{children:e})}var[Rt,B]=ne(`Modal component was not found in tree`),V={root:`m_9df02822`,content:`m_54c44539`,inner:`m_1f958f16`,header:`m_d0e2b9cd`},H=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=m(`ModalBody`,null,e);return(0,D.jsx)(Ot,{...B().getStyles(`body`,{classNames:t,style:r,styles:i,className:n}),...o})});H.classes=V,H.displayName=`@mantine/core/ModalBody`;var U=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=m(`ModalCloseButton`,null,e);return(0,D.jsx)(kt,{...B().getStyles(`close`,{classNames:t,style:r,styles:i,className:n}),...o})});U.classes=V,U.displayName=`@mantine/core/ModalCloseButton`;var W=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,__hidden:s,...c}=m(`ModalContent`,null,e),l=B(),d=l.scrollAreaComponent||Lt;return(0,D.jsx)(At,{...l.getStyles(`content`,{className:n,style:r,styles:i,classNames:t}),innerProps:l.getStyles(`inner`,{className:n,style:r,styles:i,classNames:t}),"data-full-screen":l.fullScreen||void 0,"data-modal-content":!0,"data-hidden":s||void 0,...c,children:(0,D.jsx)(d,{style:{maxHeight:l.fullScreen?`100dvh`:`calc(100dvh - (${u(l.yOffset)} * 2))`},children:o})})});W.classes=V,W.displayName=`@mantine/core/ModalContent`;var G=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=m(`ModalHeader`,null,e);return(0,D.jsx)(jt,{...B().getStyles(`header`,{classNames:t,style:r,styles:i,className:n}),...o})});G.classes=V,G.displayName=`@mantine/core/ModalHeader`;var K=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=m(`ModalOverlay`,null,e);return(0,D.jsx)(Pt,{...B().getStyles(`overlay`,{classNames:t,style:r,styles:i,className:n}),...o})});K.classes=V,K.displayName=`@mantine/core/ModalOverlay`;var zt={__staticSelector:`Modal`,closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:w(`modal`),transitionProps:{duration:200,transition:`fade-down`},yOffset:`5dvh`},Bt=a((e,{radius:t,size:n,yOffset:r,xOffset:i})=>({root:{"--modal-radius":t===void 0?void 0:c(t),"--modal-size":v(n,`modal-size`),"--modal-y-offset":u(r),"--modal-x-offset":u(i)}})),q=t(e=>{let t=m(`ModalRoot`,zt,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,yOffset:c,scrollAreaComponent:l,radius:u,fullScreen:d,centered:f,xOffset:p,__staticSelector:g,attributes:_,...v}=t,y=h({name:g,classes:V,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:_,vars:s,varsResolver:Bt});return(0,D.jsx)(Rt,{value:{yOffset:c,scrollAreaComponent:l,getStyles:y,fullScreen:d},children:(0,D.jsx)(Et,{...y(`root`),"data-full-screen":d||void 0,"data-centered":f||void 0,"data-offset-scrollbars":l===te.Autosize||void 0,unstyled:o,...v})})});q.classes=V,q.varsResolver=Bt,q.displayName=`@mantine/core/ModalRoot`;var Vt=(0,E.createContext)(null);function Ht({children:e}){let[t,n]=(0,E.useState)([]),[r,i]=(0,E.useState)(w(`modal`));return(0,D.jsx)(Vt,{value:{stack:t,addModal:(e,t)=>{n(t=>[...new Set([...t,e])]),i(e=>typeof t==`number`&&typeof e==`number`?Math.max(e,t):e)},removeModal:e=>n(t=>t.filter(t=>t!==e)),getZIndex:e=>`calc(${r} + ${t.indexOf(e)} + 1)`,currentId:t[t.length-1],maxZIndex:r},children:e})}Ht.displayName=`@mantine/core/ModalStack`;var Ut=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=m(`ModalTitle`,null,e);return(0,D.jsx)(It,{...B().getStyles(`title`,{classNames:t,style:r,styles:i,className:n}),...o})});Ut.classes=V,Ut.displayName=`@mantine/core/ModalTitle`;var Wt={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:w(`modal`),transitionProps:{duration:200,transition:`fade-down`},withOverlay:!0,withCloseButton:!0},J=t(e=>{let{title:t,withOverlay:n,overlayProps:r,withCloseButton:i,closeButtonProps:a,children:o,radius:s,opened:c,stackId:l,zIndex:u,...d}=m(`Modal`,Wt,e),f=(0,E.use)(Vt),p=!!t||i,h=f&&l?{closeOnEscape:f.currentId===l,trapFocus:f.currentId===l,zIndex:f.getZIndex(l)}:{},g=n===!1?!1:l&&f?f.currentId===l:c;return(0,E.useEffect)(()=>{f&&l&&(c?f.addModal(l,u||w(`modal`)):f.removeModal(l))},[c,l,u]),(0,D.jsxs)(q,{radius:s,opened:c,zIndex:f&&l?f.getZIndex(l):u,...d,...h,children:[n&&(0,D.jsx)(K,{visible:g,transitionProps:f&&l?{duration:0}:void 0,...r}),(0,D.jsxs)(W,{radius:s,__hidden:f&&l&&c?l!==f.currentId:!1,children:[p&&(0,D.jsxs)(G,{children:[t&&(0,D.jsx)(Ut,{children:t}),i&&(0,D.jsx)(U,{...a})]}),(0,D.jsx)(H,{children:o})]})]})});J.classes=V,J.displayName=`@mantine/core/Modal`,J.Root=q,J.Overlay=K,J.Content=W,J.Body=H,J.Header=G,J.Title=Ut,J.CloseButton=U,J.Stack=Ht;var Gt=E.createContext(void 0),Kt=e=>{let t=E.useContext(Gt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},qt=({client:e,children:t})=>(E.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,D.jsx)(Gt.Provider,{value:e,children:t})),Jt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Y=new class{#e=Jt;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Yt(e){setTimeout(e,0)}var Xt=typeof window>`u`||`Deno`in globalThis;function X(){}function Zt(e,t){return typeof e==`function`?e(t):e}function Qt(e){return typeof e==`number`&&e>=0&&e!==1/0}function $t(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Z(e,t){return typeof e==`function`?e(t):e}function en(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==nn(o,t.options))return!1}else if(!Q(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function tn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(rn(t.options.mutationKey)!==rn(a))return!1}else if(!Q(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function nn(e,t){return(t?.queryKeyHashFn||rn)(e)}function rn(e){return JSON.stringify(e,(e,t)=>ln(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Q(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n500)return t;let r=cn(e)&&cn(t);if(!r&&!(ln(e)&&ln(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{Y.setTimeout(t,e)})}function fn(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:on(e,t)}function pn(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function mn(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var hn=Symbol();function gn(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===hn?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function _n(e,t){return typeof e==`function`?e(...t):!!e}function vn(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var yn=()=>Xt,bn=()=>yn(),xn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Sn=new class extends xn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Cn=Yt;function wn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Cn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var $=wn(),Tn=new class extends xn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function En(e){return Math.min(1e3*2**e,3e4)}function Dn(e){return(e??`online`)!==`online`||Tn.isOnline()}var On=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function kn(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(X);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new On(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Sn.isFocused()&&(e.networkMode===`always`||Tn.isOnline())&&e.canRun(),p=()=>Dn(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(bn()?0:3),a=e.retryDelay??En,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var An=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Qt(this.gcTime)&&(this.#e=Y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bn()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Y.clearTimeout(this.#e),this.#e=void 0)}};function jn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{vn(e,()=>t.signal,()=>n=!0)},u=gn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?mn:pn;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Nn:Mn,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Mn(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Mn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Nn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Pn(e,t){return t?Mn(e,t)!=null:!1}function Fn(e,t){return!t||!e.getPreviousPageParam?!1:Nn(e,t)!=null}var In=class extends An{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=zn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=zn(this.options);e.data!==void 0&&(this.setState(Rn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=fn(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(X).catch(X):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Z(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===hn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Z(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!$t(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=gn(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?jn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=kn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof On&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof On){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ln(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Rn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),$.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ln(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Dn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Rn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function zn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Bn=class extends xn{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Hn(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Un(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Un(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Z(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!sn(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Wn(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Z(this.options.enabled,this.#t)!==Z(t.enabled,this.#t)||Z(this.options.staleTime,this.#t)!==Z(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Z(this.options.enabled,this.#t)!==Z(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return sn(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(X)),t}#h(e){return!bn()&&Z(this.options.enabled,this.#t)!==!1&&Qt(e)}#g(){this.#b();let e=Z(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=$t(this.#r.dataUpdatedAt,e)+1;this.#u=Y.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=Y.setInterval(()=>{(this.options.refetchIntervalInBackground||Sn.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Y.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Y.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Hn(e,t),o=i&&Wn(e,n,t,r);(a||o)&&(l={...l,...Ln(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=fn(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=fn(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Gn(e,t),refetch:this.refetch,isEnabled:Z(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),sn(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();$.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Vn(e,t){return Z(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Z(t.retryOnMount,e)!==!1)}function Hn(e,t){return Vn(e,t)||e.state.data!==void 0&&Un(e,t,t.refetchOnMount)}function Un(e,t,n){if(Z(t.enabled,e)!==!1&&Z(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Gn(e,t)}return!1}function Wn(e,t,n,r){return(e!==t||Z(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Gn(e,n)}function Gn(e,t){return Z(t.enabled,e)!==!1&&e.isStaleByTime(Z(t.staleTime,e))}var Kn=class extends An{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||qn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=kn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),$.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function qn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Jn=E.createContext(!1),Yn=()=>E.useContext(Jn);Jn.Provider;function Xn(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Zn=E.createContext(Xn()),Qn=()=>E.useContext(Zn),$n=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?_n(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},er=e=>{E.useEffect(()=>{e.clearReset()},[e])},tr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||_n(n,[e.error,r])),nr=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},rr=(e,t)=>e?.suspense&&t.isPending,ir=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ar(e,t,n){let r=Yn(),i=Qn(),a=Kt(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,nr(o),$n(o,i,s),er(i);let[l]=E.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(E.useSyncExternalStore(E.useCallback(e=>{let t=d?l.subscribe($.batchCalls(e)):X;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),rr(o,u))throw ir(o,l,i);if(tr({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function or(e,t){return ar(e,Bn,t)}var sr=[`dashboards`],cr=[`agent-threads`];async function lr(e){let t=await C(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}export{Lt as A,k as B,Z as C,qt as D,hn as E,kt as F,me as H,Ot as I,Et as L,Pt as M,jt as N,Kt as O,At as P,Tt as R,Q as S,_n as T,re as U,O as V,rn as _,ar as a,en as b,Bn as c,Fn as d,Tn as f,Zt as g,xn as h,or as i,It as j,J as k,In as l,Sn as m,lr as n,Kn as o,$ as p,cr as r,qn as s,sr as t,Pn as u,nn as v,sn as w,X as x,tn as y,A as z}; \ No newline at end of file diff --git a/internal/ui/dist/assets/auth-BeUORN-q.js b/internal/ui/dist/assets/auth-BeUORN-q.js new file mode 100644 index 000000000..18b96097f --- /dev/null +++ b/internal/ui/dist/assets/auth-BeUORN-q.js @@ -0,0 +1 @@ +import{A as e,C as t,K as n,Q as r,St as i,X as a,_ as o,a as s,c,d as l,et as ee,f as u,gt as d,h as f,i as te,j as p,k as ne,l as re,m,mt as h,o as g,p as _,r as ie,s as v,st as ae,t as oe,u as y,x as se,y as ce}from"./brand-MzZ03bSa.js";var b=i(d(),1),le=b.use,x=b.useLayoutEffect;function S(e,t,n){b.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function C(e){let t=b.useRef(null);return b.useImperativeHandle(e,()=>t.current,[]),t}var w=b.createContext(null);function T(e){return b.useContext(w)}function E(e){let t=T();return b.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function D(e){let t=T(),n=E(),r=b.useRef(null);return x(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function O({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){let[i,a]=(0,b.useState)(t===void 0?n:t);return e===void 0?[i,(e,...t)=>{a(e),r?.(e,...t)},!1]:[e,r,!0]}var k={root:`m_b183c0a2`},A=h(),ue=a((e,{color:t})=>({root:{"--code-bg":t?n(t,e):void 0}})),j=t(e=>{let t=p(`Code`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,color:c,block:l,mod:ee,attributes:u,...d}=t,f=ne({name:`Code`,props:t,classes:k,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:u,vars:s,varsResolver:ue});return(0,A.jsx)(se,{component:l?`pre`:`code`,mod:[{block:l},ee],...f(`root`),...d,dir:`ltr`})});j.classes=k,j.varsResolver=ue,j.displayName=`@mantine/core/Code`;function M(e,t){if(e<1)return[];let n=Array(e).fill(``);if(t){let r=t.trim().split(``);for(let t=0;t({root:{"--pin-input-size":ae(t??`sm`,`pin-input-size`)}})),L=t(t=>{let{name:n,form:i,className:a,value:o,defaultValue:s,variant:c,gap:l,style:u,size:d,classNames:te,styles:re,unstyled:h,length:g,onChange:_,onComplete:ie,manageFocus:v,autoFocus:ae,error:oe,success:y,radius:se,disabled:ce,oneTimeCode:le,placeholder:x,type:S,mask:C,readOnly:w,inputType:T,inputMode:E,ariaLabel:D,vars:k,id:ue,hiddenInputProps:j,rootRef:L,getInputProps:R,attributes:z,ref:de,...fe}=p([`Input`,`PinInput`],F,t),B=ee(ue),pe=ne({name:`PinInput`,classes:N,props:t,className:a,style:u,classNames:te,styles:re,unstyled:h,attributes:z,vars:k,varsResolver:I}),{resolvedClassNames:V,resolvedStyles:H}=e({classNames:te,styles:re,props:t}),[U,me]=(0,b.useState)(-1),W=(0,b.useRef)([]),G=g??4,he=(0,b.useRef)(!1),[ge,K]=O({value:o===void 0?void 0:M(G,o),defaultValue:s?.split(``).slice(0,G),finalValue:M(G,``),onChange:e=>{let t=e.join(``).trim();_?.(t),t.length===G&&!he.current?(he.current=!0,ie?.(t)):t.length(S instanceof RegExp?S:S&&S in P?P[S]:null)?.test(e),X=(e,t)=>{if(v){if(e===`next`){let e=t+1;e=0&&W.current[e]?.focus()}}},Z=(e,t)=>{let n=[...q];return n[t]=e,K(n),n},_e=(e,t)=>{let n=e.target.value;if(n.length>1){if(n.length>2){if(Y(n)){K(M(G,n));let e=Math.min(n.length,G);e{let{ctrlKey:n,metaKey:r,key:i,shiftKey:a,target:o}=e,s=o.value;if(E===`numeric`){let t=[`Backspace`,`Tab`,`Control`,`Delete`,`ArrowLeft`,`ArrowRight`],a=n||r;if(!(t.includes(i)||a||!Number.isNaN(Number(i)))){e.preventDefault();return}}switch(i){case`ArrowLeft`:e.preventDefault(),X(`prev`,t);break;case`ArrowRight`:e.preventDefault(),X(`next`,t);break;case`Tab`:a&&t>0&&v&&(e.preventDefault(),X(`prev`,t));break;case` `:e.preventDefault(),X(`next`,t);break;case`Delete`:e.preventDefault(),Z(``,t);break;case`Backspace`:s===``?(e.preventDefault(),X(`prev`,t)):(Z(``,t),t0&&i===q[t]&&(e.preventDefault(),X(`next`,t))}},ye=(e,t)=>{e.target.select(),me(t)},Q=()=>{me(-1)},$=e=>{e.preventDefault();let t=e.clipboardData.getData(`text/plain`).replace(/[\n\r\s]+/g,``);if(Y(t.trim())){let e=M(G,t);K(e);let n=e.filter(e=>e!==``).length;n>=G?W.current[G-1]?.focus():W.current[n]?.focus()}};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(f,{...fe,...pe(`root`),ref:L,role:`group`,id:B,gap:l,unstyled:h,wrap:`nowrap`,variant:c,__size:d,dir:`ltr`,children:q.map((e,t)=>(0,b.createElement)(m,{component:`input`,...pe(`pinInput`,{style:{"--input-padding":`0`,"--input-text-align":`center`}}),classNames:V,styles:H,size:d,__staticSelector:`PinInput`,id:`${B}-${t+1}`,key:`${B}-${t}`,inputMode:E||(S===`number`?`numeric`:`text`),onChange:e=>_e(e,t),onKeyDown:e=>ve(e,t),onFocus:e=>ye(e,t),onBlur:Q,onPaste:$,type:T||(C?`password`:S===`number`?`tel`:`text`),radius:se,error:oe,success:y,variant:c,disabled:ce,ref:e=>{e&&(t===0&&r(de,e),W.current[t]=e)},autoComplete:le?`one-time-code`:`off`,placeholder:U===t?``:x,value:e,autoFocus:ae&&t===0,unstyled:h,"aria-label":D,readOnly:w,...R?.(t)}))}),(0,A.jsx)(`input`,{type:`hidden`,name:n,form:i,value:J,...j})]})});L.classes={...N,..._.classes},L.varsResolver=I,L.displayName=`@mantine/core/PinInput`;var R=t(e=>(0,A.jsx)(_,{component:`input`,...p([`Input`,`InputWrapper`,`TextInput`],null,e),__staticSelector:`TextInput`}));R.classes=_.classes,R.displayName=`@mantine/core/TextInput`;var z=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),de=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),fe=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z`}))]]),B=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:z}));B.displayName=`ArrowLeftIcon`;var pe=B,V=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:de}));V.displayName=`ArrowRightIcon`;var H=V,U=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:fe}));U.displayName=`UserPlusIcon`;var me=U,W=`fanout.access-token`,G=`fanout:unauthorized`;function he(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function ge(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function K(){localStorage.removeItem(W)}function q(){K(),window.dispatchEvent(new Event(G))}async function J(e,t={}){let n=new Headers(t.headers);n.set(`Fanout-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&q(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw Error(e.message??e.error??`You do not have permission to perform this action.`)}return r}async function Y(){let e=await J(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&q(),window.location.assign(`/`)}var X=(0,b.createContext)(null);function Z(){let e=(0,b.useContext)(X);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var _e=(0,b.createContext)(null);function ve(){let e=(0,b.useContext)(_e);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function ye(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``?null:{id:t.id,email:typeof t.email==`string`?t.email:``,name:typeof t.name==`string`?t.name:``,role:typeof t.role==`string`?t.role:``}}async function Q(e,t){let n=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t),credentials:`same-origin`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.message??r.error??`Request failed (${n.status})`);return r}function $({children:e,wide:t=!1}){return(0,A.jsx)(se,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,A.jsx)(re,{mih:`100dvh`,px:`md`,py:48,children:(0,A.jsx)(c,{size:t?680:480,w:`100%`,children:(0,A.jsx)(ce,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function be(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function xe(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function Se({children:e}){let t=E(),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(!1),[s,c]=(0,b.useState)(`none`),[ee,d]=(0,b.useState)(null),[p,ne]=(0,b.useState)(!1),[m,h]=(0,b.useState)(``),[_,ae]=(0,b.useState)(``),[ce,le]=(0,b.useState)(be),[x,S]=(0,b.useState)(xe),[C,w]=(0,b.useState)(``),[T,D]=(0,b.useState)(!1),[O,k]=(0,b.useState)(0),[ue,M]=(0,b.useState)(()=>Date.now()),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)(``),[z,de]=(0,b.useState)(null),[fe,B]=(0,b.useState)(!1),V=(0,b.useRef)(null),U=he(),W=s===`user`;async function q(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){c(`none`),d(null);return}let t=await e.json().catch(()=>null);c(ge(t)),d(ye(t))}async function J(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;d(ye(await e.json().catch(()=>null)))}catch{}}(0,b.useEffect)(()=>{let e=new URL(window.location.href);(e.searchParams.has(`setup_token`)||e.searchParams.has(`login_token`))&&(e.searchParams.delete(`setup_token`),e.searchParams.delete(`login_token`),t({href:e.pathname+e.search+e.hash,replace:!0}))},[t]),(0,b.useEffect)(()=>{K(),Q(`/api/auth/status`).then(r).catch(e=>I(String(e))).finally(()=>a(!0)),q().catch(()=>c(`none`)).finally(()=>ne(!0));let e=()=>{c(`none`),d(null)};return window.addEventListener(G,e),()=>window.removeEventListener(G,e)},[]),(0,b.useEffect)(()=>{p&&s===`none`&&x&&(P(!0),I(``),Q(`/api/auth/login-link`,{token:x}).then(()=>{c(`user`),J()}).catch(e=>I(e instanceof Error?e.message:String(e))).finally(()=>{S(``),P(!1)}))},[x,p,s]),(0,b.useEffect)(()=>{W&&p&&U&&window.location.replace(U)},[W,U,p]),(0,b.useEffect)(()=>{if(O<=Date.now())return;let e=setInterval(()=>{M(Date.now()),Date.now()>=O&&clearInterval(e)},1e3);return()=>clearInterval(e)},[O]);let Y=Math.max(0,Math.ceil((O-ue)/1e3));(0,b.useEffect)(()=>{T&&!N&&F&&V.current?.querySelector(`input`)?.focus()},[N,T,F]);async function Z(e){try{await navigator.clipboard.writeText(e),B(!0)}catch{I(`Clipboard access failed. Select and copy the token manually.`)}}if(z?.ingest_token)return(0,A.jsx)($,{wide:!0,children:(0,A.jsxs)(v,{gap:`lg`,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,A.jsx)(g,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,A.jsx)(l,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,A.jsx)(j,{block:!0,children:z.suggested_endpoint??`${window.location.hostname}:4317`})]}),(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`Header`}),(0,A.jsxs)(j,{block:!0,children:[z.ingest_header_name??`Authorization`,`: Bearer `,z.ingest_token]})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),(0,A.jsxs)(f,{grow:!0,align:`stretch`,children:[(0,A.jsx)(y,{variant:`light`,radius:`md`,leftSection:fe?(0,A.jsx)(te,{size:16,weight:`bold`}):(0,A.jsx)(ie,{size:16}),onClick:()=>void Z(`${z.ingest_header_name??`Authorization`}: Bearer ${z.ingest_token}`),children:fe?`Copied`:`Copy header`}),(0,A.jsx)(y,{radius:`md`,rightSection:(0,A.jsx)(H,{size:16,weight:`bold`}),onClick:()=>{c(`user`),de(null),J()},children:`Continue to Fanout`})]}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,onClick:()=>void Z(z.ingest_token??``),children:`Copy token only`})]})});if(!p||!i||x)return(0,A.jsx)(re,{mih:`100dvh`,children:(0,A.jsx)(o,{size:`sm`})});if(!n)return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:`lg`,children:[(0,A.jsx)(oe,{}),(0,A.jsx)(g,{order:1,children:`Fanout is unavailable`}),(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F||`Authentication status could not be loaded.`})]})});if(W&&U)return null;if(W)return(0,A.jsx)(X.Provider,{value:n,children:(0,A.jsx)(_e.Provider,{value:ee??{id:``,email:m,name:_,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=U?`/api/auth/oidc/start?return_to=${encodeURIComponent(U)}`:`/api/auth/oidc/start`;return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:28,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(v,{gap:10,children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,A.jsx)(g,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,A.jsx)(l,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),(0,A.jsx)(y,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,A.jsx)(H,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ve(){P(!0),I(``);try{await Q(`/api/auth/start`,{email:m}),D(!0),w(``),k(Date.now()+3e4),M(Date.now())}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}async function Se(e){P(!0),I(``);try{await Q(`/api/auth/verify`,{email:m,code:e}),c(`user`),D(!1),w(``),k(0),J()}catch(e){w(``),I(e instanceof Error?e.message:String(e))}finally{P(!1)}}function Ce(){D(!1),w(``),I(``)}async function we(e){e.preventDefault(),P(!0),I(``);try{if(n?.setup_required){let e=await Q(`/api/auth/setup`,{email:m,name:_,setup_token:ce});e.ingest_token?de(e):(c(`user`),J())}else if(T){await Se(C);return}else{await ve();return}}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}let Te=T&&!n?.setup_required,Ee=n?.setup_required?`Create the first admin`:Te?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,De=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?Te?`We sent a code to ${m}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:28,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(v,{gap:10,children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,A.jsx)(g,{order:1,fz:{base:28,sm:32},lh:1.08,children:Ee}),De&&(0,A.jsx)(l,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:De})]}),(0,A.jsx)(`form`,{onSubmit:we,children:(0,A.jsxs)(v,{gap:`md`,children:[(0,A.jsx)(R,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:m,onChange:e=>h(e.currentTarget.value),disabled:T,variant:`filled`,radius:`md`,size:`md`,autoFocus:!T}),n?.setup_required&&(0,A.jsx)(R,{label:`Name`,placeholder:`Your name`,value:_,onChange:e=>ae(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,A.jsx)(R,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:ce,onChange:e=>le(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),Te&&(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`Verification code`}),(0,A.jsx)(se,{ref:V,children:(0,A.jsx)(L,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:C,onChange:w,onComplete:e=>void Se(e),disabled:N,error:!!F,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,A.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,A.jsxs)(l,{c:`dimmed`,size:`xs`,children:[`Sent to `,m]}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,leftSection:(0,A.jsx)(pe,{size:12,weight:`bold`}),onClick:Ce,disabled:N,children:`Change email`})]}),(0,A.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,A.jsx)(l,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(),disabled:N||Y>0,children:Y>0?`Resend in ${Y}s`:`Resend code`})]})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),Te?(0,A.jsx)(y,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:N,disabled:N||C.length<6,rightSection:(0,A.jsx)(H,{size:17,weight:`bold`}),children:`Verify code`}):(0,A.jsx)(y,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:N,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,A.jsx)(me,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,A.jsx)(H,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}export{Y as a,O as c,T as d,w as f,x as g,S as h,J as i,D as l,C as m,Z as n,R as o,le as p,ve as r,j as s,Se as t,E as u}; \ No newline at end of file diff --git a/internal/ui/dist/assets/auth-DNoFbJyG.js b/internal/ui/dist/assets/auth-DNoFbJyG.js deleted file mode 100644 index 8a3048c44..000000000 --- a/internal/ui/dist/assets/auth-DNoFbJyG.js +++ /dev/null @@ -1 +0,0 @@ -import{A as e,C as t,K as n,Q as r,St as i,X as a,_ as o,a as s,c,d as l,et as ee,f as u,gt as d,h as f,i as te,j as p,k as ne,l as re,m,mt as h,o as g,p as _,r as ie,s as v,st as ae,t as y,u as b,x as oe,y as se}from"./brand-MzZ03bSa.js";var x=i(d(),1),ce=x.use,S=x.useLayoutEffect;function C(e,t,n){x.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function w(e){let t=x.useRef(null);return x.useImperativeHandle(e,()=>t.current,[]),t}var T=x.createContext(null);function E(e){return x.useContext(T)}function D(e){let t=E();return x.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function O(e){let t=E(),n=D(),r=x.useRef(null);return S(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function k({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){let[i,a]=(0,x.useState)(t===void 0?n:t);return e===void 0?[i,(e,...t)=>{a(e),r?.(e,...t)},!1]:[e,r,!0]}var A={root:`m_b183c0a2`},j=h(),le=a((e,{color:t})=>({root:{"--code-bg":t?n(t,e):void 0}})),M=t(e=>{let t=p(`Code`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,color:c,block:l,mod:ee,attributes:u,...d}=t,f=ne({name:`Code`,props:t,classes:A,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:u,vars:s,varsResolver:le});return(0,j.jsx)(oe,{component:l?`pre`:`code`,mod:[{block:l},ee],...f(`root`),...d,dir:`ltr`})});M.classes=A,M.varsResolver=le,M.displayName=`@mantine/core/Code`;function N(e,t){if(e<1)return[];let n=Array(e).fill(``);if(t){let r=t.trim().split(``);for(let t=0;t({root:{"--pin-input-size":ae(t??`sm`,`pin-input-size`)}})),R=t(t=>{let{name:n,form:i,className:a,value:o,defaultValue:s,variant:c,gap:l,style:u,size:d,classNames:te,styles:re,unstyled:h,length:g,onChange:_,onComplete:ie,manageFocus:v,autoFocus:ae,error:y,success:b,radius:oe,disabled:se,oneTimeCode:ce,placeholder:S,type:C,mask:w,readOnly:T,inputType:E,inputMode:D,ariaLabel:O,vars:A,id:le,hiddenInputProps:M,rootRef:R,getInputProps:z,attributes:B,ref:ue,...de}=p([`Input`,`PinInput`],I,t),V=ee(le),fe=ne({name:`PinInput`,classes:P,props:t,className:a,style:u,classNames:te,styles:re,unstyled:h,attributes:B,vars:A,varsResolver:L}),{resolvedClassNames:H,resolvedStyles:U}=e({classNames:te,styles:re,props:t}),[W,pe]=(0,x.useState)(-1),G=(0,x.useRef)([]),K=g??4,me=(0,x.useRef)(!1),[he,q]=k({value:o===void 0?void 0:N(K,o),defaultValue:s?.split(``).slice(0,K),finalValue:N(K,``),onChange:e=>{let t=e.join(``).trim();_?.(t),t.length===K&&!me.current?(me.current=!0,ie?.(t)):t.length(C instanceof RegExp?C:C&&C in F?F[C]:null)?.test(e),Z=(e,t)=>{if(v){if(e===`next`){let e=t+1;e=0&&G.current[e]?.focus()}}},Q=(e,t)=>{let n=[...J];return n[t]=e,q(n),n},ge=(e,t)=>{let n=e.target.value;if(n.length>1){if(n.length>2){if(X(n)){q(N(K,n));let e=Math.min(n.length,K);e{let{ctrlKey:n,metaKey:r,key:i,shiftKey:a,target:o}=e,s=o.value;if(D===`numeric`){let t=[`Backspace`,`Tab`,`Control`,`Delete`,`ArrowLeft`,`ArrowRight`],a=n||r;if(!(t.includes(i)||a||!Number.isNaN(Number(i)))){e.preventDefault();return}}switch(i){case`ArrowLeft`:e.preventDefault(),Z(`prev`,t);break;case`ArrowRight`:e.preventDefault(),Z(`next`,t);break;case`Tab`:a&&t>0&&v&&(e.preventDefault(),Z(`prev`,t));break;case` `:e.preventDefault(),Z(`next`,t);break;case`Delete`:e.preventDefault(),Q(``,t);break;case`Backspace`:s===``?(e.preventDefault(),Z(`prev`,t)):(Q(``,t),t0&&i===J[t]&&(e.preventDefault(),Z(`next`,t))}},ve=(e,t)=>{e.target.select(),pe(t)},$=()=>{pe(-1)},ye=e=>{e.preventDefault();let t=e.clipboardData.getData(`text/plain`).replace(/[\n\r\s]+/g,``);if(X(t.trim())){let e=N(K,t);q(e);let n=e.filter(e=>e!==``).length;n>=K?G.current[K-1]?.focus():G.current[n]?.focus()}};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(f,{...de,...fe(`root`),ref:R,role:`group`,id:V,gap:l,unstyled:h,wrap:`nowrap`,variant:c,__size:d,dir:`ltr`,children:J.map((e,t)=>(0,x.createElement)(m,{component:`input`,...fe(`pinInput`,{style:{"--input-padding":`0`,"--input-text-align":`center`}}),classNames:H,styles:U,size:d,__staticSelector:`PinInput`,id:`${V}-${t+1}`,key:`${V}-${t}`,inputMode:D||(C===`number`?`numeric`:`text`),onChange:e=>ge(e,t),onKeyDown:e=>_e(e,t),onFocus:e=>ve(e,t),onBlur:$,onPaste:ye,type:E||(w?`password`:C===`number`?`tel`:`text`),radius:oe,error:y,success:b,variant:c,disabled:se,ref:e=>{e&&(t===0&&r(ue,e),G.current[t]=e)},autoComplete:ce?`one-time-code`:`off`,placeholder:W===t?``:S,value:e,autoFocus:ae&&t===0,unstyled:h,"aria-label":O,readOnly:T,...z?.(t)}))}),(0,j.jsx)(`input`,{type:`hidden`,name:n,form:i,value:Y,...M})]})});R.classes={...P,..._.classes},R.varsResolver=L,R.displayName=`@mantine/core/PinInput`;var z=t(e=>(0,j.jsx)(_,{component:`input`,...p([`Input`,`InputWrapper`,`TextInput`],null,e),__staticSelector:`TextInput`}));z.classes=_.classes,z.displayName=`@mantine/core/TextInput`;var B=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),ue=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),de=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z`}))]]),V=x.forwardRef((e,t)=>x.createElement(s,{ref:t,...e,weights:B}));V.displayName=`ArrowLeftIcon`;var fe=V,H=x.forwardRef((e,t)=>x.createElement(s,{ref:t,...e,weights:ue}));H.displayName=`ArrowRightIcon`;var U=H,W=x.forwardRef((e,t)=>x.createElement(s,{ref:t,...e,weights:de}));W.displayName=`UserPlusIcon`;var pe=W,G=`fanout.access-token`,K=`fanout:unauthorized`;function me(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function he(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function q(){localStorage.removeItem(G)}function J(){q(),window.dispatchEvent(new Event(K))}async function Y(e,t={}){let n=new Headers(t.headers);n.set(`Fanout-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&J(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw Error(e.message??e.error??`You do not have permission to perform this action.`)}return r}async function X(){let e=await Y(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&J(),window.location.assign(`/`)}var Z=(0,x.createContext)(null);function Q(){let e=(0,x.useContext)(Z);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var ge=(0,x.createContext)(null);function _e(){let e=(0,x.useContext)(ge);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function ve(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``?null:{id:t.id,email:typeof t.email==`string`?t.email:``,name:typeof t.name==`string`?t.name:``,role:typeof t.role==`string`?t.role:``}}async function $(e,t){let n=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t),credentials:`same-origin`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.message??r.error??`Request failed (${n.status})`);return r}function ye({children:e,wide:t=!1}){return(0,j.jsx)(oe,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,j.jsx)(re,{mih:`100dvh`,px:`md`,py:48,children:(0,j.jsx)(c,{size:t?680:480,w:`100%`,children:(0,j.jsx)(se,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function be(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function xe(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function Se({children:e}){let t=D(),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!1),[s,c]=(0,x.useState)(`none`),[ee,d]=(0,x.useState)(null),[p,ne]=(0,x.useState)(!1),[m,h]=(0,x.useState)(``),[_,ae]=(0,x.useState)(``),[se,ce]=(0,x.useState)(be),[S,C]=(0,x.useState)(xe),[w,T]=(0,x.useState)(``),[E,O]=(0,x.useState)(!1),[k,A]=(0,x.useState)(0),[le,N]=(0,x.useState)(()=>Date.now()),[P,F]=(0,x.useState)(!1),[I,L]=(0,x.useState)(``),[B,ue]=(0,x.useState)(null),[de,V]=(0,x.useState)(!1),H=(0,x.useRef)(null),W=me(),G=s===`user`;async function J(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){c(`none`),d(null);return}let t=await e.json().catch(()=>null);c(he(t)),d(ve(t))}async function Y(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;d(ve(await e.json().catch(()=>null)))}catch{}}(0,x.useEffect)(()=>{let e=new URL(window.location.href);(e.searchParams.has(`setup_token`)||e.searchParams.has(`login_token`))&&(e.searchParams.delete(`setup_token`),e.searchParams.delete(`login_token`),t({href:e.pathname+e.search+e.hash,replace:!0}))},[t]),(0,x.useEffect)(()=>{q(),$(`/api/auth/status`).then(r).catch(e=>L(String(e))).finally(()=>a(!0)),J().catch(()=>c(`none`)).finally(()=>ne(!0));let e=()=>{c(`none`),d(null)};return window.addEventListener(K,e),()=>window.removeEventListener(K,e)},[]),(0,x.useEffect)(()=>{p&&s===`none`&&S&&(F(!0),L(``),$(`/api/auth/login-link`,{token:S}).then(()=>{c(`user`),Y()}).catch(e=>L(e instanceof Error?e.message:String(e))).finally(()=>{C(``),F(!1)}))},[S,p,s]),(0,x.useEffect)(()=>{G&&p&&W&&window.location.replace(W)},[G,W,p]),(0,x.useEffect)(()=>{if(k<=Date.now())return;let e=setInterval(()=>{N(Date.now()),Date.now()>=k&&clearInterval(e)},1e3);return()=>clearInterval(e)},[k]);let X=Math.max(0,Math.ceil((k-le)/1e3));(0,x.useEffect)(()=>{E&&!P&&I&&H.current?.querySelector(`input`)?.focus()},[P,E,I]);async function Q(e){try{await navigator.clipboard.writeText(e),V(!0)}catch{L(`Clipboard access failed. Select and copy the token manually.`)}}if(B?.ingest_token)return(0,j.jsx)(ye,{wide:!0,children:(0,j.jsxs)(v,{gap:`lg`,children:[(0,j.jsx)(y,{}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,j.jsx)(g,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,j.jsx)(l,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,j.jsxs)(v,{gap:`xs`,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,j.jsx)(M,{block:!0,children:B.suggested_endpoint??`${window.location.hostname}:4317`})]}),(0,j.jsxs)(v,{gap:`xs`,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:`Header`}),(0,j.jsxs)(M,{block:!0,children:[B.ingest_header_name??`Authorization`,`: Bearer `,B.ingest_token]})]}),I&&(0,j.jsx)(u,{color:`bad`,radius:`md`,children:I}),(0,j.jsxs)(f,{grow:!0,align:`stretch`,children:[(0,j.jsx)(b,{variant:`light`,radius:`md`,leftSection:de?(0,j.jsx)(te,{size:16,weight:`bold`}):(0,j.jsx)(ie,{size:16}),onClick:()=>void Q(`${B.ingest_header_name??`Authorization`}: Bearer ${B.ingest_token}`),children:de?`Copied`:`Copy header`}),(0,j.jsx)(b,{radius:`md`,rightSection:(0,j.jsx)(U,{size:16,weight:`bold`}),onClick:()=>{c(`user`),ue(null),Y()},children:`Continue to Fanout`})]}),(0,j.jsx)(b,{variant:`subtle`,size:`compact-xs`,onClick:()=>void Q(B.ingest_token??``),children:`Copy token only`})]})});if(!p||!i||S)return(0,j.jsx)(re,{mih:`100dvh`,children:(0,j.jsx)(o,{size:`sm`})});if(!n)return(0,j.jsx)(ye,{children:(0,j.jsxs)(v,{gap:`lg`,children:[(0,j.jsx)(y,{}),(0,j.jsx)(g,{order:1,children:`Fanout is unavailable`}),(0,j.jsx)(u,{color:`bad`,radius:`md`,children:I||`Authentication status could not be loaded.`})]})});if(G&&W)return null;if(G)return(0,j.jsx)(Z.Provider,{value:n,children:(0,j.jsx)(ge.Provider,{value:ee??{id:``,email:m,name:_,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=W?`/api/auth/oidc/start?return_to=${encodeURIComponent(W)}`:`/api/auth/oidc/start`;return(0,j.jsx)(ye,{children:(0,j.jsxs)(v,{gap:28,children:[(0,j.jsx)(y,{}),(0,j.jsxs)(v,{gap:10,children:[(0,j.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,j.jsx)(g,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,j.jsx)(l,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),I&&(0,j.jsx)(u,{color:`bad`,radius:`md`,children:I}),(0,j.jsx)(b,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,j.jsx)(U,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function _e(){F(!0),L(``);try{await $(`/api/auth/start`,{email:m}),O(!0),T(``),A(Date.now()+3e4),N(Date.now())}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}async function Se(e){F(!0),L(``);try{await $(`/api/auth/verify`,{email:m,code:e}),c(`user`),O(!1),T(``),A(0),Y()}catch(e){T(``),L(e instanceof Error?e.message:String(e))}finally{F(!1)}}function Ce(){O(!1),T(``),L(``)}async function we(e){e.preventDefault(),F(!0),L(``);try{if(n?.setup_required){let e=await $(`/api/auth/setup`,{email:m,name:_,setup_token:se});e.ingest_token?ue(e):(c(`user`),Y())}else if(E){await Se(w);return}else{await _e();return}}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}let Te=E&&!n?.setup_required,Ee=n?.setup_required?`Create the first admin`:Te?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,De=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?Te?`We sent a code to ${m}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,j.jsx)(ye,{children:(0,j.jsxs)(v,{gap:28,children:[(0,j.jsx)(y,{}),(0,j.jsxs)(v,{gap:10,children:[(0,j.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,j.jsx)(g,{order:1,fz:{base:28,sm:32},lh:1.08,children:Ee}),De&&(0,j.jsx)(l,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:De})]}),(0,j.jsx)(`form`,{onSubmit:we,children:(0,j.jsxs)(v,{gap:`md`,children:[(0,j.jsx)(z,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:m,onChange:e=>h(e.currentTarget.value),disabled:E,variant:`filled`,radius:`md`,size:`md`,autoFocus:!E}),n?.setup_required&&(0,j.jsx)(z,{label:`Name`,placeholder:`Your name`,value:_,onChange:e=>ae(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,j.jsx)(z,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:se,onChange:e=>ce(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),Te&&(0,j.jsxs)(v,{gap:`xs`,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:`Verification code`}),(0,j.jsx)(oe,{ref:H,children:(0,j.jsx)(R,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:w,onChange:T,onComplete:e=>void Se(e),disabled:P,error:!!I,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,j.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,j.jsxs)(l,{c:`dimmed`,size:`xs`,children:[`Sent to `,m]}),(0,j.jsx)(b,{variant:`subtle`,size:`compact-xs`,leftSection:(0,j.jsx)(fe,{size:12,weight:`bold`}),onClick:Ce,disabled:P,children:`Change email`})]}),(0,j.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,j.jsx)(l,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,j.jsx)(b,{variant:`subtle`,size:`compact-xs`,onClick:()=>void _e(),disabled:P||X>0,children:X>0?`Resend in ${X}s`:`Resend code`})]})]}),I&&(0,j.jsx)(u,{color:`bad`,radius:`md`,children:I}),Te?(0,j.jsx)(b,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:P,disabled:P||w.length<6,rightSection:(0,j.jsx)(U,{size:17,weight:`bold`}),children:`Verify code`}):(0,j.jsx)(b,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:P,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,j.jsx)(pe,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,j.jsx)(U,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}export{X as a,O as c,T as d,ce as f,S as h,Y as i,D as l,C as m,Q as n,z as o,w as p,_e as r,k as s,Se as t,E as u}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat-B0CA6UcR.js b/internal/ui/dist/assets/chat-DuN0TFYv.js similarity index 83% rename from internal/ui/dist/assets/chat-B0CA6UcR.js rename to internal/ui/dist/assets/chat-DuN0TFYv.js index 288ac5e6a..3fb853fc9 100644 --- a/internal/ui/dist/assets/chat-B0CA6UcR.js +++ b/internal/ui/dist/assets/chat-DuN0TFYv.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-DQwCEkc1.js","assets/brand-MzZ03bSa.js","assets/auth-DNoFbJyG.js","assets/use-computed-color-scheme-6JIsge00.js"])))=>i.map(i=>d[i]); -import{$ as e,C as t,St as n,_ as r,_t as i,a,c as o,d as s,f as c,gt as l,h as u,i as d,j as f,k as p,l as m,mt as h,n as g,o as _,p as v,r as y,s as b,u as x,x as S,y as C,yt as w}from"./brand-MzZ03bSa.js";import{a as T,o as E,s as D,t as O}from"./preload-helper-xxyQ8-YB.js";import{n as k,t as ee}from"./copy-tlUaIRYM.js";function te(){return`development`}var A=n(l(),1),j=h(),ne=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],re={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function M(e){Object.keys(re).forEach(t=>{e.style.setProperty(t,re[t],`important`)})}function ie(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of ne)n[e]=t[e];return n.boxSizing===``?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var N=null;function ae(e,t,n=1,r=1/0){N||(N=document.createElement(`textarea`),N.setAttribute(`tabindex`,`-1`),N.setAttribute(`aria-hidden`,`true`),N.setAttribute(`aria-label`,`autosize measurement`),M(N)),N.parentNode===null&&document.body.appendChild(N);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{N.style[e]=o[e]}),M(N),N.value=t;let c=s===`border-box`?N.scrollHeight+a:N.scrollHeight-i;N.value=t,c=s===`border-box`?N.scrollHeight+a:N.scrollHeight-i,N.value=`x`;let l=N.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);let d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}function oe({maxRows:t,minRows:n,onChange:r,ref:i,...a}){let o=a.value!==void 0,s=(0,A.useRef)(null),c=e(s,i),l=(0,A.useRef)(0),u=(0,A.useRef)(0),d=()=>{let e=s.current;if(!e)return;let r=ie(e);if(!r)return;let[i]=ae(r,e.value||e.placeholder||`x`,n,t);l.current!==i&&(l.current=i,e.style.setProperty(`height`,`${i}px`,`important`))},f=e=>{o||d(),r?.(e)};return(0,A.useLayoutEffect)(d),(0,A.useEffect)(()=>{let e=()=>d();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,A.useEffect)(()=>{let e=s.current;if(!e||typeof ResizeObserver>`u`)return;u.current=e.offsetWidth;let t=new ResizeObserver(()=>{s.current&&s.current.offsetWidth!==u.current&&(u.current=s.current.offsetWidth,d())});return t.observe(e),()=>t.disconnect()},[]),(0,A.useEffect)(()=>{let e=()=>d();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,A.useEffect)(()=>{let e=e=>{if(s.current?.form===e.target&&!o){let e=s.current.value;requestAnimationFrame(()=>{s.current&&e!==s.current.value&&d()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[o]),(0,j.jsx)(`textarea`,{rows:n,...a,onChange:f,ref:c})}var se=t(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:a,bottomSection:o,bottomSectionProps:s,...c}=f([`Input`,`InputWrapper`,`Textarea`],null,e),l=t&&te()!==`test`,u=l?{maxRows:n,minRows:r}:{};return(0,j.jsx)(v,{component:l?oe:`textarea`,...c,__staticSelector:i||`Textarea`,__bottomSection:o,__bottomSectionProps:s,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":a},...u})});se.classes=v.classes,se.displayName=`@mantine/core/Textarea`;var ce={root:`m_d08caa0`},le=t(e=>{let t=f(`Typography`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,attributes:s,...c}=t;return(0,j.jsx)(S,{...p({name:`Typography`,classes:ce,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:s})(`root`),...c})});le.classes=ce,le.displayName=`@mantine/core/Typography`;var ue=new Map([[`bold`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),A.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),de=new Map([[`bold`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),A.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),fe=A.forwardRef((e,t)=>A.createElement(a,{ref:t,...e,weights:ue}));fe.displayName=`PaperPlaneTiltIcon`;var pe=fe,me=A.forwardRef((e,t)=>A.createElement(a,{ref:t,...e,weights:de}));me.displayName=`StopIcon`;var he=me;function ge(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var _e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ve=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ye={};function be(e,t){return((t||ye).jsx?ve:_e).test(e)}var xe=/[ \t\n\f\r]/g;function Se(e){return typeof e==`object`?e.type===`text`&&Ce(e.value):Ce(e)}function Ce(e){return e.replace(xe,``)===``}var we=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};we.prototype.normal={},we.prototype.property={},we.prototype.space=void 0;function Te(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new we(n,r,t)}function Ee(e){return e.toLowerCase()}var P=class{constructor(e,t){this.attribute=t,this.property=e}};P.prototype.attribute=``,P.prototype.booleanish=!1,P.prototype.boolean=!1,P.prototype.commaOrSpaceSeparated=!1,P.prototype.commaSeparated=!1,P.prototype.defined=!1,P.prototype.mustUseProperty=!1,P.prototype.number=!1,P.prototype.overloadedBoolean=!1,P.prototype.property=``,P.prototype.spaceSeparated=!1,P.prototype.space=void 0;var De=w({boolean:()=>F,booleanish:()=>I,commaOrSpaceSeparated:()=>z,commaSeparated:()=>Ae,number:()=>L,overloadedBoolean:()=>ke,spaceSeparated:()=>R}),Oe=0,F=je(),I=je(),ke=je(),L=je(),R=je(),Ae=je(),z=je();function je(){return 2**++Oe}var Me=Object.keys(De),Ne=class extends P{constructor(e,t,n,r){let i=-1;if(super(e,t),Pe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&qe.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ke,Xe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ke.test(e)){let n=e.replace(Ge,Ye);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ne}return new i(r,t)}function Ye(e){return`-`+e.toLowerCase()}function Xe(e){return e.charAt(1).toUpperCase()}var Ze=Te([Ie,ze,Ve,He,Ue],`html`),Qe=Te([Ie,Be,Ve,He,Ue],`svg`);function $e(e){return e.join(` `).trim()}var et=i(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-BZJusU6-.js","assets/brand-MzZ03bSa.js","assets/auth-BeUORN-q.js","assets/use-computed-color-scheme-6JIsge00.js"])))=>i.map(i=>d[i]); +import{$ as e,C as t,St as n,_ as r,_t as i,a,c as o,d as s,f as c,gt as l,h as u,i as d,j as f,k as p,l as m,mt as h,n as g,o as _,p as v,r as y,s as b,u as x,x as S,y as C,yt as w}from"./brand-MzZ03bSa.js";import{t as T}from"./Tooltip-BJiO7C_G.js";import{a as E,o as D,t as O}from"./preload-helper-BL3qEkUh.js";import{n as k,t as ee}from"./copy-Bzg2uCpz.js";function te(){return`development`}var A=n(l(),1),j=h(),ne=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],re={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function M(e){Object.keys(re).forEach(t=>{e.style.setProperty(t,re[t],`important`)})}function ie(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of ne)n[e]=t[e];return n.boxSizing===``?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var N=null;function ae(e,t,n=1,r=1/0){N||(N=document.createElement(`textarea`),N.setAttribute(`tabindex`,`-1`),N.setAttribute(`aria-hidden`,`true`),N.setAttribute(`aria-label`,`autosize measurement`),M(N)),N.parentNode===null&&document.body.appendChild(N);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{N.style[e]=o[e]}),M(N),N.value=t;let c=s===`border-box`?N.scrollHeight+a:N.scrollHeight-i;N.value=t,c=s===`border-box`?N.scrollHeight+a:N.scrollHeight-i,N.value=`x`;let l=N.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);let d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}function oe({maxRows:t,minRows:n,onChange:r,ref:i,...a}){let o=a.value!==void 0,s=(0,A.useRef)(null),c=e(s,i),l=(0,A.useRef)(0),u=(0,A.useRef)(0),d=()=>{let e=s.current;if(!e)return;let r=ie(e);if(!r)return;let[i]=ae(r,e.value||e.placeholder||`x`,n,t);l.current!==i&&(l.current=i,e.style.setProperty(`height`,`${i}px`,`important`))},f=e=>{o||d(),r?.(e)};return(0,A.useLayoutEffect)(d),(0,A.useEffect)(()=>{let e=()=>d();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,A.useEffect)(()=>{let e=s.current;if(!e||typeof ResizeObserver>`u`)return;u.current=e.offsetWidth;let t=new ResizeObserver(()=>{s.current&&s.current.offsetWidth!==u.current&&(u.current=s.current.offsetWidth,d())});return t.observe(e),()=>t.disconnect()},[]),(0,A.useEffect)(()=>{let e=()=>d();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,A.useEffect)(()=>{let e=e=>{if(s.current?.form===e.target&&!o){let e=s.current.value;requestAnimationFrame(()=>{s.current&&e!==s.current.value&&d()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[o]),(0,j.jsx)(`textarea`,{rows:n,...a,onChange:f,ref:c})}var se=t(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:a,bottomSection:o,bottomSectionProps:s,...c}=f([`Input`,`InputWrapper`,`Textarea`],null,e),l=t&&te()!==`test`,u=l?{maxRows:n,minRows:r}:{};return(0,j.jsx)(v,{component:l?oe:`textarea`,...c,__staticSelector:i||`Textarea`,__bottomSection:o,__bottomSectionProps:s,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":a},...u})});se.classes=v.classes,se.displayName=`@mantine/core/Textarea`;var ce={root:`m_d08caa0`},le=t(e=>{let t=f(`Typography`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,attributes:s,...c}=t;return(0,j.jsx)(S,{...p({name:`Typography`,classes:ce,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:s})(`root`),...c})});le.classes=ce,le.displayName=`@mantine/core/Typography`;var ue=new Map([[`bold`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),A.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),de=new Map([[`bold`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),A.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,A.createElement(A.Fragment,null,A.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),fe=A.forwardRef((e,t)=>A.createElement(a,{ref:t,...e,weights:ue}));fe.displayName=`PaperPlaneTiltIcon`;var pe=fe,me=A.forwardRef((e,t)=>A.createElement(a,{ref:t,...e,weights:de}));me.displayName=`StopIcon`;var he=me;function ge(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var _e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ve=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ye={};function be(e,t){return((t||ye).jsx?ve:_e).test(e)}var xe=/[ \t\n\f\r]/g;function Se(e){return typeof e==`object`?e.type===`text`&&Ce(e.value):Ce(e)}function Ce(e){return e.replace(xe,``)===``}var we=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};we.prototype.normal={},we.prototype.property={},we.prototype.space=void 0;function Te(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new we(n,r,t)}function Ee(e){return e.toLowerCase()}var P=class{constructor(e,t){this.attribute=t,this.property=e}};P.prototype.attribute=``,P.prototype.booleanish=!1,P.prototype.boolean=!1,P.prototype.commaOrSpaceSeparated=!1,P.prototype.commaSeparated=!1,P.prototype.defined=!1,P.prototype.mustUseProperty=!1,P.prototype.number=!1,P.prototype.overloadedBoolean=!1,P.prototype.property=``,P.prototype.spaceSeparated=!1,P.prototype.space=void 0;var De=w({boolean:()=>F,booleanish:()=>I,commaOrSpaceSeparated:()=>z,commaSeparated:()=>Ae,number:()=>L,overloadedBoolean:()=>ke,spaceSeparated:()=>R}),Oe=0,F=je(),I=je(),ke=je(),L=je(),R=je(),Ae=je(),z=je();function je(){return 2**++Oe}var Me=Object.keys(De),Ne=class extends P{constructor(e,t,n,r){let i=-1;if(super(e,t),Pe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&qe.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ke,Xe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ke.test(e)){let n=e.replace(Ge,Ye);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ne}return new i(r,t)}function Ye(e){return`-`+e.toLowerCase()}function Xe(e){return e.charAt(1).toUpperCase()}var Ze=Te([Ie,ze,Ve,He,Ue],`html`),Qe=Te([Ie,Be,Ve,He,Ue],`svg`);function $e(e){return e.join(` `).trim()}var et=i(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),tt=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(et());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),nt=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),rt=i(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(tt()),r=nt();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),it=ot(`end`),at=ot(`start`);function ot(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function st(e){let t=at(e),n=it(e);if(t&&n)return{start:t,end:n}}function ct(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?ut(e.position):`start`in e||`end`in e?ut(e):`line`in e||`column`in e?lt(e):``}function lt(e){return dt(e&&e.line)+`:`+dt(e&&e.column)}function ut(e){return lt(e&&e.start)+`-`+lt(e&&e.end)}function dt(e){return e&&typeof e==`number`?e:1}var B=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(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}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let 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=ct(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&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};B.prototype.file=``,B.prototype.name=``,B.prototype.reason=``,B.prototype.message=``,B.prototype.stack=``,B.prototype.column=void 0,B.prototype.line=void 0,B.prototype.ancestors=void 0,B.prototype.cause=void 0,B.prototype.fatal=void 0,B.prototype.place=void 0,B.prototype.ruleId=void 0,B.prototype.source=void 0;var ft=n(rt(),1),pt={}.hasOwnProperty,mt=new Map,ht=/[A-Z]/g,gt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),_t=new Set([`td`,`th`]),vt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function yt(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=At(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=kt(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Qe:Ze,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=bt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function bt(e,t,n){if(t.type===`element`)return xt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return St(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return wt(e,t,n);if(t.type===`mdxjsEsm`)return Ct(e,t);if(t.type===`root`)return Tt(e,t,n);if(t.type===`text`)return Et(e,t)}function xt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Qe,e.schema=i),e.ancestors.push(t);let a=It(e,t.tagName,!1),o=jt(e,t),s=Nt(e,t);return gt.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Se(e)})),Dt(e,o,a,t),Ot(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function St(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Lt(e,t.position)}function Ct(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lt(e,t.position)}function wt(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Qe,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:It(e,t.name,!0),o=Mt(e,t),s=Nt(e,t);return Dt(e,o,a,t),Ot(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Tt(e,t,n){let r={};return Ot(r,Nt(e,t)),e.create(t,e.Fragment,r,n)}function Et(e,t){return t.value}function Dt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ot(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function kt(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function At(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=at(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function jt(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&pt.call(t.properties,i)){let a=Pt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&_t.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Mt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Lt(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Lt(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Nt(e,t){let n=[],r=-1,i=e.passKeys?new Map:mt;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(V(e,e.length,0,t),e):t}var Yt={}.hasOwnProperty;function Xt(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function U(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var W=cn(/[A-Za-z]/),G=cn(/[\dA-Za-z]/),en=cn(/[#-'*+\--9=?A-Z^-~]/);function tn(e){return e!==null&&(e<32||e===127)}var nn=cn(/\d/),rn=cn(/[\dA-Fa-f]/),an=cn(/[!-/:-@[-`{-~]/);function K(e){return e!==null&&e<-2}function q(e){return e!==null&&(e<0||e===32)}function J(e){return e===-2||e===-1||e===32}var on=cn(/\p{P}|\p{S}/u),sn=cn(/\s/);function cn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ln(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&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,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Y(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return J(r)?(e.enter(n),s(r)):t(r)}function s(r){return J(r)&&a++o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function hn(e,t,n){return Y(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function gn(e){if(e===null||q(e)||sn(e))return 1;if(on(e))return 2}function _n(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};xn(d,-c),xn(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=H(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=H(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=H(l,_n(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=H(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=H(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,V(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n0&&J(t)?Y(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||K(t)?e.check(Pn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||K(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),J(t)?Y(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),J(t)?Y(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||K(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Ln(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Rn={name:`codeIndented`,tokenize:Bn},zn={partial:!0,tokenize:Vn};function Bn(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Y(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):K(t)?e.attempt(zn,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||K(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Vn(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Y(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):K(e)?i(e):n(e)}}var Hn={name:`codeText`,previous:Wn,resolve:Un,tokenize:Gn};function Un(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=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 ethis.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){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&qn(this.left,n),i.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),qn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function tr(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||tn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||K(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||q(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):K(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||K(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!J(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function rr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(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){return t===o?(e.exit(a),c(o)):t===null?n(t):K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Y(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||K(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function ir(e,t){let n;return r;function r(i){return K(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):J(i)?Y(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var ar={name:`definition`,tokenize:sr},or={partial:!0,tokenize:cr};function sr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return nr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=U(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return q(t)?ir(e,l)(t):l(t)}function l(t){return tr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(or,d,d)(t)}function d(t){return J(t)?Y(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||K(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function cr(e,t,n){return r;function r(t){return q(t)?ir(e,i)(t):n(t)}function i(t){return rr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return J(t)?Y(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||K(e)?t(e):n(e)}}var lr={name:`hardBreakEscape`,tokenize:ur};function ur(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return K(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var dr={name:`headingAtx`,resolve:fr,tokenize:pr};function fr(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},V(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function pr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||q(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||K(n)?(e.exit(`atxHeading`),t(n)):J(n)?Y(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||q(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var mr=`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`.split(`.`),hr=[`pre`,`script`,`style`,`textarea`],gr={concrete:!0,name:`htmlFlow`,resolveTo:yr,tokenize:br},_r={partial:!0,tokenize:Sr},vr={partial:!0,tokenize:xr};function yr(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(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}function br(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:M):W(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):W(a)?(e.consume(a),i=4,r.interrupt?t:M):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:M):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return W(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||q(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&hr.includes(l)?(i=1,r.interrupt?t(s):O(s)):mr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||G(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return J(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||W(t)?(e.consume(t),b):J(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||G(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):J(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):J(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||K(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||q(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||J(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||K(t)?O(t):J(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),ie):t===63&&i===3?(e.consume(t),M):t===93&&i===5?(e.consume(t),re):K(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(_r,N,k)(t)):t===null||K(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(vr,ee,N)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||K(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),M):O(t)}function j(t){return t===47?(e.consume(t),o=``,ne):O(t)}function ne(t){if(t===62){let n=o.toLowerCase();return hr.includes(n)?(e.consume(t),ie):O(t)}return W(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ne):O(t)}function re(t){return t===93?(e.consume(t),M):O(t)}function M(t){return t===62?(e.consume(t),ie):t===45&&i===2?(e.consume(t),M):O(t)}function ie(t){return t===null||K(t)?(e.exit(`htmlFlowData`),N(t)):(e.consume(t),ie)}function N(n){return e.exit(`htmlFlow`),t(n)}}function xr(e,t,n){let r=this;return i;function i(t){return K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Sr(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(wn,t,n)}}var Cr={name:`htmlText`,tokenize:wr};function wr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):W(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):W(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):K(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):K(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):K(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):K(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return W(t)?(e.consume(t),S):n(t)}function S(t){return t===45||G(t)?(e.consume(t),S):C(t)}function C(t){return K(t)?(o=C,j(t)):J(t)?(e.consume(t),C):A(t)}function w(t){return t===45||G(t)?(e.consume(t),w):t===47||t===62||q(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||W(t)?(e.consume(t),E):K(t)?(o=T,j(t)):J(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||G(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):K(t)?(o=D,j(t)):J(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):K(t)?(o=O,j(t)):J(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):K(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||q(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||q(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return J(t)?Y(e,re,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):re(t)}function re(t){return e.enter(`htmlTextData`),o(t)}}var Tr={name:`labelEnd`,resolveAll:kr,resolveTo:Ar,tokenize:jr},Er={tokenize:Mr},Dr={tokenize:Nr},Or={tokenize:Pr};function kr(e){let t=-1,n=[];for(;++t=3&&(a===null||K(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),J(t)?Y(e,s,`whitespace`)(t):s(t))}}var X={continuation:{tokenize:Kr},exit:Jr,name:`list`,tokenize:Gr},Ur={partial:!0,tokenize:Yr},Wr={partial:!0,tokenize:qr};function Gr(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:nn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Vr,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return nn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(wn,r.interrupt?n:u,e.attempt(Ur,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return J(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Kr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(wn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Y(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!J(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Wr,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Y(e,e.attempt(X,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function qr(e,t,n){let r=this;return Y(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Jr(e){e.exit(this.containerState.type)}function Yr(e,t,n){let r=this;return Y(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!J(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Xr={name:`setextUnderline`,resolveTo:Zr,tokenize:Qr};function Zr(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Qr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),J(t)?Y(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||K(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var $r={tokenize:ei};function ei(e){let t=this,n=e.attempt(wn,r,e.attempt(this.parser.constructs.flowInitial,i,Y(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Xn,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ti={resolveAll:ai()},ni=ii(`string`),ri=ii(`text`);function ii(e){return{resolveAll:ai(e===`text`?oi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++ihi,contentInitial:()=>li,disable:()=>gi,document:()=>ci,flow:()=>di,flowInitial:()=>ui,insideSpan:()=>mi,string:()=>fi,text:()=>pi}),ci={42:X,43:X,45:X,48:X,49:X,50:X,51:X,52:X,53:X,54:X,55:X,56:X,57:X,62:En},li={91:ar},ui={[-2]:Rn,[-1]:Rn,32:Rn},di={35:dr,42:Vr,45:[Xr,Vr],60:gr,61:Xr,95:Vr,96:Fn,126:Fn},fi={38:Mn,92:An},pi={[-5]:zr,[-4]:zr,[-3]:zr,33:Fr,38:Mn,42:vn,60:[Sn,Cr],91:Lr,92:[lr,An],93:Tr,95:vn,96:Hn},mi={null:[vn,ti]},hi={null:[42,95]},gi={null:[]};function _i(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=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=H(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=_n(a,l.events,l),l.events):[]}function f(e,t){return yi(p(e),t)}function p(e){return vi(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function yi(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Ni).call(a,void 0,e[0])}for(r.position={start:Ai(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Ai(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function ic(){return`!`}ac.peek=oc;function ac(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function oc(){return`!`}sc.peek=cc;function sc(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\u007F]/.test(e.url))}uc.peek=dc;function uc(e,t,n,r){let i=Ks(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(lc(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function dc(e,t,n){return lc(e,n)?`<`:`[`}fc.peek=pc;function fc(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function pc(){return`[`}function mc(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function hc(e){let t=mc(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function gc(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function _c(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function vc(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?gc(n):mc(n),s=e.ordered?o===`.`?`)`:`.`:hc(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),_c(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function xc(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Sc=Aa([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Cc(e,t,n,r){return(e.children.some(function(e){return Sc(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function wc(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Tc.peek=Ec;function Tc(e,t,n,r){let i=wc(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Xs(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Ys(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Xs(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Ys(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Ec(e,t,n){return n.options.strong||`*`}function Dc(e,t,n,r){return n.safe(e.value,r)}function Oc(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function kc(e,t,n){let r=(_c(n)+(n.options.ruleSpaces?` `:``)).repeat(Oc(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Ac={blockquote:Is,break:Bs,code:Ws,definition:qs,emphasis:Zs,hardBreak:Bs,heading:ec,html:tc,image:rc,imageReference:ac,inlineCode:sc,link:uc,linkReference:fc,list:vc,listItem:bc,paragraph:xc,root:Cc,strong:Tc,text:Dc,thematicBreak:kc};function jc(){return{enter:{table:Mc,tableData:Ic,tableHeader:Ic,tableRow:Pc},exit:{codeText:Lc,table:Nc,tableData:Fc,tableHeader:Fc,tableRow:Fc}}}function Mc(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Nc(e){this.exit(e),this.data.inTable=void 0}function Pc(e){this.enter({type:`tableRow`,children:[]},e)}function Fc(e){this.exit(e)}function Ic(e){this.enter({type:`tableCell`,children:[]},e)}function Lc(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Rc));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Rc(e,t){return t===`|`?t:e}function zc(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(` -`))}function c(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 l(e,t){return Ns(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var hl={tokenize:Cl,partial:!0};function gl(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:bl,continuation:{tokenize:xl},exit:Sl}},text:{91:{name:`gfmFootnoteCall`,tokenize:yl},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:_l,resolveTo:vl}}}}function _l(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=U(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function vl(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){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 yl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||q(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(U(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return q(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function bl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||q(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=U(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return q(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Y(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function xl(e,t,n){return e.check(wn,t,e.attempt(hl,t,n))}function Sl(e){e.exit(`gfmFootnoteDefinition`)}function Cl(e,t,n){let r=this;return Y(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function wl(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=gn(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Tl=class{constructor(){this.map=[]}add(e,t,n){El(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,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 El(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):K(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):J(t)?Y(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||q(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,J(t)?Y(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return J(t)?Y(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||K(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return J(t)?Y(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||K(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||K(n)?(e.exit(`tableRow`),t(n)):J(n)?Y(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||q(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function Al(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Tl;for(;++nn[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 i!==void 0&&(a.end=Object.assign({},Nl(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Ml(e,t,n,r,i){let a=[],o=Nl(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 Nl(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Pl={name:`tasklistCheck`,tokenize:Il};function Fl(){return{text:{91:Pl}}}function Il(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return q(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return K(r)?t(r):J(r)?e.check({tokenize:Ll},t,n)(r):n(r)}}function Ll(e,t,n){return Y(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Rl(e){return Xt([el(),gl(),wl(e),Ol(),Fl()])}var zl={};function Bl(e){let t=this,n=e||zl,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Rl(n)),a.push(Gc()),o.push(Kc(n))}var Vl=(0,A.lazy)(()=>O(()=>import(`./mcp-app-frame-DQwCEkc1.js`),__vite__mapDeps([0,1,2,3]))),Hl=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Ul(e){return{observability_overview:`System health`,service_topology:`Service map`,service_performance:`Performance`,trace_detail:`Trace analysis`,search_logs:`Logs`}[e]??`System analysis`}function Wl(){let{agentAvailable:e,messages:t,messageTimes:n,ready:i,running:a,activity:l,error:d,threadMissing:f,bottomRef:p,send:h,retry:g,reloadThread:v,newThread:y}=T();if(!e)return(0,j.jsx)(o,{size:`sm`,py:96,children:(0,j.jsx)(C,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,j.jsxs)(b,{gap:`md`,children:[(0,j.jsx)(s,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,j.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,j.jsx)(s,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,j.jsx)(x,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let w=t.filter(e=>e.role!==`tool`);return(0,j.jsxs)(S,{className:`chat-pane`,children:[(0,j.jsx)(S,{className:`chat-scroll`,children:(0,j.jsxs)(o,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,children:[f&&(0,j.jsx)(c,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,j.jsxs)(u,{justify:`space-between`,children:[(0,j.jsx)(s,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,j.jsx)(x,{size:`compact-sm`,variant:`light`,onClick:y,children:`New chat`})]})}),!f&&!i&&d&&(0,j.jsx)(Gl,{message:d,onRetry:v,onNewThread:y}),!f&&!i&&!d&&(0,j.jsxs)(m,{mih:`40vh`,children:[(0,j.jsx)(r,{size:`sm`}),(0,j.jsx)(s,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!f&&i&&(0,j.jsxs)(j.Fragment,{children:[w.length===0&&(0,j.jsx)(ql,{onSelect:h}),(0,j.jsxs)(b,{gap:`lg`,"aria-live":`polite`,children:[w.map(e=>(0,j.jsx)(Jl,{message:e,time:n[e.id],send:h},e.id)),a&&(0,j.jsxs)(u,{gap:`xs`,children:[(0,j.jsx)(r,{type:`dots`,size:`sm`}),(0,j.jsx)(s,{c:`dimmed`,size:`sm`,children:l||`Analyzing your system`})]}),d&&(0,j.jsx)(Gl,{message:d,onRetry:g}),(0,j.jsx)(`div`,{ref:p})]})]})]})}),!f&&(0,j.jsx)(Kl,{})]})}function Gl({message:e,onRetry:t,onNewThread:n}){return(0,j.jsx)(c,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,j.jsxs)(u,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,j.jsx)(s,{size:`sm`,children:e}),(0,j.jsxs)(u,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,j.jsx)(x,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,j.jsx)(x,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Kl(){let{input:e,setInput:t,inputRef:n,submit:r,send:i,stop:a,ready:c,running:l}=T();return(0,j.jsx)(S,{className:`chat-composer`,children:(0,j.jsxs)(o,{size:880,px:{base:`md`,sm:`xl`},children:[(0,j.jsx)(C,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,j.jsxs)(u,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,j.jsx)(se,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),i(e))},placeholder:l?`Fanout is working…`:`Ask about health, errors, or latency…`,disabled:!c,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,j.jsx)(E,{label:`Stop`,children:(0,j.jsx)(D,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:a,children:(0,j.jsx)(he,{size:16,weight:`fill`})})}):(0,j.jsx)(D,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!c,"aria-label":`Send message`,children:(0,j.jsx)(pe,{size:17,weight:`fill`})})]})}),(0,j.jsx)(s,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function ql({onSelect:e}){return(0,j.jsxs)(b,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,j.jsx)(g,{size:`large`}),(0,j.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,j.jsx)(u,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Hl.map(t=>(0,j.jsx)(x,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Jl({message:e,time:t,send:n}){if(e.role===`activity`){let t=e;return t.activityType===`mcp-app`?(0,j.jsx)(C,{withBorder:!0,radius:`lg`,style:{overflow:`hidden`},"aria-label":Ul(t.content.toolName),children:(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(m,{mih:180,children:(0,j.jsx)(r,{size:`sm`})}),children:(0,j.jsx)(Vl,{content:t.content,onMessage:n})})}):null}let i=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!i&&e.role===`assistant`)return null;let a=e.role===`user`,o=t?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(t)):``;return(0,j.jsxs)(S,{className:`chat-message`,"data-role":a?`user`:`assistant`,children:[a?(0,j.jsx)(C,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,j.jsx)(s,{style:{whiteSpace:`pre-wrap`},children:i})}):(0,j.jsx)(le,{className:`chat-markdown`,children:(0,j.jsx)(Ro,{remarkPlugins:[Bl],components:Xl,children:i})}),(0,j.jsxs)(u,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,children:[o&&(0,j.jsx)(s,{c:`dimmed`,size:`xs`,children:o}),!a&&(0,j.jsx)(Yl,{text:i,label:`Copy message`})]})]})}function Yl({text:e,label:t}){let{state:n,copy:r}=ee();return(0,j.jsx)(E,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,j.jsx)(D,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,j.jsx)(d,{size:13,weight:`bold`}):(0,j.jsx)(y,{size:13})})})}var Xl={table:({children:e})=>(0,j.jsx)(S,{className:`chat-table`,children:(0,j.jsx)(k,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,j.jsx)(k.Thead,{children:e}),tbody:({children:e})=>(0,j.jsx)(k.Tbody,{children:e}),tr:({children:e})=>(0,j.jsx)(k.Tr,{children:e}),th:({children:e})=>(0,j.jsx)(k.Th,{children:e}),td:({children:e})=>(0,j.jsx)(k.Td,{children:e}),pre:({children:e})=>(0,j.jsx)(Zl,{children:e}),a:({href:e,children:t})=>(0,j.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Zl({children:e}){let t=Ql(e);return(0,j.jsxs)(S,{className:`chat-code`,pos:`relative`,children:[(0,j.jsx)(S,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,j.jsx)(Yl,{text:t,label:`Copy code`})}),(0,j.jsx)(`pre`,{children:e})]})}function Ql(e){return typeof e==`string`?e:Array.isArray(e)?e.map(Ql).join(``):e&&typeof e==`object`&&`props`in e?Ql(e.props.children):``}export{Wl as t}; \ No newline at end of file +`))}function c(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 l(e,t){return Ns(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var hl={tokenize:Cl,partial:!0};function gl(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:bl,continuation:{tokenize:xl},exit:Sl}},text:{91:{name:`gfmFootnoteCall`,tokenize:yl},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:_l,resolveTo:vl}}}}function _l(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=U(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function vl(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){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 yl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||q(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(U(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return q(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function bl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||q(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=U(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return q(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Y(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function xl(e,t,n){return e.check(wn,t,e.attempt(hl,t,n))}function Sl(e){e.exit(`gfmFootnoteDefinition`)}function Cl(e,t,n){let r=this;return Y(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function wl(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=gn(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Tl=class{constructor(){this.map=[]}add(e,t,n){El(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,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 El(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):K(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):J(t)?Y(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||q(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,J(t)?Y(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return J(t)?Y(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||K(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return J(t)?Y(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||K(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||K(n)?(e.exit(`tableRow`),t(n)):J(n)?Y(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||q(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function Al(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Tl;for(;++nn[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 i!==void 0&&(a.end=Object.assign({},Nl(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Ml(e,t,n,r,i){let a=[],o=Nl(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 Nl(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Pl={name:`tasklistCheck`,tokenize:Il};function Fl(){return{text:{91:Pl}}}function Il(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return q(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return K(r)?t(r):J(r)?e.check({tokenize:Ll},t,n)(r):n(r)}}function Ll(e,t,n){return Y(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Rl(e){return Xt([el(),gl(),wl(e),Ol(),Fl()])}var zl={};function Bl(e){let t=this,n=e||zl,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Rl(n)),a.push(Gc()),o.push(Kc(n))}var Vl=(0,A.lazy)(()=>O(()=>import(`./mcp-app-frame-BZJusU6-.js`),__vite__mapDeps([0,1,2,3]))),Hl=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Ul(e){return{observability_overview:`System health`,service_topology:`Service map`,service_performance:`Performance`,trace_detail:`Trace analysis`,search_logs:`Logs`}[e]??`System analysis`}function Wl(){let{agentAvailable:e,messages:t,messageTimes:n,ready:i,running:a,activity:l,error:d,threadMissing:f,bottomRef:p,send:h,retry:g,reloadThread:v,newThread:y}=E();if(!e)return(0,j.jsx)(o,{size:`sm`,py:96,children:(0,j.jsx)(C,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,j.jsxs)(b,{gap:`md`,children:[(0,j.jsx)(s,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,j.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,j.jsx)(s,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,j.jsx)(x,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let w=t.filter(e=>e.role!==`tool`);return(0,j.jsxs)(S,{className:`chat-pane`,children:[(0,j.jsx)(S,{className:`chat-scroll`,children:(0,j.jsxs)(o,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,children:[f&&(0,j.jsx)(c,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,j.jsxs)(u,{justify:`space-between`,children:[(0,j.jsx)(s,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,j.jsx)(x,{size:`compact-sm`,variant:`light`,onClick:y,children:`New chat`})]})}),!f&&!i&&d&&(0,j.jsx)(Gl,{message:d,onRetry:v,onNewThread:y}),!f&&!i&&!d&&(0,j.jsxs)(m,{mih:`40vh`,children:[(0,j.jsx)(r,{size:`sm`}),(0,j.jsx)(s,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!f&&i&&(0,j.jsxs)(j.Fragment,{children:[w.length===0&&(0,j.jsx)(ql,{onSelect:h}),(0,j.jsxs)(b,{gap:`lg`,"aria-live":`polite`,children:[w.map(e=>(0,j.jsx)(Jl,{message:e,time:n[e.id],send:h},e.id)),a&&(0,j.jsxs)(u,{gap:`xs`,children:[(0,j.jsx)(r,{type:`dots`,size:`sm`}),(0,j.jsx)(s,{c:`dimmed`,size:`sm`,children:l||`Analyzing your system`})]}),d&&(0,j.jsx)(Gl,{message:d,onRetry:g}),(0,j.jsx)(`div`,{ref:p})]})]})]})}),!f&&(0,j.jsx)(Kl,{})]})}function Gl({message:e,onRetry:t,onNewThread:n}){return(0,j.jsx)(c,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,j.jsxs)(u,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,j.jsx)(s,{size:`sm`,children:e}),(0,j.jsxs)(u,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,j.jsx)(x,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,j.jsx)(x,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Kl(){let{input:e,setInput:t,inputRef:n,submit:r,send:i,stop:a,ready:c,running:l}=E();return(0,j.jsx)(S,{className:`chat-composer`,children:(0,j.jsxs)(o,{size:880,px:{base:`md`,sm:`xl`},children:[(0,j.jsx)(C,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,j.jsxs)(u,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,j.jsx)(se,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),i(e))},placeholder:l?`Fanout is working…`:`Ask about health, errors, or latency…`,disabled:!c,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,j.jsx)(T,{label:`Stop`,children:(0,j.jsx)(D,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:a,children:(0,j.jsx)(he,{size:16,weight:`fill`})})}):(0,j.jsx)(D,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!c,"aria-label":`Send message`,children:(0,j.jsx)(pe,{size:17,weight:`fill`})})]})}),(0,j.jsx)(s,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function ql({onSelect:e}){return(0,j.jsxs)(b,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,j.jsx)(g,{size:`large`}),(0,j.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,j.jsx)(u,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Hl.map(t=>(0,j.jsx)(x,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Jl({message:e,time:t,send:n}){if(e.role===`activity`){let t=e;return t.activityType===`mcp-app`?(0,j.jsx)(C,{withBorder:!0,radius:`lg`,style:{overflow:`hidden`},"aria-label":Ul(t.content.toolName),children:(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(m,{mih:180,children:(0,j.jsx)(r,{size:`sm`})}),children:(0,j.jsx)(Vl,{content:t.content,onMessage:n})})}):null}let i=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!i&&e.role===`assistant`)return null;let a=e.role===`user`,o=t?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(t)):``;return(0,j.jsxs)(S,{className:`chat-message`,"data-role":a?`user`:`assistant`,children:[a?(0,j.jsx)(C,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,j.jsx)(s,{style:{whiteSpace:`pre-wrap`},children:i})}):(0,j.jsx)(le,{className:`chat-markdown`,children:(0,j.jsx)(Ro,{remarkPlugins:[Bl],components:Xl,children:i})}),(0,j.jsxs)(u,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,children:[o&&(0,j.jsx)(s,{c:`dimmed`,size:`xs`,children:o}),!a&&(0,j.jsx)(Yl,{text:i,label:`Copy message`})]})]})}function Yl({text:e,label:t}){let{state:n,copy:r}=ee();return(0,j.jsx)(T,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,j.jsx)(D,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,j.jsx)(d,{size:13,weight:`bold`}):(0,j.jsx)(y,{size:13})})})}var Xl={table:({children:e})=>(0,j.jsx)(S,{className:`chat-table`,children:(0,j.jsx)(k,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,j.jsx)(k.Thead,{children:e}),tbody:({children:e})=>(0,j.jsx)(k.Tbody,{children:e}),tr:({children:e})=>(0,j.jsx)(k.Tr,{children:e}),th:({children:e})=>(0,j.jsx)(k.Th,{children:e}),td:({children:e})=>(0,j.jsx)(k.Td,{children:e}),pre:({children:e})=>(0,j.jsx)(Zl,{children:e}),a:({href:e,children:t})=>(0,j.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Zl({children:e}){let t=Ql(e);return(0,j.jsxs)(S,{className:`chat-code`,pos:`relative`,children:[(0,j.jsx)(S,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,j.jsx)(Yl,{text:t,label:`Copy code`})}),(0,j.jsx)(`pre`,{children:e})]})}function Ql(e){return typeof e==`string`?e:Array.isArray(e)?e.map(Ql).join(``):e&&typeof e==`object`&&`props`in e?Ql(e.props.children):``}export{Wl as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-DjTlEgB5.js b/internal/ui/dist/assets/chat._threadId-DjTlEgB5.js deleted file mode 100644 index 720dd19d8..000000000 --- a/internal/ui/dist/assets/chat._threadId-DjTlEgB5.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-B0CA6UcR.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-DvqxaiRx.js b/internal/ui/dist/assets/chat._threadId-DvqxaiRx.js new file mode 100644 index 000000000..3dfc4a5ee --- /dev/null +++ b/internal/ui/dist/assets/chat._threadId-DvqxaiRx.js @@ -0,0 +1 @@ +import{t as e}from"./chat-DuN0TFYv.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-DjTlEgB5.js b/internal/ui/dist/assets/chat.index-DjTlEgB5.js deleted file mode 100644 index 720dd19d8..000000000 --- a/internal/ui/dist/assets/chat.index-DjTlEgB5.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-B0CA6UcR.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-DvqxaiRx.js b/internal/ui/dist/assets/chat.index-DvqxaiRx.js new file mode 100644 index 000000000..3dfc4a5ee --- /dev/null +++ b/internal/ui/dist/assets/chat.index-DvqxaiRx.js @@ -0,0 +1 @@ +import{t as e}from"./chat-DuN0TFYv.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/copy-Bzg2uCpz.js b/internal/ui/dist/assets/copy-Bzg2uCpz.js new file mode 100644 index 000000000..65a80b097 --- /dev/null +++ b/internal/ui/dist/assets/copy-Bzg2uCpz.js @@ -0,0 +1 @@ +import{C as e,K as t,St as n,X as r,ct as i,dt as a,gt as o,j as s,k as c,mt as l,x as u}from"./brand-MzZ03bSa.js";import{o as d,w as f}from"./Tooltip-BJiO7C_G.js";var[p,m]=f(`Table component was not found in the tree`),h={table:`m_b23fa0ef`,th:`m_4e7aa4f3`,tr:`m_4e7aa4fd`,td:`m_4e7aa4ef`,tbody:`m_b2404537`,thead:`m_b242d975`,caption:`m_9e5a3ac7`,scrollContainer:`m_a100c15`,scrollContainerInner:`m_62259741`},g=l();function _(e,t){if(!t)return;let n={};return t.columnBorder&&e.withColumnBorders&&(n[`data-with-column-border`]=!0),t.rowBorder&&e.withRowBorders&&(n[`data-with-row-border`]=!0),t.striped&&e.striped&&(n[`data-striped`]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n[`data-hover`]=!0),t.captionSide&&e.captionSide&&(n[`data-side`]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n[`data-sticky`]=!0),n}function v(t,n){let r=`Table${t.charAt(0).toUpperCase()}${t.slice(1)}`,i=e(e=>{let i=s(r,{},e),{classNames:a,className:o,style:c,styles:l,...d}=i,f=m();return(0,g.jsx)(u,{component:t,..._(f,n),...f.getStyles(t,{className:o,classNames:a,style:c,styles:l,props:i}),...d})});return i.displayName=`@mantine/core/${r}`,i.classes=h,i}var y=v(`th`,{columnBorder:!0}),b=v(`td`,{columnBorder:!0}),x=v(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),S=v(`thead`,{stickyHeader:!0}),C=v(`tbody`),w=v(`tfoot`),T=v(`caption`,{captionSide:!0}),E={type:`scrollarea`},D=r((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":a(t),"--table-max-height":a(n),"--table-overflow":r===`native`?`auto`:void 0}})),O=e(e=>{let t=s(`TableScrollContainer`,E,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:l,children:f,minWidth:p,maxHeight:m,type:_,scrollAreaProps:v,attributes:y,...b}=t,x=c({name:`TableScrollContainer`,classes:h,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:y,vars:l,varsResolver:D,rootSelector:`scrollContainer`});return(0,g.jsx)(u,{component:_===`scrollarea`?d:`div`,..._===`scrollarea`?m?{offsetScrollbars:`xy`,...v}:{offsetScrollbars:`x`,...v}:{},...x(`scrollContainer`),...b,children:(0,g.jsx)(`div`,{...x(`scrollContainerInner`),children:f})})});O.classes=h,O.varsResolver=D,O.displayName=`@mantine/core/TableScrollContainer`;function k({data:e}){return(0,g.jsxs)(g.Fragment,{children:[e.caption&&(0,g.jsx)(T,{children:e.caption}),e.head&&(0,g.jsx)(S,{children:(0,g.jsx)(x,{children:e.head.map((e,t)=>(0,g.jsx)(y,{children:e},t))})}),e.body&&(0,g.jsx)(C,{children:e.body.map((e,t)=>(0,g.jsx)(x,{children:e.map((e,t)=>(0,g.jsx)(b,{children:e},t))},t))}),e.foot&&(0,g.jsx)(w,{children:(0,g.jsx)(x,{children:e.foot.map((e,t)=>(0,g.jsx)(y,{children:e},t))})})]})}k.displayName=`@mantine/core/TableDataRenderer`;var A={withRowBorders:!0,verticalSpacing:7},j=r((e,{layout:n,captionSide:r,horizontalSpacing:o,verticalSpacing:s,borderColor:c,stripedColor:l,highlightOnHoverColor:u,striped:d,highlightOnHover:f,stickyHeaderOffset:p,stickyHeader:m})=>({table:{"--table-layout":n,"--table-caption-side":r,"--table-horizontal-spacing":i(o),"--table-vertical-spacing":i(s),"--table-border-color":c?t(c,e):void 0,"--table-striped-color":d&&l?t(l,e):void 0,"--table-highlight-on-hover-color":f&&u?t(u,e):void 0,"--table-sticky-header-offset":m?a(p):void 0}})),M=e(e=>{let t=s(`Table`,A,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:l,horizontalSpacing:d,verticalSpacing:f,captionSide:m,stripedColor:_,highlightOnHoverColor:v,striped:y,highlightOnHover:b,withColumnBorders:x,withRowBorders:S,withTableBorder:C,borderColor:w,layout:T,data:E,children:D,stickyHeader:O,stickyHeaderOffset:M,mod:N,tabularNums:P,attributes:F,...I}=t,L=c({name:`Table`,props:t,className:r,style:i,classes:h,classNames:n,styles:a,unstyled:o,attributes:F,rootSelector:`table`,vars:l,varsResolver:j});return(0,g.jsx)(p,{value:{getStyles:L,stickyHeader:O,striped:y===!0?`odd`:y||void 0,highlightOnHover:b,withColumnBorders:x,withRowBorders:S,captionSide:m||`bottom`},children:(0,g.jsx)(u,{component:`table`,mod:[{"data-with-table-border":C,"data-tabular-nums":P},N],...L(`table`),...I,children:D||!!E&&(0,g.jsx)(k,{data:E})})})});M.classes=h,M.varsResolver=j,M.displayName=`@mantine/core/Table`,M.Td=b,M.Th=y,M.Tr=x,M.Thead=S,M.Tbody=C,M.Tfoot=w,M.Caption=T,M.ScrollContainer=O,M.DataRenderer=k;var N=n(o(),1);function P(e=1500){let[t,n]=(0,N.useState)(`idle`),r=(0,N.useRef)(null);(0,N.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(t){r.current&&clearTimeout(r.current),n(`idle`),(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject(Error(`clipboard unavailable`))).then(()=>n(`copied`),()=>n(`failed`)).finally(()=>{r.current=setTimeout(()=>n(`idle`),e)})}return{state:t,copy:i}}export{M as n,P as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/copy-tlUaIRYM.js b/internal/ui/dist/assets/copy-tlUaIRYM.js deleted file mode 100644 index 815471b2e..000000000 --- a/internal/ui/dist/assets/copy-tlUaIRYM.js +++ /dev/null @@ -1 +0,0 @@ -import{C as e,K as t,St as n,X as r,ct as i,dt as a,gt as o,j as s,k as c,mt as l,x as u}from"./brand-MzZ03bSa.js";import{A as d,f}from"./preload-helper-xxyQ8-YB.js";var[p,m]=d(`Table component was not found in the tree`),h={table:`m_b23fa0ef`,th:`m_4e7aa4f3`,tr:`m_4e7aa4fd`,td:`m_4e7aa4ef`,tbody:`m_b2404537`,thead:`m_b242d975`,caption:`m_9e5a3ac7`,scrollContainer:`m_a100c15`,scrollContainerInner:`m_62259741`},g=l();function _(e,t){if(!t)return;let n={};return t.columnBorder&&e.withColumnBorders&&(n[`data-with-column-border`]=!0),t.rowBorder&&e.withRowBorders&&(n[`data-with-row-border`]=!0),t.striped&&e.striped&&(n[`data-striped`]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n[`data-hover`]=!0),t.captionSide&&e.captionSide&&(n[`data-side`]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n[`data-sticky`]=!0),n}function v(t,n){let r=`Table${t.charAt(0).toUpperCase()}${t.slice(1)}`,i=e(e=>{let i=s(r,{},e),{classNames:a,className:o,style:c,styles:l,...d}=i,f=m();return(0,g.jsx)(u,{component:t,..._(f,n),...f.getStyles(t,{className:o,classNames:a,style:c,styles:l,props:i}),...d})});return i.displayName=`@mantine/core/${r}`,i.classes=h,i}var y=v(`th`,{columnBorder:!0}),b=v(`td`,{columnBorder:!0}),x=v(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),S=v(`thead`,{stickyHeader:!0}),C=v(`tbody`),w=v(`tfoot`),T=v(`caption`,{captionSide:!0}),E={type:`scrollarea`},D=r((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":a(t),"--table-max-height":a(n),"--table-overflow":r===`native`?`auto`:void 0}})),O=e(e=>{let t=s(`TableScrollContainer`,E,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:l,children:d,minWidth:p,maxHeight:m,type:_,scrollAreaProps:v,attributes:y,...b}=t,x=c({name:`TableScrollContainer`,classes:h,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:y,vars:l,varsResolver:D,rootSelector:`scrollContainer`});return(0,g.jsx)(u,{component:_===`scrollarea`?f:`div`,..._===`scrollarea`?m?{offsetScrollbars:`xy`,...v}:{offsetScrollbars:`x`,...v}:{},...x(`scrollContainer`),...b,children:(0,g.jsx)(`div`,{...x(`scrollContainerInner`),children:d})})});O.classes=h,O.varsResolver=D,O.displayName=`@mantine/core/TableScrollContainer`;function k({data:e}){return(0,g.jsxs)(g.Fragment,{children:[e.caption&&(0,g.jsx)(T,{children:e.caption}),e.head&&(0,g.jsx)(S,{children:(0,g.jsx)(x,{children:e.head.map((e,t)=>(0,g.jsx)(y,{children:e},t))})}),e.body&&(0,g.jsx)(C,{children:e.body.map((e,t)=>(0,g.jsx)(x,{children:e.map((e,t)=>(0,g.jsx)(b,{children:e},t))},t))}),e.foot&&(0,g.jsx)(w,{children:(0,g.jsx)(x,{children:e.foot.map((e,t)=>(0,g.jsx)(y,{children:e},t))})})]})}k.displayName=`@mantine/core/TableDataRenderer`;var A={withRowBorders:!0,verticalSpacing:7},j=r((e,{layout:n,captionSide:r,horizontalSpacing:o,verticalSpacing:s,borderColor:c,stripedColor:l,highlightOnHoverColor:u,striped:d,highlightOnHover:f,stickyHeaderOffset:p,stickyHeader:m})=>({table:{"--table-layout":n,"--table-caption-side":r,"--table-horizontal-spacing":i(o),"--table-vertical-spacing":i(s),"--table-border-color":c?t(c,e):void 0,"--table-striped-color":d&&l?t(l,e):void 0,"--table-highlight-on-hover-color":f&&u?t(u,e):void 0,"--table-sticky-header-offset":m?a(p):void 0}})),M=e(e=>{let t=s(`Table`,A,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:l,horizontalSpacing:d,verticalSpacing:f,captionSide:m,stripedColor:_,highlightOnHoverColor:v,striped:y,highlightOnHover:b,withColumnBorders:x,withRowBorders:S,withTableBorder:C,borderColor:w,layout:T,data:E,children:D,stickyHeader:O,stickyHeaderOffset:M,mod:N,tabularNums:P,attributes:F,...I}=t,L=c({name:`Table`,props:t,className:r,style:i,classes:h,classNames:n,styles:a,unstyled:o,attributes:F,rootSelector:`table`,vars:l,varsResolver:j});return(0,g.jsx)(p,{value:{getStyles:L,stickyHeader:O,striped:y===!0?`odd`:y||void 0,highlightOnHover:b,withColumnBorders:x,withRowBorders:S,captionSide:m||`bottom`},children:(0,g.jsx)(u,{component:`table`,mod:[{"data-with-table-border":C,"data-tabular-nums":P},N],...L(`table`),...I,children:D||!!E&&(0,g.jsx)(k,{data:E})})})});M.classes=h,M.varsResolver=j,M.displayName=`@mantine/core/Table`,M.Td=b,M.Th=y,M.Tr=x,M.Thead=S,M.Tbody=C,M.Tfoot=w,M.Caption=T,M.ScrollContainer=O,M.DataRenderer=k;var N=n(o(),1);function P(e=1500){let[t,n]=(0,N.useState)(`idle`),r=(0,N.useRef)(null);(0,N.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(t){r.current&&clearTimeout(r.current),n(`idle`),(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject(Error(`clipboard unavailable`))).then(()=>n(`copied`),()=>n(`failed`)).finally(()=>{r.current=setTimeout(()=>n(`idle`),e)})}return{state:t,copy:i}}export{M as n,P as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboard-BdaKmdJW.js b/internal/ui/dist/assets/dashboard-7dM548yK.js similarity index 55% rename from internal/ui/dist/assets/dashboard-BdaKmdJW.js rename to internal/ui/dist/assets/dashboard-7dM548yK.js index 5329f8029..7770f0727 100644 --- a/internal/ui/dist/assets/dashboard-BdaKmdJW.js +++ b/internal/ui/dist/assets/dashboard-7dM548yK.js @@ -1,24 +1,24 @@ -import{$ as e,A as t,C as n,D as r,E as i,K as a,N as o,O as s,R as c,S as l,St as u,T as d,X as f,Y as p,_ as m,_t as h,a as g,at as _,ct as v,d as y,dt as b,et as x,f as S,gt as C,h as w,ht as T,i as E,it as D,j as O,k,l as A,lt as j,m as M,mt as N,o as P,p as ee,pt as te,r as ne,s as re,st as ie,u as ae,w as oe,x as se,y as ce,yt as le}from"./brand-MzZ03bSa.js";import{i as ue,o as F,s as I}from"./auth-DNoFbJyG.js";import{$ as de,C as fe,E as pe,F as me,K as he,L as ge,Q as _e,S as ve,T as ye,U as be,X as xe,Z as Se,_ as Ce,b as we,c as Te,dt as Ee,et as De,f as Oe,ft as ke,g as Ae,gt as je,h as Me,i as Ne,k as Pe,l as Fe,m as Ie,n as Le,o as Re,p as ze,q as Be,s as Ve,u as He,ut as Ue,v as We,vt as Ge,w as Ke,y as qe,z as Je}from"./tokens-6to9Eext.js";import{A as Ye,D as Xe,O as Ze,f as Qe,j as $e,o as et,s as tt}from"./preload-helper-xxyQ8-YB.js";import{t as nt}from"./use-computed-color-scheme-6JIsge00.js";import{n as rt,t as it}from"./copy-tlUaIRYM.js";var L=u(C(),1),R=N();function at(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function ot(e){let t=(0,L.useRef)(void 0);return(0,L.useEffect)(()=>{t.current=e},[e]),t.current}function st(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{let t=O(`Flex`,null,e),{classNames:n,className:a,style:l,styles:u,unstyled:f,vars:p,gap:m,rowGap:h,columnGap:g,align:_,justify:v,wrap:y,direction:b,attributes:x,...S}=t,C=k({name:`Flex`,classes:ft,props:t,className:a,style:l,classNames:n,styles:u,unstyled:f,attributes:x,vars:p}),w=o(),T=d(),E=i({styleProps:{gap:m,rowGap:h,columnGap:g,align:_,justify:v,wrap:y,direction:b},theme:w,data:dt}),D=c(),A=D&&E.hasResponsiveStyles?r(E.styles,E.media):T;return(0,R.jsxs)(R.Fragment,{children:[E.hasResponsiveStyles&&(0,R.jsx)(s,{selector:`.${A}`,styles:E.styles,media:E.media,deduplicate:D}),(0,R.jsx)(se,{...C(`root`,{className:A,style:j(E.inlineStyles)}),...S})]})});pt.classes=ft,pt.displayName=`@mantine/core/Flex`;function mt(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>mt(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function ht(e){return e?e.map(e=>mt(e)):[]}function gt(e){return e.reduce((e,t)=>`group`in t?{...e,...gt(t.items)}:(e[`${t.value}`]=t,e),{})}var _t={dropdown:`m_88b62a41`,search:`m_985517d8`,options:`m_b2821a6e`,option:`m_92253aa5`,empty:`m_2530cd1d`,header:`m_858f94bd`,footer:`m_82b967cb`,group:`m_254f3e4f`,groupLabel:`m_2bb2e9e5`,chevron:`m_2943220b`,optionsDropdownOption:`m_390b5f4`,optionsDropdownCheckIcon:`m_8ee53fc2`,optionsDropdownCheckPlaceholder:`m_a530ee0a`},vt={error:null},yt=f((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":ie(t,`combobox-chevron-size`),"--combobox-chevron-color":n?a(n,e):void 0}})),bt=n(e=>{let t=O(`ComboboxChevron`,vt,e),{size:n,error:r,style:i,className:a,classNames:o,styles:s,unstyled:c,vars:l,attributes:u,mod:d,...f}=t,p=k({name:`ComboboxChevron`,classes:_t,props:t,style:i,className:a,classNames:o,styles:s,unstyled:c,vars:l,varsResolver:yt,attributes:u,rootSelector:`chevron`});return(0,R.jsx)(se,{component:`svg`,...f,...p(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},d],children:(0,R.jsx)(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})});bt.classes=_t,bt.varsResolver=yt,bt.displayName=`@mantine/core/ComboboxChevron`;var[xt,St]=Ye(`Combobox component was not found in tree`);function Ct({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,R.jsx)(M.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}Ct.displayName=`@mantine/core/ComboboxClearButton`;var wt=n(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=O(`ComboboxDropdown`,null,e),s=St();return(0,R.jsx)(Ue.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});wt.classes=_t,wt.displayName=`@mantine/core/ComboboxDropdown`;var Tt={refProp:`ref`},Et=n(e=>{let{children:t,refProp:n,ref:r}=O(`ComboboxDropdownTarget`,Tt,e);if(St(),!$e(t))throw Error(`Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return(0,R.jsx)(Ue.Target,{ref:r,refProp:n,children:t})});Et.displayName=`@mantine/core/ComboboxDropdownTarget`;var Dt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxEmpty`,null,e);return(0,R.jsx)(se,{...St().getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...o})});Dt.classes=_t,Dt.displayName=`@mantine/core/ComboboxEmpty`;function Ot({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=St(),[c,l]=(0,L.useState)(null),u=t=>{if(e?.(t),!s.readOnly&&n){if(t.nativeEvent.isComposing)return;if(t.nativeEvent.code===`ArrowDown`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectNextOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`ArrowUp`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectPreviousOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`Enter`||t.nativeEvent.code===`NumpadEnter`){if(t.nativeEvent.keyCode===229)return;let e=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&e!==-1?(t.preventDefault(),s.store.clickSelectedOption()):a===`button`&&(t.preventDefault(),s.store.openDropdown(`keyboard`))}t.key===`Escape`&&s.store.closeDropdown(`keyboard`),t.nativeEvent.code===`Space`&&a===`button`&&(t.preventDefault(),s.store.toggleDropdown(`keyboard`))}},d=r?{...i?{role:`combobox`}:{},"aria-haspopup":`listbox`,"aria-expanded":i?!!(s.store.listId&&s.store.dropdownOpened):void 0,"aria-controls":s.store.dropdownOpened&&s.store.listId?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&c||void 0,autoComplete:o,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},f=e=>{a===`button`&&e.currentTarget.focus(),t?.(e)};return{...d,onKeyDown:u,onClick:f}}var kt={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},At=n(t=>{let{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:a,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:l,...u}=O(`ComboboxEventsTarget`,kt,t),d=Xe(n);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=St();return(0,L.cloneElement)(d,{...Ot({targetType:s,withAriaAttributes:a,withKeyboardNavigation:i,withExpandedAttribute:o,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:c}),...u,[r]:e(l,f.store.targetRef,Ze(d))})});At.displayName=`@mantine/core/ComboboxEventsTarget`;var jt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxFooter`,null,e);return(0,R.jsx)(se,{...St().getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...o,onMouseDown:e=>{e.preventDefault()}})});jt.classes=_t,jt.displayName=`@mantine/core/ComboboxFooter`;var Mt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,label:s,id:c,...l}=O(`ComboboxGroup`,null,e),u=St(),d=x(c),f=s!=null&&s!==!1&&s!==``;return(0,R.jsxs)(se,{role:`group`,"aria-labelledby":f?d:void 0,...u.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...l,children:[f&&(0,R.jsx)(`div`,{id:d,...u.getStyles(`groupLabel`,{classNames:t,styles:i}),children:s}),o]})});Mt.classes=_t,Mt.displayName=`@mantine/core/ComboboxGroup`;var Nt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxHeader`,null,e);return(0,R.jsx)(se,{...St().getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...o,onMouseDown:e=>{e.preventDefault()}})});Nt.classes=_t,Nt.displayName=`@mantine/core/ComboboxHeader`;function Pt({value:e,valuesDivider:t=`,`,...n}){return(0,R.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}Pt.displayName=`@mantine/core/ComboboxHiddenInput`;var Ft=n(e=>{let t=O(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:o,onClick:s,id:c,active:l,onMouseDown:u,onMouseOver:d,disabled:f,selected:p,mod:m,...h}=t,g=St(),_=(0,L.useId)(),v=c||_;return(0,R.jsx)(se,{...g.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),...h,id:v,mod:[`combobox-option`,{"combobox-active":l,"combobox-disabled":f,"combobox-selected":p},m],role:`option`,onClick:e=>{f?e.preventDefault():(g.onOptionSubmit?.(t.value,t),s?.(e))},onMouseDown:e=>{e.preventDefault(),u?.(e)},onMouseOver:e=>{g.resetSelectionOnOptionHover&&g.store.resetSelectedOption(),d?.(e)}})});Ft.classes=_t,Ft.displayName=`@mantine/core/ComboboxOption`;var It=n(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:o,labelledBy:s,...c}=O(`ComboboxOptions`,null,e),l=St(),u=x(a);return(0,L.useEffect)(()=>{l.store.setListId(u)},[u]),(0,R.jsx)(se,{...l.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...c,id:u,role:`listbox`,"aria-labelledby":s,onMouseDown:e=>{e.preventDefault(),o?.(e)}})});It.classes=_t,It.displayName=`@mantine/core/ComboboxOptions`;var Lt={withAriaAttributes:!0,withKeyboardNavigation:!0},Rt=n(t=>{let{classNames:n,styles:r,unstyled:i,vars:a,withAriaAttributes:o,onKeyDown:s,onClick:c,withKeyboardNavigation:l,size:u,ref:d,...f}=O(`ComboboxSearch`,Lt,t),p=St(),m=p.getStyles(`search`),h=Ot({targetType:`input`,withAriaAttributes:o,withKeyboardNavigation:l,withExpandedAttribute:!1,onKeyDown:s,onClick:c,autoComplete:`off`});return(0,R.jsx)(M,{ref:e(d,p.store.searchRef),classNames:[{input:m.className},n],styles:[{input:m.style},r],size:u||p.size,...h,...f,__staticSelector:`Combobox`})});Rt.classes=_t,Rt.displayName=`@mantine/core/ComboboxSearch`;var zt={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Bt=n(t=>{let{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:a,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:l,...u}=O(`ComboboxTarget`,zt,t),d=Xe(n);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=St(),p=(0,L.cloneElement)(d,{...Ot({targetType:s,withAriaAttributes:a,withKeyboardNavigation:i,withExpandedAttribute:o,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:c}),...u});return(0,R.jsx)(Ue.Target,{refProp:r,ref:e(l,f.store.targetRef),children:p})});Bt.displayName=`@mantine/core/ComboboxTarget`;function Vt(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].hasAttribute(`data-combobox-disabled`))return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].hasAttribute(`data-combobox-disabled`))return e}return e}function Ht(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,L.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,L.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,L.useCallback)(()=>{let e=lt(f.current),t=st(`#${l.current} [data-combobox-selected]`,e);t?.removeAttribute(`data-combobox-selected`),t?.removeAttribute(`aria-selected`)},[]),b=(0,L.useCallback)(e=>{let t=lt(f.current),n=st(`#${l.current}`,t),r=n?ct(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].setAttribute(`aria-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,L.useCallback)(()=>{let e=lt(f.current),t=st(`#${l.current} [data-combobox-active]`,e);if(t){let n=ct(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,L.useCallback)(()=>{let e=lt(f.current),t=ct(`#${l.current} [data-combobox-option]`,e);return b(Ht(u.current,t,a))},[b,a]),C=(0,L.useCallback)(()=>{let e=lt(f.current),t=ct(`#${l.current} [data-combobox-option]`,e);return b(Vt(u.current,t,a))},[b,a]),w=(0,L.useCallback)(()=>{let e=lt(f.current),t=ct(`#${l.current} [data-combobox-option]`,e);return b(Ut(t))},[b]),T=(0,L.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=lt(f.current),r=ct(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=lt(f.current),r=ct(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,L.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,L.useCallback)(()=>{let e=lt(f.current);(ct(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,L.useCallback)(e=>{l.current=e},[]),k=(0,L.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,L.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,L.useCallback)(()=>u.current,[]);return(0,L.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var Gt={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},Kt=f((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":D(t),"--combobox-option-padding":ie(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:b(n),"--combobox-option-fz":D(t),"--combobox-option-padding":ie(t,`combobox-option-padding`)}})),qt=e=>{let t=O(`Combobox`,Gt,e),{classNames:n,styles:r,unstyled:i,children:a,store:o,vars:s,onOptionSubmit:c,onClose:l,size:u,dropdownPadding:d,resetSelectionOnOptionHover:f,__staticSelector:p,readOnly:m,attributes:h,floatingHeight:g,middlewares:_,...v}=t,y=g===`viewport`?{..._,flip:!1,size:{...typeof _?.size==`object`?_.size:{},padding:typeof _?.size==`object`&&_.size.padding!==void 0?_.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=_?.size;typeof i==`object`&&i.apply?i.apply({availableHeight:e,availableWidth:t,elements:n,...r}):i&&Object.assign(n.floating.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})}}}:_,b=Wt(),x=o||b,S=k({name:p||`Combobox`,classes:_t,props:t,classNames:n,styles:r,unstyled:i,attributes:h,vars:s,varsResolver:Kt}),C=()=>{l?.(),x.closeDropdown()};return(0,R.jsx)(xt,{value:{getStyles:S,store:x,onOptionSubmit:c,size:u,resetSelectionOnOptionHover:f,readOnly:m,floatingHeight:g},children:(0,R.jsx)(Ue,{opened:x.dropdownOpened,...v,middlewares:y,onChange:e=>!e&&C(),withRoles:!1,unstyled:i,children:a})})};qt.extend=e=>e,qt.classes=_t,qt.varsResolver=Kt,qt.displayName=`@mantine/core/Combobox`,qt.Target=Bt,qt.Dropdown=wt,qt.Options=It,qt.Option=Ft,qt.Search=Rt,qt.Empty=Dt,qt.Chevron=bt,qt.Footer=jt,qt.Header=Nt,qt.EventsTarget=At,qt.DropdownTarget=Et,qt.Group=Mt,qt.ClearButton=Ct,qt.HiddenInput=Pt;function Jt(e){return`group`in e}function Yt({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function Zt(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Jt(n))Zt(n.items,t);else{if(n.value===void 0)throw Error(`[@mantine/core] Each option must have value property`);if(t.has(n.value))throw Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function Qt(e,t){return Array.isArray(e)?e.includes(t):e===t}function $t({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Jt(e)){let s=Qt(r,e.value),c=t&&(s?(0,R.jsx)(De,{className:_t.optionsDropdownCheckIcon}):n?(0,R.jsx)(`div`,{className:_t.optionsDropdownCheckPlaceholder}):null),l=(0,R.jsxs)(R.Fragment,{children:[i===`left`&&c,(0,R.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,R.jsx)(qt.Option,{value:e.value,disabled:e.disabled,className:p({[_t.optionsDropdownOption]:!a}),"data-reverse":i===`right`||void 0,"data-checked":s||void 0,"aria-selected":s,active:s,children:typeof o==`function`?o({option:e,checked:s}):l})}let s=e.items.map(e=>(0,R.jsx)($t,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,R.jsx)(qt.Group,{label:e.group,children:s})}function en({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:a,maxDropdownHeight:o,floatingHeight:s,withScrollArea:c=!0,filterOptions:l=!0,withCheckIcon:u=!1,withAlignedLabels:d=!1,value:f,checkIconPosition:p,nothingFoundMessage:m,unstyled:h,labelId:g,renderOption:_,scrollAreaProps:v,"aria-label":y}){let b=St();Zt(e);let x=typeof i==`string`?(r||Yt)({options:e,search:l?i:``,limit:a??1/0}):e,S=Xt(x),C=x.map((e,t)=>(0,R.jsx)($t,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Jt(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,R.jsx)(qt.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,R.jsxs)(qt.Options,{labelledBy:g,"aria-label":y,children:[c?(0,R.jsx)(Qe.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,R.jsx)(qt.Empty,{children:m})]})})}function tn(e){let t=e.currentTarget;return lt(t).activeElement!==t}function nn(e,t){let n=t.trim().toLowerCase();if(n===``)return;let r=Object.values(e).filter(e=>!e.disabled&&e.label.trim().toLowerCase()===n);return r.length===1?r[0]:void 0}var[rn,an]=Ye(`Progress.Root component was not found in tree`),on={root:`m_db6d6462`,section:`m_2242eb65`,"stripes-animation":`m_81a374bd`,"stripes-animation-vertical":`m_e0fb7a86`,label:`m_91e40b74`},sn=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ProgressLabel`,null,e);return(0,R.jsx)(se,{...an().getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...o})});sn.classes=on,sn.displayName=`@mantine/core/ProgressLabel`;var cn=f((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":ie(t,`progress-size`),"--progress-radius":n===void 0?void 0:_(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),ln=n(e=>{let t=O(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,autoContrast:c,transitionDuration:l,orientation:u,attributes:d,mod:f,...p}=t,m=k({name:`Progress`,classes:on,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:d,vars:s,varsResolver:cn});return(0,R.jsx)(rn,{value:{getStyles:m,autoContrast:c},children:(0,R.jsx)(se,{mod:[{orientation:u},f],...m(`root`),...p})})});ln.classes=on,ln.varsResolver=cn,ln.displayName=`@mantine/core/ProgressRoot`;var un={withAria:!0},dn=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:s,value:c,withAria:l,color:u,striped:d,animated:f,mod:p,...m}=O(`ProgressSection`,un,e),h=an(),g=o(),_=l?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":c,"aria-valuetext":`${c}%`}:{};return(0,R.jsx)(se,{...h.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...m,..._,mod:[{striped:d||f,animated:f},p],__vars:{"--progress-section-size":`${c}%`,"--progress-section-color":a(u,g),"--progress-label-color":ut(h.autoContrast,g)?ke({color:u,theme:g,autoContrast:h.autoContrast}):void 0}})});dn.classes=on,dn.displayName=`@mantine/core/ProgressSection`;var fn=n(e=>{let n=O(`Progress`,null,e),{value:r,classNames:i,styles:a,vars:o,color:s,striped:c,animated:l,"aria-label":u,...d}=n,{resolvedClassNames:f,resolvedStyles:p}=t({classNames:i,styles:a,props:n});return(0,R.jsx)(ln,{classNames:f,styles:p,vars:o,...d,children:(0,R.jsx)(dn,{value:r,color:s,striped:c,animated:l,"aria-label":u})})});fn.classes=on,fn.displayName=`@mantine/core/Progress`,fn.Section=dn,fn.Root=ln,fn.Label=sn;var pn={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},mn=oe(e=>{let n=O([`Input`,`InputWrapper`,`Select`],pn,e),{classNames:r,styles:i,unstyled:a,vars:o,dropdownOpened:s,defaultDropdownOpened:c,onDropdownClose:l,onDropdownOpen:u,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:S,readOnly:C,disabled:w,filter:T,limit:E,withScrollArea:D,maxDropdownHeight:k,floatingHeight:A,size:j,searchable:M,rightSection:N,checkIconPosition:P,withCheckIcon:te,withAlignedLabels:ne,nothingFoundMessage:re,name:ie,form:ae,searchValue:oe,defaultSearchValue:se,onSearchChange:ce,allowDeselect:le,error:ue,rightSectionPointerEvents:F,id:de,clearable:fe,clearSectionMode:pe,clearButtonProps:me,hiddenInputProps:he,renderOption:ge,onClear:_e,autoComplete:ve,scrollAreaProps:ye,__defaultRightSection:be,__clearSection:xe,__clearable:Se,chevronColor:Ce,autoSelectOnBlur:we,openOnFocus:Te,attributes:Ee,...De}=n,Oe=(0,L.useMemo)(()=>ht(h),[h]),ke=(0,L.useRef)({}),Ae=(0,L.useMemo)(()=>gt(Oe),[Oe]),je=x(de),[Me,Ne,Pe]=I({value:g,defaultValue:_,finalValue:null,onChange:m}),Fe=Me==null?void 0:`${Me}`in Ae?Ae[`${Me}`]:ke.current[`${Me}`],Ie=ot(Fe),[Le,Re,ze]=I({value:oe,defaultValue:se,finalValue:Fe?Fe.label:``,onChange:ce}),Be=Wt({opened:s,defaultOpened:c,onDropdownOpen:()=>{u?.(),y?Be.selectFirstOption():Be.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{l?.(),setTimeout(Be.resetSelectedOption,0)}}),Ve=e=>{Re(e),Be.resetSelectedOption()},{resolvedClassNames:He,resolvedStyles:Ue}=t({props:n,styles:i,classNames:r});(0,L.useEffect)(()=>{v&&Be.selectFirstOption()},[v,Le]),(0,L.useEffect)(()=>{g===null&&Ve(``),g!=null&&Fe&&(Ie?.value!==Fe.value||Ie?.label!==Fe.label)&&Ve(Fe.label)},[g,Fe]),(0,L.useEffect)(()=>{!Pe&&!ze&&Ve(Me==null?``:`${Me}`in Ae?Ae[`${Me}`]?.label:ke.current[`${Me}`]?.label||``)},[Ae,Me]),(0,L.useEffect)(()=>{Me&&`${Me}`in Ae&&(ke.current[`${Me}`]=Ae[`${Me}`])},[Ae,Me]);let We=(0,R.jsx)(qt.ClearButton,{...me,onClear:()=>{Ne(null,null),Ve(``),_e?.()}}),Ge=fe&&Me!=null&&!w&&!C;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(qt,{store:Be,__staticSelector:`Select`,classNames:He,styles:Ue,unstyled:a,readOnly:C,size:j,attributes:Ee,floatingHeight:A,keepMounted:we,onOptionSubmit:e=>{b?.(e);let t=le&&`${Ae[e].value}`==`${Me}`?null:Ae[e],n=t?t.value:null;n!==Me&&Ne(n,t),!Pe&&Ve(n==null?``:t?.label||``),Be.closeDropdown()},...S,children:[(0,R.jsx)(qt.Target,{targetType:M?`input`:`button`,autoComplete:ve,withExpandedAttribute:!0,children:(0,R.jsx)(ee,{id:je,__defaultRightSection:(0,R.jsx)(qt.Chevron,{size:j,error:ue,unstyled:a,color:Ce}),__clearSection:We,__clearable:Ge,__clearSectionMode:pe,rightSection:N,rightSectionPointerEvents:F||`none`,...De,size:j,__staticSelector:`Select`,disabled:w,readOnly:C||!M,value:Le,onChange:e=>{if(tn(e)){if(!C){let t=nn(Ae,e.currentTarget.value);t&&`${t.value}`!=`${Me}`&&(Ne(t.value,t),!Pe&&Ve(t.label))}return}Ve(e.currentTarget.value),Be.openDropdown(),v&&Be.selectFirstOption()},onFocus:e=>{Te&&M&&Be.openDropdown(),d?.(e)},onBlur:e=>{we&&Be.clickSelectedOption(),M&&Be.closeDropdown();let t=Me!=null&&(`${Me}`in Ae?Ae[`${Me}`]:ke.current[`${Me}`]);Ve(t&&t.label||``),f?.(e)},onClick:e=>{M?Be.openDropdown():Be.toggleDropdown(),p?.(e)},classNames:He,styles:Ue,unstyled:a,pointer:!M,error:ue,attributes:Ee})}),(0,R.jsx)(en,{data:Oe,hidden:C||w,filter:T,search:Le,limit:E,hiddenWhenEmpty:!re,withScrollArea:D,maxDropdownHeight:k,filterOptions:!!M&&Fe?.label!==Le,value:Me,checkIconPosition:P,withCheckIcon:te,withAlignedLabels:ne,nothingFoundMessage:re,unstyled:a,labelId:De.label?`${je}-label`:void 0,"aria-label":De.label?void 0:De[`aria-label`],renderOption:ge,scrollAreaProps:ye})]}),(0,R.jsx)(qt.HiddenInput,{value:Me,name:ie,form:ae,disabled:w,...he})]})});mn.classes={...ee.classes,...qt.classes},mn.displayName=`@mantine/core/Select`;function hn(e){if(e!==void 0)return typeof e==`number`?b(e):e}function gn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let c=o(),l=t===void 0?e:t,u=r!==void 0,d=j({"--sg-spacing-x":v(at(e)),"--sg-spacing-y":v(at(l)),"--sg-auto-rows":i,...u?{"--sg-min-col-width":hn(r)}:{"--sg-cols":at(n)?.toString()}}),f=te(c.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=v(e[r])),typeof l==`object`&&l[r]!==void 0&&(t[r][`--sg-spacing-y`]=v(l[r])),!u&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{});return(0,R.jsx)(s,{styles:d,media:je(te(f),c.breakpoints).filter(e=>te(f[e.value]).length>0).map(e=>({query:`(min-width: ${c.breakpoints[e.value]})`,styles:f[e.value]})),selector:a})}function _n(e){return typeof e==`object`&&e?te(e):[]}function vn(e){return e.sort((e,t)=>Ge(e)-Ge(t))}function yn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return vn(Array.from(new Set([..._n(e),..._n(t),...r===void 0?_n(n):[]])))}function bn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,c=r!==void 0,l=j({"--sg-spacing-x":v(at(e)),"--sg-spacing-y":v(at(o)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":hn(r)}:{"--sg-cols":at(n)?.toString()}}),u=yn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),d=u.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=v(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=v(o[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{});return(0,R.jsx)(s,{styles:l,container:u.map(e=>({query:`simple-grid (min-width: ${e})`,styles:d[e]})),selector:a})}var xn={container:`m_925c2d2c`,root:`m_2415a157`},Sn={cols:1,spacing:`md`,type:`media`},Cn=n(e=>{let t=O(`SimpleGrid`,Sn,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,cols:c,verticalSpacing:l,spacing:u,type:f,minColWidth:p,autoFlow:m,autoRows:h,attributes:g,..._}=t,v=k({name:`SimpleGrid`,classes:xn,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s}),y=d(),b=p===void 0?void 0:m||`auto-fill`;return f===`container`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(bn,{...t,selector:`.${y}`}),(0,R.jsx)(`div`,{...v(`container`),children:(0,R.jsx)(se,{...v(`root`,{className:y}),..._,"data-auto-cols":b})})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(gn,{...t,selector:`.${y}`}),(0,R.jsx)(se,{...v(`root`,{className:y}),..._,"data-auto-cols":b})]})});Cn.classes=xn,Cn.displayName=`@mantine/core/SimpleGrid`;var wn=class extends ge{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),he(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Je(t.mutationKey)!==Je(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Pe();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){me.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Tn(e,t){let n=xe(t),[r]=L.useState(()=>new wn(n,e));L.useEffect(()=>{r.setOptions(e)},[r,e]);let i=L.useSyncExternalStore(L.useCallback(e=>r.subscribe(me.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=L.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(be)},[r]);if(i.error&&Be(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var En=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),Dn=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),On=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M28,64A12,12,0,0,1,40,52H216a12,12,0,0,1,0,24H40A12,12,0,0,1,28,64Zm12,76h64a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24Zm80,40H40a12,12,0,0,0,0,24h80a12,12,0,0,0,0-24Zm120.49,20.49a12,12,0,0,1-17,0l-18.08-18.08a44,44,0,1,1,17-17l18.08,18.07A12,12,0,0,1,240.49,200.49ZM184,164a20,20,0,1,0-20-20A20,20,0,0,0,184,164Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,2.34L217.36,166A40,40,0,1,0,206,177.36l20.3,20.3a8,8,0,0,0,11.32-11.32Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M34,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H40A6,6,0,0,1,34,64Zm6,70h72a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12Zm88,52H40a6,6,0,0,0,0,12h88a6,6,0,0,0,0-12Zm108.24,10.24a6,6,0,0,1-8.48,0l-21.49-21.48a38.06,38.06,0,1,1,8.49-8.49l21.48,21.49A6,6,0,0,1,236.24,196.24ZM184,170a26,26,0,1,0-26-26A26,26,0,0,0,184,170Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M36,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H40A4,4,0,0,1,36,64Zm4,68h72a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8Zm88,56H40a4,4,0,0,0,0,8h88a4,4,0,0,0,0-8Zm106.83,6.83a4,4,0,0,1-5.66,0l-22.72-22.72a36.06,36.06,0,1,1,5.66-5.66l22.72,22.72A4,4,0,0,1,234.83,194.83ZM184,172a28,28,0,1,0-28-28A28,28,0,0,0,184,172Z`}))]]),kn=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z`}))]]),An=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),jn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:En}));jn.displayName=`ArrowUpRightIcon`;var Mn=jn,Nn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:Dn}));Nn.displayName=`CaretDownIcon`;var Pn=Nn,Fn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:On}));Fn.displayName=`ListMagnifyingGlassIcon`;var In=Fn,Ln=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:kn}));Ln.displayName=`SlidersHorizontalIcon`;var Rn=Ln,zn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:An}));zn.displayName=`WarningCircleIcon`;var Bn=zn;function Vn(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function Hn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function Un(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=Vn(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=Hn(r,u,s[0]),f=Hn(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function Wn(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=Vn(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=qn(d,0,s-r),f=qn(f,0,l-i),{x:d,y:f}}function Gn(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=Vn(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function Kn(e,t,n){let{margin:r,rowHeight:i}=e,a=Vn(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function qn(e,t,n){return Math.max(Math.min(e,n),t)}function Jn(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Yn(e,t){for(let n=0;nJn(e,t))}function Zn(e,t){return t===`horizontal`?$n(e):t===`vertical`||t===`wrap`?Qn(e):[...e]}function Qn(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function $n(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function er(e){let t=0;for(let n=0;nt&&(t=e)}}return t}function tr(e,t){for(let n=0;ne.static===!0)}function rr(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function ir(e){let t=Array(e.length);for(let n=0;nt.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Yn(n,i);)i.y++}}return e}function cr(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=Zn(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=Xn(d,t),p=f.length>0;if(p&&c)return ir(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;et.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return cr(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return cr(e,n,void 0,n.y+1,r,c,i);if(u&&i===null)return t.y=n.y,n.y+=n.h,[...e];if(d&&o)return cr(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:cr(e,n,l,u,r,c,i)}function ur(e,t,n){return Math.max(t,Math.min(n,e))}var dr=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:ur(t,0,Math.max(0,r-e.w)),y:ur(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:ur(t,1,Math.max(1,o)),h:ur(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:ur(t,e.minW??1,e.maxW??1/0),h:ur(n,e.minH??1,e.maxH??1/0)}}}];function fr(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function pr(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function mr({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function hr({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function gr(e){return e*100+`%`}function _r(e,t,n,r){return e+n>r?t:n}function vr(e,t,n){return e<0?t:n}function yr(e){return Math.max(0,e)}function br(e){return Math.max(0,e)}var xr=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:vr(o,e.height,i),top:br(o)}},Sr=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:_r(e.left,e.width,o,n),left:yr(i)}},Cr=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:br(r),left:0}:{height:i,width:a,top:br(r),left:o}},wr=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:vr(r,e.height,a),top:br(r)}},Tr={n:xr,ne:(e,t,n)=>xr(e,Sr(e,t,n)),e:Sr,se:(e,t,n)=>wr(e,Sr(e,t,n)),s:wr,sw:(e,t,n)=>wr(e,Cr(e,t)),w:Cr,nw:(e,t,n)=>xr(e,Cr(e,t))};function Er(e,t,n,r){let i=Tr[e];return i?i(t,{...t,...n},r):n}var Dr={type:`transform`,scale:1,calcStyle(e){return mr(e)}},Or={type:`absolute`,scale:1,calcStyle(e){return hr(e)}};function kr(e){return{type:`transform`,scale:e,calcStyle(e){return mr(e)},calcDragPosition(t,n,r,i){return{left:(t-r)/e,top:(n-i)/e}}}}var Ar=Dr,jr={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},Mr={enabled:!0,bounded:!1,threshold:3},Nr={enabled:!0,handles:[`se`]},Pr={enabled:!1,defaultItem:{w:1,h:1}};function Fr(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??nr(e).length>0;for(let i=o+1;it.y+t.h)break;Jn(t,o)&&Fr(e,o,n+t[a],r,s)}}t[r]=n}function Ir(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!Yn(e,t);)t.y--;let i;for(;(i=Yn(e,t))!==void 0;)Fr(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Lr(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!Yn(e,t);)t.x--;let i;for(;(i=Yn(e,t))!==void 0;)if(Fr(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!Yn(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Rr={type:`vertical`,allowOverlap:!1,compact(e,t){let n=nr(e),r=er(n),i=Qn(e),a=Array(e.length);for(let t=0;te[t]-e[n])}function Kr(e,t){let n=Gr(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;ie[a]&&(r=a)}return r}function qr(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Jr(e,t,n,r,i,a){let o=e[n];if(o)return ir(o);let s=e[r],c=Gr(t),l=c.slice(c.indexOf(n));for(let t=0;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Zr=h(((e,t)=>{var n=Xr();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Qr=h(((e,t)=>{t.exports=Zr()()})),$r=u(Qr(),1),ei=u(T(),1);function ti(e,t){for(let n=0,r=e.length;n`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;nt===e.identifier)||e.changedTouches&&ti(e.changedTouches,e=>t===e.identifier)}function Ti(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Ei(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function Di(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??Ei();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} +import{$ as e,A as t,C as n,D as r,E as i,K as a,N as o,O as s,R as c,S as l,St as u,T as d,X as f,Y as p,_ as m,_t as h,a as g,at as _,ct as v,d as y,dt as b,et as x,f as S,gt as C,h as w,ht as T,i as E,it as D,j as O,k,l as A,lt as j,m as M,mt as N,o as P,p as ee,pt as te,r as ne,s as re,st as ie,u as ae,w as oe,x as se,y as ce,yt as le}from"./brand-MzZ03bSa.js";import{c as ue,i as F,o as I}from"./auth-BeUORN-q.js";import{A as de,C as fe,D as pe,E as me,M as he,S as ge,T as _e,_ as ve,b as ye,c as be,f as xe,g as Se,h as Ce,i as we,l as Te,m as Ee,n as De,o as Oe,p as ke,s as Ae,u as je,v as Me,w as Ne,x as Pe,y as Fe}from"./tokens-CvbGYJRX.js";import{S as Ie,T as Le,o as Re,t as ze,w as Be,x as Ve}from"./Tooltip-BJiO7C_G.js";import{t as He}from"./use-computed-color-scheme-6JIsge00.js";import{O as Ue,V as We,i as Ge,k as Ke,n as qe,t as Je}from"./api-Be5Lq4YA.js";import{o as Ye}from"./preload-helper-BL3qEkUh.js";import{n as Xe,t as Ze}from"./copy-Bzg2uCpz.js";import{n as Qe,t as $e}from"./WarningCircle.es-DDq2AFnK.js";var L=u(C(),1),R=N();function et(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function tt(e){let t=(0,L.useRef)(void 0);return(0,L.useEffect)(()=>{t.current=e},[e]),t.current}function nt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{let t=O(`Flex`,null,e),{classNames:n,className:a,style:l,styles:u,unstyled:f,vars:p,gap:m,rowGap:h,columnGap:g,align:_,justify:v,wrap:y,direction:b,attributes:x,...S}=t,C=k({name:`Flex`,classes:st,props:t,className:a,style:l,classNames:n,styles:u,unstyled:f,attributes:x,vars:p}),w=o(),T=d(),E=i({styleProps:{gap:m,rowGap:h,columnGap:g,align:_,justify:v,wrap:y,direction:b},theme:w,data:ot}),D=c(),A=D&&E.hasResponsiveStyles?r(E.styles,E.media):T;return(0,R.jsxs)(R.Fragment,{children:[E.hasResponsiveStyles&&(0,R.jsx)(s,{selector:`.${A}`,styles:E.styles,media:E.media,deduplicate:D}),(0,R.jsx)(se,{...C(`root`,{className:A,style:j(E.inlineStyles)}),...S})]})});ct.classes=st,ct.displayName=`@mantine/core/Flex`;function lt(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>lt(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function ut(e){return e?e.map(e=>lt(e)):[]}function dt(e){return e.reduce((e,t)=>`group`in t?{...e,...dt(t.items)}:(e[`${t.value}`]=t,e),{})}var ft={dropdown:`m_88b62a41`,search:`m_985517d8`,options:`m_b2821a6e`,option:`m_92253aa5`,empty:`m_2530cd1d`,header:`m_858f94bd`,footer:`m_82b967cb`,group:`m_254f3e4f`,groupLabel:`m_2bb2e9e5`,chevron:`m_2943220b`,optionsDropdownOption:`m_390b5f4`,optionsDropdownCheckIcon:`m_8ee53fc2`,optionsDropdownCheckPlaceholder:`m_a530ee0a`},pt={error:null},mt=f((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":ie(t,`combobox-chevron-size`),"--combobox-chevron-color":n?a(n,e):void 0}})),ht=n(e=>{let t=O(`ComboboxChevron`,pt,e),{size:n,error:r,style:i,className:a,classNames:o,styles:s,unstyled:c,vars:l,attributes:u,mod:d,...f}=t,p=k({name:`ComboboxChevron`,classes:ft,props:t,style:i,className:a,classNames:o,styles:s,unstyled:c,vars:l,varsResolver:mt,attributes:u,rootSelector:`chevron`});return(0,R.jsx)(se,{component:`svg`,...f,...p(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},d],children:(0,R.jsx)(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})});ht.classes=ft,ht.varsResolver=mt,ht.displayName=`@mantine/core/ComboboxChevron`;var[gt,_t]=Be(`Combobox component was not found in tree`);function vt({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,R.jsx)(M.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}vt.displayName=`@mantine/core/ComboboxClearButton`;var yt=n(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=O(`ComboboxDropdown`,null,e),s=_t();return(0,R.jsx)(me.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});yt.classes=ft,yt.displayName=`@mantine/core/ComboboxDropdown`;var bt={refProp:`ref`},xt=n(e=>{let{children:t,refProp:n,ref:r}=O(`ComboboxDropdownTarget`,bt,e);if(_t(),!Le(t))throw Error(`Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return(0,R.jsx)(me.Target,{ref:r,refProp:n,children:t})});xt.displayName=`@mantine/core/ComboboxDropdownTarget`;var St=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxEmpty`,null,e);return(0,R.jsx)(se,{..._t().getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...o})});St.classes=ft,St.displayName=`@mantine/core/ComboboxEmpty`;function Ct({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=_t(),[c,l]=(0,L.useState)(null),u=t=>{if(e?.(t),!s.readOnly&&n){if(t.nativeEvent.isComposing)return;if(t.nativeEvent.code===`ArrowDown`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectNextOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`ArrowUp`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectPreviousOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`Enter`||t.nativeEvent.code===`NumpadEnter`){if(t.nativeEvent.keyCode===229)return;let e=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&e!==-1?(t.preventDefault(),s.store.clickSelectedOption()):a===`button`&&(t.preventDefault(),s.store.openDropdown(`keyboard`))}t.key===`Escape`&&s.store.closeDropdown(`keyboard`),t.nativeEvent.code===`Space`&&a===`button`&&(t.preventDefault(),s.store.toggleDropdown(`keyboard`))}},d=r?{...i?{role:`combobox`}:{},"aria-haspopup":`listbox`,"aria-expanded":i?!!(s.store.listId&&s.store.dropdownOpened):void 0,"aria-controls":s.store.dropdownOpened&&s.store.listId?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&c||void 0,autoComplete:o,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},f=e=>{a===`button`&&e.currentTarget.focus(),t?.(e)};return{...d,onKeyDown:u,onClick:f}}var wt={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Tt=n(t=>{let{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:a,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:l,...u}=O(`ComboboxEventsTarget`,wt,t),d=Ve(n);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=_t();return(0,L.cloneElement)(d,{...Ct({targetType:s,withAriaAttributes:a,withKeyboardNavigation:i,withExpandedAttribute:o,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:c}),...u,[r]:e(l,f.store.targetRef,Ie(d))})});Tt.displayName=`@mantine/core/ComboboxEventsTarget`;var Et=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxFooter`,null,e);return(0,R.jsx)(se,{..._t().getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...o,onMouseDown:e=>{e.preventDefault()}})});Et.classes=ft,Et.displayName=`@mantine/core/ComboboxFooter`;var Dt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,label:s,id:c,...l}=O(`ComboboxGroup`,null,e),u=_t(),d=x(c),f=s!=null&&s!==!1&&s!==``;return(0,R.jsxs)(se,{role:`group`,"aria-labelledby":f?d:void 0,...u.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...l,children:[f&&(0,R.jsx)(`div`,{id:d,...u.getStyles(`groupLabel`,{classNames:t,styles:i}),children:s}),o]})});Dt.classes=ft,Dt.displayName=`@mantine/core/ComboboxGroup`;var Ot=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxHeader`,null,e);return(0,R.jsx)(se,{..._t().getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...o,onMouseDown:e=>{e.preventDefault()}})});Ot.classes=ft,Ot.displayName=`@mantine/core/ComboboxHeader`;function kt({value:e,valuesDivider:t=`,`,...n}){return(0,R.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}kt.displayName=`@mantine/core/ComboboxHiddenInput`;var At=n(e=>{let t=O(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:o,onClick:s,id:c,active:l,onMouseDown:u,onMouseOver:d,disabled:f,selected:p,mod:m,...h}=t,g=_t(),_=(0,L.useId)(),v=c||_;return(0,R.jsx)(se,{...g.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),...h,id:v,mod:[`combobox-option`,{"combobox-active":l,"combobox-disabled":f,"combobox-selected":p},m],role:`option`,onClick:e=>{f?e.preventDefault():(g.onOptionSubmit?.(t.value,t),s?.(e))},onMouseDown:e=>{e.preventDefault(),u?.(e)},onMouseOver:e=>{g.resetSelectionOnOptionHover&&g.store.resetSelectedOption(),d?.(e)}})});At.classes=ft,At.displayName=`@mantine/core/ComboboxOption`;var jt=n(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:o,labelledBy:s,...c}=O(`ComboboxOptions`,null,e),l=_t(),u=x(a);return(0,L.useEffect)(()=>{l.store.setListId(u)},[u]),(0,R.jsx)(se,{...l.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...c,id:u,role:`listbox`,"aria-labelledby":s,onMouseDown:e=>{e.preventDefault(),o?.(e)}})});jt.classes=ft,jt.displayName=`@mantine/core/ComboboxOptions`;var Mt={withAriaAttributes:!0,withKeyboardNavigation:!0},Nt=n(t=>{let{classNames:n,styles:r,unstyled:i,vars:a,withAriaAttributes:o,onKeyDown:s,onClick:c,withKeyboardNavigation:l,size:u,ref:d,...f}=O(`ComboboxSearch`,Mt,t),p=_t(),m=p.getStyles(`search`),h=Ct({targetType:`input`,withAriaAttributes:o,withKeyboardNavigation:l,withExpandedAttribute:!1,onKeyDown:s,onClick:c,autoComplete:`off`});return(0,R.jsx)(M,{ref:e(d,p.store.searchRef),classNames:[{input:m.className},n],styles:[{input:m.style},r],size:u||p.size,...h,...f,__staticSelector:`Combobox`})});Nt.classes=ft,Nt.displayName=`@mantine/core/ComboboxSearch`;var Pt={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Ft=n(t=>{let{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:a,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:l,...u}=O(`ComboboxTarget`,Pt,t),d=Ve(n);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=_t(),p=(0,L.cloneElement)(d,{...Ct({targetType:s,withAriaAttributes:a,withKeyboardNavigation:i,withExpandedAttribute:o,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:c}),...u});return(0,R.jsx)(me.Target,{refProp:r,ref:e(l,f.store.targetRef),children:p})});Ft.displayName=`@mantine/core/ComboboxTarget`;function It(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].hasAttribute(`data-combobox-disabled`))return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].hasAttribute(`data-combobox-disabled`))return e}return e}function Lt(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,L.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,L.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,L.useCallback)(()=>{let e=it(f.current),t=nt(`#${l.current} [data-combobox-selected]`,e);t?.removeAttribute(`data-combobox-selected`),t?.removeAttribute(`aria-selected`)},[]),b=(0,L.useCallback)(e=>{let t=it(f.current),n=nt(`#${l.current}`,t),r=n?rt(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].setAttribute(`aria-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,L.useCallback)(()=>{let e=it(f.current),t=nt(`#${l.current} [data-combobox-active]`,e);if(t){let n=rt(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,L.useCallback)(()=>{let e=it(f.current),t=rt(`#${l.current} [data-combobox-option]`,e);return b(Lt(u.current,t,a))},[b,a]),C=(0,L.useCallback)(()=>{let e=it(f.current),t=rt(`#${l.current} [data-combobox-option]`,e);return b(It(u.current,t,a))},[b,a]),w=(0,L.useCallback)(()=>{let e=it(f.current),t=rt(`#${l.current} [data-combobox-option]`,e);return b(Rt(t))},[b]),T=(0,L.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=it(f.current),r=rt(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=it(f.current),r=rt(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,L.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,L.useCallback)(()=>{let e=it(f.current);(rt(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,L.useCallback)(e=>{l.current=e},[]),k=(0,L.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,L.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,L.useCallback)(()=>u.current,[]);return(0,L.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var Bt={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},Vt=f((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":D(t),"--combobox-option-padding":ie(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:b(n),"--combobox-option-fz":D(t),"--combobox-option-padding":ie(t,`combobox-option-padding`)}})),Ht=e=>{let t=O(`Combobox`,Bt,e),{classNames:n,styles:r,unstyled:i,children:a,store:o,vars:s,onOptionSubmit:c,onClose:l,size:u,dropdownPadding:d,resetSelectionOnOptionHover:f,__staticSelector:p,readOnly:m,attributes:h,floatingHeight:g,middlewares:_,...v}=t,y=g===`viewport`?{..._,flip:!1,size:{...typeof _?.size==`object`?_.size:{},padding:typeof _?.size==`object`&&_.size.padding!==void 0?_.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=_?.size;typeof i==`object`&&i.apply?i.apply({availableHeight:e,availableWidth:t,elements:n,...r}):i&&Object.assign(n.floating.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})}}}:_,b=zt(),x=o||b,S=k({name:p||`Combobox`,classes:ft,props:t,classNames:n,styles:r,unstyled:i,attributes:h,vars:s,varsResolver:Vt}),C=()=>{l?.(),x.closeDropdown()};return(0,R.jsx)(gt,{value:{getStyles:S,store:x,onOptionSubmit:c,size:u,resetSelectionOnOptionHover:f,readOnly:m,floatingHeight:g},children:(0,R.jsx)(me,{opened:x.dropdownOpened,...v,middlewares:y,onChange:e=>!e&&C(),withRoles:!1,unstyled:i,children:a})})};Ht.extend=e=>e,Ht.classes=ft,Ht.varsResolver=Vt,Ht.displayName=`@mantine/core/Combobox`,Ht.Target=Ft,Ht.Dropdown=yt,Ht.Options=jt,Ht.Option=At,Ht.Search=Nt,Ht.Empty=St,Ht.Chevron=ht,Ht.Footer=Et,Ht.Header=Ot,Ht.EventsTarget=Tt,Ht.DropdownTarget=xt,Ht.Group=Dt,Ht.ClearButton=vt,Ht.HiddenInput=kt;function Ut(e){return`group`in e}function Wt({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function Kt(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Ut(n))Kt(n.items,t);else{if(n.value===void 0)throw Error(`[@mantine/core] Each option must have value property`);if(t.has(n.value))throw Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function qt(e,t){return Array.isArray(e)?e.includes(t):e===t}function Jt({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Ut(e)){let s=qt(r,e.value),c=t&&(s?(0,R.jsx)(_e,{className:ft.optionsDropdownCheckIcon}):n?(0,R.jsx)(`div`,{className:ft.optionsDropdownCheckPlaceholder}):null),l=(0,R.jsxs)(R.Fragment,{children:[i===`left`&&c,(0,R.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,R.jsx)(Ht.Option,{value:e.value,disabled:e.disabled,className:p({[ft.optionsDropdownOption]:!a}),"data-reverse":i===`right`||void 0,"data-checked":s||void 0,"aria-selected":s,active:s,children:typeof o==`function`?o({option:e,checked:s}):l})}let s=e.items.map(e=>(0,R.jsx)(Jt,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,R.jsx)(Ht.Group,{label:e.group,children:s})}function Yt({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:a,maxDropdownHeight:o,floatingHeight:s,withScrollArea:c=!0,filterOptions:l=!0,withCheckIcon:u=!1,withAlignedLabels:d=!1,value:f,checkIconPosition:p,nothingFoundMessage:m,unstyled:h,labelId:g,renderOption:_,scrollAreaProps:v,"aria-label":y}){let b=_t();Kt(e);let x=typeof i==`string`?(r||Wt)({options:e,search:l?i:``,limit:a??1/0}):e,S=Gt(x),C=x.map((e,t)=>(0,R.jsx)(Jt,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Ut(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,R.jsx)(Ht.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,R.jsxs)(Ht.Options,{labelledBy:g,"aria-label":y,children:[c?(0,R.jsx)(Re.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,R.jsx)(Ht.Empty,{children:m})]})})}function Xt(e){let t=e.currentTarget;return it(t).activeElement!==t}function Zt(e,t){let n=t.trim().toLowerCase();if(n===``)return;let r=Object.values(e).filter(e=>!e.disabled&&e.label.trim().toLowerCase()===n);return r.length===1?r[0]:void 0}var[Qt,$t]=Be(`Progress.Root component was not found in tree`),en={root:`m_db6d6462`,section:`m_2242eb65`,"stripes-animation":`m_81a374bd`,"stripes-animation-vertical":`m_e0fb7a86`,label:`m_91e40b74`},tn=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ProgressLabel`,null,e);return(0,R.jsx)(se,{...$t().getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...o})});tn.classes=en,tn.displayName=`@mantine/core/ProgressLabel`;var nn=f((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":ie(t,`progress-size`),"--progress-radius":n===void 0?void 0:_(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),rn=n(e=>{let t=O(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,autoContrast:c,transitionDuration:l,orientation:u,attributes:d,mod:f,...p}=t,m=k({name:`Progress`,classes:en,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:d,vars:s,varsResolver:nn});return(0,R.jsx)(Qt,{value:{getStyles:m,autoContrast:c},children:(0,R.jsx)(se,{mod:[{orientation:u},f],...m(`root`),...p})})});rn.classes=en,rn.varsResolver=nn,rn.displayName=`@mantine/core/ProgressRoot`;var an={withAria:!0},on=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:s,value:c,withAria:l,color:u,striped:d,animated:f,mod:p,...m}=O(`ProgressSection`,an,e),h=$t(),g=o(),_=l?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":c,"aria-valuetext":`${c}%`}:{};return(0,R.jsx)(se,{...h.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...m,..._,mod:[{striped:d||f,animated:f},p],__vars:{"--progress-section-size":`${c}%`,"--progress-section-color":a(u,g),"--progress-label-color":at(h.autoContrast,g)?pe({color:u,theme:g,autoContrast:h.autoContrast}):void 0}})});on.classes=en,on.displayName=`@mantine/core/ProgressSection`;var sn=n(e=>{let n=O(`Progress`,null,e),{value:r,classNames:i,styles:a,vars:o,color:s,striped:c,animated:l,"aria-label":u,...d}=n,{resolvedClassNames:f,resolvedStyles:p}=t({classNames:i,styles:a,props:n});return(0,R.jsx)(rn,{classNames:f,styles:p,vars:o,...d,children:(0,R.jsx)(on,{value:r,color:s,striped:c,animated:l,"aria-label":u})})});sn.classes=en,sn.displayName=`@mantine/core/Progress`,sn.Section=on,sn.Root=rn,sn.Label=tn;var cn={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},ln=oe(e=>{let n=O([`Input`,`InputWrapper`,`Select`],cn,e),{classNames:r,styles:i,unstyled:a,vars:o,dropdownOpened:s,defaultDropdownOpened:c,onDropdownClose:l,onDropdownOpen:u,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:S,readOnly:C,disabled:w,filter:T,limit:E,withScrollArea:D,maxDropdownHeight:k,floatingHeight:A,size:j,searchable:M,rightSection:N,checkIconPosition:P,withCheckIcon:te,withAlignedLabels:ne,nothingFoundMessage:re,name:ie,form:ae,searchValue:oe,defaultSearchValue:se,onSearchChange:ce,allowDeselect:le,error:F,rightSectionPointerEvents:I,id:de,clearable:fe,clearSectionMode:pe,clearButtonProps:me,hiddenInputProps:he,renderOption:ge,onClear:_e,autoComplete:ve,scrollAreaProps:ye,__defaultRightSection:be,__clearSection:xe,__clearable:Se,chevronColor:Ce,autoSelectOnBlur:we,openOnFocus:Te,attributes:Ee,...De}=n,Oe=(0,L.useMemo)(()=>ut(h),[h]),ke=(0,L.useRef)({}),Ae=(0,L.useMemo)(()=>dt(Oe),[Oe]),je=x(de),[Me,Ne,Pe]=ue({value:g,defaultValue:_,finalValue:null,onChange:m}),Fe=Me==null?void 0:`${Me}`in Ae?Ae[`${Me}`]:ke.current[`${Me}`],Ie=tt(Fe),[Le,Re,ze]=ue({value:oe,defaultValue:se,finalValue:Fe?Fe.label:``,onChange:ce}),Be=zt({opened:s,defaultOpened:c,onDropdownOpen:()=>{u?.(),y?Be.selectFirstOption():Be.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{l?.(),setTimeout(Be.resetSelectedOption,0)}}),Ve=e=>{Re(e),Be.resetSelectedOption()},{resolvedClassNames:He,resolvedStyles:Ue}=t({props:n,styles:i,classNames:r});(0,L.useEffect)(()=>{v&&Be.selectFirstOption()},[v,Le]),(0,L.useEffect)(()=>{g===null&&Ve(``),g!=null&&Fe&&(Ie?.value!==Fe.value||Ie?.label!==Fe.label)&&Ve(Fe.label)},[g,Fe]),(0,L.useEffect)(()=>{!Pe&&!ze&&Ve(Me==null?``:`${Me}`in Ae?Ae[`${Me}`]?.label:ke.current[`${Me}`]?.label||``)},[Ae,Me]),(0,L.useEffect)(()=>{Me&&`${Me}`in Ae&&(ke.current[`${Me}`]=Ae[`${Me}`])},[Ae,Me]);let We=(0,R.jsx)(Ht.ClearButton,{...me,onClear:()=>{Ne(null,null),Ve(``),_e?.()}}),Ge=fe&&Me!=null&&!w&&!C;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(Ht,{store:Be,__staticSelector:`Select`,classNames:He,styles:Ue,unstyled:a,readOnly:C,size:j,attributes:Ee,floatingHeight:A,keepMounted:we,onOptionSubmit:e=>{b?.(e);let t=le&&`${Ae[e].value}`==`${Me}`?null:Ae[e],n=t?t.value:null;n!==Me&&Ne(n,t),!Pe&&Ve(n==null?``:t?.label||``),Be.closeDropdown()},...S,children:[(0,R.jsx)(Ht.Target,{targetType:M?`input`:`button`,autoComplete:ve,withExpandedAttribute:!0,children:(0,R.jsx)(ee,{id:je,__defaultRightSection:(0,R.jsx)(Ht.Chevron,{size:j,error:F,unstyled:a,color:Ce}),__clearSection:We,__clearable:Ge,__clearSectionMode:pe,rightSection:N,rightSectionPointerEvents:I||`none`,...De,size:j,__staticSelector:`Select`,disabled:w,readOnly:C||!M,value:Le,onChange:e=>{if(Xt(e)){if(!C){let t=Zt(Ae,e.currentTarget.value);t&&`${t.value}`!=`${Me}`&&(Ne(t.value,t),!Pe&&Ve(t.label))}return}Ve(e.currentTarget.value),Be.openDropdown(),v&&Be.selectFirstOption()},onFocus:e=>{Te&&M&&Be.openDropdown(),d?.(e)},onBlur:e=>{we&&Be.clickSelectedOption(),M&&Be.closeDropdown();let t=Me!=null&&(`${Me}`in Ae?Ae[`${Me}`]:ke.current[`${Me}`]);Ve(t&&t.label||``),f?.(e)},onClick:e=>{M?Be.openDropdown():Be.toggleDropdown(),p?.(e)},classNames:He,styles:Ue,unstyled:a,pointer:!M,error:F,attributes:Ee})}),(0,R.jsx)(Yt,{data:Oe,hidden:C||w,filter:T,search:Le,limit:E,hiddenWhenEmpty:!re,withScrollArea:D,maxDropdownHeight:k,filterOptions:!!M&&Fe?.label!==Le,value:Me,checkIconPosition:P,withCheckIcon:te,withAlignedLabels:ne,nothingFoundMessage:re,unstyled:a,labelId:De.label?`${je}-label`:void 0,"aria-label":De.label?void 0:De[`aria-label`],renderOption:ge,scrollAreaProps:ye})]}),(0,R.jsx)(Ht.HiddenInput,{value:Me,name:ie,form:ae,disabled:w,...he})]})});ln.classes={...ee.classes,...Ht.classes},ln.displayName=`@mantine/core/Select`;function un(e){if(e!==void 0)return typeof e==`number`?b(e):e}function dn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let c=o(),l=t===void 0?e:t,u=r!==void 0,d=j({"--sg-spacing-x":v(et(e)),"--sg-spacing-y":v(et(l)),"--sg-auto-rows":i,...u?{"--sg-min-col-width":un(r)}:{"--sg-cols":et(n)?.toString()}}),f=te(c.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=v(e[r])),typeof l==`object`&&l[r]!==void 0&&(t[r][`--sg-spacing-y`]=v(l[r])),!u&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{});return(0,R.jsx)(s,{styles:d,media:de(te(f),c.breakpoints).filter(e=>te(f[e.value]).length>0).map(e=>({query:`(min-width: ${c.breakpoints[e.value]})`,styles:f[e.value]})),selector:a})}function fn(e){return typeof e==`object`&&e?te(e):[]}function pn(e){return e.sort((e,t)=>he(e)-he(t))}function mn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return pn(Array.from(new Set([...fn(e),...fn(t),...r===void 0?fn(n):[]])))}function hn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,c=r!==void 0,l=j({"--sg-spacing-x":v(et(e)),"--sg-spacing-y":v(et(o)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":un(r)}:{"--sg-cols":et(n)?.toString()}}),u=mn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),d=u.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=v(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=v(o[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{});return(0,R.jsx)(s,{styles:l,container:u.map(e=>({query:`simple-grid (min-width: ${e})`,styles:d[e]})),selector:a})}var gn={container:`m_925c2d2c`,root:`m_2415a157`},_n={cols:1,spacing:`md`,type:`media`},vn=n(e=>{let t=O(`SimpleGrid`,_n,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,cols:c,verticalSpacing:l,spacing:u,type:f,minColWidth:p,autoFlow:m,autoRows:h,attributes:g,..._}=t,v=k({name:`SimpleGrid`,classes:gn,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s}),y=d(),b=p===void 0?void 0:m||`auto-fill`;return f===`container`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(hn,{...t,selector:`.${y}`}),(0,R.jsx)(`div`,{...v(`container`),children:(0,R.jsx)(se,{...v(`root`,{className:y}),..._,"data-auto-cols":b})})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(dn,{...t,selector:`.${y}`}),(0,R.jsx)(se,{...v(`root`,{className:y}),..._,"data-auto-cols":b})]})});vn.classes=gn,vn.displayName=`@mantine/core/SimpleGrid`;var yn=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),bn=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),xn=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M28,64A12,12,0,0,1,40,52H216a12,12,0,0,1,0,24H40A12,12,0,0,1,28,64Zm12,76h64a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24Zm80,40H40a12,12,0,0,0,0,24h80a12,12,0,0,0,0-24Zm120.49,20.49a12,12,0,0,1-17,0l-18.08-18.08a44,44,0,1,1,17-17l18.08,18.07A12,12,0,0,1,240.49,200.49ZM184,164a20,20,0,1,0-20-20A20,20,0,0,0,184,164Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,2.34L217.36,166A40,40,0,1,0,206,177.36l20.3,20.3a8,8,0,0,0,11.32-11.32Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M34,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H40A6,6,0,0,1,34,64Zm6,70h72a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12Zm88,52H40a6,6,0,0,0,0,12h88a6,6,0,0,0,0-12Zm108.24,10.24a6,6,0,0,1-8.48,0l-21.49-21.48a38.06,38.06,0,1,1,8.49-8.49l21.48,21.49A6,6,0,0,1,236.24,196.24ZM184,170a26,26,0,1,0-26-26A26,26,0,0,0,184,170Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M36,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H40A4,4,0,0,1,36,64Zm4,68h72a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8Zm88,56H40a4,4,0,0,0,0,8h88a4,4,0,0,0,0-8Zm106.83,6.83a4,4,0,0,1-5.66,0l-22.72-22.72a36.06,36.06,0,1,1,5.66-5.66l22.72,22.72A4,4,0,0,1,234.83,194.83ZM184,172a28,28,0,1,0-28-28A28,28,0,0,0,184,172Z`}))]]),Sn=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z`}))]]),Cn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:yn}));Cn.displayName=`ArrowUpRightIcon`;var wn=Cn,Tn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:bn}));Tn.displayName=`CaretDownIcon`;var En=Tn,Dn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:xn}));Dn.displayName=`ListMagnifyingGlassIcon`;var On=Dn,kn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:Sn}));kn.displayName=`SlidersHorizontalIcon`;var An=kn;function jn(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function Mn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function Nn(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=jn(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=Mn(r,u,s[0]),f=Mn(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function Pn(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=jn(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=Ln(d,0,s-r),f=Ln(f,0,l-i),{x:d,y:f}}function Fn(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=jn(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function In(e,t,n){let{margin:r,rowHeight:i}=e,a=jn(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function Ln(e,t,n){return Math.max(Math.min(e,n),t)}function Rn(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function zn(e,t){for(let n=0;nRn(e,t))}function Vn(e,t){return t===`horizontal`?Un(e):t===`vertical`||t===`wrap`?Hn(e):[...e]}function Hn(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function Un(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function Wn(e){let t=0;for(let n=0;nt&&(t=e)}}return t}function Gn(e,t){for(let n=0;ne.static===!0)}function qn(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function Jn(e){let t=Array(e.length);for(let n=0;nt.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;zn(n,i);)i.y++}}return e}function Qn(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=Vn(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=Bn(d,t),p=f.length>0;if(p&&c)return Jn(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;et.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return Qn(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return Qn(e,n,void 0,n.y+1,r,c,i);if(u&&i===null)return t.y=n.y,n.y+=n.h,[...e];if(d&&o)return Qn(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:Qn(e,n,l,u,r,c,i)}function er(e,t,n){return Math.max(t,Math.min(n,e))}var tr=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:er(t,0,Math.max(0,r-e.w)),y:er(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:er(t,1,Math.max(1,o)),h:er(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:er(t,e.minW??1,e.maxW??1/0),h:er(n,e.minH??1,e.maxH??1/0)}}}];function nr(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function rr(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function ir({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function ar({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function or(e){return e*100+`%`}function sr(e,t,n,r){return e+n>r?t:n}function cr(e,t,n){return e<0?t:n}function lr(e){return Math.max(0,e)}function ur(e){return Math.max(0,e)}var dr=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:cr(o,e.height,i),top:ur(o)}},fr=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:sr(e.left,e.width,o,n),left:lr(i)}},pr=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:ur(r),left:0}:{height:i,width:a,top:ur(r),left:o}},mr=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:cr(r,e.height,a),top:ur(r)}},hr={n:dr,ne:(e,t,n)=>dr(e,fr(e,t,n)),e:fr,se:(e,t,n)=>mr(e,fr(e,t,n)),s:mr,sw:(e,t,n)=>mr(e,pr(e,t)),w:pr,nw:(e,t,n)=>dr(e,pr(e,t))};function gr(e,t,n,r){let i=hr[e];return i?i(t,{...t,...n},r):n}var _r={type:`transform`,scale:1,calcStyle(e){return ir(e)}},vr={type:`absolute`,scale:1,calcStyle(e){return ar(e)}};function yr(e){return{type:`transform`,scale:e,calcStyle(e){return ir(e)},calcDragPosition(t,n,r,i){return{left:(t-r)/e,top:(n-i)/e}}}}var br=_r,xr={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},Sr={enabled:!0,bounded:!1,threshold:3},Cr={enabled:!0,handles:[`se`]},wr={enabled:!1,defaultItem:{w:1,h:1}};function Tr(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??Kn(e).length>0;for(let i=o+1;it.y+t.h)break;Rn(t,o)&&Tr(e,o,n+t[a],r,s)}}t[r]=n}function Er(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!zn(e,t);)t.y--;let i;for(;(i=zn(e,t))!==void 0;)Tr(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Dr(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!zn(e,t);)t.x--;let i;for(;(i=zn(e,t))!==void 0;)if(Tr(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!zn(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Or={type:`vertical`,allowOverlap:!1,compact(e,t){let n=Kn(e),r=Wn(n),i=Hn(e),a=Array(e.length);for(let t=0;te[t]-e[n])}function Ir(e,t){let n=Fr(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;ie[a]&&(r=a)}return r}function Lr(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Rr(e,t,n,r,i,a){let o=e[n];if(o)return Jn(o);let s=e[r],c=Fr(t),l=c.slice(c.indexOf(n));for(let t=0;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Vr=h(((e,t)=>{var n=Br();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Hr=h(((e,t)=>{t.exports=Vr()()})),Ur=u(Hr(),1),Wr=u(T(),1);function Gr(e,t){for(let n=0,r=e.length;n`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;nt===e.identifier)||e.changedTouches&&Gr(e.changedTouches,e=>t===e.identifier)}function hi(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function gi(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function _i(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??gi();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;} -`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&Ai(e.body,`react-draggable-transparent-selection`)}function Oi(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{ki(e)}):ki(e)}function ki(e){if(e)try{e.body&&ji(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function Ai(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function ji(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function Mi(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:zi(r);let i=Bi(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+ii(s.paddingLeft)+ii(o.marginLeft),top:-i.offsetTop+ii(s.paddingTop)+ii(o.marginTop),right:yi(a)-_i(i)-i.offsetLeft+ii(s.paddingRight)-ii(o.marginRight),bottom:vi(a)-gi(i)-i.offsetTop+ii(s.paddingBottom)-ii(o.marginBottom)}}return ri(r.right)&&(t=Math.min(t,r.right)),ri(r.bottom)&&(n=Math.min(n,r.bottom)),ri(r.left)&&(t=Math.max(t,r.left)),ri(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Ni(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function Pi(e){return e.props.axis===`both`||e.props.axis===`x`}function Fi(e){return e.props.axis===`both`||e.props.axis===`y`}function Ii(e,t,n){let r=typeof t==`number`?wi(e,t):null;if(typeof t==`number`&&!r)return null;let i=Bi(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return bi(r||e,a,n.props.scale)}function Li(e,t,n){let r=!ri(e.lastX),i=Bi(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Ri(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function zi(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Bi(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var Vi=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Hi={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Ui=Hi.mouse,Wi=class extends L.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!pi(e.target,this.props.handle,t)||this.props.cancel&&pi(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=Ti(e);this.touchIdentifier=r;let i=Ii(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=Li(this,a,o);Vi(`DraggableCore: handleDragStart: %j`,s),Vi(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&Di(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,mi(n,Ui.move,this.handleDrag),mi(n,Ui.stop,this.handleDragStop))},this.handleDrag=e=>{let t=Ii(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=Ni(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=Li(this,n,r);if(Vi(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=Ii(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=Ni(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=Li(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&Oi(a.ownerDocument),Vi(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Vi(`DraggableCore: Removing handlers`),hi(a.ownerDocument,Ui.move,this.handleDrag),hi(a.ownerDocument,Ui.stop,this.handleDragStop))},this.onMouseDown=e=>(Ui=Hi.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Ui=Hi.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Ui=Hi.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Ui=Hi.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&mi(e,Hi.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;hi(t,Hi.mouse.move,this.handleDrag),hi(t,Hi.touch.move,this.handleDrag),hi(t,Hi.mouse.stop,this.handleDragStop),hi(t,Hi.touch.stop,this.handleDragStop),hi(e,Hi.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&Oi(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=ei.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Vi(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return L.cloneElement(L.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Wi.displayName=`DraggableCore`,Wi.propTypes={allowAnyClick:$r.default.bool,allowMobileScroll:$r.default.bool,children:$r.default.node.isRequired,disabled:$r.default.bool,enableUserSelectHack:$r.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:$r.default.arrayOf($r.default.number),handle:$r.default.string,cancel:$r.default.string,nodeRef:$r.default.object,nonce:$r.default.string,onStart:$r.default.func,onDrag:$r.default.func,onStop:$r.default.func,onMouseDown:$r.default.func,scale:$r.default.number,className:ai,style:ai,transform:ai},Wi.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Gi=class extends L.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Vi(`Draggable: onDragStart: %j`,t),this.props.onStart(e,Ri(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Vi(`Draggable: onDrag: %j`,t);let n=Ri(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=Mi(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,Ri(this,t))===!1)return!1;Vi(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Vi(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=ei.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,m=!s||this.state.dragging,h=s||r,g={x:Pi(this)&&m?this.state.x:h.x,y:Fi(this)&&m?this.state.y:h.y};this.state.isElementSVG?f=Si(g,c):d=xi(g,c);let _=L.Children.only(n),v=p(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return L.createElement(Wi,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},L.cloneElement(_,{className:v,style:{..._.props.style,...d},transform:f}))}};Gi.displayName=`Draggable`,Gi.propTypes={...Wi.propTypes,axis:$r.default.oneOf([`both`,`x`,`y`,`none`]),bounds:$r.default.oneOfType([$r.default.shape({left:$r.default.number,right:$r.default.number,top:$r.default.number,bottom:$r.default.number}),$r.default.string,$r.default.oneOf([!1])]),defaultClassName:$r.default.string,defaultClassNameDragging:$r.default.string,defaultClassNameDragged:$r.default.string,defaultPosition:$r.default.shape({x:$r.default.number,y:$r.default.number}),positionOffset:$r.default.shape({x:$r.default.oneOfType([$r.default.number,$r.default.string]),y:$r.default.oneOfType([$r.default.number,$r.default.string])}),position:$r.default.shape({x:$r.default.number,y:$r.default.number}),className:ai,style:ai,transform:ai},Gi.defaultProps={...Wi.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var Ki=h(((e,t)=>{function n(e){var t,r,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{DraggableCore:()=>Oe,default:()=>ke}),t.exports=d(f);var p=u(C()),m=u(Qr()),h=u(T()),g=Ki();function _(e,t){for(let n=0,r=e.length;n`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;nt===e.identifier)||e.changedTouches&&_(e.changedTouches,e=>t===e.identifier)}function ce(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function le(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function ue(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??le();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} +`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&bi(e.body,`react-draggable-transparent-selection`)}function vi(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{yi(e)}):yi(e)}function yi(e){if(e)try{e.body&&xi(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function bi(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function xi(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function Si(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:ki(r);let i=Ai(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+Jr(s.paddingLeft)+Jr(o.marginLeft),top:-i.offsetTop+Jr(s.paddingTop)+Jr(o.marginTop),right:li(a)-si(i)-i.offsetLeft+Jr(s.paddingRight)-Jr(o.marginRight),bottom:ci(a)-oi(i)-i.offsetTop+Jr(s.paddingBottom)-Jr(o.marginBottom)}}return qr(r.right)&&(t=Math.min(t,r.right)),qr(r.bottom)&&(n=Math.min(n,r.bottom)),qr(r.left)&&(t=Math.max(t,r.left)),qr(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Ci(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function wi(e){return e.props.axis===`both`||e.props.axis===`x`}function Ti(e){return e.props.axis===`both`||e.props.axis===`y`}function Ei(e,t,n){let r=typeof t==`number`?mi(e,t):null;if(typeof t==`number`&&!r)return null;let i=Ai(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ui(r||e,a,n.props.scale)}function Di(e,t,n){let r=!qr(e.lastX),i=Ai(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Oi(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function ki(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Ai(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ji=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Mi={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Ni=Mi.mouse,Pi=class extends L.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!ri(e.target,this.props.handle,t)||this.props.cancel&&ri(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=hi(e);this.touchIdentifier=r;let i=Ei(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=Di(this,a,o);ji(`DraggableCore: handleDragStart: %j`,s),ji(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&_i(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,ii(n,Ni.move,this.handleDrag),ii(n,Ni.stop,this.handleDragStop))},this.handleDrag=e=>{let t=Ei(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=Ci(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=Di(this,n,r);if(ji(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=Ei(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=Ci(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=Di(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&vi(a.ownerDocument),ji(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(ji(`DraggableCore: Removing handlers`),ai(a.ownerDocument,Ni.move,this.handleDrag),ai(a.ownerDocument,Ni.stop,this.handleDragStop))},this.onMouseDown=e=>(Ni=Mi.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Ni=Mi.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Ni=Mi.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Ni=Mi.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&ii(e,Mi.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;ai(t,Mi.mouse.move,this.handleDrag),ai(t,Mi.touch.move,this.handleDrag),ai(t,Mi.mouse.stop,this.handleDragStop),ai(t,Mi.touch.stop,this.handleDragStop),ai(e,Mi.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&vi(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Wr.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(ji(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return L.cloneElement(L.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Pi.displayName=`DraggableCore`,Pi.propTypes={allowAnyClick:Ur.default.bool,allowMobileScroll:Ur.default.bool,children:Ur.default.node.isRequired,disabled:Ur.default.bool,enableUserSelectHack:Ur.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:Ur.default.arrayOf(Ur.default.number),handle:Ur.default.string,cancel:Ur.default.string,nodeRef:Ur.default.object,nonce:Ur.default.string,onStart:Ur.default.func,onDrag:Ur.default.func,onStop:Ur.default.func,onMouseDown:Ur.default.func,scale:Ur.default.number,className:Yr,style:Yr,transform:Yr},Pi.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Fi=class extends L.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(ji(`Draggable: onDragStart: %j`,t),this.props.onStart(e,Oi(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;ji(`Draggable: onDrag: %j`,t);let n=Oi(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=Si(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,Oi(this,t))===!1)return!1;ji(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(ji(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Wr.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,m=!s||this.state.dragging,h=s||r,g={x:wi(this)&&m?this.state.x:h.x,y:Ti(this)&&m?this.state.y:h.y};this.state.isElementSVG?f=fi(g,c):d=di(g,c);let _=L.Children.only(n),v=p(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return L.createElement(Pi,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},L.cloneElement(_,{className:v,style:{..._.props.style,...d},transform:f}))}};Fi.displayName=`Draggable`,Fi.propTypes={...Pi.propTypes,axis:Ur.default.oneOf([`both`,`x`,`y`,`none`]),bounds:Ur.default.oneOfType([Ur.default.shape({left:Ur.default.number,right:Ur.default.number,top:Ur.default.number,bottom:Ur.default.number}),Ur.default.string,Ur.default.oneOf([!1])]),defaultClassName:Ur.default.string,defaultClassNameDragging:Ur.default.string,defaultClassNameDragged:Ur.default.string,defaultPosition:Ur.default.shape({x:Ur.default.number,y:Ur.default.number}),positionOffset:Ur.default.shape({x:Ur.default.oneOfType([Ur.default.number,Ur.default.string]),y:Ur.default.oneOfType([Ur.default.number,Ur.default.string])}),position:Ur.default.shape({x:Ur.default.number,y:Ur.default.number}),className:Yr,style:Yr,transform:Yr},Fi.defaultProps={...Pi.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var Ii=h(((e,t)=>{function n(e){var t,r,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{DraggableCore:()=>Oe,default:()=>ke}),t.exports=d(f);var p=u(C()),m=u(Hr()),h=u(T()),g=Ii();function _(e,t){for(let n=0,r=e.length;n`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;nt===e.identifier)||e.changedTouches&&_(e.changedTouches,e=>t===e.identifier)}function ce(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function le(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function ue(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??le();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;} -`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&de(e.body,`react-draggable-transparent-selection`)}function F(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{I(e)}):I(e)}function I(e){if(e)try{e.body&&fe(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function de(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function fe(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function pe(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:be(r);let i=xe(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+b(s.paddingLeft)+b(o.marginLeft),top:-i.offsetTop+b(s.paddingTop)+b(o.marginTop),right:ne(a)-ee(i)-i.offsetLeft+b(s.paddingRight)-b(o.marginRight),bottom:te(a)-P(i)-i.offsetTop+b(s.paddingBottom)-b(o.marginBottom)}}return y(r.right)&&(t=Math.min(t,r.right)),y(r.bottom)&&(n=Math.min(n,r.bottom)),y(r.left)&&(t=Math.max(t,r.left)),y(r.top)&&(n=Math.max(n,r.top)),[t,n]}function me(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function he(e){return e.props.axis===`both`||e.props.axis===`x`}function ge(e){return e.props.axis===`both`||e.props.axis===`y`}function _e(e,t,n){let r=typeof t==`number`?se(e,t):null;if(typeof t==`number`&&!r)return null;let i=xe(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return re(r||e,a,n.props.scale)}function ve(e,t,n){let r=!y(e.lastX),i=xe(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function ye(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function be(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function xe(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var Se=u(C()),Ce=u(Qr()),we=u(T()),Te=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Ee={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},De=Ee.mouse,Oe=class extends Se.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ce(e);this.touchIdentifier=r;let i=_e(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=ve(this,a,o);Te(`DraggableCore: handleDragStart: %j`,s),Te(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&ue(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,De.move,this.handleDrag),M(n,De.stop,this.handleDragStop))},this.handleDrag=e=>{let t=_e(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=me(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=ve(this,n,r);if(Te(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=_e(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=me(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=ve(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&F(a.ownerDocument),Te(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Te(`DraggableCore: Removing handlers`),N(a.ownerDocument,De.move,this.handleDrag),N(a.ownerDocument,De.stop,this.handleDragStop))},this.onMouseDown=e=>(De=Ee.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(De=Ee.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(De=Ee.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(De=Ee.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Ee.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Ee.mouse.move,this.handleDrag),N(t,Ee.touch.move,this.handleDrag),N(t,Ee.mouse.stop,this.handleDragStop),N(t,Ee.touch.stop,this.handleDragStop),N(e,Ee.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&F(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=we.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Te(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return Se.cloneElement(Se.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Oe.displayName=`DraggableCore`,Oe.propTypes={allowAnyClick:Ce.default.bool,allowMobileScroll:Ce.default.bool,children:Ce.default.node.isRequired,disabled:Ce.default.bool,enableUserSelectHack:Ce.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:Ce.default.arrayOf(Ce.default.number),handle:Ce.default.string,cancel:Ce.default.string,nodeRef:Ce.default.object,nonce:Ce.default.string,onStart:Ce.default.func,onDrag:Ce.default.func,onStop:Ce.default.func,onMouseDown:Ce.default.func,scale:Ce.default.number,className:x,style:x,transform:x},Oe.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var ke=class extends p.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Te(`Draggable: onDragStart: %j`,t),this.props.onStart(e,ye(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Te(`Draggable: onDrag: %j`,t);let n=ye(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=pe(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,ye(this,t))===!1)return!1;Te(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Te(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=h.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,m=!s||this.state.dragging,h=s||r,_={x:he(this)&&m?this.state.x:h.x,y:ge(this)&&m?this.state.y:h.y};this.state.isElementSVG?f=ae(_,c):d=ie(_,c);let v=p.Children.only(n),y=(0,g.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return p.createElement(Oe,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},p.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};ke.displayName=`Draggable`,ke.propTypes={...Oe.propTypes,axis:m.default.oneOf([`both`,`x`,`y`,`none`]),bounds:m.default.oneOfType([m.default.shape({left:m.default.number,right:m.default.number,top:m.default.number,bottom:m.default.number}),m.default.string,m.default.oneOf([!1])]),defaultClassName:m.default.string,defaultClassNameDragging:m.default.string,defaultClassNameDragged:m.default.string,defaultPosition:m.default.shape({x:m.default.number,y:m.default.number}),positionOffset:m.default.shape({x:m.default.oneOfType([m.default.number,m.default.string]),y:m.default.oneOfType([m.default.number,m.default.string])}),position:m.default.shape({x:m.default.number,y:m.default.number}),className:x,style:x,transform:x},ke.defaultProps={...Oe.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(t.exports={DraggableCore:Oe})})),Ji=h(((e,t)=>{var n=qi(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),Yi=h((e=>{e.__esModule=!0,e.cloneElement=c;var t=n(C());function n(e){return e&&e.__esModule?e:{default:e}}function r(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 i(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(Qr());Ji();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Zi=h((e=>{e.__esModule=!0,e.default=void 0;var t=o(C()),n=Ji(),r=Yi(),i=Xi(),a=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function o(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(o=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;tMath.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,n){let r=this.props.handle;if(!r)return t.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:n});if(typeof r==`function`)return r(e,n);let i=typeof r.type==`string`,a=u({ref:n},i?{}:{handleAxis:e});return t.cloneElement(r,a)}render(){let e=this.props,i=e.children,o=e.className,l=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let d=e.resizeHandles;e.transformScale;let f=c(e,a);return(0,r.cloneElement)(i,u(u({},f),{},{className:(o?o+` `:``)+`react-resizable`,children:[...t.Children.toArray(i.props.children),...d.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,s({},l,{nodeRef:r,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,r))})]}))}};e.default=m,m.propTypes=i.resizableProps,m.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Qi=h((e=>{e.__esModule=!0,e.default=void 0;var t=s(C()),n=o(Qr()),r=o(Zi()),i=Xi(),a=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,n=e.handle,i=e.handleSize;e.onResize;let o=e.onResizeStart,s=e.onResizeStop,l=e.draggableOpts,d=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,h=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=m(e,a);return t.createElement(r.default,{axis:h,draggableOpts:l,handle:n,handleSize:i,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:d,onResizeStart:o,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},t.createElement(`div`,c({},y,{style:u(u({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=h,h.propTypes=u(u({},i.resizableProps),{},{children:n.default.element})})),$i=h(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Zi().default,t.exports.ResizableBox=Qi().default})),ea=h(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(e,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function O(e,t){return D(e,t,new WeakMap)}var k=c(r(S,{createIsNestedEqual:function(){return o}}));function A(e,t){return k(e,t,new WeakMap)}function j(e){return c(r(x,e(x)))}function M(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=O,e.circularShallowEqual=A,e.createCustomCircularEqual=M,e.createCustomEqual=j,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),ta=$i(),na=ea();function ra(e){let{children:t,cols:n,containerWidth:r,margin:i,containerPadding:a,rowHeight:o,maxRows:s,isDraggable:c,isResizable:l,isBounded:u,static:d,useCSSTransforms:f=!0,usePercentages:m=!1,transformScale:h=1,positionStrategy:g,dragThreshold:_=0,droppingPosition:v,className:y=``,style:b,handle:x=``,cancel:S=``,x:C,y:w,w:T,h:E,minW:D=1,maxW:O=1/0,minH:k=1,maxH:A=1/0,i:j,resizeHandles:M,resizeHandle:N,constraints:P=dr,layoutItem:ee,layout:te=[],onDragStart:ne,onDrag:re,onDragStop:ie,onResizeStart:ae,onResize:oe,onResizeStop:se}=e,[ce,le]=(0,L.useState)(!1),[ue,F]=(0,L.useState)(!1),I=(0,L.useRef)(null),de=(0,L.useRef)({left:0,top:0}),fe=(0,L.useRef)({top:0,left:0,width:0,height:0}),pe=(0,L.useRef)(void 0),me=(0,L.useRef)(te);me.current=te;let he=(0,L.useRef)(null),ge=(0,L.useRef)(null),_e=(0,L.useRef)(!1),ve=(0,L.useRef)({x:0,y:0}),ye=(0,L.useRef)(!1),be=(0,L.useMemo)(()=>({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),xe=(0,L.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),Se=(0,L.useCallback)(()=>({...xe,layout:me.current}),[xe]),Ce=(0,L.useMemo)(()=>ee??{i:j,x:C,y:w,w:T,h:E,minW:D,maxW:O,minH:k,maxH:A},[ee,j,C,w,T,E,D,O,k,A]),we=(0,L.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(f)return mr(e);let t=hr(e);return m?{...t,left:gr(e.left/r),width:gr(e.width/r)}:t},[g,f,m,r]),Te=(0,L.useCallback)((e,{node:t})=>{if(!ne)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(de.current=l,_>0){let t=e;ve.current={x:t.clientX,y:t.clientY},_e.current=!0,ye.current=!1,le(!0);return}le(!0);let u=Gn(be,l.top,l.left),{x:d,y:f}=fr(P,Ce,u.x,u.y,Se());ne(j,d,f,{e,node:t,newPosition:l})},[ne,h,be,g,_,P,Ce,Se,j]),Ee=(0,L.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!re||!ce)return;let s=e;if(_e.current&&!ye.current){let n=s.clientX-ve.current.x,r=s.clientY-ve.current.y;if(Math.hypot(n,r)<_)return;if(ye.current=!0,_e.current=!1,ne){let n=Gn(be,de.current.top,de.current.left),{x:r,y:i}=fr(P,Ce,n.x,n.y,Se());ne(j,r,i,{e,node:t,newPosition:de.current})}}let c=de.current.top+a,l=de.current.left+n;if(u){let{offsetParent:e}=t;if(e){let t=e.clientHeight-Hn(E,o,i[1]);c=qn(c,0,t);let n=Vn(be),a=r-Hn(T,n,i[0]);l=qn(l,0,a)}}let d={top:c,left:l};de.current=d;let f=Gn(be,c,l),{x:p,y:m}=fr(P,Ce,f.x,f.y,Se());re(j,p,m,{e,node:t,newPosition:d})},[re,ne,ce,_,u,E,o,i,be,r,T,j,P,Ce,Se]),De=(0,L.useCallback)((e,{node:t})=>{if(!ie||!ce)return;let n=_e.current;if(_e.current=!1,ye.current=!1,ve.current={x:0,y:0},n){le(!1),de.current={left:0,top:0};return}let{left:r,top:i}=de.current,a={top:i,left:r};le(!1),de.current={left:0,top:0};let o=Gn(be,i,r),{x:s,y:c}=fr(P,Ce,o.x,o.y,Se());ie(j,s,c,{e,node:t,newPosition:a})},[ie,ce,be,P,Ce,Se,j]);he.current=Te,ge.current=Ee;let Oe=(0,L.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ae:o===`onResize`?oe:se;if(!s)return;let c;c=t?Er(i,a,n,r):{...n,top:a.top,left:a.left},fe.current=c;let l=Kn(be,c.width,c.height),{w:u,h:d}=pr(P,Ce,l.w,l.h,i,Se());s(j,u,d,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[ae,oe,se,r,be,j,P,Ce,Se]),ke=(0,L.useCallback)((e,t)=>{F(!0);let n=Un(be,C,w,T,E),r={...t,handle:t.handle};Oe(e,r,n,`onResizeStart`)},[Oe,be,C,w,T,E]),Ae=(0,L.useCallback)((e,t)=>{let n=Un(be,C,w,T,E),r={...t,handle:t.handle};Oe(e,r,n,`onResize`)},[Oe,be,C,w,T,E]),je=(0,L.useCallback)((e,t)=>{F(!1),fe.current={top:0,left:0,width:0,height:0};let n=Un(be,C,w,T,E),r={...t,handle:t.handle};Oe(e,r,n,`onResizeStop`)},[Oe,be,C,w,T,E]);(0,L.useEffect)(()=>{if(!v)return;let e=I.current;if(!e)return;let t=pe.current||{left:0,top:0},n=ce&&(v.left!==t.left||v.top!==t.top);if(!ce){let t={node:e,deltaX:v.left,deltaY:v.top,lastX:0,lastY:0,x:v.left,y:v.top};he.current?.(v.e,t)}else if(n){let t={node:e,deltaX:v.left-de.current.left,deltaY:v.top-de.current.top,lastX:de.current.left,lastY:de.current.top,x:v.left,y:v.top};ge.current?.(v.e,t)}pe.current=v},[v,ce,j]);let Me=Un(be,C,w,T,E,ce?de.current:null,ue?fe.current:null),Ne=L.Children.only(t),Pe=Vn(be),Fe=[Hn(D,Pe,i[0]),Hn(k,o,i[1])],Ie=[Hn(O,Pe,i[0]),Hn(A,o,i[1])],Le=Ne.props,Re=Le.className,ze=Le.style,Be=L.cloneElement(Ne,{ref:I,className:p(`react-grid-item`,Re,y,{static:d,resizing:ue,"react-draggable":c,"react-draggable-dragging":ce,dropping:!!v,cssTransforms:f}),style:{...b,...ze,...we(Me)}}),Ve=N;return Be=(0,R.jsx)(ta.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Me.width,height:Me.height,minConstraints:Fe,maxConstraints:Ie,onResizeStart:ke,onResize:Ae,onResizeStop:je,transformScale:h,resizeHandles:M,handle:Ve,children:Be}),Be=(0,R.jsx)(Wi,{disabled:!c,onStart:Te,onDrag:Ee,onStop:De,handle:x,cancel:`.react-resizable-handle`+(S?`,`+S:``),scale:h,nodeRef:I,children:Be}),Be}var ia=()=>{},aa=`react-grid-layout`,oa=!1;try{oa=/firefox/i.test(navigator.userAgent)}catch{}function sa(e,t){let n=L.Children.toArray(e),r=L.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!L.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(rr(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:er(i),w:1,h:1})}});let o=sr(i,{cols:n});return r.compact(o,n)}function la(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=Ar,compactor:c,constraints:l=dr,layout:u=[],droppingItem:d,autoSize:f=!0,className:m=``,style:h={},innerRef:g,onLayoutChange:_=ia,onDragStart:v=ia,onDrag:y=ia,onDragStop:b=ia,onResizeStart:x=ia,onResize:S=ia,onResizeStop:C=ia,onDrop:w=ia,onDropDragOver:T=ia}=e,E=(0,L.useMemo)(()=>({...jr,...r}),[r]),D=(0,L.useMemo)(()=>({...Mr,...i}),[i]),O=(0,L.useMemo)(()=>({...Nr,...a}),[a]),k=(0,L.useMemo)(()=>({...Pr,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:ee,bounded:te,handle:ne,cancel:re,threshold:ie}=D,{enabled:ae,handles:oe,handleComponent:se}=O,{enabled:ce,defaultItem:le,onDragOver:ue}=k,F=c??Wr(`vertical`),I=F.type,de=F.allowOverlap,fe=F.preventCollision??!1,pe=(0,L.useMemo)(()=>d??{i:`__dropping-elem__`,...le},[d,le]),me=s.type===`transform`,he=s.scale,ge=P??N,[_e,ve]=(0,L.useState)(!1),[ye,be]=(0,L.useState)(()=>ca(u,t,A,F)),[xe,Se]=(0,L.useState)(null),[Ce,we]=(0,L.useState)(!1),[Te,Ee]=(0,L.useState)(null),[De,Oe]=(0,L.useState)(),ke=(0,L.useRef)(null),Ae=(0,L.useRef)(null),je=(0,L.useRef)(null),Me=(0,L.useRef)(0),Ne=(0,L.useRef)(ye),Pe=(0,L.useRef)(u),Fe=(0,L.useRef)(t),Ie=(0,L.useRef)(I),Le=(0,L.useRef)(ye);Le.current=ye,(0,L.useEffect)(()=>{ve(!0),(0,na.deepEqual)(ye,u)||_(ye)},[]),(0,L.useEffect)(()=>{if(xe||Te)return;let e=!(0,na.deepEqual)(u,Pe.current),n=!sa(t,Fe.current),r=I!==Ie.current;if(e||n||r){let n=ca(e?u:ye,t,A,F);(0,na.deepEqual)(n,ye)||be(n)}Pe.current=u,Fe.current=t,Ie.current=I},[u,t,A,I,F,xe,Te,ye]),(0,L.useEffect)(()=>{if(!xe&&!(0,na.deepEqual)(ye,Ne.current)){Ne.current=ye;let e=ye.filter(e=>e.i!==pe.i);_(e)}},[ye,xe,_,pe.i]);let Re=(0,L.useMemo)(()=>{if(!f)return;let e=er(ye),t=ge[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,ye,j,N,ge]),ze=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=tr(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};ke.current=rr(a),je.current=i,Se(o),v(i,a,a,null,r.e,r.node)},[v]),Be=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=ke.current,o=tr(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=cr(i,o,t,n,!0,fe,I,A,de);y(c,a,o,s,r.e,r.node),be(F.compact(c,A)),Se(s)},[fe,I,A,de,F,y]),Ve=(0,L.useCallback)((e,t,n,r)=>{if(!xe)return;let i=Le.current,a=ke.current,o=tr(i,e);if(!o)return;let s=cr(i,o,t,n,!0,fe,I,A,de),c=F.compact(s,A);b(c,a,o,null,r.e,r.node);let l=je.current;ke.current=null,je.current=null,Se(null),be(c),l&&!(0,na.deepEqual)(l,c)&&_(c)},[xe,fe,I,A,de,F,b,_]),He=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=tr(i,e);a&&(Ae.current=rr(a),je.current=i,we(!0),x(i,a,a,null,r.e,r.node))},[x]),Ue=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=Ae.current,{handle:o}=r,s=!1,c,l,[u,d]=or(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),fe&&!de&&Xn(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=cr(u,d,c,l,!0,fe,I,A,de));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};S(f,a,d,p,r.e,r.node),be(F.compact(f,A)),Se(p)},[fe,I,A,de,F,S]),We=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=Ae.current,o=tr(i,e),s=F.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=je.current;Ae.current=null,je.current=null,Se(null),we(!1),be(s),c&&!(0,na.deepEqual)(c,s)&&_(s)},[A,F,C,_]),Ge=(0,L.useCallback)(()=>{let e=Le.current;if(!e.some(e=>e.i===pe.i)){Ee(null),Se(null),Oe(void 0);return}let t=F.compact(e.filter(e=>e.i!==pe.i),A);be(t),Ee(null),Se(null),Oe(void 0)},[pe.i,A,F]),Ke=(0,L.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),oa&&!e.nativeEvent.target?.classList.contains(aa))return!1;let t=ue?ue(e.nativeEvent):T(e);if(t===!1)return Te&&Ge(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...pe,...a},s=e.currentTarget.getBoundingClientRect(),c={cols:A,margin:N,maxRows:M,rowHeight:j,containerWidth:n,containerPadding:ge},l=Vn(c),u=Hn(o.w,l,N[0]),d=Hn(o.h,j,N[1]),f=u/2,p=d/2,m=e.clientX-s.left+r-f,h=e.clientY-s.top+i-p,g=Math.max(0,m),_=Math.max(0,h),v={left:g/he,top:_/he,e:e.nativeEvent};if(Te)De&&(De.left!==v.left||De.top!==v.top)&&Oe(v);else{let e=Wn(c,_,g,o.w,o.h);Ee((0,R.jsx)(`div`,{},o.i)),Oe(v);let t=Le.current.filter(e=>e.i!==o.i);be([...t,{...o,x:e.x,y:e.y,static:!1,isDraggable:!0}])}},[Te,De,pe,ue,T,Ge,he,A,N,M,j,n,ge]),qe=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current--,Me.current<0&&(Me.current=0),Me.current===0&&Ge()},[Ge]),Je=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current++},[]),Ye=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=Le.current,n=t.find(e=>e.i===pe.i);Me.current=0,Ge(),w(t,n,e.nativeEvent)},[pe.i,Ge,w]),Xe=(0,L.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=tr(ye,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&ee,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ae,o=r.resizeHandles||[...oe],c=i&&te&&r.isBounded!==!1,u=se;return(0,R.jsx)(ra,{containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,cancel:re,handle:ne,onDragStart:ze,onDrag:Be,onDragStop:Ve,onResizeStart:He,onResize:Ue,onResizeStop:We,isDraggable:i,isResizable:a,isBounded:c,useCSSTransforms:me&&_e,usePercentages:!_e,transformScale:he,positionStrategy:s,dragThreshold:ie,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?De:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:ye,children:e},r.i)},[ye,n,A,N,ge,M,j,re,ne,ze,Be,Ve,He,Ue,We,ee,ae,te,me,_e,he,s,ie,De,oe,se,l]),Ze=()=>xe?(0,R.jsx)(ra,{w:xe.w,h:xe.h,x:xe.x,y:xe.y,i:xe.i,className:`react-grid-placeholder ${Ce?`placeholder-resizing`:``}`,containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:me,transformScale:he,constraints:l,layout:ye,children:(0,R.jsx)(`div`,{})}):null,Qe=p(aa,m),$e={height:Re,...h};return(0,R.jsxs)(`div`,{ref:g,className:Qe,style:$e,onDrop:ce?Ye:void 0,onDragLeave:ce?qe:void 0,onDragEnter:ce?Je:void 0,onDragOver:ce?Ke:void 0,children:[L.Children.map(t,e=>L.isValidElement(e)?Xe(e):null),ce&&Te&&Xe(Te,!0),Ze()]})}var ua={lg:1200,md:996,sm:768,xs:480,xxs:0},da={lg:12,md:10,sm:6,xs:4,xxs:2},fa=()=>{};function pa(e,t,n,r){let i=[];L.Children.forEach(t,t=>{if(!L.isValidElement(t)||t.key===null)return;let n=String(t.key),r=e.find(e=>e.i===n);if(r)i.push({...r,i:n});else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:er(i),w:1,h:1})}});let a=sr(i,{cols:n});return r.compact(a,n)}function ma(e){let{children:t,width:n,breakpoint:r,breakpoints:i=ua,cols:a=da,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=fa,onLayoutChange:p=fa,onWidthChange:m=fa,...h}=e,g=d??Wr(`vertical`),_=g.type,v=g.allowOverlap,y=(0,L.useMemo)(()=>r??Kr(i,n),[]),b=(0,L.useMemo)(()=>qr(y,a),[y,a]),x=(0,L.useMemo)(()=>Jr(o,i,y,y,b,_),[]),[S,C]=(0,L.useState)(y),[w,T]=(0,L.useState)(b),[E,D]=(0,L.useState)(x),[O,k]=(0,L.useState)(o),A=(0,L.useRef)(n),j=(0,L.useRef)(r),M=(0,L.useRef)(i),N=(0,L.useRef)(a),P=(0,L.useRef)(o),ee=(0,L.useRef)(_),te=(0,L.useRef)(O);(0,L.useEffect)(()=>{te.current=O},[O]);let ne=(0,L.useMemo)(()=>(0,na.deepEqual)(o,P.current)?null:Jr(o,i,S,S,w,g),[o,i,S,w,g]),re=ne??E;(0,L.useEffect)(()=>{ne!==null&&(D(ne),k(o),te.current=o,P.current=o)},[ne,o]),(0,L.useEffect)(()=>{if(_!==ee.current){let e=g.compact(ir(re),w),t={...te.current,[S]:e};D(e),k(t),te.current=t,p(e,t),ee.current=_}},[_,g,re,w,v,S,p]),(0,L.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,na.deepEqual)(i,M.current),c=!(0,na.deepEqual)(a,N.current);if(e||o||s||c){let e=r??Kr(i,n),o=qr(e,a),d=S;if(d!==e||s||c){let n={...te.current};n[d]||(n[d]=ir(E));let r=Jr(n,i,e,d,o,g);r=pa(r,t,o,g),n[e]=r,C(e),T(o),D(r),k(n),te.current=n,f(e,o),p(r,n)}let h=Yr(l,e),_=u?Yr(u,e):null;m(n,h,o,_),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let ie=(0,L.useCallback)(e=>{let t={...te.current,[S]:e};D(e),k(t),te.current=t,p(e,t)},[S,p]),ae=(0,L.useMemo)(()=>Yr(l,S),[l,S]),oe=(0,L.useMemo)(()=>u===null?null:Yr(u,S),[u,S]),se=(0,L.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:ae,containerPadding:oe}),[w,s,c,ae,oe]);return(0,R.jsx)(la,{...h,width:n,gridConfig:se,compactor:g,onLayoutChange:ie,layout:re,children:t})}function ha(e){let{children:t,width:n,breakpoint:r,breakpoints:i,cols:a,layouts:o,onBreakpointChange:s,onLayoutChange:c,onWidthChange:l,rowHeight:u,maxRows:d,margin:f,containerPadding:p,droppingItem:m,compactType:h,preventCollision:g=!1,allowOverlap:_=!1,verticalCompact:v,isDraggable:y=!0,isBounded:b=!1,draggableHandle:x,draggableCancel:S,isResizable:C=!0,resizeHandles:w=[`se`],resizeHandle:T,isDroppable:E=!1,useCSSTransforms:D=!0,transformScale:O=1,autoSize:k,className:A,style:j,innerRef:M,onDragStart:N,onDrag:P,onDragStop:ee,onResizeStart:te,onResize:ne,onResizeStop:re,onDrop:ie,onDropDragOver:ae}=e,oe=h===void 0?`vertical`:h;v===!1&&(oe=null);let se={enabled:y,bounded:b,handle:x,cancel:S},ce={enabled:C,handles:w,handleComponent:T},le={enabled:E},ue;ue=D?O===1?Dr:kr(O):Or;let F=Wr(oe,_,g);return(0,R.jsx)(ma,{width:n,breakpoint:r,breakpoints:i,cols:a,layouts:o,rowHeight:u,maxRows:d,margin:f,containerPadding:p,compactor:F,dragConfig:se,resizeConfig:ce,dropConfig:le,positionStrategy:ue,droppingItem:m,autoSize:k,className:A,style:j,innerRef:M,onBreakpointChange:s,onLayoutChange:c,onWidthChange:l,onDragStart:N,onDrag:P,onDragStop:ee,onResizeStart:te,onResize:ne,onResizeStop:re,onDrop:ie,onDropDragOver:ae,children:t})}ha.displayName=`ResponsiveReactGridLayout`;var ga=ha,_a=`react-grid-layout`;function va(e){function t(t){let{measureBeforeMount:n=!1,className:r,style:i,...a}=t,[o,s]=(0,L.useState)(1280),[c,l]=(0,L.useState)(!1),u=(0,L.useRef)(null),d=(0,L.useRef)(null);return(0,L.useEffect)(()=>{l(!0)},[]),(0,L.useEffect)(()=>{let e=u.current;if(!(e instanceof HTMLElement))return;let t=null,n=new ResizeObserver(e=>{if(e[0]){let n=Math.round(e[0].contentRect.width);t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{s(e=>e===n?e:n),t=null})}});return n.observe(e),d.current=n,()=>{t!==null&&cancelAnimationFrame(t),n.unobserve(e),n.disconnect()}},[c]),n&&!c?(0,R.jsx)(`div`,{className:p(r,_a),style:i,ref:u}):(0,R.jsx)(e,{innerRef:u,className:r,style:i,...a,width:o})}return t.displayName=`WidthProvider(${e.displayName||e.name||`Component`})`,t}function ya(e){return e.reduce((e,t)=>Math.max(e,t.y+t.h),0)}function ba(e,t){return e.map(e=>({...e,x:0,w:t,minW:Math.min(e.minW??1,t)}))}var xa=[`overview`,`topology`,`activity`,`assistant`,`performance`,`trace`,`logs`],Sa={overview:{w:4,h:3,minW:3,minH:3},activity:{w:4,h:5,minW:3,minH:4},assistant:{w:4,h:3,minW:3,minH:3},topology:{w:8,h:5,minW:4,minH:4},performance:{w:8,h:5,minW:4,minH:4},logs:{w:8,h:5,minW:4,minH:4},trace:{w:8,h:4,minW:4,minH:4}};function Ca(e,t){return e.xe.y)),o=(t,r)=>!e.some(e=>Ca(e,{x:t,y:a,w:r,h:n}));for(let e=0;e+t<=r;e+=1)if(o(e,t))return{x:e,y:a,w:t};let s=e.reduce((e,t)=>Ca(t,{x:0,y:a,w:r,h:n})?Math.max(e,t.x+t.w):e,0),c={x:s,w:0};for(let e=Math.min(s,r);ec.w&&(c={x:e,w:t-e}),e=t}return c.w>=i?{x:c.x,y:a,w:c.w}:{x:0,y:ya(e),w:t}}var Ta=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Ea(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function Da(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${Da(-e)}`;if(e===0)return`0ms`;if(e<.01)return`<0.01ms`;if(e<1)return`${e.toFixed(2)}ms`;if(Math.round(e*10)/10<100)return`${e.toFixed(1)}ms`;if(Math.round(e)<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100)/10;if(t<10)return`${(e/1e3).toFixed(2)}s`;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(e/1e3),r=Math.floor(n/60),i=n%60;if(r<60)return i===0?`${r}m`:`${r}m ${i}s`;let a=Math.floor(r/60),o=r%60;return o===0?`${a}h`:`${a}h ${o}m`}function Oa(e,t,n=!1){let r=new Date(e);if(Number.isNaN(r.valueOf()))return e;let[i,a]=t.split(`/`),o=new Date(i),s=new Date(a),c=!Number.isNaN(o.valueOf())&&!Number.isNaN(s.valueOf())&&s.valueOf()-o.valueOf()>864e5;return r.toLocaleString([],{...c?{month:`short`,day:`numeric`}:{},hour:`numeric`,minute:`2-digit`,...n?{second:`2-digit`}:{}})}function ka(e){if(e>=2e3)return`bad`;if(e>=750)return`warn`}function Aa(e){return e>=.05?`bad`:e>=.01?`warn`:`dimmed`}var ja=function(e,t){return ja=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ja(e,t)};function z(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);ja(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Ma=`12px sans-serif`,Na=20,Pa=100,Fa=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function Ia(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;c=Za&&(Xa=0),Xa++}function $a(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function B(e){if(typeof e!=`object`||!e)return e;var t=e,n=Va.call(e);if(n===`[object Array]`){if(!ko(e)){t=[];for(var r=0,i=e.length;r`u`&&typeof self<`u`?Bo.worker=!0:!Bo.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(Bo.node=!0,Bo.svgSupported=!0):Vo(navigator.userAgent,Bo);function Vo(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var Ho=`.`,Uo=`___EC__COMPONENT__CONTAINER___`,Wo=`___EC__EXTENDED_CLASS___`;function Go(e){var t={main:``,sub:``};if(e){var n=e.split(Ho);t.main=n[0]||``,t.sub=n[1]||``}return t}function Ko(e){To(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function qo(e){return!!(e&&e[Wo])}function Jo(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return Yo(t)?n=function(e){z(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},io(n,this)),V(n.prototype,e),n[Wo]=!0,n.extend=this.extend,n.superCall=$o,n.superApply=es,n.superClass=t,n}}function Yo(e){return K(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function Xo(e,t){e.extend=t.extend}var Zo=Math.round(Math.random()*10);function Qo(e){var t=[`__\0is_clz`,Zo++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function $o(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function es(e,t,n){return this.superClass.prototype[t].apply(e,n)}function ts(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){Ko(r),e.prototype.type=r;var i=Go(r);if(!i.sub)t[i.main]=e;else if(i.sub!==Uo){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[Uo]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=Go(e),r=[],i=t[n.main];return i&&i[Uo]?H(i,function(e,t){t!==Uo&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[Go(e).main]},e.getAllClassMainTypes=function(){var e=[];return H(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[Go(e).main];return n&&n[Uo]};function n(e){var n=t[e.main];return(!n||!n[Uo])&&(n=t[e.main]={},n[Uo]=!0),n}}function ns(e,t){for(var n=0;n=0||i&&ro(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var rs=ns([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),is=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return rs(this,e,t)},e}(),as=function(){function e(e){this.value=e}return e}(),os=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new as(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),ss=function(){function e(e){this._list=new os,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new as(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),cs=new ss(50);function ls(e){if(typeof e==`string`){var t=cs.get(e);return t&&t.image}return e}function us(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=cs.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!fs(t)&&a.pending.push(o)):(t=Ra.loadImage(e,ds,ds),t.__zrImageSrc=e,cs.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}function ds(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;tu||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){tc(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&tc(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Gs.x=qs.x=t.x,Gs.y=Js.y=t.y,Ks.x=Js.x=t.x+t.width,Ks.y=qs.y=t.y+t.height,Gs.transform(n),Js.transform(n),Ks.transform(n),qs.transform(n),e.x=Bs(Gs.x,Ks.x,qs.x,Js.x),e.y=Bs(Gs.y,Ks.y,qs.y,Js.y);var s=Vs(Gs.x,Ks.x,qs.x,Js.x),c=Vs(Gs.y,Ks.y,qs.y,Js.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=ms(e||[]),_s(e,e,ws(sc,-t.x,-t.y)),ys(e,e,ws(sc,r,i)),_s(e,e,ws(sc,n.x,n.y)),e},e}(),$s=Z.create,ec=Z.set,tc=Z.copy,nc=Z.calculateTransform,rc=Z.applyTransform,ic=Z.contain,ac=new Z(0,0,0,0),oc=new Z(0,0,0,0),sc=[];function cc(e,t,n,r,i,a,o,s){var c=Hs(t-n),l=Hs(r-e),u=Bs(c,l),d=Us[i],f=Us[1-i],p=Ws[i];t=l||!Ys.bidirectional)&&(Xs[d]=-l,Xs[f]=0,Ys.useDir&&Ys.calcDirMTV())))}function lc(){var e=0,t=new zs,n=new zs,r={minTv:new zs,maxTv:new zs,useDir:!1,dirMinTv:new zs,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Vs(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=mc)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=Ra.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?pc=mc:i>2&&pc++,t}}var pc=0,mc=5;function hc(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=fc(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function gc(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=Ra.measureText(t,e.font).width,n.put(t,r)),r}function _c(e,t,n,r){var i=gc(uc(t),e),a=xc(t);return new Z(yc(0,i,n),bc(0,a,r),i,a)}function vc(e,t,n,r){var i=((e||``)+``).split(` -`);if(i.length===1)return _c(i[0],t,n,r);for(var a=new Z(0,0,0,0),o=0;o=0?parseFloat(e)/100*t:parseFloat(e):e}function Cc(e,t,n){var r=t.position||`inside`,i=t.distance==null?5:t.distance,a=n.height,o=n.width,s=a/2,c=n.x,l=n.y,u=`left`,d=`top`;if(r instanceof Array)c+=Sc(r[0],n.width),l+=Sc(r[1],n.height),u=null,d=null;else switch(r){case`left`:c-=i,l+=s,u=`right`,d=`middle`;break;case`right`:c+=i+o,l+=s,d=`middle`;break;case`top`:c+=o/2,l-=i,u=`center`,d=`bottom`;break;case`bottom`:c+=o/2,l+=a+i,u=`center`;break;case`inside`:c+=o/2,l+=s,u=`center`,d=`middle`;break;case`insideLeft`:c+=i,l+=s,d=`middle`;break;case`insideRight`:c+=o-i,l+=s,u=`right`,d=`middle`;break;case`insideTop`:c+=o/2,l+=i,u=`center`;break;case`insideBottom`:c+=o/2,l+=a-i,u=`center`,d=`bottom`;break;case`insideTopLeft`:c+=i,l+=i;break;case`insideTopRight`:c+=o-i,l+=i,u=`right`;break;case`insideBottomLeft`:c+=i,l+=a-i,d=`bottom`;break;case`insideBottomRight`:c+=o-i,l+=a-i,u=`right`,d=`bottom`}return e||={},e.x=c,e.y=l,e.align=u,e.verticalAlign=d,e}var wc=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function Tc(e,t,n,r,i,a){if(!n){e.text=``,e.isTruncated=!1;return}var o=(t+``).split(` -`);a=Ec(n,r,i,a);for(var s=!1,c={},l=0,u=o.length;l=s;l++)c-=s;var u=gc(o,n);return u>c&&(n=``,u=0),c=e-u,i.ellipsis=n,i.ellipsisWidth=u,i.contentWidth=c,i.containerWidth=e,i}function Dc(e,t,n){var r=n.containerWidth,i=n.contentWidth,a=n.fontMeasureInfo;if(!r){e.textLine=``,e.isTruncated=!1;return}var o=gc(a,t);if(o<=r){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=n.maxIterations){t+=n.ellipsis;break}var c=s===0?Oc(t,i,a):o>0?Math.floor(t.length*i/o):0;t=t.substr(0,c),o=gc(a,t)}t===``&&(t=n.placeholder),e.textLine=t,e.isTruncated=!0}function Oc(e,t,n){for(var r=0,i=0,a=e.length;ig&&p){var y=Math.floor(g/f);m||=_.length>y,_=_.slice(0,y),v=_.length*f}if(i&&u&&h!=null)for(var b=Ec(h,l,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),x={},S=0;S<_.length;S++)Dc(x,_[S],b),_[S]=x.textLine,m||=x.isTruncated;for(var C=g,w=0,T=uc(l),S=0;S<_.length;S++)w=Math.max(gc(T,_[S]),w);h??=w;var E=h;return C+=c,E+=s,{lines:_,height:g,outerWidth:E,outerHeight:C,lineHeight:f,calculatedLineHeight:d,contentWidth:w,contentHeight:v,width:h,isTruncated:m}}var Ac=function(){function e(){}return e}(),jc=function(){function e(e){this.tokens=[],e&&(this.tokens=e)}return e}(),Mc=function(){function e(){this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.outerWidth=0,this.outerHeight=0,this.lines=[],this.isTruncated=!1}return e}();function Nc(e,t,n,r,i){var a=new Mc,o=Hc(e);if(!o)return a;var s=t.padding,c=s?s[1]+s[3]:0,l=s?s[0]+s[2]:0,u=t.width;u==null&&n!=null&&(u=n-c);var d=t.height;d==null&&r!=null&&(d=r-l);for(var f=t.overflow,p=(f===`break`||f===`breakAll`)&&u!=null?{width:u,accumWidth:0,breakAll:f===`breakAll`}:null,m=wc.lastIndex=0,h;(h=wc.exec(o))!=null;){var g=h.index;g>m&&Pc(a,o.substring(m,g),t,p),Pc(a,h[2],t,p,h[1]),m=wc.lastIndex}md){var ee=a.lines.length;O>0?(T.tokens=T.tokens.slice(0,O),C(T,D,E),a.lines=a.lines.slice(0,w+1)):a.lines=a.lines.slice(0,w),a.isTruncated=a.isTruncated||a.lines.length0&&m+r.accumWidth>r.width&&(u=t.split(` -`),l=!0),r.accumWidth=m}else{var h=Rc(t,c,r.width,r.breakAll,r.accumWidth);r.accumWidth=h.accumWidth+p,d=h.linesWidths,u=h.lines}}u||=t.split(` -`);for(var g=uc(c),_=0;_=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}var Ic=so(`,&?/;] `.split(``),function(e,t){return e[t]=!0,e},{});function Lc(e){return!Fc(e)||!!Ic[e]}function Rc(e,t,n,r,i){for(var a=[],o=[],s=``,c=``,l=0,u=0,d=uc(t),f=0;fn:i+u+m>n){u?(s||c)&&(h?(s||(s=c,c=``,l=0,u=l),a.push(s),o.push(u-l),c+=p,l+=m,s=``,u=l):(c&&(s+=c,c=``,l=0),a.push(s),o.push(u),s=p,u=m)):h?(a.push(c),o.push(l),c=p,l=m):(a.push(p),o.push(m));continue}u+=m,h?(c+=p,l+=m):(c&&(s+=c,c=``,l=0),s+=p)}return c&&(s+=c),s&&(a.push(s),o.push(u)),a.length===1&&(u+=i),{accumWidth:u,lines:a,linesWidths:o}}function zc(e,t,n,r,i,a){if(e.baseX=n,e.baseY=r,e.outerWidth=e.outerHeight=null,t){var o=t.width*2,s=t.height*2;Z.set(Bc,yc(n,o,i),bc(r,s,a),o,s),Z.intersect(t,Bc,null,Vc);var c=Vc.outIntersectRect;e.outerWidth=c.width,e.outerHeight=c.height,e.baseX=yc(c.x,c.width,i,!0),e.baseY=bc(c.y,c.height,a,!0)}}var Bc=new Z(0,0,0,0),Vc={outIntersectRect:{},clamp:!0};function Hc(e){return e==null?e=``:e+=``}function Uc(e){var t=Hc(e.text),n=e.font;return Wc(e,gc(uc(n),t),xc(n),null)}function Wc(e,t,n,r){var i=new Z(yc(e.x||0,t,e.textAlign),bc(e.y||0,n,e.textBaseline),t,n),a=r??(Gc(e)?e.lineWidth:0);return a>0&&(i.x-=a/2,i.y-=a/2,i.width+=a,i.height+=a),i}function Gc(e){var t=e.stroke;return t!=null&&t!==`none`&&e.lineWidth>0}var Kc=ms,qc=5e-5;function Jc(e){return e>qc||e<-qc}var Yc=[],Xc=[],Zc=ps(),Qc=Math.abs,$c=function(){function e(){}return e.prototype.getLocalTransform=function(e){return el(this,e)},e.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},e.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},e.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},e.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},e.prototype.needLocalTransform=function(){return Jc(this.rotation)||Jc(this.x)||Jc(this.y)||Jc(this.scaleX-1)||Jc(this.scaleY-1)||Jc(this.skewX)||Jc(this.skewY)},e.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),n=this.transform;if(!(t||e)){n&&(Kc(n),this.invTransform=null);return}n||=ps(),t?this.getLocalTransform(n):Kc(n),e&&(t?gs(n,e,n):hs(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||ps(),bs(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(Yc);var n=Yc[0]<0?-1:1,r=Yc[1]<0?-1:1,i=((Yc[0]-n)*t+n)/Yc[0]||0,a=((Yc[1]-r)*t+r)/Yc[1]||0;e[0]*=i,e[1]*=i,e[2]*=a,e[3]*=a}},e.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},e.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],r=Math.atan2(e[1],e[0]),i=Math.PI/2+r-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(i),t=Math.sqrt(t),this.skewX=i,this.skewY=0,this.rotation=-r,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||ps(),gs(Xc,e.invTransform,t),t=Xc);var n=this.originX,r=this.originY;(n||r)&&(Zc[4]=n,Zc[5]=r,gs(Xc,t,Zc),Xc[4]-=n,Xc[5]-=r,t=Xc),this.setLocalTransform(t)}},e.prototype.getGlobalScale=function(e){var t=this.transform;return e||=[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},e.prototype.transformCoordToLocal=function(e,t){var n=[e,t],r=this.invTransform;return r&&Is(n,n,r),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],r=this.transform;return r&&Is(n,n,r),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&Qc(e[0]-1)>1e-10&&Qc(e[3]-1)>1e-10?Math.sqrt(Qc(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){rl(this,e)},e.getLocalTransform=function(e,t){t||=[];var n=e.originX||0,r=e.originY||0,i=e.scaleX,a=e.scaleY,o=e.anchorX,s=e.anchorY,c=e.rotation||0,l=e.x,u=e.y,d=e.skewX?Math.tan(e.skewX):0,f=e.skewY?Math.tan(-e.skewY):0;if(n||r||o||s){var p=n+o,m=r+s;t[4]=-p*i-d*m*a,t[5]=-m*a-f*p*i}else t[4]=t[5]=0;return t[0]=i,t[3]=a,t[1]=f*i,t[2]=d*a,c&&vs(t,t,c),t[4]+=n+l,t[5]+=r+u,t},e.initDefaultProps=(function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0})(),e}(),el=$c.getLocalTransform;function tl(){return new $c}var nl=[`x`,`y`,`originX`,`originY`,`anchorX`,`anchorY`,`rotation`,`scaleX`,`scaleY`,`skewX`,`skewY`];function rl(e,t){return to(e,t,nl)}var il={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:1024**(e-1)},exponentialOut:function(e){return e===1?1:1-2**(-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*1024**(e-1):.5*(-(2**(-10*(e-1)))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),-(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)))},elasticOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),n*2**(-10*e)*Math.sin((e-t)*(2*Math.PI)/r)+1)},elasticInOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?-.5*(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)):n*2**(-10*--e)*Math.sin((e-t)*(2*Math.PI)/r)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-il.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?il.bounceIn(e*2)*.5:il.bounceOut(e*2-1)*.5+.5}},al=Math.pow,ol=Math.sqrt,sl=1e-8,cl=1e-4,ll=ol(3),ul=1/3,dl=xs(),fl=xs(),pl=xs();function ml(e){return e>-sl&&esl||e<-sl}function gl(e,t,n,r,i){var a=1-i;return a*a*(a*e+3*i*t)+i*i*(i*r+3*a*n)}function _l(e,t,n,r,i){var a=1-i;return 3*(((t-e)*a+2*(n-t)*i)*a+(r-n)*i*i)}function vl(e,t,n,r,i,a){var o=r+3*(t-n)-e,s=3*(n-t*2+e),c=3*(t-e),l=e-i,u=s*s-3*o*c,d=s*c-9*o*l,f=c*c-3*s*l,p=0;if(ml(u)&&ml(d)){if(ml(s))a[0]=0;else{var m=-c/s;m>=0&&m<=1&&(a[p++]=m)}}else{var h=d*d-4*u*f;if(ml(h)){var g=d/u,m=-s/o+g,_=-g/2;m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_)}else if(h>0){var v=ol(h),y=u*s+1.5*o*(-d+v),b=u*s+1.5*o*(-d-v);y=y<0?-al(-y,ul):al(y,ul),b=b<0?-al(-b,ul):al(b,ul);var m=(-s-(y+b))/(3*o);m>=0&&m<=1&&(a[p++]=m)}else{var x=(2*u*s-3*o*d)/(2*ol(u*u*u)),S=Math.acos(x)/3,C=ol(u),w=Math.cos(S),m=(-s-2*C*w)/(3*o),_=(-s+C*(w+ll*Math.sin(S)))/(3*o),T=(-s+C*(w-ll*Math.sin(S)))/(3*o);m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_),T>=0&&T<=1&&(a[p++]=T)}}return p}function yl(e,t,n,r,i){var a=6*n-12*t+6*e,o=9*t+3*r-3*e-9*n,s=3*t-3*e,c=0;if(ml(o)){if(hl(a)){var l=-s/a;l>=0&&l<=1&&(i[c++]=l)}}else{var u=a*a-4*o*s;if(ml(u))i[0]=-a/(2*o);else if(u>0){var d=ol(u),l=(-a+d)/(2*o),f=(-a-d)/(2*o);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function bl(e,t,n,r,i,a){var o=(t-e)*i+e,s=(n-t)*i+t,c=(r-n)*i+n,l=(s-o)*i+o,u=(c-s)*i+s,d=(u-l)*i+l;a[0]=e,a[1]=o,a[2]=l,a[3]=d,a[4]=d,a[5]=u,a[6]=c,a[7]=r}function xl(e,t,n,r,i,a,o,s,c,l,u){var d,f=.005,p=1/0,m,h,g,_;dl[0]=c,dl[1]=l;for(var v=0;v<1;v+=.05)fl[0]=gl(e,n,i,o,v),fl[1]=gl(t,r,a,s,v),g=Fs(dl,fl),g=0&&g=0&&l<=1&&(i[c++]=l)}}else{var u=o*o-4*a*s;if(ml(u)){var l=-o/(2*a);l>=0&&l<=1&&(i[c++]=l)}else if(u>0){var d=ol(u),l=(-o+d)/(2*a),f=(-o-d)/(2*a);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function El(e,t,n){var r=e+n-2*t;return r===0?.5:(e-t)/r}function Dl(e,t,n,r,i){var a=(t-e)*r+e,o=(n-t)*r+t,s=(o-a)*r+a;i[0]=e,i[1]=a,i[2]=s,i[3]=s,i[4]=o,i[5]=n}function Ol(e,t,n,r,i,a,o,s,c){var l,u=.005,d=1/0;dl[0]=o,dl[1]=s;for(var f=0;f<1;f+=.05){fl[0]=Cl(e,n,i,f),fl[1]=Cl(t,r,a,f);var p=Fs(dl,fl);p=0&&p=1?1:vl(0,r,a,1,e,s)&&gl(0,i,o,1,s[0])}}}var Ml=function(){function e(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Lo,this.ondestroy=e.ondestroy||Lo,this.onrestart=e.onrestart||Lo,e.easing&&this.setEasing(e.easing)}return e.prototype.step=function(e,t){if(this._inited||=(this._startTime=e+this._delay,!0),this._paused){this._pausedTime+=t;return}var n=this._life,r=e-this._startTime-this._pausedTime,i=r/n;i<0&&(i=0),i=Math.min(i,1);var a=this.easingFunc,o=a?a(i):i;if(this.onframe(o),i===1){if(this.loop){var s=r%n;this._startTime=e-s,this._pausedTime=0,this.onrestart()}else return!0}return!1},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(e){this.easing=e,this.easingFunc=K(e)?e:il[e]||jl(e)},e}(),Nl={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Pl(e){return e=Math.round(e),e<0?0:e>255?255:e}function Fl(e){return e=Math.round(e),e<0?0:e>360?360:e}function Il(e){return e<0?0:e>1?1:e}function Ll(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?Pl(parseFloat(t)/100*255):Pl(parseInt(t,10))}function Rl(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?Il(parseFloat(t)/100):Il(parseFloat(t))}function zl(e,t,n){return n<0?n+=1:n>1&&--n,n*6<1?e+(t-e)*n*6:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function Bl(e,t,n){return e+(t-e)*n}function Vl(e,t,n,r,i){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}function Hl(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var Ul=new ss(20),Wl=null;function Gl(e,t){Wl&&Hl(Wl,t),Wl=Ul.put(e,Wl||t.slice())}function Kl(e,t){if(e){t||=[];var n=Ul.get(e);if(n)return Hl(t,n);e+=``;var r=e.replace(/ /g,``).toLowerCase();if(r in Nl)return Hl(t,Nl[r]),Gl(e,t),t;var i=r.length;if(r.charAt(0)===`#`){if(i===4||i===5){var a=parseInt(r.slice(1,4),16);if(!(a>=0&&a<=4095)){Vl(t,0,0,0,1);return}return Vl(t,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,i===5?parseInt(r.slice(4),16)/15:1),Gl(e,t),t}if(i===7||i===9){var a=parseInt(r.slice(1,7),16);if(!(a>=0&&a<=16777215)){Vl(t,0,0,0,1);return}return Vl(t,(a&16711680)>>16,(a&65280)>>8,a&255,i===9?parseInt(r.slice(7),16)/255:1),Gl(e,t),t}return}var o=r.indexOf(`(`),s=r.indexOf(`)`);if(o!==-1&&s+1===i){var c=r.substr(0,o),l=r.substr(o+1,s-(o+1)).split(`,`),u=1;switch(c){case`rgba`:if(l.length!==4)return l.length===3?Vl(t,+l[0],+l[1],+l[2],1):Vl(t,0,0,0,1);u=Rl(l.pop());case`rgb`:if(l.length>=3)return Vl(t,Ll(l[0]),Ll(l[1]),Ll(l[2]),l.length===3?u:Rl(l[3])),Gl(e,t),t;Vl(t,0,0,0,1);return;case`hsla`:if(l.length!==4){Vl(t,0,0,0,1);return}return l[3]=Rl(l[3]),ql(l,t),Gl(e,t),t;case`hsl`:if(l.length!==3){Vl(t,0,0,0,1);return}return ql(l,t),Gl(e,t),t;default:return}}Vl(t,0,0,0,1)}}function ql(e,t){var n=(parseFloat(e[0])%360+360)%360/360,r=Rl(e[1]),i=Rl(e[2]),a=i<=.5?i*(r+1):i+r-i*r,o=i*2-a;return t||=[],Vl(t,Pl(zl(o,a,n+1/3)*255),Pl(zl(o,a,n)*255),Pl(zl(o,a,n-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function Jl(e){if(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=(a+i)/2,c,l;if(o===0)c=0,l=0;else{l=s<.5?o/(a+i):o/(2-a-i);var u=((a-t)/6+o/2)/o,d=((a-n)/6+o/2)/o,f=((a-r)/6+o/2)/o;t===a?c=f-d:n===a?c=1/3+u-f:r===a&&(c=2/3+d-u),c<0&&(c+=1),c>1&&--c}var p=[c*360,l,s];return e[3]!=null&&p.push(e[3]),p}}function Yl(e,t){var n=Kl(e);if(n){for(var r=0;r<3;r++)t<0?n[r]=n[r]*(1-t)|0:n[r]=(255-n[r])*t+n[r]|0,n[r]>255?n[r]=255:n[r]<0&&(n[r]=0);return eu(n,n.length===4?`rgba`:`rgb`)}}function Xl(e,t,n){if(t&&t.length&&e>=0&&e<=1){n||=[];var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=t[i],s=t[a],c=r-i;return n[0]=Pl(Bl(o[0],s[0],c)),n[1]=Pl(Bl(o[1],s[1],c)),n[2]=Pl(Bl(o[2],s[2],c)),n[3]=Il(Bl(o[3],s[3],c)),n}}function Zl(e,t,n){if(t&&t.length&&e>=0&&e<=1){var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=Kl(t[i]),s=Kl(t[a]),c=r-i,l=eu([Pl(Bl(o[0],s[0],c)),Pl(Bl(o[1],s[1],c)),Pl(Bl(o[2],s[2],c)),Il(Bl(o[3],s[3],c))],`rgba`);return n?{color:l,leftIndex:i,rightIndex:a,value:r}:l}}function Ql(e,t,n,r){var i=Kl(e);if(e)return i=Jl(i),t!=null&&(i[0]=Fl(K(t)?t(i[0]):t)),n!=null&&(i[1]=Rl(K(n)?n(i[1]):n)),r!=null&&(i[2]=Rl(K(r)?r(i[2]):r)),eu(ql(i),`rgba`)}function $l(e,t){var n=Kl(e);if(n&&t!=null)return n[3]=Il(t),eu(n,`rgba`)}function eu(e,t){if(e&&e.length){var n=e[0]+`,`+e[1]+`,`+e[2];return(t===`rgba`||t===`hsva`||t===`hsla`)&&(n+=`,`+e[3]),t+`(`+n+`)`}}function tu(e,t){var n=Kl(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var nu=new ss(100);function ru(e){if(q(e)){var t=nu.get(e);return t||(t=Yl(e,-.1),nu.put(e,t)),t}if(yo(e)){var n=V({},e);return n.colorStops=U(e.colorStops,function(e){return{offset:e.offset,color:Yl(e.color,-.1)}}),n}return e}var iu=Math.round;function au(e){var t;if(!e||e===`transparent`)e=`none`;else if(typeof e==`string`&&e.indexOf(`rgba`)>-1){var n=Kl(e);n&&(e=`rgb(`+n[0]+`,`+n[1]+`,`+n[2]+`)`,t=n[3])}return{color:e,opacity:t??1}}var ou=1e-4;function su(e){return e-ou}function cu(e){return iu(e*1e3)/1e3}function lu(e){return iu(e*1e4)/1e4}function uu(e){return`matrix(`+cu(e[0])+`,`+cu(e[1])+`,`+cu(e[2])+`,`+cu(e[3])+`,`+lu(e[4])+`,`+lu(e[5])+`)`}var du={left:`start`,right:`end`,center:`middle`,middle:`middle`};function fu(e,t,n){return n===`top`?e+=t/2:n===`bottom`&&(e-=t/2),e}function pu(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function mu(e){var t=e.style,n=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(`,`)}function hu(e){return e&&!!e.image}function gu(e){return e&&!!e.svgElement}function _u(e){return hu(e)||gu(e)}function vu(e){return e.type===`linear`}function yu(e){return e.type===`radial`}function bu(e){return e&&(e.type===`linear`||e.type===`radial`)}function xu(e){return`url(#`+e+`)`}function Su(e){var t=e.getGlobalScale(),n=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function Cu(e){var t=e.x||0,n=e.y||0,r=(e.rotation||0)*Ro,i=Y(e.scaleX,1),a=Y(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,c=[];return(t||n)&&c.push(`translate(`+t+`px,`+n+`px)`),r&&c.push(`rotate(`+r+`)`),(i!==1||a!==1)&&c.push(`scale(`+i+`,`+a+`)`),(o||s)&&c.push(`skew(`+iu(o*Ro)+`deg, `+iu(s*Ro)+`deg)`),c.join(` `)}var wu=(function(){return typeof Buffer<`u`&&typeof Buffer.from==`function`?function(e){return Buffer.from(e).toString(`base64`)}:typeof btoa==`function`&&typeof unescape==`function`&&typeof encodeURIComponent==`function`?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}})(),Tu=Array.prototype.slice;function Eu(e,t,n){return(t-e)*n+e}function Du(e,t,n,r){for(var i=t.length,a=0;ar?t:e,a=Math.min(n,r),o=i[a-1]||{color:[0,0,0,0],offset:0},s=a;so)r.length=o;else for(var s=a;s=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t,n){this._needsSort=!0;var r=this.keyframes,i=r.length,a=!1,o=Hu,s=t;if(oo(t)){var c=Fu(t);o=c,(c===1&&!ho(t[0])||c===2&&!ho(t[0][0]))&&(a=!0)}else if(ho(t)&&!bo(t))o=Iu;else if(q(t)){if(!isNaN(+t))o=Iu;else{var l=Kl(t);l&&(s=l,o=zu)}}else if(yo(t)){var u=V({},s);u.colorStops=U(t.colorStops,function(e){return{offset:e.offset,color:Kl(e.color)}}),vu(t)?o=Bu:yu(t)&&(o=Vu),s=u}i===0?this.valType=o:(o!==this.valType||o===Hu)&&(a=!0),this.discrete=this.discrete||a;var d={time:e,value:s,rawValue:t,percent:0};return n&&(d.easing=n,d.easingFunc=K(n)?n:il[n]||jl(n)),r.push(d),d},e.prototype.prepare=function(e,t){var n=this.keyframes;this._needsSort&&n.sort(function(e,t){return e.time-t.time});for(var r=this.valType,i=n.length,a=n[i-1],o=this.discrete,s=Wu(r),c=Uu(r),l=0;l=0&&!(a[l].percent<=t);l--);l=d(l,o-2)}else{for(l=u;lt);l++);l=d(l-1,o-2)}p=a[l+1],f=a[l]}if(f&&p){this._lastFr=l,this._lastFrP=t;var m=p.percent-f.percent,h=m===0?1:d((t-f.percent)/m,1);p.easingFunc&&(h=p.easingFunc(h));var g=n?this._additiveValue:c?Gu:e[s];if((Wu(i)||c)&&!g&&(g=this._additiveValue=[]),this.discrete)e[s]=h<1?f.rawValue:p.rawValue;else if(Wu(i))i===Lu?Du(g,f[r],p[r],h):Ou(g,f[r],p[r],h);else if(Uu(i)){var _=f[r],v=p[r],y=i===Bu;e[s]={type:y?`linear`:`radial`,x:Eu(_.x,v.x,h),y:Eu(_.y,v.y,h),colorStops:U(_.colorStops,function(e,t){var n=v.colorStops[t];return{offset:Eu(e.offset,n.offset,h),color:Pu(Du([],e.color,n.color,h))}}),global:v.global},y?(e[s].x2=Eu(_.x2,v.x2,h),e[s].y2=Eu(_.y2,v.y2,h)):e[s].r=Eu(_.r,v.r,h)}else if(c)Du(g,f[r],p[r],h),n||(e[s]=Pu(g));else{var b=Eu(f[r],p[r],h);n?this._additiveValue=b:e[s]=b}n&&this._addToTarget(e)}}},e.prototype._addToTarget=function(e){var t=this.valType,n=this.propName,r=this._additiveValue;t===Iu?e[n]=e[n]+r:t===zu?(Kl(e[n],Gu),ku(Gu,Gu,r,1),e[n]=Pu(Gu)):t===Lu?ku(e[n],e[n],r,1):t===Ru&&Au(e[n],e[n],r,1)},e}(),qu=function(){function e(e,t,n,r){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&r){$a(`Can' use additive animation on looped animation.`);return}this._additiveAnimators=r,this._allowDiscrete=n}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(e){this._target=e},e.prototype.when=function(e,t,n){return this.whenWithKeys(e,t,uo(t),n)},e.prototype.whenWithKeys=function(e,t,n,r){for(var i=this._tracks,a=0;a0&&s.addKeyframe(0,Nu(c),r),this._trackKeys.push(o)}s.addKeyframe(e,Nu(t[o]),r)}return this._maxTime=Math.max(this._maxTime,e),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,n=0;n0)){this._started=1;for(var t=this,n=[],r=this._maxTime||0,i=0;i1){var o=a.pop();i.addKeyframe(o.time,e[r]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}(),Ju=function(){function e(e){e&&(this._$eventProcessor=e)}return e.prototype.on=function(e,t,n,r){this._$handlers||={};var i=this._$handlers;if(typeof t==`function`&&(r=n,n=t,t=null),!n||!e)return this;var a=this._$eventProcessor;t!=null&&a&&a.normalizeQuery&&(t=a.normalizeQuery(t)),i[e]||(i[e]=[]);for(var o=0;o=0:n.inside,y=void 0,b=void 0,x=void 0;v&&this.canBeInsideText()?(y=n.insideFill,b=n.insideStroke,(y==null||y===`auto`)&&(y=this.getInsideTextFill()),(b==null||b===`auto`)&&(b=this.getInsideTextStroke(y),x=!0)):(y=n.outsideFill,b=n.outsideStroke,(y==null||y===`auto`)&&(y=this.getOutsideFill()),(b==null||b===`auto`)&&(b=this.getOutsideStroke(y),x=!0)),y||=`#000`,(y!==g.fill||b!==g.stroke||x!==g.autoStroke||a!==g.align||o!==g.verticalAlign)&&(s=!0,g.fill=y,g.stroke=b,g.autoStroke=x,g.align=a,g.verticalAlign=o,t.setDefaultTextStyle(g)),t.__dirty|=1,s&&t.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return`#fff`},e.prototype.getInsideTextStroke=function(e){return`#000`},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?$u:Qu},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n=typeof t==`string`&&Kl(t);n||=[255,255,255,1];for(var r=n[3],i=this.__zr.isDarkMode(),a=0;a<3;a++)n[a]=n[a]*r+(i?0:255)*(1-r);return n[3]=1,eu(n,`rgba`)},e.prototype.traverse=function(e,t){},e.prototype.attrKV=function(e,t){e===`textConfig`?this.setTextConfig(t):e===`textContent`?this.setTextContent(t):e===`clipPath`?this.setClipPath(t):e===`extra`?(this.extra=this.extra||{},V(this.extra,t)):this[e]=t},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(e,t){if(typeof e==`string`)this.attrKV(e,t);else if(J(e))for(var n=uo(e),r=0;r0},e.prototype.getState=function(e){return this.states[e]},e.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},e.prototype.clearStates=function(e){this.useState(td,!1,e)},e.prototype.useState=function(e,t,n,r){var i=e===td;if(this.hasState()||!i){var a=this.currentStates,o=this.stateTransition;if(!(ro(a,e)>=0&&(t||a.length===1))){var s;if(this.stateProxy&&!i&&(s=this.stateProxy(e)),s||=this.states&&this.states[e],!s&&!i){$a(`State `+e+` not exists.`);return}i||this.saveCurrentToNormalState(s);var c=this._textContent,l=hd(this,c,s,r);l&&!this.__inHover&&(this.__inHover=l),this._applyStateObj(e,s,this._normalState,t,_d(this,n,o),o);var u=this._textGuide;return c&&c.useState(e,t,n,!!l),u&&u.useState(e,t,n,!!l),i?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this.__inHover=0,this.__dirty&=-2),s}}},e.prototype.useStates=function(e,t,n){if(!e.length)this.clearStates();else{var r=[],i=this.currentStates,a=e.length,o=a===i.length;if(o){for(var s=0;s=0){var n=this.currentStates.slice();n.splice(t,1),this.useStates(n)}},e.prototype.replaceState=function(e,t,n){var r=this.currentStates.slice(),i=ro(r,e),a=ro(r,t)>=0;i>=0?a?r.splice(i,1):r[i]=t:n&&!a&&r.push(t),this.useStates(r)},e.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},e.prototype._mergeStates=function(e){for(var t={},n,r=0;r=0&&t.splice(n,1)}),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(e){this.markRedraw()},e.prototype.stopAnimation=function(e,t){for(var n=this.animators,r=n.length,i=[],a=0;a0&&n.during&&a[0].during(function(e,t){n.during(t)});for(var f=0;f0||i.force&&!o.length){var C=void 0,w=void 0,T=void 0;if(s){w={},f&&(C={});for(var b=0;b0}var vd=`__zr_style_`+Math.round(Math.random()*10),yd={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:`#000`,opacity:1,blend:`source-over`},bd={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};yd[vd]=!0;var xd=[`z`,`z2`,`invisible`],Sd=[`invisible`],Cd=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype._init=function(t){for(var n=uo(t),r=0;r1e-4){s[0]=e-n,s[1]=t-r,c[0]=e+n,c[1]=t+r;return}if(Md[0]=Ad(i)*n+e,Md[1]=kd(i)*r+t,Nd[0]=Ad(a)*n+e,Nd[1]=kd(a)*r+t,l(s,Md,Nd),u(c,Md,Nd),i%=jd,i<0&&(i+=jd),a%=jd,a<0&&(a+=jd),i>a&&!o?a+=jd:ii&&(Pd[0]=Ad(p)*n+e,Pd[1]=kd(p)*r+t,l(s,Pd,s),u(c,Pd,c))}var Hd={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Ud=[],Wd=[],Gd=[],Kd=[],qd=[],Jd=[],Yd=Math.min,Xd=Math.max,Zd=Math.cos,Qd=Math.sin,$d=Math.abs,ef=Math.PI,tf=ef*2,nf=typeof Float32Array<`u`,rf=[];function af(e){return Math.round(e/ef*1e8)/1e8%2*ef}function of(e,t){var n=af(e[0]);n<0&&(n+=tf);var r=n-e[0],i=e[1];i+=r,!t&&i-n>=tf?i=n+tf:t&&n-i>=tf?i=n-tf:!t&&n>i?i=n+(tf-af(n-i)):t&&n0&&(this._ux=$d(n/Xu/e)||0,this._uy=$d(n/Xu/t)||0)},e.prototype.setDPR=function(e){this.dpr=e},e.prototype.setContext=function(e){this._ctx=e},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(Hd.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},e.prototype.lineTo=function(e,t){var n=$d(e-this._xi),r=$d(t-this._yi),i=n>this._ux||r>this._uy;if(this.addData(Hd.L,e,t),this._ctx&&i&&this._ctx.lineTo(e,t),i)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var a=n*n+r*r;a>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=a)}return this},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){return this._drawPendingPt(),this.addData(Hd.C,e,t,n,r,i,a),this._ctx&&this._ctx.bezierCurveTo(e,t,n,r,i,a),this._xi=i,this._yi=a,this},e.prototype.quadraticCurveTo=function(e,t,n,r){return this._drawPendingPt(),this.addData(Hd.Q,e,t,n,r),this._ctx&&this._ctx.quadraticCurveTo(e,t,n,r),this._xi=n,this._yi=r,this},e.prototype.arc=function(e,t,n,r,i,a){this._drawPendingPt(),rf[0]=r,rf[1]=i,of(rf,a),r=rf[0],i=rf[1];var o=i-r;return this.addData(Hd.A,e,t,n,n,r,o,0,+!a),this._ctx&&this._ctx.arc(e,t,n,r,i,a),this._xi=Zd(i)*n+e,this._yi=Qd(i)*n+t,this},e.prototype.arcTo=function(e,t,n,r,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,n,r,i),this},e.prototype.rect=function(e,t,n,r){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,n,r),this.addData(Hd.R,e,t,n,r),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Hd.Z);var e=this._ctx,t=this._x0,n=this._y0;return e&&e.closePath(),this._xi=t,this._yi=n,this},e.prototype.fill=function(e){e&&e.fill(),this.toStatic()},e.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(e){if(this._saveData){var t=e.length;!(this.data&&this.data.length===t)&&nf&&(this.data=new Float32Array(t));for(var n=0;n0&&a))for(var o=0;ol.length&&(this._expandData(),l=this.data);for(var u=0;u0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t11&&(this.data=new Float32Array(e)))}},e.prototype.getBoundingRect=function(){Gd[0]=Gd[1]=qd[0]=qd[1]=Number.MAX_VALUE,Kd[0]=Kd[1]=Jd[0]=Jd[1]=-Number.MAX_VALUE;for(var e=this.data,t=0,n=0,r=0,i=0,a=0;an||$d(v)>r||d===t-1)&&(m=Math.sqrt(_*_+v*v),i=h,a=g);break;case Hd.C:var y=e[d++],b=e[d++],h=e[d++],g=e[d++],x=e[d++],S=e[d++];m=Sl(i,a,y,b,h,g,x,S,10),i=x,a=S;break;case Hd.Q:var y=e[d++],b=e[d++],h=e[d++],g=e[d++];m=kl(i,a,y,b,h,g,10),i=h,a=g;break;case Hd.A:var C=e[d++],w=e[d++],T=e[d++],E=e[d++],D=e[d++],O=e[d++],k=O+D;d+=1,p&&(o=Zd(D)*T+C,s=Qd(D)*E+w),m=Xd(T,E)*Yd(tf,Math.abs(O)),i=Zd(k)*T+C,a=Qd(k)*E+w;break;case Hd.R:o=i=e[d++],s=a=e[d++];var A=e[d++],j=e[d++];m=A*2+j*2;break;case Hd.Z:var _=o-i,v=s-a;m=Math.sqrt(_*_+v*v),i=o,a=s}m>=0&&(c[u++]=m,l+=m)}return this._pathLen=l,l},e.prototype.rebuildPath=function(e,t){var n=this.data,r=this._ux,i=this._uy,a=this._len,o,s,c,l,u,d,f=t<1,p,m,h=0,g=0,_,v=0,y,b;if(!(f&&(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,m=this._pathLen,_=t*m,!_)))lo:for(var x=0;x0&&(e.lineTo(y,b),v=0),S){case Hd.M:o=c=n[x++],s=l=n[x++],e.moveTo(c,l);break;case Hd.L:u=n[x++],d=n[x++];var w=$d(u-c),T=$d(d-l);if(w>r||T>i){if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;e.lineTo(c*(1-D)+u*D,l*(1-D)+d*D);break lo}h+=E}e.lineTo(u,d),c=u,l=d,v=0}else{var O=w*w+T*T;O>v&&(y=u,b=d,v=O)}break;case Hd.C:var k=n[x++],A=n[x++],j=n[x++],M=n[x++],N=n[x++],P=n[x++];if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;bl(c,k,j,N,D,Ud),bl(l,A,M,P,D,Wd),e.bezierCurveTo(Ud[1],Wd[1],Ud[2],Wd[2],Ud[3],Wd[3]);break lo}h+=E}e.bezierCurveTo(k,A,j,M,N,P),c=N,l=P;break;case Hd.Q:var k=n[x++],A=n[x++],j=n[x++],M=n[x++];if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;Dl(c,k,j,D,Ud),Dl(l,A,M,D,Wd),e.quadraticCurveTo(Ud[1],Wd[1],Ud[2],Wd[2]);break lo}h+=E}e.quadraticCurveTo(k,A,j,M),c=j,l=M;break;case Hd.A:var ee=n[x++],te=n[x++],ne=n[x++],re=n[x++],ie=n[x++],ae=n[x++],oe=n[x++],se=!n[x++],ce=ne>re?ne:re,le=$d(ne-re)>.001,ue=ie+ae,F=!1;if(f){var E=p[g++];h+E>_&&(ue=ie+ae*(_-h)/E,F=!0),h+=E}if(le&&e.ellipse?e.ellipse(ee,te,ne,re,oe,ie,ue,se):e.arc(ee,te,ce,ie,ue,se),F)break lo;C&&(o=Zd(ie)*ne+ee,s=Qd(ie)*re+te),c=Zd(ue)*ne+ee,l=Qd(ue)*re+te;break;case Hd.R:o=c=n[x],s=l=n[x+1],u=n[x++],d=n[x++];var I=n[x++],de=n[x++];if(f){var E=p[g++];if(h+E>_){var fe=_-h;e.moveTo(u,d),e.lineTo(u+Yd(fe,I),d),fe-=I,fe>0&&e.lineTo(u+I,d+Yd(fe,de)),fe-=de,fe>0&&e.lineTo(u+Xd(I-fe,0),d+de),fe-=I,fe>0&&e.lineTo(u,d+Xd(de-fe,0));break lo}h+=E}e.rect(u,d,I,de);break;case Hd.Z:if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;e.lineTo(c*(1-D)+o*D,l*(1-D)+s*D);break lo}h+=E}e.closePath(),c=o,l=s}}},e.prototype.clone=function(){var t=new e,n=this.data;return t.data=n.slice?n.slice():Array.prototype.slice.call(n),t._len=this._len,t},e.prototype.canSave=function(){return!!this._saveData},e.CMD=Hd,e.initDefaultProps=(function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0})(),e}();function cf(e,t,n,r,i,a,o){if(i===0)return!1;var s=i,c=0,l=e;if(o>t+s&&o>r+s||oe+s&&a>n+s||at+d&&u>r+d&&u>a+d&&u>s+d||ue+d&&l>n+d&&l>i+d&&l>o+d||lt+l&&c>r+l&&c>a+l||ce+l&&s>n+l&&s>i+l||sn||u+li&&(i+=pf);var f=Math.atan2(c,s);return f<0&&(f+=pf),f>=r&&f<=i||f+pf>=r&&f+pf<=i}function hf(e,t,n,r,i,a){if(a>t&&a>r||ai?s:0}var gf=sf.CMD,_f=Math.PI*2,vf=1e-4;function yf(e,t){return Math.abs(e-t)t&&l>r&&l>a&&l>s||l1&&Sf(),p=gl(t,r,a,s,xf[0]),f>1&&(m=gl(t,r,a,s,xf[1]))),f===2?gt&&s>r&&s>a||s=0&&l<=1){for(var u=0,d=Cl(t,r,a,l),f=0;fn||s<-n)return 0;var c=Math.sqrt(n*n-s*s);bf[0]=-c,bf[1]=c;var l=Math.abs(r-i);if(l<1e-4)return 0;if(l>=_f-1e-4){r=0,i=_f;var u=a?1:-1;return o>=bf[0]+e&&o<=bf[1]+e?u:0}if(r>i){var d=r;r=i,i=d}r<0&&(r+=_f,i+=_f);for(var f=0,p=0;p<2;p++){var m=bf[p];if(m+e>o){var h=Math.atan2(s,m),u=a?1:-1;h<0&&(h=_f+h),(h>=r&&h<=i||h+_f>=r&&h+_f<=i)&&(h>Math.PI/2&&h1&&(n||(s+=hf(c,l,u,d,r,i))),g&&(c=a[m],l=a[m+1],u=c,d=l),h){case gf.M:u=a[m++],d=a[m++],c=u,l=d;break;case gf.L:if(n){if(cf(c,l,a[m],a[m+1],t,r,i))return!0}else s+=hf(c,l,a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case gf.C:if(n){if(lf(c,l,a[m++],a[m++],a[m++],a[m++],a[m],a[m+1],t,r,i))return!0}else s+=Cf(c,l,a[m++],a[m++],a[m++],a[m++],a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case gf.Q:if(n){if(uf(c,l,a[m++],a[m++],a[m],a[m+1],t,r,i))return!0}else s+=wf(c,l,a[m++],a[m++],a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case gf.A:var _=a[m++],v=a[m++],y=a[m++],b=a[m++],x=a[m++],S=a[m++];m+=1;var C=!!(1-a[m++]);f=Math.cos(x)*y+_,p=Math.sin(x)*b+v,g?(u=f,d=p):s+=hf(c,l,f,p,r,i);var w=(r-_)*b/y+_;if(n){if(mf(_,v,b,x,x+S,C,t,w,i))return!0}else s+=Tf(_,v,b,x,x+S,C,w,i);c=Math.cos(x+S)*y+_,l=Math.sin(x+S)*b+v;break;case gf.R:u=c=a[m++],d=l=a[m++];var T=a[m++],E=a[m++];if(f=u+T,p=d+E,n){if(cf(u,d,f,d,t,r,i)||cf(f,d,f,p,t,r,i)||cf(f,p,u,p,t,r,i)||cf(u,p,u,d,t,r,i))return!0}else s+=hf(f,d,f,p,r,i),s+=hf(u,p,u,d,r,i);break;case gf.Z:if(n){if(cf(c,l,u,d,t,r,i))return!0}else s+=hf(c,l,u,d,r,i);c=u,l=d}}return!n&&!yf(l,d)&&(s+=hf(c,l,u,d,r,i)||0),s!==0}function Df(e,t,n){return Ef(e,0,!1,t,n)}function Of(e,t,n,r){return Ef(e,t,!0,n,r)}var kf=no({fill:`#000`,stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:`butt`,miterLimit:10,strokeNoScale:!1,strokeFirst:!1},yd),Af={style:no({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},bd.style)},jf=nl.concat([`invisible`,`culling`,`z`,`z2`,`zlevel`,`parent`]),Mf=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype.update=function(){var n=this;e.prototype.update.call(this);var r=this.style;if(r.decal){var i=this._decalEl=this._decalEl||new t;i.buildPath===t.prototype.buildPath&&(i.buildPath=function(e){n.buildPath(e,n.shape)}),i.silent=!0;var a=i.style;for(var o in r)a[o]!==r[o]&&(a[o]=r[o]);a.fill=r.fill?r.decal:null,a.decal=null,a.shadowColor=null,r.strokeFirst&&(a.stroke=null);for(var s=0;s.5?Qu:t>.2?ed:$u}if(e)return $u}return Qu},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(q(t)){var n=this.__zr;if(!!(n&&n.isDarkMode())==tu(e,0)<.4)return t}},t.prototype.buildPath=function(e,t,n){},t.prototype.pathUpdated=function(){this.__dirty&=-5},t.prototype.getUpdatedPathProxy=function(e){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,e),this.path},t.prototype.createPathProxy=function(){this.path=new sf(!1)},t.prototype.hasStroke=function(){var e=this.style,t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))},t.prototype.hasFill=function(){var e=this.style.fill;return e!=null&&e!==`none`},t.prototype.getBoundingRect=function(){var e=this._rect,t=this.style,n=!e;if(n){var r=!1;this.path||(r=!0,this.createPathProxy());var i=this.path;(r||this.__dirty&4)&&(i.beginPath(),this.buildPath(i,this.shape,!1),this.pathUpdated()),e=i.getBoundingRect()}if(this._rect=e,this.hasStroke()&&this.path&&this.path.len()>0){var a=this._rectStroke||=e.clone();if(this.__dirty||n){a.copy(e);var o=t.strokeNoScale?this.getLineScale():1,s=t.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;s=Math.max(s,c??4)}o>1e-10&&(a.width+=s/o,a.height+=s/o,a.x-=s/o/2,a.y-=s/o/2)}return a}return e},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),r=this.getBoundingRect(),i=this.style;if(e=n[0],t=n[1],r.contain(e,t)){var a=this.path;if(this.hasStroke()){var o=i.lineWidth,s=i.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(o=Math.max(o,this.strokeContainThreshold)),Of(a,o/s,e,t)))return!0}if(this.hasFill())return Df(a,e,t)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=4,this._rect&&=null,this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(e){return this.animate(`shape`,e)},t.prototype.updateDuringAnimation=function(e){e===`style`?this.dirtyStyle():e===`shape`?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(t,n){t===`shape`?this.setShape(n):e.prototype.attrKV.call(this,t,n)},t.prototype.setShape=function(e,t){var n=this.shape;return n||=this.shape={},typeof e==`string`?n[e]=t:V(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&4)},t.prototype.createStyle=function(e){return Fo(kf,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=V({},this.shape))},t.prototype._applyStateObj=function(t,n,r,i,a,o){if(e.prototype._applyStateObj.call(this,t,n,r,i,a,o),this.__inHover!==1){var s=!(n&&i),c;if(n&&n.shape?a?i?c=n.shape:(c=V({},r.shape),V(c,n.shape)):(c=V({},i?this.shape:r.shape),V(c,n.shape)):s&&(c=r.shape),c){if(a){this.shape=V({},this.shape);for(var l={},u=uo(c),d=0;di&&(d=s+c,s*=i/d,c*=i/d),l+u>i&&(d=l+u,l*=i/d,u*=i/d),c+l>a&&(d=c+l,c*=a/d,l*=a/d),s+u>a&&(d=s+u,s*=a/d,u*=a/d),e.moveTo(n+s,r),e.lineTo(n+i-c,r),c!==0&&e.arc(n+i-c,r+c,c,-Math.PI/2,0),e.lineTo(n+i,r+a-l),l!==0&&e.arc(n+i-l,r+a-l,l,0,Math.PI/2),e.lineTo(n+u,r+a),u!==0&&e.arc(n+u,r+a-u,u,Math.PI/2,Math.PI),e.lineTo(n,r+s),s!==0&&e.arc(n+s,r+s,s,Math.PI,Math.PI*1.5),e.closePath()}var Bf=Math.round;function Vf(e,t,n){if(t){var r=t.x1,i=t.x2,a=t.y1,o=t.y2;e.x1=r,e.x2=i,e.y1=a,e.y2=o;var s=n&&n.lineWidth;return s?(Bf(r*2)===Bf(i*2)&&(e.x1=e.x2=Uf(r,s,!0)),Bf(a*2)===Bf(o*2)&&(e.y1=e.y2=Uf(a,s,!0)),e):e}}function Hf(e,t,n){if(t){var r=t.x,i=t.y,a=t.width,o=t.height;e.x=r,e.y=i,e.width=a,e.height=o;var s=n&&n.lineWidth;return s?(e.x=Uf(r,s,!0),e.y=Uf(i,s,!0),e.width=Math.max(Uf(r+a,s,!1)-e.x,a===0?0:1),e.height=Math.max(Uf(i+o,s,!1)-e.y,o===0?0:1),e):e}}function Uf(e,t,n){if(!t)return e;var r=Bf(e*2);return(r+Bf(t))%2==0?r/2:(r+(n?1:-1))/2}var Wf=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),Gf={},Kf=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new Wf},t.prototype.buildPath=function(e,t){var n,r,i,a;if(this.subPixelOptimize){var o=Hf(Gf,t,this.style);n=o.x,r=o.y,i=o.width,a=o.height,o.r=t.r,t=o}else n=t.x,r=t.y,i=t.width,a=t.height;t.r?zf(e,t):e.rect(n,r,i,a)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(Mf);Kf.prototype.type=`rect`;var qf={fill:`#000`},Jf=2,Yf={},Xf={style:no({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},bd.style)},Zf=function(e){z(t,e);function t(t){var n=e.call(this)||this;return n.type=`text`,n._children=[],n._defaultStyle=qf,n.attr(t),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;t0,T=0;T=0&&(D=y[E],D.align===`right`);)this._placeToken(D,e,x,m,T,`right`,g),S-=D.width,T-=D.width,E--;for(w+=(s-(w-p)-(h-T)-S)/2;C<=E;)D=y[C],this._placeToken(D,e,x,m,w+D.width/2,`center`,g),w+=D.width,C++;m+=x}},t.prototype._placeToken=function(e,t,n,r,i,a,o){var s=t.rich[e.styleName]||{};s.text=e.text;var c=e.verticalAlign,l=r+n/2;c===`top`?l=r+e.height/2:c===`bottom`&&(l=r+n-e.height/2),!e.isLineHolder&&up(s)&&this._renderBackground(s,t,a===`right`?i-e.width:a===`center`?i-e.width/2:i,l-e.height/2,e.width,e.height);var u=!!s.backgroundColor,d=e.textPadding;d&&(i=cp(i,a,d),l-=e.height/2-d[0]-e.innerHeight/2);var f=this._getOrCreateChild(Pf),p=f.createStyle();f.useStyle(p);var m=this._defaultStyle,h=!1,g=0,_=!1,v=sp(`fill`in s?s.fill:`fill`in t?t.fill:(h=!0,m.fill)),y=op(`stroke`in s?s.stroke:`stroke`in t?t.stroke:!u&&!o&&(!m.autoStroke||h)?(g=Jf,_=!0,m.stroke):null),b=s.textShadowBlur>0||t.textShadowBlur>0;p.text=e.text,p.x=i,p.y=l,b&&(p.shadowBlur=s.textShadowBlur||t.textShadowBlur||0,p.shadowColor=s.textShadowColor||t.textShadowColor||`transparent`,p.shadowOffsetX=s.textShadowOffsetX||t.textShadowOffsetX||0,p.shadowOffsetY=s.textShadowOffsetY||t.textShadowOffsetY||0),p.textAlign=a,p.textBaseline=`middle`,p.font=e.font||`12px sans-serif`,p.opacity=So(s.opacity,t.opacity,1),np(p,s),y&&(p.lineWidth=So(s.lineWidth,t.lineWidth,g),p.lineDash=Y(s.lineDash,t.lineDash),p.lineDashOffset=t.lineDashOffset||0,p.stroke=y),v&&(p.fill=v),f.setBoundingRect(Wc(p,e.contentWidth,e.contentHeight,_?0:null))},t.prototype._renderBackground=function(e,t,n,r,i,a){var o=e.backgroundColor,s=e.borderWidth,c=e.borderColor,l=o&&o.image,u=o&&!l,d=e.borderRadius,f=this,p,m;if(u||e.lineHeight||s&&c){p=this._getOrCreateChild(Kf),p.useStyle(p.createStyle()),p.style.fill=null;var h=p.shape;h.x=n,h.y=r,h.width=i,h.height=a,h.r=d,p.dirtyShape()}if(u){var g=p.style;g.fill=o||null,g.fillOpacity=Y(e.fillOpacity,1)}else if(l){m=this._getOrCreateChild(Rf),m.onload=function(){f.dirtyStyle()};var _=m.style;_.image=o.image,_.x=n,_.y=r,_.width=i,_.height=a}if(s&&c){var g=p.style;g.lineWidth=s,g.stroke=c,g.strokeOpacity=Y(e.strokeOpacity,1),g.lineDash=e.borderDash,g.lineDashOffset=e.borderDashOffset||0,p.strokeContainThreshold=0,p.hasFill()&&p.hasStroke()&&(g.strokeFirst=!0,g.lineWidth*=2)}var v=(p||m).style;v.shadowBlur=e.shadowBlur||0,v.shadowColor=e.shadowColor||`transparent`,v.shadowOffsetX=e.shadowOffsetX||0,v.shadowOffsetY=e.shadowOffsetY||0,v.opacity=So(e.opacity,t.opacity,1)},t.makeFont=function(e){var t=``;return rp(e)&&(t=[e.fontStyle,e.fontWeight,tp(e.fontSize),e.fontFamily||`sans-serif`].join(` `)),t&&Eo(t)||e.textFont||e.font},t}(Cd),Qf={left:!0,right:1,center:1},$f={top:1,bottom:1,middle:1},ep=[`fontStyle`,`fontWeight`,`fontSize`,`fontFamily`];function tp(e){return typeof e==`string`&&(e.indexOf(`px`)!==-1||e.indexOf(`rem`)!==-1||e.indexOf(`em`)!==-1)?e:isNaN(+e)?`12px`:e+`px`}function np(e,t){for(var n=0;n0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var Ep=Dp;function Dp(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`}return Op(e,t,n)}function Op(e,t,n){return q(e)?Ap(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function kp(e){return q(e)&&Ap(e)}function Ap(e){return!!pp(e).match(/%$/)}function jp(e,t,n){return isNaN(t)?n?``+e:+e:(t=mp(hp(0,t),fp),e=(+e).toFixed(t),n?e:+e)}function Mp(e){return e.sort(function(e,t){return e-t}),e}function Np(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(_p(e*t)/t===e)return n}return Pp(e)}function Pp(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return hp(0,(a<0?0:i-1-a)-r)}function Fp(e,t,n){var r=gp(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=xp(2*gp(n||1)*gp(r))/Sp,a=xp(gp(t))/Sp,o=hp(0,yp(-i+a));return isFinite(o)||(o=NaN),o}function Ip(e,t){var n=hp(Np(e),Np(t)),r=e+t;return n>fp?r:jp(r,n)}var Lp=bp(2,53)-1;function Rp(e){var t=Cp*2;return(e%t+t)%t}function zp(e){return e>-dp&&e=10&&t++,t}function Wp(e,t){var n=Up(e),r=bp(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,jp(e,-n)}function Gp(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)&&(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0)},e})();function zm(){return[1/0,-1/0]}function Bm(e,t){Wm(t)&&(te[1]&&(e[1]=t))}function Vm(e,t){Wm(t)&&te[1]&&(e[1]=t)}function Um(e,t){Gm(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function Wm(e){return e!=null&&isFinite(e)}function Gm(e,t){return Wm(e)&&Wm(t)&&e<=t}function Km(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function qm(e){Gm(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function Jm(){var e=`__ec_once_`+Ym++;return function(t,n){Io(t,e)||(t[e]=1,n())}}var Ym=Jp();function Xm(e,t,n){var r=X(),i=0;H(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function Zm(e){return e.value+``}function Qm(e){return e+``}function $m(e,t){return Y(t,!0)?e.seriesIndex+2:0}function eh(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function th(e,t){return{seriesType:e,overallReset:t}}function nh(e){return{overallReset:e}}var rh=Om(),ih=function(e,t,n,r){if(r){var i=rh(r);i.dataIndex=n,i.dataType=t,i.seriesIndex=e,i.ssrType=`chart`,r.type===`group`&&r.traverse(function(r){var i=rh(r);i.seriesIndex=e,i.dataIndex=n,i.dataType=t,i.ssrType=`chart`})}},ah=`series`,oh=X([`tooltip`,`label`,`itemName`,`itemId`,`itemGroupId`,`itemChildGroupId`,`seriesName`]),sh=`original`,ch=`arrayRows`,lh=`objectRows`,uh=`keyedColumns`,dh=`typedArray`,fh=`unknown`,ph=`column`,mh=`Roam`,hh=[`getDom`,`getZr`,`getWidth`,`getHeight`,`getDevicePixelRatio`,`dispatchAction`,`isSSR`,`isDisposed`,`on`,`off`,`getDataURL`,`getConnectedDataURL`,`getOption`,`getId`,`updateLabelLayout`],gh=function(){function e(e){H(hh,function(t){this[t]=W(e[t],e)},this)}return e}();function _h(e,t){return t.mainType===`series`?e.getViewOfSeriesModel(t):e.getViewOfComponentModel(t)}var vh=1,yh={},bh=Om(),xh=Om(),Sh=[`emphasis`,`blur`,`select`],Ch=[`normal`,`emphasis`,`blur`,`select`],wh=`highlight`,Th=`downplay`,Eh=`select`,Dh=`unselect`,Oh=`toggleSelect`,kh=`selectchanged`;function Ah(e){return e!=null&&e!==`none`}function jh(e,t,n){e.onHoverStateChange&&(e.hoverState||0)!==n&&e.onHoverStateChange(t),e.hoverState=n}function Mh(e){jh(e,`emphasis`,2)}function Nh(e){e.hoverState===2&&jh(e,`normal`,0)}function Ph(e){jh(e,`blur`,1)}function Fh(e){e.hoverState===1&&jh(e,`normal`,0)}function Ih(e){e.selected=!0}function Lh(e){e.selected=!1}function Rh(e,t,n){t(e,n)}function zh(e,t,n){Rh(e,t,n),e.isGroup&&e.traverse(function(e){Rh(e,t,n)})}function Bh(e,t){switch(t){case`emphasis`:e.hoverState=2;break;case`normal`:e.hoverState=0;break;case`blur`:e.hoverState=1;break;case`select`:e.selected=!0}}function Vh(e,t,n,r){for(var i=e.style,a={},o=0;o=0,a=!1;if(e instanceof Mf){var o=bh(e),s=i&&o.selectFill||o.normalFill,c=i&&o.selectStroke||o.normalStroke;if(Ah(s)||Ah(c)){r||={};var l=r.style||{};l.fill===`inherit`?(a=!0,r=V({},r),l=V({},l),l.fill=s):!Ah(l.fill)&&Ah(s)?(a=!0,r=V({},r),l=V({},l),l.fill=ru(s)):!Ah(l.stroke)&&Ah(c)&&(a||(r=V({},r),l=V({},l)),l.stroke=ru(c)),r.style=l}}if(r&&r.z2==null){a||(r=V({},r));var u=e.z2EmphasisLift;r.z2=e.z2+(u??10)}return r}function Uh(e,t,n){if(n&&n.z2==null){n=V({},n);var r=e.z2SelectLift;n.z2=e.z2+(r??9)}return n}function Wh(e,t,n){var r=ro(e.currentStates,t)>=0,i=e.style.opacity,a=r?null:Vh(e,[`opacity`],t,{opacity:1});n||={};var o=n.style||{};return o.opacity??(n=V({},n),o=V({opacity:r?i:a.opacity*.1},o),n.style=o),n}function Gh(e,t){var n=this.states[e];if(this.style){if(e===`emphasis`)return Hh(this,e,t,n);if(e===`blur`)return Wh(this,e,n);if(e===`select`)return Uh(this,e,n)}return n}function Kh(e){e.stateProxy=Gh;var t=e.getTextContent(),n=e.getTextGuideLine();t&&(t.stateProxy=Gh),n&&(n.stateProxy=Gh)}function qh(e,t){!tg(e,t)&&!e.__highByOuter&&zh(e,Mh)}function Jh(e,t){!tg(e,t)&&!e.__highByOuter&&zh(e,Nh)}function Yh(e,t){e.__highByOuter|=1<<(t||0),zh(e,Mh)}function Xh(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&zh(e,Nh)}function Zh(e){zh(e,Ph)}function Qh(e){zh(e,Fh)}function $h(e){zh(e,Ih)}function eg(e){zh(e,Lh)}function tg(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function ng(e){var t=e.getModel(),n=[],r=[];t.eachComponent(function(t,i){var a=xh(i),o=_h(e,i),s=t===`series`;!s&&r.push(o),a.isBlured&&(o.group.traverse(function(e){Fh(e)}),s&&n.push(i)),a.isBlured=!1}),H(r,function(e){e&&e.toggleBlurSeries&&e.toggleBlurSeries(n,!1,t)})}function rg(e,t,n,r){var i=r.getModel();n||=`coordinateSystem`;function a(e,t){for(var n=0;n0){var a={dataIndex:i,seriesIndex:e.seriesIndex};r!=null&&(a.dataType=r),t.push(a)}})}),t}function fg(e,t,n){yg(e,!0),zh(e,Kh),hg(e,t,n)}function pg(e){yg(e,!1)}function mg(e,t,n,r){r?pg(e):fg(e,t,n)}function hg(e,t,n){var r=rh(e);t==null?r.focus&&=null:(r.focus=t,r.blurScope=n)}var gg=[`emphasis`,`blur`,`select`],_g={itemStyle:`getItemStyle`,lineStyle:`getLineStyle`,areaStyle:`getAreaStyle`};function vg(e,t,n,r){n||=`itemStyle`;for(var i=0;i1&&(o*=Ag(m),s*=Ag(m));var h=(i===a?-1:1)*Ag((o*o*(s*s)-o*o*(p*p)-s*s*(f*f))/(o*o*(p*p)+s*s*(f*f)))||0,g=h*o*p/s,_=h*-s*f/o,v=(e+n)/2+Mg(d)*g-jg(d)*_,y=(t+r)/2+jg(d)*g+Mg(d)*_,b=Ig([1,0],[(f-g)/o,(p-_)/s]),x=[(f-g)/o,(p-_)/s],S=[(-1*f-g)/o,(-1*p-_)/s],C=Ig(x,S);if(Fg(x,S)<=-1&&(C=Ng),Fg(x,S)>=1&&(C=0),C<0){var w=Math.round(C/Ng*1e6)/1e6;C=Ng*2+w%2*Ng}u.addData(l,v,y,o,s,b,C,d,a)}var Rg=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,zg=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function Bg(e){var t=new sf;if(!e)return t;var n=0,r=0,i=n,a=r,o,s=sf.CMD,c=e.match(Rg);if(!c)return t;for(var l=0;l=0&&(n.splice(r,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=ro(this._children,e);return n>=0&&this.replaceAt(t,n),this},t.prototype.replaceAt=function(e,t){var n=this._children,r=n[t];if(e&&e!==this&&e.parent!==this&&e!==r){n[t]=e,r.parent=null;var i=this.__zr;i&&r.removeSelfFromZr(i),this._doAdd(e)}return this},t.prototype._doAdd=function(e){e.parent&&e.parent.remove(e),e.parent=this;var t=this.__zr;t&&t!==e.__zr&&e.addSelfToZr(t),t&&t.refresh()},t.prototype.remove=function(e){var t=this.__zr,n=this._children,r=ro(n,e);return r<0?this:(n.splice(r,1),e.parent=null,t&&e.removeSelfFromZr(t),t&&t.refresh(),this)},t.prototype.removeAll=function(){for(var e=this._children,t=this.__zr,n=0;nA*A+j*j&&(w=E,T=D),{cx:w,cy:T,x0:-u,y0:-d,x1:w*(i/x-1),y1:T*(i/x-1)}}function d_(e){var t;if(G(e)){var n=e.length;if(!n)return e;t=n===1?[e[0],e[0],0,0]:n===2?[e[0],e[0],e[1],e[1]]:n===3?e.concat(e[2]):e}else t=[e,e,e,e];return t}function f_(e,t){var n,r=o_(t.r,0),i=o_(t.r0||0,0),a=r>0;if(a||i>0){if(a||(r=i,i=0),i>r){var o=r;r=i,i=o}var s=t.startAngle,c=t.endAngle;if(!(isNaN(s)||isNaN(c))){var l=t.cx,u=t.cy,d=!!t.clockwise,f=i_(c-s),p=f>$g&&f%$g;if(p>c_&&(f=p),!(r>c_))e.moveTo(l,u);else if(f>$g-c_)e.moveTo(l+r*t_(s),u+r*e_(s)),e.arc(l,u,r,s,c,!d),i>c_&&(e.moveTo(l+i*t_(c),u+i*e_(c)),e.arc(l,u,i,c,s,d));else{var m=void 0,h=void 0,g=void 0,_=void 0,v=void 0,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0,w=void 0,T=void 0,E=void 0,D=void 0,O=void 0,k=void 0,A=r*t_(s),j=r*e_(s),M=i*t_(c),N=i*e_(c),P=f>c_;if(P){var ee=t.cornerRadius;ee&&(n=d_(ee),m=n[0],h=n[1],g=n[2],_=n[3]);var te=i_(r-i)/2;if(v=s_(te,g),y=s_(te,_),b=s_(te,m),x=s_(te,h),w=S=o_(v,y),T=C=o_(b,x),(S>c_||C>c_)&&(E=r*t_(c),D=r*e_(c),O=i*t_(s),k=i*e_(s),fc_){var le=s_(g,w),ue=s_(_,w),F=u_(O,k,A,j,r,le,d),I=u_(E,D,M,N,r,ue,d);e.moveTo(l+F.cx+F.x0,u+F.cy+F.y0),w0&&e.arc(l+F.cx,u+F.cy,le,r_(F.y0,F.x0),r_(F.y1,F.x1),!d),e.arc(l,u,r,r_(F.cy+F.y1,F.cx+F.x1),r_(I.cy+I.y1,I.cx+I.x1),!d),ue>0&&e.arc(l+I.cx,u+I.cy,ue,r_(I.y1,I.x1),r_(I.y0,I.x0),!d))}else e.moveTo(l+A,u+j),e.arc(l,u,r,s,c,!d);if(!(i>c_)||!P)e.lineTo(l+M,u+N);else if(T>c_){var le=s_(m,T),ue=s_(h,T),F=u_(M,N,E,D,i,-ue,d),I=u_(A,j,O,k,i,-le,d);e.lineTo(l+F.cx+F.x0,u+F.cy+F.y0),T0&&e.arc(l+F.cx,u+F.cy,ue,r_(F.y0,F.x0),r_(F.y1,F.x1),!d),e.arc(l,u,i,r_(F.cy+F.y1,F.cx+F.x1),r_(I.cy+I.y1,I.cx+I.x1),d),le>0&&e.arc(l+I.cx,u+I.cy,le,r_(I.y1,I.x1),r_(I.y0,I.x0),!d))}else e.lineTo(l+M,u+N),e.arc(l,u,i,c,s,d)}e.closePath()}}}var p_=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return e}(),m_=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new p_},t.prototype.buildPath=function(e,t){f_(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(Mf);m_.prototype.type=`sector`;var h_=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),g_=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new h_},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.PI*2;e.moveTo(n+t.r,r),e.arc(n,r,t.r,0,i,!1),e.moveTo(n+t.r0,r),e.arc(n,r,t.r0,0,i,!0)},t}(Mf);g_.prototype.type=`ring`;function __(e,t,n,r){var i=[],a=[],o=[],s=[],c,l,u,d;if(r){u=[1/0,1/0],d=[-1/0,-1/0];for(var f=0,p=e.length;f=2){if(r){var a=__(i,r,n,t.smoothConstraint);e.moveTo(i[0][0],i[0][1]);for(var o=i.length,s=0;s<(n?o:o-1);s++){var c=a[s*2],l=a[s*2+1],u=i[(s+1)%o];e.bezierCurveTo(c[0],c[1],l[0],l[1],u[0],u[1])}}else{e.moveTo(i[0][0],i[0][1]);for(var s=1,d=i.length;sB_[1]){if(i=!1,V_.negativeSize||n)return i;var s=R_(B_[0]-z_[1]),c=R_(z_[0]-B_[1]);I_(s,c)>U_.len()&&(s=c||!V_.bidirectional)&&(zs.scale(H_,o,-c*r),V_.useDir&&V_.calcDirMTV()))}}return i},e.prototype._getProjMinMaxOnAxis=function(e,t,n){for(var r=this._axes[e],i=this._origin,a=t[0].dot(r)+i[e],o=a,s=a,c=1;c0){var d=u.duration,f=u.delay,p=u.easing,m={duration:d,delay:f||0,easing:p,done:a,force:!!a||!!o,setToFinal:!l,scope:e,during:o};s?t.animateFrom(n,m):t.animateTo(n,m)}else t.stopAnimation(),!s&&t.attr(n),o&&o(1),a&&a()}function X_(e,t,n,r,i,a){Y_(`update`,e,t,n,r,i,a)}function Z_(e,t,n,r,i,a){Y_(`enter`,e,t,n,r,i,a)}function Q_(e){if(!e.__zr)return!0;for(var t=0;tj_,BezierCurve:()=>k_,BoundingRect:()=>Z,Circle:()=>Yg,CompoundPath:()=>M_,Ellipse:()=>Zg,Group:()=>qg,HOVER_LAYER_FOR_INCREMENTAL:()=>2,HOVER_LAYER_FROM_THRESHOLD:()=>1,HOVER_LAYER_NO:()=>0,Image:()=>Rf,IncrementalDisplayable:()=>K_,Line:()=>T_,LinearGradient:()=>P_,OrientedBoundingRect:()=>W_,Path:()=>Mf,Point:()=>zs,Polygon:()=>b_,Polyline:()=>S_,RadialGradient:()=>F_,Rect:()=>Kf,Ring:()=>g_,Sector:()=>m_,Text:()=>Zf,WH:()=>ov,XY:()=>av,applyTransform:()=>xv,calcZ2Range:()=>Wv,clipPointsByRect:()=>Ev,clipRectByRect:()=>Dv,createIcon:()=>Ov,decomposeTransform:()=>Jv,ensureCopyRect:()=>Vv,ensureCopyTransform:()=>Hv,expandOrShrinkRect:()=>Nv,extendPath:()=>lv,extendShape:()=>sv,getCurrentCanvasPainter:()=>Xv,getShapeClass:()=>dv,getTransform:()=>bv,groupTransition:()=>Tv,initProps:()=>Z_,isBoundingRectAxisAligned:()=>zv,isElementRemoved:()=>Q_,lineLineIntersect:()=>Av,linePolygonIntersect:()=>kv,makeImage:()=>pv,makePath:()=>fv,mergePath:()=>hv,payloadDisableAnimation:()=>qv,registerShape:()=>uv,removeElement:()=>$_,removeElementWithFadeOut:()=>tv,resizePath:()=>gv,retrieveZInfo:()=>Uv,setTooltipConfig:()=>Iv,subPixelOptimize:()=>yv,subPixelOptimizeLine:()=>_v,subPixelOptimizeRect:()=>vv,transformDirection:()=>Sv,traverseElements:()=>Rv,traverseUpdateZ:()=>Gv,updateProps:()=>X_}),iv={},av=[`x`,`y`],ov=[`width`,`height`];function sv(e){return Mf.extend(e)}var cv=Gg;function lv(e,t){return cv(e,t)}function uv(e,t){iv[e]=t}function dv(e){if(iv.hasOwnProperty(e))return iv[e]}function fv(e,t,n,r){var i=Wg(e,t);return n&&(r===`center`&&(n=mv(n,i.getBoundingRect())),gv(i,n)),i}function pv(e,t,n){var r=new Rf({style:{image:e,x:t.x,y:t.y,width:t.width,height:t.height},onload:function(e){if(n===`center`){var i={width:e.width,height:e.height};r.setStyle(mv(t,i))}}});return r}function mv(e,t){var n=t.width/t.height,r=e.height*n,i;r<=e.width?i=e.height:(r=e.width,i=r/n);var a=e.x+e.width/2,o=e.y+e.height/2;return{x:a-r/2,y:o-i/2,width:r,height:i}}var hv=Kg;function gv(e,t){if(e.applyTransform){var n=e.getBoundingRect().calculateTransform(t);e.applyTransform(n)}}function _v(e,t){return Vf(e,e,{lineWidth:t}),e}function vv(e,t){return Hf(e,e,t),e}var yv=Uf;function bv(e,t){for(var n=ms([]);e&&e!==t;)gs(n,e.getLocalTransform(),n),e=e.parent;return n}function xv(e,t,n){return t&&!oo(t)&&(t=$c.getLocalTransform(t)),n&&(t=bs([],t)),Is([],e,t)}function Sv(e,t,n){var r=t[4]===0||t[5]===0||t[0]===0?1:gp(2*t[4]/t[0]),i=t[4]===0||t[5]===0||t[2]===0?1:gp(2*t[4]/t[2]),a=[e===`left`?-r:e===`right`?r:0,e===`top`?-i:e===`bottom`?i:0];return a=xv(a,t,n),gp(a[0])>gp(a[1])?a[0]>0?`right`:`left`:a[1]>0?`bottom`:`top`}function Cv(e){return!e.isGroup}function wv(e){return e.shape!=null}function Tv(e,t,n){if(!e||!t)return;function r(e){var t={};return e.traverse(function(e){Cv(e)&&e.anid&&(t[e.anid]=e)}),t}function i(e){var t={x:e.x,y:e.y,rotation:e.rotation};return wv(e)&&(t.shape=B(e.shape)),t}var a=r(e);t.traverse(function(e){if(Cv(e)&&e.anid){var t=a[e.anid];if(t){var r=i(e);e.attr(i(t)),X_(e,r,n,rh(e).dataIndex)}}})}function Ev(e,t){return U(e,function(e){var n=e[0];n=hp(n,t.x),n=mp(n,t.x+t.width);var r=e[1];return r=hp(r,t.y),r=mp(r,t.y+t.height),[n,r]})}function Dv(e,t){var n=hp(e.x,t.x),r=mp(e.x+e.width,t.x+t.width),i=hp(e.y,t.y),a=mp(e.y+e.height,t.y+t.height);if(r>=n&&a>=i)return{x:n,y:i,width:r-n,height:a-i}}function Ov(e,t,n){var r=V({rectHover:!0},t),i=r.style={strokeNoScale:!0};if(n||={x:-1,y:-1,width:2,height:2},e)return e.indexOf(`image://`)===0?(i.image=e.slice(8),no(i,n),new Rf(r)):fv(e.replace(`path://`,``),r,n,`center`)}function kv(e,t,n,r,i){for(var a=0,o=i[i.length-1];a1)return!1;var g=jv(p,m,u,d)/f;return!(g<0||g>1)}function jv(e,t,n,r){return e*r-n*t}function Mv(e){return e<=1e-6&&e>=-1e-6}function Nv(e,t,n,r,i){return t==null?e:(ho(t)?Pv[0]=Pv[1]=Pv[2]=Pv[3]=t:(Pv[0]=t[0],Pv[1]=t[1],Pv[2]=t[2],Pv[3]=t[3]),r&&(Pv[0]=hp(0,Pv[0]),Pv[1]=hp(0,Pv[1]),Pv[2]=hp(0,Pv[2]),Pv[3]=hp(0,Pv[3])),n&&(Pv[0]=-Pv[0],Pv[1]=-Pv[1],Pv[2]=-Pv[2],Pv[3]=-Pv[3]),Fv(e,Pv,`x`,`width`,3,1,i&&i[0]||0),Fv(e,Pv,`y`,`height`,0,2,i&&i[1]||0),e)}var Pv=[0,0,0,0];function Fv(e,t,n,r,i,a,o){var s=t[a]+t[i],c=e[r];e[r]+=s,o=hp(0,mp(o,c)),e[r]=0?-t[i]:t[a]>=0?c+t[a]:gp(s)>1e-8?(c-o)*t[i]/s:0):e[n]-=t[i]}function Iv(e){var t=e.itemTooltipOption,n=e.componentModel,r=e.itemName,i=q(t)?{formatter:t}:t,a=n.mainType,o=n.componentIndex,s={componentType:a,name:r,$vars:[`name`]};s[a+`Index`]=o;var c=e.formatterParamsExtra;c&&H(uo(c),function(e){Io(s,e)||(s[e]=c[e],s.$vars.push(e))});var l=rh(e.el);l.componentMainType=a,l.componentIndex=o,l.tooltipConfig={name:r,option:no({content:r,encodeHTMLContent:!0,formatterParams:s},i)}}function Lv(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function Rv(e,t){if(e){if(G(e))for(var n=0;nt&&(t=r),rt&&(n=t=0),{min:n,max:t}}function Gv(e,t,n){Kv(e,t,n,-1/0)}function Kv(e,t,n,r){if(e.ignoreModelZ)return r;var i=e.getTextContent(),a=e.getTextGuideLine();if(e.isGroup)for(var o=e.childrenRef(),s=0;s1){var l=s.shift();s.length===1&&(n[o]=s[0]),this._update&&this._update(l,a)}else c===1?(n[o]=null,this._update&&this._update(s,a)):this._remove&&this._remove(a)}this._performRestAdd(i,n)},e.prototype._executeMultiple=function(){var e=this._old,t=this._new,n={},r={},i=[],a=[];this._initIndexMap(e,n,i,`_oldKeyGetter`),this._initIndexMap(t,r,a,`_newKeyGetter`);for(var o=0;o1&&d===1)this._updateManyToOne&&this._updateManyToOne(l,c),r[s]=null;else if(u===1&&d>1)this._updateOneToMany&&this._updateOneToMany(l,c),r[s]=null;else if(u===1&&d===1)this._update&&this._update(l,c),r[s]=null;else if(u>1&&d>1)this._updateManyToMany&&this._updateManyToMany(l,c),r[s]=null;else if(u>1)for(var f=0;f1)for(var o=0;ol&&(l=p)}s[0]=c,s[1]=l}},r=function(){return this._data?this._data.length/this._dimSize:0};Zy=(e={},e[ch+`_`+ph]={pure:!0,appendData:i},e[ch+`_row`]={pure:!0,appendData:function(){throw Error(`Do not support appendData when set seriesLayoutBy: "row".`)}},e[lh]={pure:!0,appendData:i},e[uh]={pure:!0,appendData:function(e){var t=this._data;H(e,function(e,n){for(var r=t[n]||(t[n]=[]),i=0;i<(e||[]).length;i++)r.push(e[i])})}},e[sh]={appendData:i},e[dh]={persistent:!1,pure:!0,appendData:function(e){this._data=e},clean:function(){this._offset+=this.count(),this._data=null}},e);function i(e){for(var t=0;tt},gte:function(e,t){return e>=t}};(function(){function e(e,t){ho(t)||rm(``),this._opFn=yb[e],this._rvalFloat=Kp(t)}return e.prototype.evaluate=function(e){return ho(e)?this._opFn(e,this._rvalFloat):this._opFn(Kp(e),this._rvalFloat)},e})();var bb=function(){function e(e,t){var n=e===`desc`;this._resultLT=n?1:-1,t??=n?`min`:`max`,this._incomparable=t===`min`?-1/0:1/0}return e.prototype.evaluate=function(e,t){var n=ho(e)?e:Kp(e),r=ho(t)?t:Kp(t),i=isNaN(n),a=isNaN(r);if(i&&(n=this._incomparable),a&&(r=this._incomparable),i&&a){var o=q(e),s=q(t);o&&(n=s?e:0),s&&(r=o?t:0)}return nr?-this._resultLT:0},e}();(function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=Kp(t)}return e.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var n=typeof e;n!==this._rvalTypeof&&(n===`number`||this._rvalTypeof===`number`)&&(t=Kp(e)===this._rvalFloat)}return this._isEQ?t:!t},e})();function xb(e){var t=``,n=-1/0,r=-1/0,i=1/0,a=1/0;return e&&(e.g!=null&&(t+=`G`+e.g,n=e.g),e.ge!=null&&(t+=`GE`+e.ge,r=e.ge),e.l!=null&&(t+=`L`+e.l,i=e.l),e.le!=null&&(t+=`LE`+e.le,a=e.le)),{key:t,g:n,ge:r,l:i,le:a}}function Sb(e,t){return t>e.g&&t>=e.ge&&t`u`?Array:Uint32Array,wb=typeof Uint16Array>`u`?Array:Uint16Array,Tb=typeof Int32Array>`u`?Array:Int32Array,Eb=typeof Float64Array>`u`?Array:Float64Array,Db={float:Eb,int:Tb,ordinal:Array,number:Array,time:Eb},Ob;function kb(e){return e>65535?Cb:wb}function Ab(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function jb(e,t,n,r,i){var a=Db[n||`float`];if(i){var o=e[t],s=o&&o.length;if(s!==r){for(var c=new a(r),l=0;lh[1]&&(h[1]=m)}return this._rawCount=this._count=s,{start:o,end:s}},e.prototype._initDataFromProvider=function(e,t,n){for(var r=this._provider,i=this._chunks,a=this._dimensions,o=a.length,s=this._rawExtent,c=U(a,function(e){return e.property}),l=0;lg[1]&&(g[1]=h)}}!r.persistent&&r.clean&&r.clean(),this._rawCount=this._count=t,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(e,t){if(!(t>=0&&t=0&&t=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,n=t[e];if(n!=null&&ne)i=a-1;else return a}return-1},e.prototype.getIndices=function(){var e,t=this._indices;if(t){var n=t.constructor,r=this._count;if(n===Array){e=new n(r);for(var i=0;i=l&&g<=u||isNaN(g))&&(o[s++]=p),p++}f=!0}else if(i===2){for(var m=d[r[0]],_=d[r[1]],v=e[r[1]][0],y=e[r[1]][1],h=0;h=l&&g<=u||isNaN(g))&&(b>=v&&b<=y||isNaN(b))&&(o[s++]=p),p++}f=!0}}if(!f){if(i===1)for(var h=0;h=l&&g<=u||isNaN(g))&&(o[s++]=x)}else for(var h=0;he[w][1])&&(S=!1)}S&&(o[s++]=t.getRawIndex(h))}}return sg[1]&&(g[1]=h)}}}},e.prototype.lttbDownSample=function(e,t){var n=this.clone([e],!0),r=n._chunks[e],i=this.count(),a=0,o=Math.floor(1/t),s=this.getRawIndex(0),c,l,u,d=new(kb(this._rawCount))(Math.min((Math.ceil(i/o)+2)*2,i));d[a++]=s;for(var f=1;fc&&(c=l,u=v)}T>0&&To&&(m=o-l);for(var h=0;hp&&(p=g,f=l+h)}var _=this.getRawIndex(u),v=this.getRawIndex(f);ul-p&&(s=l-p,o.length=s);for(var m=0;mu[1]&&(u[1]=g),d[f++]=_}return i._count=f,i._indices=d,i._updateGetRawIdx(),i},e.prototype.each=function(e,t){if(this._count)for(var n=e.length,r=this._chunks,i=0,a=this.count();id&&(d=p))}return o[c]=[u,d]},e.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var n=[],r=this._chunks,i=0;i=0?this._indices[e]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function e(e,t,n,r){return vb(e[r],this._dimensions[r])}Ob={arrayRows:e,objectRows:function(e,t,n,r){return vb(e[t],this._dimensions[r])},keyedColumns:e,original:function(e,t,n,r){var i=e&&(e.value==null?e:e.value);return vb(i instanceof Array?i[r]:i,this._dimensions[r])},typedArray:function(e,t,n,r){return e[r]}}}(),e}(),Nb=Om(),Pb={float:`f`,int:`i`,ordinal:`o`,number:`n`,time:`t`},Fb=function(){function e(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return e.prototype.isDimensionOmitted=function(){return this._dimOmitted},e.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||=Rb(this.source))},e.prototype.getSourceDimensionIndex=function(e){return Y(this._dimNameMap.get(e),-1)},e.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},e.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=Ky(this.source),n=!zb(e),r=``,i=[],a=0,o=0;a30}var Bb=J,Vb=U,Hb=typeof Int32Array>`u`?Array:Int32Array,Ub=`e\0\0`,Wb=-1,Gb=[`hasItemOption`,`_nameList`,`_idList`,`_invertedIndicesMap`,`_dimSummary`,`userOutput`,`_rawData`,`_dimValueGetter`,`_nameDimIdx`,`_idDimIdx`,`_nameRepeatCount`],Kb=[`_approximateExtent`],qb,Jb,Yb,Xb,Zb,Qb,$b,ex=function(){function e(e,t){this.type=`list`,this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=[`cloneShallow`,`downSample`,`minmaxDownSample`,`lttbDownSample`,`map`],this.CHANGABLE_METHODS=[`filterSelf`,`selectRange`],this.DOWNSAMPLE_METHODS=[`downSample`,`minmaxDownSample`,`lttbDownSample`];var n,r=!1;Ib(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(r=!0,n=e),n||=[`x`,`y`];for(var i={},a=[],o={},s=!1,c={},l=0;l=t)){var n=this._store.getProvider();this._updateOrdinalMeta();var r=this._nameList,i=this._idList;if(n.getSource().sourceFormat===`original`&&!n.pure)for(var a=[],o=e;o0},e.prototype.ensureUniqueItemVisual=function(e,t){var n=this._itemVisuals,r=n[e];r||=n[e]={};var i=r[t];return i??(i=this.getVisual(t),G(i)?i=i.slice():Bb(i)&&(i=V({},i)),r[t]=i),i},e.prototype.setItemVisual=function(e,t,n){var r=this._itemVisuals[e]||{};this._itemVisuals[e]=r,Bb(t)?V(r,t):r[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){Bb(e)?V(this._layout,e):this._layout[e]=t},e.prototype.getLayout=function(e){return this._layout[e]},e.prototype.getItemLayout=function(e){return this._itemLayouts[e]},e.prototype.setItemLayout=function(e,t,n){this._itemLayouts[e]=n?V(this._itemLayouts[e]||{},t):t},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(e,t){ih(this.hostModel&&this.hostModel.seriesIndex,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){H(this._graphicEls,function(n,r){n&&e&&e.call(t,n,r)})},e.prototype.cloneShallow=function(t){return t||=new e(this._schema?this._schema:Vb(this.dimensions,this._getDimInfo,this),this.hostModel),Zb(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];K(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(Co(arguments)))})},e.internalField=function(){qb=function(e){var t=e._invertedIndicesMap;H(t,function(n,r){var i=e._dimInfos[r],a=i.ordinalMeta,o=e._store;if(a){n=t[r]=new Hb(a.categories.length);for(var s=0;s1&&(s+=`__ec__`+l),r[t]=s}}}(),e}();function tx(e,t){Ly(e)||(e=zy(e)),t||={};var n=t.coordDimensions||[],r=t.dimensionsDefine||e.dimensionsDefine||[],i=X(),a=[],o=nx(e,n,r,t.dimensionsCount),s=t.canOmitUnusedDimensions&&zb(o),c=r===e.dimensionsDefine,l=c?Rb(e):Lb(r),u=t.encodeDefine;!u&&t.encodeDefaulter&&(u=t.encodeDefaulter(e,o));for(var d=X(u),f=new Tb(o),p=0;p0&&(e.name+=t-1)}),new Fb({source:e,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function nx(e,t,n,r){var i=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,r||0);return H(t,function(e){var t;J(e)&&(t=e.dimsDef)&&(i=Math.max(i,t.length))}),i}function rx(e,t,n){if(n||t.hasKey(e)){for(var r=0;t.hasKey(e+r);)r++;e+=r}return t.set(e,!0),e}var ix={},ax={},ox=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(e,t){this._nonSeriesBoxMasterList=n(ix,!0),this._normalMasterList=n(ax,!1);function n(n,r){var i=[];return H(n,function(n,r){var a=n.create(e,t);i=i.concat(a||[])}),i}},e.prototype.update=function(e,t){H(this._normalMasterList,function(n){n.update&&n.update(e,t)})},e.prototype.getCoordinateSystems=function(){return this._normalMasterList.concat(this._nonSeriesBoxMasterList)},e.register=function(e,t){if(e===`matrix`||e===`calendar`){ix[e]=t;return}ax[e]=t},e.get=function(e){return ax[e]||ix[e]},e}();function sx(e){return!!ix[e]}var cx=X();function lx(e){var t=e.getShallow(`coord`,!0),n=1;if(t==null){var r=cx.get(e.type);r&&r.getCoord2&&(n=2,t=r.getCoord2(e))}return{coord:t,from:n}}function ux(e,t){var n=e.getShallow(`coordinateSystem`),r=e.getShallow(`coordinateSystemUsage`,!0),i=0;if(n){var a=e.mainType===`series`;r??=a?`data`:`box`,r===`data`?(i=1,a||(i=0)):r===`box`&&(i=2,!a&&!sx(n)&&(i=0))}return{coordSysType:n,kind:i}}function dx(e){var t=e.targetModel,n=e.coordSysType,r=e.coordSysProvider,i=e.isDefaultDataCoordSys;e.allowNotFound;var a=ux(t,!0),o=a.kind,s=a.coordSysType;if(i&&o!==1&&(o=1,s=n),o===0||s!==n)return 0;var c=r(n,t);return c?(o===1?t.coordinateSystem=c:t.boxCoordinateSystem=c,o):0}var fx=function(){function e(e){this.coordSysDims=[],this.axisMap=X(),this.categoryAxisMap=X(),this.coordSysName=e}return e}();function px(e){var t=e.get(`coordinateSystem`),n=new fx(t),r=mx[t];if(r)return r(e,n,n.axisMap,n.categoryAxisMap),n}var mx={cartesian2d:function(e,t,n,r){var i=e.getReferringComponents(`xAxis`,Mm).models[0],a=e.getReferringComponents(`yAxis`,Mm).models[0];t.coordSysDims=[`x`,`y`],n.set(`x`,i),n.set(`y`,a),hx(i)&&(r.set(`x`,i),t.firstCategoryDimIndex=0),hx(a)&&(r.set(`y`,a),t.firstCategoryDimIndex??=1)},singleAxis:function(e,t,n,r){var i=e.getReferringComponents(`singleAxis`,Mm).models[0];t.coordSysDims=[`single`],n.set(`single`,i),hx(i)&&(r.set(`single`,i),t.firstCategoryDimIndex=0)},polar:function(e,t,n,r){var i=e.getReferringComponents(`polar`,Mm).models[0],a=i.findAxisModel(`radiusAxis`),o=i.findAxisModel(`angleAxis`);t.coordSysDims=[`radius`,`angle`],n.set(`radius`,a),n.set(`angle`,o),hx(a)&&(r.set(`radius`,a),t.firstCategoryDimIndex=0),hx(o)&&(r.set(`angle`,o),t.firstCategoryDimIndex??=1)},geo:function(e,t,n,r){t.coordSysDims=[`lng`,`lat`]},parallel:function(e,t,n,r){var i=e.ecModel,a=i.getComponent(`parallel`,e.get(`parallelIndex`)),o=t.coordSysDims=a.dimensions.slice();H(a.parallelAxisIndex,function(e,a){var s=i.getComponent(`parallelAxis`,e),c=o[a];n.set(c,s),hx(s)&&(r.set(c,s),t.firstCategoryDimIndex??=a)})},matrix:function(e,t,n,r){var i=e.getReferringComponents(`matrix`,Mm).models[0];t.coordSysDims=[`x`,`y`];var a=i.getDimensionModel(`x`),o=i.getDimensionModel(`y`);n.set(`x`,a),n.set(`y`,o),r.set(`x`,a),r.set(`y`,o)}};function hx(e){return e.get(`type`)===`category`}function gx(e,t,n){n||={};var r=n.byIndex,i=n.stackedCoordDimension,a,o,s;_x(t)?a=t:(o=t.schema,a=o.dimensions,s=t.store);var c=!!(e&&e.get(`stack`)),l,u,d,f,p=!0;function m(e){return e.type!==`ordinal`&&e.type!==`time`}if(H(a,function(e,t){q(e)&&(a[t]=e={name:e}),m(e)||(p=!1)}),H(a,function(e,t){c&&!e.isExtraCoord&&(!r&&!l&&e.ordinalMeta&&(l=e),!u&&m(e)&&(!p||e.coordDim!==`x`&&e.coordDim!==`angle`)&&(!i||i===e.coordDim)&&(u=e))}),u&&!r&&!l&&(r=!0),u){d=`__\0ecstackresult_`+e.id,f=`__\0ecstackedover_`+e.id,l&&(l.createInvertedIndices=!0);var h=u.coordDim,g=u.type,_=0;H(a,function(e){e.coordDim===h&&_++});var v={name:d,coordDim:h,coordDimIndex:_,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},y={name:f,coordDim:f,coordDimIndex:_+1,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(v.storeDimIndex=s.ensureCalculationDimension(f,g),y.storeDimIndex=s.ensureCalculationDimension(d,g)),o.appendCalculationDimension(v),o.appendCalculationDimension(y)):(a.push(v),a.push(y))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:r,stackedOverDimension:f,stackResultDimension:d}}function _x(e){return!Ib(e.schema)}function vx(e,t){return!!t&&t===e.getCalculationInfo(`stackedDimension`)}function yx(e,t){return vx(e,t)?e.getCalculationInfo(`stackResultDimension`):t}function bx(e,t){var n=e.get(`coordinateSystem`),r=ox.get(n),i;return t&&t.coordSysDims&&(i=U(t.coordSysDims,function(e){var n={name:e},r=t.axisMap.get(e);return r&&(n.type=hb(r.get(`type`))),n})),i||=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||[`x`,`y`],i}function xx(e,t,n){var r,i;return n&&H(e,function(e,a){var o=e.coordDim,s=n.categoryAxisMap.get(o);s&&(r??=a,e.ordinalMeta=s.getOrdinalMeta(),t&&(e.createInvertedIndices=!0)),e.otherDims.itemName!=null&&(i=!0)}),!i&&r!=null&&(e[r].otherDims.itemName=0),r}function Sx(e,t,n){n||={};var r=t.getSourceManager(),i,a=!1;e?(a=!0,i=zy(e)):(i=r.getSource(),a=i.sourceFormat===sh);var o=px(t),s=bx(t,o),c=n.useEncodeDefaulter,l=K(c)?c:c?po(jy,s,t):null,u={coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:l,canOmitUnusedDimensions:!a},d=tx(i,u),f=xx(d.dimensions,n.createInvertedIndices,o),p=a?null:r.getSharedDataStore(d),m=gx(t,{schema:d,store:p}),h=new ex(d,t);h.setCalculationInfo(m);var g=f!=null&&Cx(i)?function(e,t,n,r){return r===f?n:this.defaultDimValueGetter(e,t,n,r)}:null;return h.hasItemOption=!1,h.initData(a?i:p,null,g),h}function Cx(e){if(e.sourceFormat===`original`)return!G(um(Tx(e.data||[])))}function Tx(e){for(var t=0;t=0&&n.push(e)}),n}}function Ax(e,t){return eo(eo({},e,!0),t,!0)}var jx=Math.log(2);function Mx(e,t,n,r,i,a){var o=r+`-`+i,s=e.length;if(a.hasOwnProperty(o))return a[o];if(t===1){var c=Math.round(Math.log((1<>1)%2;s.cssText=[`position: absolute`,`visibility: hidden`,`padding: 0`,`margin: 0`,`border-width: 0`,`user-select: none`,`width:0`,`height:0`,r[c]+`:0`,i[l]+`:0`,r[1-c]+`:auto`,i[1-l]+`:auto`,``].join(`!important;`),e.appendChild(o),n.push(o)}return t.clearMarkers=function(){H(n,function(e){e.parentNode&&e.parentNode.removeChild(e)})},n}function Bx(e,t,n){for(var r=n?`invTrans`:`trans`,i=t[r],a=t.srcCoords,o=[],s=[],c=!0,l=0;l<4;l++){var u=e[l].getBoundingClientRect(),d=2*l,f=u.left,p=u.top;o.push(f,p),c=c&&a&&f===a[d]&&p===a[d+1],s.push(e[l].offsetLeft,e[l].offsetTop)}return c&&i?i:(t.srcCoords=o,t[r]=n?Nx(s,o):Nx(o,s))}function Vx(e){return e.nodeName.toUpperCase()===`CANVAS`}var Hx=/([&<>"'])/g,Ux={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function Wx(e){return e==null?``:(e+``).replace(Hx,function(e,t){return Ux[t]})}var Gx={time:{month:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],monthAbbr:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],dayOfWeek:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],dayOfWeekAbbr:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]},legend:{selector:{all:`All`,inverse:`Inv`}},toolbox:{brush:{title:{rect:`Box Select`,polygon:`Lasso Select`,lineX:`Horizontally Select`,lineY:`Vertically Select`,keep:`Keep Selections`,clear:`Clear Selections`}},dataView:{title:`Data View`,lang:[`Data View`,`Close`,`Refresh`]},dataZoom:{title:{zoom:`Zoom`,back:`Zoom Reset`}},magicType:{title:{line:`Switch to Line Chart`,bar:`Switch to Bar Chart`,stack:`Stack`,tiled:`Tile`}},restore:{title:`Restore`},saveAsImage:{title:`Save as Image`,lang:[`Right Click to Save Image`]}},series:{typeNames:{pie:`Pie chart`,bar:`Bar chart`,line:`Line chart`,scatter:`Scatter plot`,effectScatter:`Ripple scatter plot`,radar:`Radar chart`,tree:`Tree`,treemap:`Treemap`,boxplot:`Boxplot`,candlestick:`Candlestick`,k:`K line chart`,heatmap:`Heat map`,map:`Map`,parallel:`Parallel coordinate map`,lines:`Line graph`,graph:`Relationship graph`,sankey:`Sankey diagram`,funnel:`Funnel chart`,gauge:`Gauge`,pictorialBar:`Pictorial bar`,themeRiver:`Theme River Map`,sunburst:`Sunburst`,custom:`Custom chart`,chart:`Chart`}},aria:{general:{withTitle:`This is a chart about "{title}"`,withoutTitle:`This is a chart`},series:{single:{prefix:``,withName:` with type {seriesType} named {seriesName}.`,withoutName:` with type {seriesType}.`},multiple:{prefix:`. It consists of {seriesCount} series count.`,withName:` The {seriesId} series is a {seriesType} representing {seriesName}.`,withoutName:` The {seriesId} series is a {seriesType}.`,separator:{middle:``,end:``}}},data:{allData:`The data is as follows: `,partialData:`The first {displayCnt} items are: `,withName:`the data for {name} is {value}`,withoutName:`{value}`,separator:{middle:`, `,end:`. `}}}},Kx={time:{month:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],monthAbbr:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],dayOfWeek:[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`],dayOfWeekAbbr:[`日`,`一`,`二`,`三`,`四`,`五`,`六`]},legend:{selector:{all:`全选`,inverse:`反选`}},toolbox:{brush:{title:{rect:`矩形选择`,polygon:`圈选`,lineX:`横向选择`,lineY:`纵向选择`,keep:`保持选择`,clear:`清除选择`}},dataView:{title:`数据视图`,lang:[`数据视图`,`关闭`,`刷新`]},dataZoom:{title:{zoom:`区域缩放`,back:`区域缩放还原`}},magicType:{title:{line:`切换为折线图`,bar:`切换为柱状图`,stack:`切换为堆叠`,tiled:`切换为平铺`}},restore:{title:`还原`},saveAsImage:{title:`保存为图片`,lang:[`右键另存为图片`]}},series:{typeNames:{pie:`饼图`,bar:`柱状图`,line:`折线图`,scatter:`散点图`,effectScatter:`涟漪散点图`,radar:`雷达图`,tree:`树图`,treemap:`矩形树图`,boxplot:`箱型图`,candlestick:`K线图`,k:`K线图`,heatmap:`热力图`,map:`地图`,parallel:`平行坐标图`,lines:`线图`,graph:`关系图`,sankey:`桑基图`,funnel:`漏斗图`,gauge:`仪表盘图`,pictorialBar:`象形柱图`,themeRiver:`主题河流图`,sunburst:`旭日图`,custom:`自定义图表`,chart:`图表`}},aria:{general:{withTitle:`这是一个关于“{title}”的图表。`,withoutTitle:`这是一个图表,`},series:{single:{prefix:``,withName:`图表类型是{seriesType},表示{seriesName}。`,withoutName:`图表类型是{seriesType}。`},multiple:{prefix:`它由{seriesCount}个图表系列组成。`,withName:`第{seriesId}个系列是一个表示{seriesName}的{seriesType},`,withoutName:`第{seriesId}个系列是一个{seriesType},`,separator:{middle:`;`,end:`。`}}},data:{allData:`其数据是——`,partialData:`其中,前{displayCnt}项是——`,withName:`{name}的数据是{value}`,withoutName:`{value}`,separator:{middle:`,`,end:``}}}},qx=`ZH`,Jx=`EN`,Yx=Jx,Xx={},Zx={},Qx=Bo.domSupported?function(){return(document.documentElement.lang||navigator.language||navigator.browserLanguage||Yx).toUpperCase().indexOf(qx)>-1?qx:Yx}():Yx;function $x(e,t){e=e.toUpperCase(),Zx[e]=new wy(t),Xx[e]=t}function eS(e){if(q(e)){var t=Xx[e.toUpperCase()]||{};return e===qx||e===Jx?B(t):eo(B(t),B(Xx[Yx]),!1)}return eo(B(e),B(Xx[Yx]),!1)}function tS(e){return Zx[e]}function nS(){return Zx[Yx]}$x(Jx,Gx),$x(qx,Kx);var rS=null;function iS(){return rS}function aS(e,t){var n=iS(),r=t.breakOption,i=t.breakParsed;return!i&&n&&(i=n.parseAxisBreakOption(r,e)),i}function oS(e){var t=e.brk;return t?t.breaks:[]}function sS(e){var t=e.brk;return t?t.hasBreaks():!1}var cS=1e3,lS=cS*60,uS=lS*60,dS=uS*24,fS=dS*365,pS={year:/({yyyy}|{yy})/,month:/({MMMM}|{MMM}|{MM}|{M})/,day:/({dd}|{d})/,hour:/({HH}|{H}|{hh}|{h})/,minute:/({mm}|{m})/,second:/({ss}|{s})/,millisecond:/({SSS}|{S})/},mS={year:`{yyyy}`,month:`{MMM}`,day:`{d}`,hour:`{HH}:{mm}`,minute:`{HH}:{mm}`,second:`{HH}:{mm}:{ss}`,millisecond:`{HH}:{mm}:{ss} {SSS}`},hS=`{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}`,gS=`{yyyy}-{MM}-{dd}`,_S={year:`{yyyy}`,month:`{yyyy}-{MM}`,day:gS,hour:gS+` `+mS.hour,minute:gS+` `+mS.minute,second:gS+` `+mS.second,millisecond:hS},vS=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],yS=[`year`,`half-year`,`quarter`,`month`,`week`,`half-week`,`day`,`half-day`,`quarter-day`,`hour`,`minute`,`second`,`millisecond`];function bS(e){return!q(e)&&!K(e)?xS(e):e}function xS(e){e||={};var t={},n=!0;return H(vS,function(t){n&&=e[t]==null}),H(vS,function(r,i){var a=e[r];t[r]={};for(var o=null,s=i;s>=0;s--){var c=vS[s],l=J(a)&&!G(a)?a[c]:a,u=void 0;G(l)?(u=l.slice(),o=u[0]||``):q(l)?(o=l,u=[o]):(o==null?o=mS[r]:pS[c].test(o)||(o=t[c][c][0]+` `+o),u=[o],n&&(u[1]=`{primary|`+o+`}`)),t[r][c]=u}}),t}function SS(e,t){return e+=``,`0000`.substr(0,t-e.length)+e}function CS(e){switch(e){case`half-year`:case`quarter`:return`month`;case`week`:case`half-week`:return`day`;case`half-day`:case`quarter-day`:return`hour`;default:return e}}function wS(e){return e===CS(e)}function TS(e){switch(e){case`year`:case`month`:return`day`;case`millisecond`:return`millisecond`;default:return`second`}}function ES(e,t,n,r){var i=Vp(e),a=i[AS(n)](),o=i[jS(n)]()+1,s=Math.floor((o-1)/3)+1,c=i[MS(n)](),l=i[`get`+(n?`UTC`:``)+`Day`](),u=i[NS(n)](),d=(u-1)%12+1,f=i[PS(n)](),p=i[FS(n)](),m=i[IS(n)](),h=u>=12?`pm`:`am`,g=h.toUpperCase(),_=(r instanceof wy?r:tS(r||Qx)||nS()).getModel(`time`),v=_.get(`month`),y=_.get(`monthAbbr`),b=_.get(`dayOfWeek`),x=_.get(`dayOfWeekAbbr`);return(t||``).replace(/{a}/g,h+``).replace(/{A}/g,g+``).replace(/{yyyy}/g,a+``).replace(/{yy}/g,SS(a%100+``,2)).replace(/{Q}/g,s+``).replace(/{MMMM}/g,v[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,SS(o,2)).replace(/{M}/g,o+``).replace(/{dd}/g,SS(c,2)).replace(/{d}/g,c+``).replace(/{eeee}/g,b[l]).replace(/{ee}/g,x[l]).replace(/{e}/g,l+``).replace(/{HH}/g,SS(u,2)).replace(/{H}/g,u+``).replace(/{hh}/g,SS(d+``,2)).replace(/{h}/g,d+``).replace(/{mm}/g,SS(f,2)).replace(/{m}/g,f+``).replace(/{ss}/g,SS(p,2)).replace(/{s}/g,p+``).replace(/{SSS}/g,SS(m,3)).replace(/{S}/g,m+``)}function DS(e,t,n,r,i){var a=null;if(q(n))a=n;else if(K(n)){var o={time:e.time,level:e.time?e.time.level:0},s=iS();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),a=n(e.value,t,o)}else{var c=e.time;if(c){var l=n[c.lowerTimeUnit][c.upperTimeUnit];a=l[Math.min(c.level,l.length-1)]||``}else{var u=OS(e.value,i);a=n[u][u][0]}}return ES(new Date(e.value),a,i,r)}function OS(e,t){var n=Vp(e),r=n[jS(t)]()+1,i=n[MS(t)](),a=n[NS(t)](),o=n[PS(t)](),s=n[FS(t)](),c=n[IS(t)]()===0,l=c&&s===0,u=l&&o===0,d=u&&a===0,f=d&&i===1;return f&&r===1?`year`:f?`month`:d?`day`:u?`hour`:l?`minute`:c?`second`:`millisecond`}function kS(e,t,n){switch(t){case`year`:e[RS(n)](0);case`month`:e[zS(n)](1);case`day`:e[BS(n)](0);case`hour`:e[VS(n)](0);case`minute`:e[HS(n)](0);case`second`:e[US(n)](0)}return e}function AS(e){return e?`getUTCFullYear`:`getFullYear`}function jS(e){return e?`getUTCMonth`:`getMonth`}function MS(e){return e?`getUTCDate`:`getDate`}function NS(e){return e?`getUTCHours`:`getHours`}function PS(e){return e?`getUTCMinutes`:`getMinutes`}function FS(e){return e?`getUTCSeconds`:`getSeconds`}function IS(e){return e?`getUTCMilliseconds`:`getMilliseconds`}function LS(e){return e?`setUTCFullYear`:`setFullYear`}function RS(e){return e?`setUTCMonth`:`setMonth`}function zS(e){return e?`setUTCDate`:`setDate`}function BS(e){return e?`setUTCHours`:`setHours`}function VS(e){return e?`setUTCMinutes`:`setMinutes`}function HS(e){return e?`setUTCSeconds`:`setSeconds`}function US(e){return e?`setUTCMilliseconds`:`setMilliseconds`}function WS(e){if(!qp(e))return q(e)?e:`-`;var t=(e+``).split(`.`);return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,`$1,`)+(t.length>1?`.`+t[1]:``)}function GS(e,t){return e=(e||``).toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var KS=wo;function qS(e,t,n){var r=`{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}`;function i(e){return e&&Eo(e)?e:`-`}function a(e){return Zp(e)}var o=t===`time`,s=e instanceof Date;if(o||s){var c=o?Vp(e):e;if(!isNaN(+c))return ES(c,r,n);if(s)return`-`}if(t===`ordinal`)return mo(e)?i(e):ho(e)&&a(e)?e+``:`-`;var l=Kp(e);return a(l)?WS(l):mo(e)?i(e):typeof e==`boolean`?e+``:`-`}var JS=[`a`,`b`,`c`,`d`,`e`,`f`,`g`],YS=function(e,t){return`{`+e+(t??``)+`}`};function XS(e,t,n){G(t)||(t=[t]);var r=t.length;if(!r)return``;for(var i=t[0].$vars||[],a=0;a`:``:{renderMode:a,content:`{`+(n.markerId||`markerX`)+`|} `,style:i===`subItem`?{width:4,height:4,borderRadius:2,backgroundColor:r}:{width:10,height:10,borderRadius:5,backgroundColor:r}}:``}function QS(e,t){return t||=`transparent`,q(e)?e:J(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}var $S=H,eC=[`left`,`right`,`top`,`bottom`,`width`,`height`],tC=[[`width`,`left`,`right`],[`height`,`top`,`bottom`]];function nC(e,t,n,r,i){var a=0,o=0;r??=1/0,i??=1/0;var s=0;t.eachChild(function(c,l){var u=c.getBoundingRect(),d=t.childAt(l+1),f=d&&d.getBoundingRect(),p,m;if(e===`horizontal`){var h=u.width+(f?-f.x+u.x:0);p=a+h,p>r||c.newline?(a=0,p=h,o+=s+n,s=u.height):s=Math.max(s,u.height)}else{var g=u.height+(f?-f.y+u.y:0);m=o+g,m>i||c.newline?(a+=s+n,o=0,m=g,s=u.width):s=Math.max(s,u.width)}c.newline||(c.x=a,c.y=o,c.markRedraw(),e===`horizontal`?a=p+n:o=m+n)})}var rC=nC;po(nC,`vertical`),po(nC,`horizontal`);function iC(e,t){return{left:e.getShallow(`left`,t),top:e.getShallow(`top`,t),right:e.getShallow(`right`,t),bottom:e.getShallow(`bottom`,t),width:e.getShallow(`width`,t),height:e.getShallow(`height`,t)}}function aC(e,t,n){n=KS(n||0);var r=t.width,i=t.height,a=Ep(e.left,r),o=Ep(e.top,i),s=Ep(e.right,r),c=Ep(e.bottom,i),l=Ep(e.width,r),u=Ep(e.height,i),d=n[2]+n[0],f=n[1]+n[3],p=e.aspect;switch(isNaN(l)&&(l=r-s-f-a),isNaN(u)&&(u=i-c-d-o),p!=null&&(isNaN(l)&&isNaN(u)&&(p>r/i?l=r*.8:u=i*.8),isNaN(l)&&(l=p*u),isNaN(u)&&(u=l/p)),isNaN(a)&&(a=r-s-l-f),isNaN(o)&&(o=i-c-u-d),e.left||e.right){case`center`:a=r/2-l/2-n[3];break;case`right`:a=r-l-f}switch(e.top||e.bottom){case`middle`:case`center`:o=i/2-u/2-n[0];break;case`bottom`:o=i-u-d}a||=0,o||=0,isNaN(l)&&(l=r-f-a-(s||0)),isNaN(u)&&(u=i-d-o-(c||0));var m=new Z((t.x||0)+a+n[3],(t.y||0)+o+n[0],l,u);return m.margin=n,m}function oC(e,t,n){var r=e.getShallow(`preserveAspect`,!0);if(!r)return t;var i=t.width/t.height;if(Math.abs(Math.atan(n)-Math.atan(i))<1e-9)return t;var a=e.getShallow(`preserveAspectAlign`,!0),o=e.getShallow(`preserveAspectVerticalAlign`,!0),s={width:t.width,height:t.height},c=r===`cover`;return i>n&&!c||i=u)return a;for(var d=0;d=0;o--)a=eo(a,n[o],!0);t.defaultOption=a}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+`Index`,r=e+`Id`;return Nm(this.ecModel,e,{index:this.get(n,!0),id:this.get(r,!0)},t)},t.prototype.getBoxLayoutParams=function(){return iC(this,!1)},t.prototype.getZLevelKey=function(){return``},t.prototype.setZLevel=function(e){this.option.zlevel=e},t.protoInitialize=function(){var e=t.prototype;e.type=`component`,e.id=``,e.name=``,e.mainType=``,e.subType=``,e.componentIndex=0}(),t}(wy);Xo(hC,wy),ts(hC),Ox(hC),kx(hC,gC);function gC(e){var t=[];return H(hC.getClassesByMainType(e),function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])}),t=U(t,function(e){return Go(e).main}),e!==`dataset`&&ro(t,`dataset`)<=0&&t.unshift(`dataset`),t}var _C=Om(),vC=Om(),yC=function(){function e(){}return e.prototype.getColorFromPalette=function(e,t,n){var r=sm(this.get(`color`,!0)),i=this.get(`colorLayer`,!0);return SC(this,_C,r,i,e,t,n)},e.prototype.clearColorPalette=function(){CC(this,_C)},e}();function bC(e,t,n,r){return SC(e,vC,sm(e.get([`aria`,`decal`,`decals`])),null,t,n,r)}function xC(e,t){for(var n=e.length,r=0;rt)return e[r];return e[n-1]}function SC(e,t,n,r,i,a,o){a||=e;var s=t(a),c=s.paletteIdx||0,l=s.paletteNameMap=s.paletteNameMap||{};if(l.hasOwnProperty(i))return l[i];var u=o==null||!r?n:xC(r,o);if(u||=n,u&&u.length){var d=u[c];return i&&(l[i]=d),s.paletteIdx=(c+1)%u.length,d}}function CC(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var wC=/\{@(.+?)\}/g,TC=function(){function e(){}return e.prototype.getDataParams=function(e,t){var n=this.getData(t),r=this.getRawValue(e,t),i=n.getRawIndex(e),a=n.getName(e),o=n.getRawDataItem(e),s=n.getItemVisual(e,`style`),c=s&&s[n.getItemVisual(e,`drawType`)||`fill`],l=s&&s.stroke,u=this.mainType,d=u===`series`,f=n.userOutput&&n.userOutput.get();return{componentType:u,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:d?this.subType:null,seriesIndex:this.seriesIndex,seriesId:d?this.id:null,seriesName:d?this.name:null,name:a,dataIndex:i,data:o,dataType:t,value:r,color:c,borderColor:l,dimensionNames:f?f.fullDimensions:null,encode:f?f.encode:null,$vars:[`seriesName`,`name`,`value`]}},e.prototype.getFormattedLabel=function(e,t,n,r,i,a){t||=`normal`;var o=this.getData(n),s=this.getDataParams(e,n);if(a&&(s.value=a.interpolatedValue),r!=null&&G(s.value)&&(s.value=s.value[r]),i||=o.getItemModel(e).get(t===`normal`?[`label`,`formatter`]:[t,`label`,`formatter`]),K(i))return s.status=t,s.dimensionIndex=r,i(s);if(q(i))return XS(i,s).replace(wC,function(t,n){var r=n.length,i=n;i.charAt(0)===`[`&&i.charAt(r-1)===`]`&&(i=+i.slice(1,r-1));var s=db(o,e,i);if(a&&G(a.interpolatedValue)){var c=o.getDimensionIndex(i);c>=0&&(s=a.interpolatedValue[c])}return s==null?``:s+``})},e.prototype.getRawValue=function(e,t){return db(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function EC(e){var t,n;return J(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function DC(e){return new OC(e)}var OC=function(){function e(e){e||={},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return e.prototype.perform=function(e){var t=this._upstream,n=e&&e.skip;if(this._dirty&&t){var r=this.context;r.data=r.outputData=t.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=this._plan(this.context));var a=l(this._modBy),o=this._modDataCount||0,s=l(e&&e.modBy),c=e&&e.modDataCount||0;(a!==s||o!==c)&&(i=`reset`);function l(e){return!(e>=1)&&(e=1),e}var u;(this._dirty||i===`reset`)&&(this._dirty=!1,u=this._doReset(n)),this._modBy=s,this._modDataCount=c;var d=e&&e.step;if(this._dueEnd=t?t._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var f=this._dueIndex,p=Math.min(d==null?1/0:this._dueIndex+d,this._dueEnd);if(!n&&(u||f1&&r>0?s:o}};return a;function o(){return t=e?null:a9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+`_`+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,t=this._getUpstreamSourceManagers(),n=!!t.length,r,i;if(HC(e)){var a=e,o=void 0,s=void 0,c=void 0;if(n){var l=t[0];l.prepareSource(),c=l.getSource(),o=c.data,s=c.sourceFormat,i=[l._getVersionSign()]}else o=a.get(`data`,!0),s=_o(o)?dh:sh,i=[];var u=this._getSourceMetaRawOption()||{},d=c&&c.metaRawOption||{},f=Y(u.seriesLayoutBy,d.seriesLayoutBy)||null,p=Y(u.sourceHeader,d.sourceHeader),m=Y(u.dimensions,d.dimensions);r=f!==d.seriesLayoutBy||!!p!=!!d.sourceHeader||m?[Ry(o,{seriesLayoutBy:f,sourceHeader:p,dimensions:m},s)]:[]}else{var h=e;if(n){var g=this._applyTransform(t);r=g.sourceList,i=g.upstreamSignList}else r=[Ry(h.get(`source`,!0),this._getSourceMetaRawOption(),null)],i=[]}this._setLocalSource(r,i)},e.prototype._applyTransform=function(e){var t=this._sourceHost,n=t.get(`transform`,!0),r=t.get(`fromTransformResult`,!0);r!=null&&e.length!==1&&UC(``);var i,a=[],o=[];return H(e,function(e){e.prepareSource();var t=e.getSource(r||0);r!=null&&!t&&UC(``),a.push(t),o.push(e._getVersionSign())}),n?i=RC(n,a,{datasetIndex:t.componentIndex}):r!=null&&(i=[By(a[0])]),{sourceList:i,upstreamSignList:o}},e.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),t=0;t{I(e)}):I(e)}function I(e){if(e)try{e.body&&fe(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function de(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function fe(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function pe(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:be(r);let i=xe(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+b(s.paddingLeft)+b(o.marginLeft),top:-i.offsetTop+b(s.paddingTop)+b(o.marginTop),right:ne(a)-ee(i)-i.offsetLeft+b(s.paddingRight)-b(o.marginRight),bottom:te(a)-P(i)-i.offsetTop+b(s.paddingBottom)-b(o.marginBottom)}}return y(r.right)&&(t=Math.min(t,r.right)),y(r.bottom)&&(n=Math.min(n,r.bottom)),y(r.left)&&(t=Math.max(t,r.left)),y(r.top)&&(n=Math.max(n,r.top)),[t,n]}function me(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function he(e){return e.props.axis===`both`||e.props.axis===`x`}function ge(e){return e.props.axis===`both`||e.props.axis===`y`}function _e(e,t,n){let r=typeof t==`number`?se(e,t):null;if(typeof t==`number`&&!r)return null;let i=xe(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return re(r||e,a,n.props.scale)}function ve(e,t,n){let r=!y(e.lastX),i=xe(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function ye(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function be(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function xe(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var Se=u(C()),Ce=u(Hr()),we=u(T()),Te=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Ee={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},De=Ee.mouse,Oe=class extends Se.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ce(e);this.touchIdentifier=r;let i=_e(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=ve(this,a,o);Te(`DraggableCore: handleDragStart: %j`,s),Te(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&ue(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,De.move,this.handleDrag),M(n,De.stop,this.handleDragStop))},this.handleDrag=e=>{let t=_e(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=me(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=ve(this,n,r);if(Te(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=_e(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=me(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=ve(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&F(a.ownerDocument),Te(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Te(`DraggableCore: Removing handlers`),N(a.ownerDocument,De.move,this.handleDrag),N(a.ownerDocument,De.stop,this.handleDragStop))},this.onMouseDown=e=>(De=Ee.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(De=Ee.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(De=Ee.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(De=Ee.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Ee.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Ee.mouse.move,this.handleDrag),N(t,Ee.touch.move,this.handleDrag),N(t,Ee.mouse.stop,this.handleDragStop),N(t,Ee.touch.stop,this.handleDragStop),N(e,Ee.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&F(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=we.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Te(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return Se.cloneElement(Se.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Oe.displayName=`DraggableCore`,Oe.propTypes={allowAnyClick:Ce.default.bool,allowMobileScroll:Ce.default.bool,children:Ce.default.node.isRequired,disabled:Ce.default.bool,enableUserSelectHack:Ce.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:Ce.default.arrayOf(Ce.default.number),handle:Ce.default.string,cancel:Ce.default.string,nodeRef:Ce.default.object,nonce:Ce.default.string,onStart:Ce.default.func,onDrag:Ce.default.func,onStop:Ce.default.func,onMouseDown:Ce.default.func,scale:Ce.default.number,className:x,style:x,transform:x},Oe.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var ke=class extends p.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Te(`Draggable: onDragStart: %j`,t),this.props.onStart(e,ye(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Te(`Draggable: onDrag: %j`,t);let n=ye(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=pe(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,ye(this,t))===!1)return!1;Te(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Te(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=h.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,m=!s||this.state.dragging,h=s||r,_={x:he(this)&&m?this.state.x:h.x,y:ge(this)&&m?this.state.y:h.y};this.state.isElementSVG?f=ae(_,c):d=ie(_,c);let v=p.Children.only(n),y=(0,g.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return p.createElement(Oe,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},p.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};ke.displayName=`Draggable`,ke.propTypes={...Oe.propTypes,axis:m.default.oneOf([`both`,`x`,`y`,`none`]),bounds:m.default.oneOfType([m.default.shape({left:m.default.number,right:m.default.number,top:m.default.number,bottom:m.default.number}),m.default.string,m.default.oneOf([!1])]),defaultClassName:m.default.string,defaultClassNameDragging:m.default.string,defaultClassNameDragged:m.default.string,defaultPosition:m.default.shape({x:m.default.number,y:m.default.number}),positionOffset:m.default.shape({x:m.default.oneOfType([m.default.number,m.default.string]),y:m.default.oneOfType([m.default.number,m.default.string])}),position:m.default.shape({x:m.default.number,y:m.default.number}),className:x,style:x,transform:x},ke.defaultProps={...Oe.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(t.exports={DraggableCore:Oe})})),Ri=h(((e,t)=>{var n=Li(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),zi=h((e=>{e.__esModule=!0,e.cloneElement=c;var t=n(C());function n(e){return e&&e.__esModule?e:{default:e}}function r(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 i(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(Hr());Ri();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Vi=h((e=>{e.__esModule=!0,e.default=void 0;var t=o(C()),n=Ri(),r=zi(),i=Bi(),a=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function o(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(o=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;tMath.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,n){let r=this.props.handle;if(!r)return t.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:n});if(typeof r==`function`)return r(e,n);let i=typeof r.type==`string`,a=u({ref:n},i?{}:{handleAxis:e});return t.cloneElement(r,a)}render(){let e=this.props,i=e.children,o=e.className,l=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let d=e.resizeHandles;e.transformScale;let f=c(e,a);return(0,r.cloneElement)(i,u(u({},f),{},{className:(o?o+` `:``)+`react-resizable`,children:[...t.Children.toArray(i.props.children),...d.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,s({},l,{nodeRef:r,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,r))})]}))}};e.default=m,m.propTypes=i.resizableProps,m.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Hi=h((e=>{e.__esModule=!0,e.default=void 0;var t=s(C()),n=o(Hr()),r=o(Vi()),i=Bi(),a=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,n=e.handle,i=e.handleSize;e.onResize;let o=e.onResizeStart,s=e.onResizeStop,l=e.draggableOpts,d=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,h=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=m(e,a);return t.createElement(r.default,{axis:h,draggableOpts:l,handle:n,handleSize:i,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:d,onResizeStart:o,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},t.createElement(`div`,c({},y,{style:u(u({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=h,h.propTypes=u(u({},i.resizableProps),{},{children:n.default.element})})),Ui=h(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Vi().default,t.exports.ResizableBox=Hi().default})),Wi=h(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(e,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function O(e,t){return D(e,t,new WeakMap)}var k=c(r(S,{createIsNestedEqual:function(){return o}}));function A(e,t){return k(e,t,new WeakMap)}function j(e){return c(r(x,e(x)))}function M(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=O,e.circularShallowEqual=A,e.createCustomCircularEqual=M,e.createCustomEqual=j,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),Gi=Ui(),Ki=Wi();function qi(e){let{children:t,cols:n,containerWidth:r,margin:i,containerPadding:a,rowHeight:o,maxRows:s,isDraggable:c,isResizable:l,isBounded:u,static:d,useCSSTransforms:f=!0,usePercentages:m=!1,transformScale:h=1,positionStrategy:g,dragThreshold:_=0,droppingPosition:v,className:y=``,style:b,handle:x=``,cancel:S=``,x:C,y:w,w:T,h:E,minW:D=1,maxW:O=1/0,minH:k=1,maxH:A=1/0,i:j,resizeHandles:M,resizeHandle:N,constraints:P=tr,layoutItem:ee,layout:te=[],onDragStart:ne,onDrag:re,onDragStop:ie,onResizeStart:ae,onResize:oe,onResizeStop:se}=e,[ce,le]=(0,L.useState)(!1),[ue,F]=(0,L.useState)(!1),I=(0,L.useRef)(null),de=(0,L.useRef)({left:0,top:0}),fe=(0,L.useRef)({top:0,left:0,width:0,height:0}),pe=(0,L.useRef)(void 0),me=(0,L.useRef)(te);me.current=te;let he=(0,L.useRef)(null),ge=(0,L.useRef)(null),_e=(0,L.useRef)(!1),ve=(0,L.useRef)({x:0,y:0}),ye=(0,L.useRef)(!1),be=(0,L.useMemo)(()=>({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),xe=(0,L.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),Se=(0,L.useCallback)(()=>({...xe,layout:me.current}),[xe]),Ce=(0,L.useMemo)(()=>ee??{i:j,x:C,y:w,w:T,h:E,minW:D,maxW:O,minH:k,maxH:A},[ee,j,C,w,T,E,D,O,k,A]),we=(0,L.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(f)return ir(e);let t=ar(e);return m?{...t,left:or(e.left/r),width:or(e.width/r)}:t},[g,f,m,r]),Te=(0,L.useCallback)((e,{node:t})=>{if(!ne)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(de.current=l,_>0){let t=e;ve.current={x:t.clientX,y:t.clientY},_e.current=!0,ye.current=!1,le(!0);return}le(!0);let u=Fn(be,l.top,l.left),{x:d,y:f}=nr(P,Ce,u.x,u.y,Se());ne(j,d,f,{e,node:t,newPosition:l})},[ne,h,be,g,_,P,Ce,Se,j]),Ee=(0,L.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!re||!ce)return;let s=e;if(_e.current&&!ye.current){let n=s.clientX-ve.current.x,r=s.clientY-ve.current.y;if(Math.hypot(n,r)<_)return;if(ye.current=!0,_e.current=!1,ne){let n=Fn(be,de.current.top,de.current.left),{x:r,y:i}=nr(P,Ce,n.x,n.y,Se());ne(j,r,i,{e,node:t,newPosition:de.current})}}let c=de.current.top+a,l=de.current.left+n;if(u){let{offsetParent:e}=t;if(e){let t=e.clientHeight-Mn(E,o,i[1]);c=Ln(c,0,t);let n=jn(be),a=r-Mn(T,n,i[0]);l=Ln(l,0,a)}}let d={top:c,left:l};de.current=d;let f=Fn(be,c,l),{x:p,y:m}=nr(P,Ce,f.x,f.y,Se());re(j,p,m,{e,node:t,newPosition:d})},[re,ne,ce,_,u,E,o,i,be,r,T,j,P,Ce,Se]),De=(0,L.useCallback)((e,{node:t})=>{if(!ie||!ce)return;let n=_e.current;if(_e.current=!1,ye.current=!1,ve.current={x:0,y:0},n){le(!1),de.current={left:0,top:0};return}let{left:r,top:i}=de.current,a={top:i,left:r};le(!1),de.current={left:0,top:0};let o=Fn(be,i,r),{x:s,y:c}=nr(P,Ce,o.x,o.y,Se());ie(j,s,c,{e,node:t,newPosition:a})},[ie,ce,be,P,Ce,Se,j]);he.current=Te,ge.current=Ee;let Oe=(0,L.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ae:o===`onResize`?oe:se;if(!s)return;let c;c=t?gr(i,a,n,r):{...n,top:a.top,left:a.left},fe.current=c;let l=In(be,c.width,c.height),{w:u,h:d}=rr(P,Ce,l.w,l.h,i,Se());s(j,u,d,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[ae,oe,se,r,be,j,P,Ce,Se]),ke=(0,L.useCallback)((e,t)=>{F(!0);let n=Nn(be,C,w,T,E),r={...t,handle:t.handle};Oe(e,r,n,`onResizeStart`)},[Oe,be,C,w,T,E]),Ae=(0,L.useCallback)((e,t)=>{let n=Nn(be,C,w,T,E),r={...t,handle:t.handle};Oe(e,r,n,`onResize`)},[Oe,be,C,w,T,E]),je=(0,L.useCallback)((e,t)=>{F(!1),fe.current={top:0,left:0,width:0,height:0};let n=Nn(be,C,w,T,E),r={...t,handle:t.handle};Oe(e,r,n,`onResizeStop`)},[Oe,be,C,w,T,E]);(0,L.useEffect)(()=>{if(!v)return;let e=I.current;if(!e)return;let t=pe.current||{left:0,top:0},n=ce&&(v.left!==t.left||v.top!==t.top);if(!ce){let t={node:e,deltaX:v.left,deltaY:v.top,lastX:0,lastY:0,x:v.left,y:v.top};he.current?.(v.e,t)}else if(n){let t={node:e,deltaX:v.left-de.current.left,deltaY:v.top-de.current.top,lastX:de.current.left,lastY:de.current.top,x:v.left,y:v.top};ge.current?.(v.e,t)}pe.current=v},[v,ce,j]);let Me=Nn(be,C,w,T,E,ce?de.current:null,ue?fe.current:null),Ne=L.Children.only(t),Pe=jn(be),Fe=[Mn(D,Pe,i[0]),Mn(k,o,i[1])],Ie=[Mn(O,Pe,i[0]),Mn(A,o,i[1])],Le=Ne.props,Re=Le.className,ze=Le.style,Be=L.cloneElement(Ne,{ref:I,className:p(`react-grid-item`,Re,y,{static:d,resizing:ue,"react-draggable":c,"react-draggable-dragging":ce,dropping:!!v,cssTransforms:f}),style:{...b,...ze,...we(Me)}}),Ve=N;return Be=(0,R.jsx)(Gi.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Me.width,height:Me.height,minConstraints:Fe,maxConstraints:Ie,onResizeStart:ke,onResize:Ae,onResizeStop:je,transformScale:h,resizeHandles:M,handle:Ve,children:Be}),Be=(0,R.jsx)(Pi,{disabled:!c,onStart:Te,onDrag:Ee,onStop:De,handle:x,cancel:`.react-resizable-handle`+(S?`,`+S:``),scale:h,nodeRef:I,children:Be}),Be}var Ji=()=>{},Yi=`react-grid-layout`,Xi=!1;try{Xi=/firefox/i.test(navigator.userAgent)}catch{}function Zi(e,t){let n=L.Children.toArray(e),r=L.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!L.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(qn(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:Wn(i),w:1,h:1})}});let o=Zn(i,{cols:n});return r.compact(o,n)}function $i(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=br,compactor:c,constraints:l=tr,layout:u=[],droppingItem:d,autoSize:f=!0,className:m=``,style:h={},innerRef:g,onLayoutChange:_=Ji,onDragStart:v=Ji,onDrag:y=Ji,onDragStop:b=Ji,onResizeStart:x=Ji,onResize:S=Ji,onResizeStop:C=Ji,onDrop:w=Ji,onDropDragOver:T=Ji}=e,E=(0,L.useMemo)(()=>({...xr,...r}),[r]),D=(0,L.useMemo)(()=>({...Sr,...i}),[i]),O=(0,L.useMemo)(()=>({...Cr,...a}),[a]),k=(0,L.useMemo)(()=>({...wr,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:ee,bounded:te,handle:ne,cancel:re,threshold:ie}=D,{enabled:ae,handles:oe,handleComponent:se}=O,{enabled:ce,defaultItem:le,onDragOver:ue}=k,F=c??Pr(`vertical`),I=F.type,de=F.allowOverlap,fe=F.preventCollision??!1,pe=(0,L.useMemo)(()=>d??{i:`__dropping-elem__`,...le},[d,le]),me=s.type===`transform`,he=s.scale,ge=P??N,[_e,ve]=(0,L.useState)(!1),[ye,be]=(0,L.useState)(()=>Qi(u,t,A,F)),[xe,Se]=(0,L.useState)(null),[Ce,we]=(0,L.useState)(!1),[Te,Ee]=(0,L.useState)(null),[De,Oe]=(0,L.useState)(),ke=(0,L.useRef)(null),Ae=(0,L.useRef)(null),je=(0,L.useRef)(null),Me=(0,L.useRef)(0),Ne=(0,L.useRef)(ye),Pe=(0,L.useRef)(u),Fe=(0,L.useRef)(t),Ie=(0,L.useRef)(I),Le=(0,L.useRef)(ye);Le.current=ye,(0,L.useEffect)(()=>{ve(!0),(0,Ki.deepEqual)(ye,u)||_(ye)},[]),(0,L.useEffect)(()=>{if(xe||Te)return;let e=!(0,Ki.deepEqual)(u,Pe.current),n=!Zi(t,Fe.current),r=I!==Ie.current;if(e||n||r){let n=Qi(e?u:ye,t,A,F);(0,Ki.deepEqual)(n,ye)||be(n)}Pe.current=u,Fe.current=t,Ie.current=I},[u,t,A,I,F,xe,Te,ye]),(0,L.useEffect)(()=>{if(!xe&&!(0,Ki.deepEqual)(ye,Ne.current)){Ne.current=ye;let e=ye.filter(e=>e.i!==pe.i);_(e)}},[ye,xe,_,pe.i]);let Re=(0,L.useMemo)(()=>{if(!f)return;let e=Wn(ye),t=ge[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,ye,j,N,ge]),ze=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=Gn(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};ke.current=qn(a),je.current=i,Se(o),v(i,a,a,null,r.e,r.node)},[v]),Be=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=ke.current,o=Gn(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=Qn(i,o,t,n,!0,fe,I,A,de);y(c,a,o,s,r.e,r.node),be(F.compact(c,A)),Se(s)},[fe,I,A,de,F,y]),Ve=(0,L.useCallback)((e,t,n,r)=>{if(!xe)return;let i=Le.current,a=ke.current,o=Gn(i,e);if(!o)return;let s=Qn(i,o,t,n,!0,fe,I,A,de),c=F.compact(s,A);b(c,a,o,null,r.e,r.node);let l=je.current;ke.current=null,je.current=null,Se(null),be(c),l&&!(0,Ki.deepEqual)(l,c)&&_(c)},[xe,fe,I,A,de,F,b,_]),He=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=Gn(i,e);a&&(Ae.current=qn(a),je.current=i,we(!0),x(i,a,a,null,r.e,r.node))},[x]),Ue=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=Ae.current,{handle:o}=r,s=!1,c,l,[u,d]=Xn(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),fe&&!de&&Bn(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=Qn(u,d,c,l,!0,fe,I,A,de));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};S(f,a,d,p,r.e,r.node),be(F.compact(f,A)),Se(p)},[fe,I,A,de,F,S]),We=(0,L.useCallback)((e,t,n,r)=>{let i=Le.current,a=Ae.current,o=Gn(i,e),s=F.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=je.current;Ae.current=null,je.current=null,Se(null),we(!1),be(s),c&&!(0,Ki.deepEqual)(c,s)&&_(s)},[A,F,C,_]),Ge=(0,L.useCallback)(()=>{let e=Le.current;if(!e.some(e=>e.i===pe.i)){Ee(null),Se(null),Oe(void 0);return}let t=F.compact(e.filter(e=>e.i!==pe.i),A);be(t),Ee(null),Se(null),Oe(void 0)},[pe.i,A,F]),Ke=(0,L.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),Xi&&!e.nativeEvent.target?.classList.contains(Yi))return!1;let t=ue?ue(e.nativeEvent):T(e);if(t===!1)return Te&&Ge(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...pe,...a},s=e.currentTarget.getBoundingClientRect(),c={cols:A,margin:N,maxRows:M,rowHeight:j,containerWidth:n,containerPadding:ge},l=jn(c),u=Mn(o.w,l,N[0]),d=Mn(o.h,j,N[1]),f=u/2,p=d/2,m=e.clientX-s.left+r-f,h=e.clientY-s.top+i-p,g=Math.max(0,m),_=Math.max(0,h),v={left:g/he,top:_/he,e:e.nativeEvent};if(Te)De&&(De.left!==v.left||De.top!==v.top)&&Oe(v);else{let e=Pn(c,_,g,o.w,o.h);Ee((0,R.jsx)(`div`,{},o.i)),Oe(v);let t=Le.current.filter(e=>e.i!==o.i);be([...t,{...o,x:e.x,y:e.y,static:!1,isDraggable:!0}])}},[Te,De,pe,ue,T,Ge,he,A,N,M,j,n,ge]),qe=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current--,Me.current<0&&(Me.current=0),Me.current===0&&Ge()},[Ge]),Je=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current++},[]),Ye=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=Le.current,n=t.find(e=>e.i===pe.i);Me.current=0,Ge(),w(t,n,e.nativeEvent)},[pe.i,Ge,w]),Xe=(0,L.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=Gn(ye,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&ee,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ae,o=r.resizeHandles||[...oe],c=i&&te&&r.isBounded!==!1,u=se;return(0,R.jsx)(qi,{containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,cancel:re,handle:ne,onDragStart:ze,onDrag:Be,onDragStop:Ve,onResizeStart:He,onResize:Ue,onResizeStop:We,isDraggable:i,isResizable:a,isBounded:c,useCSSTransforms:me&&_e,usePercentages:!_e,transformScale:he,positionStrategy:s,dragThreshold:ie,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?De:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:ye,children:e},r.i)},[ye,n,A,N,ge,M,j,re,ne,ze,Be,Ve,He,Ue,We,ee,ae,te,me,_e,he,s,ie,De,oe,se,l]),Ze=()=>xe?(0,R.jsx)(qi,{w:xe.w,h:xe.h,x:xe.x,y:xe.y,i:xe.i,className:`react-grid-placeholder ${Ce?`placeholder-resizing`:``}`,containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:me,transformScale:he,constraints:l,layout:ye,children:(0,R.jsx)(`div`,{})}):null,Qe=p(Yi,m),$e={height:Re,...h};return(0,R.jsxs)(`div`,{ref:g,className:Qe,style:$e,onDrop:ce?Ye:void 0,onDragLeave:ce?qe:void 0,onDragEnter:ce?Je:void 0,onDragOver:ce?Ke:void 0,children:[L.Children.map(t,e=>L.isValidElement(e)?Xe(e):null),ce&&Te&&Xe(Te,!0),Ze()]})}var ea={lg:1200,md:996,sm:768,xs:480,xxs:0},ta={lg:12,md:10,sm:6,xs:4,xxs:2},na=()=>{};function ra(e,t,n,r){let i=[];L.Children.forEach(t,t=>{if(!L.isValidElement(t)||t.key===null)return;let n=String(t.key),r=e.find(e=>e.i===n);if(r)i.push({...r,i:n});else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:Wn(i),w:1,h:1})}});let a=Zn(i,{cols:n});return r.compact(a,n)}function ia(e){let{children:t,width:n,breakpoint:r,breakpoints:i=ea,cols:a=ta,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=na,onLayoutChange:p=na,onWidthChange:m=na,...h}=e,g=d??Pr(`vertical`),_=g.type,v=g.allowOverlap,y=(0,L.useMemo)(()=>r??Ir(i,n),[]),b=(0,L.useMemo)(()=>Lr(y,a),[y,a]),x=(0,L.useMemo)(()=>Rr(o,i,y,y,b,_),[]),[S,C]=(0,L.useState)(y),[w,T]=(0,L.useState)(b),[E,D]=(0,L.useState)(x),[O,k]=(0,L.useState)(o),A=(0,L.useRef)(n),j=(0,L.useRef)(r),M=(0,L.useRef)(i),N=(0,L.useRef)(a),P=(0,L.useRef)(o),ee=(0,L.useRef)(_),te=(0,L.useRef)(O);(0,L.useEffect)(()=>{te.current=O},[O]);let ne=(0,L.useMemo)(()=>(0,Ki.deepEqual)(o,P.current)?null:Rr(o,i,S,S,w,g),[o,i,S,w,g]),re=ne??E;(0,L.useEffect)(()=>{ne!==null&&(D(ne),k(o),te.current=o,P.current=o)},[ne,o]),(0,L.useEffect)(()=>{if(_!==ee.current){let e=g.compact(Jn(re),w),t={...te.current,[S]:e};D(e),k(t),te.current=t,p(e,t),ee.current=_}},[_,g,re,w,v,S,p]),(0,L.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,Ki.deepEqual)(i,M.current),c=!(0,Ki.deepEqual)(a,N.current);if(e||o||s||c){let e=r??Ir(i,n),o=Lr(e,a),d=S;if(d!==e||s||c){let n={...te.current};n[d]||(n[d]=Jn(E));let r=Rr(n,i,e,d,o,g);r=ra(r,t,o,g),n[e]=r,C(e),T(o),D(r),k(n),te.current=n,f(e,o),p(r,n)}let h=zr(l,e),_=u?zr(u,e):null;m(n,h,o,_),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let ie=(0,L.useCallback)(e=>{let t={...te.current,[S]:e};D(e),k(t),te.current=t,p(e,t)},[S,p]),ae=(0,L.useMemo)(()=>zr(l,S),[l,S]),oe=(0,L.useMemo)(()=>u===null?null:zr(u,S),[u,S]),se=(0,L.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:ae,containerPadding:oe}),[w,s,c,ae,oe]);return(0,R.jsx)($i,{...h,width:n,gridConfig:se,compactor:g,onLayoutChange:ie,layout:re,children:t})}function aa(e){let{children:t,width:n,breakpoint:r,breakpoints:i,cols:a,layouts:o,onBreakpointChange:s,onLayoutChange:c,onWidthChange:l,rowHeight:u,maxRows:d,margin:f,containerPadding:p,droppingItem:m,compactType:h,preventCollision:g=!1,allowOverlap:_=!1,verticalCompact:v,isDraggable:y=!0,isBounded:b=!1,draggableHandle:x,draggableCancel:S,isResizable:C=!0,resizeHandles:w=[`se`],resizeHandle:T,isDroppable:E=!1,useCSSTransforms:D=!0,transformScale:O=1,autoSize:k,className:A,style:j,innerRef:M,onDragStart:N,onDrag:P,onDragStop:ee,onResizeStart:te,onResize:ne,onResizeStop:re,onDrop:ie,onDropDragOver:ae}=e,oe=h===void 0?`vertical`:h;v===!1&&(oe=null);let se={enabled:y,bounded:b,handle:x,cancel:S},ce={enabled:C,handles:w,handleComponent:T},le={enabled:E},ue;ue=D?O===1?_r:yr(O):vr;let F=Pr(oe,_,g);return(0,R.jsx)(ia,{width:n,breakpoint:r,breakpoints:i,cols:a,layouts:o,rowHeight:u,maxRows:d,margin:f,containerPadding:p,compactor:F,dragConfig:se,resizeConfig:ce,dropConfig:le,positionStrategy:ue,droppingItem:m,autoSize:k,className:A,style:j,innerRef:M,onBreakpointChange:s,onLayoutChange:c,onWidthChange:l,onDragStart:N,onDrag:P,onDragStop:ee,onResizeStart:te,onResize:ne,onResizeStop:re,onDrop:ie,onDropDragOver:ae,children:t})}aa.displayName=`ResponsiveReactGridLayout`;var oa=aa,sa=`react-grid-layout`;function ca(e){function t(t){let{measureBeforeMount:n=!1,className:r,style:i,...a}=t,[o,s]=(0,L.useState)(1280),[c,l]=(0,L.useState)(!1),u=(0,L.useRef)(null),d=(0,L.useRef)(null);return(0,L.useEffect)(()=>{l(!0)},[]),(0,L.useEffect)(()=>{let e=u.current;if(!(e instanceof HTMLElement))return;let t=null,n=new ResizeObserver(e=>{if(e[0]){let n=Math.round(e[0].contentRect.width);t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{s(e=>e===n?e:n),t=null})}});return n.observe(e),d.current=n,()=>{t!==null&&cancelAnimationFrame(t),n.unobserve(e),n.disconnect()}},[c]),n&&!c?(0,R.jsx)(`div`,{className:p(r,sa),style:i,ref:u}):(0,R.jsx)(e,{innerRef:u,className:r,style:i,...a,width:o})}return t.displayName=`WidthProvider(${e.displayName||e.name||`Component`})`,t}function la(e){return e.reduce((e,t)=>Math.max(e,t.y+t.h),0)}function ua(e,t){return e.map(e=>({...e,x:0,w:t,minW:Math.min(e.minW??1,t)}))}var da=[`overview`,`topology`,`activity`,`assistant`,`performance`,`trace`,`logs`],fa={overview:{w:4,h:3,minW:3,minH:3},activity:{w:4,h:5,minW:3,minH:4},assistant:{w:4,h:3,minW:3,minH:3},topology:{w:8,h:5,minW:4,minH:4},performance:{w:8,h:5,minW:4,minH:4},logs:{w:8,h:5,minW:4,minH:4},trace:{w:8,h:4,minW:4,minH:4}};function pa(e,t){return e.xe.y)),o=(t,r)=>!e.some(e=>pa(e,{x:t,y:a,w:r,h:n}));for(let e=0;e+t<=r;e+=1)if(o(e,t))return{x:e,y:a,w:t};let s=e.reduce((e,t)=>pa(t,{x:0,y:a,w:r,h:n})?Math.max(e,t.x+t.w):e,0),c={x:s,w:0};for(let e=Math.min(s,r);ec.w&&(c={x:e,w:t-e}),e=t}return c.w>=i?{x:c.x,y:a,w:c.w}:{x:0,y:la(e),w:t}}var ha=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function ga(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function _a(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${_a(-e)}`;if(e===0)return`0ms`;if(e<.01)return`<0.01ms`;if(e<1)return`${e.toFixed(2)}ms`;if(Math.round(e*10)/10<100)return`${e.toFixed(1)}ms`;if(Math.round(e)<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100)/10;if(t<10)return`${(e/1e3).toFixed(2)}s`;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(e/1e3),r=Math.floor(n/60),i=n%60;if(r<60)return i===0?`${r}m`:`${r}m ${i}s`;let a=Math.floor(r/60),o=r%60;return o===0?`${a}h`:`${a}h ${o}m`}function va(e,t,n=!1){let r=new Date(e);if(Number.isNaN(r.valueOf()))return e;let[i,a]=t.split(`/`),o=new Date(i),s=new Date(a),c=!Number.isNaN(o.valueOf())&&!Number.isNaN(s.valueOf())&&s.valueOf()-o.valueOf()>864e5;return r.toLocaleString([],{...c?{month:`short`,day:`numeric`}:{},hour:`numeric`,minute:`2-digit`,...n?{second:`2-digit`}:{}})}function ya(e){if(e>=2e3)return`bad`;if(e>=750)return`warn`}function ba(e){return e>=.05?`bad`:e>=.01?`warn`:`dimmed`}var xa=function(e,t){return xa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},xa(e,t)};function z(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);xa(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Sa=`12px sans-serif`,Ca=20,wa=100,Ta=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function Ea(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;c=Va&&(Ba=0),Ba++}function Ua(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function B(e){if(typeof e!=`object`||!e)return e;var t=e,n=ja.call(e);if(n===`[object Array]`){if(!yo(e)){t=[];for(var r=0,i=e.length;r`u`&&typeof self<`u`?Ao.worker=!0:!Ao.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(Ao.node=!0,Ao.svgSupported=!0):jo(navigator.userAgent,Ao);function jo(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var Mo=`.`,No=`___EC__COMPONENT__CONTAINER___`,Po=`___EC__EXTENDED_CLASS___`;function Fo(e){var t={main:``,sub:``};if(e){var n=e.split(Mo);t.main=n[0]||``,t.sub=n[1]||``}return t}function Io(e){ho(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function Lo(e){return!!(e&&e[Po])}function Ro(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return zo(t)?n=function(e){z(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},Ja(n,this)),V(n.prototype,e),n[Po]=!0,n.extend=this.extend,n.superCall=Uo,n.superApply=Wo,n.superClass=t,n}}function zo(e){return K(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function Bo(e,t){e.extend=t.extend}var Vo=Math.round(Math.random()*10);function Ho(e){var t=[`__\0is_clz`,Vo++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function Uo(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function Wo(e,t,n){return this.superClass.prototype[t].apply(e,n)}function Go(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){Io(r),e.prototype.type=r;var i=Fo(r);if(!i.sub)t[i.main]=e;else if(i.sub!==No){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[No]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=Fo(e),r=[],i=t[n.main];return i&&i[No]?H(i,function(e,t){t!==No&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[Fo(e).main]},e.getAllClassMainTypes=function(){var e=[];return H(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[Fo(e).main];return n&&n[No]};function n(e){var n=t[e.main];return(!n||!n[No])&&(n=t[e.main]={},n[No]=!0),n}}function Ko(e,t){for(var n=0;n=0||i&&qa(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var qo=Ko([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),Jo=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return qo(this,e,t)},e}(),Yo=function(){function e(e){this.value=e}return e}(),Xo=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Yo(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Zo=function(){function e(e){this._list=new Xo,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new Yo(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),Qo=new Zo(50);function $o(e){if(typeof e==`string`){var t=Qo.get(e);return t&&t.image}return e}function es(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=Qo.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!ns(t)&&a.pending.push(o)):(t=Oa.loadImage(e,ts,ts),t.__zrImageSrc=e,Qo.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}function ts(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;tu||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){Gs(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&Gs(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Fs.x=Ls.x=t.x,Fs.y=Rs.y=t.y,Is.x=Rs.x=t.x+t.width,Is.y=Ls.y=t.y+t.height,Fs.transform(n),Rs.transform(n),Is.transform(n),Ls.transform(n),e.x=As(Fs.x,Is.x,Ls.x,Rs.x),e.y=As(Fs.y,Is.y,Ls.y,Rs.y);var s=js(Fs.x,Is.x,Ls.x,Rs.x),c=js(Fs.y,Is.y,Ls.y,Rs.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=is(e||[]),ss(e,e,ms(Zs,-t.x,-t.y)),ls(e,e,ms(Zs,r,i)),ss(e,e,ms(Zs,n.x,n.y)),e},e}(),Us=Z.create,Ws=Z.set,Gs=Z.copy,Ks=Z.calculateTransform,qs=Z.applyTransform,Js=Z.contain,Ys=new Z(0,0,0,0),Xs=new Z(0,0,0,0),Zs=[];function Qs(e,t,n,r,i,a,o,s){var c=Ms(t-n),l=Ms(r-e),u=As(c,l),d=Ns[i],f=Ns[1-i],p=Ps[i];t=l||!zs.bidirectional)&&(Bs[d]=-l,Bs[f]=0,zs.useDir&&zs.calcDirMTV())))}function $s(){var e=0,t=new ks,n=new ks,r={minTv:new ks,maxTv:new ks,useDir:!1,dirMinTv:new ks,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=js(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=ic)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=Oa.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?rc=ic:i>2&&rc++,t}}var rc=0,ic=5;function ac(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=nc(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function oc(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=Oa.measureText(t,e.font).width,n.put(t,r)),r}function sc(e,t,n,r){var i=oc(ec(t),e),a=dc(t);return new Z(lc(0,i,n),uc(0,a,r),i,a)}function cc(e,t,n,r){var i=((e||``)+``).split(` +`);if(i.length===1)return sc(i[0],t,n,r);for(var a=new Z(0,0,0,0),o=0;o=0?parseFloat(e)/100*t:parseFloat(e):e}function pc(e,t,n){var r=t.position||`inside`,i=t.distance==null?5:t.distance,a=n.height,o=n.width,s=a/2,c=n.x,l=n.y,u=`left`,d=`top`;if(r instanceof Array)c+=fc(r[0],n.width),l+=fc(r[1],n.height),u=null,d=null;else switch(r){case`left`:c-=i,l+=s,u=`right`,d=`middle`;break;case`right`:c+=i+o,l+=s,d=`middle`;break;case`top`:c+=o/2,l-=i,u=`center`,d=`bottom`;break;case`bottom`:c+=o/2,l+=a+i,u=`center`;break;case`inside`:c+=o/2,l+=s,u=`center`,d=`middle`;break;case`insideLeft`:c+=i,l+=s,d=`middle`;break;case`insideRight`:c+=o-i,l+=s,u=`right`,d=`middle`;break;case`insideTop`:c+=o/2,l+=i,u=`center`;break;case`insideBottom`:c+=o/2,l+=a-i,u=`center`,d=`bottom`;break;case`insideTopLeft`:c+=i,l+=i;break;case`insideTopRight`:c+=o-i,l+=i,u=`right`;break;case`insideBottomLeft`:c+=i,l+=a-i,d=`bottom`;break;case`insideBottomRight`:c+=o-i,l+=a-i,u=`right`,d=`bottom`}return e||={},e.x=c,e.y=l,e.align=u,e.verticalAlign=d,e}var mc=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function hc(e,t,n,r,i,a){if(!n){e.text=``,e.isTruncated=!1;return}var o=(t+``).split(` +`);a=gc(n,r,i,a);for(var s=!1,c={},l=0,u=o.length;l=s;l++)c-=s;var u=oc(o,n);return u>c&&(n=``,u=0),c=e-u,i.ellipsis=n,i.ellipsisWidth=u,i.contentWidth=c,i.containerWidth=e,i}function _c(e,t,n){var r=n.containerWidth,i=n.contentWidth,a=n.fontMeasureInfo;if(!r){e.textLine=``,e.isTruncated=!1;return}var o=oc(a,t);if(o<=r){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=n.maxIterations){t+=n.ellipsis;break}var c=s===0?vc(t,i,a):o>0?Math.floor(t.length*i/o):0;t=t.substr(0,c),o=oc(a,t)}t===``&&(t=n.placeholder),e.textLine=t,e.isTruncated=!0}function vc(e,t,n){for(var r=0,i=0,a=e.length;ig&&p){var y=Math.floor(g/f);m||=_.length>y,_=_.slice(0,y),v=_.length*f}if(i&&u&&h!=null)for(var b=gc(h,l,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),x={},S=0;S<_.length;S++)_c(x,_[S],b),_[S]=x.textLine,m||=x.isTruncated;for(var C=g,w=0,T=ec(l),S=0;S<_.length;S++)w=Math.max(oc(T,_[S]),w);h??=w;var E=h;return C+=c,E+=s,{lines:_,height:g,outerWidth:E,outerHeight:C,lineHeight:f,calculatedLineHeight:d,contentWidth:w,contentHeight:v,width:h,isTruncated:m}}var bc=function(){function e(){}return e}(),xc=function(){function e(e){this.tokens=[],e&&(this.tokens=e)}return e}(),Sc=function(){function e(){this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.outerWidth=0,this.outerHeight=0,this.lines=[],this.isTruncated=!1}return e}();function Cc(e,t,n,r,i){var a=new Sc,o=Mc(e);if(!o)return a;var s=t.padding,c=s?s[1]+s[3]:0,l=s?s[0]+s[2]:0,u=t.width;u==null&&n!=null&&(u=n-c);var d=t.height;d==null&&r!=null&&(d=r-l);for(var f=t.overflow,p=(f===`break`||f===`breakAll`)&&u!=null?{width:u,accumWidth:0,breakAll:f===`breakAll`}:null,m=mc.lastIndex=0,h;(h=mc.exec(o))!=null;){var g=h.index;g>m&&wc(a,o.substring(m,g),t,p),wc(a,h[2],t,p,h[1]),m=mc.lastIndex}md){var ee=a.lines.length;O>0?(T.tokens=T.tokens.slice(0,O),C(T,D,E),a.lines=a.lines.slice(0,w+1)):a.lines=a.lines.slice(0,w),a.isTruncated=a.isTruncated||a.lines.length0&&m+r.accumWidth>r.width&&(u=t.split(` +`),l=!0),r.accumWidth=m}else{var h=Oc(t,c,r.width,r.breakAll,r.accumWidth);r.accumWidth=h.accumWidth+p,d=h.linesWidths,u=h.lines}}u||=t.split(` +`);for(var g=ec(c),_=0;_=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}var Ec=Za(`,&?/;] `.split(``),function(e,t){return e[t]=!0,e},{});function Dc(e){return!Tc(e)||!!Ec[e]}function Oc(e,t,n,r,i){for(var a=[],o=[],s=``,c=``,l=0,u=0,d=ec(t),f=0;fn:i+u+m>n){u?(s||c)&&(h?(s||(s=c,c=``,l=0,u=l),a.push(s),o.push(u-l),c+=p,l+=m,s=``,u=l):(c&&(s+=c,c=``,l=0),a.push(s),o.push(u),s=p,u=m)):h?(a.push(c),o.push(l),c=p,l=m):(a.push(p),o.push(m));continue}u+=m,h?(c+=p,l+=m):(c&&(s+=c,c=``,l=0),s+=p)}return c&&(s+=c),s&&(a.push(s),o.push(u)),a.length===1&&(u+=i),{accumWidth:u,lines:a,linesWidths:o}}function kc(e,t,n,r,i,a){if(e.baseX=n,e.baseY=r,e.outerWidth=e.outerHeight=null,t){var o=t.width*2,s=t.height*2;Z.set(Ac,lc(n,o,i),uc(r,s,a),o,s),Z.intersect(t,Ac,null,jc);var c=jc.outIntersectRect;e.outerWidth=c.width,e.outerHeight=c.height,e.baseX=lc(c.x,c.width,i,!0),e.baseY=uc(c.y,c.height,a,!0)}}var Ac=new Z(0,0,0,0),jc={outIntersectRect:{},clamp:!0};function Mc(e){return e==null?e=``:e+=``}function Nc(e){var t=Mc(e.text),n=e.font;return Pc(e,oc(ec(n),t),dc(n),null)}function Pc(e,t,n,r){var i=new Z(lc(e.x||0,t,e.textAlign),uc(e.y||0,n,e.textBaseline),t,n),a=r??(Fc(e)?e.lineWidth:0);return a>0&&(i.x-=a/2,i.y-=a/2,i.width+=a,i.height+=a),i}function Fc(e){var t=e.stroke;return t!=null&&t!==`none`&&e.lineWidth>0}var Ic=is,Lc=5e-5;function Rc(e){return e>Lc||e<-Lc}var zc=[],Bc=[],Vc=rs(),Hc=Math.abs,Uc=function(){function e(){}return e.prototype.getLocalTransform=function(e){return Wc(this,e)},e.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},e.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},e.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},e.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},e.prototype.needLocalTransform=function(){return Rc(this.rotation)||Rc(this.x)||Rc(this.y)||Rc(this.scaleX-1)||Rc(this.scaleY-1)||Rc(this.skewX)||Rc(this.skewY)},e.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),n=this.transform;if(!(t||e)){n&&(Ic(n),this.invTransform=null);return}n||=rs(),t?this.getLocalTransform(n):Ic(n),e&&(t?os(n,e,n):as(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||rs(),us(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(zc);var n=zc[0]<0?-1:1,r=zc[1]<0?-1:1,i=((zc[0]-n)*t+n)/zc[0]||0,a=((zc[1]-r)*t+r)/zc[1]||0;e[0]*=i,e[1]*=i,e[2]*=a,e[3]*=a}},e.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},e.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],r=Math.atan2(e[1],e[0]),i=Math.PI/2+r-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(i),t=Math.sqrt(t),this.skewX=i,this.skewY=0,this.rotation=-r,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||rs(),os(Bc,e.invTransform,t),t=Bc);var n=this.originX,r=this.originY;(n||r)&&(Vc[4]=n,Vc[5]=r,os(Bc,t,Vc),Bc[4]-=n,Bc[5]-=r,t=Bc),this.setLocalTransform(t)}},e.prototype.getGlobalScale=function(e){var t=this.transform;return e||=[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},e.prototype.transformCoordToLocal=function(e,t){var n=[e,t],r=this.invTransform;return r&&Es(n,n,r),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],r=this.transform;return r&&Es(n,n,r),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&Hc(e[0]-1)>1e-10&&Hc(e[3]-1)>1e-10?Math.sqrt(Hc(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){qc(this,e)},e.getLocalTransform=function(e,t){t||=[];var n=e.originX||0,r=e.originY||0,i=e.scaleX,a=e.scaleY,o=e.anchorX,s=e.anchorY,c=e.rotation||0,l=e.x,u=e.y,d=e.skewX?Math.tan(e.skewX):0,f=e.skewY?Math.tan(-e.skewY):0;if(n||r||o||s){var p=n+o,m=r+s;t[4]=-p*i-d*m*a,t[5]=-m*a-f*p*i}else t[4]=t[5]=0;return t[0]=i,t[3]=a,t[1]=f*i,t[2]=d*a,c&&cs(t,t,c),t[4]+=n+l,t[5]+=r+u,t},e.initDefaultProps=(function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0})(),e}(),Wc=Uc.getLocalTransform;function Gc(){return new Uc}var Kc=[`x`,`y`,`originX`,`originY`,`anchorX`,`anchorY`,`rotation`,`scaleX`,`scaleY`,`skewX`,`skewY`];function qc(e,t){return Ga(e,t,Kc)}var Jc={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:1024**(e-1)},exponentialOut:function(e){return e===1?1:1-2**(-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*1024**(e-1):.5*(-(2**(-10*(e-1)))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),-(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)))},elasticOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),n*2**(-10*e)*Math.sin((e-t)*(2*Math.PI)/r)+1)},elasticInOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?-.5*(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)):n*2**(-10*--e)*Math.sin((e-t)*(2*Math.PI)/r)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-Jc.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?Jc.bounceIn(e*2)*.5:Jc.bounceOut(e*2-1)*.5+.5}},Yc=Math.pow,Xc=Math.sqrt,Zc=1e-8,Qc=1e-4,$c=Xc(3),el=1/3,tl=ds(),nl=ds(),rl=ds();function il(e){return e>-Zc&&eZc||e<-Zc}function ol(e,t,n,r,i){var a=1-i;return a*a*(a*e+3*i*t)+i*i*(i*r+3*a*n)}function sl(e,t,n,r,i){var a=1-i;return 3*(((t-e)*a+2*(n-t)*i)*a+(r-n)*i*i)}function cl(e,t,n,r,i,a){var o=r+3*(t-n)-e,s=3*(n-t*2+e),c=3*(t-e),l=e-i,u=s*s-3*o*c,d=s*c-9*o*l,f=c*c-3*s*l,p=0;if(il(u)&&il(d)){if(il(s))a[0]=0;else{var m=-c/s;m>=0&&m<=1&&(a[p++]=m)}}else{var h=d*d-4*u*f;if(il(h)){var g=d/u,m=-s/o+g,_=-g/2;m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_)}else if(h>0){var v=Xc(h),y=u*s+1.5*o*(-d+v),b=u*s+1.5*o*(-d-v);y=y<0?-Yc(-y,el):Yc(y,el),b=b<0?-Yc(-b,el):Yc(b,el);var m=(-s-(y+b))/(3*o);m>=0&&m<=1&&(a[p++]=m)}else{var x=(2*u*s-3*o*d)/(2*Xc(u*u*u)),S=Math.acos(x)/3,C=Xc(u),w=Math.cos(S),m=(-s-2*C*w)/(3*o),_=(-s+C*(w+$c*Math.sin(S)))/(3*o),T=(-s+C*(w-$c*Math.sin(S)))/(3*o);m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_),T>=0&&T<=1&&(a[p++]=T)}}return p}function ll(e,t,n,r,i){var a=6*n-12*t+6*e,o=9*t+3*r-3*e-9*n,s=3*t-3*e,c=0;if(il(o)){if(al(a)){var l=-s/a;l>=0&&l<=1&&(i[c++]=l)}}else{var u=a*a-4*o*s;if(il(u))i[0]=-a/(2*o);else if(u>0){var d=Xc(u),l=(-a+d)/(2*o),f=(-a-d)/(2*o);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function ul(e,t,n,r,i,a){var o=(t-e)*i+e,s=(n-t)*i+t,c=(r-n)*i+n,l=(s-o)*i+o,u=(c-s)*i+s,d=(u-l)*i+l;a[0]=e,a[1]=o,a[2]=l,a[3]=d,a[4]=d,a[5]=u,a[6]=c,a[7]=r}function dl(e,t,n,r,i,a,o,s,c,l,u){var d,f=.005,p=1/0,m,h,g,_;tl[0]=c,tl[1]=l;for(var v=0;v<1;v+=.05)nl[0]=ol(e,n,i,o,v),nl[1]=ol(t,r,a,s,v),g=Ts(tl,nl),g=0&&g=0&&l<=1&&(i[c++]=l)}}else{var u=o*o-4*a*s;if(il(u)){var l=-o/(2*a);l>=0&&l<=1&&(i[c++]=l)}else if(u>0){var d=Xc(u),l=(-o+d)/(2*a),f=(-o-d)/(2*a);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function gl(e,t,n){var r=e+n-2*t;return r===0?.5:(e-t)/r}function _l(e,t,n,r,i){var a=(t-e)*r+e,o=(n-t)*r+t,s=(o-a)*r+a;i[0]=e,i[1]=a,i[2]=s,i[3]=s,i[4]=o,i[5]=n}function vl(e,t,n,r,i,a,o,s,c){var l,u=.005,d=1/0;tl[0]=o,tl[1]=s;for(var f=0;f<1;f+=.05){nl[0]=pl(e,n,i,f),nl[1]=pl(t,r,a,f);var p=Ts(tl,nl);p=0&&p=1?1:cl(0,r,a,1,e,s)&&ol(0,i,o,1,s[0])}}}var Sl=function(){function e(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Do,this.ondestroy=e.ondestroy||Do,this.onrestart=e.onrestart||Do,e.easing&&this.setEasing(e.easing)}return e.prototype.step=function(e,t){if(this._inited||=(this._startTime=e+this._delay,!0),this._paused){this._pausedTime+=t;return}var n=this._life,r=e-this._startTime-this._pausedTime,i=r/n;i<0&&(i=0),i=Math.min(i,1);var a=this.easingFunc,o=a?a(i):i;if(this.onframe(o),i===1){if(this.loop){var s=r%n;this._startTime=e-s,this._pausedTime=0,this.onrestart()}else return!0}return!1},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(e){this.easing=e,this.easingFunc=K(e)?e:Jc[e]||xl(e)},e}(),Cl={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function wl(e){return e=Math.round(e),e<0?0:e>255?255:e}function Tl(e){return e=Math.round(e),e<0?0:e>360?360:e}function El(e){return e<0?0:e>1?1:e}function Dl(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?wl(parseFloat(t)/100*255):wl(parseInt(t,10))}function Ol(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?El(parseFloat(t)/100):El(parseFloat(t))}function kl(e,t,n){return n<0?n+=1:n>1&&--n,n*6<1?e+(t-e)*n*6:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function Al(e,t,n){return e+(t-e)*n}function jl(e,t,n,r,i){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}function Ml(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var Nl=new Zo(20),Pl=null;function Fl(e,t){Pl&&Ml(Pl,t),Pl=Nl.put(e,Pl||t.slice())}function Il(e,t){if(e){t||=[];var n=Nl.get(e);if(n)return Ml(t,n);e+=``;var r=e.replace(/ /g,``).toLowerCase();if(r in Cl)return Ml(t,Cl[r]),Fl(e,t),t;var i=r.length;if(r.charAt(0)===`#`){if(i===4||i===5){var a=parseInt(r.slice(1,4),16);if(!(a>=0&&a<=4095)){jl(t,0,0,0,1);return}return jl(t,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,i===5?parseInt(r.slice(4),16)/15:1),Fl(e,t),t}if(i===7||i===9){var a=parseInt(r.slice(1,7),16);if(!(a>=0&&a<=16777215)){jl(t,0,0,0,1);return}return jl(t,(a&16711680)>>16,(a&65280)>>8,a&255,i===9?parseInt(r.slice(7),16)/255:1),Fl(e,t),t}return}var o=r.indexOf(`(`),s=r.indexOf(`)`);if(o!==-1&&s+1===i){var c=r.substr(0,o),l=r.substr(o+1,s-(o+1)).split(`,`),u=1;switch(c){case`rgba`:if(l.length!==4)return l.length===3?jl(t,+l[0],+l[1],+l[2],1):jl(t,0,0,0,1);u=Ol(l.pop());case`rgb`:if(l.length>=3)return jl(t,Dl(l[0]),Dl(l[1]),Dl(l[2]),l.length===3?u:Ol(l[3])),Fl(e,t),t;jl(t,0,0,0,1);return;case`hsla`:if(l.length!==4){jl(t,0,0,0,1);return}return l[3]=Ol(l[3]),Ll(l,t),Fl(e,t),t;case`hsl`:if(l.length!==3){jl(t,0,0,0,1);return}return Ll(l,t),Fl(e,t),t;default:return}}jl(t,0,0,0,1)}}function Ll(e,t){var n=(parseFloat(e[0])%360+360)%360/360,r=Ol(e[1]),i=Ol(e[2]),a=i<=.5?i*(r+1):i+r-i*r,o=i*2-a;return t||=[],jl(t,wl(kl(o,a,n+1/3)*255),wl(kl(o,a,n)*255),wl(kl(o,a,n-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function Rl(e){if(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=(a+i)/2,c,l;if(o===0)c=0,l=0;else{l=s<.5?o/(a+i):o/(2-a-i);var u=((a-t)/6+o/2)/o,d=((a-n)/6+o/2)/o,f=((a-r)/6+o/2)/o;t===a?c=f-d:n===a?c=1/3+u-f:r===a&&(c=2/3+d-u),c<0&&(c+=1),c>1&&--c}var p=[c*360,l,s];return e[3]!=null&&p.push(e[3]),p}}function zl(e,t){var n=Il(e);if(n){for(var r=0;r<3;r++)t<0?n[r]=n[r]*(1-t)|0:n[r]=(255-n[r])*t+n[r]|0,n[r]>255?n[r]=255:n[r]<0&&(n[r]=0);return Wl(n,n.length===4?`rgba`:`rgb`)}}function Bl(e,t,n){if(t&&t.length&&e>=0&&e<=1){n||=[];var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=t[i],s=t[a],c=r-i;return n[0]=wl(Al(o[0],s[0],c)),n[1]=wl(Al(o[1],s[1],c)),n[2]=wl(Al(o[2],s[2],c)),n[3]=El(Al(o[3],s[3],c)),n}}function Vl(e,t,n){if(t&&t.length&&e>=0&&e<=1){var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=Il(t[i]),s=Il(t[a]),c=r-i,l=Wl([wl(Al(o[0],s[0],c)),wl(Al(o[1],s[1],c)),wl(Al(o[2],s[2],c)),El(Al(o[3],s[3],c))],`rgba`);return n?{color:l,leftIndex:i,rightIndex:a,value:r}:l}}function Hl(e,t,n,r){var i=Il(e);if(e)return i=Rl(i),t!=null&&(i[0]=Tl(K(t)?t(i[0]):t)),n!=null&&(i[1]=Ol(K(n)?n(i[1]):n)),r!=null&&(i[2]=Ol(K(r)?r(i[2]):r)),Wl(Ll(i),`rgba`)}function Ul(e,t){var n=Il(e);if(n&&t!=null)return n[3]=El(t),Wl(n,`rgba`)}function Wl(e,t){if(e&&e.length){var n=e[0]+`,`+e[1]+`,`+e[2];return(t===`rgba`||t===`hsva`||t===`hsla`)&&(n+=`,`+e[3]),t+`(`+n+`)`}}function Gl(e,t){var n=Il(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var Kl=new Zo(100);function ql(e){if(q(e)){var t=Kl.get(e);return t||(t=zl(e,-.1),Kl.put(e,t)),t}if(co(e)){var n=V({},e);return n.colorStops=U(e.colorStops,function(e){return{offset:e.offset,color:zl(e.color,-.1)}}),n}return e}var Jl=Math.round;function Yl(e){var t;if(!e||e===`transparent`)e=`none`;else if(typeof e==`string`&&e.indexOf(`rgba`)>-1){var n=Il(e);n&&(e=`rgb(`+n[0]+`,`+n[1]+`,`+n[2]+`)`,t=n[3])}return{color:e,opacity:t??1}}var Xl=1e-4;function Zl(e){return e-Xl}function Ql(e){return Jl(e*1e3)/1e3}function $l(e){return Jl(e*1e4)/1e4}function eu(e){return`matrix(`+Ql(e[0])+`,`+Ql(e[1])+`,`+Ql(e[2])+`,`+Ql(e[3])+`,`+$l(e[4])+`,`+$l(e[5])+`)`}var tu={left:`start`,right:`end`,center:`middle`,middle:`middle`};function nu(e,t,n){return n===`top`?e+=t/2:n===`bottom`&&(e-=t/2),e}function ru(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function iu(e){var t=e.style,n=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(`,`)}function au(e){return e&&!!e.image}function ou(e){return e&&!!e.svgElement}function su(e){return au(e)||ou(e)}function cu(e){return e.type===`linear`}function lu(e){return e.type===`radial`}function uu(e){return e&&(e.type===`linear`||e.type===`radial`)}function du(e){return`url(#`+e+`)`}function fu(e){var t=e.getGlobalScale(),n=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function pu(e){var t=e.x||0,n=e.y||0,r=(e.rotation||0)*Oo,i=Y(e.scaleX,1),a=Y(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,c=[];return(t||n)&&c.push(`translate(`+t+`px,`+n+`px)`),r&&c.push(`rotate(`+r+`)`),(i!==1||a!==1)&&c.push(`scale(`+i+`,`+a+`)`),(o||s)&&c.push(`skew(`+Jl(o*Oo)+`deg, `+Jl(s*Oo)+`deg)`),c.join(` `)}var mu=(function(){return typeof Buffer<`u`&&typeof Buffer.from==`function`?function(e){return Buffer.from(e).toString(`base64`)}:typeof btoa==`function`&&typeof unescape==`function`&&typeof encodeURIComponent==`function`?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}})(),hu=Array.prototype.slice;function gu(e,t,n){return(t-e)*n+e}function _u(e,t,n,r){for(var i=t.length,a=0;ar?t:e,a=Math.min(n,r),o=i[a-1]||{color:[0,0,0,0],offset:0},s=a;so)r.length=o;else for(var s=a;s=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t,n){this._needsSort=!0;var r=this.keyframes,i=r.length,a=!1,o=Mu,s=t;if(Xa(t)){var c=Tu(t);o=c,(c===1&&!io(t[0])||c===2&&!io(t[0][0]))&&(a=!0)}else if(io(t)&&!lo(t))o=Eu;else if(q(t)){if(!isNaN(+t))o=Eu;else{var l=Il(t);l&&(s=l,o=ku)}}else if(co(t)){var u=V({},s);u.colorStops=U(t.colorStops,function(e){return{offset:e.offset,color:Il(e.color)}}),cu(t)?o=Au:lu(t)&&(o=ju),s=u}i===0?this.valType=o:(o!==this.valType||o===Mu)&&(a=!0),this.discrete=this.discrete||a;var d={time:e,value:s,rawValue:t,percent:0};return n&&(d.easing=n,d.easingFunc=K(n)?n:Jc[n]||xl(n)),r.push(d),d},e.prototype.prepare=function(e,t){var n=this.keyframes;this._needsSort&&n.sort(function(e,t){return e.time-t.time});for(var r=this.valType,i=n.length,a=n[i-1],o=this.discrete,s=Pu(r),c=Nu(r),l=0;l=0&&!(a[l].percent<=t);l--);l=d(l,o-2)}else{for(l=u;lt);l++);l=d(l-1,o-2)}p=a[l+1],f=a[l]}if(f&&p){this._lastFr=l,this._lastFrP=t;var m=p.percent-f.percent,h=m===0?1:d((t-f.percent)/m,1);p.easingFunc&&(h=p.easingFunc(h));var g=n?this._additiveValue:c?Fu:e[s];if((Pu(i)||c)&&!g&&(g=this._additiveValue=[]),this.discrete)e[s]=h<1?f.rawValue:p.rawValue;else if(Pu(i))i===Du?_u(g,f[r],p[r],h):vu(g,f[r],p[r],h);else if(Nu(i)){var _=f[r],v=p[r],y=i===Au;e[s]={type:y?`linear`:`radial`,x:gu(_.x,v.x,h),y:gu(_.y,v.y,h),colorStops:U(_.colorStops,function(e,t){var n=v.colorStops[t];return{offset:gu(e.offset,n.offset,h),color:wu(_u([],e.color,n.color,h))}}),global:v.global},y?(e[s].x2=gu(_.x2,v.x2,h),e[s].y2=gu(_.y2,v.y2,h)):e[s].r=gu(_.r,v.r,h)}else if(c)_u(g,f[r],p[r],h),n||(e[s]=wu(g));else{var b=gu(f[r],p[r],h);n?this._additiveValue=b:e[s]=b}n&&this._addToTarget(e)}}},e.prototype._addToTarget=function(e){var t=this.valType,n=this.propName,r=this._additiveValue;t===Eu?e[n]=e[n]+r:t===ku?(Il(e[n],Fu),yu(Fu,Fu,r,1),e[n]=wu(Fu)):t===Du?yu(e[n],e[n],r,1):t===Ou&&bu(e[n],e[n],r,1)},e}(),Lu=function(){function e(e,t,n,r){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&r){Ua(`Can' use additive animation on looped animation.`);return}this._additiveAnimators=r,this._allowDiscrete=n}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(e){this._target=e},e.prototype.when=function(e,t,n){return this.whenWithKeys(e,t,eo(t),n)},e.prototype.whenWithKeys=function(e,t,n,r){for(var i=this._tracks,a=0;a0&&s.addKeyframe(0,Cu(c),r),this._trackKeys.push(o)}s.addKeyframe(e,Cu(t[o]),r)}return this._maxTime=Math.max(this._maxTime,e),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,n=0;n0)){this._started=1;for(var t=this,n=[],r=this._maxTime||0,i=0;i1){var o=a.pop();i.addKeyframe(o.time,e[r]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}(),Ru=function(){function e(e){e&&(this._$eventProcessor=e)}return e.prototype.on=function(e,t,n,r){this._$handlers||={};var i=this._$handlers;if(typeof t==`function`&&(r=n,n=t,t=null),!n||!e)return this;var a=this._$eventProcessor;t!=null&&a&&a.normalizeQuery&&(t=a.normalizeQuery(t)),i[e]||(i[e]=[]);for(var o=0;o=0:n.inside,y=void 0,b=void 0,x=void 0;v&&this.canBeInsideText()?(y=n.insideFill,b=n.insideStroke,(y==null||y===`auto`)&&(y=this.getInsideTextFill()),(b==null||b===`auto`)&&(b=this.getInsideTextStroke(y),x=!0)):(y=n.outsideFill,b=n.outsideStroke,(y==null||y===`auto`)&&(y=this.getOutsideFill()),(b==null||b===`auto`)&&(b=this.getOutsideStroke(y),x=!0)),y||=`#000`,(y!==g.fill||b!==g.stroke||x!==g.autoStroke||a!==g.align||o!==g.verticalAlign)&&(s=!0,g.fill=y,g.stroke=b,g.autoStroke=x,g.align=a,g.verticalAlign=o,t.setDefaultTextStyle(g)),t.__dirty|=1,s&&t.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return`#fff`},e.prototype.getInsideTextStroke=function(e){return`#000`},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?Uu:Hu},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n=typeof t==`string`&&Il(t);n||=[255,255,255,1];for(var r=n[3],i=this.__zr.isDarkMode(),a=0;a<3;a++)n[a]=n[a]*r+(i?0:255)*(1-r);return n[3]=1,Wl(n,`rgba`)},e.prototype.traverse=function(e,t){},e.prototype.attrKV=function(e,t){e===`textConfig`?this.setTextConfig(t):e===`textContent`?this.setTextContent(t):e===`clipPath`?this.setClipPath(t):e===`extra`?(this.extra=this.extra||{},V(this.extra,t)):this[e]=t},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(e,t){if(typeof e==`string`)this.attrKV(e,t);else if(J(e))for(var n=eo(e),r=0;r0},e.prototype.getState=function(e){return this.states[e]},e.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},e.prototype.clearStates=function(e){this.useState(Gu,!1,e)},e.prototype.useState=function(e,t,n,r){var i=e===Gu;if(this.hasState()||!i){var a=this.currentStates,o=this.stateTransition;if(!(qa(a,e)>=0&&(t||a.length===1))){var s;if(this.stateProxy&&!i&&(s=this.stateProxy(e)),s||=this.states&&this.states[e],!s&&!i){Ua(`State `+e+` not exists.`);return}i||this.saveCurrentToNormalState(s);var c=this._textContent,l=ad(this,c,s,r);l&&!this.__inHover&&(this.__inHover=l),this._applyStateObj(e,s,this._normalState,t,sd(this,n,o),o);var u=this._textGuide;return c&&c.useState(e,t,n,!!l),u&&u.useState(e,t,n,!!l),i?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this.__inHover=0,this.__dirty&=-2),s}}},e.prototype.useStates=function(e,t,n){if(!e.length)this.clearStates();else{var r=[],i=this.currentStates,a=e.length,o=a===i.length;if(o){for(var s=0;s=0){var n=this.currentStates.slice();n.splice(t,1),this.useStates(n)}},e.prototype.replaceState=function(e,t,n){var r=this.currentStates.slice(),i=qa(r,e),a=qa(r,t)>=0;i>=0?a?r.splice(i,1):r[i]=t:n&&!a&&r.push(t),this.useStates(r)},e.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},e.prototype._mergeStates=function(e){for(var t={},n,r=0;r=0&&t.splice(n,1)}),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(e){this.markRedraw()},e.prototype.stopAnimation=function(e,t){for(var n=this.animators,r=n.length,i=[],a=0;a0&&n.during&&a[0].during(function(e,t){n.during(t)});for(var f=0;f0||i.force&&!o.length){var C=void 0,w=void 0,T=void 0;if(s){w={},f&&(C={});for(var b=0;b0}var cd=`__zr_style_`+Math.round(Math.random()*10),ld={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:`#000`,opacity:1,blend:`source-over`},ud={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};ld[cd]=!0;var dd=[`z`,`z2`,`invisible`],fd=[`invisible`],pd=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype._init=function(t){for(var n=eo(t),r=0;r1e-4){s[0]=e-n,s[1]=t-r,c[0]=e+n,c[1]=t+r;return}if(Sd[0]=bd(i)*n+e,Sd[1]=yd(i)*r+t,Cd[0]=bd(a)*n+e,Cd[1]=yd(a)*r+t,l(s,Sd,Cd),u(c,Sd,Cd),i%=xd,i<0&&(i+=xd),a%=xd,a<0&&(a+=xd),i>a&&!o?a+=xd:ii&&(wd[0]=bd(p)*n+e,wd[1]=yd(p)*r+t,l(s,wd,s),u(c,wd,c))}var Md={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Nd=[],Pd=[],Fd=[],Id=[],Ld=[],Rd=[],zd=Math.min,Bd=Math.max,Vd=Math.cos,Hd=Math.sin,Ud=Math.abs,Wd=Math.PI,Gd=Wd*2,Kd=typeof Float32Array<`u`,qd=[];function Jd(e){return Math.round(e/Wd*1e8)/1e8%2*Wd}function Yd(e,t){var n=Jd(e[0]);n<0&&(n+=Gd);var r=n-e[0],i=e[1];i+=r,!t&&i-n>=Gd?i=n+Gd:t&&n-i>=Gd?i=n-Gd:!t&&n>i?i=n+(Gd-Jd(n-i)):t&&n0&&(this._ux=Ud(n/Bu/e)||0,this._uy=Ud(n/Bu/t)||0)},e.prototype.setDPR=function(e){this.dpr=e},e.prototype.setContext=function(e){this._ctx=e},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(Md.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},e.prototype.lineTo=function(e,t){var n=Ud(e-this._xi),r=Ud(t-this._yi),i=n>this._ux||r>this._uy;if(this.addData(Md.L,e,t),this._ctx&&i&&this._ctx.lineTo(e,t),i)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var a=n*n+r*r;a>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=a)}return this},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){return this._drawPendingPt(),this.addData(Md.C,e,t,n,r,i,a),this._ctx&&this._ctx.bezierCurveTo(e,t,n,r,i,a),this._xi=i,this._yi=a,this},e.prototype.quadraticCurveTo=function(e,t,n,r){return this._drawPendingPt(),this.addData(Md.Q,e,t,n,r),this._ctx&&this._ctx.quadraticCurveTo(e,t,n,r),this._xi=n,this._yi=r,this},e.prototype.arc=function(e,t,n,r,i,a){this._drawPendingPt(),qd[0]=r,qd[1]=i,Yd(qd,a),r=qd[0],i=qd[1];var o=i-r;return this.addData(Md.A,e,t,n,n,r,o,0,+!a),this._ctx&&this._ctx.arc(e,t,n,r,i,a),this._xi=Vd(i)*n+e,this._yi=Hd(i)*n+t,this},e.prototype.arcTo=function(e,t,n,r,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,n,r,i),this},e.prototype.rect=function(e,t,n,r){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,n,r),this.addData(Md.R,e,t,n,r),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Md.Z);var e=this._ctx,t=this._x0,n=this._y0;return e&&e.closePath(),this._xi=t,this._yi=n,this},e.prototype.fill=function(e){e&&e.fill(),this.toStatic()},e.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(e){if(this._saveData){var t=e.length;!(this.data&&this.data.length===t)&&Kd&&(this.data=new Float32Array(t));for(var n=0;n0&&a))for(var o=0;ol.length&&(this._expandData(),l=this.data);for(var u=0;u0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t11&&(this.data=new Float32Array(e)))}},e.prototype.getBoundingRect=function(){Fd[0]=Fd[1]=Ld[0]=Ld[1]=Number.MAX_VALUE,Id[0]=Id[1]=Rd[0]=Rd[1]=-Number.MAX_VALUE;for(var e=this.data,t=0,n=0,r=0,i=0,a=0;an||Ud(v)>r||d===t-1)&&(m=Math.sqrt(_*_+v*v),i=h,a=g);break;case Md.C:var y=e[d++],b=e[d++],h=e[d++],g=e[d++],x=e[d++],S=e[d++];m=fl(i,a,y,b,h,g,x,S,10),i=x,a=S;break;case Md.Q:var y=e[d++],b=e[d++],h=e[d++],g=e[d++];m=yl(i,a,y,b,h,g,10),i=h,a=g;break;case Md.A:var C=e[d++],w=e[d++],T=e[d++],E=e[d++],D=e[d++],O=e[d++],k=O+D;d+=1,p&&(o=Vd(D)*T+C,s=Hd(D)*E+w),m=Bd(T,E)*zd(Gd,Math.abs(O)),i=Vd(k)*T+C,a=Hd(k)*E+w;break;case Md.R:o=i=e[d++],s=a=e[d++];var A=e[d++],j=e[d++];m=A*2+j*2;break;case Md.Z:var _=o-i,v=s-a;m=Math.sqrt(_*_+v*v),i=o,a=s}m>=0&&(c[u++]=m,l+=m)}return this._pathLen=l,l},e.prototype.rebuildPath=function(e,t){var n=this.data,r=this._ux,i=this._uy,a=this._len,o,s,c,l,u,d,f=t<1,p,m,h=0,g=0,_,v=0,y,b;if(!(f&&(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,m=this._pathLen,_=t*m,!_)))lo:for(var x=0;x0&&(e.lineTo(y,b),v=0),S){case Md.M:o=c=n[x++],s=l=n[x++],e.moveTo(c,l);break;case Md.L:u=n[x++],d=n[x++];var w=Ud(u-c),T=Ud(d-l);if(w>r||T>i){if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;e.lineTo(c*(1-D)+u*D,l*(1-D)+d*D);break lo}h+=E}e.lineTo(u,d),c=u,l=d,v=0}else{var O=w*w+T*T;O>v&&(y=u,b=d,v=O)}break;case Md.C:var k=n[x++],A=n[x++],j=n[x++],M=n[x++],N=n[x++],P=n[x++];if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;ul(c,k,j,N,D,Nd),ul(l,A,M,P,D,Pd),e.bezierCurveTo(Nd[1],Pd[1],Nd[2],Pd[2],Nd[3],Pd[3]);break lo}h+=E}e.bezierCurveTo(k,A,j,M,N,P),c=N,l=P;break;case Md.Q:var k=n[x++],A=n[x++],j=n[x++],M=n[x++];if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;_l(c,k,j,D,Nd),_l(l,A,M,D,Pd),e.quadraticCurveTo(Nd[1],Pd[1],Nd[2],Pd[2]);break lo}h+=E}e.quadraticCurveTo(k,A,j,M),c=j,l=M;break;case Md.A:var ee=n[x++],te=n[x++],ne=n[x++],re=n[x++],ie=n[x++],ae=n[x++],oe=n[x++],se=!n[x++],ce=ne>re?ne:re,le=Ud(ne-re)>.001,ue=ie+ae,F=!1;if(f){var E=p[g++];h+E>_&&(ue=ie+ae*(_-h)/E,F=!0),h+=E}if(le&&e.ellipse?e.ellipse(ee,te,ne,re,oe,ie,ue,se):e.arc(ee,te,ce,ie,ue,se),F)break lo;C&&(o=Vd(ie)*ne+ee,s=Hd(ie)*re+te),c=Vd(ue)*ne+ee,l=Hd(ue)*re+te;break;case Md.R:o=c=n[x],s=l=n[x+1],u=n[x++],d=n[x++];var I=n[x++],de=n[x++];if(f){var E=p[g++];if(h+E>_){var fe=_-h;e.moveTo(u,d),e.lineTo(u+zd(fe,I),d),fe-=I,fe>0&&e.lineTo(u+I,d+zd(fe,de)),fe-=de,fe>0&&e.lineTo(u+Bd(I-fe,0),d+de),fe-=I,fe>0&&e.lineTo(u,d+Bd(de-fe,0));break lo}h+=E}e.rect(u,d,I,de);break;case Md.Z:if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;e.lineTo(c*(1-D)+o*D,l*(1-D)+s*D);break lo}h+=E}e.closePath(),c=o,l=s}}},e.prototype.clone=function(){var t=new e,n=this.data;return t.data=n.slice?n.slice():Array.prototype.slice.call(n),t._len=this._len,t},e.prototype.canSave=function(){return!!this._saveData},e.CMD=Md,e.initDefaultProps=(function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0})(),e}();function Zd(e,t,n,r,i,a,o){if(i===0)return!1;var s=i,c=0,l=e;if(o>t+s&&o>r+s||oe+s&&a>n+s||at+d&&u>r+d&&u>a+d&&u>s+d||ue+d&&l>n+d&&l>i+d&&l>o+d||lt+l&&c>r+l&&c>a+l||ce+l&&s>n+l&&s>i+l||sn||u+li&&(i+=nf);var f=Math.atan2(c,s);return f<0&&(f+=nf),f>=r&&f<=i||f+nf>=r&&f+nf<=i}function af(e,t,n,r,i,a){if(a>t&&a>r||ai?s:0}var of=Xd.CMD,sf=Math.PI*2,cf=1e-4;function lf(e,t){return Math.abs(e-t)t&&l>r&&l>a&&l>s||l1&&ff(),p=ol(t,r,a,s,df[0]),f>1&&(m=ol(t,r,a,s,df[1]))),f===2?gt&&s>r&&s>a||s=0&&l<=1){for(var u=0,d=pl(t,r,a,l),f=0;fn||s<-n)return 0;var c=Math.sqrt(n*n-s*s);uf[0]=-c,uf[1]=c;var l=Math.abs(r-i);if(l<1e-4)return 0;if(l>=sf-1e-4){r=0,i=sf;var u=a?1:-1;return o>=uf[0]+e&&o<=uf[1]+e?u:0}if(r>i){var d=r;r=i,i=d}r<0&&(r+=sf,i+=sf);for(var f=0,p=0;p<2;p++){var m=uf[p];if(m+e>o){var h=Math.atan2(s,m),u=a?1:-1;h<0&&(h=sf+h),(h>=r&&h<=i||h+sf>=r&&h+sf<=i)&&(h>Math.PI/2&&h1&&(n||(s+=af(c,l,u,d,r,i))),g&&(c=a[m],l=a[m+1],u=c,d=l),h){case of.M:u=a[m++],d=a[m++],c=u,l=d;break;case of.L:if(n){if(Zd(c,l,a[m],a[m+1],t,r,i))return!0}else s+=af(c,l,a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case of.C:if(n){if(Qd(c,l,a[m++],a[m++],a[m++],a[m++],a[m],a[m+1],t,r,i))return!0}else s+=pf(c,l,a[m++],a[m++],a[m++],a[m++],a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case of.Q:if(n){if($d(c,l,a[m++],a[m++],a[m],a[m+1],t,r,i))return!0}else s+=mf(c,l,a[m++],a[m++],a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case of.A:var _=a[m++],v=a[m++],y=a[m++],b=a[m++],x=a[m++],S=a[m++];m+=1;var C=!!(1-a[m++]);f=Math.cos(x)*y+_,p=Math.sin(x)*b+v,g?(u=f,d=p):s+=af(c,l,f,p,r,i);var w=(r-_)*b/y+_;if(n){if(rf(_,v,b,x,x+S,C,t,w,i))return!0}else s+=hf(_,v,b,x,x+S,C,w,i);c=Math.cos(x+S)*y+_,l=Math.sin(x+S)*b+v;break;case of.R:u=c=a[m++],d=l=a[m++];var T=a[m++],E=a[m++];if(f=u+T,p=d+E,n){if(Zd(u,d,f,d,t,r,i)||Zd(f,d,f,p,t,r,i)||Zd(f,p,u,p,t,r,i)||Zd(u,p,u,d,t,r,i))return!0}else s+=af(f,d,f,p,r,i),s+=af(u,p,u,d,r,i);break;case of.Z:if(n){if(Zd(c,l,u,d,t,r,i))return!0}else s+=af(c,l,u,d,r,i);c=u,l=d}}return!n&&!lf(l,d)&&(s+=af(c,l,u,d,r,i)||0),s!==0}function _f(e,t,n){return gf(e,0,!1,t,n)}function vf(e,t,n,r){return gf(e,t,!0,n,r)}var yf=Ka({fill:`#000`,stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:`butt`,miterLimit:10,strokeNoScale:!1,strokeFirst:!1},ld),bf={style:Ka({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},ud.style)},xf=Kc.concat([`invisible`,`culling`,`z`,`z2`,`zlevel`,`parent`]),Sf=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype.update=function(){var n=this;e.prototype.update.call(this);var r=this.style;if(r.decal){var i=this._decalEl=this._decalEl||new t;i.buildPath===t.prototype.buildPath&&(i.buildPath=function(e){n.buildPath(e,n.shape)}),i.silent=!0;var a=i.style;for(var o in r)a[o]!==r[o]&&(a[o]=r[o]);a.fill=r.fill?r.decal:null,a.decal=null,a.shadowColor=null,r.strokeFirst&&(a.stroke=null);for(var s=0;s.5?Hu:t>.2?Wu:Uu}if(e)return Uu}return Hu},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(q(t)){var n=this.__zr;if(!!(n&&n.isDarkMode())==Gl(e,0)<.4)return t}},t.prototype.buildPath=function(e,t,n){},t.prototype.pathUpdated=function(){this.__dirty&=-5},t.prototype.getUpdatedPathProxy=function(e){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,e),this.path},t.prototype.createPathProxy=function(){this.path=new Xd(!1)},t.prototype.hasStroke=function(){var e=this.style,t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))},t.prototype.hasFill=function(){var e=this.style.fill;return e!=null&&e!==`none`},t.prototype.getBoundingRect=function(){var e=this._rect,t=this.style,n=!e;if(n){var r=!1;this.path||(r=!0,this.createPathProxy());var i=this.path;(r||this.__dirty&4)&&(i.beginPath(),this.buildPath(i,this.shape,!1),this.pathUpdated()),e=i.getBoundingRect()}if(this._rect=e,this.hasStroke()&&this.path&&this.path.len()>0){var a=this._rectStroke||=e.clone();if(this.__dirty||n){a.copy(e);var o=t.strokeNoScale?this.getLineScale():1,s=t.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;s=Math.max(s,c??4)}o>1e-10&&(a.width+=s/o,a.height+=s/o,a.x-=s/o/2,a.y-=s/o/2)}return a}return e},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),r=this.getBoundingRect(),i=this.style;if(e=n[0],t=n[1],r.contain(e,t)){var a=this.path;if(this.hasStroke()){var o=i.lineWidth,s=i.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(o=Math.max(o,this.strokeContainThreshold)),vf(a,o/s,e,t)))return!0}if(this.hasFill())return _f(a,e,t)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=4,this._rect&&=null,this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(e){return this.animate(`shape`,e)},t.prototype.updateDuringAnimation=function(e){e===`style`?this.dirtyStyle():e===`shape`?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(t,n){t===`shape`?this.setShape(n):e.prototype.attrKV.call(this,t,n)},t.prototype.setShape=function(e,t){var n=this.shape;return n||=this.shape={},typeof e==`string`?n[e]=t:V(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&4)},t.prototype.createStyle=function(e){return To(yf,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=V({},this.shape))},t.prototype._applyStateObj=function(t,n,r,i,a,o){if(e.prototype._applyStateObj.call(this,t,n,r,i,a,o),this.__inHover!==1){var s=!(n&&i),c;if(n&&n.shape?a?i?c=n.shape:(c=V({},r.shape),V(c,n.shape)):(c=V({},i?this.shape:r.shape),V(c,n.shape)):s&&(c=r.shape),c){if(a){this.shape=V({},this.shape);for(var l={},u=eo(c),d=0;di&&(d=s+c,s*=i/d,c*=i/d),l+u>i&&(d=l+u,l*=i/d,u*=i/d),c+l>a&&(d=c+l,c*=a/d,l*=a/d),s+u>a&&(d=s+u,s*=a/d,u*=a/d),e.moveTo(n+s,r),e.lineTo(n+i-c,r),c!==0&&e.arc(n+i-c,r+c,c,-Math.PI/2,0),e.lineTo(n+i,r+a-l),l!==0&&e.arc(n+i-l,r+a-l,l,0,Math.PI/2),e.lineTo(n+u,r+a),u!==0&&e.arc(n+u,r+a-u,u,Math.PI/2,Math.PI),e.lineTo(n,r+s),s!==0&&e.arc(n+s,r+s,s,Math.PI,Math.PI*1.5),e.closePath()}var Af=Math.round;function jf(e,t,n){if(t){var r=t.x1,i=t.x2,a=t.y1,o=t.y2;e.x1=r,e.x2=i,e.y1=a,e.y2=o;var s=n&&n.lineWidth;return s?(Af(r*2)===Af(i*2)&&(e.x1=e.x2=Nf(r,s,!0)),Af(a*2)===Af(o*2)&&(e.y1=e.y2=Nf(a,s,!0)),e):e}}function Mf(e,t,n){if(t){var r=t.x,i=t.y,a=t.width,o=t.height;e.x=r,e.y=i,e.width=a,e.height=o;var s=n&&n.lineWidth;return s?(e.x=Nf(r,s,!0),e.y=Nf(i,s,!0),e.width=Math.max(Nf(r+a,s,!1)-e.x,a===0?0:1),e.height=Math.max(Nf(i+o,s,!1)-e.y,o===0?0:1),e):e}}function Nf(e,t,n){if(!t)return e;var r=Af(e*2);return(r+Af(t))%2==0?r/2:(r+(n?1:-1))/2}var Pf=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),Ff={},If=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new Pf},t.prototype.buildPath=function(e,t){var n,r,i,a;if(this.subPixelOptimize){var o=Mf(Ff,t,this.style);n=o.x,r=o.y,i=o.width,a=o.height,o.r=t.r,t=o}else n=t.x,r=t.y,i=t.width,a=t.height;t.r?kf(e,t):e.rect(n,r,i,a)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(Sf);If.prototype.type=`rect`;var Lf={fill:`#000`},Rf=2,zf={},Bf={style:Ka({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},ud.style)},Vf=function(e){z(t,e);function t(t){var n=e.call(this)||this;return n.type=`text`,n._children=[],n._defaultStyle=Lf,n.attr(t),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;t0,T=0;T=0&&(D=y[E],D.align===`right`);)this._placeToken(D,e,x,m,T,`right`,g),S-=D.width,T-=D.width,E--;for(w+=(s-(w-p)-(h-T)-S)/2;C<=E;)D=y[C],this._placeToken(D,e,x,m,w+D.width/2,`center`,g),w+=D.width,C++;m+=x}},t.prototype._placeToken=function(e,t,n,r,i,a,o){var s=t.rich[e.styleName]||{};s.text=e.text;var c=e.verticalAlign,l=r+n/2;c===`top`?l=r+e.height/2:c===`bottom`&&(l=r+n-e.height/2),!e.isLineHolder&&ep(s)&&this._renderBackground(s,t,a===`right`?i-e.width:a===`center`?i-e.width/2:i,l-e.height/2,e.width,e.height);var u=!!s.backgroundColor,d=e.textPadding;d&&(i=Qf(i,a,d),l-=e.height/2-d[0]-e.innerHeight/2);var f=this._getOrCreateChild(wf),p=f.createStyle();f.useStyle(p);var m=this._defaultStyle,h=!1,g=0,_=!1,v=Zf(`fill`in s?s.fill:`fill`in t?t.fill:(h=!0,m.fill)),y=Xf(`stroke`in s?s.stroke:`stroke`in t?t.stroke:!u&&!o&&(!m.autoStroke||h)?(g=Rf,_=!0,m.stroke):null),b=s.textShadowBlur>0||t.textShadowBlur>0;p.text=e.text,p.x=i,p.y=l,b&&(p.shadowBlur=s.textShadowBlur||t.textShadowBlur||0,p.shadowColor=s.textShadowColor||t.textShadowColor||`transparent`,p.shadowOffsetX=s.textShadowOffsetX||t.textShadowOffsetX||0,p.shadowOffsetY=s.textShadowOffsetY||t.textShadowOffsetY||0),p.textAlign=a,p.textBaseline=`middle`,p.font=e.font||`12px sans-serif`,p.opacity=fo(s.opacity,t.opacity,1),Kf(p,s),y&&(p.lineWidth=fo(s.lineWidth,t.lineWidth,g),p.lineDash=Y(s.lineDash,t.lineDash),p.lineDashOffset=t.lineDashOffset||0,p.stroke=y),v&&(p.fill=v),f.setBoundingRect(Pc(p,e.contentWidth,e.contentHeight,_?0:null))},t.prototype._renderBackground=function(e,t,n,r,i,a){var o=e.backgroundColor,s=e.borderWidth,c=e.borderColor,l=o&&o.image,u=o&&!l,d=e.borderRadius,f=this,p,m;if(u||e.lineHeight||s&&c){p=this._getOrCreateChild(If),p.useStyle(p.createStyle()),p.style.fill=null;var h=p.shape;h.x=n,h.y=r,h.width=i,h.height=a,h.r=d,p.dirtyShape()}if(u){var g=p.style;g.fill=o||null,g.fillOpacity=Y(e.fillOpacity,1)}else if(l){m=this._getOrCreateChild(Of),m.onload=function(){f.dirtyStyle()};var _=m.style;_.image=o.image,_.x=n,_.y=r,_.width=i,_.height=a}if(s&&c){var g=p.style;g.lineWidth=s,g.stroke=c,g.strokeOpacity=Y(e.strokeOpacity,1),g.lineDash=e.borderDash,g.lineDashOffset=e.borderDashOffset||0,p.strokeContainThreshold=0,p.hasFill()&&p.hasStroke()&&(g.strokeFirst=!0,g.lineWidth*=2)}var v=(p||m).style;v.shadowBlur=e.shadowBlur||0,v.shadowColor=e.shadowColor||`transparent`,v.shadowOffsetX=e.shadowOffsetX||0,v.shadowOffsetY=e.shadowOffsetY||0,v.opacity=fo(e.opacity,t.opacity,1)},t.makeFont=function(e){var t=``;return qf(e)&&(t=[e.fontStyle,e.fontWeight,Gf(e.fontSize),e.fontFamily||`sans-serif`].join(` `)),t&&go(t)||e.textFont||e.font},t}(pd),Hf={left:!0,right:1,center:1},Uf={top:1,bottom:1,middle:1},Wf=[`fontStyle`,`fontWeight`,`fontSize`,`fontFamily`];function Gf(e){return typeof e==`string`&&(e.indexOf(`px`)!==-1||e.indexOf(`rem`)!==-1||e.indexOf(`em`)!==-1)?e:isNaN(+e)?`12px`:e+`px`}function Kf(e,t){for(var n=0;n0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var gp=_p;function _p(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`}return vp(e,t,n)}function vp(e,t,n){return q(e)?bp(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function yp(e){return q(e)&&bp(e)}function bp(e){return!!rp(e).match(/%$/)}function xp(e,t,n){return isNaN(t)?n?``+e:+e:(t=ip(ap(0,t),np),e=(+e).toFixed(t),n?e:+e)}function Sp(e){return e.sort(function(e,t){return e-t}),e}function Cp(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(sp(e*t)/t===e)return n}return wp(e)}function wp(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return ap(0,(a<0?0:i-1-a)-r)}function Tp(e,t,n){var r=op(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=dp(2*op(n||1)*op(r))/fp,a=dp(op(t))/fp,o=ap(0,lp(-i+a));return isFinite(o)||(o=NaN),o}function Ep(e,t){var n=ap(Cp(e),Cp(t)),r=e+t;return n>np?r:xp(r,n)}var Dp=up(2,53)-1;function Op(e){var t=pp*2;return(e%t+t)%t}function kp(e){return e>-tp&&e=10&&t++,t}function Pp(e,t){var n=Np(e),r=up(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,xp(e,-n)}function Fp(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)&&(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0)},e})();function km(){return[1/0,-1/0]}function Am(e,t){Pm(t)&&(te[1]&&(e[1]=t))}function jm(e,t){Pm(t)&&te[1]&&(e[1]=t)}function Nm(e,t){Fm(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function Pm(e){return e!=null&&isFinite(e)}function Fm(e,t){return Pm(e)&&Pm(t)&&e<=t}function Im(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function Lm(e){Fm(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function Rm(){var e=`__ec_once_`+zm++;return function(t,n){Eo(t,e)||(t[e]=1,n())}}var zm=Rp();function Bm(e,t,n){var r=X(),i=0;H(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function Vm(e){return e.value+``}function Hm(e){return e+``}function Um(e,t){return Y(t,!0)?e.seriesIndex+2:0}function Wm(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function Gm(e,t){return{seriesType:e,overallReset:t}}function Km(e){return{overallReset:e}}var qm=vm(),Jm=function(e,t,n,r){if(r){var i=qm(r);i.dataIndex=n,i.dataType=t,i.seriesIndex=e,i.ssrType=`chart`,r.type===`group`&&r.traverse(function(r){var i=qm(r);i.seriesIndex=e,i.dataIndex=n,i.dataType=t,i.ssrType=`chart`})}},Ym=`series`,Xm=X([`tooltip`,`label`,`itemName`,`itemId`,`itemGroupId`,`itemChildGroupId`,`seriesName`]),Zm=`original`,Qm=`arrayRows`,$m=`objectRows`,eh=`keyedColumns`,th=`typedArray`,nh=`unknown`,rh=`column`,ih=`Roam`,ah=[`getDom`,`getZr`,`getWidth`,`getHeight`,`getDevicePixelRatio`,`dispatchAction`,`isSSR`,`isDisposed`,`on`,`off`,`getDataURL`,`getConnectedDataURL`,`getOption`,`getId`,`updateLabelLayout`],oh=function(){function e(e){H(ah,function(t){this[t]=W(e[t],e)},this)}return e}();function sh(e,t){return t.mainType===`series`?e.getViewOfSeriesModel(t):e.getViewOfComponentModel(t)}var ch=1,lh={},uh=vm(),dh=vm(),fh=[`emphasis`,`blur`,`select`],ph=[`normal`,`emphasis`,`blur`,`select`],mh=`highlight`,hh=`downplay`,gh=`select`,_h=`unselect`,vh=`toggleSelect`,yh=`selectchanged`;function bh(e){return e!=null&&e!==`none`}function xh(e,t,n){e.onHoverStateChange&&(e.hoverState||0)!==n&&e.onHoverStateChange(t),e.hoverState=n}function Sh(e){xh(e,`emphasis`,2)}function Ch(e){e.hoverState===2&&xh(e,`normal`,0)}function wh(e){xh(e,`blur`,1)}function Th(e){e.hoverState===1&&xh(e,`normal`,0)}function Eh(e){e.selected=!0}function Dh(e){e.selected=!1}function Oh(e,t,n){t(e,n)}function kh(e,t,n){Oh(e,t,n),e.isGroup&&e.traverse(function(e){Oh(e,t,n)})}function Ah(e,t){switch(t){case`emphasis`:e.hoverState=2;break;case`normal`:e.hoverState=0;break;case`blur`:e.hoverState=1;break;case`select`:e.selected=!0}}function jh(e,t,n,r){for(var i=e.style,a={},o=0;o=0,a=!1;if(e instanceof Sf){var o=uh(e),s=i&&o.selectFill||o.normalFill,c=i&&o.selectStroke||o.normalStroke;if(bh(s)||bh(c)){r||={};var l=r.style||{};l.fill===`inherit`?(a=!0,r=V({},r),l=V({},l),l.fill=s):!bh(l.fill)&&bh(s)?(a=!0,r=V({},r),l=V({},l),l.fill=ql(s)):!bh(l.stroke)&&bh(c)&&(a||(r=V({},r),l=V({},l)),l.stroke=ql(c)),r.style=l}}if(r&&r.z2==null){a||(r=V({},r));var u=e.z2EmphasisLift;r.z2=e.z2+(u??10)}return r}function Nh(e,t,n){if(n&&n.z2==null){n=V({},n);var r=e.z2SelectLift;n.z2=e.z2+(r??9)}return n}function Ph(e,t,n){var r=qa(e.currentStates,t)>=0,i=e.style.opacity,a=r?null:jh(e,[`opacity`],t,{opacity:1});n||={};var o=n.style||{};return o.opacity??(n=V({},n),o=V({opacity:r?i:a.opacity*.1},o),n.style=o),n}function Fh(e,t){var n=this.states[e];if(this.style){if(e===`emphasis`)return Mh(this,e,t,n);if(e===`blur`)return Ph(this,e,n);if(e===`select`)return Nh(this,e,n)}return n}function Ih(e){e.stateProxy=Fh;var t=e.getTextContent(),n=e.getTextGuideLine();t&&(t.stateProxy=Fh),n&&(n.stateProxy=Fh)}function Lh(e,t){!Gh(e,t)&&!e.__highByOuter&&kh(e,Sh)}function Rh(e,t){!Gh(e,t)&&!e.__highByOuter&&kh(e,Ch)}function zh(e,t){e.__highByOuter|=1<<(t||0),kh(e,Sh)}function Bh(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&kh(e,Ch)}function Vh(e){kh(e,wh)}function Hh(e){kh(e,Th)}function Uh(e){kh(e,Eh)}function Wh(e){kh(e,Dh)}function Gh(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function Kh(e){var t=e.getModel(),n=[],r=[];t.eachComponent(function(t,i){var a=dh(i),o=sh(e,i),s=t===`series`;!s&&r.push(o),a.isBlured&&(o.group.traverse(function(e){Th(e)}),s&&n.push(i)),a.isBlured=!1}),H(r,function(e){e&&e.toggleBlurSeries&&e.toggleBlurSeries(n,!1,t)})}function qh(e,t,n,r){var i=r.getModel();n||=`coordinateSystem`;function a(e,t){for(var n=0;n0){var a={dataIndex:i,seriesIndex:e.seriesIndex};r!=null&&(a.dataType=r),t.push(a)}})}),t}function ng(e,t,n){lg(e,!0),kh(e,Ih),ag(e,t,n)}function rg(e){lg(e,!1)}function ig(e,t,n,r){r?rg(e):ng(e,t,n)}function ag(e,t,n){var r=qm(e);t==null?r.focus&&=null:(r.focus=t,r.blurScope=n)}var og=[`emphasis`,`blur`,`select`],sg={itemStyle:`getItemStyle`,lineStyle:`getLineStyle`,areaStyle:`getAreaStyle`};function cg(e,t,n,r){n||=`itemStyle`;for(var i=0;i1&&(o*=bg(m),s*=bg(m));var h=(i===a?-1:1)*bg((o*o*(s*s)-o*o*(p*p)-s*s*(f*f))/(o*o*(p*p)+s*s*(f*f)))||0,g=h*o*p/s,_=h*-s*f/o,v=(e+n)/2+Sg(d)*g-xg(d)*_,y=(t+r)/2+xg(d)*g+Sg(d)*_,b=Eg([1,0],[(f-g)/o,(p-_)/s]),x=[(f-g)/o,(p-_)/s],S=[(-1*f-g)/o,(-1*p-_)/s],C=Eg(x,S);if(Tg(x,S)<=-1&&(C=Cg),Tg(x,S)>=1&&(C=0),C<0){var w=Math.round(C/Cg*1e6)/1e6;C=Cg*2+w%2*Cg}u.addData(l,v,y,o,s,b,C,d,a)}var Og=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,kg=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function Ag(e){var t=new Xd;if(!e)return t;var n=0,r=0,i=n,a=r,o,s=Xd.CMD,c=e.match(Og);if(!c)return t;for(var l=0;l=0&&(n.splice(r,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=qa(this._children,e);return n>=0&&this.replaceAt(t,n),this},t.prototype.replaceAt=function(e,t){var n=this._children,r=n[t];if(e&&e!==this&&e.parent!==this&&e!==r){n[t]=e,r.parent=null;var i=this.__zr;i&&r.removeSelfFromZr(i),this._doAdd(e)}return this},t.prototype._doAdd=function(e){e.parent&&e.parent.remove(e),e.parent=this;var t=this.__zr;t&&t!==e.__zr&&e.addSelfToZr(t),t&&t.refresh()},t.prototype.remove=function(e){var t=this.__zr,n=this._children,r=qa(n,e);return r<0?this:(n.splice(r,1),e.parent=null,t&&e.removeSelfFromZr(t),t&&t.refresh(),this)},t.prototype.removeAll=function(){for(var e=this._children,t=this.__zr,n=0;nA*A+j*j&&(w=E,T=D),{cx:w,cy:T,x0:-u,y0:-d,x1:w*(i/x-1),y1:T*(i/x-1)}}function t_(e){var t;if(G(e)){var n=e.length;if(!n)return e;t=n===1?[e[0],e[0],0,0]:n===2?[e[0],e[0],e[1],e[1]]:n===3?e.concat(e[2]):e}else t=[e,e,e,e];return t}function n_(e,t){var n,r=Xg(t.r,0),i=Xg(t.r0||0,0),a=r>0;if(a||i>0){if(a||(r=i,i=0),i>r){var o=r;r=i,i=o}var s=t.startAngle,c=t.endAngle;if(!(isNaN(s)||isNaN(c))){var l=t.cx,u=t.cy,d=!!t.clockwise,f=Jg(c-s),p=f>Ug&&f%Ug;if(p>Qg&&(f=p),!(r>Qg))e.moveTo(l,u);else if(f>Ug-Qg)e.moveTo(l+r*Gg(s),u+r*Wg(s)),e.arc(l,u,r,s,c,!d),i>Qg&&(e.moveTo(l+i*Gg(c),u+i*Wg(c)),e.arc(l,u,i,c,s,d));else{var m=void 0,h=void 0,g=void 0,_=void 0,v=void 0,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0,w=void 0,T=void 0,E=void 0,D=void 0,O=void 0,k=void 0,A=r*Gg(s),j=r*Wg(s),M=i*Gg(c),N=i*Wg(c),P=f>Qg;if(P){var ee=t.cornerRadius;ee&&(n=t_(ee),m=n[0],h=n[1],g=n[2],_=n[3]);var te=Jg(r-i)/2;if(v=Zg(te,g),y=Zg(te,_),b=Zg(te,m),x=Zg(te,h),w=S=Xg(v,y),T=C=Xg(b,x),(S>Qg||C>Qg)&&(E=r*Gg(c),D=r*Wg(c),O=i*Gg(s),k=i*Wg(s),fQg){var le=Zg(g,w),ue=Zg(_,w),F=e_(O,k,A,j,r,le,d),I=e_(E,D,M,N,r,ue,d);e.moveTo(l+F.cx+F.x0,u+F.cy+F.y0),w0&&e.arc(l+F.cx,u+F.cy,le,qg(F.y0,F.x0),qg(F.y1,F.x1),!d),e.arc(l,u,r,qg(F.cy+F.y1,F.cx+F.x1),qg(I.cy+I.y1,I.cx+I.x1),!d),ue>0&&e.arc(l+I.cx,u+I.cy,ue,qg(I.y1,I.x1),qg(I.y0,I.x0),!d))}else e.moveTo(l+A,u+j),e.arc(l,u,r,s,c,!d);if(!(i>Qg)||!P)e.lineTo(l+M,u+N);else if(T>Qg){var le=Zg(m,T),ue=Zg(h,T),F=e_(M,N,E,D,i,-ue,d),I=e_(A,j,O,k,i,-le,d);e.lineTo(l+F.cx+F.x0,u+F.cy+F.y0),T0&&e.arc(l+F.cx,u+F.cy,ue,qg(F.y0,F.x0),qg(F.y1,F.x1),!d),e.arc(l,u,i,qg(F.cy+F.y1,F.cx+F.x1),qg(I.cy+I.y1,I.cx+I.x1),d),le>0&&e.arc(l+I.cx,u+I.cy,le,qg(I.y1,I.x1),qg(I.y0,I.x0),!d))}else e.lineTo(l+M,u+N),e.arc(l,u,i,c,s,d)}e.closePath()}}}var r_=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return e}(),i_=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new r_},t.prototype.buildPath=function(e,t){n_(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(Sf);i_.prototype.type=`sector`;var a_=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),o_=function(e){z(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new a_},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.PI*2;e.moveTo(n+t.r,r),e.arc(n,r,t.r,0,i,!1),e.moveTo(n+t.r0,r),e.arc(n,r,t.r0,0,i,!0)},t}(Sf);o_.prototype.type=`ring`;function s_(e,t,n,r){var i=[],a=[],o=[],s=[],c,l,u,d;if(r){u=[1/0,1/0],d=[-1/0,-1/0];for(var f=0,p=e.length;f=2){if(r){var a=s_(i,r,n,t.smoothConstraint);e.moveTo(i[0][0],i[0][1]);for(var o=i.length,s=0;s<(n?o:o-1);s++){var c=a[s*2],l=a[s*2+1],u=i[(s+1)%o];e.bezierCurveTo(c[0],c[1],l[0],l[1],u[0],u[1])}}else{e.moveTo(i[0][0],i[0][1]);for(var s=1,d=i.length;sA_[1]){if(i=!1,j_.negativeSize||n)return i;var s=O_(A_[0]-k_[1]),c=O_(k_[0]-A_[1]);E_(s,c)>N_.len()&&(s=c||!j_.bidirectional)&&(ks.scale(M_,o,-c*r),j_.useDir&&j_.calcDirMTV()))}}return i},e.prototype._getProjMinMaxOnAxis=function(e,t,n){for(var r=this._axes[e],i=this._origin,a=t[0].dot(r)+i[e],o=a,s=a,c=1;c0){var d=u.duration,f=u.delay,p=u.easing,m={duration:d,delay:f||0,easing:p,done:a,force:!!a||!!o,setToFinal:!l,scope:e,during:o};s?t.animateFrom(n,m):t.animateTo(n,m)}else t.stopAnimation(),!s&&t.attr(n),o&&o(1),a&&a()}function B_(e,t,n,r,i,a){z_(`update`,e,t,n,r,i,a)}function V_(e,t,n,r,i,a){z_(`enter`,e,t,n,r,i,a)}function H_(e){if(!e.__zr)return!0;for(var t=0;tx_,BezierCurve:()=>y_,BoundingRect:()=>Z,Circle:()=>zg,CompoundPath:()=>S_,Ellipse:()=>Vg,Group:()=>Lg,HOVER_LAYER_FOR_INCREMENTAL:()=>2,HOVER_LAYER_FROM_THRESHOLD:()=>1,HOVER_LAYER_NO:()=>0,Image:()=>Of,IncrementalDisplayable:()=>I_,Line:()=>h_,LinearGradient:()=>w_,OrientedBoundingRect:()=>P_,Path:()=>Sf,Point:()=>ks,Polygon:()=>u_,Polyline:()=>f_,RadialGradient:()=>T_,Rect:()=>If,Ring:()=>o_,Sector:()=>i_,Text:()=>Vf,WH:()=>X_,XY:()=>Y_,applyTransform:()=>dv,calcZ2Range:()=>Pv,clipPointsByRect:()=>gv,clipRectByRect:()=>_v,createIcon:()=>vv,decomposeTransform:()=>Rv,ensureCopyRect:()=>jv,ensureCopyTransform:()=>Mv,expandOrShrinkRect:()=>Cv,extendPath:()=>$_,extendShape:()=>Z_,getCurrentCanvasPainter:()=>Bv,getShapeClass:()=>tv,getTransform:()=>uv,groupTransition:()=>hv,initProps:()=>V_,isBoundingRectAxisAligned:()=>kv,isElementRemoved:()=>H_,lineLineIntersect:()=>bv,linePolygonIntersect:()=>yv,makeImage:()=>rv,makePath:()=>nv,mergePath:()=>av,payloadDisableAnimation:()=>Lv,registerShape:()=>ev,removeElement:()=>U_,removeElementWithFadeOut:()=>G_,resizePath:()=>ov,retrieveZInfo:()=>Nv,setTooltipConfig:()=>Ev,subPixelOptimize:()=>lv,subPixelOptimizeLine:()=>sv,subPixelOptimizeRect:()=>cv,transformDirection:()=>fv,traverseElements:()=>Ov,traverseUpdateZ:()=>Fv,updateProps:()=>B_}),J_={},Y_=[`x`,`y`],X_=[`width`,`height`];function Z_(e){return Sf.extend(e)}var Q_=Fg;function $_(e,t){return Q_(e,t)}function ev(e,t){J_[e]=t}function tv(e){if(J_.hasOwnProperty(e))return J_[e]}function nv(e,t,n,r){var i=Pg(e,t);return n&&(r===`center`&&(n=iv(n,i.getBoundingRect())),ov(i,n)),i}function rv(e,t,n){var r=new Of({style:{image:e,x:t.x,y:t.y,width:t.width,height:t.height},onload:function(e){if(n===`center`){var i={width:e.width,height:e.height};r.setStyle(iv(t,i))}}});return r}function iv(e,t){var n=t.width/t.height,r=e.height*n,i;r<=e.width?i=e.height:(r=e.width,i=r/n);var a=e.x+e.width/2,o=e.y+e.height/2;return{x:a-r/2,y:o-i/2,width:r,height:i}}var av=Ig;function ov(e,t){if(e.applyTransform){var n=e.getBoundingRect().calculateTransform(t);e.applyTransform(n)}}function sv(e,t){return jf(e,e,{lineWidth:t}),e}function cv(e,t){return Mf(e,e,t),e}var lv=Nf;function uv(e,t){for(var n=is([]);e&&e!==t;)os(n,e.getLocalTransform(),n),e=e.parent;return n}function dv(e,t,n){return t&&!Xa(t)&&(t=Uc.getLocalTransform(t)),n&&(t=us([],t)),Es([],e,t)}function fv(e,t,n){var r=t[4]===0||t[5]===0||t[0]===0?1:op(2*t[4]/t[0]),i=t[4]===0||t[5]===0||t[2]===0?1:op(2*t[4]/t[2]),a=[e===`left`?-r:e===`right`?r:0,e===`top`?-i:e===`bottom`?i:0];return a=dv(a,t,n),op(a[0])>op(a[1])?a[0]>0?`right`:`left`:a[1]>0?`bottom`:`top`}function pv(e){return!e.isGroup}function mv(e){return e.shape!=null}function hv(e,t,n){if(!e||!t)return;function r(e){var t={};return e.traverse(function(e){pv(e)&&e.anid&&(t[e.anid]=e)}),t}function i(e){var t={x:e.x,y:e.y,rotation:e.rotation};return mv(e)&&(t.shape=B(e.shape)),t}var a=r(e);t.traverse(function(e){if(pv(e)&&e.anid){var t=a[e.anid];if(t){var r=i(e);e.attr(i(t)),B_(e,r,n,qm(e).dataIndex)}}})}function gv(e,t){return U(e,function(e){var n=e[0];n=ap(n,t.x),n=ip(n,t.x+t.width);var r=e[1];return r=ap(r,t.y),r=ip(r,t.y+t.height),[n,r]})}function _v(e,t){var n=ap(e.x,t.x),r=ip(e.x+e.width,t.x+t.width),i=ap(e.y,t.y),a=ip(e.y+e.height,t.y+t.height);if(r>=n&&a>=i)return{x:n,y:i,width:r-n,height:a-i}}function vv(e,t,n){var r=V({rectHover:!0},t),i=r.style={strokeNoScale:!0};if(n||={x:-1,y:-1,width:2,height:2},e)return e.indexOf(`image://`)===0?(i.image=e.slice(8),Ka(i,n),new Of(r)):nv(e.replace(`path://`,``),r,n,`center`)}function yv(e,t,n,r,i){for(var a=0,o=i[i.length-1];a1)return!1;var g=xv(p,m,u,d)/f;return!(g<0||g>1)}function xv(e,t,n,r){return e*r-n*t}function Sv(e){return e<=1e-6&&e>=-1e-6}function Cv(e,t,n,r,i){return t==null?e:(io(t)?wv[0]=wv[1]=wv[2]=wv[3]=t:(wv[0]=t[0],wv[1]=t[1],wv[2]=t[2],wv[3]=t[3]),r&&(wv[0]=ap(0,wv[0]),wv[1]=ap(0,wv[1]),wv[2]=ap(0,wv[2]),wv[3]=ap(0,wv[3])),n&&(wv[0]=-wv[0],wv[1]=-wv[1],wv[2]=-wv[2],wv[3]=-wv[3]),Tv(e,wv,`x`,`width`,3,1,i&&i[0]||0),Tv(e,wv,`y`,`height`,0,2,i&&i[1]||0),e)}var wv=[0,0,0,0];function Tv(e,t,n,r,i,a,o){var s=t[a]+t[i],c=e[r];e[r]+=s,o=ap(0,ip(o,c)),e[r]=0?-t[i]:t[a]>=0?c+t[a]:op(s)>1e-8?(c-o)*t[i]/s:0):e[n]-=t[i]}function Ev(e){var t=e.itemTooltipOption,n=e.componentModel,r=e.itemName,i=q(t)?{formatter:t}:t,a=n.mainType,o=n.componentIndex,s={componentType:a,name:r,$vars:[`name`]};s[a+`Index`]=o;var c=e.formatterParamsExtra;c&&H(eo(c),function(e){Eo(s,e)||(s[e]=c[e],s.$vars.push(e))});var l=qm(e.el);l.componentMainType=a,l.componentIndex=o,l.tooltipConfig={name:r,option:Ka({content:r,encodeHTMLContent:!0,formatterParams:s},i)}}function Dv(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function Ov(e,t){if(e){if(G(e))for(var n=0;nt&&(t=r),rt&&(n=t=0),{min:n,max:t}}function Fv(e,t,n){Iv(e,t,n,-1/0)}function Iv(e,t,n,r){if(e.ignoreModelZ)return r;var i=e.getTextContent(),a=e.getTextGuideLine();if(e.isGroup)for(var o=e.childrenRef(),s=0;s1){var l=s.shift();s.length===1&&(n[o]=s[0]),this._update&&this._update(l,a)}else c===1?(n[o]=null,this._update&&this._update(s,a)):this._remove&&this._remove(a)}this._performRestAdd(i,n)},e.prototype._executeMultiple=function(){var e=this._old,t=this._new,n={},r={},i=[],a=[];this._initIndexMap(e,n,i,`_oldKeyGetter`),this._initIndexMap(t,r,a,`_newKeyGetter`);for(var o=0;o1&&d===1)this._updateManyToOne&&this._updateManyToOne(l,c),r[s]=null;else if(u===1&&d>1)this._updateOneToMany&&this._updateOneToMany(l,c),r[s]=null;else if(u===1&&d===1)this._update&&this._update(l,c),r[s]=null;else if(u>1&&d>1)this._updateManyToMany&&this._updateManyToMany(l,c),r[s]=null;else if(u>1)for(var f=0;f1)for(var o=0;ol&&(l=p)}s[0]=c,s[1]=l}},r=function(){return this._data?this._data.length/this._dimSize:0};Vy=(e={},e[Qm+`_`+rh]={pure:!0,appendData:i},e[Qm+`_row`]={pure:!0,appendData:function(){throw Error(`Do not support appendData when set seriesLayoutBy: "row".`)}},e[$m]={pure:!0,appendData:i},e[eh]={pure:!0,appendData:function(e){var t=this._data;H(e,function(e,n){for(var r=t[n]||(t[n]=[]),i=0;i<(e||[]).length;i++)r.push(e[i])})}},e[Zm]={appendData:i},e[th]={persistent:!1,pure:!0,appendData:function(e){this._data=e},clean:function(){this._offset+=this.count(),this._data=null}},e);function i(e){for(var t=0;tt},gte:function(e,t){return e>=t}};(function(){function e(e,t){io(t)||qp(``),this._opFn=lb[e],this._rvalFloat=Ip(t)}return e.prototype.evaluate=function(e){return io(e)?this._opFn(e,this._rvalFloat):this._opFn(Ip(e),this._rvalFloat)},e})();var ub=function(){function e(e,t){var n=e===`desc`;this._resultLT=n?1:-1,t??=n?`min`:`max`,this._incomparable=t===`min`?-1/0:1/0}return e.prototype.evaluate=function(e,t){var n=io(e)?e:Ip(e),r=io(t)?t:Ip(t),i=isNaN(n),a=isNaN(r);if(i&&(n=this._incomparable),a&&(r=this._incomparable),i&&a){var o=q(e),s=q(t);o&&(n=s?e:0),s&&(r=o?t:0)}return nr?-this._resultLT:0},e}();(function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=Ip(t)}return e.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var n=typeof e;n!==this._rvalTypeof&&(n===`number`||this._rvalTypeof===`number`)&&(t=Ip(e)===this._rvalFloat)}return this._isEQ?t:!t},e})();function db(e){var t=``,n=-1/0,r=-1/0,i=1/0,a=1/0;return e&&(e.g!=null&&(t+=`G`+e.g,n=e.g),e.ge!=null&&(t+=`GE`+e.ge,r=e.ge),e.l!=null&&(t+=`L`+e.l,i=e.l),e.le!=null&&(t+=`LE`+e.le,a=e.le)),{key:t,g:n,ge:r,l:i,le:a}}function fb(e,t){return t>e.g&&t>=e.ge&&t`u`?Array:Uint32Array,mb=typeof Uint16Array>`u`?Array:Uint16Array,hb=typeof Int32Array>`u`?Array:Int32Array,gb=typeof Float64Array>`u`?Array:Float64Array,_b={float:gb,int:hb,ordinal:Array,number:Array,time:gb},vb;function yb(e){return e>65535?pb:mb}function bb(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function xb(e,t,n,r,i){var a=_b[n||`float`];if(i){var o=e[t],s=o&&o.length;if(s!==r){for(var c=new a(r),l=0;lh[1]&&(h[1]=m)}return this._rawCount=this._count=s,{start:o,end:s}},e.prototype._initDataFromProvider=function(e,t,n){for(var r=this._provider,i=this._chunks,a=this._dimensions,o=a.length,s=this._rawExtent,c=U(a,function(e){return e.property}),l=0;lg[1]&&(g[1]=h)}}!r.persistent&&r.clean&&r.clean(),this._rawCount=this._count=t,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(e,t){if(!(t>=0&&t=0&&t=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,n=t[e];if(n!=null&&ne)i=a-1;else return a}return-1},e.prototype.getIndices=function(){var e,t=this._indices;if(t){var n=t.constructor,r=this._count;if(n===Array){e=new n(r);for(var i=0;i=l&&g<=u||isNaN(g))&&(o[s++]=p),p++}f=!0}else if(i===2){for(var m=d[r[0]],_=d[r[1]],v=e[r[1]][0],y=e[r[1]][1],h=0;h=l&&g<=u||isNaN(g))&&(b>=v&&b<=y||isNaN(b))&&(o[s++]=p),p++}f=!0}}if(!f){if(i===1)for(var h=0;h=l&&g<=u||isNaN(g))&&(o[s++]=x)}else for(var h=0;he[w][1])&&(S=!1)}S&&(o[s++]=t.getRawIndex(h))}}return sg[1]&&(g[1]=h)}}}},e.prototype.lttbDownSample=function(e,t){var n=this.clone([e],!0),r=n._chunks[e],i=this.count(),a=0,o=Math.floor(1/t),s=this.getRawIndex(0),c,l,u,d=new(yb(this._rawCount))(Math.min((Math.ceil(i/o)+2)*2,i));d[a++]=s;for(var f=1;fc&&(c=l,u=v)}T>0&&To&&(m=o-l);for(var h=0;hp&&(p=g,f=l+h)}var _=this.getRawIndex(u),v=this.getRawIndex(f);ul-p&&(s=l-p,o.length=s);for(var m=0;mu[1]&&(u[1]=g),d[f++]=_}return i._count=f,i._indices=d,i._updateGetRawIdx(),i},e.prototype.each=function(e,t){if(this._count)for(var n=e.length,r=this._chunks,i=0,a=this.count();id&&(d=p))}return o[c]=[u,d]},e.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var n=[],r=this._chunks,i=0;i=0?this._indices[e]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function e(e,t,n,r){return cb(e[r],this._dimensions[r])}vb={arrayRows:e,objectRows:function(e,t,n,r){return cb(e[t],this._dimensions[r])},keyedColumns:e,original:function(e,t,n,r){var i=e&&(e.value==null?e:e.value);return cb(i instanceof Array?i[r]:i,this._dimensions[r])},typedArray:function(e,t,n,r){return e[r]}}}(),e}(),Cb=vm(),wb={float:`f`,int:`i`,ordinal:`o`,number:`n`,time:`t`},Tb=function(){function e(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return e.prototype.isDimensionOmitted=function(){return this._dimOmitted},e.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||=Ob(this.source))},e.prototype.getSourceDimensionIndex=function(e){return Y(this._dimNameMap.get(e),-1)},e.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},e.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=Iy(this.source),n=!kb(e),r=``,i=[],a=0,o=0;a30}var Ab=J,jb=U,Mb=typeof Int32Array>`u`?Array:Int32Array,Nb=`e\0\0`,Pb=-1,Fb=[`hasItemOption`,`_nameList`,`_idList`,`_invertedIndicesMap`,`_dimSummary`,`userOutput`,`_rawData`,`_dimValueGetter`,`_nameDimIdx`,`_idDimIdx`,`_nameRepeatCount`],Ib=[`_approximateExtent`],Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb=function(){function e(e,t){this.type=`list`,this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=[`cloneShallow`,`downSample`,`minmaxDownSample`,`lttbDownSample`,`map`],this.CHANGABLE_METHODS=[`filterSelf`,`selectRange`],this.DOWNSAMPLE_METHODS=[`downSample`,`minmaxDownSample`,`lttbDownSample`];var n,r=!1;Eb(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(r=!0,n=e),n||=[`x`,`y`];for(var i={},a=[],o={},s=!1,c={},l=0;l=t)){var n=this._store.getProvider();this._updateOrdinalMeta();var r=this._nameList,i=this._idList;if(n.getSource().sourceFormat===`original`&&!n.pure)for(var a=[],o=e;o0},e.prototype.ensureUniqueItemVisual=function(e,t){var n=this._itemVisuals,r=n[e];r||=n[e]={};var i=r[t];return i??(i=this.getVisual(t),G(i)?i=i.slice():Ab(i)&&(i=V({},i)),r[t]=i),i},e.prototype.setItemVisual=function(e,t,n){var r=this._itemVisuals[e]||{};this._itemVisuals[e]=r,Ab(t)?V(r,t):r[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){Ab(e)?V(this._layout,e):this._layout[e]=t},e.prototype.getLayout=function(e){return this._layout[e]},e.prototype.getItemLayout=function(e){return this._itemLayouts[e]},e.prototype.setItemLayout=function(e,t,n){this._itemLayouts[e]=n?V(this._itemLayouts[e]||{},t):t},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(e,t){Jm(this.hostModel&&this.hostModel.seriesIndex,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){H(this._graphicEls,function(n,r){n&&e&&e.call(t,n,r)})},e.prototype.cloneShallow=function(t){return t||=new e(this._schema?this._schema:jb(this.dimensions,this._getDimInfo,this),this.hostModel),Vb(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];K(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(po(arguments)))})},e.internalField=function(){Lb=function(e){var t=e._invertedIndicesMap;H(t,function(n,r){var i=e._dimInfos[r],a=i.ordinalMeta,o=e._store;if(a){n=t[r]=new Mb(a.categories.length);for(var s=0;s1&&(s+=`__ec__`+l),r[t]=s}}}(),e}();function Gb(e,t){Dy(e)||(e=ky(e)),t||={};var n=t.coordDimensions||[],r=t.dimensionsDefine||e.dimensionsDefine||[],i=X(),a=[],o=Kb(e,n,r,t.dimensionsCount),s=t.canOmitUnusedDimensions&&kb(o),c=r===e.dimensionsDefine,l=c?Ob(e):Db(r),u=t.encodeDefine;!u&&t.encodeDefaulter&&(u=t.encodeDefaulter(e,o));for(var d=X(u),f=new hb(o),p=0;p0&&(e.name+=t-1)}),new Tb({source:e,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function Kb(e,t,n,r){var i=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,r||0);return H(t,function(e){var t;J(e)&&(t=e.dimsDef)&&(i=Math.max(i,t.length))}),i}function qb(e,t,n){if(n||t.hasKey(e)){for(var r=0;t.hasKey(e+r);)r++;e+=r}return t.set(e,!0),e}var Jb={},Yb={},Xb=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(e,t){this._nonSeriesBoxMasterList=n(Jb,!0),this._normalMasterList=n(Yb,!1);function n(n,r){var i=[];return H(n,function(n,r){var a=n.create(e,t);i=i.concat(a||[])}),i}},e.prototype.update=function(e,t){H(this._normalMasterList,function(n){n.update&&n.update(e,t)})},e.prototype.getCoordinateSystems=function(){return this._normalMasterList.concat(this._nonSeriesBoxMasterList)},e.register=function(e,t){if(e===`matrix`||e===`calendar`){Jb[e]=t;return}Yb[e]=t},e.get=function(e){return Yb[e]||Jb[e]},e}();function Zb(e){return!!Jb[e]}var Qb=X();function $b(e){var t=e.getShallow(`coord`,!0),n=1;if(t==null){var r=Qb.get(e.type);r&&r.getCoord2&&(n=2,t=r.getCoord2(e))}return{coord:t,from:n}}function ex(e,t){var n=e.getShallow(`coordinateSystem`),r=e.getShallow(`coordinateSystemUsage`,!0),i=0;if(n){var a=e.mainType===`series`;r??=a?`data`:`box`,r===`data`?(i=1,a||(i=0)):r===`box`&&(i=2,!a&&!Zb(n)&&(i=0))}return{coordSysType:n,kind:i}}function tx(e){var t=e.targetModel,n=e.coordSysType,r=e.coordSysProvider,i=e.isDefaultDataCoordSys;e.allowNotFound;var a=ex(t,!0),o=a.kind,s=a.coordSysType;if(i&&o!==1&&(o=1,s=n),o===0||s!==n)return 0;var c=r(n,t);return c?(o===1?t.coordinateSystem=c:t.boxCoordinateSystem=c,o):0}var nx=function(){function e(e){this.coordSysDims=[],this.axisMap=X(),this.categoryAxisMap=X(),this.coordSysName=e}return e}();function rx(e){var t=e.get(`coordinateSystem`),n=new nx(t),r=ix[t];if(r)return r(e,n,n.axisMap,n.categoryAxisMap),n}var ix={cartesian2d:function(e,t,n,r){var i=e.getReferringComponents(`xAxis`,Sm).models[0],a=e.getReferringComponents(`yAxis`,Sm).models[0];t.coordSysDims=[`x`,`y`],n.set(`x`,i),n.set(`y`,a),ax(i)&&(r.set(`x`,i),t.firstCategoryDimIndex=0),ax(a)&&(r.set(`y`,a),t.firstCategoryDimIndex??=1)},singleAxis:function(e,t,n,r){var i=e.getReferringComponents(`singleAxis`,Sm).models[0];t.coordSysDims=[`single`],n.set(`single`,i),ax(i)&&(r.set(`single`,i),t.firstCategoryDimIndex=0)},polar:function(e,t,n,r){var i=e.getReferringComponents(`polar`,Sm).models[0],a=i.findAxisModel(`radiusAxis`),o=i.findAxisModel(`angleAxis`);t.coordSysDims=[`radius`,`angle`],n.set(`radius`,a),n.set(`angle`,o),ax(a)&&(r.set(`radius`,a),t.firstCategoryDimIndex=0),ax(o)&&(r.set(`angle`,o),t.firstCategoryDimIndex??=1)},geo:function(e,t,n,r){t.coordSysDims=[`lng`,`lat`]},parallel:function(e,t,n,r){var i=e.ecModel,a=i.getComponent(`parallel`,e.get(`parallelIndex`)),o=t.coordSysDims=a.dimensions.slice();H(a.parallelAxisIndex,function(e,a){var s=i.getComponent(`parallelAxis`,e),c=o[a];n.set(c,s),ax(s)&&(r.set(c,s),t.firstCategoryDimIndex??=a)})},matrix:function(e,t,n,r){var i=e.getReferringComponents(`matrix`,Sm).models[0];t.coordSysDims=[`x`,`y`];var a=i.getDimensionModel(`x`),o=i.getDimensionModel(`y`);n.set(`x`,a),n.set(`y`,o),r.set(`x`,a),r.set(`y`,o)}};function ax(e){return e.get(`type`)===`category`}function ox(e,t,n){n||={};var r=n.byIndex,i=n.stackedCoordDimension,a,o,s;sx(t)?a=t:(o=t.schema,a=o.dimensions,s=t.store);var c=!!(e&&e.get(`stack`)),l,u,d,f,p=!0;function m(e){return e.type!==`ordinal`&&e.type!==`time`}if(H(a,function(e,t){q(e)&&(a[t]=e={name:e}),m(e)||(p=!1)}),H(a,function(e,t){c&&!e.isExtraCoord&&(!r&&!l&&e.ordinalMeta&&(l=e),!u&&m(e)&&(!p||e.coordDim!==`x`&&e.coordDim!==`angle`)&&(!i||i===e.coordDim)&&(u=e))}),u&&!r&&!l&&(r=!0),u){d=`__\0ecstackresult_`+e.id,f=`__\0ecstackedover_`+e.id,l&&(l.createInvertedIndices=!0);var h=u.coordDim,g=u.type,_=0;H(a,function(e){e.coordDim===h&&_++});var v={name:d,coordDim:h,coordDimIndex:_,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},y={name:f,coordDim:f,coordDimIndex:_+1,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(v.storeDimIndex=s.ensureCalculationDimension(f,g),y.storeDimIndex=s.ensureCalculationDimension(d,g)),o.appendCalculationDimension(v),o.appendCalculationDimension(y)):(a.push(v),a.push(y))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:r,stackedOverDimension:f,stackResultDimension:d}}function sx(e){return!Eb(e.schema)}function cx(e,t){return!!t&&t===e.getCalculationInfo(`stackedDimension`)}function lx(e,t){return cx(e,t)?e.getCalculationInfo(`stackResultDimension`):t}function ux(e,t){var n=e.get(`coordinateSystem`),r=Xb.get(n),i;return t&&t.coordSysDims&&(i=U(t.coordSysDims,function(e){var n={name:e},r=t.axisMap.get(e);return r&&(n.type=ab(r.get(`type`))),n})),i||=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||[`x`,`y`],i}function dx(e,t,n){var r,i;return n&&H(e,function(e,a){var o=e.coordDim,s=n.categoryAxisMap.get(o);s&&(r??=a,e.ordinalMeta=s.getOrdinalMeta(),t&&(e.createInvertedIndices=!0)),e.otherDims.itemName!=null&&(i=!0)}),!i&&r!=null&&(e[r].otherDims.itemName=0),r}function fx(e,t,n){n||={};var r=t.getSourceManager(),i,a=!1;e?(a=!0,i=ky(e)):(i=r.getSource(),a=i.sourceFormat===Zm);var o=rx(t),s=ux(t,o),c=n.useEncodeDefaulter,l=K(c)?c:c?no(xy,s,t):null,u={coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:l,canOmitUnusedDimensions:!a},d=Gb(i,u),f=dx(d.dimensions,n.createInvertedIndices,o),p=a?null:r.getSharedDataStore(d),m=ox(t,{schema:d,store:p}),h=new Wb(d,t);h.setCalculationInfo(m);var g=f!=null&&px(i)?function(e,t,n,r){return r===f?n:this.defaultDimValueGetter(e,t,n,r)}:null;return h.hasItemOption=!1,h.initData(a?i:p,null,g),h}function px(e){if(e.sourceFormat===`original`)return!G(em(mx(e.data||[])))}function mx(e){for(var t=0;t=0&&n.push(e)}),n}}function yx(e,t){return Wa(Wa({},e,!0),t,!0)}var bx=Math.log(2);function xx(e,t,n,r,i,a){var o=r+`-`+i,s=e.length;if(a.hasOwnProperty(o))return a[o];if(t===1){var c=Math.round(Math.log((1<>1)%2;s.cssText=[`position: absolute`,`visibility: hidden`,`padding: 0`,`margin: 0`,`border-width: 0`,`user-select: none`,`width:0`,`height:0`,r[c]+`:0`,i[l]+`:0`,r[1-c]+`:auto`,i[1-l]+`:auto`,``].join(`!important;`),e.appendChild(o),n.push(o)}return t.clearMarkers=function(){H(n,function(e){e.parentNode&&e.parentNode.removeChild(e)})},n}function Ax(e,t,n){for(var r=n?`invTrans`:`trans`,i=t[r],a=t.srcCoords,o=[],s=[],c=!0,l=0;l<4;l++){var u=e[l].getBoundingClientRect(),d=2*l,f=u.left,p=u.top;o.push(f,p),c=c&&a&&f===a[d]&&p===a[d+1],s.push(e[l].offsetLeft,e[l].offsetTop)}return c&&i?i:(t.srcCoords=o,t[r]=n?Sx(s,o):Sx(o,s))}function jx(e){return e.nodeName.toUpperCase()===`CANVAS`}var Mx=/([&<>"'])/g,Nx={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function Px(e){return e==null?``:(e+``).replace(Mx,function(e,t){return Nx[t]})}var Fx={time:{month:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],monthAbbr:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],dayOfWeek:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],dayOfWeekAbbr:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]},legend:{selector:{all:`All`,inverse:`Inv`}},toolbox:{brush:{title:{rect:`Box Select`,polygon:`Lasso Select`,lineX:`Horizontally Select`,lineY:`Vertically Select`,keep:`Keep Selections`,clear:`Clear Selections`}},dataView:{title:`Data View`,lang:[`Data View`,`Close`,`Refresh`]},dataZoom:{title:{zoom:`Zoom`,back:`Zoom Reset`}},magicType:{title:{line:`Switch to Line Chart`,bar:`Switch to Bar Chart`,stack:`Stack`,tiled:`Tile`}},restore:{title:`Restore`},saveAsImage:{title:`Save as Image`,lang:[`Right Click to Save Image`]}},series:{typeNames:{pie:`Pie chart`,bar:`Bar chart`,line:`Line chart`,scatter:`Scatter plot`,effectScatter:`Ripple scatter plot`,radar:`Radar chart`,tree:`Tree`,treemap:`Treemap`,boxplot:`Boxplot`,candlestick:`Candlestick`,k:`K line chart`,heatmap:`Heat map`,map:`Map`,parallel:`Parallel coordinate map`,lines:`Line graph`,graph:`Relationship graph`,sankey:`Sankey diagram`,funnel:`Funnel chart`,gauge:`Gauge`,pictorialBar:`Pictorial bar`,themeRiver:`Theme River Map`,sunburst:`Sunburst`,custom:`Custom chart`,chart:`Chart`}},aria:{general:{withTitle:`This is a chart about "{title}"`,withoutTitle:`This is a chart`},series:{single:{prefix:``,withName:` with type {seriesType} named {seriesName}.`,withoutName:` with type {seriesType}.`},multiple:{prefix:`. It consists of {seriesCount} series count.`,withName:` The {seriesId} series is a {seriesType} representing {seriesName}.`,withoutName:` The {seriesId} series is a {seriesType}.`,separator:{middle:``,end:``}}},data:{allData:`The data is as follows: `,partialData:`The first {displayCnt} items are: `,withName:`the data for {name} is {value}`,withoutName:`{value}`,separator:{middle:`, `,end:`. `}}}},Ix={time:{month:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],monthAbbr:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],dayOfWeek:[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`],dayOfWeekAbbr:[`日`,`一`,`二`,`三`,`四`,`五`,`六`]},legend:{selector:{all:`全选`,inverse:`反选`}},toolbox:{brush:{title:{rect:`矩形选择`,polygon:`圈选`,lineX:`横向选择`,lineY:`纵向选择`,keep:`保持选择`,clear:`清除选择`}},dataView:{title:`数据视图`,lang:[`数据视图`,`关闭`,`刷新`]},dataZoom:{title:{zoom:`区域缩放`,back:`区域缩放还原`}},magicType:{title:{line:`切换为折线图`,bar:`切换为柱状图`,stack:`切换为堆叠`,tiled:`切换为平铺`}},restore:{title:`还原`},saveAsImage:{title:`保存为图片`,lang:[`右键另存为图片`]}},series:{typeNames:{pie:`饼图`,bar:`柱状图`,line:`折线图`,scatter:`散点图`,effectScatter:`涟漪散点图`,radar:`雷达图`,tree:`树图`,treemap:`矩形树图`,boxplot:`箱型图`,candlestick:`K线图`,k:`K线图`,heatmap:`热力图`,map:`地图`,parallel:`平行坐标图`,lines:`线图`,graph:`关系图`,sankey:`桑基图`,funnel:`漏斗图`,gauge:`仪表盘图`,pictorialBar:`象形柱图`,themeRiver:`主题河流图`,sunburst:`旭日图`,custom:`自定义图表`,chart:`图表`}},aria:{general:{withTitle:`这是一个关于“{title}”的图表。`,withoutTitle:`这是一个图表,`},series:{single:{prefix:``,withName:`图表类型是{seriesType},表示{seriesName}。`,withoutName:`图表类型是{seriesType}。`},multiple:{prefix:`它由{seriesCount}个图表系列组成。`,withName:`第{seriesId}个系列是一个表示{seriesName}的{seriesType},`,withoutName:`第{seriesId}个系列是一个{seriesType},`,separator:{middle:`;`,end:`。`}}},data:{allData:`其数据是——`,partialData:`其中,前{displayCnt}项是——`,withName:`{name}的数据是{value}`,withoutName:`{value}`,separator:{middle:`,`,end:``}}}},Lx=`ZH`,Rx=`EN`,zx=Rx,Bx={},Vx={},Hx=Ao.domSupported?function(){return(document.documentElement.lang||navigator.language||navigator.browserLanguage||zx).toUpperCase().indexOf(Lx)>-1?Lx:zx}():zx;function Ux(e,t){e=e.toUpperCase(),Vx[e]=new my(t),Bx[e]=t}function Wx(e){if(q(e)){var t=Bx[e.toUpperCase()]||{};return e===Lx||e===Rx?B(t):Wa(B(t),B(Bx[zx]),!1)}return Wa(B(e),B(Bx[zx]),!1)}function Gx(e){return Vx[e]}function Kx(){return Vx[zx]}Ux(Rx,Fx),Ux(Lx,Ix);var qx=null;function Jx(){return qx}function Yx(e,t){var n=Jx(),r=t.breakOption,i=t.breakParsed;return!i&&n&&(i=n.parseAxisBreakOption(r,e)),i}function Xx(e){var t=e.brk;return t?t.breaks:[]}function Zx(e){var t=e.brk;return t?t.hasBreaks():!1}var Qx=1e3,$x=Qx*60,eS=$x*60,tS=eS*24,nS=tS*365,rS={year:/({yyyy}|{yy})/,month:/({MMMM}|{MMM}|{MM}|{M})/,day:/({dd}|{d})/,hour:/({HH}|{H}|{hh}|{h})/,minute:/({mm}|{m})/,second:/({ss}|{s})/,millisecond:/({SSS}|{S})/},iS={year:`{yyyy}`,month:`{MMM}`,day:`{d}`,hour:`{HH}:{mm}`,minute:`{HH}:{mm}`,second:`{HH}:{mm}:{ss}`,millisecond:`{HH}:{mm}:{ss} {SSS}`},aS=`{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}`,oS=`{yyyy}-{MM}-{dd}`,sS={year:`{yyyy}`,month:`{yyyy}-{MM}`,day:oS,hour:oS+` `+iS.hour,minute:oS+` `+iS.minute,second:oS+` `+iS.second,millisecond:aS},cS=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],lS=[`year`,`half-year`,`quarter`,`month`,`week`,`half-week`,`day`,`half-day`,`quarter-day`,`hour`,`minute`,`second`,`millisecond`];function uS(e){return!q(e)&&!K(e)?dS(e):e}function dS(e){e||={};var t={},n=!0;return H(cS,function(t){n&&=e[t]==null}),H(cS,function(r,i){var a=e[r];t[r]={};for(var o=null,s=i;s>=0;s--){var c=cS[s],l=J(a)&&!G(a)?a[c]:a,u=void 0;G(l)?(u=l.slice(),o=u[0]||``):q(l)?(o=l,u=[o]):(o==null?o=iS[r]:rS[c].test(o)||(o=t[c][c][0]+` `+o),u=[o],n&&(u[1]=`{primary|`+o+`}`)),t[r][c]=u}}),t}function fS(e,t){return e+=``,`0000`.substr(0,t-e.length)+e}function pS(e){switch(e){case`half-year`:case`quarter`:return`month`;case`week`:case`half-week`:return`day`;case`half-day`:case`quarter-day`:return`hour`;default:return e}}function mS(e){return e===pS(e)}function hS(e){switch(e){case`year`:case`month`:return`day`;case`millisecond`:return`millisecond`;default:return`second`}}function gS(e,t,n,r){var i=jp(e),a=i[bS(n)](),o=i[xS(n)]()+1,s=Math.floor((o-1)/3)+1,c=i[SS(n)](),l=i[`get`+(n?`UTC`:``)+`Day`](),u=i[CS(n)](),d=(u-1)%12+1,f=i[wS(n)](),p=i[TS(n)](),m=i[ES(n)](),h=u>=12?`pm`:`am`,g=h.toUpperCase(),_=(r instanceof my?r:Gx(r||Hx)||Kx()).getModel(`time`),v=_.get(`month`),y=_.get(`monthAbbr`),b=_.get(`dayOfWeek`),x=_.get(`dayOfWeekAbbr`);return(t||``).replace(/{a}/g,h+``).replace(/{A}/g,g+``).replace(/{yyyy}/g,a+``).replace(/{yy}/g,fS(a%100+``,2)).replace(/{Q}/g,s+``).replace(/{MMMM}/g,v[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,fS(o,2)).replace(/{M}/g,o+``).replace(/{dd}/g,fS(c,2)).replace(/{d}/g,c+``).replace(/{eeee}/g,b[l]).replace(/{ee}/g,x[l]).replace(/{e}/g,l+``).replace(/{HH}/g,fS(u,2)).replace(/{H}/g,u+``).replace(/{hh}/g,fS(d+``,2)).replace(/{h}/g,d+``).replace(/{mm}/g,fS(f,2)).replace(/{m}/g,f+``).replace(/{ss}/g,fS(p,2)).replace(/{s}/g,p+``).replace(/{SSS}/g,fS(m,3)).replace(/{S}/g,m+``)}function _S(e,t,n,r,i){var a=null;if(q(n))a=n;else if(K(n)){var o={time:e.time,level:e.time?e.time.level:0},s=Jx();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),a=n(e.value,t,o)}else{var c=e.time;if(c){var l=n[c.lowerTimeUnit][c.upperTimeUnit];a=l[Math.min(c.level,l.length-1)]||``}else{var u=vS(e.value,i);a=n[u][u][0]}}return gS(new Date(e.value),a,i,r)}function vS(e,t){var n=jp(e),r=n[xS(t)]()+1,i=n[SS(t)](),a=n[CS(t)](),o=n[wS(t)](),s=n[TS(t)](),c=n[ES(t)]()===0,l=c&&s===0,u=l&&o===0,d=u&&a===0,f=d&&i===1;return f&&r===1?`year`:f?`month`:d?`day`:u?`hour`:l?`minute`:c?`second`:`millisecond`}function yS(e,t,n){switch(t){case`year`:e[OS(n)](0);case`month`:e[kS(n)](1);case`day`:e[AS(n)](0);case`hour`:e[jS(n)](0);case`minute`:e[MS(n)](0);case`second`:e[NS(n)](0)}return e}function bS(e){return e?`getUTCFullYear`:`getFullYear`}function xS(e){return e?`getUTCMonth`:`getMonth`}function SS(e){return e?`getUTCDate`:`getDate`}function CS(e){return e?`getUTCHours`:`getHours`}function wS(e){return e?`getUTCMinutes`:`getMinutes`}function TS(e){return e?`getUTCSeconds`:`getSeconds`}function ES(e){return e?`getUTCMilliseconds`:`getMilliseconds`}function DS(e){return e?`setUTCFullYear`:`setFullYear`}function OS(e){return e?`setUTCMonth`:`setMonth`}function kS(e){return e?`setUTCDate`:`setDate`}function AS(e){return e?`setUTCHours`:`setHours`}function jS(e){return e?`setUTCMinutes`:`setMinutes`}function MS(e){return e?`setUTCSeconds`:`setSeconds`}function NS(e){return e?`setUTCMilliseconds`:`setMilliseconds`}function PS(e){if(!Lp(e))return q(e)?e:`-`;var t=(e+``).split(`.`);return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,`$1,`)+(t.length>1?`.`+t[1]:``)}function FS(e,t){return e=(e||``).toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var IS=mo;function LS(e,t,n){var r=`{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}`;function i(e){return e&&go(e)?e:`-`}function a(e){return Vp(e)}var o=t===`time`,s=e instanceof Date;if(o||s){var c=o?jp(e):e;if(!isNaN(+c))return gS(c,r,n);if(s)return`-`}if(t===`ordinal`)return ro(e)?i(e):io(e)&&a(e)?e+``:`-`;var l=Ip(e);return a(l)?PS(l):ro(e)?i(e):typeof e==`boolean`?e+``:`-`}var RS=[`a`,`b`,`c`,`d`,`e`,`f`,`g`],zS=function(e,t){return`{`+e+(t??``)+`}`};function BS(e,t,n){G(t)||(t=[t]);var r=t.length;if(!r)return``;for(var i=t[0].$vars||[],a=0;a`:``:{renderMode:a,content:`{`+(n.markerId||`markerX`)+`|} `,style:i===`subItem`?{width:4,height:4,borderRadius:2,backgroundColor:r}:{width:10,height:10,borderRadius:5,backgroundColor:r}}:``}function HS(e,t){return t||=`transparent`,q(e)?e:J(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}var US=H,WS=[`left`,`right`,`top`,`bottom`,`width`,`height`],GS=[[`width`,`left`,`right`],[`height`,`top`,`bottom`]];function KS(e,t,n,r,i){var a=0,o=0;r??=1/0,i??=1/0;var s=0;t.eachChild(function(c,l){var u=c.getBoundingRect(),d=t.childAt(l+1),f=d&&d.getBoundingRect(),p,m;if(e===`horizontal`){var h=u.width+(f?-f.x+u.x:0);p=a+h,p>r||c.newline?(a=0,p=h,o+=s+n,s=u.height):s=Math.max(s,u.height)}else{var g=u.height+(f?-f.y+u.y:0);m=o+g,m>i||c.newline?(a+=s+n,o=0,m=g,s=u.width):s=Math.max(s,u.width)}c.newline||(c.x=a,c.y=o,c.markRedraw(),e===`horizontal`?a=p+n:o=m+n)})}var qS=KS;no(KS,`vertical`),no(KS,`horizontal`);function JS(e,t){return{left:e.getShallow(`left`,t),top:e.getShallow(`top`,t),right:e.getShallow(`right`,t),bottom:e.getShallow(`bottom`,t),width:e.getShallow(`width`,t),height:e.getShallow(`height`,t)}}function YS(e,t,n){n=IS(n||0);var r=t.width,i=t.height,a=gp(e.left,r),o=gp(e.top,i),s=gp(e.right,r),c=gp(e.bottom,i),l=gp(e.width,r),u=gp(e.height,i),d=n[2]+n[0],f=n[1]+n[3],p=e.aspect;switch(isNaN(l)&&(l=r-s-f-a),isNaN(u)&&(u=i-c-d-o),p!=null&&(isNaN(l)&&isNaN(u)&&(p>r/i?l=r*.8:u=i*.8),isNaN(l)&&(l=p*u),isNaN(u)&&(u=l/p)),isNaN(a)&&(a=r-s-l-f),isNaN(o)&&(o=i-c-u-d),e.left||e.right){case`center`:a=r/2-l/2-n[3];break;case`right`:a=r-l-f}switch(e.top||e.bottom){case`middle`:case`center`:o=i/2-u/2-n[0];break;case`bottom`:o=i-u-d}a||=0,o||=0,isNaN(l)&&(l=r-f-a-(s||0)),isNaN(u)&&(u=i-d-o-(c||0));var m=new Z((t.x||0)+a+n[3],(t.y||0)+o+n[0],l,u);return m.margin=n,m}function XS(e,t,n){var r=e.getShallow(`preserveAspect`,!0);if(!r)return t;var i=t.width/t.height;if(Math.abs(Math.atan(n)-Math.atan(i))<1e-9)return t;var a=e.getShallow(`preserveAspectAlign`,!0),o=e.getShallow(`preserveAspectVerticalAlign`,!0),s={width:t.width,height:t.height},c=r===`cover`;return i>n&&!c||i=u)return a;for(var d=0;d=0;o--)a=Wa(a,n[o],!0);t.defaultOption=a}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+`Index`,r=e+`Id`;return Cm(this.ecModel,e,{index:this.get(n,!0),id:this.get(r,!0)},t)},t.prototype.getBoxLayoutParams=function(){return JS(this,!1)},t.prototype.getZLevelKey=function(){return``},t.prototype.setZLevel=function(e){this.option.zlevel=e},t.protoInitialize=function(){var e=t.prototype;e.type=`component`,e.id=``,e.name=``,e.mainType=``,e.subType=``,e.componentIndex=0}(),t}(my);Bo(aC,my),Go(aC),_x(aC),vx(aC,oC);function oC(e){var t=[];return H(aC.getClassesByMainType(e),function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])}),t=U(t,function(e){return Fo(e).main}),e!==`dataset`&&qa(t,`dataset`)<=0&&t.unshift(`dataset`),t}var sC=vm(),cC=vm(),lC=function(){function e(){}return e.prototype.getColorFromPalette=function(e,t,n){var r=Zp(this.get(`color`,!0)),i=this.get(`colorLayer`,!0);return fC(this,sC,r,i,e,t,n)},e.prototype.clearColorPalette=function(){pC(this,sC)},e}();function uC(e,t,n,r){return fC(e,cC,Zp(e.get([`aria`,`decal`,`decals`])),null,t,n,r)}function dC(e,t){for(var n=e.length,r=0;rt)return e[r];return e[n-1]}function fC(e,t,n,r,i,a,o){a||=e;var s=t(a),c=s.paletteIdx||0,l=s.paletteNameMap=s.paletteNameMap||{};if(l.hasOwnProperty(i))return l[i];var u=o==null||!r?n:dC(r,o);if(u||=n,u&&u.length){var d=u[c];return i&&(l[i]=d),s.paletteIdx=(c+1)%u.length,d}}function pC(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var mC=/\{@(.+?)\}/g,hC=function(){function e(){}return e.prototype.getDataParams=function(e,t){var n=this.getData(t),r=this.getRawValue(e,t),i=n.getRawIndex(e),a=n.getName(e),o=n.getRawDataItem(e),s=n.getItemVisual(e,`style`),c=s&&s[n.getItemVisual(e,`drawType`)||`fill`],l=s&&s.stroke,u=this.mainType,d=u===`series`,f=n.userOutput&&n.userOutput.get();return{componentType:u,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:d?this.subType:null,seriesIndex:this.seriesIndex,seriesId:d?this.id:null,seriesName:d?this.name:null,name:a,dataIndex:i,data:o,dataType:t,value:r,color:c,borderColor:l,dimensionNames:f?f.fullDimensions:null,encode:f?f.encode:null,$vars:[`seriesName`,`name`,`value`]}},e.prototype.getFormattedLabel=function(e,t,n,r,i,a){t||=`normal`;var o=this.getData(n),s=this.getDataParams(e,n);if(a&&(s.value=a.interpolatedValue),r!=null&&G(s.value)&&(s.value=s.value[r]),i||=o.getItemModel(e).get(t===`normal`?[`label`,`formatter`]:[t,`label`,`formatter`]),K(i))return s.status=t,s.dimensionIndex=r,i(s);if(q(i))return BS(i,s).replace(mC,function(t,n){var r=n.length,i=n;i.charAt(0)===`[`&&i.charAt(r-1)===`]`&&(i=+i.slice(1,r-1));var s=tb(o,e,i);if(a&&G(a.interpolatedValue)){var c=o.getDimensionIndex(i);c>=0&&(s=a.interpolatedValue[c])}return s==null?``:s+``})},e.prototype.getRawValue=function(e,t){return tb(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function gC(e){var t,n;return J(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function _C(e){return new vC(e)}var vC=function(){function e(e){e||={},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return e.prototype.perform=function(e){var t=this._upstream,n=e&&e.skip;if(this._dirty&&t){var r=this.context;r.data=r.outputData=t.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=this._plan(this.context));var a=l(this._modBy),o=this._modDataCount||0,s=l(e&&e.modBy),c=e&&e.modDataCount||0;(a!==s||o!==c)&&(i=`reset`);function l(e){return!(e>=1)&&(e=1),e}var u;(this._dirty||i===`reset`)&&(this._dirty=!1,u=this._doReset(n)),this._modBy=s,this._modDataCount=c;var d=e&&e.step;if(this._dueEnd=t?t._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var f=this._dueIndex,p=Math.min(d==null?1/0:this._dueIndex+d,this._dueEnd);if(!n&&(u||f1&&r>0?s:o}};return a;function o(){return t=e?null:a9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+`_`+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,t=this._getUpstreamSourceManagers(),n=!!t.length,r,i;if(MC(e)){var a=e,o=void 0,s=void 0,c=void 0;if(n){var l=t[0];l.prepareSource(),c=l.getSource(),o=c.data,s=c.sourceFormat,i=[l._getVersionSign()]}else o=a.get(`data`,!0),s=oo(o)?th:Zm,i=[];var u=this._getSourceMetaRawOption()||{},d=c&&c.metaRawOption||{},f=Y(u.seriesLayoutBy,d.seriesLayoutBy)||null,p=Y(u.sourceHeader,d.sourceHeader),m=Y(u.dimensions,d.dimensions);r=f!==d.seriesLayoutBy||!!p!=!!d.sourceHeader||m?[Oy(o,{seriesLayoutBy:f,sourceHeader:p,dimensions:m},s)]:[]}else{var h=e;if(n){var g=this._applyTransform(t);r=g.sourceList,i=g.upstreamSignList}else r=[Oy(h.get(`source`,!0),this._getSourceMetaRawOption(),null)],i=[]}this._setLocalSource(r,i)},e.prototype._applyTransform=function(e){var t=this._sourceHost,n=t.get(`transform`,!0),r=t.get(`fromTransformResult`,!0);r!=null&&e.length!==1&&NC(``);var i,a=[],o=[];return H(e,function(e){e.prepareSource();var t=e.getSource(r||0);r!=null&&!t&&NC(``),a.push(t),o.push(e._getVersionSign())}),n?i=OC(n,a,{datasetIndex:t.componentIndex}):r!=null&&(i=[Ay(a[0])]),{sourceList:i,upstreamSignList:o}},e.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),t=0;t1||n>0&&!e.noHeader;return H(e.blocks,function(e){var n=tw(e);n>=t&&(t=n+ +(r&&(!n||$C(e)&&!e.noHeader)))}),t}return 0}function nw(e,t,n,r){var i=t.noHeader,a=aw(tw(t)),o=[],s=t.blocks||[];To(!s||G(s)),s||=[];var c=e.orderMode;if(t.sortBlocks&&c){s=s.slice();var l={valueAsc:`asc`,valueDesc:`desc`};if(Io(l,c)){var u=new bb(l[c],null);s.sort(function(e,t){return u.evaluate(e.sortParam,t.sortParam)})}else c===`seriesDesc`&&s.reverse()}H(s,function(n,i){var s=t.valueFormatter,c=ew(n)(s?V(V({},e),{valueFormatter:s}):e,n,i>0?a.html:0,r);c!=null&&o.push(c)});var d=e.renderMode===`richText`?o.join(a.richText):ow(r,o.join(``),i?n:a.html);if(i)return d;var f=qS(t.header,`ordinal`,e.useUTC),p=YC(r,e.renderMode).nameStyle,m=JC(r);return e.renderMode===`richText`?lw(e,f,p)+a.richText+d:ow(r,`
`+Wx(f)+`
`+d,n)}function rw(e,t,n,r){var i=e.renderMode,a=t.noName,o=t.noValue,s=!t.markerType,c=t.name,l=e.useUTC,u=t.valueFormatter||e.valueFormatter||function(e){return e=G(e)?e:[e],U(e,function(e,t){return qS(e,G(p)?p[t]:p,l)})};if(!(a&&o)){var d=s?``:e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||Q.color.secondary,i),f=a?``:qS(c,`ordinal`,l),p=t.valueType,m=o?[]:u(t.value,t.rawDataIndex),h=!s||!a,g=!s&&a,_=YC(r,i),v=_.nameStyle,y=_.valueStyle;return i===`richText`?(s?``:d)+(a?``:lw(e,f,v))+(o?``:uw(e,m,h,g,y)):ow(r,(s?``:d)+(a?``:sw(f,!s,v))+(o?``:cw(m,h,g,y)),n)}}function iw(e,t,n,r,i,a){if(e)return ew(e)({useUTC:i,renderMode:n,orderMode:r,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,a)}function aw(e){return{html:XC[e],richText:ZC[e]}}function ow(e,t,n){var r=`
`,i=`margin: `+n+`px 0 0`,a=JC(e);return`
`+t+r+`
`}function sw(e,t,n){var r=t?`margin-left:2px`:``;return``+Wx(e)+``}function cw(e,t,n,r){var i=t?`float:right;margin-left:`+(n?`10px`:`20px`):``;return e=G(e)?e:[e],``+U(e,function(e){return Wx(e)}).join(`  `)+``}function lw(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function uw(e,t,n,r,i){var a=[i],o=r?10:20;return n&&a.push({padding:[0,0,0,o],align:`right`}),e.markupStyleCreator.wrapRichTextStyle(G(t)?t.join(` `):t,a)}function dw(e,t){var n=e.getData().getItemVisual(t,`style`)[e.visualDrawType];return QS(n)}function fw(e,t){return e.get(`padding`)??(t===`richText`?[8,10]:10)}var pw=function(){function e(){this.richTextStyles={},this._nextStyleNameId=Jp()}return e.prototype._generateStyleName=function(){return`__EC_aUTo_`+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var r=n===`richText`?this._generateStyleName():null,i=ZS({color:t,type:e,renderMode:n,markerId:r});return q(i)?i:(this.richTextStyles[r]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};G(t)?H(t,function(e){return V(n,e)}):V(n,t);var r=this._generateStyleName();return this.richTextStyles[r]=n,`{`+r+`|`+e+`}`},e}();function mw(e){var t=e.series,n=e.dataIndex,r=e.multipleSeries,i=t.getData(),a=i.mapDimensionsAll(`defaultedTooltip`),o=a.length,s=t.getRawValue(n),c=G(s),l=dw(t,n),u,d,f,p;if(o>1||c&&!o){var m=hw(s,t,n,a,l);u=m.inlineValues,d=m.inlineValueTypes,f=m.blocks,p=m.inlineValues[0]}else if(o){var h=i.getDimensionInfo(a[0]);p=u=db(i,n,a[0]),d=h.type}else p=u=c?s[0]:s;var g=Sm(t),_=g&&t.name||``,v=i.getName(n),y=r?_:v;return QC(`section`,{header:_,noHeader:r||!g,sortParam:p,blocks:[QC(`nameValue`,{markerType:`item`,markerColor:l,name:y,noName:!Eo(y),value:u,valueType:d,rawDataIndex:i.getRawIndex(n)})].concat(f||[])})}function hw(e,t,n,r,i){var a=t.getData(),o=so(e,function(e,t,n){var r=a.getDimensionInfo(n);return e||=r&&r.tooltip!==!1&&r.displayName!=null},!1),s=[],c=[],l=[];r.length?H(r,function(e){u(db(a,n,e),e)}):H(e,u);function u(e,t){var n=a.getDimensionInfo(t);n&&n.otherDims.tooltip!==!1&&(o?l.push(QC(`nameValue`,{markerType:`subItem`,markerColor:i,name:n.displayName,value:e,valueType:n.type})):(s.push(e),c.push(n.type)))}return{inlineValues:s,inlineValueTypes:c,blocks:l}}var gw=Om();function _w(e,t){return e.getName(t)||e.getId(t)}var vw=function(e){z(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=DC({count:xw,reset:Sw}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(gw(this).sourceManager=new VC(this)).prepareSource();var r=this.getInitialData(e,n);ww(r,this),this.dataTask.context.data=r,gw(this).dataBeforeProcessed=r,yw(this),this._initSelectedMapFromData(r)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=uC(this),r=n?fC(e):{},i=this.subType;hC.hasClass(i)&&(i+=`Series`),eo(e,t.getTheme().get(this.subType)),eo(e,this.getDefaultOption()),cm(e,`label`,[`show`]),this.fillDataTextStyle(e.data),n&&dC(e,r,n)},t.prototype.mergeOption=function(e,t){e=eo(this.option,e,!0),this.fillDataTextStyle(e.data);var n=uC(this);n&&dC(this.option,e,n);var r=gw(this).sourceManager;r.dirty(),r.prepareSource();var i=this.getInitialData(e,t);ww(i,this),this.dataTask.dirty(),this.dataTask.context.data=i,gw(this).dataBeforeProcessed=i,yw(this),this._initSelectedMapFromData(i)},t.prototype.fillDataTextStyle=function(e){if(e&&!_o(e))for(var t=[`show`],n=0;n=0&&u<0)&&(l=v,u=_,d=0),_===u&&(c[d++]=m))}return c.length=d,c},t.prototype.formatTooltip=function(e,t,n){return mw({series:this,dataIndex:e,multipleSeries:t})},t.prototype.isAnimationEnabled=function(){var e=this.ecModel;if(Bo.node&&!(e&&e.ssr))return!1;var t=this.getShallow(`animation`);return t&&this.getData().count()>this.getShallow(`animationThreshold`)&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var r=this.ecModel,i=yC.prototype.getColorFromPalette.call(this,e,t,n);return i||=r.getColorFromPalette(e,t,n),i},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get(`progressive`)},t.prototype.getProgressiveThreshold=function(){return this.get(`progressiveThreshold`)},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var r=this.option.selectedMode,i=this.getData(t);if(r===`series`||n===`all`){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var a=0;a=0&&n.push(i)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var r=this.getData(t);return(n===`all`||n[_w(r,e)])&&!r.getItemModel(e).get([`select`,`disabled`])},t.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var e=this.option.universalTransition;return e?e===!0||e&&e.enabled:!1},t.prototype._innerSelect=function(e,t){var n,r,i=this.option,a=i.selectedMode,o=t.length;if(a&&o){if(a===`series`)i.selectedMap=`all`;else if(a===`multiple`){J(i.selectedMap)||(i.selectedMap={});for(var s=i.selectedMap,c=0;c0&&this._innerSelect(e,t)}},t.registerClass=function(e){return hC.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type=`series.__base__`,e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol=`circle`,e.visualStyleAccessPath=`itemStyle`,e.visualDrawType=`fill`}(),t}(hC);ao(vw,TC),ao(vw,yC),Xo(vw,hC);function yw(e){var t=e.name;Sm(e)||(e.name=bw(e)||t)}function bw(e){var t=e.getRawData(),n=t.mapDimensionsAll(`seriesName`),r=[];return H(n,function(e){var n=t.getDimensionInfo(e);n.displayName&&r.push(n.displayName)}),r.join(` `)}function xw(e){return e.model.getRawData().count()}function Sw(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),Cw}function Cw(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function ww(e,t){H(Po(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(n){e.wrapMethod(n,po(Tw,t))})}function Tw(e,t){var n=Ew(e);return n&&n.setOutputEnd((t||this).count()),t}function Ew(e){var t=(e.ecModel||{}).scheduler,n=t&&t.getPipeline(e.uid);if(n){var r=n.currentTask;if(r){var i=r.agentStubMap;i&&(r=i.get(e.uid))}return r}}var Dw=Mf.extend({type:`triangle`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r+a),e.lineTo(n-i,r+a),e.closePath()}}),Ow={line:T_,rect:Kf,roundRect:Kf,square:Kf,circle:Yg,diamond:Mf.extend({type:`diamond`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r),e.lineTo(n,r+a),e.lineTo(n-i,r),e.closePath()}}),pin:Mf.extend({type:`pin`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,r=t.y,i=t.width/5*3,a=Math.max(i,t.height),o=i/2,s=o*o/(a-o),c=r-a+o+s,l=Math.asin(s/o),u=Math.cos(l)*o,d=Math.sin(l),f=Math.cos(l),p=o*.6,m=o*.7;e.moveTo(n-u,c+s),e.arc(n,c,o,Math.PI-l,Math.PI*2+l),e.bezierCurveTo(n+u-d*p,c+s+f*p,n,r-m,n,r),e.bezierCurveTo(n,r-m,n-u+d*p,c+s+f*p,n-u,c+s),e.closePath()}}),arrow:Mf.extend({type:`arrow`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,r=t.width,i=t.x,a=t.y,o=r/3*2;e.moveTo(i,a),e.lineTo(i+o,a+n),e.lineTo(i,a+n/4*3),e.lineTo(i-o,a+n),e.lineTo(i,a),e.closePath()}}),triangle:Dw},kw={line:function(e,t,n,r,i){i.x1=e,i.y1=t+r/2,i.x2=e+n,i.y2=t+r/2},rect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r},roundRect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r,i.r=Math.min(n,r)/4},square:function(e,t,n,r,i){var a=Math.min(n,r);i.x=e,i.y=t,i.width=a,i.height=a},circle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.r=Math.min(n,r)/2},diamond:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r},pin:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},arrow:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},triangle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r}},Aw={};H(Ow,function(e,t){Aw[t]=new e});var jw=Mf.extend({type:`symbol`,shape:{symbolType:``,x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var r=Cc(e,t,n),i=this.shape;return i&&i.symbolType===`pin`&&t.position===`inside`&&(r.y=n.y+n.height*.4),r},buildPath:function(e,t,n){var r=t.symbolType;if(r!==`none`){var i=Aw[r];i||=(r=`rect`,Aw[r]),kw[r](t.x,t.y,t.width,t.height,i.shape),i.buildPath(e,i.shape,n)}}});function Mw(e,t){if(this.type!==`image`){var n=this.style;this.__isEmptyBrush?(n.stroke=e,n.fill=t||Q.color.neutral00,n.lineWidth=2):this.shape.symbolType===`line`?n.stroke=e:n.fill=e,this.markRedraw()}}function Nw(e,t,n,r,i,a,o){var s=e.indexOf(`empty`)===0;s&&(e=e.substr(5,1).toLowerCase()+e.substr(6));var c=e.indexOf(`image://`)===0?pv(e.slice(8),new Z(t,n,r,i),o?`center`:`cover`):e.indexOf(`path://`)===0?fv(e.slice(7),{},new Z(t,n,r,i),o?`center`:`cover`):new jw({shape:{symbolType:e,x:t,y:n,width:r,height:i}});return c.__isEmptyBrush=s,c.setColor=Mw,a&&c.setColor(a),c}function Pw(e){return G(e)||(e=[+e,+e]),[e[0]||0,e[1]||0]}function Fw(e,t){if(e!=null)return G(e)||(e=[e,e]),[Ep(e[0],t[0])||0,Ep(Y(e[1],e[0]),t[1])||0]}var Iw=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return t.prototype.getInitialData=function(e){return Sx(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new qg,n=Nw(`line`,0,e.itemHeight/2,e.itemWidth,0,e.lineStyle.stroke,!1);t.add(n),n.setStyle(e.lineStyle);var r=this.getData().getVisual(`symbol`),i=this.getData().getVisual(`symbolRotate`),a=r===`none`?`circle`:r,o=e.itemHeight*.8,s=Nw(a,(e.itemWidth-o)/2,(e.itemHeight-o)/2,o,o,e.itemStyle.fill);return t.add(s),s.setStyle(e.itemStyle),s.rotation=(e.iconRotate===`inherit`?i:e.iconRotate||0)*Math.PI/180,s.setOrigin([e.itemWidth/2,e.itemHeight/2]),a.indexOf(`empty`)>-1&&(s.style.stroke=s.style.fill,s.style.fill=Q.color.neutral00,s.style.lineWidth=2),t},t.type=`series.line`,t.dependencies=[`grid`,`polar`],t.defaultOption={z:3,coordinateSystem:`cartesian2d`,legendHoverLink:!0,clip:!0,label:{position:`top`},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:`solid`},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:`emptyCircle`,symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:`auto`,connectNulls:!1,sampling:`none`,animationEasing:`linear`,progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:`clone`},triggerLineEvent:!1,triggerEvent:!1},t}(vw);function Lw(e,t){var n=e.mapDimensionsAll(`defaultedLabel`),r=n.length;if(r===1){var i=db(e,t,n[0]);return i==null?null:i+``}if(r){for(var a=[],o=0;o=0&&r.push(t[a])}return r.join(` `)}var zw=function(e){z(t,e);function t(t,n,r,i){var a=e.call(this)||this;return a.updateData(t,n,r,i),a}return t.prototype._createSymbol=function(e,t,n,r,i,a){this.removeAll();var o=Nw(e,-1,-1,2,2,null,a);o.attr({z2:Y(i,100),culling:!0,scaleX:r[0]/2,scaleY:r[1]/2}),o.drift=Bw,this._symbolType=e,this.add(o)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){Yh(this.childAt(0))},t.prototype.downplay=function(){Xh(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?`move`:n.cursor},t.prototype.updateData=function(e,n,r,i){this.silent=!1;var a=e.getItemVisual(n,`symbol`)||`circle`,o=e.hostModel,s=t.getSymbolSize(e,n),c=t.getSymbolZ2(e,n),l=a!==this._symbolType,u=i&&i.disableAnimation;if(l){var d=e.getItemVisual(n,`symbolKeepAspect`);this._createSymbol(a,e,n,s,c,d)}else{var f=this.childAt(0);f.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?f.attr(p):X_(f,p,o,n),nv(f)}if(this._updateCommon(e,n,s,r,i),l){var f=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:f.style.opacity}};f.scaleX=f.scaleY=0,f.style.opacity=0,Z_(f,p,o,n)}}u&&this.childAt(0).stopAnimation(`leave`)},t.prototype._updateCommon=function(e,t,n,r,i){var a=this.childAt(0),o=e.hostModel,s,c,l,u,d,f,p,m,h;if(r&&(s=r.emphasisItemStyle,c=r.blurItemStyle,l=r.selectItemStyle,u=r.focus,d=r.blurScope,p=r.labelStatesModels,m=r.hoverScale,h=r.cursorStyle,f=r.emphasisDisabled),!r||e.hasItemOption){var g=r&&r.itemModel?r.itemModel:e.getItemModel(t),_=g.getModel(`emphasis`);s=_.getModel(`itemStyle`).getItemStyle(),l=g.getModel([`select`,`itemStyle`]).getItemStyle(),c=g.getModel([`blur`,`itemStyle`]).getItemStyle(),u=_.get(`focus`),d=_.get(`blurScope`),f=_.get(`disabled`),p=ty(g),m=_.getShallow(`scale`),h=g.getShallow(`cursor`)}var v=e.getItemVisual(t,`symbolRotate`);a.attr(`rotation`,(v||0)*Math.PI/180||0);var y=Fw(e.getItemVisual(t,`symbolOffset`),n);y&&(a.x=y[0],a.y=y[1]),h&&a.attr(`cursor`,h);var b=e.getItemVisual(t,`style`),x=b.fill;if(a instanceof Rf){var S=a.style;a.useStyle(V({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else a.__isEmptyBrush?a.useStyle(V({},b)):a.useStyle(b),a.style.decal=null,a.setColor(x,i&&i.symbolInnerColor),a.style.strokeNoScale=!0;var C=e.getItemVisual(t,`liftZ`),w=this._z2;C==null?w!=null&&(a.z2=w,this._z2=null):w??(this._z2=a.z2,a.z2+=C);var T=i&&i.useNameLabel;ey(a,p,{labelFetcher:o,labelDataIndex:t,defaultText:E,inheritColor:x,defaultOpacity:b.opacity});function E(t){return T?e.getName(t):Lw(e,t)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var D=a.ensureState(`emphasis`);D.style=s,a.ensureState(`select`).style=l,a.ensureState(`blur`).style=c;var O=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;D.scaleX=this._sizeX*O,D.scaleY=this._sizeY*O,this.setSymbolScale(1),mg(this,u,d,f)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var r=this.childAt(0),i=rh(this).dataIndex,a=n&&n.animation;if(this.silent=r.silent=!0,n&&n.fadeLabel){var o=r.getTextContent();o&&$_(o,{style:{opacity:0}},t,{dataIndex:i,removeOpt:a,cb:function(){r.removeTextContent()}})}else r.removeTextContent();$_(r,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:i,cb:e,removeOpt:a})},t.getSymbolSize=function(e,t){return Pw(e.getItemVisual(t,`symbolSize`))},t.getSymbolZ2=function(e,t){return e.getItemVisual(t,`z2`)},t}(qg);function Bw(e,t){this.parent.drift(e,t)}function Vw(e,t,n,r){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(r&&r.isIgnore&&r.isIgnore(n))&&!(r&&r.clipShape&&!r.clipShape.contain(t[0],t[1]))&&e.getItemVisual(n,`symbol`)!==`none`}function Hw(e){return e!=null&&!J(e)&&(e={isIgnore:e}),e||{}}function Uw(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{emphasisItemStyle:n.getModel(`itemStyle`).getItemStyle(),blurItemStyle:t.getModel([`blur`,`itemStyle`]).getItemStyle(),selectItemStyle:t.getModel([`select`,`itemStyle`]).getItemStyle(),focus:n.get(`focus`),blurScope:n.get(`blurScope`),emphasisDisabled:n.get(`disabled`),hoverScale:n.get(`scale`),labelStatesModels:ty(t),cursorStyle:t.get(`cursor`)}}function Ww(e,t,n,r,i,a,o){var s=new e(t,n,r,i);return s.setPosition(a),t.setItemGraphicEl(n,s),o.add(s),s}var Gw=function(){function e(e){this.group=new qg,this._SymbolCtor=e||zw}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=Hw(t);var n=this.group,r=e.hostModel,i=this._data,a=this._SymbolCtor,o=t.disableAnimation,s=this._seriesScope=Uw(e),c={disableAnimation:o},l=t.getSymbolPoint||function(t){return e.getItemLayout(t)};i||n.removeAll(),e.diff(i).add(function(r){var i=l(r);Vw(e,i,r,t)&&Ww(a,e,r,s,c,i,n)}).update(function(u,d){var f=i.getItemGraphicEl(d),p=l(u);if(!Vw(e,p,u,t)){n.remove(f);return}var m=e.getItemVisual(u,`symbol`)||`circle`,h=f&&f.getSymbolType&&f.getSymbolType();if(!f||h&&h!==m)n.remove(f),f=new a(e,u,s,c),f.setPosition(p);else{f.updateData(e,u,s,c);var g={x:p[0],y:p[1]};o?f.attr(g):X_(f,g,r)}n.add(f),e.setItemGraphicEl(u,f)}).remove(function(e){var t=i.getItemGraphicEl(e);t&&t.fadeOut(function(){n.remove(t)},r)}).execute(),this._getSymbolPoint=l,this._data=e},e.prototype.updateLayout=function(e){var t=this._data;if(t)for(var n=this,r=t.getStore(),i=0,a=r.count();i0?n=r[0]:r[1]<0&&(n=r[1]),n}function Jw(e,t,n,r){var i=NaN;e.stacked&&(i=n.get(n.getCalculationInfo(`stackedOverDimension`),r)),isNaN(i)&&(i=e.valueStart);var a=e.baseDataOffset,o=[];return o[a]=n.get(e.baseDim,r),o[1-a]=i,t.dataToPoint(o)}function Yw(e,t){return!isFinite(e)||!isFinite(t)}var Xw=typeof Float32Array<`u`?Float32Array:void 0,Zw=typeof Float64Array<`u`?Float64Array:void 0;function Qw(e){return $w({ctor:Xw},e).arr}function $w(e,t){var n=e.arr,r=e.ctor;if(t>Lp&&(t=Lp),!n||e.typed&&n.length=i||h<0)break;if(Yw(_,v)){if(c){h+=a;continue}break}if(h===n)e[a>0?`moveTo`:`lineTo`](_,v),d=_,f=v;else{var y=_-l,b=v-u;if(y*y+b*b<.5){h+=a;continue}if(o>0){for(var x=h+a,S=t[x*2],C=t[x*2+1];S===_&&C===v&&g=r||Yw(S,C))p=_,m=v;else{E=S-l,D=C-u;var A=_-l,j=S-_,M=v-u,N=C-v,P=void 0,ee=void 0;if(s===`x`){P=Math.abs(A),ee=Math.abs(j);var te=E>0?1:-1;p=_-te*P*o,m=v,O=_+te*ee*o,k=v}else if(s===`y`){P=Math.abs(M),ee=Math.abs(N);var ne=D>0?1:-1;p=_,m=v-ne*P*o,O=_,k=v+ne*ee*o}else P=Math.sqrt(A*A+M*M),ee=Math.sqrt(j*j+N*N),T=ee/(ee+P),p=_-E*o*(1-T),m=v-D*o*(1-T),O=_+E*o*T,k=v+D*o*T,O=nT(O,rT(S,_)),k=nT(k,rT(C,v)),O=rT(O,nT(S,_)),k=rT(k,nT(C,v)),E=O-_,D=k-v,p=_-E*P/ee,m=v-D*P/ee,p=nT(p,rT(l,_)),m=nT(m,rT(u,v)),p=rT(p,nT(l,_)),m=rT(m,nT(u,v)),E=_-p,D=v-m,O=_+E*ee/P,k=v+D*ee/P}e.bezierCurveTo(d,f,p,m,_,v),d=O,f=k}else e.lineTo(_,v)}l=_,u=v,h+=a}return g}var aT=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),oT=function(e){z(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polyline`,n}return t.prototype.getDefaultStyle=function(){return{stroke:Q.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new aT},t.prototype.buildPath=function(e,t){var n=t.points,r=0,i=n.length/2;if(t.connectNulls){for(;i>0&&Yw(n[i*2-2],n[i*2-1]);i--);for(;r=0){var _=o?(d-a)*g+a:(u-i)*g+i;return o?[e,_]:[_,e]}i=u,a=d;break;case r.C:u=n[c++],d=n[c++],f=n[c++],p=n[c++],m=n[c++],h=n[c++];var v=o?vl(i,u,f,m,e,s):vl(a,d,p,h,e,s);if(v>0)for(var y=0;y=0){var _=o?gl(a,d,p,h,b):gl(i,u,f,m,b);return o?[e,_]:[_,e]}}i=m,a=h}}},t}(Mf),sT=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(aT),cT=function(e){z(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polygon`,n}return t.prototype.getDefaultShape=function(){return new sT},t.prototype.buildPath=function(e,t){var n=t.points,r=t.stackedOnPoints,i=0,a=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;a>0&&Yw(n[a*2-2],n[a*2-1]);a--);for(;i=t[0]&&e<=t[1]},getExtent:function(){return this._extents[0].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){IT(this._extents,0,e,t)},setExtent2:function(e,t,n){var r=this._extents;r[e]||(r[e]=r[0].slice()),IT(r,e,t,n)},freeze:function(){}};function IT(e,t,n,r){Gm(n,r)&&(e[t][0]=n,e[t][1]=r)}function LT(e){return RT(e)||BT(e)}function RT(e){return e.type===`interval`}function zT(e){return e.type===`time`}function BT(e){return e.type===`log`}function VT(e){return e.type===`ordinal`}function HT(e){var t=Up(e),n=bp(10,t),r=_p(e/n);return r?r===2?r=3:r===3?r=5:r*=2:r=1,jp(r*n,-t)}function UT(e){return Np(e)+2}function WT(e,t){return xp(e)/xp(t)}function GT(e,t,n){var r=n&&n.lookup;if(r){for(var i=0;i1&&a/o>2&&(i=Math.round(Math.ceil(i/o)*o)),i!==r[0]&&c(r[0],!0,!0);for(var s=i;s<=r[1];s+=o)c(s,!1,s===r[0]||s===r[1]);s-o!==r[1]&&c(r[1],!0,!0);function c(e,t,r){n({value:e,offInterval:t},r)}}var XT=function(e){z(t,e);function t(n){var r=e.call(this)||this;r.type=`ordinal`,r.parse=t.parse,OT(r,t.decoratedMethods);var i=n.ordinalMeta;i||=new wT({}),G(i)&&(i=new wT({categories:U(i,function(e){return J(e)?e.value:e})})),r._ordinalMeta=i;var a=DT(null,null,n.extent||[0,i.categories.length-1]);return r._mapper=a.mapper,kT(r,a.mapper),r}return t.parse=function(e){return e==null?e=NaN:q(e)?(e=this._ordinalMeta.getOrdinal(e),e??=NaN):e=_p(e),e},t.prototype.getTicks=function(){var e=[];return YT(this,0,function(t){e.push(t)}),e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(e==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],r=this._ticksByOrdinalNumber=[],i=0,a=this._ordinalMeta.categories.length,o=mp(a,t.length);i=0&&e=0&&e=0&&eo[0]&&mi[1]||!isFinite(p)||!isFinite(i[1]))break}else{if(m>f)break;p=mp(p,i[1]),m===f&&(p=i[1])}if(l.push({value:p}),p=jp(p+n,a),s){var h=s.calcNiceTickMultiple(p,d);h>=0&&(p=jp(p+h*n,a))}if(l.length>0&&p===l[l.length-1].value)break;if(l.length>u)return[]}var g=l.length?l[l.length-1].value:i[1];return r[1]>g&&l.push({value:e.expandToNicedExtent?jp(g+n,a):r[1]}),c&&o.pruneTicksByBreak(e.pruneByBreak,l,s.breaks,function(e){return e.value},t.interval,r),c&&e.breakTicks!==`none`&&o.addBreaksToTicks(l,s.breaks,r),l},t.prototype.getMinorTicks=function(e){return ZT(this,e,oS(this),this._cfg.interval)},t.prototype.getLabel=function(e,t){if(e==null)return``;var n=t&&t.precision;return n==null?n=Np(e.value)||0:n===`auto`&&(n=this._cfg.intervalPrecision),WS(jp(e.value,n,!0))},t.type=`interval`,t}(ST);ST.registerClass(QT);var $T=function(e,t,n,r){for(;n>>1;e[i][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function iE(e){var t=30*dS;return e/=t,e>6?6:e>3?3:e>2?2:1}function aE(e){return e/=uS,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function oE(e,t){return e/=t?lS:cS,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function sE(e){return hp(Wp(e,!0),1)}function cE(e,t,n){var r=Math.max(0,ro(vS,t)-1);return kS(new Date(e),vS[r],n).getTime()}function lE(e,t){var n=new Date(0);n[e](1);var r=n.getTime();n[e](1+t);var i=n.getTime()-r;return function(e,t){return Math.max(0,Math.round((t-e)/i))}}function uE(e,t,n,r,i,a){var o=yS,s=0;function c(e,t,n,i,o,c,l){for(var u=lE(o,e),d=t,f=new Date(d);d3e3));)if(f[o](f[i]()+e),d=f.getTime(),a){var p=a.calcNiceTickMultiple(d,u);p>0&&(f[o](f[i]()+p*e),d=f.getTime())}l.push({value:d,notAdd:d>r[1]})}function l(e,i,a){var o=[],s=!i.length;if(!nE(CS(e),r[0],r[1],n)){s&&(i=[{value:cE(r[0],e,n)},{value:r[1]}]);for(var l=0;l=r[0]&&u<=r[1]&&c(f,u,d,p,m,h,o),e===`year`&&a.length>1&&l===0&&a.unshift({value:a[0].value-f})}}for(var l=0;l=r[0]&&v<=r[1]&&f++)}var y=i/t;if(f>y*1.5&&p>y/1.5||(u.push(g),f>y||e===o[m]))break}d=[]}}for(var b=co(U(u,function(e){return co(e,function(e){return e.value>=r[0]&&e.value<=r[1]&&!e.notAdd})}),function(e){return e.length>0}),x=b.length-1,S=[],m=0;mr[0])&&S.unshift({value:r[0],time:{level:0,upperTimeUnit:O,lowerTimeUnit:O},notNice:!0}),(!D||D.values&&(a=s);var c=tE.length,l=Math.min($T(tE,a,0,c),c-1),u=tE[l][1],d=tE[Math.max(l-1,0)][0];e.setTimeInterval({approxInterval:a,interval:u,minLevelUnit:d})};ST.registerClass(eE);var fE=0,pE=1,mE=2,hE=function(e){z(t,e);function t(n){var r=e.call(this)||this;r.type=`log`,r.parse=QT.parse,r.base=n.logBase||10;var i=[],a=[],o=r._lookup={from:i,to:a};i[fE]=i[pE]=a[fE]=a[pE]=NaN,OT(r,t.mapperMethods);var s=iS(),c=n.breakOption,l={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(c,r,{noNegative:!0},mE,l),r.powStub=new QT({breakParsed:l.original}),r.intervalStub=new QT({breakParsed:l.transformed}),kT(r,r.intervalStub),r}return t.prototype.getTicks=function(e){var t=this.base,n=this.powStub,r=iS(),i=this.intervalStub,a={lookup:{from:i.getExtent(),to:n.getExtent()}};return U(i.getTicks(e||{}),function(e){var i=e.value,o=GT(i,t,a),s;if(r){var c=r.getTicksBreakOutwardTransform(this,e,oS(n),this._lookup);c&&(s=c.vBreak,o=c.tickVal)}return{value:o,break:s}},this)},t.prototype.getMinorTicks=function(e){return ZT(this,e,oS(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(e,t){return this.intervalStub.getLabel(e,t)},t.type=`log`,t.mapperMethods={needTransform:function(){return!0},normalize:function(e){return this.intervalStub.normalize(WT(e,this.base))},scale:function(e){return GT(this.intervalStub.scale(e),this.base,null)},transformIn:function(e,t){return e=WT(e,this.base),t&&t.depth===2?e:this.intervalStub.transformIn(e,t)},transformOut:function(e,t){var n=t?t.depth:null;return gE.depth=n,_E.lookup=this._lookup,GT(n===2?e:this.intervalStub.transformOut(e,gE),this.base,_E)},contain:function(e){return this.powStub.contain(e)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){if(!(!Gm(t,n)||t<=0||n<=0)){var r=vE,i=vE;if(e===0){var a=this._lookup;r=a.to,i=a.from}this.powStub.setExtent2(e,r[fE]=t,r[pE]=n);var o=this.base;this.intervalStub.setExtent2(e,i[fE]=WT(t,o),i[pE]=WT(n,o))}},getFilter:function(){return{g:0}},sanitize:function(e,t){return Gm(t[0],t[1])&&Zp(e)&&e<=0&&(e=t[0]),e},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(e,t){return t===null?this.powStub.getExtentUnsafe(e,null):this.intervalStub.getExtentUnsafe(e,t)}},t}(ST);ST.registerClass(hE);var gE={},_E={},vE=[],yE={value:1,category:1,time:1,log:1},bE=Om();function xE(e){var t=e.get(`type`);return(t==null||!Io(yE,t)&&!ST.getClass(t))&&(t=`value`),t}function SE(e,t,n){var r=iS(),i;switch(r&&(i=NE(e,t,n)),t){case`category`:return new XT({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:zm()});case`time`:return new eE({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get(`useUTC`),breakOption:i});case`log`:return new hE({logBase:e.get(`logBase`),breakOption:i});case`value`:return new QT({breakOption:i});default:return new((ST.getClass(t))||QT)({})}}function CE(e,t,n){var r=n?jT(e,null):e.getExtentUnsafe(0,null),i=r[0],a=r[1];return Gm(i,a)?i===t||a===t?2:it?1:3:3}function wE(e){bE(e).noOnMyZero=!0}function TE(e){return bE(e).noOnMyZero}function EE(e){var t=e.getLabelModel().get(`formatter`);if(e.type===`time`){var n=bS(t);return function(t,r){return e.scale.getFormattedLabel(t,r,n)}}if(q(t))return function(n){var r=e.scale.getLabel(n);return t.replace(`{value}`,r??``)};if(K(t)){if(e.type===`category`)return function(n,r){return t(DE(e,n),n.value-e.scale.getExtent()[0],null)};var r=iS();return function(n,i){var a=null;return r&&(a=r.makeAxisLabelFormatterParamBreak(a,n.break)),t(DE(e,n),i,a)}}return function(t){return e.scale.getLabel(t)}}function DE(e,t){var n=e.scale;return VT(n)?n.getLabel(t):t.value}function OE(e){return e.get(`interval`)??`auto`}function kE(e){return e.type===`category`&&OE(e.getLabelModel())===0}function AE(e,t){var n={};return H(e.mapDimensionsAll(t),function(t){n[yx(e,t)]=!0}),uo(n)}function jE(e){return e===`middle`||e===`center`}function ME(e){return e.getShallow(`show`)}function NE(e,t,n){var r=e.get(`breaks`,!0);if(r!=null)return!iS()||!n||!PE(t)?void 0:r}function PE(e){return e!==`category`}function FE(e,t,n,r,i,a){var o=BT(e),s=o?e.intervalStub:e;if(s.setExtent(r[0],r[1]),o){var c=e.powStub,l={depth:2},u=e.transformOut(r[0],l),d=e.transformOut(r[1],l),f=qT(n,r);t[0]&&!f[0]&&(u=i[0]),t[1]&&!f[1]&&(d=i[1]),c.setExtent(u,d)}s.setConfig(a)}function IE(e,t){return VT(e)?e.getRawOrdinalNumber(t.value):t.value}function LE(e,t){return VT(e)&&!!t.get(`boundaryGap`)}function RE(e,t){if(e.length===t.length){for(var n=0;nt){a?n.push(o(a,c,t)):i&&n.push(o(i,c,0),o(i,c,t));break}else i&&=(n.push(o(i,c,0)),null),n.push(c),a=c}return n}function GE(e,t,n){var r=e.getVisual(`visualMeta`);if(r&&r.length&&e.count()&&t.type===`cartesian2d`){for(var i,a,o=r.length-1;o>=0;o--){var s=e.getDimensionInfo(r[o].dimension);if(i=s&&s.coordDim,i===`x`||i===`y`){a=r[o];break}}if(a){var c=t.getAxis(i),l=U(a.stops,function(e){return{coord:c.toGlobalCoord(c.dataToCoord(e.value)),color:e.color}}),u=l.length,d=a.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),d.reverse());var f=WE(l,i===`x`?n.getWidth():n.getHeight()),p=f.length;if(!p&&u)return l[0].coord<0?d[1]?d[1]:l[u-1].color:d[0]?d[0]:l[0].color;var m=10,h=f[0].coord-m,g=f[p-1].coord+m,_=g-h;if(_<.001)return`transparent`;H(f,function(e){e.offset=(e.coord-h)/_}),f.push({offset:p?f[p-1].offset:.5,color:d[1]||`transparent`}),f.unshift({offset:p?f[0].offset:.5,color:d[0]||`transparent`});var v=new P_(0,0,0,0,f,!0);return v[i]=h,v[i+`2`]=g,v}}}function KE(e,t,n){var r=e.get(`showAllSymbol`),i=r===`auto`;if(!r||i){var a=n.getAxesByScale(`ordinal`)[0];if(a&&!(i&&qE(a,t))){var o=t.mapDimension(a.dim),s={};return H(a.getViewLabels(),function(e){e.tick.offInterval||(s[IE(a.scale,e.tick)]=1)}),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function qE(e,t){var n=e.getExtent(),r=Math.abs(n[1]-n[0])/e.scale.count();isNaN(r)&&(r=0);for(var i=t.count(),a=Math.max(1,Math.round(i/5)),o=0;or)return!1;return!0}function JE(e){for(var t=e.length/2;t>0&&Yw(e[t*2-2],e[t*2-1]);t--);return t-1}function YE(e,t){return[e[t*2],e[t*2+1]]}function XE(e,t,n){for(var r=e.length/2,i=n===`x`?0:1,a,o,s=0,c=-1,l=0;l=t||a>=t&&o<=t){c=l;break}s=l,a=o}return{range:[s,c],t:(t-a)/(o-a)}}function ZE(e){if(e.get([`endLabel`,`show`]))return!0;for(var t=0;t0&&e.get([`emphasis`,`lineStyle`,`width`])===`bolder`){var M=f.getState(`emphasis`).style;M.lineWidth=+f.style.lineWidth+1}rh(f).seriesIndex=e.seriesIndex,mg(f,k,A,j);var N=VE(e.get(`smooth`)),P=e.get(`smoothMonotone`);if(f.setShape({smooth:N,smoothMonotone:P,connectNulls:x}),p){var ee=a.getCalculationInfo(`stackedOnSeries`),te=0;p.useStyle(no(s.getAreaStyle(),{fill:E,opacity:.7,lineJoin:`bevel`,decal:a.getVisual(`style`).decal})),ee&&(te=VE(ee.get(`smooth`))),p.setShape({smooth:N,stackedOnSmooth:te,smoothMonotone:P,connectNulls:x}),vg(p,e,`areaStyle`),rh(p).seriesIndex=e.seriesIndex,mg(p,k,A,j)}var ne=this._changePolyState;a.eachItemGraphicEl(function(e){e&&(e.onHoverStateChange=ne)}),this._polyline.onHoverStateChange=ne,this._data=a,this._coordSys=r,this._stackedOnPoints=y,this._points=c,this._step=w,this._valueOrigin=_;var re=e.get(`triggerEvent`),ie=e.get(`triggerLineEvent`),ae=ie===!0||re===!0||re===`line`,oe=ie===!0||re===!0||re===`area`;this.packEventData(e,f,ae),p&&this.packEventData(e,p,oe)},t.prototype.packEventData=function(e,t,n){rh(t).eventData=n?{componentType:`series`,componentSubType:`line`,componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:`line`,selfType:t===this._polygon?`area`:`line`}:null},t.prototype.highlight=function(e,t,n,r){var i=e.getData(),a=Dm(i,r);if(this._changePolyState(`emphasis`),!(a instanceof Array)&&a!=null&&a>=0){var o=i.getLayout(`points`),s=i.getItemGraphicEl(a);if(!s){var c=o[a*2],l=o[a*2+1];if(Yw(c,l)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,l))return;var u=e.get(`zlevel`)||0,d=e.get(`z`)||0;s=new zw(i,a),s.x=c,s.y=l,s.setZ(u,d);var f=s.getSymbolPath().getTextContent();f&&(f.zlevel=u,f.z=d,f.z2=this._polyline.z2+1),s.__temp=!0,i.setItemGraphicEl(a,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else fT.prototype.highlight.call(this,e,t,n,r)},t.prototype.downplay=function(e,t,n,r){var i=e.getData(),a=Dm(i,r);if(this._changePolyState(`normal`),a!=null&&a>=0){var o=i.getItemGraphicEl(a);o&&(o.__temp?(i.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else fT.prototype.downplay.call(this,e,t,n,r)},t.prototype._changePolyState=function(e){var t=this._polygon;Bh(this._polyline,e),t&&Bh(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new oT({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new cT({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var r,i,a=t.getBaseAxis(),o=a.inverse;t.type===`cartesian2d`?(r=a.isHorizontal(),i=!1):t.type===`polar`&&(r=a.dim===`angle`,i=!0);var s=e.hostModel,c=s.get(`animationDuration`);K(c)&&(c=c(null));var l=s.get(`animationDelay`)||0,u=K(l)?l(null):l;e.eachItemGraphicEl(function(e,a){var s=e;if(s){var d=[e.x,e.y],f=void 0,p=void 0,m=void 0;if(n){if(i){var h=n,g=t.pointToCoord(d);r?(f=h.startAngle,p=h.endAngle,m=-g[1]/180*Math.PI):(f=h.r0,p=h.r,m=g[0])}else{var _=n;r?(f=_.x,p=_.x+_.width,m=e.x):(f=_.y+_.height,p=_.y,m=e.y)}}var v=p===f?0:(m-f)/(p-f);o&&(v=1-v);var y=K(l)?l(a):c*v+u,b=s.getSymbolPath(),x=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:y}),x&&x.animateFrom({style:{opacity:0}},{duration:300,delay:y}),b.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(e,t,n){var r=e.getModel(`endLabel`);if(ZE(e)){var i=e.getData(),a=this._polyline,o=i.getLayout(`points`);if(!o){a.removeTextContent(),this._endLabel=null;return}var s=this._endLabel;s||(s=this._endLabel=new Zf({z2:200}),s.ignoreClip=!0,a.setTextContent(this._endLabel),a.disableLabelAnimation=!0);var c=JE(o);c>=0&&(ey(a,ty(e,`endLabel`),{inheritColor:n,labelFetcher:e,labelDataIndex:c,defaultText:function(e,t,n){return n==null?Lw(i,e):Rw(i,n)},enableTextSetter:!0},$E(r,t)),a.textConfig.position=null)}else this._endLabel&&=(this._polyline.removeTextContent(),null)},t.prototype._endLabelOnDuring=function(e,t,n,r,i,a,o){var s=this._endLabel,c=this._polyline;if(s){e<1&&r.originalX==null&&(r.originalX=s.x,r.originalY=s.y);var l=n.getLayout(`points`),u=n.hostModel,d=u.get(`connectNulls`),f=a.get(`precision`),p=a.get(`distance`)||0,m=o.getBaseAxis(),h=m.isHorizontal(),g=m.inverse,_=t.shape,v=g?h?_.x:_.y+_.height:h?_.x+_.width:_.y,y=(h?p:0)*(g?-1:1),b=(h?0:-p)*(g?-1:1),x=h?`x`:`y`,S=XE(l,v,x),C=S.range,w=C[1]-C[0],T=void 0;if(w>=1){if(w>1&&!d){var E=YE(l,C[0]);s.attr({x:E[0]+y,y:E[1]+b}),i&&(T=u.getRawValue(C[0]))}else{var E=c.getPointOn(v,x);E&&s.attr({x:E[0]+y,y:E[1]+b});var D=u.getRawValue(C[0]),O=u.getRawValue(C[1]);i&&(T=Rm(n,f,D,O,S.t))}r.lastFrameIndex=C[0]}else{var k=e===1||r.lastFrameIndex>0?C[0]:0,E=YE(l,k);i&&(T=u.getRawValue(k)),s.attr({x:E[0]+y,y:E[1]+b})}if(i){var A=dy(s);typeof A.setLabelText==`function`&&A.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,r,i,a,o){var s=this._polyline,c=this._polygon,l=e.hostModel,u=tT(this._data,e,this._stackedOnPoints,t,this._coordSys,n,this._valueOrigin,a),d=u.current,f=u.stackedOnCurrent,p=u.next,m=u.stackedOnNext;if(i&&(f=UE(u.stackedOnCurrent,u.current,n,i,o),d=UE(u.current,null,n,i,o),m=UE(u.stackedOnNext,u.next,n,i,o),p=UE(u.next,null,n,i,o)),BE(d,p)>3e3||c&&BE(f,m)>3e3){s.stopAnimation(),s.setShape({points:p}),c&&(c.stopAnimation(),c.setShape({points:p,stackedOnPoints:m}));return}s.shape.__points=u.current,s.shape.points=d;var h={shape:{points:p}};u.current!==d&&(h.shape.__points=u.next),s.stopAnimation(),X_(s,h,l),c&&(c.setShape({points:d,stackedOnPoints:f}),c.stopAnimation(),X_(c,{shape:{stackedOnPoints:m}},l),s.shape.points!==c.shape.points&&(c.shape.points=s.shape.points));for(var g=[],_=u.status,v=0;v<_.length;v++)if(_[v].cmd===`=`){var y=e.getItemGraphicEl(_[v].idx1);y&&g.push({el:y,ptIdx:v})}s.animators&&s.animators.length&&s.animators[0].during(function(){c&&c.dirtyShape();for(var e=s.shape.__points,t=0;tt&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;n10&&a.type===`cartesian2d`&&i){var s=a.getBaseAxis(),c=a.getOtherAxis(s),l=s.getExtent(),u=n.getDevicePixelRatio(),d=Math.abs(l[1]-l[0])*(u||1),f=Math.round(o/d);if(isFinite(f)&&f>1){i===`lttb`?e.setData(r.lttbDownSample(r.mapDimension(c.dim),1/f)):i===`minmax`&&e.setData(r.minmaxDownSample(r.mapDimension(c.dim),1/f));var p=void 0;q(i)?p=nD[i]:K(i)&&(p=i),p&&e.setData(r.downSample(r.mapDimension(c.dim),1/f,p,rD))}}}}}function aD(e){e.registerChartView(eD),e.registerSeriesModel(Iw),e.registerLayout(tD(`line`,!0)),e.registerVisual({seriesType:`line`,reset:function(e){var t=e.getData(),n=e.getModel(`lineStyle`).getLineStyle();n&&!n.stroke&&(n.stroke=t.getVisual(`style`).fill),t.setVisual(`legendLineStyle`,n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,iD(`line`))}var oD=Om(),sD=Om(),cD={estimate:1,determine:2};function lD(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function uD(e,t){var n=e.getLabelModel().get(`customValues`);if(n){var r=e.scale;return{labels:U(fD(n,r),function(t,n){return{formattedLabel:EE(e)(t,n),rawLabel:r.getLabel(t),tick:t}})}}return e.type===`category`?pD(e,t):gD(e)}function dD(e,t,n){var r=e.scale,i=e.getTickModel().get(`customValues`);return i?{ticks:fD(i,r)}:e.type===`category`?hD(e,t):{ticks:r.getTicks(n)}}function fD(e,t){var n=t.getExtent(),r=[];return H(e,function(e){e=t.parse(e),e>=n[0]&&e<=n[1]&&r.push(e)}),Xm(r,Qm,null),Mp(r),U(r,function(e){return{value:e}})}function pD(e,t){var n=e.getLabelModel(),r=mD(e,n,t);return!n.get(`show`)||e.scale.isBlank()?{labels:[]}:r}function mD(e,t,n){var r=vD(e),i=OE(t),a=n.kind===cD.estimate;if(!a){var o=bD(r,i);if(o)return o}var s,c;K(i)?s=DD(e,i,!1):(c=i===`auto`?SD(e,n):i,s=DD(e,c,!1));var l={labels:s,labelCategoryInterval:c};return a?n.out.noPxChangeTryDetermine.push(function(){return xD(r,i,l),!0}):xD(r,i,l),l}function hD(e,t){var n=_D(e),r=OE(t),i=bD(n,r);if(i)return i;var a,o;if((!t.get(`show`)||e.scale.isBlank())&&(a=[]),K(r))a=DD(e,r,!0);else if(r===`auto`){var s=mD(e,e.getLabelModel(),lD(cD.determine));o=s.labelCategoryInterval,a=U(s.labels,function(e){return e.tick})}else o=r,a=DD(e,o,!0);return xD(n,r,{ticks:a,tickCategoryInterval:o})}function gD(e){var t=e.scale.getTicks(),n=EE(e);return{labels:U(t,function(t,r){return{formattedLabel:n(t,r),rawLabel:e.scale.getLabel(t),tick:t}})}}var _D=yD(`axisTick`),vD=yD(`axisLabel`);function yD(e){return function(t){return sD(t)[e]||(sD(t)[e]={list:[]})}}function bD(e,t){for(var n=0;nu&&(l=Math.max(1,Math.floor(c/u)));for(var d=s[0],f=e.dataToCoord(d+1)-e.dataToCoord(d),p=Math.abs(f*Math.cos(a)),m=Math.abs(f*Math.sin(a)),h=0,g=0;d<=s[1];d+=l){var _=0,v=0,y=vc(i({value:d}),r.font,`center`,`top`);_=y.width*1.3,v=y.height*1.3,h=Math.max(h,_,7),g=Math.max(g,v,7)}var b=h/p,x=g/m;isNaN(b)&&(b=1/0),isNaN(x)&&(x=1/0);var S=Math.max(0,Math.floor(Math.min(b,x)));return n===cD.estimate?(t.out.noPxChangeTryDetermine.push(W(wD,null,e,S,c)),S):TD(e,S,c)??S}function wD(e,t,n){return TD(e,t,n)==null}function TD(e,t,n){var r=oD(e.model),i=e.getExtent(),a=r.lastAutoInterval,o=r.lastTickCount;if(a!=null&&o!=null&&Math.abs(a-t)<=1&&Math.abs(o-n)<=1&&a>t&&r.axisExtent0===i[0]&&r.axisExtent1===i[1])return a;r.lastTickCount=n,r.lastAutoInterval=t,r.axisExtent0=i[0],r.axisExtent1=i[1]}function ED(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get(`rotate`)||0,font:t.getFont()}}function DD(e,t,n){var r=EE(e),i=e.scale,a=[],o=K(t);return YT(i,o?0:t,function(e,s){var c=i.getLabel(e);if(o){var l=!!t(e.value,c);if(e.offInterval=!l,!l&&!s)return}a.push(n?e:{formattedLabel:r(e),rawLabel:c,tick:e})}),a}var OD=Om();function kD(e){OD(e).prepare={}}function AD(e){OD(e).fullUpdate={}}function jD(e){return OD(e).prepare}function MD(e){return OD(e).fullUpdate}var ND=Jm(),PD=Om(),FD=Om();function ID(e,t){var n=e.model,r=PD(MD(n.ecModel)).keyed,i=r&&r.get(t);return i&&i.get(n.uid)}function LD(e,t){return BD(ID(e,t))}function RD(e,t){var n=[];return zD(e.model.ecModel,function(e){for(var r=0;r0?(t>o&&(o=t),a=!1):t===-2&&(a=!0))}),Zp(n)&&n>0&&Zp(o)?(e.w=r/n*o,e.w2=o):a&&(e.w=r*$D,e.w2=e.w*n/r)}var rO=[0,1],iO=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]);return e>=n&&e<=r},e.prototype.containData=function(e){return this.scale.contain(this.scale.parse(e))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this.scale;return e=n.normalize(n.parse(e)),Tp(e,rO,aO(this),t)},e.prototype.coordToData=function(e,t){var n=Tp(e,aO(this),rO,t);return this.scale.scale(n)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){e||={};var t=e.tickModel||this.getTickModel(),n=U(dD(this,t,{breakTicks:e.breakTicks,pruneByBreak:e.pruneByBreak}).ticks,function(e){return{coord:this.dataToCoord(IE(this.scale,e)),tick:e}},this),r=t.get(`alignWithLabel`),i=oO(this,n,r);return U(n,function(e){return{coord:e.coord,tickValue:e.tick.value,onBand:i}})},e.prototype.getMinorTicksCoords=function(){if(VT(this.scale))return[];var e=this.model.getModel(`minorTick`).get(`splitNumber`);return e>0&&e<100||(e=5),U(this.scale.getMinorTicks(e),function(e){return U(e,function(e){return{coord:this.dataToCoord(e),tickValue:e}},this)},this)},e.prototype.getViewLabels=function(e){return e||=lD(cD.determine),uD(this,e).labels},e.prototype.getLabelModel=function(){return this.model.getModel(`axisLabel`)},e.prototype.getTickModel=function(){return this.model.getModel(`axisTick`)},e.prototype.getBandWidth=function(){return eO(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(e){return e||=lD(cD.determine),CD(this,e)},e}();function aO(e){var t=e.getExtent();if(e.onBand){var n=(t[1]-t[0])/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function oO(e,t,n){var r=t.length;if(!e.onBand||n||!r)return!1;var i=eO(e).w;if(!i)return!1;H(t,function(e){e.coord-=i/2});var a=e.scale.getExtent(),o=t[r-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+i,tick:{value:a[1]+1}}),!0}var sO=function(e){z(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r)||this;return o.index=0,o.type=i||`value`,o.position=a||`bottom`,o}return t.prototype.isHorizontal=function(){var e=this.position;return e===`top`||e===`bottom`},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e[this.dim===`x`?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if(this.type!==`category`)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(iO),cO=[`label`,`labelLine`,`layoutOption`,`priority`,`defaultAttr`,`marginForce`,`minMarginForce`,`marginDefault`,`suggestIgnore`],lO=1,uO=2,dO=lO|uO;function fO(e,t,n){n||=dO,t?e.dirty|=n:e.dirty&=~n}function pO(e,t){return t||=dO,e.dirty==null||!!(e.dirty&t)}function mO(e){if(e)return pO(e)&&hO(e,e.label,e),e}function hO(e,t,n){var r=t.getComputedTransform();e.transform=Hv(e.transform,r);var i=e.localRect=Vv(e.localRect,t.getBoundingRect()),a=t.style,o=a.margin,s=n&&n.marginForce,c=n&&n.minMarginForce,l=n&&n.marginDefault,u=a.__marginType;u==null&&l&&(o=l,u=py.textMargin);for(var d=0;d<4;d++)gO[d]=u===py.minMargin&&c&&c[d]!=null?c[d]:s&&s[d]!=null?s[d]:o?o[d]:0;u===py.textMargin&&Nv(i,gO,!1,!1);var f=e.rect=Vv(e.rect,i);return r&&f.applyTransform(r),u===py.minMargin&&Nv(f,gO,!1,!1),e.axisAligned=zv(r),(e.label=e.label||{}).ignore=t.ignore,fO(e,!1),fO(e,!0,uO),e}var gO=[0,0,0,0];function _O(e,t,n){return e.transform=Hv(e.transform,n),e.localRect=Vv(e.localRect,t),e.rect=Vv(e.rect,t),n&&e.rect.applyTransform(n),e.axisAligned=zv(n),e.obb=void 0,(e.label=e.label||{}).ignore=!1,e}function vO(e,t){if(e){e.label.x+=t.x,e.label.y+=t.y,e.label.markRedraw();var n=e.transform;n&&(n[4]+=t.x,n[5]+=t.y);var r=e.rect;r&&(r.x+=t.x,r.y+=t.y);var i=e.obb;i&&i.fromBoundingRect(e.localRect,n)}}function yO(e,t){for(var n=0;n.1?`x`:`y`,u=a.transGroup[l];if(o.sort(function(e,t){return Math.abs(e.label[l]-u)-Math.abs(t.label[l]-u)}),c&&s){var d=i.getExtent(),f=Math.min(d[0],d[1]),p=Math.max(d[0],d[1])-f;s.union(new Z(f,0,p,1))}a.stOccupiedRect=s,a.labelInfoList=o}var NO=ps(),PO=new Z(0,0,0,0),FO=function(e,t,n,r,i,a){if(jE(e.nameLocation)){var o=a.stOccupiedRect;o&&IO(_O({},o,a.transGroup.transform),r,i)}else LO(a.labelInfoList,a.dirVec,r,i)};function IO(e,t,n){var r=new zs;SO(e,t,r,{direction:Math.atan2(n.y,n.x),bidirectional:!1,touchThreshold:.05})&&vO(t,r)}function LO(e,t,n,r){for(var i=zs.dot(r,t)>=0,a=0,o=e.length;a0?`top`:`bottom`,i=`center`):zp(r-EO)?(a=n>0?`bottom`:`top`,i=`center`):(a=`middle`,i=r>0&&r0?`right`:`left`:n>0?`left`:`right`),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+`Index`]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get(`tooltip`);return e.get(`silent`)||!(e.get(`triggerEvent`)||t&&t.show)},e}(),zO=[`axisLine`,`axisTickLabelEstimate`,`axisTickLabelDetermine`,`axisName`],BO={axisLine:function(e,t,n,r,i,a,o){var s=r.get([`axisLine`,`show`]);if(s===`auto`&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),s){var c=r.axis.getExtent(),l=a.transform,u=[c[0],0],d=[c[1],0],f=u[0]>d[0];l&&(Is(u,u,l),Is(d,d,l));var p=V({lineCap:`round`},r.getModel([`axisLine`,`lineStyle`]).getLineStyle()),m={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:p};if(r.get([`axisLine`,`breakLine`])&&sS(r.axis.scale))wO().buildAxisBreakLine(r,i,a,m);else{var h=new T_(V({shape:{x1:u[0],y1:u[1],x2:d[0],y2:d[1]}},m));_v(h.shape,h.style.lineWidth),h.anid=`line`,i.add(h)}var g=r.get([`axisLine`,`symbol`]);if(g!=null){var _=r.get([`axisLine`,`symbolSize`]);q(g)&&(g=[g,g]),(q(_)||ho(_))&&(_=[_,_]);var v=Fw(r.get([`axisLine`,`symbolOffset`])||0,_),y=_[0],b=_[1];H([{rotate:e.rotation+Math.PI/2,offset:v[0],r:0},{rotate:e.rotation-Math.PI/2,offset:v[1],r:Math.sqrt((u[0]-d[0])*(u[0]-d[0])+(u[1]-d[1])*(u[1]-d[1]))}],function(t,n){if(g[n]!==`none`&&g[n]!=null){var r=Nw(g[n],-y/2,-b/2,y,b,p.stroke,!0),a=t.r+t.offset,o=f?d:u;r.attr({rotation:t.rotate,x:o[0]+a*Math.cos(e.rotation),y:o[1]-a*Math.sin(e.rotation),silent:!0,z2:11}),i.add(r)}})}}},axisTickLabelEstimate:function(e,t,n,r,i,a,o,s){YO(t,i,s)&&VO(e,t,n,r,i,a,o,cD.estimate)},axisTickLabelDetermine:function(e,t,n,r,i,a,o,s){YO(t,i,s)&&VO(e,t,n,r,i,a,o,cD.determine);var c=qO(e,i,a,r);WO(e,t.labelLayoutList,c),JO(e,i,a,r,e.tickDirection)},axisName:function(e,t,n,r,i,a,o,s){var c=n.ensureRecord(r);t.nameEl&&=(i.remove(t.nameEl),c.nameLayout=c.nameLocation=null);var l=e.axisName;if(nk(l)){var u=e.nameLocation,d=e.nameDirection,f=r.getModel(`nameTextStyle`),p=r.get(`nameGap`)||0,m=r.axis.getExtent(),h=r.axis.inverse?-1:1,g=new zs(0,0),_=new zs(0,0);u===`start`?(g.x=m[0]-h*p,_.x=-h):u===`end`?(g.x=m[1]+h*p,_.x=h):(g.x=(m[0]+m[1])/2,g.y=e.labelOffset+d*p,_.y=d);var v=ps();_.transform(vs(v,v,e.rotation));var y=r.get(`nameRotate`);y!=null&&(y=y*EO/180);var b,x;jE(u)?b=RO.innerTextLayout(e.rotation,y??e.rotation,d):(b=HO(e.rotation,u,y||0,m),x=e.raw.axisNameAvailableWidth,x!=null&&(x=Math.abs(x/Math.sin(b.rotation)),!isFinite(x)&&(x=null)));var S=f.getFont(),C=r.get(`nameTruncate`,!0)||{},w=C.ellipsis,T=xo(e.raw.nameTruncateMaxWidth,C.maxWidth,x),E=s.nameMarginLevel||0,D=new Zf({x:g.x,y:g.y,rotation:b.rotation,silent:RO.isLabelSilent(r),style:ny(f,{text:l,font:S,overflow:`truncate`,width:T,ellipsis:w,fill:f.getTextColor()||r.get([`axisLine`,`lineStyle`,`color`]),align:f.get(`align`)||b.textAlign,verticalAlign:f.get(`verticalAlign`)||b.textVerticalAlign}),z2:1});if(Iv({el:D,componentModel:r,itemName:l}),D.__fullText=l,D.anid=`name`,r.get(`triggerEvent`)){var O=RO.makeAxisEventDataBase(r);O.targetType=`axisName`,O.name=l,rh(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var k=c.nameLayout=mO({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:jE(u)?DO[E]:OO[E]});if(c.nameLocation=u,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&k){var A=n.ensureRecord(r);n.resolveAxisNameOverlap(e,n,r,k,_,A)}}}};function VO(e,t,n,r,i,a,o,s){ZO(t)||XO(e,t,i,s,r,o);var c=t.labelLayoutList;$O(e,r,c,a),ik(r,e.rotation,c);var l=e.optionHideOverlap;UO(r,c,l),l&&xO(co(c,function(e){return e&&!e.label.ignore})),MO(e,n,r,c)}function HO(e,t,n,r){var i=Rp(n-e),a,o,s=r[0]>r[1],c=t===`start`&&!s||t!==`start`&&s;return zp(i-EO/2)?(o=c?`bottom`:`top`,a=`center`):zp(i-EO*1.5)?(o=c?`top`:`bottom`,a=`center`):(o=`middle`,a=iEO/2?c?`left`:`right`:c?`right`:`left`),{rotation:i,textAlign:a,textVerticalAlign:o}}function UO(e,t,n){var r=e.axis,i=e.get([`axisLabel`,`customValues`]);if(kE(r))return;function a(e,a,o){var s=mO(t[a]),c=mO(t[o]),l=r.scale;if(s&&c){if(e==null){if(!n&&i)return;var u=kO(s.label).labelInfo.tick;if(zT(l)&&u.notNice||VT(l)&&u.offInterval){GO(s.label);return}}if(e===!1||s.suggestIgnore){GO(s.label);return}if(c.suggestIgnore){GO(c.label);return}var d=.1;if(!n){var f=[0,0,0,0];s=yO({marginForce:f},s),c=yO({marginForce:f},c)}SO(s,c,null,{touchThreshold:d})&&GO(e?c.label:s.label)}}var o=e.get([`axisLabel`,`showMinLabel`]),s=e.get([`axisLabel`,`showMaxLabel`]),c=t.length;a(o,0,1),a(s,c-1,c-2)}function WO(e,t,n){e.showMinorTicks||H(t,function(e){if(e&&e.label.ignore)for(var t=0;t0&&u[1]>0&&!d[0]&&(u[0]=0),u[0]<0&&u[1]<0&&!d[1]&&(u[1]=0));var y=!1;u[0]>u[1]&&(u.reverse(),y=!0);var b=mk(e,t.get(`startValue`,!0)),x=b!=null;!Zp(b)&&r&&(b=e.getDefaultStartValue?e.getDefaultStartValue():0),Zp(b)&&(x||!_||v)&&(bu[1]&&!d[1]&&(u[1]=b,d[1]=!0)),pk(this._i={scale:e,dataMM:l,noZoomEffMM:u,zoomMM:[],fixMM:d,zoomFixMM:[!1,!1],startValue:b,isBlank:g,incl0:v,tggAxInv:y,ctnShp:i},u)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var e=this._i,t=e.zoomMM,n=e.noZoomEffMM,r=e.zoomFixMM,i=e.fixMM,a={fixMM:i,zoomFixMM:r,isBlank:e.isBlank,incl0:e.incl0,tggAxInv:e.tggAxInv,ctnShp:e.ctnShp,effMM:n.slice()},o=a.effMM;return t[0]!=null&&(o[0]=t[0],i[0]=r[0]=!0),t[1]!=null&&(o[1]=t[1],i[1]=r[1]=!0),pk(e,o),a},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(e,t){this._i.zoomMM[e]=t},e}();function pk(e,t){var n=e.scale,r=e.dataMM;n.sanitize&&(t[0]=n.sanitize(t[0],r),t[1]=n.sanitize(t[1],r),qm(t))}function mk(e,t){return t==null?null:bo(t)?NaN:e.parse(t)}function hk(e,t){var n;if(VT(e))n=[0,0];else{var r=t.get(`boundaryGap`);typeof r==`boolean`&&(r=null),n=G(r)?r:[r,r]}return[gk(n[0]),gk(n[1])]}function gk(e){return Sc(typeof e==`boolean`?0:e,1)||0}function _k(e){var t=uk(e.scale);return t.extent||=zm(),t}function vk(e,t){_k(e).dimIdxInCoord=t.get(e.dim)}function yk(e,t){var n=e.scale,r=e.model,i=e.dim;n.rawExtentInfo||bk(n,e,i,r,t)}function bk(e,t,n,r,i){var a=_k(t),o=a.extent,s=!1;VD(t,function(r){if(r.boxCoordinateSystem){var i=lx(r).coord,c=a.dimIdxInCoord;if(c>=0&&G(i)){var l=i[c];l!=null&&!G(l)&&Bm(o,e.parse(l))}}else if(r.coordinateSystem){var u=r.getData();if(u){var d=e.getFilter?e.getFilter():null;H(AE(u,n),function(e){Um(o,u.getApproximateExtent(e,d))})}r.__requireStartValue&&r.__requireStartValue(t)&&(s=!0)}});var c=Ek(e,t,r);Sk(e,new fk(e,r,o,s,c),i),a.extent=null}function xk(e,t){var n=e.scale;Sk(n,new fk(n,e.model,t,!1,!1),dk)}function Sk(e,t,n){e.rawExtentInfo=t,t.from=n}function Ck(e,t){wk.set(e,t)}var wk=X();function Tk(e,t,n,r,i){e.rawExtentInfo||xk({scale:e,model:t},i||zm());var a=e.rawExtentInfo.makeFinal(),o=a.effMM;return e.setExtent(o[0],o[1]),e.setBlank(a.isBlank),r&&a.tggAxInv&&n&&!n.get(`legacyMinMaxDontInverseAxis`)&&(r.inverse=!r.inverse),a}function Ek(e,t,n){var r=LE(e,n),i=n.get(`containShape`,!0);if(i==null&&!r&&(i=!0),!i)return!1;var a=!1;return GD(t,function(e){a=!!wk.get(e)||a}),a}function Dk(e,t,n,r){if(n.ctnShp){var i;if(GD(e,function(t){var n=wk.get(t);if(n){var a=n(e,r);a&&(i||=[0,0],Vm(i,a[0]),Hm(i,a[1]),wE(e))}}),i){var a=t.getExtent();if(VT(t))e.onBand||t.setExtent2(1,mp(a[0],a[0]+i[0]),hp(a[1],a[1]+i[1]));else{var o=a.slice();n.zoomFixMM[0]||(o[0]=mp(o[0],t.transformOut(t.transformIn(o[0],null)+i[0],null))),n.zoomFixMM[1]||(o[1]=hp(o[1],t.transformOut(t.transformIn(o[1],null)+i[1],null))),(o[0]a[1])&&t.setExtent2(1,o[0],o[1])}}}}function Ok(){qD(`liPosMinGap`,kk)}function kk(e,t,n){var r=X(),i=n.serUids,a=n.liPosMinGap,o,s=t.axis,c=s.scale,l=c.needTransform(),u=c.getFilter?c.getFilter():null,d=xb(u);function f(n){UD(e,t.sers,function(e){var t=e.getRawData(),r=t.getDimensionIndex(t.mapDimension(s.dim));r>=0&&n(r,e,t.getStore())})}var p=0;if(f(function(e,t,n){r.set(t.uid,1),(!i||!i.hasKey(t.uid))&&(o=!0),p+=n.count()}),(!i||i.keys().length!==r.keys().length)&&(o=!0),!o&&a!=null){t.liPosMinGap=a;return}$w(Ak,p);var m=0;f(function(e,t,n){for(var r=0,i=n.count();r0&&v0?-2:-1,n.serUids=r}var Ak=$w({ctor:Zw},50);function jk(e){return function(t,n){var r=eO(t,{fromStat:{key:e}});if(Zp(r.w2))return[-r.w2/2,r.w2/2]}}function Mk(e,t){return e+`|&`+t}function Nk(e){return Ok(),{liPosMinGap:!VT(e.scale)}}function Pk(e,t,n,r){ZD(e,{key:t,seriesType:n,coordSysType:r,getMetrics:Nk})}function Fk(e){return e.scale.rawExtentInfo.makeRenderInfo().startValue}var Ik={left:0,right:0,top:0,bottom:0},Lk=[`25%`,`25%`],Rk=`cartesian2d`,zk=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(t,n){var r=fC(t.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),r&&t.outerBounds&&dC(t.outerBounds,r)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&t.outerBounds&&dC(this.option.outerBounds,t.outerBounds)},t.type=`grid`,t.dependencies=[`xAxis`,`yAxis`],t.layoutMode=`box`,t.defaultOption={show:!1,z:0,left:`15%`,top:65,right:`10%`,bottom:80,containLabel:!1,outerBoundsMode:`auto`,outerBounds:Ik,outerBoundsContain:`all`,outerBoundsClampWidth:Lk[0],outerBoundsClampHeight:Lk[1],backgroundColor:Q.color.transparent,borderWidth:1,borderColor:Q.color.neutral30},t}(hC),Bk=Jm(),Vk=`__ec_stack_`;function Hk(e){return e.get(`stack`)||Vk+e.seriesIndex}function Uk(e,t){var n=Wk(e,t);return n.columnMap=Gk(n),n}function Wk(e,t){var n=Mk(t,Rk),r=[],i=eO(e,{fromStat:{key:n},min:1});return HD(e,n,function(e){r.push({barWidth:Ep(e.get(`barWidth`),i.w),barMaxWidth:Ep(e.get(`barMaxWidth`),i.w),barMinWidth:Ep(e.get(`barMinWidth`)||(Jk(e)?.5:1),i.w),barGap:e.get(`barGap`),barCategoryGap:e.get(`barCategoryGap`),defaultBarGap:e.get(`defaultBarGap`),stackId:Hk(e)})}),{bandWidthResult:i,seriesInfo:r}}function Gk(e){var t=e.bandWidthResult.w,n=t,r=0,i,a,o=[],s={};H(e.seriesInfo,function(e,t){t||(a=e.defaultBarGap||0);var c=e.stackId;Io(s,c)||r++;var l=s[c];l||(l=s[c]={width:0,maxWidth:0},o.push(c));var u=e.barWidth;u&&!l.width&&(l.width=u,u=mp(n,u),n-=u);var d=e.barMaxWidth;d&&(l.maxWidth=d);var f=e.barMinWidth;f&&(l.minWidth=f);var p=e.barGap;p!=null&&(a=p);var m=e.barCategoryGap;m!=null&&(i=m)}),i??=hp(35-o.length*4,15)+`%`;var c=Ep(i,t),l=Ep(a,1),u=(n-c)/(r+(r-1)*l);u=hp(u,0),H(o,function(e){var t=s[e],i=t.maxWidth,a=t.minWidth;if(t.width){var o=t.width;i&&(o=mp(o,i)),a&&(o=hp(o,a)),t.width=o,n-=o+l*o,r--}else{var o=u;i&&io&&(o=a),o!==u&&(t.width=o,n-=o+l*o,r--)}}),u=(n-c)/(r+(r-1)*l),u=hp(u,0);var d=0,f;H(o,function(e){var t=s[e];t.width||=u,f=t,d+=t.width*(1+l)}),f&&(d-=f.width*l);var p={},m=-d/2;return H(o,function(e){var n=s[e];p[e]=p[e]||{bandWidth:t,offset:m,width:n.width},m+=n.width*(1+l)}),p}function Kk(e){return{seriesType:e,overallReset:function(t){var n=Mk(e,Rk);WD(t,n,function(t){var r=Uk(t,e);HD(t,n,function(e){var t=r.columnMap[Hk(e)];e.getData().setLayout({bandWidth:t.bandWidth,offset:t.offset,size:t.width})})})}}}function qk(e){return{seriesType:e,plan:lT(),reset:function(e){if(ok(e)){var t=e.getData(),n=e.coordinateSystem,r=n.getBaseAxis(),i=n.getOtherAxis(r),a=t.getDimensionIndex(t.mapDimension(i.dim)),o=t.getDimensionIndex(t.mapDimension(r.dim)),s=e.get(`showBackground`,!0),c=t.mapDimension(i.dim),l=t.getCalculationInfo(`stackResultDimension`),u=vx(t,c)&&!!t.getCalculationInfo(`stackedOnSeries`),d=i.isHorizontal(),f=i.toGlobalCoord(i.dataToCoord(Fk(i))),p=Jk(e),m=e.get(`barMinHeight`)||0,h=l&&t.getDimensionIndex(l),g=t.getLayout(`size`),_=t.getLayout(`offset`);return{progress:function(e,t){for(var r=e.count,i=p&&Qw(r*3),c=p&&s&&Qw(r*3),l=p&&Qw(r),v=n.master.getRect(),y=d?v.width:v.height,b,x=t.getStore(),S=0;(b=e.next())!=null;){var C=x.get(u?h:a,b),w=x.get(o,b),T=f,E=void 0;u&&(E=+C-x.get(a,b));var D=void 0,O=void 0,k=void 0,A=void 0;if(d){var j=n.dataToPoint([C,w]);u&&(T=n.dataToPoint([E,w])[0]),D=T,O=j[1]+_,k=j[0]-T,A=g,gp(k)s){u=(p+l)/2;break}f===1&&(d=m-r[0].tickValue)}u??(l?l&&(u=r[r.length-1].coord):u=r[0].coord),a[n]=e.toGlobalCoord(u)}});else{var o=this.getData(),s=o.getLayout(`offset`),c=o.getLayout(`size`),l=+!r.getBaseAxis().isHorizontal();a[l]+=s+c/2}return a}return[NaN,NaN]},t.prototype.__requireStartValue=function(e){return this.getBaseAxis()!==e},t.type=`series.__base_bar__`,t.defaultOption={z:2,coordinateSystem:`cartesian2d`,legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:`mod`,defaultBarGap:`10%`},t}(vw);vw.registerClass(Zk);var Qk=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(){return Sx(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get(`realtimeSort`,!0)||null})},t.prototype.getProgressive=function(){return this.get(`large`)?this.get(`progressive`):!1},t.prototype.__preparePipelineContext=function(e,t){var n=eh(this,e,t);return n.progressiveRender&&(n.large=!0),n},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type=`series.bar`,t.dependencies=[`grid`,`polar`],t.defaultOption=Ax(Zk.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:`rgba(180, 180, 180, 0.2)`,borderColor:null,borderWidth:0,borderType:`solid`,borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:Q.color.primary,borderWidth:2}},realtimeSort:!1}),t}(Zk),$k=`\0__throttleOriginMethod`,eA=`\0__throttleRate`,tA=`\0__throttleType`;function nA(e,t,n){var r,i=0,a=0,o=null,s,c,l,u;t||=0;function d(){a=new Date().getTime(),o=null,e.apply(c,l||[])}var f=function(){var e=[...arguments];r=new Date().getTime(),c=this,l=e;var f=u||t,p=u||n;u=null,s=r-(p?i:a)-f,clearTimeout(o),p?o=setTimeout(d,f):s>=0?d():o=setTimeout(d,-s),i=r};return f.clear=function(){o&&=(clearTimeout(o),null)},f.debounceNextCall=function(e){u=e},f}function rA(e,t,n,r){var i=e[t];if(i){var a=i[$k]||i,o=i[tA];if(i[eA]!==n||o!==r){if(n==null||!r)return e[t]=a;i=e[t]=nA(a,n,r===`debounce`),i[$k]=a,i[tA]=r,i[eA]=n}return i}}function iA(e,t){var n=e[t];n&&n[$k]&&(n.clear&&n.clear(),e[t]=n[$k])}var aA=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),oA=function(e){z(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`sausage`,n}return t.prototype.getDefaultShape=function(){return new aA},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.max(t.r0||0,0),a=Math.max(t.r,0),o=(a-i)*.5,s=i+o,c=t.startAngle,l=t.endAngle,u=t.clockwise,d=Math.PI*2,f=u?l-cMath.PI/2&&ua)return!0;a=l}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,r=n.getExtent(),i=Math.max(0,r[0]),a=Math.min(r[1],n.getOrdinalMeta().categories.length-1);i<=a;++i)if(e.ordinalNumbers[i]!==n.getRawOrdinalNumber(i))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,r){if(this._isOrderChangedWithinSameData(e,t,n)){var i=this._dataSort(e,n,t);this._isOrderDifferentInView(i,n)&&(this._removeOnRenderedListener(r),r.dispatchAction({type:`changeAxisOrder`,componentType:n.dim+`Axis`,axisId:n.index,sortInfo:i}))}},t.prototype._dispatchInitSort=function(e,t,n){var r=t.baseAxis,i=this._dataSort(e,r,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:`changeAxisOrder`,componentType:r.dim+`Axis`,isInitSort:!0,axisId:r.index,sortInfo:i})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&=(e.getZr().off(`rendered`,this._onRendered),null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){tv(t,e,rh(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=`bar`,t}(fT),hA={cartesian2d:function(e,t){var n=t.width<0?-1:1,r=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=fA(t.x,e.x),s=pA(t.x+t.width,i),c=fA(t.y,e.y),l=pA(t.y+t.height,a),u=si?s:o,t.y=d&&c>a?l:c,t.width=u?0:s-o,t.height=d?0:l-c,n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height),u||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}var i=pA(t.r,e.r),a=fA(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}return o}},gA={cartesian2d:function(e,t,n,r,i,a,o,s,c){var l=new Kf({shape:V({},r),z2:1});if(l.__dataIndex=n,l.name=`item`,a){var u=l.shape,d=i?`height`:`width`;u[d]=0}return l},polar:function(e,t,n,r,i,a,o,s,c){var l=!i&&c?oA:m_,u=new l({shape:r,z2:1});if(u.name=`item`,u.calculateTextPosition=sA(TA(i),{isRoundCap:l===oA}),a){var d=u.shape,f=i?`r`:`endAngle`,p={};d[f]=i?r.r0:r.startAngle,p[f]=r[f],(s?X_:Z_)(u,{shape:p},a)}return u}};function _A(e,t){var n=e.get(`realtimeSort`,!0),r=t.getBaseAxis();if(n&&r.type===`category`&&t.type===`cartesian2d`)return{baseAxis:r,otherAxis:t.getOtherAxis(r)}}function vA(e,t,n,r,i,a,o,s){var c,l;a?(l={x:r.x,width:r.width},c={y:r.y,height:r.height}):(l={y:r.y,height:r.height},c={x:r.x,width:r.width}),s||(o?X_:Z_)(n,{shape:c},t,i,null);var u=t?e.baseAxis.model:null;(o?X_:Z_)(n,{shape:l},u,i)}function yA(e,t){for(var n=0;n0?1:-1,o=r.height>0?1:-1;return{x:r.x+a*i/2,y:r.y+o*i/2,width:r.width-a*i,height:r.height-o*i}},polar:function(e,t,n){var r=e.getItemLayout(t);return{cx:r.cx,cy:r.cy,r0:r.r0,r:r.r,startAngle:r.startAngle,endAngle:r.endAngle,clockwise:r.clockwise}}};function wA(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function TA(e){return function(e){var t=e?`Arc`:`Angle`;return function(e){switch(e){case`start`:case`insideStart`:case`end`:case`insideEnd`:return e+t;default:return e}}}(e)}function EA(e,t,n,r,i,a,o,s){var c=t.getItemVisual(n,`style`);if(!s){var l=r.get([`itemStyle`,`borderRadius`])||0;e.setShape(`r`,l)}else if(!a.get(`roundCap`)){var u=e.shape;V(u,dA(r.getModel(`itemStyle`),u,!0)),e.setShape(u)}e.useStyle(c);var d=r.getShallow(`cursor`);d&&e.attr(`cursor`,d);var f=s?o?i.r>=i.r0?`endArc`:`startArc`:i.endAngle>=i.startAngle?`endAngle`:`startAngle`:o?FA(i,a.coordinateSystem):IA(i,a.coordinateSystem),p=ty(r);ey(e,p,{labelFetcher:a,labelDataIndex:n,defaultText:Lw(a.getData(),n),inheritColor:c.fill,defaultOpacity:c.opacity,defaultOutsidePosition:f});var m=e.getTextContent();if(s&&m){var h=r.get([`label`,`position`]);e.textConfig.inside=h===`middle`||null,cA(e,h===`outside`?f:h,TA(o),r.get([`label`,`rotate`]))}fy(m,p,a.getRawValue(n),function(e){return Rw(t,e)});var g=r.getModel([`emphasis`]);mg(e,g.get(`focus`),g.get(`blurScope`),g.get(`disabled`)),vg(e,r),wA(i)&&(e.style.fill=`none`,e.style.stroke=`none`,H(e.states,function(e){e.style&&(e.style.fill=e.style.stroke=`none`)}))}function DA(e,t){var n=e.get([`itemStyle`,`borderColor`]);if(!n||n===`none`)return 0;var r=e.get([`itemStyle`,`borderWidth`])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(r,i,a)}var OA=function(){function e(){}return e}(),kA=function(e){z(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`largeBar`,n}return t.prototype.getDefaultShape=function(){return new OA},t.prototype.buildPath=function(e,t){for(var n=t.points,r=this.baseDimIdx,i=1-this.baseDimIdx,a=[],o=[],s=this.barWidth,c=0;c=0?n:null},30,!1);function MA(e,t,n){for(var r=e.baseDimIdx,i=1-r,a=e.shape.points,o=e.largeDataIndices,s=[],c=[],l=e.barWidth,u=0,d=a.length/3;u=s[0]&&t<=s[0]+c[0]&&n>=s[1]&&n<=s[1]+c[1])return o[u]}return-1}function NA(e,t,n){if(xT(n,`cartesian2d`)){var r=t,i=n.getArea();return{x:e?r.x:i.x,y:e?i.y:r.y,width:e?r.width:i.width,height:e?i.height:r.height}}var i=n.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}function PA(e,t,n){return new(e.type===`polar`?m_:Kf)({shape:NA(t,n,e),silent:!0,z2:0})}function FA(e,t){return e.height===0?t.getOtherAxis(t.getBaseAxis()).inverse?`bottom`:`top`:e.height>0?`bottom`:`top`}function IA(e,t){return e.width===0?t.getOtherAxis(t.getBaseAxis()).inverse?`left`:`right`:e.width>=0?`right`:`left`}function LA(e){e.registerChartView(mA),e.registerSeriesModel(Qk),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Kk(`bar`)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,qk(`bar`)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,iD(`bar`)),e.registerAction({type:`changeAxisOrder`,event:`changeAxisOrder`,update:`update`},function(e,t){var n=e.componentType||`series`;t.eachComponent({mainType:n,query:e},function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)})}),Xk(e)}function RA(e,t,n,r,i){var a=e+t;n.isSilent(a)||r.eachComponent({mainType:`series`,subType:`pie`},function(e){for(var t=e.seriesIndex,r=e.option.selectedMap,o=i.selected,s=0;s=0},e.prototype.indexOfName=function(e){return this._getDataWithEncodedVisual().indexOfName(e)},e.prototype.getItemVisual=function(e,t){return this._getDataWithEncodedVisual().getItemVisual(e,t)},e}(),VA=function(){function e(e,t){this.target=e,this.topTarget=t&&t.topTarget}return e}(),HA=function(){function e(e){this.handler=e,e.on(`mousedown`,this._dragStart,this),e.on(`mousemove`,this._drag,this),e.on(`mouseup`,this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new VA(t,e),`dragstart`,e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,r=e.offsetY,i=n-this._x,a=r-this._y;this._x=n,this._y=r,t.drift(i,a,e),this.handler.dispatchToElement(new VA(t,e),`drag`,e.event);var o=this.handler.findHover(n,r,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new VA(s,e),`dragleave`,e.event),o&&o!==s&&this.handler.dispatchToElement(new VA(o,e),`dragenter`,e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new VA(t,e),`dragend`,e.event),this._dropTarget&&this.handler.dispatchToElement(new VA(this._dropTarget,e),`drop`,e.event),this._draggingTarget=null,this._dropTarget=null},e}(),UA=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,WA=[],GA=Bo.browser.firefox&&+Bo.browser.version.split(`.`)[0]<39;function KA(e,t,n,r){return n||={},r?qA(e,t,n):GA&&t.layerX!=null&&t.layerX!==t.offsetX?(n.zrX=t.layerX,n.zrY=t.layerY):t.offsetX==null?qA(e,t,n):(n.zrX=t.offsetX,n.zrY=t.offsetY),n}function qA(e,t,n){if(Bo.domSupported&&e.getBoundingClientRect){var r=t.clientX,i=t.clientY;if(Vx(e)){var a=e.getBoundingClientRect();n.zrX=r-a.left,n.zrY=i-a.top;return}if(Rx(WA,e,r,i)){n.zrX=WA[0],n.zrY=WA[1];return}}n.zrX=n.zrY=0}function JA(e){return e||window.event}function YA(e,t,n){if(t=JA(t),t.zrX!=null)return t;var r=t.type;if(r&&r.indexOf(`touch`)>=0){var i=r===`touchend`?t.changedTouches[0]:t.targetTouches[0];i&&KA(e,i,t,n)}else{KA(e,t,t,n);var a=XA(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var o=t.button;return t.which==null&&o!==void 0&&UA.test(t.type)&&(t.which=o&1?1:o&2?3:o&4?2:0),t}function XA(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,r=e.deltaY;if(n==null||r==null)return t;var i=Math.abs(r===0?n:r),a=r>0?-1:r<0?1:n>0?-1:1;return 3*i*a}function ZA(e,t,n,r){e.addEventListener(t,n,r)}function QA(e,t,n,r){e.removeEventListener(t,n,r)}var $A=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function ej(e){return e.which===2||e.which===3}var tj=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a1&&r&&r.length>1){var a=nj(r)/nj(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=rj(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},aj=`silent`;function oj(e,t,n){return{type:e,event:n,target:t.target,topTarget:t.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:sj}}function sj(){$A(this.event)}var cj=function(e){z(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.handler=null,t}return t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(Ju),lj=function(){function e(e,t){this.x=e,this.y=t}return e}(),uj=[`click`,`dblclick`,`mousewheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],dj=new Z(0,0,0,0),fj=function(e){z(t,e);function t(t,n,r,i,a){var o=e.call(this)||this;return o._hovered=new lj(0,0),o.storage=t,o.painter=n,o.painterRoot=i,o._pointerSize=a,r||=new cj,o.proxy=null,o.setHandlerProxy(r),o._draggingMgr=new HA(o),o}return t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(H(uj,function(t){e.on&&e.on(t,this[t],this)},this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,r=hj(this,t,n),i=this._hovered,a=i.target;a&&!a.__zr&&(i=this.findHover(i.x,i.y),a=i.target);var o=this._hovered=r?new lj(t,n):this.findHover(t,n),s=o.target,c=this.proxy;c.setCursor&&c.setCursor(s?s.cursor:`default`),a&&s!==a&&this.dispatchToElement(i,`mouseout`,e),this.dispatchToElement(o,`mousemove`,e),s&&s!==a&&this.dispatchToElement(o,`mouseover`,e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;t!==`only_globalout`&&this.dispatchToElement(this._hovered,`mouseout`,e),t!==`no_globalout`&&this.trigger(`globalout`,{type:`globalout`,event:e})},t.prototype.resize=function(){this._hovered=new lj(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){e||={};var r=e.target;if(!(r&&r.silent)){for(var i=`on`+t,a=oj(t,e,n);r&&(r[i]&&(a.cancelBubble=!!r[i].call(r,a)),r.trigger(t,a),r=r.__hostTarget?r.__hostTarget:r.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(t,a),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(e){typeof e[i]==`function`&&e[i].call(e,a),e.trigger&&e.trigger(t,a)}))}},t.prototype.findHover=function(e,t,n){var r=this.storage.getDisplayList(),i=new lj(e,t);if(mj(r,i,e,t,n),this._pointerSize&&!i.target){for(var a=[],o=this._pointerSize,s=o/2,c=new Z(e-s,t-s,o,o),l=r.length-1;l>=0;l--){var u=r[l];u!==n&&!u.ignore&&!u.ignoreCoarsePointer&&(!u.parent||!u.parent.ignoreCoarsePointer)&&(dj.copy(u.getBoundingRect()),u.transform&&dj.applyTransform(u.transform),dj.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function pj(e,t,n){if(e[e.rectHover?`rectContain`:`contain`](t,n)){for(var r=e,i=void 0,a=!1;r;){if(r.ignoreClip&&(a=!0),!a){var o=r.getClipPath();if(o&&!o.contain(t,n))return!1}r.silent&&(i=!0);var s=r.__hostTarget;r=s?r.ignoreHostSilent?null:s:r.parent}return!i||aj}return!1}function mj(e,t,n,r,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=pj(o,n,r))&&(!t.topTarget&&(t.topTarget=o),s!==aj)){t.target=o;break}}}function hj(e,t,n){var r=e.painter;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var gj=32,_j=7;function vj(e){for(var t=0;e>=gj;)t|=e&1,e>>=1;return e+t}function yj(e,t,n,r){var i=t+1;if(i===n)return 1;if(r(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function bj(e,t,n){for(n--;t>>1,i(a,e[c])<0?s=c:o=c+1;var l=r-o;switch(l){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;l>0;)e[o+l]=e[o+l-1],l--}e[o]=a}}function Sj(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])>0){for(s=r-i;c0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}else{for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}for(o++;o>>1);a(e,t[n+u])>0?o=u+1:c=u}return c}function Cj(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])<0){for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}else{for(s=r-i;c=0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}for(o++;o>>1);a(e,t[n+u])<0?c=u:o=u+1}return c}function wj(e,t){var n=_j,r,i,a=0,o=[];r=[],i=[];function s(e,t){r[a]=e,i[a]=t,a+=1}function c(){for(;a>1;){var e=a-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;u(e)}}function l(){for(;a>1;){var e=a-2;e>0&&i[e-1]=_j||m>=_j);if(h)break;f<0&&(f=0),f+=2}if(n=f,n<1&&(n=1),i===1){for(c=0;c=0;c--)e[p+c]=e[f+c];e[d]=o[u];return}for(var m=n;;){var h=0,g=0,_=!1;do if(t(o[u],e[l])<0){if(e[d--]=e[l--],h++,g=0,--i===0){_=!0;break}}else if(e[d--]=o[u--],g++,h=0,--s===1){_=!0;break}while((h|g)=0;c--)e[p+c]=e[f+c];if(i===0){_=!0;break}}if(e[d--]=o[u--],--s===1){_=!0;break}if(g=s-Sj(e[l],o,0,s,s-1,t),g!==0){for(d-=g,u-=g,s-=g,p=d+1,f=u+1,c=0;c=_j||g>=_j);if(_)break;m<0&&(m=0),m+=2}if(n=m,n<1&&(n=1),s===1){for(d-=i,l-=i,p=d+1,f=l+1,c=i-1;c>=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else if(s===0)throw Error();else for(f=d-(s-1),c=0;cs&&(c=s),xj(e,n,n+c,n+a,t),a=c}o.pushRun(n,a),o.mergeRuns(),i-=a,n+=a}while(i!==0);o.forceMergeRuns()}}var Ej=!1;function Dj(){Ej||(Ej=!0,console.warn(`z / z2 / zlevel of displayable is invalid, which may cause unexpected errors`))}function Oj(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var kj=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=Oj}return e.prototype.traverse=function(e,t){for(var n=0;n=0&&this._roots.splice(r,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),Aj=Bo.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};function jj(){return new Date().getTime()}var Mj=function(e){z(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=jj()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)?(r.ondestroy(),this.removeClip(r),r=i):r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&(Aj(t),!e._paused&&e.update())}Aj(t)},t.prototype.start=function(){this._running||(this._time=jj(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=jj(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=jj()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new qu(e,t.loop);return this.addAnimator(n),n},t}(Ju),Nj=300,Pj=Bo.domSupported,Fj=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:U(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),Ij={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},Lj=!1;function Rj(e){var t=e.pointerType;return t===`pen`||t===`touch`}function zj(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function Bj(e){e&&(e.zrByTouch=!0)}function Vj(e,t){return YA(e.dom,new Uj(e,t),!0)}function Hj(e,t){for(var n=t,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return r}var Uj=function(){function e(e,t){this.stopPropagation=Lo,this.stopImmediatePropagation=Lo,this.preventDefault=Lo,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),Wj={mousedown:function(e){e=YA(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=YA(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=YA(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=YA(this.dom,e);var t=e.toElement||e.relatedTarget;Hj(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){Lj=!0,e=YA(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){Lj||(e=YA(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=YA(this.dom,e),Bj(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),Wj.mousemove.call(this,e),Wj.mousedown.call(this,e)},touchmove:function(e){e=YA(this.dom,e),Bj(e),this.handler.processGesture(e,`change`),Wj.mousemove.call(this,e)},touchend:function(e){e=YA(this.dom,e),Bj(e),this.handler.processGesture(e,`end`),Wj.mouseup.call(this,e),+new Date-this.__lastTouchMoment0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(e){this._disposed||(e||={},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t=0;o--)r[o]&&!Cm(r[o])?a=!0:(r[o]=null,!a&&i--);r.length=i,e[n]=r}}),delete e[vM],e},t.prototype.setTheme=function(e){this._theme=new wy(e),this._resetOption(`recreate`,null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var r=n[t||0];if(r)return r;if(t==null){for(var i=0;i=t:n===`max`?e<=t:e===t}function jM(e,t){return e.join(`,`)===t.join(`,`)}var MM=H,NM=J,PM=[`areaStyle`,`lineStyle`,`nodeStyle`,`linkStyle`,`chordStyle`,`label`,`labelLine`];function FM(e){var t=e&&e.itemStyle;if(t)for(var n=0,r=PM.length;n0?e[n-1].seriesModel:null)}),iN(e))})}function iN(e){H(e,function(t,n){var r=[],i=[NaN,NaN],a=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,c=t.seriesModel.get(`stackStrategy`)||`samesign`;o.modify(a,function(a,l,u){var d=o.get(t.stackedDimension,u);if(isNaN(d))return i;var f,p;s?p=o.getRawIndex(u):f=o.get(t.stackedByDimension,u);for(var m=NaN,h=n-1;h>=0;h--){var g=e[h];if(s||(p=g.data.rawIndexOf(g.stackedByDimension,f)),p>=0){var _=g.data.getByRawIndex(g.stackResultDimension,p);if(c===`all`||c===`positive`&&_>0||c===`negative`&&_<0||c===`samesign`&&d>=0&&_>0||c===`samesign`&&d<=0&&_<0){d=Ip(d,_),m=_;break}}}return r[0]=d,r[1]=m,r})})}var aN=function(){function e(){this.group=new qg,this.uid=Dx(`viewComponent`)}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){},e.prototype.updateLayout=function(e,t,n,r){},e.prototype.updateVisual=function(e,t,n,r){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}();Jo(aN),ts(aN);var oN=Om(),sN={itemStyle:ns(xy,!0),lineStyle:ns(vy,!0)},cN={lineStyle:`stroke`,itemStyle:`fill`};function lN(e,t){return e.visualStyleMapper||sN[t]||(console.warn(`Unknown style type '`+t+`'.`),sN.itemStyle)}function uN(e,t){return e.visualDrawType||cN[t]||(console.warn(`Unknown style type '`+t+`'.`),`fill`)}var dN={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=e.getModel(r),a=lN(e,r)(i),o=i.getShallow(`decal`);o&&(n.setVisual(`decal`,o),o.dirty=!0);var s=uN(e,r),c=a[s],l=K(c)?c:null,u=a.fill===`auto`||a.stroke===`auto`;if(!a[s]||l||u){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());a[s]||(a[s]=d,n.setVisual(`colorFromPalette`,!0)),a.fill=a.fill===`auto`||K(a.fill)?d:a.fill,a.stroke=a.stroke===`auto`||K(a.stroke)?d:a.stroke}if(n.setVisual(`style`,a),n.setVisual(`drawType`,s),!t.isSeriesFiltered(e)&&l)return n.setVisual(`colorFromPalette`,!1),{dataEach:function(t,n){var r=e.getDataParams(n),i=V({},a);i[s]=l(r),t.setItemVisual(n,`style`,i)}}}},fN=new wy,pN={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=lN(e,r),a=n.getVisual(`drawType`);return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[r]){fN.option=n[r];var o=i(fN);V(e.ensureUniqueItemVisual(t,`style`),o),fN.option.decal&&(e.setItemVisual(t,`decal`,fN.option.decal),fN.option.decal.dirty=!0),a in o&&e.setItemVisual(t,`colorFromPalette`,!1)}}:null}}}},mN={performRawSeries:!0,overallReset:function(e){var t=X();e.eachSeries(function(e){if(!e.isColorBySeries()){var n=e.type+`-`+e.getColorBy();oN(e).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(e){if(!e.isColorBySeries()){var t=e.getRawData(),n={},r=e.getData(),i=oN(e).scope,a=uN(e,e.visualStyleAccessPath||`itemStyle`);r.each(function(e){var t=r.getRawIndex(e);n[t]=e}),t.each(function(o){var s=n[o];if(r.getItemVisual(s,`colorFromPalette`)){var c=r.ensureUniqueItemVisual(s,`style`),l=t.getName(o)||o+``,u=t.count();c[a]=e.getColorFromPalette(l,i,u)}})}})}},hN=Math.PI;function gN(e,t){t||={},no(t,{text:`loading`,textColor:Q.color.primary,fontSize:12,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`,maskColor:`rgba(255,255,255,0.8)`,showSpinner:!0,color:Q.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var n=new qg,r=new Kf({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(r);var i=new Zf({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),a=new Kf({style:{fill:`none`},textContent:i,textConfig:{position:`right`,distance:10},zlevel:t.zlevel,z:10001});n.add(a);var o;return t.showSpinner&&(o=new j_({shape:{startAngle:-hN/2,endAngle:-hN/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:`round`,lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:hN*3/2}).start(`circularInOut`),o.animateShape(!0).when(1e3,{startAngle:hN*3/2}).delay(300).start(`circularInOut`),n.add(o)),n.resize=function(){var n=i.getBoundingRect().width,s=t.showSpinner?t.spinnerRadius:0,c=(e.getWidth()-s*2-(t.showSpinner&&n?10:0)-n)/2-(t.showSpinner&&n?0:5+n/2)+(t.showSpinner?0:n/2)+(n?0:s),l=e.getHeight()/2;t.showSpinner&&o.setShape({cx:c,cy:l}),a.setShape({x:c-s,y:l-s,width:s*2,height:s*2}),r.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},n.resize(),n}var _N=function(){function e(e,t,n,r){this._stageTaskMap=X(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),r=this._visualHandlers=r.slice(),this._allHandlers=n.concat(r)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(e){var t=e.overallTask;t&&t.dirty()})},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),r=n.context,i=!t&&n.progressiveEnabled&&(!r||r.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,a=r&&r.modDataCount;return{step:i,modBy:a==null?null:Math.ceil(a/i),modDataCount:a}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid);e.pipelineContext=n.context=e.__preparePipelineContext?e.__preparePipelineContext(t,n):eh(e,t,n)},e.prototype.restorePipelines=function(e,t){var n=this,r=n._pipelineMap=X();t.eachSeries(function(t){var i=e.painter.type===`canvas`&&t.getProgressive(),a=t.uid;r.set(a,{id:a,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),n._pipe(t,t.dataTask)})},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;H(this._allHandlers,function(r){var i=e.get(r.uid)||e.set(r.uid,{});To(!(r.reset&&r.overallReset),``),r.reset&&this._createSeriesStageTask(r,i,t,n),r.overallReset&&this._createOverallStageTask(r,i,t,n)},this)},e.prototype.prepareView=function(e,t,n,r){var i=e.renderTask,a=i.context;a.model=t,a.ecModel=n,a.api=r,i.__block=!e.incrementalPrepareRender,this._pipe(t,i)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,r){r||={};var i=!1,a=this;H(e,function(e,s){if(!(r.visualType&&r.visualType!==e.visualType)){var c=a._stageTaskMap.get(e.uid),l=c.seriesTaskMap,u=c.overallTask;if(u){var d,f=u.agentStubMap;f.each(function(e){o(r,e)&&(e.dirty(),d=!0)}),d&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,r.block);f.each(function(e){e.perform(p)}),u.perform(p)&&(i=!0)}else l&&l.each(function(s,c){o(r,s)&&s.dirty();var l=a.getPerformArgs(s,r.block);l.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(i=!0)})}});function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(e){t=e.dataTask.perform()||t}),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},e.prototype.updatePayload=function(e,t){t!==`remain`&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,r){var i=this,a=t.seriesTaskMap,o=t.seriesTaskMap=X(),s=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(l):s?n.eachRawSeriesByType(s,l):c&&c(n,r).each(l);function l(t){var s=t.uid,c=o.set(s,a&&a.get(s)||DC({plan:SN,reset:CN,count:EN}));c.context={model:t,ecModel:n,api:r,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(t,c)}},e.prototype._createOverallStageTask=function(e,t,n,r){var i=this,a=t.overallTask=t.overallTask||DC({reset:vN});a.context={ecModel:n,api:r,overallReset:e.overallReset,scheduler:i};var o=a.agentStubMap,s=a.agentStubMap=X(),c=e.seriesType,l=e.getTargetSeries,u=e.dirtyOnOverallProgress,d=!1;To(!e.createOnAllSeries,``),c?n.eachRawSeriesByType(c,f):l?l(n,r).each(f):H(n.getSeries(),f);function f(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,DC({reset:yN,onDirty:xN})));n.context={model:e,dirtyOnOverallProgress:u},n.agent=a,n.__block=u,i._pipe(e,n)}d&&a.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,r=this._pipelineMap.get(n);!r.head&&(r.head=t),r.tail&&r.tail.pipe(t),r.tail=t,t.__idxInPipeline=r.count++,t.__pipeline=r},e.wrapStageHandler=function(e,t){return K(e)&&(e={overallReset:e,seriesType:DN(e)}),e.uid=Dx(`stageHandler`),t&&(e.visualType=t),e},e}();function vN(e){e.overallReset(e.ecModel,e.api,e.payload)}function yN(e){return e.dirtyOnOverallProgress&&bN}function bN(){this.agent.dirty(),this.getDownstream().dirty()}function xN(){this.agent&&this.agent.dirty()}function SN(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function CN(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=sm(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?U(t,function(e,t){return TN(t)}):wN}var wN=TN(0);function TN(e){return function(t,n){var r=n.data,i=n.resetDefines[e];if(i&&i.dataEach)for(var a=t.start;a0&&u===i.length-l.length){var d=i.slice(0,u);d!==`data`&&(t.mainType=d,t[l.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(i)&&(n[i]=e,s=!0),s||(r[i]=e)})}return{cptQuery:t,dataQuery:n,otherQuery:r}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var r=n.targetEl,i=n.packedEvent,a=n.model,o=n.view;if(!a||!o)return!0;var s=t.cptQuery,c=t.dataQuery;return l(s,a,`mainType`)&&l(s,a,`subType`)&&l(s,a,`index`,`componentIndex`)&&l(s,a,`name`)&&l(s,a,`id`)&&l(c,i,`name`)&&l(c,i,`dataIndex`)&&l(c,i,`dataType`)&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,r,i));function l(e,t,n,r){return e[n]==null||t[r||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),LN=[`symbol`,`symbolSize`,`symbolRotate`,`symbolOffset`],RN=LN.concat([`symbolKeepAspect`]),zN={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual(`legendIcon`,e.legendIcon),!e.hasSymbolVisual)return;for(var r={},i={},a=!1,o=0;o=0&&eP(c)?c:.5,e.createRadialGradient(o,s,0,o,s,c)}function rP(e,t,n){for(var r=t.type===`radial`?nP(e,t,n):tP(e,t,n),i=t.colorStops,a=0;a0)?null:e===`dashed`?[4*t,2*t]:e===`dotted`?[t]:ho(e)?[e]:G(e)?e:null}function cP(e){var t=e.style,n=t.lineDash&&t.lineWidth>0&&sP(t.lineDash,t.lineWidth),r=t.lineDashOffset;if(n){var i=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;i&&i!==1&&(n=U(n,function(e){return e/i}),r/=i)}return[n,r]}var lP=new sf(!0);function uP(e){var t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))}function dP(e){return typeof e==`string`&&e!==`none`}function fP(e){var t=e.fill;return t!=null&&t!==`none`}function pP(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=n}else e.fill()}function mP(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=n}else e.stroke()}function hP(e,t,n){var r=us(t.image,t.__image,n);if(fs(r)){var i=e.createPattern(r,t.repeat||`repeat`);if(typeof DOMMatrix==`function`&&i&&i.setTransform){var a=new DOMMatrix;a.translateSelf(t.x||0,t.y||0),a.rotateSelf(0,0,(t.rotation||0)*Ro),a.scaleSelf(t.scaleX||1,t.scaleY||1),i.setTransform(a)}return i}}function gP(e,t,n,r,i){var a,o=uP(n),s=fP(n),c=n.strokePercent,l=c<1,u=!t.path;(!t.silent||l)&&u&&t.createPathProxy();var d=t.path||lP,f=t.__dirty;if(!r){var p=n.fill,m=n.stroke,h=s&&!!p.colorStops,g=o&&!!m.colorStops,_=s&&!!p.image,v=o&&!!m.image,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0;(h||g)&&(C=t.getBoundingRect()),h&&(y=f?rP(e,p,C):t.__canvasFillGradient,t.__canvasFillGradient=y),g&&(b=f?rP(e,m,C):t.__canvasStrokeGradient,t.__canvasStrokeGradient=b),_&&(x=f||!t.__canvasFillPattern?hP(e,p,t):t.__canvasFillPattern,t.__canvasFillPattern=x),v&&(S=f||!t.__canvasStrokePattern?hP(e,m,t):t.__canvasStrokePattern,t.__canvasStrokePattern=S),h?e.fillStyle=y:_&&(x?e.fillStyle=x:s=!1),g?e.strokeStyle=b:v&&(S?e.strokeStyle=S:o=!1)}var w=t.getGlobalScale();d.setScale(w[0],w[1],t.segmentIgnoreThreshold);var T,E;e.setLineDash&&n.lineDash&&(a=cP(t),T=a[0],E=a[1]);var D=!0;(u||f&4)&&(d.setDPR(e.dpr),l?d.setContext(null):(d.setContext(e),D=!1),d.reset(),t.buildPath(d,t.shape,r),d.toStatic(),t.pathUpdated()),D&&d.rebuildPath(e,l?c:1),T&&(e.setLineDash(T),e.lineDashOffset=E),r?(i.batchFill=s,i.batchStroke=o):n.strokeFirst?(o&&mP(e,n),s&&pP(e,n)):(s&&pP(e,n),o&&mP(e,n)),T&&e.setLineDash([])}function _P(e,t,n){var r=t.__image=us(n.image,t.__image,t,t.onload);if(r&&fs(r)){var i=n.x||0,a=n.y||0,o=t.getWidth(),s=t.getHeight(),c=r.width/r.height;if(o==null&&s!=null?o=s*c:s==null&&o!=null?s=o/c:o==null&&s==null&&(o=r.width,s=r.height),n.sWidth&&n.sHeight){var l=n.sx||0,u=n.sy||0;e.drawImage(r,l,u,n.sWidth,n.sHeight,i,a,o,s)}else if(n.sx&&n.sy){var l=n.sx,u=n.sy,d=o-l,f=s-u;e.drawImage(r,l,u,d,f,i,a,o,s)}else e.drawImage(r,i,a,o,s)}}function vP(e,t,n){var r,i=n.text;if(i!=null&&(i+=``),i){e.font=n.font||`12px sans-serif`,e.textAlign=n.textAlign,e.textBaseline=n.textBaseline;var a=void 0,o=void 0;e.setLineDash&&n.lineDash&&(r=cP(t),a=r[0],o=r[1]),a&&(e.setLineDash(a),e.lineDashOffset=o),n.strokeFirst?(uP(n)&&e.strokeText(i,n.x,n.y),fP(n)&&e.fillText(i,n.x,n.y)):(fP(n)&&e.fillText(i,n.x,n.y),uP(n)&&e.strokeText(i,n.x,n.y)),a&&e.setLineDash([])}}var yP=[`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`],bP=[[`lineCap`,`butt`],[`lineJoin`,`miter`],[`miterLimit`,10]];function xP(e,t,n,r,i){var a=!1;if(!r&&(n||={},t===n))return!1;if(r||t.opacity!==n.opacity){MP(e,i),a=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?yd.opacity:o}(r||t.blend!==n.blend)&&(a||=(MP(e,i),!0),e.globalCompositeOperation=t.blend||yd.blend);for(var s=0;s0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[fF]){if(this._disposed){this.id;return}var r,i,a;if(J(t)&&(n=t.lazyUpdate,r=t.silent,i=t.replaceMerge,a=t.transition,t=t.notMerge),this[fF]=!0,WF(this),!this._model||t){var o=new DM(this._api),s=this._theme,c=this._model=new bM;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:i},QF);var l={seriesTransition:a,optionChanged:!0};if(n)this[mF]={silent:r,updateParams:l},this[fF]=!1,this.getZr().wakeUp();else{try{EF(this),kF.update.call(this,null,l)}catch(e){throw this[mF]=null,this[fF]=!1,e}this._ssr||this._zr.flush(),this[mF]=null,this[fF]=!1,NF.call(this,r),PF.call(this,r)}}},t.prototype.setTheme=function(e,t){if(!this[fF]){if(this._disposed){this.id;return}var n=this._model;if(n){var r=t&&t.silent,i=null;this[mF]&&(r??=this[mF].silent,i=this[mF].updateParams,this[mF]=null),this[fF]=!0,WF(this);try{this._updateTheme(e),n.setTheme(this._theme),EF(this),kF.update.call(this,{type:`setTheme`},i)}catch(e){throw this[fF]=!1,e}this[fF]=!1,NF.call(this,r),PF.call(this,r)}}},t.prototype._updateTheme=function(e){q(e)&&(e=eI[e]),e&&(e=B(e),e&&tN(e,!0),this._theme=e)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||Bo.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){return e||={},this._zr.painter.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get(`backgroundColor`),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){return e||={},this._zr.painter.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){var e=this._zr;return H(e.storage.getDisplayList(),function(e){e.stopAnimation(null,!0)}),e.painter.toDataURL()},t.prototype.getDataURL=function(e){if(this._disposed){this.id;return}e||={};var t=e.excludeComponents,n=this._model,r=[],i=this;H(t,function(e){n.eachComponent({mainType:e},function(e){var t=i._componentsMap[e.__viewId];t.group.ignore||(r.push(t),t.group.ignore=!0)})});var a=this._zr.painter.getType()===`svg`?this.getSvgDataURL():this.renderToCanvas(e).toDataURL(`image/`+(e&&e.type||`png`));return H(r,function(e){e.group.ignore=!1}),a},t.prototype.getConnectedDataURL=function(e){if(this._disposed){this.id;return}var t=e.type===`svg`,n=this.group,r=Math.min,i=Math.max,a=1/0;if(rI[n]){var o=a,s=a,c=-a,l=-a,u=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();H(nI,function(a,d){if(a.group===n){var f=t?a.getZr().painter.getSvgDom().innerHTML:a.renderToCanvas(B(e)),p=a.getDom().getBoundingClientRect();o=r(p.left,o),s=r(p.top,s),c=i(p.right,c),l=i(p.bottom,l),u.push({dom:f,left:p.left,top:p.top})}}),o*=d,s*=d,c*=d,l*=d;var f=c-o,p=l-s,m=Ra.createCanvas(),h=rM(m,{renderer:t?`svg`:`canvas`});if(h.resize({width:f,height:p}),t){var g=``;return H(u,function(e){var t=e.left-o,n=e.top-s;g+=``+e.dom+``}),h.painter.getSvgRoot().innerHTML=g,e.connectedBackgroundColor&&h.painter.setBackgroundColor(e.connectedBackgroundColor),h.refreshImmediately(),h.painter.toDataURL()}return e.connectedBackgroundColor&&h.add(new Kf({shape:{x:0,y:0,width:f,height:p},style:{fill:e.connectedBackgroundColor}})),H(u,function(e){var t=new Rf({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});h.add(t)}),h.refreshImmediately(),m.toDataURL(`image/`+(e&&e.type||`png`))}return this.getDataURL(e)},t.prototype.convertToPixel=function(e,t,n){return AF(this,`convertToPixel`,e,t,n)},t.prototype.convertToLayout=function(e,t,n){return AF(this,`convertToLayout`,e,t,n)},t.prototype.convertFromPixel=function(e,t,n){return AF(this,`convertFromPixel`,e,t,n)},t.prototype.containPixel=function(e,t){if(this._disposed){this.id;return}var n=this._model,r;return H(Am(n,e),function(e,n){n.indexOf(`Models`)>=0&&H(e,function(e){var i=e.coordinateSystem;if(i&&i.containPoint)r||=!!i.containPoint(t);else if(n===`seriesModels`){var a=this._chartsMap[e.__viewId];a&&a.containPoint&&(r||=a.containPoint(t,e))}},this)},this),!!r},t.prototype.getVisual=function(e,t){var n=this._model,r=Am(n,e,{defaultMainType:`series`}),i=r.seriesModel.getData(),a=r.hasOwnProperty(`dataIndexInside`)?r.dataIndexInside:r.hasOwnProperty(`dataIndex`)?i.indexOfRawIndex(r.dataIndex):null;return a==null?HN(i,t):VN(i,a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e=this;H(qF,function(t){var n=function(n){var r=e.getModel(),i=n.target,a;if(t===`globalout`?a={}:i&&WN(i,function(e){var t=rh(e);if(t&&t.dataIndex!=null){var n=t.dataModel||r.getSeriesByIndex(t.seriesIndex);return a=n&&n.getDataParams(t.dataIndex,t.dataType,i)||{},!0}if(t.eventData)return a=V({},t.eventData),!0},!0),a){var o=a.componentType,s=a.componentIndex;(o===`markLine`||o===`markPoint`||o===`markArea`)&&(o=`series`,s=a.seriesIndex);var c=o&&s!=null&&r.getComponent(o,s),l=c&&e[c.mainType===`series`?`_chartsMap`:`_componentsMap`][c.__viewId];a.event=n,a.type=t,e._$eventProcessor.eventInfo={targetEl:i,packedEvent:a,model:c,view:l},e.trigger(t,a)}};n.zrEventfulCallAtLast=!0,e._zr.on(t,n,e)});var t=this._messageCenter;H(XF,function(n,r){t.on(r,function(t){e.trigger(r,t)})}),zA(t,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0,this.getDom()&&Fm(this.getDom(),aI,``);var e=this,t=e._api,n=e._model;H(e._componentsViews,function(e){e.dispose(n,t)}),H(e._chartsViews,function(e){e.dispose(n,t)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete nI[e.id]},t.prototype.resize=function(e){if(!this[fF]){if(this._disposed){this.id;return}this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption(`media`),r=e&&e.silent;this[mF]&&(r??=this[mF].silent,n=!0,this[mF]=null),this[fF]=!0,WF(this);try{n&&EF(this),kF.update.call(this,{type:`resize`,animation:V({duration:0},e&&e.animation)})}catch(e){throw this[fF]=!1,e}this[fF]=!1,NF.call(this,r),PF.call(this,r)}}},t.prototype.showLoading=function(e,t){if(this._disposed){this.id;return}if(J(e)&&(t=e,e=``),e||=`default`,this.hideLoading(),tI[e]){var n=tI[e](this._api,t),r=this._zr;this._loadingFX=n,r.add(n)}},t.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},t.prototype.makeActionFromEvent=function(e){var t=V({},e);return t.type=YF[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed){this.id;return}if(J(t)||(t={silent:!!t}),JF[e.type]&&this._model){if(this[fF]){this._pendingActions.push(e);return}var n=t.silent;MF.call(this,e,n);var r=t.flush;r?this._zr.flush():r!==!1&&Bo.browser.weChat&&this._throttledZrFlush(),NF.call(this,n),PF.call(this,n)}},t.prototype.updateLabelLayout=function(){GN.trigger(`series:layoutlabels`,this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed){this.id;return}var t=e.seriesIndex;this.getModel().getSeriesByIndex(t).appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){EF=function(e){kD(e._model);var t=e._scheduler;t.restorePipelines(e._zr,e._model),t.prepareStageTasks(),DF(e,!0),DF(e,!1),t.plan()},DF=function(e,t){for(var n=e._model,r=e._scheduler,i=t?e._componentsViews:e._chartsViews,a=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,c=0;cY(t.get(`hoverLayerThreshold`),fM.hoverLayerThreshold)&&!Bo.node&&!Bo.worker;(e._usingTHL||a)&&(t.eachSeries(function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered(function(e){var t=e.states.emphasis;t&&t.hoverLayer!==2&&(t.hoverLayer=+!!a)})}}),e._usingTHL=a)}}function a(e,t){var n=e.get(`blendMode`)||null;t.eachRendered(function(e){e.isGroup||(e.style.blend=n)})}function o(e,t){if(!e.preventAutoZ){var n=Uv(e);t.eachRendered(function(e){return Gv(e,n.z,n.zlevel),!0})}}function s(e,t){t.eachRendered(function(e){if(!Q_(e)){var t=e.getTextContent(),n=e.getTextGuideLine();e.stateTransition&&=null,t&&t.stateTransition&&(t.stateTransition=null),n&&n.stateTransition&&(n.stateTransition=null),e.hasState()?(e.prevStates=e.currentStates,e.clearStates()):e.prevStates&&=null}})}function c(e,t){var n=e.getModel(`stateAnimation`),i=e.isAnimationEnabled(),a=n.get(`duration`),o=a>0?{duration:a,delay:n.get(`delay`),easing:n.get(`easing`)}:null;t.eachRendered(function(e){if(e.states&&e.states.emphasis){if(Q_(e))return;if(e instanceof Mf&&wg(e),e.__dirty){var t=e.prevStates;t&&e.useStates(t)}if(i){e.stateTransition=o;var n=e.getTextContent(),a=e.getTextGuideLine();n&&(n.stateTransition=o),a&&(a.stateTransition=o)}e.__dirty&&r(e)}})}BF=function(e){return new(function(t){z(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}return n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(n!=null)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){Yh(t,n),HF(e)},n.prototype.leaveEmphasis=function(t,n){Xh(t,n),HF(e)},n.prototype.enterBlur=function(t){Zh(t),HF(e)},n.prototype.leaveBlur=function(t){Qh(t),HF(e)},n.prototype.enterSelect=function(t){$h(t),HF(e)},n.prototype.leaveSelect=function(t){eg(t),HF(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n.prototype.getECUpdateCycleVersion=function(){return e[pF]},n.prototype.usingTHL=function(){return e._usingTHL},n}(gh))(e)},VF=function(e){function t(e,t){for(var n=0;n=0)){vI.push(n);var o=_N.wrapStageHandler(n,i);o.__prio=t,o.__raw=n,e.push(o)}}function bI(e,t){tI[e]=t}function xI(e,t,n){var r=JN(`registerMap`);r&&r(e,t,n)}var SI=LC;_I(rF,dN),_I(oF,pN),_I(oF,mN),_I(rF,zN),_I(oF,BN),_I(uF,KP),lI(tN),uI(XP,nN),bI(`default`,gN),mI({type:wh,event:wh,update:wh},Lo),mI({type:Th,event:Th,update:Th},Lo),mI({type:Eh,event:kh,update:Eh,action:Lo,refineEvent:CI,publishNonRefinedEvent:!0}),mI({type:Dh,event:kh,update:Dh,action:Lo,refineEvent:CI,publishNonRefinedEvent:!0}),mI({type:Oh,event:kh,update:Oh,action:Lo,refineEvent:CI,publishNonRefinedEvent:!0});function CI(e,t,n,r){return{eventContent:{selected:dg(n),isFromClick:t.isFromClick||!1}}}cI(`default`,{}),cI(`dark`,FN);var wI=[],TI={registerPreprocessor:lI,registerProcessor:uI,registerPostInit:dI,registerPostUpdate:fI,registerUpdateLifecycle:pI,registerAction:mI,registerCoordinateSystem:hI,registerLayout:gI,registerVisual:_I,registerTransform:SI,registerLoading:bI,registerMap:xI,registerImpl:qN,PRIORITY:dF,ComponentModel:hC,ComponentView:aN,SeriesModel:vw,ChartView:fT,registerComponentModel:function(e){hC.registerClass(e)},registerComponentView:function(e){aN.registerClass(e)},registerSeriesModel:function(e){vw.registerClass(e)},registerChartView:function(e){fT.registerClass(e)},registerCustomSeries:function(e,t){XN(e,t)},registerSubTypeDefaulter:function(e,t){hC.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){iM(e,t)}};function EI(e){if(G(e)){H(e,function(e){EI(e)});return}ro(wI,e)>=0||(wI.push(e),K(e)&&(e={install:e}),e.install(TI))}var DI=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),OI=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents(`grid`,Mm).models[0]},t.type=`cartesian2dAxis`,t}(hC);ao(OI,DI);var kI={show:!0,z:0,inverse:!1,name:``,nameLocation:`end`,nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:`...`,placeholder:`.`},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:`auto`,onZeroAxisIndex:null,lineStyle:{color:Q.color.axisLine,width:1,type:`solid`},symbol:[`none`,`none`],symbolSize:[10,15],breakLine:!0},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12,color:Q.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:Q.color.axisSplitLine,width:1,type:`solid`}},splitArea:{show:!1,areaStyle:{color:[Q.color.backgroundTint,Q.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:Q.color.neutral00,borderColor:Q.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:`auto`}},AI=eo({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:`auto`,show:`auto`},axisLabel:{interval:`auto`}},kI),jI=eo({boundaryGap:[0,0],axisLine:{show:`auto`},axisTick:{show:`auto`},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:Q.color.axisMinorSplitLine,width:1}}},kI),MI={category:AI,value:jI,time:eo({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:`bold`}}},splitLine:{show:!1}},jI),log:no({logBase:10},jI)};function NI(e,t,n,r){H(yE,function(i,a){var o=eo(eo({},MI[a],!0),r,!0),s=function(e){z(n,e);function n(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t+`Axis.`+a,n}return n.prototype.mergeDefaultAndTheme=function(e,t){var n=uC(this),r=n?fC(e):{};eo(e,t.getTheme().get(a+`Axis`)),eo(e,this.getDefaultOption()),e.type=PI(e),n&&dC(e,r,n)},n.prototype.optionUpdated=function(){this.option.type===`category`&&(this.__ordinalMeta=wT.createByAxisModel(this))},n.prototype.getCategories=function(e){var t=this.option;if(t.type===`category`)return e?t.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.prototype.updateAxisBreaks=function(e){var t=wO();return t?t.updateModelAxisBreak(this,e):{breaks:[]}},n.type=t+`Axis.`+a,n.defaultOption=o,n}(n);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+`Axis`,PI)}function PI(e){return e.type||(e.data?`category`:`value`)}var FI=function(){function e(e){this.type=`cartesian`,this._dimList=[],this._axes={},this.name=e||``}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return U(this._dimList,function(e){return this._axes[e]},this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),co(this.getAxes(),function(t){return t.scale.type===e})},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),II=[`x`,`y`];function LI(e){return(e.type===`interval`||e.type===`time`)&&!sS(e)}var RI=function(e){z(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=Rk,t.dimensions=II,t}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis(`x`).scale,t=this.getAxis(`y`).scale;if(LI(e)&&LI(t)){var n=jT(e,null),r=jT(t,null),i=this.dataToPoint([n[0],r[0]]),a=this.dataToPoint([n[1],r[1]]),o=n[1]-n[0],s=r[1]-r[0];if(o&&s){var c=(a[0]-i[0])/o,l=(a[1]-i[1])/s,u=i[0]-n[0]*c,d=i[1]-r[0]*l,f=this._transform=[c,0,0,l,u,d];this._invTransform=bs([],f)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale(`ordinal`)[0]||this.getAxesByScale(`time`)[0]||this.getAxis(`x`)},t.prototype.containPoint=function(e){var t=this.getAxis(`x`),n=this.getAxis(`y`);return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis(`x`).containData(e[0])&&this.getAxis(`y`).containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),r=this.dataToPoint(t),i=this.getArea(),a=new Z(n[0],n[1],r[0]-n[0],r[1]-n[1]);return i.intersect(a)},t.prototype.dataToPoint=function(e,t,n){n||=[];var r=e[0],i=e[1];if(this._transform&&r!=null&&isFinite(r)&&i!=null&&isFinite(i))return Is(n,e,this._transform);var a=this.getAxis(`x`),o=this.getAxis(`y`);return n[0]=a.toGlobalCoord(a.dataToCoord(r,t)),n[1]=o.toGlobalCoord(o.dataToCoord(i,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis(`x`).scale,r=this.getAxis(`y`).scale,i=n.getExtent(),a=r.getExtent(),o=n.parse(e[0]),s=r.parse(e[1]);return t||=[],t[0]=Math.min(Math.max(Math.min(i[0],i[1]),o),Math.max(i[0],i[1])),t[1]=Math.min(Math.max(Math.min(a[0],a[1]),s),Math.max(a[0],a[1])),t},t.prototype.pointToData=function(e,t,n){if(n||=[],this._invTransform)return Is(n,e,this._invTransform);var r=this.getAxis(`x`),i=this.getAxis(`y`);return n[0]=r.coordToData(r.toLocalCoord(e[0]),t),n[1]=i.coordToData(i.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis(e.dim===`x`?`y`:`x`)},t.prototype.getArea=function(e){e||=0;var t=this.getAxis(`x`).getGlobalExtent(),n=this.getAxis(`y`).getGlobalExtent(),r=Math.min(t[0],t[1])-e,i=Math.min(n[0],n[1])-e;return new Z(r,i,Math.max(t[0],t[1])-r+e,Math.max(n[0],n[1])-i+e)},t}(FI);function zI(e,t){var n=e.scale,r=e.model,i=Tk(n,r,r.ecModel,e,null),a=BT(n),o=BT(t)?t.intervalStub:t,s=a?n.intervalStub:n,c=n.base,l=o.getTicks(),u=o.getTicks({expandToNicedExtent:!0}),d=l.length-1,f,p,m;if(d===1)f=p=0,m=1;else if(d===2){var h=gp(l[0].value-l[1].value),g=gp(l[1].value-l[2].value);f=p=0,h===g?m=2:(m=1,h=C[1])return!0})):b[1]?(T=C[1],A(function(){if(P(),k=jp(O-E*m,D),j(),w<=C[0])return!0})):A(function(){k=jp(yp(C[0]/E)*E,D),O=jp(vp(C[1]/E)*E,D);var e=_p((O-k)/E);if(e<=m){var t=m-e,n=void 0,r=i.incl0||a;if(r&&C[0]===0)n=[0,t];else if(r&&C[1]===0)n=[t,0];else{var o=vp(t/2);n=t%2==0?[o,o]:w+T=C[1])return!0}})}FE(n,b,S,[w,T],x,{interval:E,intervalCount:m,intervalPrecision:D,niceExtent:[k,O]})}function BI(e,t){var n=BT(e),r=n?e.intervalStub:e,i=t.fixMinMax||[],a=n?e.getExtent():null,o=r.getExtent(),s=KT(o,i,t.rawExtentResult);r.setExtent(s[0],s[1]),s=r.getExtent();var c=n?HI(r,t):VI(r,t),l=c.intervalPrecision,u=c.interval,d=t.userInterval;d!=null&&(c.interval=d,c.intervalPrecision=UT(d)),i[0]||(s[0]=jp(vp(s[0]/u)*u,l)),i[1]||(s[1]=jp(yp(s[1]/u)*u,l)),d!=null&&(c.niceExtent=s.slice()),FE(e,i,o,s,a,c)}function VI(e,t){var n=JT(t.splitNumber,5),r=NT(e),i=t.minInterval,a=t.maxInterval,o=Wp(r/n,!0);i!=null&&oa&&(o=a);var s=UT(o),c=e.getExtent(),l=[jp(yp(c[0]/o)*o,s),jp(vp(c[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:l}}function HI(e,t){var n=JT(t.splitNumber,10),r=e.getExtent(),i=NT(e),a=hp(Hp(i),1);n/i*a<=.5&&(a*=10);var o=UT(a),s=[jp(yp(r[0]/a)*a,o),jp(vp(r[1]/a)*a,o)];return{intervalPrecision:o,interval:a,niceExtent:s}}function UI(e){var t=e.scale,n=e.model,r=n.axis,i=n.ecModel;WI(t,n,r,i,null)}function WI(e,t,n,r,i){var a=Tk(e,t,r,n,i),o=RT(e)||zT(e);GI(e,{splitNumber:t.get(`splitNumber`),fixMinMax:a.fixMM,userInterval:t.get(`interval`),minInterval:o?t.get(`minInterval`):null,maxInterval:o?t.get(`maxInterval`):null,rawExtentResult:a}),n&&r&&Dk(n,e,a,r)}function GI(e,t){KI[e.type](e,t)}var KI={interval:BI,log:BI,time:dE,ordinal:Lo},qI=[[3,1],[0,2]],JI=function(){function e(e,t,n){this.type=`grid`,this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=II,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;H(this._axesList,function(e){yk(e,1);var t=e.scale;VT(t)&&t.setSortInfo(e.model.get(`categorySortInfo`))});function r(e){for(var t=uo(e),n=[],r=t.length-1;r>=0;r--){var i=e[+t[r]];i.__alignTo?n.push(i):UI(i)}H(n,function(e){$I(e,e.__alignTo)?UI(e):zI(e,e.__alignTo.scale)})}r(n.x),r(n.y);var i={};H(n.x,function(e){XI(n,`y`,e,i)}),H(n.y,function(e){XI(n,`x`,e,i)}),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var r=cC(e,t),i=this._rect=aC(e.getBoxLayoutParams(),r.refContainer),a=this._axesMap,o=this._coordsList,s=e.get(`containLabel`);if(tL(a,i),!n){var c=aL(i,o,a,s,t),l=void 0;if(s)rL?(rL(this._axesList,i),tL(a,i)):l=iL(i.clone(),`axisLabel`,null,i,a,c,r);else{var u=sL(e,i,r),d=u.outerBoundsRect,f=u.parsedOuterBoundsContain,p=u.outerBoundsClamp;d&&(l=iL(d,f,p,i,a,c,r))}oL(i,a,cD.determine,null,l,r),H(this._coordsList,function(e){e.calcAffineTransform()})}},e.prototype.getAxis=function(e,t){var n=this._axesMap[e];if(n!=null)return n[t||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var n=`x`+e+`y`+t;return this._coordsMap[n]}J(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var r=0,i=this._coordsList;r=0;i--){var a=e[+t[i]];LT(a.scale)&&NE(a.model,a.type,!0)==null&&(a.model.get(`alignTicks`)&&a.model.get(`interval`)==null?r.push(a):n=a)}n||=r.pop(),n&&H(r,function(e){e.__alignTo=n})}function $I(e,t){return sS(e.scale)||sS(t.scale)||t.scale.getTicks().length<2}function eL(e,t){var n=e.getExtent(),r=n[0]+n[1];e.toGlobalCoord=e.dim===`x`?function(e){return e+t}:function(e){return r-e+t},e.toLocalCoord=e.dim===`x`?function(e){return e-t}:function(e){return r-e+t}}function tL(e,t){H(e.x,function(e){return nL(e,t.x,t.width)}),H(e.y,function(e){return nL(e,t.y,t.height)})}function nL(e,t,n){var r=[0,n],i=+!!e.inverse;e.setExtent(r[i],r[1-i]),eL(e,t)}var rL;function iL(e,t,n,r,i,a,o){oL(r,i,cD.estimate,t,!1,o);var s=[0,0,0,0];l(0),l(1),u(r,0,NaN),u(r,1,NaN);var c=lo(s,function(e){return e>0})==null;return Nv(r,s,!0,!0,n),tL(i,r),c;function l(e){H(i[av[e]],function(t){if(ME(t.model)){var n=a.ensureRecord(t.model),r=n.labelInfoList;if(r)for(var i=0;i0&&!bo(t)&&t>1e-4&&(e/=t),e}}function aL(e,t,n,r,i){var a=new jO(cL);return H(n,function(n){return H(n,function(n){if(ME(n.model)){var o=!r;n.axisBuilder=ck(e,t,n.model,i,a,o)}})}),a}function oL(e,t,n,r,i,a){var o=n===cD.determine;H(t,function(t){return H(t,function(t){ME(t.model)&&(lk(t.axisBuilder,e,t.model),t.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:i}))})});var s={x:0,y:0};c(0),c(1);function c(t){s[av[1-t]]=e[ov[t]]<=a.refContainer[ov[t]]*.5?0:1-t==1?2:1}H(t,function(e,t){return H(e,function(e){ME(e.model)&&((r===`all`||o)&&e.axisBuilder.build({axisName:!0},{nameMarginLevel:s[t]}),o&&e.axisBuilder.build({axisLine:!0}))})})}function sL(e,t,n){var r,i=e.get(`outerBoundsMode`,!0);i===`same`?r=t.clone():(i==null||i===`auto`)&&(r=aC(e.get(`outerBounds`,!0)||Ik,n.refContainer));var a=e.get(`outerBoundsContain`,!0),o=a==null||a===`auto`||ro([`all`,`axisLabel`],a)<0?`all`:a,s=[Op(Y(e.get(`outerBoundsClampWidth`,!0),Lk[0]),t.width),Op(Y(e.get(`outerBoundsClampHeight`,!0),Lk[1]),t.height)];return{outerBoundsRect:r,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var cL=function(e,t,n,r,i,a){var o=n.axis.dim===`x`?`y`:`x`;FO(e,t,n,r,i,a),jE(e.nameLocation)||H(t.recordMap[o],function(e){e&&e.labelInfoList&&e.dirVec&&LO(e.labelInfoList,e.dirVec,r,i)})};function lL(e,t){var n={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return uL(n,e,t),n.seriesInvolved&&fL(n,e),n}function uL(e,t,n){var r=t.getComponent(`tooltip`),i=t.getComponent(`axisPointer`),a=i.get(`link`,!0)||[],o=[];H(n.getCoordinateSystems(),function(n){if(!n.axisPointerEnabled)return;var s=yL(n.model),c=e.coordSysAxesInfo[s]={};e.coordSysMap[s]=n;var l=n.model.getModel(`tooltip`,r);if(H(n.getAxes(),po(p,!1,null)),n.getTooltipAxes&&r&&l.get(`show`)){var u=l.get(`trigger`)===`axis`,d=l.get([`axisPointer`,`type`])===`cross`,f=n.getTooltipAxes(l.get([`axisPointer`,`axis`]));(u||d)&&H(f.baseAxes,po(p,!d||`cross`,u)),d&&H(f.otherAxes,po(p,`cross`,!1))}function p(r,s,u){var d=u.model.getModel(`axisPointer`,i),f=d.get(`show`);if(f&&(f!==`auto`||r||vL(d))){s??=d.get(`triggerTooltip`),d=r?dL(u,l,i,t,r,s):d;var p=d.get(`snap`),m=d.get(`triggerEmphasis`),h=yL(u.model),g=s||p||u.type===`category`,_=e.axesInfo[h]={key:h,axis:u,coordSys:n,axisPointerModel:d,triggerTooltip:s,triggerEmphasis:m,involveSeries:g,snap:p,useHandle:vL(d),seriesModels:[],linkGroup:null};c[h]=_,e.seriesInvolved=e.seriesInvolved||g;var v=pL(a,u);if(v!=null){var y=o[v]||(o[v]={axesInfo:{}});y.axesInfo[h]=_,y.mapper=a[v].mapper,_.linkGroup=y}}}})}function dL(e,t,n,r,i,a){var o=t.getModel(`axisPointer`),s=[`type`,`snap`,`lineStyle`,`shadowStyle`,`label`,`animation`,`animationDurationUpdate`,`animationEasingUpdate`,`z`],c={};H(s,function(e){c[e]=B(o.get(e))}),c.snap=e.type!==`category`&&!!a,o.get(`type`)===`cross`&&(c.type=`line`);var l=c.label||={};if(l.show??=!1,i===`cross`&&(l.show=o.get([`label`,`show`])??!0,!a)){var u=c.lineStyle=o.get(`crossStyle`);u&&no(l,u.textStyle)}return e.model.getModel(`axisPointer`,new wy(c,n,r))}function fL(e,t){t.eachSeries(function(t){var n=t.coordinateSystem,r=t.get([`tooltip`,`trigger`],!0),i=t.get([`tooltip`,`show`],!0);n&&n.model&&r!==`none`&&r!==!1&&r!==`item`&&i!==!1&&t.get([`axisPointer`,`show`],!0)!==!1&&H(e.coordSysAxesInfo[yL(n.model)],function(e){var r=e.axis;n.getAxis(r.dim)===r&&(e.seriesModels.push(t),e.seriesDataCount??=0,e.seriesDataCount+=t.getData().count())})})}function pL(e,t){for(var n=t.model,r=t.dim,i=0;i=0||e===t}function hL(e){var t=gL(e);if(t){var n=t.axisPointerModel,r=t.axis.scale,i=n.option,a=n.get(`status`),o=n.get(`value`);o!=null&&(o=r.parse(o));var s=vL(n);a??(i.status=s?`show`:`hide`);var c=r.getExtent();(o==null||o>c[1])&&(o=c[1]),o3?1.4:i>1?1.2:1.1,c=r>0?s:1/s;this._checkTriggerMoveZoom(this,`zoom`,`zoomOnMouseWheel`,e,{scale:c,originX:a,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(r),u=(r>0?1:-1)*(l>3?.4:l>1?.15:.05);this._checkTriggerMoveZoom(this,`scrollMove`,`moveOnMouseWheel`,e,{scrollDelta:u,originX:a,originY:o,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(e){if(!(PL(this._zr,`globalPan`)||RL(e))){var t=e.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,`zoom`,null,e,{scale:t,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(e,t,n,r,i){e._checkPointer(r,i.originX,i.originY)&&($A(r.event),r.__ecRoamConsumed=!0,GL(e,t,n,r,i))},t}(Ju);function RL(e){return e.__ecRoamConsumed}var zL=Om();function BL(e){var t=zL(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function VL(e,t,n,r){for(var i=BL(e).roam,a=i[t]=i[t]||[],o=0;o1e-6;LR[0]=o?(i[0]-r.x)/a:i[0],LR[1]=o?(i[1]-r.y)/a:i[1],Is(LR,LR,e.mtRawInv);var s=NR(e,LR);RR(t,s,a),H(n,function(e){e!==t&&RR(e,s.slice(),a)})}var LR=[];function RR(e,t,n){var r=e.option;r.center=t,r.zoom=n}function zR(e,t){if(t){var n=t.min||0,r=t.max||1/0;e=Math.max(Math.min(r,e),n)}return e}function BR(e,t){var n=t.getShallow(`nodeScaleRatio`,!0)||1,r=qL(e);return((r.zoom-1)*n+1)/(r.trans[2].scaleX||1)}function VR(e,t,n,r,i,a,o,s){if(!OR(e)){n.disable();return}n.enable(Y(e.get(`roam`),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get(`roamTrigger`),isInSelf:r,isInClip:function(e,t,n){return!i||i.contain(t,n)}}});function c(n){var r=e.mainType,i=qv(no({type:UR(r,e.subType,mh)},n));s&&(i.componentType=r),i[r+`Id`]=e.id,t.dispatchAction(i)}n.off(`pan`).off(`zoom`).on(`pan`,function(e){a&&a(`pan`),c({dx:e.dx,dy:e.dy})}).on(`zoom`,function(e){a&&a(`zoom`),c({zoom:e.scale,originX:e.originX,originY:e.originY})})}new Z(0,0,0,0);function HR(e,t,n){var r=UR(t,n,mh);e.registerAction({type:r,event:r,update:`none`},function(e,r,i){r.eachComponent(Pm(e,t,n),function(t){DR(e,t),kR(e,t,r,i)})})}function UR(e,t,n){return(e===`series`?t===`map`?`geo`:t:e)+n}function WR(e){return e.zoom!=null}function GR(e,t,n,r,i,a,o){var s=new YL(null,FR(e.ecModel,t));return oR(s,n,r,i,a),o?sR(s,o.x,o.y,o.width,o.height):sR(s,n,r,i,a),aR(s,e),s}var KR=Om();function qR(e){var t=e.mainData,n=e.datas;n||(n={main:t},e.datasAttr={main:`data`}),e.datas=e.mainData=null,ez(t,n,e),H(n,function(n){H(t.TRANSFERABLE_METHODS,function(t){n.wrapMethod(t,po(JR,e))})}),t.wrapMethod(`cloneShallow`,po(XR,e)),H(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,po(YR,e))}),To(n[t.dataType]===t)}function JR(e,t){if($R(this)){var n=V({},KR(this).datas);n[this.dataType]=t,ez(t,n,e)}else tz(t,this.dataType,KR(this).mainData,e);return t}function YR(e,t){return e.struct&&e.struct.update(),t}function XR(e,t){return H(KR(t).datas,function(n,r){n!==t&&tz(n.cloneShallow(),r,t,e)}),t}function ZR(e){var t=KR(this).mainData;return e==null||t==null?t:KR(t).datas[e]}function QR(){var e=KR(this).mainData;return e==null?[{data:e}]:U(uo(KR(e).datas),function(t){return{type:t,data:KR(e).datas[t]}})}function $R(e){return KR(e).mainData===e}function ez(e,t,n){KR(e).datas={},H(t,function(t,r){tz(t,r,e,n)})}function tz(e,t,n,r){KR(n).datas[t]=e,KR(e).mainData=n,e.dataType=t,r.struct&&(e[r.structAttr]=r.struct,r.struct[r.datasAttr[t]]=e),e.getLinkedData=ZR,e.getLinkedDataAll=QR}var nz=H,rz=J,iz=-1,az=function(){function e(t){var n=t.mappingMethod,r=t.type,i=this.option=B(t);this.type=r,this.mappingMethod=n,this._normalizeData=_z[n];var a=e.visualHandlers[r];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[n],n===`piecewise`?(cz(i),oz(i)):n===`category`?i.categories?sz(i):cz(i,!0):(To(n!==`linear`||i.dataExtent),cz(i))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return W(this._normalizeData,this)},e.listVisualTypes=function(){return uo(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){J(e)?H(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,r){var i,a=G(t)?[]:J(t)?{}:(i=!0,null);return e.eachVisual(t,function(e,t){var o=n.call(r,e,t);i?a=o:a[t]=o}),a},e.retrieveVisuals=function(t){var n={},r;return t&&nz(e.visualHandlers,function(e,i){t.hasOwnProperty(i)&&(n[i]=t[i],r=!0)}),r?n:null},e.prepareVisualTypes=function(e){if(G(e))e=e.slice();else if(rz(e)){var t=[];nz(e,function(e,n){t.push(n)}),e=t}else return[];return e.sort(function(e,t){return t===`color`&&e!==`color`&&e.indexOf(`color`)===0?1:-1}),e},e.dependsOn=function(e,t){return t===`color`?!!(e&&e.indexOf(t)===0):e===t},e.findPieceIndex=function(e,t,n){for(var r,i=1/0,a=0,o=t.length;a=0;a--)r[a]??(delete n[t[a]],t.pop())}function cz(e,t){var n=e.visual,r=[];J(n)?nz(n,function(e){r.push(e)}):n!=null&&r.push(n),!t&&r.length===1&&!{color:1,symbol:1}.hasOwnProperty(e.type)&&(r[1]=r[0]),gz(e,r)}function lz(e){return{applyVisual:function(t,n,r){var i=this.mapValueToVisual(t);r(`color`,e(n(`color`),i))},_normalizedToVisual:mz([0,1])}}function uz(e){var t=this.option.visual;return t[Math.round(Tp(e,[0,1],[0,t.length-1],!0))]||{}}function dz(e){return function(t,n,r){r(e,this.mapValueToVisual(t))}}function fz(e){var t=this.option.visual;return t[this.option.loop&&e!==iz?e%t.length:e]}function pz(){return this.option.visual[0]}function mz(e){return{linear:function(t){return Tp(t,e,this.option.visual,!0)},category:fz,piecewise:function(t,n){var r=hz.call(this,n);return r??=Tp(t,e,this.option.visual,!0),r},fixed:pz}}function hz(e){var t=this.option,n=t.pieceList;if(t.hasSpecialVisual){var r=n[az.findPieceIndex(e,n)];if(r&&r.visual)return r.visual[this.type]}}function gz(e,t){return e.visual=t,e.type===`color`&&(e.parsedVisual=U(t,function(e){return Kl(e)||[0,0,0,1]})),t}var _z={linear:function(e){return Tp(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,n=az.findPieceIndex(e,t,!0);if(n!=null)return Tp(n,[0,t.length-1],[0,1],!0)},category:function(e){return(this.option.categories?this.option.categoryMap[e]:e)??iz},fixed:Lo};function vz(e,t,n){return e?t<=n:t=0&&e.call(t,n[i],i)},e.prototype.eachEdge=function(e,t){for(var n=this.edges,r=n.length,i=0;i=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&e.call(t,n[i],i)},e.prototype.breadthFirstTraverse=function(e,t,n,r){if(t instanceof xz||(t=this._nodesMap[yz(t)]),t){for(var i=n===`out`?`outEdges`:n===`in`?`inEdges`:`edges`,a=0;a=0&&n.node2.dataIndex>=0});for(var i=0,a=r.length;i=0&&!e.hasKey(p)&&(e.set(p,!0),a.push(f.node1))}for(s=0;s=0&&!e.hasKey(v)&&(e.set(v,!0),o.push(_.node2))}}}return{edge:e.keys(),node:t.keys()}},e}(),Sz=function(){function e(e,t,n){this.dataIndex=-1,this.node1=e,this.node2=t,this.dataIndex=n??-1}return e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostGraph.edgeData.getItemModel(this.dataIndex).getModel(e)},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var e=X(),t=X();e.set(this.dataIndex,!0);for(var n=[this.node1],r=[this.node2],i=0;i=0&&!e.hasKey(u)&&(e.set(u,!0),n.push(l.node1))}for(i=0;i=0&&!e.hasKey(m)&&(e.set(m,!0),r.push(p.node2))}return{edge:e.keys(),node:t.keys()}},e}();function Cz(e,t){return{getValue:function(n){var r=this[e][t];return r.getStore().get(r.getDimensionIndex(n||`value`),this.dataIndex)},setVisual:function(n,r){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,n,r)},getVisual:function(n){return this[e][t].getItemVisual(this.dataIndex,n)},setLayout:function(n,r){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,n,r)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}ao(xz,Cz(`hostGraph`,`data`)),ao(Sz,Cz(`hostGraph`,`edgeData`));function wz(e,t,n,r,i){for(var a=new bz(r),o=0;o `+f)),l++)}var p=n.get(`coordinateSystem`),m;if(p===`cartesian2d`||p===`polar`||p===`matrix`)m=Sx(e,n);else{var h=ox.get(p),g=h&&h.dimensions||[];ro(g,`value`)<0&&g.concat([`value`]);var _=tx(e,{coordDimensions:g,encodeDefine:n.getEncode()}).dimensions;m=new ex(_,n),m.initData(e)}var v=new ex([`value`],n);return v.initData(c,s),i&&i(m,v),qR({mainData:m,struct:a,structAttr:`graph`,datas:{node:m,edge:v},datasAttr:{node:`data`,edge:`edgeData`}}),a.update(),a}var Tz=`-->`,Ez=function(e){return e.get(`autoCurveness`)||null},Dz=function(e,t){var n=Ez(e),r=20,i=[];if(ho(n))r=n;else if(G(n)){e.__curvenessList=n;return}t>r&&(r=t);var a=r%2?r+2:r+3;i=[];for(var o=0;o `),value:i.value,noValue:i.value==null})}return mw({series:this,dataIndex:e,multipleSeries:t})},t.prototype._updateCategoriesData=function(){var e=U(this.option.categories||[],function(e){return e.value==null?V({value:0},e):e}),t=new ex([`value`],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray(function(e){return t.getItemModel(e)})},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!(this.get(`layout`)===`force`&&this.get([`force`,`layoutAnimation`]))},t.prototype.__ownRoamView=function(){var e=this.coordinateSystem;return SR(e)&&e},t.type=`series.`+Iz,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`],t.defaultOption={z:2,coordinateSystem:`view`,legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:`center`,top:`center`,symbol:`circle`,symbolSize:10,edgeSymbol:[`none`,`none`],edgeSymbolSize:10,edgeLabel:{position:`middle`,distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:`{b}`},itemStyle:{},lineStyle:{color:Q.color.neutral50,width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:Q.color.primary}}},t}(vw);function Rz(e){return e instanceof Array||(e=[e,e]),e}var zz=th(Iz,Bz);function Bz(e){e.eachSeriesByType(Iz,function(e){var t=e.getGraph(),n=e.getEdgeData(),r=Rz(e.get(`edgeSymbol`)),i=Rz(e.get(`edgeSymbolSize`));n.setVisual(`fromSymbol`,r&&r[0]),n.setVisual(`toSymbol`,r&&r[1]),n.setVisual(`fromSymbolSize`,i&&i[0]),n.setVisual(`toSymbolSize`,i&&i[1]),n.setVisual(`style`,e.getModel(`lineStyle`).getLineStyle()),n.each(function(e){var r=n.getItemModel(e),i=t.getEdgeByIndex(e),a=Rz(r.getShallow(`symbol`,!0)),o=Rz(r.getShallow(`symbolSize`,!0)),s=r.getModel(`lineStyle`).getLineStyle(),c=n.ensureUniqueItemVisual(e,`style`);switch(V(c,s),c.stroke){case`source`:var l=i.node1.getVisual(`style`);c.stroke=l&&l.fill;break;case`target`:var l=i.node2.getVisual(`style`);c.stroke=l&&l.fill}a[0]&&i.setVisual(`fromSymbol`,a[0]),a[1]&&i.setVisual(`toSymbol`,a[1]),o[0]&&i.setVisual(`fromSymbolSize`,o[0]),o[1]&&i.setVisual(`toSymbolSize`,o[1])})})}function Vz(e){var t=e.coordinateSystem;if(!(t&&t.type!==`view`)){var n=e.getGraph();n.eachNode(function(e){var t=e.getModel();e.setLayout([+t.get(`x`),+t.get(`y`)])}),Hz(n,e)}}function Hz(e,t){e.eachEdge(function(e,n){var r=So(e.getModel().get([`lineStyle`,`curveness`]),-Fz(e,t,n,!0),0),i=Cs(e.node1.getLayout()),a=Cs(e.node2.getLayout()),o=[i,a];+r&&o.push([(i[0]+a[0])/2-(i[1]-a[1])*r,(i[1]+a[1])/2-(a[0]-i[0])*r]),e.setLayout(o)})}var Uz=th(Iz,Wz);function Wz(e,t){e.eachSeriesByType(Iz,function(e){var t=e.get(`layout`),n=e.coordinateSystem;if(n&&n.type!==`view`){var r=e.getData(),i=[];H(n.dimensions,function(e){i=i.concat(r.mapDimensionsAll(e))});for(var a=0;a0&&(y[0]=-y[0],y[1]=-y[1]);var x=v[0]<0?-1:1;if(r.__position!==`start`&&r.__position!==`end`){var S=-Math.atan2(v[1],v[0]);l[0].8?`left`:u[0]<-.8?`right`:`center`,p=u[1]>.8?`top`:u[1]<-.8?`bottom`:`middle`;break;case`start`:r.x=-u[0]*h+c[0],r.y=-u[1]*g+c[1],f=u[0]>.8?`right`:u[0]<-.8?`left`:`center`,p=u[1]>.8?`bottom`:u[1]<-.8?`top`:`middle`;break;case`insideStartTop`:case`insideStart`:case`insideStartBottom`:r.x=h*x+c[0],r.y=c[1]+C,f=v[0]<0?`right`:`left`,r.originX=-h*x,r.originY=-C;break;case`insideMiddleTop`:case`insideMiddle`:case`insideMiddleBottom`:case`middle`:r.x=b[0],r.y=b[1]+C,f=`center`,r.originY=-C;break;case`insideEndTop`:case`insideEnd`:case`insideEndBottom`:r.x=-h*x+l[0],r.y=l[1]+C,f=v[0]>=0?`right`:`left`,r.originX=h*x,r.originY=-C}r.scaleX=r.scaleY=i,r.setStyle({verticalAlign:r.__verticalAlign||p,align:r.__align||f})}},t}(qg),vB=function(){function e(e){this.group=new qg,this._LineCtor=e||_B}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,r=n.group,i=n._lineData;n._lineData=e,i||r.removeAll();var a=bB(e);e.diff(i).add(function(n){t._doAdd(e,n,a)}).update(function(n,r){t._doUpdate(i,e,r,n,a)}).remove(function(e){r.remove(i.getItemGraphicEl(e))}).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,n){t.updateLayout(e,n)},this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=bB(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){this._progressiveEls=[];function r(e){!e.isGroup&&!yB(e)&&(e.incremental=n,e.ensureState(`emphasis`).hoverLayer=2)}for(var i=e.start;i0}function bB(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{lineStyle:t.getModel(`lineStyle`).getLineStyle(),emphasisLineStyle:n.getModel([`lineStyle`]).getLineStyle(),blurLineStyle:t.getModel([`blur`,`lineStyle`]).getLineStyle(),selectLineStyle:t.getModel([`select`,`lineStyle`]).getLineStyle(),emphasisDisabled:n.get(`disabled`),blurScope:n.get(`blurScope`),focus:n.get(`focus`),labelStatesModels:ty(t)}}function xB(e){return isNaN(e[0])||isNaN(e[1])}function SB(e){return e&&!xB(e[0])&&!xB(e[1])}var CB=[],wB=[],TB=[],EB=Cl,DB=Fs,OB=Math.abs;function kB(e,t,n){for(var r=e[0],i=e[1],a=e[2],o=1/0,s,c=n*n,l=.1,u=.1;u<=.9;u+=.1){CB[0]=EB(r[0],i[0],a[0],u),CB[1]=EB(r[1],i[1],a[1],u);var d=OB(DB(CB,t)-c);d=0?s+=l:s-=l:m>=0?s-=l:s+=l}return s}function AB(e,t){var n=[],r=Dl,i=[[],[],[]],a=[[],[]],o=[];t/=2,e.eachEdge(function(e,s){var c=e.getLayout(),l=e.getVisual(`fromSymbol`),u=e.getVisual(`toSymbol`);c.__original||(c.__original=[Cs(c[0]),Cs(c[1])],c[2]&&c.__original.push(Cs(c[2])));var d=c.__original;if(c[2]!=null){if(Ss(i[0],d[0]),Ss(i[1],d[2]),Ss(i[2],d[1]),l&&l!==`none`){var f=Kz(e.node1),p=kB(i,d[0],f*t);r(i[0][0],i[1][0],i[2][0],p,n),i[0][0]=n[3],i[1][0]=n[4],r(i[0][1],i[1][1],i[2][1],p,n),i[0][1]=n[3],i[1][1]=n[4]}if(u&&u!==`none`){var f=Kz(e.node2),p=kB(i,d[1],f*t);r(i[0][0],i[1][0],i[2][0],p,n),i[1][0]=n[1],i[2][0]=n[2],r(i[0][1],i[1][1],i[2][1],p,n),i[1][1]=n[1],i[2][1]=n[2]}Ss(c[0],i[0]),Ss(c[1],i[2]),Ss(c[2],i[1])}else{if(Ss(a[0],d[0]),Ss(a[1],d[1]),Ds(o,a[1],a[0]),js(o,o),l&&l!==`none`){var f=Kz(e.node1);Es(a[0],a[0],o,f*t)}if(u&&u!==`none`){var f=Kz(e.node2);Es(a[1],a[1],o,-f*t)}Ss(c[0],a[0]),Ss(c[1],a[1])}})}var jB=Om();function MB(e){if(e)return jB(e).bridge}var NB=function(e){z(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=Iz,t}return t.prototype.init=function(e,t){var n=new Gw,r=new vB,i=this.group,a=new qg;this._controller=new LL(t.getZr()),a.add(n.group),a.add(r.group),i.add(a),this._symbolDraw=n,this._lineDraw=r,this._mainGroup=a,this._firstRender=!0},t.prototype.render=function(e,t,n){var r=this,i=OR(e),a=!1;this._model=e,this._api=n,this._active=!0;var o=this._mainGroup,s=this._getThumbnailInfo();s&&s.bridge.reset(n);var c=this._symbolDraw,l=this._lineDraw;i&&CR(o,2,i,this._firstRender?null:e),AB(e.getGraph(),Gz(e));var u=e.getData();c.updateData(u);var d=e.getEdgeData();l.updateData(d),this._updateNodeAndLinkScale(),i&&VR(e,n,this._controller,function(t,n,r){return e.coordinateSystem.containPoint([n,r])},null),clearTimeout(this._layoutTimeout);var f=e.forceLayout,p=e.get([`force`,`layoutAnimation`]);f&&(a=!0,this._startForceLayoutIteration(f,n,p));var m=e.get(`layout`);u.graph.eachNode(function(t){var i=t.dataIndex,a=t.getGraphicEl(),o=t.getModel();if(a){a.off(`drag`).off(`dragend`);var s=o.get(`draggable`);s&&a.on(`drag`,function(o){switch(m){case`force`:f.warmUp(),!r._layouting&&r._startForceLayoutIteration(f,n,p),f.setFixed(i),u.setItemLayout(i,[a.x,a.y]);break;case`circular`:u.setItemLayout(i,[a.x,a.y]),t.setLayout({fixed:!0},!0),Yz(e,`symbolSize`,t,[o.offsetX,o.offsetY]),r.updateLayout(e);break;default:u.setItemLayout(i,[a.x,a.y]),Hz(e.getGraph(),e),r.updateLayout(e)}}).on(`dragend`,function(){f&&f.setUnfixed(i)}),a.setDraggable(s,!!o.get(`cursor`)),o.get([`emphasis`,`focus`])===`adjacency`&&(rh(a).focus=t.getAdjacentDataIndices())}}),u.graph.eachEdge(function(e){var t=e.getGraphicEl(),n=e.getModel().get([`emphasis`,`focus`]);t&&n===`adjacency`&&(rh(t).focus={edge:[e.dataIndex],node:[e.node1.dataIndex,e.node2.dataIndex]})});var h=e.get(`layout`)===`circular`&&e.get([`circular`,`rotateLabel`]),g=u.getLayout(`cx`),_=u.getLayout(`cy`);u.graph.eachNode(function(e){Zz(e,h,g,_)}),this._firstRender=!1,a||this._renderThumbnail(e,n,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose()},t.prototype._startForceLayoutIteration=function(e,t,n){var r=this,i=!1;(function a(){e.step(function(e){r.updateLayout(r._model),(e||!i)&&(i=!0,r._renderThumbnail(r._model,t,r._symbolDraw,r._lineDraw)),(r._layouting=!e)&&(n?r._layoutTimeout=setTimeout(a,16):a())})})()},t.prototype.__updateOnOwnRoam=function(e,t,n){var r=OR(t);this._active&&r&&(CR(this._mainGroup,2,r,null),WR(e)&&(this._updateNodeAndLinkScale(),AB(t.getGraph(),Gz(t)),this._lineDraw.updateLayout(),n.updateLabelLayout()),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var e=this._model,t=e.getData(),n=Gz(e);t.eachItemGraphicEl(function(e,t){e&&e.setSymbolScale(n)})},t.prototype.updateLayout=function(e){this._active&&(AB(e.getGraph(),Gz(e)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout())},t.prototype.remove=function(){this._active=!1,clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove(),this._controller&&this._controller.disable()},t.prototype._getThumbnailInfo=function(){var e=this._model,t=e.coordinateSystem;if(t.type===`view`){var n=MB(e);if(n)return{bridge:n,coordSys:t}}},t.prototype._updateThumbnailWindow=function(){var e=this._getThumbnailInfo();e&&e.bridge.updateWindow(ZL(null,e.coordSys),this._api)},t.prototype._renderThumbnail=function(e,t,n,r){var i=this._getThumbnailInfo();if(i){var a=new qg,o=n.group.children(),s=r.group.children(),c=new qg,l=new qg;a.add(l),a.add(c);for(var u=0;ua&&(t[1-r]=Ip(t[r],d.sign*a)),t}function BB(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function VB(e,t){return Math.min(t[1]==null?1/0:t[1],Math.max(t[0]==null?-1/0:t[0],e))}var HB=Om(),UB=B,WB=W,GB=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,r){var i=t.get(`value`),a=t.get(`status`);if(this._axisModel=e,this._axisPointerModel=t,this._api=n,r||this._lastValue!==i||this._lastStatus!==a){this._lastValue=i,this._lastStatus=a;var o=this._group,s=this._handle;if(!a||a===`hide`){o&&o.hide(),s&&s.hide();return}o&&o.show(),s&&s.show();var c={};this.makeElOption(c,i,e,t,n);var l=c.graphicKey;l!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=l;var u=this._moveAnimation=this.determineAnimation(e,t);if(!o)o=this._group=new qg,this.createPointerEl(o,c,e,t),this.createLabelEl(o,c,e,t),n.getZr().add(o);else{var d=po(KB,t,u);this.updatePointerEl(o,c,d),this.updateLabelEl(o,c,d,t)}XB(o,t,!0),this._renderHandle(i)}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get(`animation`),r=e.axis,i=r.type===`category`,a=t.get(`snap`);if(!a&&!i)return!1;if(n===`auto`||n==null){var o=this.animationThreshold;if(i&&eO(r).w>o)return!0;if(a){var s=gL(e).seriesDataCount,c=r.getExtent();return Math.abs(c[0]-c[1])/s>o}return!1}return n===!0},e.prototype.makeElOption=function(e,t,n,r,i){},e.prototype.createPointerEl=function(e,t,n,r){var i=t.pointer;if(i){var a=HB(e).pointerEl=new rv[i.type](UB(t.pointer));e.add(a)}},e.prototype.createLabelEl=function(e,t,n,r){if(t.label){var i=HB(e).labelEl=new Zf(UB(t.label));e.add(i),JB(i,r)}},e.prototype.updatePointerEl=function(e,t,n){var r=HB(e).pointerEl;r&&t.pointer&&(r.setStyle(t.pointer.style),n(r,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,r){var i=HB(e).labelEl;i&&(i.setStyle(t.label.style),n(i,{x:t.label.x,y:t.label.y}),JB(i,r))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t=this._axisPointerModel,n=this._api.getZr(),r=this._handle,i=t.getModel(`handle`),a=t.get(`status`);if(!i.get(`show`)||!a||a===`hide`){r&&n.remove(r),this._handle=null;return}var o;this._handle||(o=!0,r=this._handle=Ov(i.get(`icon`),{cursor:`move`,draggable:!0,onmousemove:function(e){$A(e.event)},onmousedown:WB(this._onHandleDragMove,this,0,0),drift:WB(this._onHandleDragMove,this),ondragend:WB(this._onHandleDragEnd,this)}),n.add(r)),XB(r,t,!1),r.setStyle(i.getItemStyle(null,[`color`,`borderColor`,`borderWidth`,`opacity`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`]));var s=i.get(`size`);G(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,rA(this,`_doDispatchAxisPointer`,i.get(`throttle`)||0,`fixRate`),this._moveHandleToValue(e,o)}},e.prototype._moveHandleToValue=function(e,t){KB(this._axisPointerModel,!t&&this._moveAnimation,this._handle,YB(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var r=this.updateHandleTransform(YB(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=r,n.stopAnimation(),n.attr(YB(r)),HB(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:`updateAxisPointer`,x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get(`value`);this._moveHandleToValue(e),this._api.dispatchAction({type:`hideTip`})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,r=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),r&&t.remove(r),this._group=null,this._handle=null,this._payloadInfo=null),iA(this,`_doDispatchAxisPointer`)},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}},e}();function KB(e,t,n,r){qB(HB(n).lastProp,r)||(HB(n).lastProp=r,t?X_(n,r,e):(n.stopAnimation(),n.attr(r)))}function qB(e,t){if(J(e)&&J(t)){var n=!0;return H(t,function(t,r){n&&=qB(e[r],t)}),!!n}return e===t}function JB(e,t){e[t.get([`label`,`show`])?`show`:`hide`]()}function YB(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function XB(e,t,n){var r=t.get(`z`),i=t.get(`zlevel`);e&&e.traverse(function(e){e.type!==`group`&&(r!=null&&(e.z=r),i!=null&&(e.zlevel=i),e.silent=n)})}function ZB(e){var t=e.get(`type`),n=e.getModel(t+`Style`),r;return t===`line`?(r=n.getLineStyle(),r.fill=null):t===`shadow`&&(r=n.getAreaStyle(),r.stroke=null),r}function QB(e,t,n,r,i){var a=eV(n.get(`value`),t.axis,t.ecModel,n.get(`seriesDataIndices`),{precision:n.get([`label`,`precision`]),formatter:n.get([`label`,`formatter`])}),o=n.getModel(`label`),s=KS(o.get(`padding`)||0),c=o.getFont(),l=vc(a,c),u=i.position,d=l.width+s[1]+s[3],f=l.height+s[0]+s[2],p=i.align;p===`right`&&(u[0]-=d),p===`center`&&(u[0]-=d/2);var m=i.verticalAlign;m===`bottom`&&(u[1]-=f),m===`middle`&&(u[1]-=f/2),$B(u,d,f,r);var h=o.get(`backgroundColor`);(!h||h===`auto`)&&(h=t.get([`axisLine`,`lineStyle`,`color`])),e.label={x:u[0],y:u[1],style:ny(o,{text:a,font:c,fill:o.getTextColor(),padding:s,backgroundColor:h}),z2:10}}function $B(e,t,n,r){var i=r.getWidth(),a=r.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+n,a)-n,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function eV(e,t,n,r,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:DE(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};H(r,function(e){var t=n.getSeriesByIndex(e.seriesIndex),r=e.dataIndexInside,i=t&&t.getDataParams(r);i&&s.seriesData.push(i)}),q(o)?a=o.replace(`{value}`,a):K(o)&&(a=o(s))}return a}function tV(e,t,n){var r=ps();return vs(r,r,n.rotation),_s(r,r,n.position),xv([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],r)}function nV(e,t,n,r,i,a){var o=RO.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=i.get([`label`,`margin`]),QB(t,r,i,a,{position:tV(r.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function rV(e,t,n){return n||=0,{x1:e[n],y1:e[1-n],x2:t[n],y2:t[1-n]}}function iV(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}}function aV(e,t,n){return eO(e,{fromStat:{sers:U(t,function(e){return n.getSeriesByIndex(e.seriesIndex)})},min:1}).w}function oV(e,t,n){return[hp(mp(t[0],t[1]),e-n/2),mp(e+n/2,hp(t[0],t[1]))]}var sV=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(e,t,n,r,i){var a=n.axis,o=a.grid,s=r.get(`type`),c=a.getGlobalExtent(),l=cV(o,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(t,!0));if(s&&s!==`none`){var d=ZB(r),f=lV[s](a,u,c,l,r.get(`seriesDataIndices`),r.ecModel);f.style=d,e.graphicKey=f.type,e.pointer=f}nV(t,e,ak(o.getRect(),n),n,r,i)},t.prototype.getHandleTransform=function(e,t,n){var r=ak(t.axis.grid.getRect(),t,{labelInside:!1});r.labelMargin=n.get([`handle`,`margin`]);var i=tV(t.axis,e,r);return{x:i[0],y:i[1],rotation:r.rotation+(r.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,r){var i=n.axis,a=i.grid,o=i.getGlobalExtent(!0),s=cV(a,i).getOtherAxis(i).getGlobalExtent(),c=i.dim===`x`?0:1,l=[e.x,e.y];l[c]+=t[c],l[c]=mp(o[1],l[c]),l[c]=hp(o[0],l[c]);var u=(s[1]+s[0])/2,d=[u,u];return d[c]=l[c],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:`middle`},{align:`center`}][c]}},t}(GB);function cV(e,t){var n={};return n[t.dim+`AxisIndex`]=t.index,e.getCartesian(n)}var lV={line:function(e,t,n,r){return{type:`Line`,subPixelOptimize:!0,shape:rV([t,r[0]],[t,r[1]],uV(e))}},shadow:function(e,t,n,r,i,a){var o=aV(e,i,a),s=r[1]-r[0],c=oV(t,n,o),l=c[0],u=c[1];return{type:`Rect`,shape:iV([l,r[0]],[u-l,s],uV(e))}}};function uV(e){return e.dim===`x`?0:1}var dV=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`axisPointer`,t.defaultOption={show:`auto`,z:50,type:`line`,snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:Q.color.border,width:1,type:`dashed`},shadowStyle:{color:Q.color.shadowTint},label:{show:!0,formatter:null,precision:`auto`,margin:3,color:Q.color.neutral00,padding:[5,7,5,7],backgroundColor:Q.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:`M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z`,size:45,margin:50,color:Q.color.accent40,throttle:40}},t}(hC),fV=Om(),pV=H;function mV(e,t,n){if(!Bo.node){var r=t.getZr();fV(r).records||(fV(r).records={}),hV(r,t);var i=fV(r).records[e]||(fV(r).records[e]={});i.handler=n}}function hV(e,t){if(fV(e).initialized)return;fV(e).initialized=!0,n(`click`,po(vV,`click`)),n(`mousemove`,po(vV,`mousemove`)),n(`mousewheel`,po(vV,`mousewheel`)),n(`globalout`,_V);function n(n,r){e.on(n,function(n){var i=yV(t);pV(fV(e).records,function(e){e&&r(e,n,i.dispatchAction)}),gV(i.pendings,t)})}}function gV(e,t){var n=e.showTip.length,r=e.hideTip.length,i;n?i=e.showTip[n-1]:r&&(i=e.hideTip[r-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function _V(e,t,n){e.handler(`leave`,null,n)}function vV(e,t,n,r){t.handler(e,n,r)}function yV(e){var t={showTip:[],hideTip:[]},n=function(r){var i=t[r.type];i?i.push(r):(r.dispatchAction=n,e.dispatchAction(r))};return{dispatchAction:n,pendings:t}}function bV(e,t){if(!Bo.node){var n=t.getZr();(fV(n).records||{})[e]&&(fV(n).records[e]=null)}}var xV=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=t.getComponent(`tooltip`),i=e.get(`triggerOn`)||r&&r.get(`triggerOn`)||`mousemove|click|mousewheel`;mV(`axisPointer`,n,function(e,t,n){i!==`none`&&(e===`leave`||i.indexOf(e)>=0)&&n({type:`updateAxisPointer`,currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})})},t.prototype.remove=function(e,t){bV(`axisPointer`,t)},t.prototype.dispose=function(e,t){bV(`axisPointer`,t)},t.type=`axisPointer`,t}(aN);function SV(e,t){var n=[],r=e.seriesIndex,i;if(r==null||!(i=t.getSeriesByIndex(r)))return{point:[]};var a=i.getData(),o=Dm(a,e);if(o==null||o<0||G(o))return{point:[]};var s=a.getItemGraphicEl(o),c=i.coordinateSystem;if(i.getTooltipPosition)n=i.getTooltipPosition(o)||[];else if(c&&c.dataToPoint){if(e.isStacked){var l=c.getBaseAxis(),u=c.getOtherAxis(l).dim,d=l.dim,f=+(u===`x`||u===`radius`),p=a.mapDimension(d),m=[];m[f]=a.get(p,o),m[1-f]=a.get(a.getCalculationInfo(`stackResultDimension`),o),n=c.dataToPoint(m)||[]}else n=c.dataToPoint(a.getValues(U(c.dimensions,function(e){return a.mapDimension(e)}),o))||[]}else if(s){var h=s.getBoundingRect().clone();h.applyTransform(s.transform),n=[h.x+h.width/2,h.y+h.height/2]}return{point:n,el:s}}var CV=Om();function wV(e,t,n){var r=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||W(n.dispatchAction,n),s=t.getComponent(`axisPointer`).coordSysAxesInfo;if(s){PV(i)&&(i=SV({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var c=PV(i),l=a.axesInfo,u=s.axesInfo,d=r===`leave`||PV(i),f={},p={},m={list:[],map:{}},h={showPointer:po(DV,p),showTooltip:po(OV,m)};H(s.coordSysMap,function(e,t){var n=c||e.containPoint(i);H(s.coordSysAxesInfo[t],function(e,t){var r=e.axis,a=MV(l,e);if(!d&&n&&(!l||a)){var o=a&&a.value;o==null&&!c&&(o=r.pointToData(i)),o!=null&&TV(e,o,h,!1,f)}})});var g={};return H(u,function(e,t){var n=e.linkGroup;n&&!p[t]&&H(n.axesInfo,function(t,r){var i=p[r];if(t!==e&&i){var a=i.value;n.mapper&&(a=e.axis.scale.parse(n.mapper(a,NV(t),NV(e)))),g[e.key]=a}})}),H(g,function(e,t){TV(u[t],e,h,!0,f)}),kV(p,u,f),AV(m,i,e,o),jV(u,o,n),f}}function TV(e,t,n,r,i){var a=e.axis;if(!a.scale.isBlank()&&a.containData(t)){if(!e.involveSeries){n.showPointer(e,t);return}var o=EV(t,e),s=o.payloadBatch,c=o.snapToValue;s[0]&&i.seriesIndex==null&&V(i,s[0]),!r&&e.snap&&a.containData(c)&&c!=null&&(t=c),n.showPointer(e,t,s),n.showTooltip(e,o,c)}}function EV(e,t){var n=t.axis,r=n.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return H(t.seriesModels,function(t,c){var l=t.getData().mapDimensionsAll(r),u,d;if(t.getAxisTooltipData){var f=t.getAxisTooltipData(l,e,n);d=f.dataIndices,u=f.nestestValue}else{if(d=t.indicesOfNearest(r,l[0],e,n.type===`category`?.5:null),!d.length)return;u=t.getData().get(l[0],d[0])}if(Zp(u)){var p=e-u,m=Math.abs(p);m<=o&&((m=0&&s<0)&&(o=m,s=p,i=u,a.length=0),H(d,function(e){a.push({seriesIndex:t.seriesIndex,dataIndexInside:e,dataIndex:t.getData().getRawIndex(e)})}))}}),{payloadBatch:a,snapToValue:i}}function DV(e,t,n,r){e[t.key]={value:n,payloadBatch:r}}function OV(e,t,n,r){var i=n.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(t.triggerTooltip&&i.length){var c=t.coordSys.model,l=yL(c),u=e.map[l];u||(u=e.map[l]={coordSysId:c.id,coordSysIndex:c.componentIndex,coordSysType:c.type,coordSysMainType:c.mainType,dataByAxis:[]},e.list.push(u)),u.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:r,valueLabelOpt:{precision:s.get([`label`,`precision`]),formatter:s.get([`label`,`formatter`])},seriesDataIndices:i.slice()})}}function kV(e,t,n){var r=n.axesInfo=[];H(t,function(t,n){var i=t.axisPointerModel.option,a=e[n];a?(!t.useHandle&&(i.status=`show`),i.value=a.value,i.seriesDataIndices=(a.payloadBatch||[]).slice()):!t.useHandle&&(i.status=`hide`),i.status===`show`&&r.push({axisDim:t.axis.dim,axisIndex:t.axis.model.componentIndex,value:i.value})})}function AV(e,t,n,r){if(PV(t)||!e.list.length){r({type:`hideTip`});return}var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};r({type:`showTip`,escapeConnect:!0,x:t[0],y:t[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}function jV(e,t,n){var r=n.getZr(),i=`axisPointerLastHighlights`,a=CV(r)[i]||{},o=CV(r)[i]={};H(e,function(e,t){var n=e.axisPointerModel.option;n.status===`show`&&e.triggerEmphasis&&H(n.seriesDataIndices,function(e){o[e.seriesIndex+`|`+e.dataIndex]=e})});var s=[],c=[];function l(e){return{seriesIndex:e.seriesIndex,dataIndex:e.dataIndex}}H(a,function(e,t){!o[t]&&c.push(l(e))}),H(o,function(e,t){!a[t]&&s.push(l(e))}),c.length&&n.dispatchAction({type:`downplay`,escapeConnect:!0,notBlur:!0,batch:c}),s.length&&n.dispatchAction({type:`highlight`,escapeConnect:!0,notBlur:!0,batch:s})}function MV(e,t){for(var n=0;n<(e||[]).length;n++){var r=e[n];if(t.axis.dim===r.axisDim&&t.axis.model.componentIndex===r.axisIndex)return r}}function NV(e){var t=e.axis.model,n={},r=n.axisDim=e.axis.dim;return n.axisIndex=n[r+`AxisIndex`]=t.componentIndex,n.axisName=n[r+`AxisName`]=t.name,n.axisId=n[r+`AxisId`]=t.id,n}function PV(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function FV(e){xL.registerAxisPointerClass(`CartesianAxisPointer`,sV),e.registerComponentModel(dV),e.registerComponentView(xV),e.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!G(t)&&(e.axisPointer.link=[t])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(e,t){e.getComponent(`axisPointer`).coordSysAxesInfo=lL(e,t)}}),e.registerAction({type:`updateAxisPointer`,event:`updateAxisPointer`,update:`:updateAxisPointer`},wV)}function IV(e){EI(ML),EI(FV)}function LV(e,t){var n=KS(t.get(`padding`)),r=t.getItemStyle([`color`,`opacity`]);return r.fill=t.get(`backgroundColor`),new Kf({shape:{x:e.x-n[3],y:e.y-n[0],width:e.width+n[1]+n[3],height:e.height+n[0]+n[2],r:t.get(`borderRadius`)},style:r,silent:!0,z2:-1})}var RV=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`tooltip`,t.dependencies=[`axisPointer`],t.defaultOption={z:60,show:!0,showContent:!0,trigger:`item`,triggerOn:`mousemove|click|mousewheel`,alwaysShowContent:!1,renderMode:`auto`,confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:Q.color.neutral00,shadowBlur:10,shadowColor:`rgba(0, 0, 0, .2)`,shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:Q.color.border,padding:null,extraCssText:``,axisPointer:{type:`line`,axis:`auto`,animation:`auto`,animationDurationUpdate:200,animationEasingUpdate:`exponentialOut`,crossStyle:{color:Q.color.borderShade,width:1,type:`dashed`,textStyle:{}}},textStyle:{color:Q.color.tertiary,fontSize:14}},t}(hC);function zV(e){var t=e.get(`confine`);return t==null?e.get(`renderMode`)===`richText`:!!t}function BV(e){if(Bo.domSupported){for(var t=document.documentElement.style,n=0,r=e.length;n-1?(s+=`top:50%`,c+=`translateY(-50%) rotate(`+(l=a===`left`?-225:-45)+`deg)`):(s+=`left:50%`,c+=`translateX(-50%) rotate(`+(l=a===`top`?225:45)+`deg)`);var u=l*Math.PI/180,d=o+i,f=d*Math.abs(Math.cos(u))+d*Math.abs(Math.sin(u)),p=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-d)/2)*100)/100;s+=`;`+a+`:-`+p+`px`;var m=t+` solid `+i+`px;`;return`
`}function XV(e,t,n){var r=`cubic-bezier(0.23,1,0.32,1)`,i=``,a=``;return n&&(i=` `+e/2+`s `+r,a=`opacity`+i+`,visibility`+i),t||(i=` `+e+`s `+r,a+=(a.length?`,`:``)+(Bo.transformSupported?``+KV+i:`,left`+i+`,top`+i)),GV+`:`+a}function ZV(e,t,n){var r=e.toFixed(0)+`px`,i=t.toFixed(0)+`px`;if(!Bo.transformSupported)return n?`top:`+i+`;left:`+r+`;`:[[`top`,i],[`left`,r]];var a=Bo.transform3dSupported,o=`translate`+(a?`3d`:``)+`(`+r+`,`+i+(a?`,0`:``)+`)`;return n?`top:0;left:0;`+KV+`:`+o+`;`:[[`top`,0],[`left`,0],[VV,o]]}function QV(e){var t=[],n=e.get(`fontSize`),r=e.getTextColor();r&&t.push(`color:`+r),t.push(`font:`+e.getFont());var i=Y(e.get(`lineHeight`),Math.round(n*3/2));n&&t.push(`line-height:`+i+`px`);var a=e.get(`textShadowColor`),o=e.get(`textShadowBlur`)||0,s=e.get(`textShadowOffsetX`)||0,c=e.get(`textShadowOffsetY`)||0;return a&&o&&t.push(`text-shadow:`+s+`px `+c+`px `+o+`px `+a),H([`decoration`,`align`],function(n){var r=e.get(n);r&&t.push(`text-`+n+`:`+r)}),t.join(`;`)}function $V(e,t,n,r){var i=[],a=e.get(`transitionDuration`),o=e.get(`backgroundColor`),s=e.get(`shadowBlur`),c=e.get(`shadowColor`),l=e.get(`shadowOffsetX`),u=e.get(`shadowOffsetY`),d=e.getModel(`textStyle`),f=fw(e,`html`),p=l+`px `+u+`px `+s+`px `+c;return i.push(`box-shadow:`+p),t&&a>0&&i.push(XV(a,n,r)),o&&i.push(`background-color:`+o),H([`width`,`color`,`radius`],function(t){var n=`border-`+t,r=GS(n),a=e.get(r);a!=null&&i.push(n+`:`+a+(t===`color`?``:`px`))}),i.push(QV(d)),f!=null&&i.push(`padding:`+KS(f).join(`px `)+`px`),i.join(`;`)+`;`}function eH(e,t,n,r,i){var a=t&&t.painter;if(n){var o=a&&a.getViewportRoot();o&&Ix(e,o,n,r,i)}else{e[0]=r,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var tH=function(){function e(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,Bo.wxa)return null;var n=document.createElement(`div`);n.domBelongToZr=!0,this.el=n;var r=this._zr=e.getZr(),i=t.appendTo,a=i&&(q(i)?document.querySelector(i):vo(i)?i:K(i)&&i(e.getDom()));eH(this._styleCoord,r,a,e.getWidth()/2,e.getHeight()/2),(a||e.getDom()).appendChild(n),this._api=e,this._container=a;var o=this;n.onmouseenter=function(){o._enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},n.onmousemove=function(e){if(e||=window.event,!o._enterable){var t=r.handler;YA(r.painter.getViewportRoot(),e,!0),t.dispatch(`mousemove`,e)}},n.onmouseleave=function(){o._inContent=!1,o._enterable&&o._show&&o.hideLater(o._hideDelay)}}return e.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),n=WV(t,`position`),r=t.style;r.position!==`absolute`&&n!==`absolute`&&(r.position=`relative`)}var i=e.get(`alwaysShowContent`);i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=e.get(`displayTransition`)&&e.get(`transitionDuration`)>0,this.el.className=e.get(`className`)||``},e.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,r=n.style,i=this._styleCoord;n.innerHTML?r.cssText=qV+$V(e,!this._firstShow,this._longHide,this._enableDisplayTransition)+ZV(i[0],i[1],!0)+(`border-color:`+QS(t)+`;`)+(e.get(`extraCssText`)||``)+(`;pointer-events:`+(this._enterable?`auto`:`none`)):r.display=`none`,this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(e,t,n,r,i){var a=this.el;if(e==null){a.innerHTML=``;return}var o=``;if(q(i)&&n.get(`trigger`)===`item`&&!zV(n)&&(o=YV(n,r,i)),q(e))a.innerHTML=e+o;else if(e){a.innerHTML=``,G(e)||(e=[e]);for(var s=0;s=0?this._tryShow(n,r):t===`leave`&&this._hide(r))},this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,r=e.get(`triggerOn`);if(e.get(`trigger`)!==`axis`&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&r!==`none`&&r!==`click`){var i=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&i.manuallyShowTip(e,t,n,{x:i._lastX,y:i._lastY,dataByCoordSys:i._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(e,t,n,r){if(r.from!==this.uid&&!Bo.node&&n.getDom()){var i=lH(r,n);this._ticket=``;var a=r.dataByCoordSys,o=mH(r,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:r.position,positionDefault:`bottom`},i)}else if(r.tooltip&&r.x!=null&&r.y!=null){var c=oH;c.x=r.x,c.y=r.y,c.update(),rh(c).tooltipConfig={name:null,option:r.tooltip},this._tryShow({offsetX:r.x,offsetY:r.y,target:c},i)}else if(a)this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,dataByCoordSys:a,tooltipOption:r.tooltipOption},i);else if(r.seriesIndex!=null){if(this._manuallyAxisShowTip(e,t,n,r))return;var l=SV(r,t),u=l.point[0],d=l.point[1];u!=null&&d!=null&&this._tryShow({offsetX:u,offsetY:d,target:l.el,position:r.position,positionDefault:`bottom`},i)}else r.x!=null&&r.y!=null&&(n.dispatchAction({type:`updateAxisPointer`,x:r.x,y:r.y}),this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,target:n.getZr().findHover(r.x,r.y).target},i))}},t.prototype.manuallyHideTip=function(e,t,n,r){var i=this._tooltipContent;this._tooltipModel&&i.hideLater(this._tooltipModel.get(`hideDelay`)),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,r.from!==this.uid&&this._hide(lH(r,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,r){var i=r.seriesIndex,a=r.dataIndex,o=t.getComponent(`axisPointer`).coordSysAxesInfo;if(i!=null&&a!=null&&o!=null){var s=t.getSeriesByIndex(i);if(s&&cH([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model],this._tooltipModel).get(`trigger`)===`axis`)return n.dispatchAction({type:`updateAxisPointer`,seriesIndex:i,dataIndex:a,position:r.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var r=e.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,e);else if(n){if(rh(n).ssrType===`legend`)return;this._lastDataByCoordSys=null,this._cbParamsList=null;var i,a;WN(n,function(e){if(e.tooltipDisabled)return i=a=null,!0;i||a||(rh(e).dataIndex==null?rh(e).tooltipConfig!=null&&(a=e):i=e)},!0),i?this._showSeriesItemTooltip(e,i,t):a?this._showComponentItemTooltip(e,a,t):this._hide(t)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get(`showDelay`);t=W(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,r=this._tooltipModel,i=[t.offsetX,t.offsetY],a=cH([t.tooltipOption],r),o=this._renderMode,s=[],c=QC(`section`,{blocks:[],noHeader:!0}),l=[],u=new pw;H(e,function(e){H(e.dataByAxis,function(e){var t=n.getComponent(e.axisDim+`Axis`,e.axisIndex),i=e.value,a=t.axis,d=a.scale.parse(i);if(t&&i!=null){var f=eV(i,a,n,e.seriesDataIndices,e.valueLabelOpt),p=QC(`section`,{header:f,noHeader:!Eo(f),sortBlocks:!0,blocks:[]});c.blocks.push(p),H(e.seriesDataIndices,function(i){var a=n.getSeriesByIndex(i.seriesIndex),c=i.dataIndexInside,m=a.getDataParams(c);if(!(m.dataIndex<0)){m.axisDim=e.axisDim,m.axisIndex=e.axisIndex,m.axisType=e.axisType,m.axisId=e.axisId,m.axisValue=DE(t.axis,{value:d}),m.axisValueLabel=f,m.marker=u.makeTooltipMarker(`item`,QS(m.color),o);var h=EC(a.formatTooltip(c,!0,null)),g=h.frag;if(g){var _=cH([a],r).get(`valueFormatter`);p.blocks.push(_?V({valueFormatter:_},g):g)}h.text&&l.push(h.text),s.push(m)}})}})}),c.blocks.reverse(),l.reverse();var d=t.position,f=iw(c,u,o,a.get(`order`),n.get(`useUTC`),a.get(`textStyle`));f&&l.unshift(f);var p=o===`richText`?` +`];function HC(e,t){return t.type=e,t}function UC(e){return e.type===`section`}function WC(e){return UC(e)?KC:qC}function GC(e){if(UC(e)){var t=0,n=e.blocks.length,r=n>1||n>0&&!e.noHeader;return H(e.blocks,function(e){var n=GC(e);n>=t&&(t=n+ +(r&&(!n||UC(e)&&!e.noHeader)))}),t}return 0}function KC(e,t,n,r){var i=t.noHeader,a=YC(GC(t)),o=[],s=t.blocks||[];ho(!s||G(s)),s||=[];var c=e.orderMode;if(t.sortBlocks&&c){s=s.slice();var l={valueAsc:`asc`,valueDesc:`desc`};if(Eo(l,c)){var u=new ub(l[c],null);s.sort(function(e,t){return u.evaluate(e.sortParam,t.sortParam)})}else c===`seriesDesc`&&s.reverse()}H(s,function(n,i){var s=t.valueFormatter,c=WC(n)(s?V(V({},e),{valueFormatter:s}):e,n,i>0?a.html:0,r);c!=null&&o.push(c)});var d=e.renderMode===`richText`?o.join(a.richText):XC(r,o.join(``),i?n:a.html);if(i)return d;var f=LS(t.header,`ordinal`,e.useUTC),p=zC(r,e.renderMode).nameStyle,m=RC(r);return e.renderMode===`richText`?$C(e,f,p)+a.richText+d:XC(r,`
`+Px(f)+`
`+d,n)}function qC(e,t,n,r){var i=e.renderMode,a=t.noName,o=t.noValue,s=!t.markerType,c=t.name,l=e.useUTC,u=t.valueFormatter||e.valueFormatter||function(e){return e=G(e)?e:[e],U(e,function(e,t){return LS(e,G(p)?p[t]:p,l)})};if(!(a&&o)){var d=s?``:e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||Q.color.secondary,i),f=a?``:LS(c,`ordinal`,l),p=t.valueType,m=o?[]:u(t.value,t.rawDataIndex),h=!s||!a,g=!s&&a,_=zC(r,i),v=_.nameStyle,y=_.valueStyle;return i===`richText`?(s?``:d)+(a?``:$C(e,f,v))+(o?``:ew(e,m,h,g,y)):XC(r,(s?``:d)+(a?``:ZC(f,!s,v))+(o?``:QC(m,h,g,y)),n)}}function JC(e,t,n,r,i,a){if(e)return WC(e)({useUTC:i,renderMode:n,orderMode:r,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,a)}function YC(e){return{html:BC[e],richText:VC[e]}}function XC(e,t,n){var r=`
`,i=`margin: `+n+`px 0 0`,a=RC(e);return`
`+t+r+`
`}function ZC(e,t,n){var r=t?`margin-left:2px`:``;return``+Px(e)+``}function QC(e,t,n,r){var i=t?`float:right;margin-left:`+(n?`10px`:`20px`):``;return e=G(e)?e:[e],``+U(e,function(e){return Px(e)}).join(`  `)+``}function $C(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function ew(e,t,n,r,i){var a=[i],o=r?10:20;return n&&a.push({padding:[0,0,0,o],align:`right`}),e.markupStyleCreator.wrapRichTextStyle(G(t)?t.join(` `):t,a)}function tw(e,t){var n=e.getData().getItemVisual(t,`style`)[e.visualDrawType];return HS(n)}function nw(e,t){return e.get(`padding`)??(t===`richText`?[8,10]:10)}var rw=function(){function e(){this.richTextStyles={},this._nextStyleNameId=Rp()}return e.prototype._generateStyleName=function(){return`__EC_aUTo_`+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var r=n===`richText`?this._generateStyleName():null,i=VS({color:t,type:e,renderMode:n,markerId:r});return q(i)?i:(this.richTextStyles[r]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};G(t)?H(t,function(e){return V(n,e)}):V(n,t);var r=this._generateStyleName();return this.richTextStyles[r]=n,`{`+r+`|`+e+`}`},e}();function iw(e){var t=e.series,n=e.dataIndex,r=e.multipleSeries,i=t.getData(),a=i.mapDimensionsAll(`defaultedTooltip`),o=a.length,s=t.getRawValue(n),c=G(s),l=tw(t,n),u,d,f,p;if(o>1||c&&!o){var m=aw(s,t,n,a,l);u=m.inlineValues,d=m.inlineValueTypes,f=m.blocks,p=m.inlineValues[0]}else if(o){var h=i.getDimensionInfo(a[0]);p=u=tb(i,n,a[0]),d=h.type}else p=u=c?s[0]:s;var g=fm(t),_=g&&t.name||``,v=i.getName(n),y=r?_:v;return HC(`section`,{header:_,noHeader:r||!g,sortParam:p,blocks:[HC(`nameValue`,{markerType:`item`,markerColor:l,name:y,noName:!go(y),value:u,valueType:d,rawDataIndex:i.getRawIndex(n)})].concat(f||[])})}function aw(e,t,n,r,i){var a=t.getData(),o=Za(e,function(e,t,n){var r=a.getDimensionInfo(n);return e||=r&&r.tooltip!==!1&&r.displayName!=null},!1),s=[],c=[],l=[];r.length?H(r,function(e){u(tb(a,n,e),e)}):H(e,u);function u(e,t){var n=a.getDimensionInfo(t);n&&n.otherDims.tooltip!==!1&&(o?l.push(HC(`nameValue`,{markerType:`subItem`,markerColor:i,name:n.displayName,value:e,valueType:n.type})):(s.push(e),c.push(n.type)))}return{inlineValues:s,inlineValueTypes:c,blocks:l}}var ow=vm();function sw(e,t){return e.getName(t)||e.getId(t)}var cw=function(e){z(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=_C({count:dw,reset:fw}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(ow(this).sourceManager=new jC(this)).prepareSource();var r=this.getInitialData(e,n);mw(r,this),this.dataTask.context.data=r,ow(this).dataBeforeProcessed=r,lw(this),this._initSelectedMapFromData(r)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=eC(this),r=n?nC(e):{},i=this.subType;aC.hasClass(i)&&(i+=`Series`),Wa(e,t.getTheme().get(this.subType)),Wa(e,this.getDefaultOption()),Qp(e,`label`,[`show`]),this.fillDataTextStyle(e.data),n&&tC(e,r,n)},t.prototype.mergeOption=function(e,t){e=Wa(this.option,e,!0),this.fillDataTextStyle(e.data);var n=eC(this);n&&tC(this.option,e,n);var r=ow(this).sourceManager;r.dirty(),r.prepareSource();var i=this.getInitialData(e,t);mw(i,this),this.dataTask.dirty(),this.dataTask.context.data=i,ow(this).dataBeforeProcessed=i,lw(this),this._initSelectedMapFromData(i)},t.prototype.fillDataTextStyle=function(e){if(e&&!oo(e))for(var t=[`show`],n=0;n=0&&u<0)&&(l=v,u=_,d=0),_===u&&(c[d++]=m))}return c.length=d,c},t.prototype.formatTooltip=function(e,t,n){return iw({series:this,dataIndex:e,multipleSeries:t})},t.prototype.isAnimationEnabled=function(){var e=this.ecModel;if(Ao.node&&!(e&&e.ssr))return!1;var t=this.getShallow(`animation`);return t&&this.getData().count()>this.getShallow(`animationThreshold`)&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var r=this.ecModel,i=lC.prototype.getColorFromPalette.call(this,e,t,n);return i||=r.getColorFromPalette(e,t,n),i},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get(`progressive`)},t.prototype.getProgressiveThreshold=function(){return this.get(`progressiveThreshold`)},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var r=this.option.selectedMode,i=this.getData(t);if(r===`series`||n===`all`){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var a=0;a=0&&n.push(i)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var r=this.getData(t);return(n===`all`||n[sw(r,e)])&&!r.getItemModel(e).get([`select`,`disabled`])},t.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var e=this.option.universalTransition;return e?e===!0||e&&e.enabled:!1},t.prototype._innerSelect=function(e,t){var n,r,i=this.option,a=i.selectedMode,o=t.length;if(a&&o){if(a===`series`)i.selectedMap=`all`;else if(a===`multiple`){J(i.selectedMap)||(i.selectedMap={});for(var s=i.selectedMap,c=0;c0&&this._innerSelect(e,t)}},t.registerClass=function(e){return aC.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type=`series.__base__`,e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol=`circle`,e.visualStyleAccessPath=`itemStyle`,e.visualDrawType=`fill`}(),t}(aC);Ya(cw,hC),Ya(cw,lC),Bo(cw,aC);function lw(e){var t=e.name;fm(e)||(e.name=uw(e)||t)}function uw(e){var t=e.getRawData(),n=t.mapDimensionsAll(`seriesName`),r=[];return H(n,function(e){var n=t.getDimensionInfo(e);n.displayName&&r.push(n.displayName)}),r.join(` `)}function dw(e){return e.model.getRawData().count()}function fw(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),pw}function pw(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function mw(e,t){H(wo(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(n){e.wrapMethod(n,no(hw,t))})}function hw(e,t){var n=gw(e);return n&&n.setOutputEnd((t||this).count()),t}function gw(e){var t=(e.ecModel||{}).scheduler,n=t&&t.getPipeline(e.uid);if(n){var r=n.currentTask;if(r){var i=r.agentStubMap;i&&(r=i.get(e.uid))}return r}}var _w=Sf.extend({type:`triangle`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r+a),e.lineTo(n-i,r+a),e.closePath()}}),vw={line:h_,rect:If,roundRect:If,square:If,circle:zg,diamond:Sf.extend({type:`diamond`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r),e.lineTo(n,r+a),e.lineTo(n-i,r),e.closePath()}}),pin:Sf.extend({type:`pin`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,r=t.y,i=t.width/5*3,a=Math.max(i,t.height),o=i/2,s=o*o/(a-o),c=r-a+o+s,l=Math.asin(s/o),u=Math.cos(l)*o,d=Math.sin(l),f=Math.cos(l),p=o*.6,m=o*.7;e.moveTo(n-u,c+s),e.arc(n,c,o,Math.PI-l,Math.PI*2+l),e.bezierCurveTo(n+u-d*p,c+s+f*p,n,r-m,n,r),e.bezierCurveTo(n,r-m,n-u+d*p,c+s+f*p,n-u,c+s),e.closePath()}}),arrow:Sf.extend({type:`arrow`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,r=t.width,i=t.x,a=t.y,o=r/3*2;e.moveTo(i,a),e.lineTo(i+o,a+n),e.lineTo(i,a+n/4*3),e.lineTo(i-o,a+n),e.lineTo(i,a),e.closePath()}}),triangle:_w},yw={line:function(e,t,n,r,i){i.x1=e,i.y1=t+r/2,i.x2=e+n,i.y2=t+r/2},rect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r},roundRect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r,i.r=Math.min(n,r)/4},square:function(e,t,n,r,i){var a=Math.min(n,r);i.x=e,i.y=t,i.width=a,i.height=a},circle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.r=Math.min(n,r)/2},diamond:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r},pin:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},arrow:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},triangle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r}},bw={};H(vw,function(e,t){bw[t]=new e});var xw=Sf.extend({type:`symbol`,shape:{symbolType:``,x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var r=pc(e,t,n),i=this.shape;return i&&i.symbolType===`pin`&&t.position===`inside`&&(r.y=n.y+n.height*.4),r},buildPath:function(e,t,n){var r=t.symbolType;if(r!==`none`){var i=bw[r];i||=(r=`rect`,bw[r]),yw[r](t.x,t.y,t.width,t.height,i.shape),i.buildPath(e,i.shape,n)}}});function Sw(e,t){if(this.type!==`image`){var n=this.style;this.__isEmptyBrush?(n.stroke=e,n.fill=t||Q.color.neutral00,n.lineWidth=2):this.shape.symbolType===`line`?n.stroke=e:n.fill=e,this.markRedraw()}}function Cw(e,t,n,r,i,a,o){var s=e.indexOf(`empty`)===0;s&&(e=e.substr(5,1).toLowerCase()+e.substr(6));var c=e.indexOf(`image://`)===0?rv(e.slice(8),new Z(t,n,r,i),o?`center`:`cover`):e.indexOf(`path://`)===0?nv(e.slice(7),{},new Z(t,n,r,i),o?`center`:`cover`):new xw({shape:{symbolType:e,x:t,y:n,width:r,height:i}});return c.__isEmptyBrush=s,c.setColor=Sw,a&&c.setColor(a),c}function ww(e){return G(e)||(e=[+e,+e]),[e[0]||0,e[1]||0]}function Tw(e,t){if(e!=null)return G(e)||(e=[e,e]),[gp(e[0],t[0])||0,gp(Y(e[1],e[0]),t[1])||0]}var Ew=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return t.prototype.getInitialData=function(e){return fx(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new Lg,n=Cw(`line`,0,e.itemHeight/2,e.itemWidth,0,e.lineStyle.stroke,!1);t.add(n),n.setStyle(e.lineStyle);var r=this.getData().getVisual(`symbol`),i=this.getData().getVisual(`symbolRotate`),a=r===`none`?`circle`:r,o=e.itemHeight*.8,s=Cw(a,(e.itemWidth-o)/2,(e.itemHeight-o)/2,o,o,e.itemStyle.fill);return t.add(s),s.setStyle(e.itemStyle),s.rotation=(e.iconRotate===`inherit`?i:e.iconRotate||0)*Math.PI/180,s.setOrigin([e.itemWidth/2,e.itemHeight/2]),a.indexOf(`empty`)>-1&&(s.style.stroke=s.style.fill,s.style.fill=Q.color.neutral00,s.style.lineWidth=2),t},t.type=`series.line`,t.dependencies=[`grid`,`polar`],t.defaultOption={z:3,coordinateSystem:`cartesian2d`,legendHoverLink:!0,clip:!0,label:{position:`top`},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:`solid`},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:`emptyCircle`,symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:`auto`,connectNulls:!1,sampling:`none`,animationEasing:`linear`,progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:`clone`},triggerLineEvent:!1,triggerEvent:!1},t}(cw);function Dw(e,t){var n=e.mapDimensionsAll(`defaultedLabel`),r=n.length;if(r===1){var i=tb(e,t,n[0]);return i==null?null:i+``}if(r){for(var a=[],o=0;o=0&&r.push(t[a])}return r.join(` `)}var kw=function(e){z(t,e);function t(t,n,r,i){var a=e.call(this)||this;return a.updateData(t,n,r,i),a}return t.prototype._createSymbol=function(e,t,n,r,i,a){this.removeAll();var o=Cw(e,-1,-1,2,2,null,a);o.attr({z2:Y(i,100),culling:!0,scaleX:r[0]/2,scaleY:r[1]/2}),o.drift=Aw,this._symbolType=e,this.add(o)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){zh(this.childAt(0))},t.prototype.downplay=function(){Bh(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?`move`:n.cursor},t.prototype.updateData=function(e,n,r,i){this.silent=!1;var a=e.getItemVisual(n,`symbol`)||`circle`,o=e.hostModel,s=t.getSymbolSize(e,n),c=t.getSymbolZ2(e,n),l=a!==this._symbolType,u=i&&i.disableAnimation;if(l){var d=e.getItemVisual(n,`symbolKeepAspect`);this._createSymbol(a,e,n,s,c,d)}else{var f=this.childAt(0);f.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?f.attr(p):B_(f,p,o,n),K_(f)}if(this._updateCommon(e,n,s,r,i),l){var f=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:f.style.opacity}};f.scaleX=f.scaleY=0,f.style.opacity=0,V_(f,p,o,n)}}u&&this.childAt(0).stopAnimation(`leave`)},t.prototype._updateCommon=function(e,t,n,r,i){var a=this.childAt(0),o=e.hostModel,s,c,l,u,d,f,p,m,h;if(r&&(s=r.emphasisItemStyle,c=r.blurItemStyle,l=r.selectItemStyle,u=r.focus,d=r.blurScope,p=r.labelStatesModels,m=r.hoverScale,h=r.cursorStyle,f=r.emphasisDisabled),!r||e.hasItemOption){var g=r&&r.itemModel?r.itemModel:e.getItemModel(t),_=g.getModel(`emphasis`);s=_.getModel(`itemStyle`).getItemStyle(),l=g.getModel([`select`,`itemStyle`]).getItemStyle(),c=g.getModel([`blur`,`itemStyle`]).getItemStyle(),u=_.get(`focus`),d=_.get(`blurScope`),f=_.get(`disabled`),p=Gv(g),m=_.getShallow(`scale`),h=g.getShallow(`cursor`)}var v=e.getItemVisual(t,`symbolRotate`);a.attr(`rotation`,(v||0)*Math.PI/180||0);var y=Tw(e.getItemVisual(t,`symbolOffset`),n);y&&(a.x=y[0],a.y=y[1]),h&&a.attr(`cursor`,h);var b=e.getItemVisual(t,`style`),x=b.fill;if(a instanceof Of){var S=a.style;a.useStyle(V({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else a.__isEmptyBrush?a.useStyle(V({},b)):a.useStyle(b),a.style.decal=null,a.setColor(x,i&&i.symbolInnerColor),a.style.strokeNoScale=!0;var C=e.getItemVisual(t,`liftZ`),w=this._z2;C==null?w!=null&&(a.z2=w,this._z2=null):w??(this._z2=a.z2,a.z2+=C);var T=i&&i.useNameLabel;Wv(a,p,{labelFetcher:o,labelDataIndex:t,defaultText:E,inheritColor:x,defaultOpacity:b.opacity});function E(t){return T?e.getName(t):Dw(e,t)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var D=a.ensureState(`emphasis`);D.style=s,a.ensureState(`select`).style=l,a.ensureState(`blur`).style=c;var O=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;D.scaleX=this._sizeX*O,D.scaleY=this._sizeY*O,this.setSymbolScale(1),ig(this,u,d,f)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var r=this.childAt(0),i=qm(this).dataIndex,a=n&&n.animation;if(this.silent=r.silent=!0,n&&n.fadeLabel){var o=r.getTextContent();o&&U_(o,{style:{opacity:0}},t,{dataIndex:i,removeOpt:a,cb:function(){r.removeTextContent()}})}else r.removeTextContent();U_(r,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:i,cb:e,removeOpt:a})},t.getSymbolSize=function(e,t){return ww(e.getItemVisual(t,`symbolSize`))},t.getSymbolZ2=function(e,t){return e.getItemVisual(t,`z2`)},t}(Lg);function Aw(e,t){this.parent.drift(e,t)}function jw(e,t,n,r){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(r&&r.isIgnore&&r.isIgnore(n))&&!(r&&r.clipShape&&!r.clipShape.contain(t[0],t[1]))&&e.getItemVisual(n,`symbol`)!==`none`}function Mw(e){return e!=null&&!J(e)&&(e={isIgnore:e}),e||{}}function Nw(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{emphasisItemStyle:n.getModel(`itemStyle`).getItemStyle(),blurItemStyle:t.getModel([`blur`,`itemStyle`]).getItemStyle(),selectItemStyle:t.getModel([`select`,`itemStyle`]).getItemStyle(),focus:n.get(`focus`),blurScope:n.get(`blurScope`),emphasisDisabled:n.get(`disabled`),hoverScale:n.get(`scale`),labelStatesModels:Gv(t),cursorStyle:t.get(`cursor`)}}function Pw(e,t,n,r,i,a,o){var s=new e(t,n,r,i);return s.setPosition(a),t.setItemGraphicEl(n,s),o.add(s),s}var Fw=function(){function e(e){this.group=new Lg,this._SymbolCtor=e||kw}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=Mw(t);var n=this.group,r=e.hostModel,i=this._data,a=this._SymbolCtor,o=t.disableAnimation,s=this._seriesScope=Nw(e),c={disableAnimation:o},l=t.getSymbolPoint||function(t){return e.getItemLayout(t)};i||n.removeAll(),e.diff(i).add(function(r){var i=l(r);jw(e,i,r,t)&&Pw(a,e,r,s,c,i,n)}).update(function(u,d){var f=i.getItemGraphicEl(d),p=l(u);if(!jw(e,p,u,t)){n.remove(f);return}var m=e.getItemVisual(u,`symbol`)||`circle`,h=f&&f.getSymbolType&&f.getSymbolType();if(!f||h&&h!==m)n.remove(f),f=new a(e,u,s,c),f.setPosition(p);else{f.updateData(e,u,s,c);var g={x:p[0],y:p[1]};o?f.attr(g):B_(f,g,r)}n.add(f),e.setItemGraphicEl(u,f)}).remove(function(e){var t=i.getItemGraphicEl(e);t&&t.fadeOut(function(){n.remove(t)},r)}).execute(),this._getSymbolPoint=l,this._data=e},e.prototype.updateLayout=function(e){var t=this._data;if(t)for(var n=this,r=t.getStore(),i=0,a=r.count();i0?n=r[0]:r[1]<0&&(n=r[1]),n}function Rw(e,t,n,r){var i=NaN;e.stacked&&(i=n.get(n.getCalculationInfo(`stackedOverDimension`),r)),isNaN(i)&&(i=e.valueStart);var a=e.baseDataOffset,o=[];return o[a]=n.get(e.baseDim,r),o[1-a]=i,t.dataToPoint(o)}function zw(e,t){return!isFinite(e)||!isFinite(t)}var Bw=typeof Float32Array<`u`?Float32Array:void 0,Vw=typeof Float64Array<`u`?Float64Array:void 0;function Hw(e){return Uw({ctor:Bw},e).arr}function Uw(e,t){var n=e.arr,r=e.ctor;if(t>Dp&&(t=Dp),!n||e.typed&&n.length=i||h<0)break;if(zw(_,v)){if(c){h+=a;continue}break}if(h===n)e[a>0?`moveTo`:`lineTo`](_,v),d=_,f=v;else{var y=_-l,b=v-u;if(y*y+b*b<.5){h+=a;continue}if(o>0){for(var x=h+a,S=t[x*2],C=t[x*2+1];S===_&&C===v&&g=r||zw(S,C))p=_,m=v;else{E=S-l,D=C-u;var A=_-l,j=S-_,M=v-u,N=C-v,P=void 0,ee=void 0;if(s===`x`){P=Math.abs(A),ee=Math.abs(j);var te=E>0?1:-1;p=_-te*P*o,m=v,O=_+te*ee*o,k=v}else if(s===`y`){P=Math.abs(M),ee=Math.abs(N);var ne=D>0?1:-1;p=_,m=v-ne*P*o,O=_,k=v+ne*ee*o}else P=Math.sqrt(A*A+M*M),ee=Math.sqrt(j*j+N*N),T=ee/(ee+P),p=_-E*o*(1-T),m=v-D*o*(1-T),O=_+E*o*T,k=v+D*o*T,O=Kw(O,qw(S,_)),k=Kw(k,qw(C,v)),O=qw(O,Kw(S,_)),k=qw(k,Kw(C,v)),E=O-_,D=k-v,p=_-E*P/ee,m=v-D*P/ee,p=Kw(p,qw(l,_)),m=Kw(m,qw(u,v)),p=qw(p,Kw(l,_)),m=qw(m,Kw(u,v)),E=_-p,D=v-m,O=_+E*ee/P,k=v+D*ee/P}e.bezierCurveTo(d,f,p,m,_,v),d=O,f=k}else e.lineTo(_,v)}l=_,u=v,h+=a}return g}var Yw=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),Xw=function(e){z(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polyline`,n}return t.prototype.getDefaultStyle=function(){return{stroke:Q.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Yw},t.prototype.buildPath=function(e,t){var n=t.points,r=0,i=n.length/2;if(t.connectNulls){for(;i>0&&zw(n[i*2-2],n[i*2-1]);i--);for(;r=0){var _=o?(d-a)*g+a:(u-i)*g+i;return o?[e,_]:[_,e]}i=u,a=d;break;case r.C:u=n[c++],d=n[c++],f=n[c++],p=n[c++],m=n[c++],h=n[c++];var v=o?cl(i,u,f,m,e,s):cl(a,d,p,h,e,s);if(v>0)for(var y=0;y=0){var _=o?ol(a,d,p,h,b):ol(i,u,f,m,b);return o?[e,_]:[_,e]}}i=m,a=h}}},t}(Sf),Zw=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Yw),Qw=function(e){z(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polygon`,n}return t.prototype.getDefaultShape=function(){return new Zw},t.prototype.buildPath=function(e,t){var n=t.points,r=t.stackedOnPoints,i=0,a=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;a>0&&zw(n[a*2-2],n[a*2-1]);a--);for(;i=t[0]&&e<=t[1]},getExtent:function(){return this._extents[0].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){ET(this._extents,0,e,t)},setExtent2:function(e,t,n){var r=this._extents;r[e]||(r[e]=r[0].slice()),ET(r,e,t,n)},freeze:function(){}};function ET(e,t,n,r){Fm(n,r)&&(e[t][0]=n,e[t][1]=r)}function DT(e){return OT(e)||AT(e)}function OT(e){return e.type===`interval`}function kT(e){return e.type===`time`}function AT(e){return e.type===`log`}function jT(e){return e.type===`ordinal`}function MT(e){var t=Np(e),n=up(10,t),r=sp(e/n);return r?r===2?r=3:r===3?r=5:r*=2:r=1,xp(r*n,-t)}function NT(e){return Cp(e)+2}function PT(e,t){return dp(e)/dp(t)}function FT(e,t,n){var r=n&&n.lookup;if(r){for(var i=0;i1&&a/o>2&&(i=Math.round(Math.ceil(i/o)*o)),i!==r[0]&&c(r[0],!0,!0);for(var s=i;s<=r[1];s+=o)c(s,!1,s===r[0]||s===r[1]);s-o!==r[1]&&c(r[1],!0,!0);function c(e,t,r){n({value:e,offInterval:t},r)}}var BT=function(e){z(t,e);function t(n){var r=e.call(this)||this;r.type=`ordinal`,r.parse=t.parse,vT(r,t.decoratedMethods);var i=n.ordinalMeta;i||=new mT({}),G(i)&&(i=new mT({categories:U(i,function(e){return J(e)?e.value:e})})),r._ordinalMeta=i;var a=_T(null,null,n.extent||[0,i.categories.length-1]);return r._mapper=a.mapper,yT(r,a.mapper),r}return t.parse=function(e){return e==null?e=NaN:q(e)?(e=this._ordinalMeta.getOrdinal(e),e??=NaN):e=sp(e),e},t.prototype.getTicks=function(){var e=[];return zT(this,0,function(t){e.push(t)}),e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(e==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],r=this._ticksByOrdinalNumber=[],i=0,a=this._ordinalMeta.categories.length,o=ip(a,t.length);i=0&&e=0&&e=0&&eo[0]&&mi[1]||!isFinite(p)||!isFinite(i[1]))break}else{if(m>f)break;p=ip(p,i[1]),m===f&&(p=i[1])}if(l.push({value:p}),p=xp(p+n,a),s){var h=s.calcNiceTickMultiple(p,d);h>=0&&(p=xp(p+h*n,a))}if(l.length>0&&p===l[l.length-1].value)break;if(l.length>u)return[]}var g=l.length?l[l.length-1].value:i[1];return r[1]>g&&l.push({value:e.expandToNicedExtent?xp(g+n,a):r[1]}),c&&o.pruneTicksByBreak(e.pruneByBreak,l,s.breaks,function(e){return e.value},t.interval,r),c&&e.breakTicks!==`none`&&o.addBreaksToTicks(l,s.breaks,r),l},t.prototype.getMinorTicks=function(e){return VT(this,e,Xx(this),this._cfg.interval)},t.prototype.getLabel=function(e,t){if(e==null)return``;var n=t&&t.precision;return n==null?n=Cp(e.value)||0:n===`auto`&&(n=this._cfg.intervalPrecision),PS(xp(e.value,n,!0))},t.type=`interval`,t}(fT);fT.registerClass(HT);var UT=function(e,t,n,r){for(;n>>1;e[i][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function JT(e){var t=30*tS;return e/=t,e>6?6:e>3?3:e>2?2:1}function YT(e){return e/=eS,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function XT(e,t){return e/=t?$x:Qx,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function ZT(e){return ap(Pp(e,!0),1)}function QT(e,t,n){var r=Math.max(0,qa(cS,t)-1);return yS(new Date(e),cS[r],n).getTime()}function $T(e,t){var n=new Date(0);n[e](1);var r=n.getTime();n[e](1+t);var i=n.getTime()-r;return function(e,t){return Math.max(0,Math.round((t-e)/i))}}function eE(e,t,n,r,i,a){var o=lS,s=0;function c(e,t,n,i,o,c,l){for(var u=$T(o,e),d=t,f=new Date(d);d3e3));)if(f[o](f[i]()+e),d=f.getTime(),a){var p=a.calcNiceTickMultiple(d,u);p>0&&(f[o](f[i]()+p*e),d=f.getTime())}l.push({value:d,notAdd:d>r[1]})}function l(e,i,a){var o=[],s=!i.length;if(!KT(pS(e),r[0],r[1],n)){s&&(i=[{value:QT(r[0],e,n)},{value:r[1]}]);for(var l=0;l=r[0]&&u<=r[1]&&c(f,u,d,p,m,h,o),e===`year`&&a.length>1&&l===0&&a.unshift({value:a[0].value-f})}}for(var l=0;l=r[0]&&v<=r[1]&&f++)}var y=i/t;if(f>y*1.5&&p>y/1.5||(u.push(g),f>y||e===o[m]))break}d=[]}}for(var b=Qa(U(u,function(e){return Qa(e,function(e){return e.value>=r[0]&&e.value<=r[1]&&!e.notAdd})}),function(e){return e.length>0}),x=b.length-1,S=[],m=0;mr[0])&&S.unshift({value:r[0],time:{level:0,upperTimeUnit:O,lowerTimeUnit:O},notNice:!0}),(!D||D.values&&(a=s);var c=GT.length,l=Math.min(UT(GT,a,0,c),c-1),u=GT[l][1],d=GT[Math.max(l-1,0)][0];e.setTimeInterval({approxInterval:a,interval:u,minLevelUnit:d})};fT.registerClass(WT);var nE=0,rE=1,iE=2,aE=function(e){z(t,e);function t(n){var r=e.call(this)||this;r.type=`log`,r.parse=HT.parse,r.base=n.logBase||10;var i=[],a=[],o=r._lookup={from:i,to:a};i[nE]=i[rE]=a[nE]=a[rE]=NaN,vT(r,t.mapperMethods);var s=Jx(),c=n.breakOption,l={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(c,r,{noNegative:!0},iE,l),r.powStub=new HT({breakParsed:l.original}),r.intervalStub=new HT({breakParsed:l.transformed}),yT(r,r.intervalStub),r}return t.prototype.getTicks=function(e){var t=this.base,n=this.powStub,r=Jx(),i=this.intervalStub,a={lookup:{from:i.getExtent(),to:n.getExtent()}};return U(i.getTicks(e||{}),function(e){var i=e.value,o=FT(i,t,a),s;if(r){var c=r.getTicksBreakOutwardTransform(this,e,Xx(n),this._lookup);c&&(s=c.vBreak,o=c.tickVal)}return{value:o,break:s}},this)},t.prototype.getMinorTicks=function(e){return VT(this,e,Xx(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(e,t){return this.intervalStub.getLabel(e,t)},t.type=`log`,t.mapperMethods={needTransform:function(){return!0},normalize:function(e){return this.intervalStub.normalize(PT(e,this.base))},scale:function(e){return FT(this.intervalStub.scale(e),this.base,null)},transformIn:function(e,t){return e=PT(e,this.base),t&&t.depth===2?e:this.intervalStub.transformIn(e,t)},transformOut:function(e,t){var n=t?t.depth:null;return oE.depth=n,sE.lookup=this._lookup,FT(n===2?e:this.intervalStub.transformOut(e,oE),this.base,sE)},contain:function(e){return this.powStub.contain(e)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){if(!(!Fm(t,n)||t<=0||n<=0)){var r=cE,i=cE;if(e===0){var a=this._lookup;r=a.to,i=a.from}this.powStub.setExtent2(e,r[nE]=t,r[rE]=n);var o=this.base;this.intervalStub.setExtent2(e,i[nE]=PT(t,o),i[rE]=PT(n,o))}},getFilter:function(){return{g:0}},sanitize:function(e,t){return Fm(t[0],t[1])&&Vp(e)&&e<=0&&(e=t[0]),e},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(e,t){return t===null?this.powStub.getExtentUnsafe(e,null):this.intervalStub.getExtentUnsafe(e,t)}},t}(fT);fT.registerClass(aE);var oE={},sE={},cE=[],lE={value:1,category:1,time:1,log:1},uE=vm();function dE(e){var t=e.get(`type`);return(t==null||!Eo(lE,t)&&!fT.getClass(t))&&(t=`value`),t}function fE(e,t,n){var r=Jx(),i;switch(r&&(i=CE(e,t,n)),t){case`category`:return new BT({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:km()});case`time`:return new WT({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get(`useUTC`),breakOption:i});case`log`:return new aE({logBase:e.get(`logBase`),breakOption:i});case`value`:return new HT({breakOption:i});default:return new((fT.getClass(t))||HT)({})}}function pE(e,t,n){var r=n?xT(e,null):e.getExtentUnsafe(0,null),i=r[0],a=r[1];return Fm(i,a)?i===t||a===t?2:it?1:3:3}function mE(e){uE(e).noOnMyZero=!0}function hE(e){return uE(e).noOnMyZero}function gE(e){var t=e.getLabelModel().get(`formatter`);if(e.type===`time`){var n=uS(t);return function(t,r){return e.scale.getFormattedLabel(t,r,n)}}if(q(t))return function(n){var r=e.scale.getLabel(n);return t.replace(`{value}`,r??``)};if(K(t)){if(e.type===`category`)return function(n,r){return t(_E(e,n),n.value-e.scale.getExtent()[0],null)};var r=Jx();return function(n,i){var a=null;return r&&(a=r.makeAxisLabelFormatterParamBreak(a,n.break)),t(_E(e,n),i,a)}}return function(t){return e.scale.getLabel(t)}}function _E(e,t){var n=e.scale;return jT(n)?n.getLabel(t):t.value}function vE(e){return e.get(`interval`)??`auto`}function yE(e){return e.type===`category`&&vE(e.getLabelModel())===0}function bE(e,t){var n={};return H(e.mapDimensionsAll(t),function(t){n[lx(e,t)]=!0}),eo(n)}function xE(e){return e===`middle`||e===`center`}function SE(e){return e.getShallow(`show`)}function CE(e,t,n){var r=e.get(`breaks`,!0);if(r!=null)return!Jx()||!n||!wE(t)?void 0:r}function wE(e){return e!==`category`}function TE(e,t,n,r,i,a){var o=AT(e),s=o?e.intervalStub:e;if(s.setExtent(r[0],r[1]),o){var c=e.powStub,l={depth:2},u=e.transformOut(r[0],l),d=e.transformOut(r[1],l),f=LT(n,r);t[0]&&!f[0]&&(u=i[0]),t[1]&&!f[1]&&(d=i[1]),c.setExtent(u,d)}s.setConfig(a)}function EE(e,t){return jT(e)?e.getRawOrdinalNumber(t.value):t.value}function DE(e,t){return jT(e)&&!!t.get(`boundaryGap`)}function OE(e,t){if(e.length===t.length){for(var n=0;nt){a?n.push(o(a,c,t)):i&&n.push(o(i,c,0),o(i,c,t));break}else i&&=(n.push(o(i,c,0)),null),n.push(c),a=c}return n}function FE(e,t,n){var r=e.getVisual(`visualMeta`);if(r&&r.length&&e.count()&&t.type===`cartesian2d`){for(var i,a,o=r.length-1;o>=0;o--){var s=e.getDimensionInfo(r[o].dimension);if(i=s&&s.coordDim,i===`x`||i===`y`){a=r[o];break}}if(a){var c=t.getAxis(i),l=U(a.stops,function(e){return{coord:c.toGlobalCoord(c.dataToCoord(e.value)),color:e.color}}),u=l.length,d=a.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),d.reverse());var f=PE(l,i===`x`?n.getWidth():n.getHeight()),p=f.length;if(!p&&u)return l[0].coord<0?d[1]?d[1]:l[u-1].color:d[0]?d[0]:l[0].color;var m=10,h=f[0].coord-m,g=f[p-1].coord+m,_=g-h;if(_<.001)return`transparent`;H(f,function(e){e.offset=(e.coord-h)/_}),f.push({offset:p?f[p-1].offset:.5,color:d[1]||`transparent`}),f.unshift({offset:p?f[0].offset:.5,color:d[0]||`transparent`});var v=new w_(0,0,0,0,f,!0);return v[i]=h,v[i+`2`]=g,v}}}function IE(e,t,n){var r=e.get(`showAllSymbol`),i=r===`auto`;if(!r||i){var a=n.getAxesByScale(`ordinal`)[0];if(a&&!(i&&LE(a,t))){var o=t.mapDimension(a.dim),s={};return H(a.getViewLabels(),function(e){e.tick.offInterval||(s[EE(a.scale,e.tick)]=1)}),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function LE(e,t){var n=e.getExtent(),r=Math.abs(n[1]-n[0])/e.scale.count();isNaN(r)&&(r=0);for(var i=t.count(),a=Math.max(1,Math.round(i/5)),o=0;or)return!1;return!0}function RE(e){for(var t=e.length/2;t>0&&zw(e[t*2-2],e[t*2-1]);t--);return t-1}function zE(e,t){return[e[t*2],e[t*2+1]]}function BE(e,t,n){for(var r=e.length/2,i=n===`x`?0:1,a,o,s=0,c=-1,l=0;l=t||a>=t&&o<=t){c=l;break}s=l,a=o}return{range:[s,c],t:(t-a)/(o-a)}}function VE(e){if(e.get([`endLabel`,`show`]))return!0;for(var t=0;t0&&e.get([`emphasis`,`lineStyle`,`width`])===`bolder`){var M=f.getState(`emphasis`).style;M.lineWidth=+f.style.lineWidth+1}qm(f).seriesIndex=e.seriesIndex,ig(f,k,A,j);var N=jE(e.get(`smooth`)),P=e.get(`smoothMonotone`);if(f.setShape({smooth:N,smoothMonotone:P,connectNulls:x}),p){var ee=a.getCalculationInfo(`stackedOnSeries`),te=0;p.useStyle(Ka(s.getAreaStyle(),{fill:E,opacity:.7,lineJoin:`bevel`,decal:a.getVisual(`style`).decal})),ee&&(te=jE(ee.get(`smooth`))),p.setShape({smooth:N,stackedOnSmooth:te,smoothMonotone:P,connectNulls:x}),cg(p,e,`areaStyle`),qm(p).seriesIndex=e.seriesIndex,ig(p,k,A,j)}var ne=this._changePolyState;a.eachItemGraphicEl(function(e){e&&(e.onHoverStateChange=ne)}),this._polyline.onHoverStateChange=ne,this._data=a,this._coordSys=r,this._stackedOnPoints=y,this._points=c,this._step=w,this._valueOrigin=_;var re=e.get(`triggerEvent`),ie=e.get(`triggerLineEvent`),ae=ie===!0||re===!0||re===`line`,oe=ie===!0||re===!0||re===`area`;this.packEventData(e,f,ae),p&&this.packEventData(e,p,oe)},t.prototype.packEventData=function(e,t,n){qm(t).eventData=n?{componentType:`series`,componentSubType:`line`,componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:`line`,selfType:t===this._polygon?`area`:`line`}:null},t.prototype.highlight=function(e,t,n,r){var i=e.getData(),a=_m(i,r);if(this._changePolyState(`emphasis`),!(a instanceof Array)&&a!=null&&a>=0){var o=i.getLayout(`points`),s=i.getItemGraphicEl(a);if(!s){var c=o[a*2],l=o[a*2+1];if(zw(c,l)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,l))return;var u=e.get(`zlevel`)||0,d=e.get(`z`)||0;s=new kw(i,a),s.x=c,s.y=l,s.setZ(u,d);var f=s.getSymbolPath().getTextContent();f&&(f.zlevel=u,f.z=d,f.z2=this._polyline.z2+1),s.__temp=!0,i.setItemGraphicEl(a,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else nT.prototype.highlight.call(this,e,t,n,r)},t.prototype.downplay=function(e,t,n,r){var i=e.getData(),a=_m(i,r);if(this._changePolyState(`normal`),a!=null&&a>=0){var o=i.getItemGraphicEl(a);o&&(o.__temp?(i.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else nT.prototype.downplay.call(this,e,t,n,r)},t.prototype._changePolyState=function(e){var t=this._polygon;Ah(this._polyline,e),t&&Ah(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new Xw({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new Qw({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var r,i,a=t.getBaseAxis(),o=a.inverse;t.type===`cartesian2d`?(r=a.isHorizontal(),i=!1):t.type===`polar`&&(r=a.dim===`angle`,i=!0);var s=e.hostModel,c=s.get(`animationDuration`);K(c)&&(c=c(null));var l=s.get(`animationDelay`)||0,u=K(l)?l(null):l;e.eachItemGraphicEl(function(e,a){var s=e;if(s){var d=[e.x,e.y],f=void 0,p=void 0,m=void 0;if(n){if(i){var h=n,g=t.pointToCoord(d);r?(f=h.startAngle,p=h.endAngle,m=-g[1]/180*Math.PI):(f=h.r0,p=h.r,m=g[0])}else{var _=n;r?(f=_.x,p=_.x+_.width,m=e.x):(f=_.y+_.height,p=_.y,m=e.y)}}var v=p===f?0:(m-f)/(p-f);o&&(v=1-v);var y=K(l)?l(a):c*v+u,b=s.getSymbolPath(),x=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:y}),x&&x.animateFrom({style:{opacity:0}},{duration:300,delay:y}),b.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(e,t,n){var r=e.getModel(`endLabel`);if(VE(e)){var i=e.getData(),a=this._polyline,o=i.getLayout(`points`);if(!o){a.removeTextContent(),this._endLabel=null;return}var s=this._endLabel;s||(s=this._endLabel=new Vf({z2:200}),s.ignoreClip=!0,a.setTextContent(this._endLabel),a.disableLabelAnimation=!0);var c=RE(o);c>=0&&(Wv(a,Gv(e,`endLabel`),{inheritColor:n,labelFetcher:e,labelDataIndex:c,defaultText:function(e,t,n){return n==null?Dw(i,e):Ow(i,n)},enableTextSetter:!0},UE(r,t)),a.textConfig.position=null)}else this._endLabel&&=(this._polyline.removeTextContent(),null)},t.prototype._endLabelOnDuring=function(e,t,n,r,i,a,o){var s=this._endLabel,c=this._polyline;if(s){e<1&&r.originalX==null&&(r.originalX=s.x,r.originalY=s.y);var l=n.getLayout(`points`),u=n.hostModel,d=u.get(`connectNulls`),f=a.get(`precision`),p=a.get(`distance`)||0,m=o.getBaseAxis(),h=m.isHorizontal(),g=m.inverse,_=t.shape,v=g?h?_.x:_.y+_.height:h?_.x+_.width:_.y,y=(h?p:0)*(g?-1:1),b=(h?0:-p)*(g?-1:1),x=h?`x`:`y`,S=BE(l,v,x),C=S.range,w=C[1]-C[0],T=void 0;if(w>=1){if(w>1&&!d){var E=zE(l,C[0]);s.attr({x:E[0]+y,y:E[1]+b}),i&&(T=u.getRawValue(C[0]))}else{var E=c.getPointOn(v,x);E&&s.attr({x:E[0]+y,y:E[1]+b});var D=u.getRawValue(C[0]),O=u.getRawValue(C[1]);i&&(T=Om(n,f,D,O,S.t))}r.lastFrameIndex=C[0]}else{var k=e===1||r.lastFrameIndex>0?C[0]:0,E=zE(l,k);i&&(T=u.getRawValue(k)),s.attr({x:E[0]+y,y:E[1]+b})}if(i){var A=ty(s);typeof A.setLabelText==`function`&&A.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,r,i,a,o){var s=this._polyline,c=this._polygon,l=e.hostModel,u=Gw(this._data,e,this._stackedOnPoints,t,this._coordSys,n,this._valueOrigin,a),d=u.current,f=u.stackedOnCurrent,p=u.next,m=u.stackedOnNext;if(i&&(f=NE(u.stackedOnCurrent,u.current,n,i,o),d=NE(u.current,null,n,i,o),m=NE(u.stackedOnNext,u.next,n,i,o),p=NE(u.next,null,n,i,o)),AE(d,p)>3e3||c&&AE(f,m)>3e3){s.stopAnimation(),s.setShape({points:p}),c&&(c.stopAnimation(),c.setShape({points:p,stackedOnPoints:m}));return}s.shape.__points=u.current,s.shape.points=d;var h={shape:{points:p}};u.current!==d&&(h.shape.__points=u.next),s.stopAnimation(),B_(s,h,l),c&&(c.setShape({points:d,stackedOnPoints:f}),c.stopAnimation(),B_(c,{shape:{stackedOnPoints:m}},l),s.shape.points!==c.shape.points&&(c.shape.points=s.shape.points));for(var g=[],_=u.status,v=0;v<_.length;v++)if(_[v].cmd===`=`){var y=e.getItemGraphicEl(_[v].idx1);y&&g.push({el:y,ptIdx:v})}s.animators&&s.animators.length&&s.animators[0].during(function(){c&&c.dirtyShape();for(var e=s.shape.__points,t=0;tt&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;n10&&a.type===`cartesian2d`&&i){var s=a.getBaseAxis(),c=a.getOtherAxis(s),l=s.getExtent(),u=n.getDevicePixelRatio(),d=Math.abs(l[1]-l[0])*(u||1),f=Math.round(o/d);if(isFinite(f)&&f>1){i===`lttb`?e.setData(r.lttbDownSample(r.mapDimension(c.dim),1/f)):i===`minmax`&&e.setData(r.minmaxDownSample(r.mapDimension(c.dim),1/f));var p=void 0;q(i)?p=KE[i]:K(i)&&(p=i),p&&e.setData(r.downSample(r.mapDimension(c.dim),1/f,p,qE))}}}}}function YE(e){e.registerChartView(WE),e.registerSeriesModel(Ew),e.registerLayout(GE(`line`,!0)),e.registerVisual({seriesType:`line`,reset:function(e){var t=e.getData(),n=e.getModel(`lineStyle`).getLineStyle();n&&!n.stroke&&(n.stroke=t.getVisual(`style`).fill),t.setVisual(`legendLineStyle`,n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,JE(`line`))}var XE=vm(),ZE=vm(),QE={estimate:1,determine:2};function $E(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function eD(e,t){var n=e.getLabelModel().get(`customValues`);if(n){var r=e.scale;return{labels:U(nD(n,r),function(t,n){return{formattedLabel:gE(e)(t,n),rawLabel:r.getLabel(t),tick:t}})}}return e.type===`category`?rD(e,t):oD(e)}function tD(e,t,n){var r=e.scale,i=e.getTickModel().get(`customValues`);return i?{ticks:nD(i,r)}:e.type===`category`?aD(e,t):{ticks:r.getTicks(n)}}function nD(e,t){var n=t.getExtent(),r=[];return H(e,function(e){e=t.parse(e),e>=n[0]&&e<=n[1]&&r.push(e)}),Bm(r,Hm,null),Sp(r),U(r,function(e){return{value:e}})}function rD(e,t){var n=e.getLabelModel(),r=iD(e,n,t);return!n.get(`show`)||e.scale.isBlank()?{labels:[]}:r}function iD(e,t,n){var r=cD(e),i=vE(t),a=n.kind===QE.estimate;if(!a){var o=uD(r,i);if(o)return o}var s,c;K(i)?s=_D(e,i,!1):(c=i===`auto`?fD(e,n):i,s=_D(e,c,!1));var l={labels:s,labelCategoryInterval:c};return a?n.out.noPxChangeTryDetermine.push(function(){return dD(r,i,l),!0}):dD(r,i,l),l}function aD(e,t){var n=sD(e),r=vE(t),i=uD(n,r);if(i)return i;var a,o;if((!t.get(`show`)||e.scale.isBlank())&&(a=[]),K(r))a=_D(e,r,!0);else if(r===`auto`){var s=iD(e,e.getLabelModel(),$E(QE.determine));o=s.labelCategoryInterval,a=U(s.labels,function(e){return e.tick})}else o=r,a=_D(e,o,!0);return dD(n,r,{ticks:a,tickCategoryInterval:o})}function oD(e){var t=e.scale.getTicks(),n=gE(e);return{labels:U(t,function(t,r){return{formattedLabel:n(t,r),rawLabel:e.scale.getLabel(t),tick:t}})}}var sD=lD(`axisTick`),cD=lD(`axisLabel`);function lD(e){return function(t){return ZE(t)[e]||(ZE(t)[e]={list:[]})}}function uD(e,t){for(var n=0;nu&&(l=Math.max(1,Math.floor(c/u)));for(var d=s[0],f=e.dataToCoord(d+1)-e.dataToCoord(d),p=Math.abs(f*Math.cos(a)),m=Math.abs(f*Math.sin(a)),h=0,g=0;d<=s[1];d+=l){var _=0,v=0,y=cc(i({value:d}),r.font,`center`,`top`);_=y.width*1.3,v=y.height*1.3,h=Math.max(h,_,7),g=Math.max(g,v,7)}var b=h/p,x=g/m;isNaN(b)&&(b=1/0),isNaN(x)&&(x=1/0);var S=Math.max(0,Math.floor(Math.min(b,x)));return n===QE.estimate?(t.out.noPxChangeTryDetermine.push(W(mD,null,e,S,c)),S):hD(e,S,c)??S}function mD(e,t,n){return hD(e,t,n)==null}function hD(e,t,n){var r=XE(e.model),i=e.getExtent(),a=r.lastAutoInterval,o=r.lastTickCount;if(a!=null&&o!=null&&Math.abs(a-t)<=1&&Math.abs(o-n)<=1&&a>t&&r.axisExtent0===i[0]&&r.axisExtent1===i[1])return a;r.lastTickCount=n,r.lastAutoInterval=t,r.axisExtent0=i[0],r.axisExtent1=i[1]}function gD(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get(`rotate`)||0,font:t.getFont()}}function _D(e,t,n){var r=gE(e),i=e.scale,a=[],o=K(t);return zT(i,o?0:t,function(e,s){var c=i.getLabel(e);if(o){var l=!!t(e.value,c);if(e.offInterval=!l,!l&&!s)return}a.push(n?e:{formattedLabel:r(e),rawLabel:c,tick:e})}),a}var vD=vm();function yD(e){vD(e).prepare={}}function bD(e){vD(e).fullUpdate={}}function xD(e){return vD(e).prepare}function SD(e){return vD(e).fullUpdate}var CD=Rm(),wD=vm(),TD=vm();function ED(e,t){var n=e.model,r=wD(SD(n.ecModel)).keyed,i=r&&r.get(t);return i&&i.get(n.uid)}function DD(e,t){return AD(ED(e,t))}function OD(e,t){var n=[];return kD(e.model.ecModel,function(e){for(var r=0;r0?(t>o&&(o=t),a=!1):t===-2&&(a=!0))}),Vp(n)&&n>0&&Vp(o)?(e.w=r/n*o,e.w2=o):a&&(e.w=r*UD,e.w2=e.w*n/r)}var qD=[0,1],JD=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]);return e>=n&&e<=r},e.prototype.containData=function(e){return this.scale.contain(this.scale.parse(e))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this.scale;return e=n.normalize(n.parse(e)),hp(e,qD,YD(this),t)},e.prototype.coordToData=function(e,t){var n=hp(e,YD(this),qD,t);return this.scale.scale(n)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){e||={};var t=e.tickModel||this.getTickModel(),n=U(tD(this,t,{breakTicks:e.breakTicks,pruneByBreak:e.pruneByBreak}).ticks,function(e){return{coord:this.dataToCoord(EE(this.scale,e)),tick:e}},this),r=t.get(`alignWithLabel`),i=XD(this,n,r);return U(n,function(e){return{coord:e.coord,tickValue:e.tick.value,onBand:i}})},e.prototype.getMinorTicksCoords=function(){if(jT(this.scale))return[];var e=this.model.getModel(`minorTick`).get(`splitNumber`);return e>0&&e<100||(e=5),U(this.scale.getMinorTicks(e),function(e){return U(e,function(e){return{coord:this.dataToCoord(e),tickValue:e}},this)},this)},e.prototype.getViewLabels=function(e){return e||=$E(QE.determine),eD(this,e).labels},e.prototype.getLabelModel=function(){return this.model.getModel(`axisLabel`)},e.prototype.getTickModel=function(){return this.model.getModel(`axisTick`)},e.prototype.getBandWidth=function(){return WD(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(e){return e||=$E(QE.determine),pD(this,e)},e}();function YD(e){var t=e.getExtent();if(e.onBand){var n=(t[1]-t[0])/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function XD(e,t,n){var r=t.length;if(!e.onBand||n||!r)return!1;var i=WD(e).w;if(!i)return!1;H(t,function(e){e.coord-=i/2});var a=e.scale.getExtent(),o=t[r-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+i,tick:{value:a[1]+1}}),!0}var ZD=function(e){z(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r)||this;return o.index=0,o.type=i||`value`,o.position=a||`bottom`,o}return t.prototype.isHorizontal=function(){var e=this.position;return e===`top`||e===`bottom`},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e[this.dim===`x`?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if(this.type!==`category`)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(JD),QD=[`label`,`labelLine`,`layoutOption`,`priority`,`defaultAttr`,`marginForce`,`minMarginForce`,`marginDefault`,`suggestIgnore`],$D=1,eO=2,tO=$D|eO;function nO(e,t,n){n||=tO,t?e.dirty|=n:e.dirty&=~n}function rO(e,t){return t||=tO,e.dirty==null||!!(e.dirty&t)}function iO(e){if(e)return rO(e)&&aO(e,e.label,e),e}function aO(e,t,n){var r=t.getComputedTransform();e.transform=Mv(e.transform,r);var i=e.localRect=jv(e.localRect,t.getBoundingRect()),a=t.style,o=a.margin,s=n&&n.marginForce,c=n&&n.minMarginForce,l=n&&n.marginDefault,u=a.__marginType;u==null&&l&&(o=l,u=ry.textMargin);for(var d=0;d<4;d++)oO[d]=u===ry.minMargin&&c&&c[d]!=null?c[d]:s&&s[d]!=null?s[d]:o?o[d]:0;u===ry.textMargin&&Cv(i,oO,!1,!1);var f=e.rect=jv(e.rect,i);return r&&f.applyTransform(r),u===ry.minMargin&&Cv(f,oO,!1,!1),e.axisAligned=kv(r),(e.label=e.label||{}).ignore=t.ignore,nO(e,!1),nO(e,!0,eO),e}var oO=[0,0,0,0];function sO(e,t,n){return e.transform=Mv(e.transform,n),e.localRect=jv(e.localRect,t),e.rect=jv(e.rect,t),n&&e.rect.applyTransform(n),e.axisAligned=kv(n),e.obb=void 0,(e.label=e.label||{}).ignore=!1,e}function cO(e,t){if(e){e.label.x+=t.x,e.label.y+=t.y,e.label.markRedraw();var n=e.transform;n&&(n[4]+=t.x,n[5]+=t.y);var r=e.rect;r&&(r.x+=t.x,r.y+=t.y);var i=e.obb;i&&i.fromBoundingRect(e.localRect,n)}}function lO(e,t){for(var n=0;n.1?`x`:`y`,u=a.transGroup[l];if(o.sort(function(e,t){return Math.abs(e.label[l]-u)-Math.abs(t.label[l]-u)}),c&&s){var d=i.getExtent(),f=Math.min(d[0],d[1]),p=Math.max(d[0],d[1])-f;s.union(new Z(f,0,p,1))}a.stOccupiedRect=s,a.labelInfoList=o}var CO=rs(),wO=new Z(0,0,0,0),TO=function(e,t,n,r,i,a){if(xE(e.nameLocation)){var o=a.stOccupiedRect;o&&EO(sO({},o,a.transGroup.transform),r,i)}else DO(a.labelInfoList,a.dirVec,r,i)};function EO(e,t,n){var r=new ks;fO(e,t,r,{direction:Math.atan2(n.y,n.x),bidirectional:!1,touchThreshold:.05})&&cO(t,r)}function DO(e,t,n,r){for(var i=ks.dot(r,t)>=0,a=0,o=e.length;a0?`top`:`bottom`,i=`center`):kp(r-gO)?(a=n>0?`bottom`:`top`,i=`center`):(a=`middle`,i=r>0&&r0?`right`:`left`:n>0?`left`:`right`),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+`Index`]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get(`tooltip`);return e.get(`silent`)||!(e.get(`triggerEvent`)||t&&t.show)},e}(),kO=[`axisLine`,`axisTickLabelEstimate`,`axisTickLabelDetermine`,`axisName`],AO={axisLine:function(e,t,n,r,i,a,o){var s=r.get([`axisLine`,`show`]);if(s===`auto`&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),s){var c=r.axis.getExtent(),l=a.transform,u=[c[0],0],d=[c[1],0],f=u[0]>d[0];l&&(Es(u,u,l),Es(d,d,l));var p=V({lineCap:`round`},r.getModel([`axisLine`,`lineStyle`]).getLineStyle()),m={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:p};if(r.get([`axisLine`,`breakLine`])&&Zx(r.axis.scale))mO().buildAxisBreakLine(r,i,a,m);else{var h=new h_(V({shape:{x1:u[0],y1:u[1],x2:d[0],y2:d[1]}},m));sv(h.shape,h.style.lineWidth),h.anid=`line`,i.add(h)}var g=r.get([`axisLine`,`symbol`]);if(g!=null){var _=r.get([`axisLine`,`symbolSize`]);q(g)&&(g=[g,g]),(q(_)||io(_))&&(_=[_,_]);var v=Tw(r.get([`axisLine`,`symbolOffset`])||0,_),y=_[0],b=_[1];H([{rotate:e.rotation+Math.PI/2,offset:v[0],r:0},{rotate:e.rotation-Math.PI/2,offset:v[1],r:Math.sqrt((u[0]-d[0])*(u[0]-d[0])+(u[1]-d[1])*(u[1]-d[1]))}],function(t,n){if(g[n]!==`none`&&g[n]!=null){var r=Cw(g[n],-y/2,-b/2,y,b,p.stroke,!0),a=t.r+t.offset,o=f?d:u;r.attr({rotation:t.rotate,x:o[0]+a*Math.cos(e.rotation),y:o[1]-a*Math.sin(e.rotation),silent:!0,z2:11}),i.add(r)}})}}},axisTickLabelEstimate:function(e,t,n,r,i,a,o,s){zO(t,i,s)&&jO(e,t,n,r,i,a,o,QE.estimate)},axisTickLabelDetermine:function(e,t,n,r,i,a,o,s){zO(t,i,s)&&jO(e,t,n,r,i,a,o,QE.determine);var c=LO(e,i,a,r);PO(e,t.labelLayoutList,c),RO(e,i,a,r,e.tickDirection)},axisName:function(e,t,n,r,i,a,o,s){var c=n.ensureRecord(r);t.nameEl&&=(i.remove(t.nameEl),c.nameLayout=c.nameLocation=null);var l=e.axisName;if(KO(l)){var u=e.nameLocation,d=e.nameDirection,f=r.getModel(`nameTextStyle`),p=r.get(`nameGap`)||0,m=r.axis.getExtent(),h=r.axis.inverse?-1:1,g=new ks(0,0),_=new ks(0,0);u===`start`?(g.x=m[0]-h*p,_.x=-h):u===`end`?(g.x=m[1]+h*p,_.x=h):(g.x=(m[0]+m[1])/2,g.y=e.labelOffset+d*p,_.y=d);var v=rs();_.transform(cs(v,v,e.rotation));var y=r.get(`nameRotate`);y!=null&&(y=y*gO/180);var b,x;xE(u)?b=OO.innerTextLayout(e.rotation,y??e.rotation,d):(b=MO(e.rotation,u,y||0,m),x=e.raw.axisNameAvailableWidth,x!=null&&(x=Math.abs(x/Math.sin(b.rotation)),!isFinite(x)&&(x=null)));var S=f.getFont(),C=r.get(`nameTruncate`,!0)||{},w=C.ellipsis,T=uo(e.raw.nameTruncateMaxWidth,C.maxWidth,x),E=s.nameMarginLevel||0,D=new Vf({x:g.x,y:g.y,rotation:b.rotation,silent:OO.isLabelSilent(r),style:Kv(f,{text:l,font:S,overflow:`truncate`,width:T,ellipsis:w,fill:f.getTextColor()||r.get([`axisLine`,`lineStyle`,`color`]),align:f.get(`align`)||b.textAlign,verticalAlign:f.get(`verticalAlign`)||b.textVerticalAlign}),z2:1});if(Ev({el:D,componentModel:r,itemName:l}),D.__fullText=l,D.anid=`name`,r.get(`triggerEvent`)){var O=OO.makeAxisEventDataBase(r);O.targetType=`axisName`,O.name=l,qm(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var k=c.nameLayout=iO({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:xE(u)?_O[E]:vO[E]});if(c.nameLocation=u,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&k){var A=n.ensureRecord(r);n.resolveAxisNameOverlap(e,n,r,k,_,A)}}}};function jO(e,t,n,r,i,a,o,s){VO(t)||BO(e,t,i,s,r,o);var c=t.labelLayoutList;UO(e,r,c,a),JO(r,e.rotation,c);var l=e.optionHideOverlap;NO(r,c,l),l&&dO(Qa(c,function(e){return e&&!e.label.ignore})),SO(e,n,r,c)}function MO(e,t,n,r){var i=Op(n-e),a,o,s=r[0]>r[1],c=t===`start`&&!s||t!==`start`&&s;return kp(i-gO/2)?(o=c?`bottom`:`top`,a=`center`):kp(i-gO*1.5)?(o=c?`top`:`bottom`,a=`center`):(o=`middle`,a=igO/2?c?`left`:`right`:c?`right`:`left`),{rotation:i,textAlign:a,textVerticalAlign:o}}function NO(e,t,n){var r=e.axis,i=e.get([`axisLabel`,`customValues`]);if(yE(r))return;function a(e,a,o){var s=iO(t[a]),c=iO(t[o]),l=r.scale;if(s&&c){if(e==null){if(!n&&i)return;var u=yO(s.label).labelInfo.tick;if(kT(l)&&u.notNice||jT(l)&&u.offInterval){FO(s.label);return}}if(e===!1||s.suggestIgnore){FO(s.label);return}if(c.suggestIgnore){FO(c.label);return}var d=.1;if(!n){var f=[0,0,0,0];s=lO({marginForce:f},s),c=lO({marginForce:f},c)}fO(s,c,null,{touchThreshold:d})&&FO(e?c.label:s.label)}}var o=e.get([`axisLabel`,`showMinLabel`]),s=e.get([`axisLabel`,`showMaxLabel`]),c=t.length;a(o,0,1),a(s,c-1,c-2)}function PO(e,t,n){e.showMinorTicks||H(t,function(e){if(e&&e.label.ignore)for(var t=0;t0&&u[1]>0&&!d[0]&&(u[0]=0),u[0]<0&&u[1]<0&&!d[1]&&(u[1]=0));var y=!1;u[0]>u[1]&&(u.reverse(),y=!0);var b=ik(e,t.get(`startValue`,!0)),x=b!=null;!Vp(b)&&r&&(b=e.getDefaultStartValue?e.getDefaultStartValue():0),Vp(b)&&(x||!_||v)&&(bu[1]&&!d[1]&&(u[1]=b,d[1]=!0)),rk(this._i={scale:e,dataMM:l,noZoomEffMM:u,zoomMM:[],fixMM:d,zoomFixMM:[!1,!1],startValue:b,isBlank:g,incl0:v,tggAxInv:y,ctnShp:i},u)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var e=this._i,t=e.zoomMM,n=e.noZoomEffMM,r=e.zoomFixMM,i=e.fixMM,a={fixMM:i,zoomFixMM:r,isBlank:e.isBlank,incl0:e.incl0,tggAxInv:e.tggAxInv,ctnShp:e.ctnShp,effMM:n.slice()},o=a.effMM;return t[0]!=null&&(o[0]=t[0],i[0]=r[0]=!0),t[1]!=null&&(o[1]=t[1],i[1]=r[1]=!0),rk(e,o),a},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(e,t){this._i.zoomMM[e]=t},e}();function rk(e,t){var n=e.scale,r=e.dataMM;n.sanitize&&(t[0]=n.sanitize(t[0],r),t[1]=n.sanitize(t[1],r),Lm(t))}function ik(e,t){return t==null?null:lo(t)?NaN:e.parse(t)}function ak(e,t){var n;if(jT(e))n=[0,0];else{var r=t.get(`boundaryGap`);typeof r==`boolean`&&(r=null),n=G(r)?r:[r,r]}return[ok(n[0]),ok(n[1])]}function ok(e){return fc(typeof e==`boolean`?0:e,1)||0}function sk(e){var t=ek(e.scale);return t.extent||=km(),t}function ck(e,t){sk(e).dimIdxInCoord=t.get(e.dim)}function lk(e,t){var n=e.scale,r=e.model,i=e.dim;n.rawExtentInfo||uk(n,e,i,r,t)}function uk(e,t,n,r,i){var a=sk(t),o=a.extent,s=!1;jD(t,function(r){if(r.boxCoordinateSystem){var i=$b(r).coord,c=a.dimIdxInCoord;if(c>=0&&G(i)){var l=i[c];l!=null&&!G(l)&&Am(o,e.parse(l))}}else if(r.coordinateSystem){var u=r.getData();if(u){var d=e.getFilter?e.getFilter():null;H(bE(u,n),function(e){Nm(o,u.getApproximateExtent(e,d))})}r.__requireStartValue&&r.__requireStartValue(t)&&(s=!0)}});var c=gk(e,t,r);fk(e,new nk(e,r,o,s,c),i),a.extent=null}function dk(e,t){var n=e.scale;fk(n,new nk(n,e.model,t,!1,!1),tk)}function fk(e,t,n){e.rawExtentInfo=t,t.from=n}function pk(e,t){mk.set(e,t)}var mk=X();function hk(e,t,n,r,i){e.rawExtentInfo||dk({scale:e,model:t},i||km());var a=e.rawExtentInfo.makeFinal(),o=a.effMM;return e.setExtent(o[0],o[1]),e.setBlank(a.isBlank),r&&a.tggAxInv&&n&&!n.get(`legacyMinMaxDontInverseAxis`)&&(r.inverse=!r.inverse),a}function gk(e,t,n){var r=DE(e,n),i=n.get(`containShape`,!0);if(i==null&&!r&&(i=!0),!i)return!1;var a=!1;return FD(t,function(e){a=!!mk.get(e)||a}),a}function _k(e,t,n,r){if(n.ctnShp){var i;if(FD(e,function(t){var n=mk.get(t);if(n){var a=n(e,r);a&&(i||=[0,0],jm(i,a[0]),Mm(i,a[1]),mE(e))}}),i){var a=t.getExtent();if(jT(t))e.onBand||t.setExtent2(1,ip(a[0],a[0]+i[0]),ap(a[1],a[1]+i[1]));else{var o=a.slice();n.zoomFixMM[0]||(o[0]=ip(o[0],t.transformOut(t.transformIn(o[0],null)+i[0],null))),n.zoomFixMM[1]||(o[1]=ap(o[1],t.transformOut(t.transformIn(o[1],null)+i[1],null))),(o[0]a[1])&&t.setExtent2(1,o[0],o[1])}}}}function vk(){LD(`liPosMinGap`,yk)}function yk(e,t,n){var r=X(),i=n.serUids,a=n.liPosMinGap,o,s=t.axis,c=s.scale,l=c.needTransform(),u=c.getFilter?c.getFilter():null,d=db(u);function f(n){ND(e,t.sers,function(e){var t=e.getRawData(),r=t.getDimensionIndex(t.mapDimension(s.dim));r>=0&&n(r,e,t.getStore())})}var p=0;if(f(function(e,t,n){r.set(t.uid,1),(!i||!i.hasKey(t.uid))&&(o=!0),p+=n.count()}),(!i||i.keys().length!==r.keys().length)&&(o=!0),!o&&a!=null){t.liPosMinGap=a;return}Uw(bk,p);var m=0;f(function(e,t,n){for(var r=0,i=n.count();r0&&v0?-2:-1,n.serUids=r}var bk=Uw({ctor:Vw},50);function xk(e){return function(t,n){var r=WD(t,{fromStat:{key:e}});if(Vp(r.w2))return[-r.w2/2,r.w2/2]}}function Sk(e,t){return e+`|&`+t}function Ck(e){return vk(),{liPosMinGap:!jT(e.scale)}}function wk(e,t,n,r){VD(e,{key:t,seriesType:n,coordSysType:r,getMetrics:Ck})}function Tk(e){return e.scale.rawExtentInfo.makeRenderInfo().startValue}var Ek={left:0,right:0,top:0,bottom:0},Dk=[`25%`,`25%`],Ok=`cartesian2d`,kk=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(t,n){var r=nC(t.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),r&&t.outerBounds&&tC(t.outerBounds,r)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&t.outerBounds&&tC(this.option.outerBounds,t.outerBounds)},t.type=`grid`,t.dependencies=[`xAxis`,`yAxis`],t.layoutMode=`box`,t.defaultOption={show:!1,z:0,left:`15%`,top:65,right:`10%`,bottom:80,containLabel:!1,outerBoundsMode:`auto`,outerBounds:Ek,outerBoundsContain:`all`,outerBoundsClampWidth:Dk[0],outerBoundsClampHeight:Dk[1],backgroundColor:Q.color.transparent,borderWidth:1,borderColor:Q.color.neutral30},t}(aC),Ak=Rm(),jk=`__ec_stack_`;function Mk(e){return e.get(`stack`)||jk+e.seriesIndex}function Nk(e,t){var n=Pk(e,t);return n.columnMap=Fk(n),n}function Pk(e,t){var n=Sk(t,Ok),r=[],i=WD(e,{fromStat:{key:n},min:1});return MD(e,n,function(e){r.push({barWidth:gp(e.get(`barWidth`),i.w),barMaxWidth:gp(e.get(`barMaxWidth`),i.w),barMinWidth:gp(e.get(`barMinWidth`)||(Rk(e)?.5:1),i.w),barGap:e.get(`barGap`),barCategoryGap:e.get(`barCategoryGap`),defaultBarGap:e.get(`defaultBarGap`),stackId:Mk(e)})}),{bandWidthResult:i,seriesInfo:r}}function Fk(e){var t=e.bandWidthResult.w,n=t,r=0,i,a,o=[],s={};H(e.seriesInfo,function(e,t){t||(a=e.defaultBarGap||0);var c=e.stackId;Eo(s,c)||r++;var l=s[c];l||(l=s[c]={width:0,maxWidth:0},o.push(c));var u=e.barWidth;u&&!l.width&&(l.width=u,u=ip(n,u),n-=u);var d=e.barMaxWidth;d&&(l.maxWidth=d);var f=e.barMinWidth;f&&(l.minWidth=f);var p=e.barGap;p!=null&&(a=p);var m=e.barCategoryGap;m!=null&&(i=m)}),i??=ap(35-o.length*4,15)+`%`;var c=gp(i,t),l=gp(a,1),u=(n-c)/(r+(r-1)*l);u=ap(u,0),H(o,function(e){var t=s[e],i=t.maxWidth,a=t.minWidth;if(t.width){var o=t.width;i&&(o=ip(o,i)),a&&(o=ap(o,a)),t.width=o,n-=o+l*o,r--}else{var o=u;i&&io&&(o=a),o!==u&&(t.width=o,n-=o+l*o,r--)}}),u=(n-c)/(r+(r-1)*l),u=ap(u,0);var d=0,f;H(o,function(e){var t=s[e];t.width||=u,f=t,d+=t.width*(1+l)}),f&&(d-=f.width*l);var p={},m=-d/2;return H(o,function(e){var n=s[e];p[e]=p[e]||{bandWidth:t,offset:m,width:n.width},m+=n.width*(1+l)}),p}function Ik(e){return{seriesType:e,overallReset:function(t){var n=Sk(e,Ok);PD(t,n,function(t){var r=Nk(t,e);MD(t,n,function(e){var t=r.columnMap[Mk(e)];e.getData().setLayout({bandWidth:t.bandWidth,offset:t.offset,size:t.width})})})}}}function Lk(e){return{seriesType:e,plan:$w(),reset:function(e){if(XO(e)){var t=e.getData(),n=e.coordinateSystem,r=n.getBaseAxis(),i=n.getOtherAxis(r),a=t.getDimensionIndex(t.mapDimension(i.dim)),o=t.getDimensionIndex(t.mapDimension(r.dim)),s=e.get(`showBackground`,!0),c=t.mapDimension(i.dim),l=t.getCalculationInfo(`stackResultDimension`),u=cx(t,c)&&!!t.getCalculationInfo(`stackedOnSeries`),d=i.isHorizontal(),f=i.toGlobalCoord(i.dataToCoord(Tk(i))),p=Rk(e),m=e.get(`barMinHeight`)||0,h=l&&t.getDimensionIndex(l),g=t.getLayout(`size`),_=t.getLayout(`offset`);return{progress:function(e,t){for(var r=e.count,i=p&&Hw(r*3),c=p&&s&&Hw(r*3),l=p&&Hw(r),v=n.master.getRect(),y=d?v.width:v.height,b,x=t.getStore(),S=0;(b=e.next())!=null;){var C=x.get(u?h:a,b),w=x.get(o,b),T=f,E=void 0;u&&(E=+C-x.get(a,b));var D=void 0,O=void 0,k=void 0,A=void 0;if(d){var j=n.dataToPoint([C,w]);u&&(T=n.dataToPoint([E,w])[0]),D=T,O=j[1]+_,k=j[0]-T,A=g,op(k)s){u=(p+l)/2;break}f===1&&(d=m-r[0].tickValue)}u??(l?l&&(u=r[r.length-1].coord):u=r[0].coord),a[n]=e.toGlobalCoord(u)}});else{var o=this.getData(),s=o.getLayout(`offset`),c=o.getLayout(`size`),l=+!r.getBaseAxis().isHorizontal();a[l]+=s+c/2}return a}return[NaN,NaN]},t.prototype.__requireStartValue=function(e){return this.getBaseAxis()!==e},t.type=`series.__base_bar__`,t.defaultOption={z:2,coordinateSystem:`cartesian2d`,legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:`mod`,defaultBarGap:`10%`},t}(cw);cw.registerClass(Vk);var Hk=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(){return fx(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get(`realtimeSort`,!0)||null})},t.prototype.getProgressive=function(){return this.get(`large`)?this.get(`progressive`):!1},t.prototype.__preparePipelineContext=function(e,t){var n=Wm(this,e,t);return n.progressiveRender&&(n.large=!0),n},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type=`series.bar`,t.dependencies=[`grid`,`polar`],t.defaultOption=yx(Vk.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:`rgba(180, 180, 180, 0.2)`,borderColor:null,borderWidth:0,borderType:`solid`,borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:Q.color.primary,borderWidth:2}},realtimeSort:!1}),t}(Vk),Uk=`\0__throttleOriginMethod`,Wk=`\0__throttleRate`,Gk=`\0__throttleType`;function Kk(e,t,n){var r,i=0,a=0,o=null,s,c,l,u;t||=0;function d(){a=new Date().getTime(),o=null,e.apply(c,l||[])}var f=function(){var e=[...arguments];r=new Date().getTime(),c=this,l=e;var f=u||t,p=u||n;u=null,s=r-(p?i:a)-f,clearTimeout(o),p?o=setTimeout(d,f):s>=0?d():o=setTimeout(d,-s),i=r};return f.clear=function(){o&&=(clearTimeout(o),null)},f.debounceNextCall=function(e){u=e},f}function qk(e,t,n,r){var i=e[t];if(i){var a=i[Uk]||i,o=i[Gk];if(i[Wk]!==n||o!==r){if(n==null||!r)return e[t]=a;i=e[t]=Kk(a,n,r===`debounce`),i[Uk]=a,i[Gk]=r,i[Wk]=n}return i}}function Jk(e,t){var n=e[t];n&&n[Uk]&&(n.clear&&n.clear(),e[t]=n[Uk])}var Yk=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),Xk=function(e){z(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`sausage`,n}return t.prototype.getDefaultShape=function(){return new Yk},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.max(t.r0||0,0),a=Math.max(t.r,0),o=(a-i)*.5,s=i+o,c=t.startAngle,l=t.endAngle,u=t.clockwise,d=Math.PI*2,f=u?l-cMath.PI/2&&ua)return!0;a=l}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,r=n.getExtent(),i=Math.max(0,r[0]),a=Math.min(r[1],n.getOrdinalMeta().categories.length-1);i<=a;++i)if(e.ordinalNumbers[i]!==n.getRawOrdinalNumber(i))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,r){if(this._isOrderChangedWithinSameData(e,t,n)){var i=this._dataSort(e,n,t);this._isOrderDifferentInView(i,n)&&(this._removeOnRenderedListener(r),r.dispatchAction({type:`changeAxisOrder`,componentType:n.dim+`Axis`,axisId:n.index,sortInfo:i}))}},t.prototype._dispatchInitSort=function(e,t,n){var r=t.baseAxis,i=this._dataSort(e,r,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:`changeAxisOrder`,componentType:r.dim+`Axis`,isInitSort:!0,axisId:r.index,sortInfo:i})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&=(e.getZr().off(`rendered`,this._onRendered),null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){G_(t,e,qm(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=`bar`,t}(nT),aA={cartesian2d:function(e,t){var n=t.width<0?-1:1,r=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=nA(t.x,e.x),s=rA(t.x+t.width,i),c=nA(t.y,e.y),l=rA(t.y+t.height,a),u=si?s:o,t.y=d&&c>a?l:c,t.width=u?0:s-o,t.height=d?0:l-c,n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height),u||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}var i=rA(t.r,e.r),a=nA(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}return o}},oA={cartesian2d:function(e,t,n,r,i,a,o,s,c){var l=new If({shape:V({},r),z2:1});if(l.__dataIndex=n,l.name=`item`,a){var u=l.shape,d=i?`height`:`width`;u[d]=0}return l},polar:function(e,t,n,r,i,a,o,s,c){var l=!i&&c?Xk:i_,u=new l({shape:r,z2:1});if(u.name=`item`,u.calculateTextPosition=Zk(hA(i),{isRoundCap:l===Xk}),a){var d=u.shape,f=i?`r`:`endAngle`,p={};d[f]=i?r.r0:r.startAngle,p[f]=r[f],(s?B_:V_)(u,{shape:p},a)}return u}};function sA(e,t){var n=e.get(`realtimeSort`,!0),r=t.getBaseAxis();if(n&&r.type===`category`&&t.type===`cartesian2d`)return{baseAxis:r,otherAxis:t.getOtherAxis(r)}}function cA(e,t,n,r,i,a,o,s){var c,l;a?(l={x:r.x,width:r.width},c={y:r.y,height:r.height}):(l={y:r.y,height:r.height},c={x:r.x,width:r.width}),s||(o?B_:V_)(n,{shape:c},t,i,null);var u=t?e.baseAxis.model:null;(o?B_:V_)(n,{shape:l},u,i)}function lA(e,t){for(var n=0;n0?1:-1,o=r.height>0?1:-1;return{x:r.x+a*i/2,y:r.y+o*i/2,width:r.width-a*i,height:r.height-o*i}},polar:function(e,t,n){var r=e.getItemLayout(t);return{cx:r.cx,cy:r.cy,r0:r.r0,r:r.r,startAngle:r.startAngle,endAngle:r.endAngle,clockwise:r.clockwise}}};function mA(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function hA(e){return function(e){var t=e?`Arc`:`Angle`;return function(e){switch(e){case`start`:case`insideStart`:case`end`:case`insideEnd`:return e+t;default:return e}}}(e)}function gA(e,t,n,r,i,a,o,s){var c=t.getItemVisual(n,`style`);if(!s){var l=r.get([`itemStyle`,`borderRadius`])||0;e.setShape(`r`,l)}else if(!a.get(`roundCap`)){var u=e.shape;V(u,tA(r.getModel(`itemStyle`),u,!0)),e.setShape(u)}e.useStyle(c);var d=r.getShallow(`cursor`);d&&e.attr(`cursor`,d);var f=s?o?i.r>=i.r0?`endArc`:`startArc`:i.endAngle>=i.startAngle?`endAngle`:`startAngle`:o?TA(i,a.coordinateSystem):EA(i,a.coordinateSystem),p=Gv(r);Wv(e,p,{labelFetcher:a,labelDataIndex:n,defaultText:Dw(a.getData(),n),inheritColor:c.fill,defaultOpacity:c.opacity,defaultOutsidePosition:f});var m=e.getTextContent();if(s&&m){var h=r.get([`label`,`position`]);e.textConfig.inside=h===`middle`||null,Qk(e,h===`outside`?f:h,hA(o),r.get([`label`,`rotate`]))}ny(m,p,a.getRawValue(n),function(e){return Ow(t,e)});var g=r.getModel([`emphasis`]);ig(e,g.get(`focus`),g.get(`blurScope`),g.get(`disabled`)),cg(e,r),mA(i)&&(e.style.fill=`none`,e.style.stroke=`none`,H(e.states,function(e){e.style&&(e.style.fill=e.style.stroke=`none`)}))}function _A(e,t){var n=e.get([`itemStyle`,`borderColor`]);if(!n||n===`none`)return 0;var r=e.get([`itemStyle`,`borderWidth`])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(r,i,a)}var vA=function(){function e(){}return e}(),yA=function(e){z(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`largeBar`,n}return t.prototype.getDefaultShape=function(){return new vA},t.prototype.buildPath=function(e,t){for(var n=t.points,r=this.baseDimIdx,i=1-this.baseDimIdx,a=[],o=[],s=this.barWidth,c=0;c=0?n:null},30,!1);function SA(e,t,n){for(var r=e.baseDimIdx,i=1-r,a=e.shape.points,o=e.largeDataIndices,s=[],c=[],l=e.barWidth,u=0,d=a.length/3;u=s[0]&&t<=s[0]+c[0]&&n>=s[1]&&n<=s[1]+c[1])return o[u]}return-1}function CA(e,t,n){if(dT(n,`cartesian2d`)){var r=t,i=n.getArea();return{x:e?r.x:i.x,y:e?i.y:r.y,width:e?r.width:i.width,height:e?i.height:r.height}}var i=n.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}function wA(e,t,n){return new(e.type===`polar`?i_:If)({shape:CA(t,n,e),silent:!0,z2:0})}function TA(e,t){return e.height===0?t.getOtherAxis(t.getBaseAxis()).inverse?`bottom`:`top`:e.height>0?`bottom`:`top`}function EA(e,t){return e.width===0?t.getOtherAxis(t.getBaseAxis()).inverse?`left`:`right`:e.width>=0?`right`:`left`}function DA(e){e.registerChartView(iA),e.registerSeriesModel(Hk),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Ik(`bar`)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,Lk(`bar`)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,JE(`bar`)),e.registerAction({type:`changeAxisOrder`,event:`changeAxisOrder`,update:`update`},function(e,t){var n=e.componentType||`series`;t.eachComponent({mainType:n,query:e},function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)})}),Bk(e)}function OA(e,t,n,r,i){var a=e+t;n.isSilent(a)||r.eachComponent({mainType:`series`,subType:`pie`},function(e){for(var t=e.seriesIndex,r=e.option.selectedMap,o=i.selected,s=0;s=0},e.prototype.indexOfName=function(e){return this._getDataWithEncodedVisual().indexOfName(e)},e.prototype.getItemVisual=function(e,t){return this._getDataWithEncodedVisual().getItemVisual(e,t)},e}(),jA=function(){function e(e,t){this.target=e,this.topTarget=t&&t.topTarget}return e}(),MA=function(){function e(e){this.handler=e,e.on(`mousedown`,this._dragStart,this),e.on(`mousemove`,this._drag,this),e.on(`mouseup`,this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new jA(t,e),`dragstart`,e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,r=e.offsetY,i=n-this._x,a=r-this._y;this._x=n,this._y=r,t.drift(i,a,e),this.handler.dispatchToElement(new jA(t,e),`drag`,e.event);var o=this.handler.findHover(n,r,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new jA(s,e),`dragleave`,e.event),o&&o!==s&&this.handler.dispatchToElement(new jA(o,e),`dragenter`,e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new jA(t,e),`dragend`,e.event),this._dropTarget&&this.handler.dispatchToElement(new jA(this._dropTarget,e),`drop`,e.event),this._draggingTarget=null,this._dropTarget=null},e}(),NA=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,PA=[],FA=Ao.browser.firefox&&+Ao.browser.version.split(`.`)[0]<39;function IA(e,t,n,r){return n||={},r?LA(e,t,n):FA&&t.layerX!=null&&t.layerX!==t.offsetX?(n.zrX=t.layerX,n.zrY=t.layerY):t.offsetX==null?LA(e,t,n):(n.zrX=t.offsetX,n.zrY=t.offsetY),n}function LA(e,t,n){if(Ao.domSupported&&e.getBoundingClientRect){var r=t.clientX,i=t.clientY;if(jx(e)){var a=e.getBoundingClientRect();n.zrX=r-a.left,n.zrY=i-a.top;return}if(Ox(PA,e,r,i)){n.zrX=PA[0],n.zrY=PA[1];return}}n.zrX=n.zrY=0}function RA(e){return e||window.event}function zA(e,t,n){if(t=RA(t),t.zrX!=null)return t;var r=t.type;if(r&&r.indexOf(`touch`)>=0){var i=r===`touchend`?t.changedTouches[0]:t.targetTouches[0];i&&IA(e,i,t,n)}else{IA(e,t,t,n);var a=BA(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var o=t.button;return t.which==null&&o!==void 0&&NA.test(t.type)&&(t.which=o&1?1:o&2?3:o&4?2:0),t}function BA(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,r=e.deltaY;if(n==null||r==null)return t;var i=Math.abs(r===0?n:r),a=r>0?-1:r<0?1:n>0?-1:1;return 3*i*a}function VA(e,t,n,r){e.addEventListener(t,n,r)}function HA(e,t,n,r){e.removeEventListener(t,n,r)}var UA=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function WA(e){return e.which===2||e.which===3}var GA=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a1&&r&&r.length>1){var a=KA(r)/KA(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=qA(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},YA=`silent`;function XA(e,t,n){return{type:e,event:n,target:t.target,topTarget:t.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:ZA}}function ZA(){UA(this.event)}var QA=function(e){z(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.handler=null,t}return t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(Ru),$A=function(){function e(e,t){this.x=e,this.y=t}return e}(),ej=[`click`,`dblclick`,`mousewheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],tj=new Z(0,0,0,0),nj=function(e){z(t,e);function t(t,n,r,i,a){var o=e.call(this)||this;return o._hovered=new $A(0,0),o.storage=t,o.painter=n,o.painterRoot=i,o._pointerSize=a,r||=new QA,o.proxy=null,o.setHandlerProxy(r),o._draggingMgr=new MA(o),o}return t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(H(ej,function(t){e.on&&e.on(t,this[t],this)},this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,r=aj(this,t,n),i=this._hovered,a=i.target;a&&!a.__zr&&(i=this.findHover(i.x,i.y),a=i.target);var o=this._hovered=r?new $A(t,n):this.findHover(t,n),s=o.target,c=this.proxy;c.setCursor&&c.setCursor(s?s.cursor:`default`),a&&s!==a&&this.dispatchToElement(i,`mouseout`,e),this.dispatchToElement(o,`mousemove`,e),s&&s!==a&&this.dispatchToElement(o,`mouseover`,e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;t!==`only_globalout`&&this.dispatchToElement(this._hovered,`mouseout`,e),t!==`no_globalout`&&this.trigger(`globalout`,{type:`globalout`,event:e})},t.prototype.resize=function(){this._hovered=new $A(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){e||={};var r=e.target;if(!(r&&r.silent)){for(var i=`on`+t,a=XA(t,e,n);r&&(r[i]&&(a.cancelBubble=!!r[i].call(r,a)),r.trigger(t,a),r=r.__hostTarget?r.__hostTarget:r.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(t,a),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(e){typeof e[i]==`function`&&e[i].call(e,a),e.trigger&&e.trigger(t,a)}))}},t.prototype.findHover=function(e,t,n){var r=this.storage.getDisplayList(),i=new $A(e,t);if(ij(r,i,e,t,n),this._pointerSize&&!i.target){for(var a=[],o=this._pointerSize,s=o/2,c=new Z(e-s,t-s,o,o),l=r.length-1;l>=0;l--){var u=r[l];u!==n&&!u.ignore&&!u.ignoreCoarsePointer&&(!u.parent||!u.parent.ignoreCoarsePointer)&&(tj.copy(u.getBoundingRect()),u.transform&&tj.applyTransform(u.transform),tj.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function rj(e,t,n){if(e[e.rectHover?`rectContain`:`contain`](t,n)){for(var r=e,i=void 0,a=!1;r;){if(r.ignoreClip&&(a=!0),!a){var o=r.getClipPath();if(o&&!o.contain(t,n))return!1}r.silent&&(i=!0);var s=r.__hostTarget;r=s?r.ignoreHostSilent?null:s:r.parent}return!i||YA}return!1}function ij(e,t,n,r,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=rj(o,n,r))&&(!t.topTarget&&(t.topTarget=o),s!==YA)){t.target=o;break}}}function aj(e,t,n){var r=e.painter;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var oj=32,sj=7;function cj(e){for(var t=0;e>=oj;)t|=e&1,e>>=1;return e+t}function lj(e,t,n,r){var i=t+1;if(i===n)return 1;if(r(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function uj(e,t,n){for(n--;t>>1,i(a,e[c])<0?s=c:o=c+1;var l=r-o;switch(l){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;l>0;)e[o+l]=e[o+l-1],l--}e[o]=a}}function fj(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])>0){for(s=r-i;c0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}else{for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}for(o++;o>>1);a(e,t[n+u])>0?o=u+1:c=u}return c}function pj(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])<0){for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}else{for(s=r-i;c=0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}for(o++;o>>1);a(e,t[n+u])<0?c=u:o=u+1}return c}function mj(e,t){var n=sj,r,i,a=0,o=[];r=[],i=[];function s(e,t){r[a]=e,i[a]=t,a+=1}function c(){for(;a>1;){var e=a-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;u(e)}}function l(){for(;a>1;){var e=a-2;e>0&&i[e-1]=sj||m>=sj);if(h)break;f<0&&(f=0),f+=2}if(n=f,n<1&&(n=1),i===1){for(c=0;c=0;c--)e[p+c]=e[f+c];e[d]=o[u];return}for(var m=n;;){var h=0,g=0,_=!1;do if(t(o[u],e[l])<0){if(e[d--]=e[l--],h++,g=0,--i===0){_=!0;break}}else if(e[d--]=o[u--],g++,h=0,--s===1){_=!0;break}while((h|g)=0;c--)e[p+c]=e[f+c];if(i===0){_=!0;break}}if(e[d--]=o[u--],--s===1){_=!0;break}if(g=s-fj(e[l],o,0,s,s-1,t),g!==0){for(d-=g,u-=g,s-=g,p=d+1,f=u+1,c=0;c=sj||g>=sj);if(_)break;m<0&&(m=0),m+=2}if(n=m,n<1&&(n=1),s===1){for(d-=i,l-=i,p=d+1,f=l+1,c=i-1;c>=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else if(s===0)throw Error();else for(f=d-(s-1),c=0;cs&&(c=s),dj(e,n,n+c,n+a,t),a=c}o.pushRun(n,a),o.mergeRuns(),i-=a,n+=a}while(i!==0);o.forceMergeRuns()}}var gj=!1;function _j(){gj||(gj=!0,console.warn(`z / z2 / zlevel of displayable is invalid, which may cause unexpected errors`))}function vj(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var yj=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=vj}return e.prototype.traverse=function(e,t){for(var n=0;n=0&&this._roots.splice(r,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),bj=Ao.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};function xj(){return new Date().getTime()}var Sj=function(e){z(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=xj()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)?(r.ondestroy(),this.removeClip(r),r=i):r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&(bj(t),!e._paused&&e.update())}bj(t)},t.prototype.start=function(){this._running||(this._time=xj(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=xj(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=xj()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new Lu(e,t.loop);return this.addAnimator(n),n},t}(Ru),Cj=300,wj=Ao.domSupported,Tj=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:U(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),Ej={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},Dj=!1;function Oj(e){var t=e.pointerType;return t===`pen`||t===`touch`}function kj(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function Aj(e){e&&(e.zrByTouch=!0)}function jj(e,t){return zA(e.dom,new Nj(e,t),!0)}function Mj(e,t){for(var n=t,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return r}var Nj=function(){function e(e,t){this.stopPropagation=Do,this.stopImmediatePropagation=Do,this.preventDefault=Do,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),Pj={mousedown:function(e){e=zA(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=zA(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=zA(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=zA(this.dom,e);var t=e.toElement||e.relatedTarget;Mj(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){Dj=!0,e=zA(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){Dj||(e=zA(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=zA(this.dom,e),Aj(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),Pj.mousemove.call(this,e),Pj.mousedown.call(this,e)},touchmove:function(e){e=zA(this.dom,e),Aj(e),this.handler.processGesture(e,`change`),Pj.mousemove.call(this,e)},touchend:function(e){e=zA(this.dom,e),Aj(e),this.handler.processGesture(e,`end`),Pj.mouseup.call(this,e),+new Date-this.__lastTouchMoment0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(e){this._disposed||(e||={},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t=0;o--)r[o]&&!pm(r[o])?a=!0:(r[o]=null,!a&&i--);r.length=i,e[n]=r}}),delete e[cM],e},t.prototype.setTheme=function(e){this._theme=new my(e),this._resetOption(`recreate`,null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var r=n[t||0];if(r)return r;if(t==null){for(var i=0;i=t:n===`max`?e<=t:e===t}function xM(e,t){return e.join(`,`)===t.join(`,`)}var SM=H,CM=J,wM=[`areaStyle`,`lineStyle`,`nodeStyle`,`linkStyle`,`chordStyle`,`label`,`labelLine`];function TM(e){var t=e&&e.itemStyle;if(t)for(var n=0,r=wM.length;n0?e[n-1].seriesModel:null)}),JM(e))})}function JM(e){H(e,function(t,n){var r=[],i=[NaN,NaN],a=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,c=t.seriesModel.get(`stackStrategy`)||`samesign`;o.modify(a,function(a,l,u){var d=o.get(t.stackedDimension,u);if(isNaN(d))return i;var f,p;s?p=o.getRawIndex(u):f=o.get(t.stackedByDimension,u);for(var m=NaN,h=n-1;h>=0;h--){var g=e[h];if(s||(p=g.data.rawIndexOf(g.stackedByDimension,f)),p>=0){var _=g.data.getByRawIndex(g.stackResultDimension,p);if(c===`all`||c===`positive`&&_>0||c===`negative`&&_<0||c===`samesign`&&d>=0&&_>0||c===`samesign`&&d<=0&&_<0){d=Ep(d,_),m=_;break}}}return r[0]=d,r[1]=m,r})})}var YM=function(){function e(){this.group=new Lg,this.uid=gx(`viewComponent`)}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){},e.prototype.updateLayout=function(e,t,n,r){},e.prototype.updateVisual=function(e,t,n,r){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}();Ro(YM),Go(YM);var XM=vm(),ZM={itemStyle:Ko(dy,!0),lineStyle:Ko(cy,!0)},QM={lineStyle:`stroke`,itemStyle:`fill`};function $M(e,t){return e.visualStyleMapper||ZM[t]||(console.warn(`Unknown style type '`+t+`'.`),ZM.itemStyle)}function eN(e,t){return e.visualDrawType||QM[t]||(console.warn(`Unknown style type '`+t+`'.`),`fill`)}var tN={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=e.getModel(r),a=$M(e,r)(i),o=i.getShallow(`decal`);o&&(n.setVisual(`decal`,o),o.dirty=!0);var s=eN(e,r),c=a[s],l=K(c)?c:null,u=a.fill===`auto`||a.stroke===`auto`;if(!a[s]||l||u){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());a[s]||(a[s]=d,n.setVisual(`colorFromPalette`,!0)),a.fill=a.fill===`auto`||K(a.fill)?d:a.fill,a.stroke=a.stroke===`auto`||K(a.stroke)?d:a.stroke}if(n.setVisual(`style`,a),n.setVisual(`drawType`,s),!t.isSeriesFiltered(e)&&l)return n.setVisual(`colorFromPalette`,!1),{dataEach:function(t,n){var r=e.getDataParams(n),i=V({},a);i[s]=l(r),t.setItemVisual(n,`style`,i)}}}},nN=new my,rN={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=$M(e,r),a=n.getVisual(`drawType`);return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[r]){nN.option=n[r];var o=i(nN);V(e.ensureUniqueItemVisual(t,`style`),o),nN.option.decal&&(e.setItemVisual(t,`decal`,nN.option.decal),nN.option.decal.dirty=!0),a in o&&e.setItemVisual(t,`colorFromPalette`,!1)}}:null}}}},iN={performRawSeries:!0,overallReset:function(e){var t=X();e.eachSeries(function(e){if(!e.isColorBySeries()){var n=e.type+`-`+e.getColorBy();XM(e).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(e){if(!e.isColorBySeries()){var t=e.getRawData(),n={},r=e.getData(),i=XM(e).scope,a=eN(e,e.visualStyleAccessPath||`itemStyle`);r.each(function(e){var t=r.getRawIndex(e);n[t]=e}),t.each(function(o){var s=n[o];if(r.getItemVisual(s,`colorFromPalette`)){var c=r.ensureUniqueItemVisual(s,`style`),l=t.getName(o)||o+``,u=t.count();c[a]=e.getColorFromPalette(l,i,u)}})}})}},aN=Math.PI;function oN(e,t){t||={},Ka(t,{text:`loading`,textColor:Q.color.primary,fontSize:12,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`,maskColor:`rgba(255,255,255,0.8)`,showSpinner:!0,color:Q.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var n=new Lg,r=new If({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(r);var i=new Vf({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),a=new If({style:{fill:`none`},textContent:i,textConfig:{position:`right`,distance:10},zlevel:t.zlevel,z:10001});n.add(a);var o;return t.showSpinner&&(o=new x_({shape:{startAngle:-aN/2,endAngle:-aN/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:`round`,lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:aN*3/2}).start(`circularInOut`),o.animateShape(!0).when(1e3,{startAngle:aN*3/2}).delay(300).start(`circularInOut`),n.add(o)),n.resize=function(){var n=i.getBoundingRect().width,s=t.showSpinner?t.spinnerRadius:0,c=(e.getWidth()-s*2-(t.showSpinner&&n?10:0)-n)/2-(t.showSpinner&&n?0:5+n/2)+(t.showSpinner?0:n/2)+(n?0:s),l=e.getHeight()/2;t.showSpinner&&o.setShape({cx:c,cy:l}),a.setShape({x:c-s,y:l-s,width:s*2,height:s*2}),r.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},n.resize(),n}var sN=function(){function e(e,t,n,r){this._stageTaskMap=X(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),r=this._visualHandlers=r.slice(),this._allHandlers=n.concat(r)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(e){var t=e.overallTask;t&&t.dirty()})},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),r=n.context,i=!t&&n.progressiveEnabled&&(!r||r.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,a=r&&r.modDataCount;return{step:i,modBy:a==null?null:Math.ceil(a/i),modDataCount:a}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid);e.pipelineContext=n.context=e.__preparePipelineContext?e.__preparePipelineContext(t,n):Wm(e,t,n)},e.prototype.restorePipelines=function(e,t){var n=this,r=n._pipelineMap=X();t.eachSeries(function(t){var i=e.painter.type===`canvas`&&t.getProgressive(),a=t.uid;r.set(a,{id:a,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),n._pipe(t,t.dataTask)})},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;H(this._allHandlers,function(r){var i=e.get(r.uid)||e.set(r.uid,{});ho(!(r.reset&&r.overallReset),``),r.reset&&this._createSeriesStageTask(r,i,t,n),r.overallReset&&this._createOverallStageTask(r,i,t,n)},this)},e.prototype.prepareView=function(e,t,n,r){var i=e.renderTask,a=i.context;a.model=t,a.ecModel=n,a.api=r,i.__block=!e.incrementalPrepareRender,this._pipe(t,i)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,r){r||={};var i=!1,a=this;H(e,function(e,s){if(!(r.visualType&&r.visualType!==e.visualType)){var c=a._stageTaskMap.get(e.uid),l=c.seriesTaskMap,u=c.overallTask;if(u){var d,f=u.agentStubMap;f.each(function(e){o(r,e)&&(e.dirty(),d=!0)}),d&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,r.block);f.each(function(e){e.perform(p)}),u.perform(p)&&(i=!0)}else l&&l.each(function(s,c){o(r,s)&&s.dirty();var l=a.getPerformArgs(s,r.block);l.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(i=!0)})}});function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(e){t=e.dataTask.perform()||t}),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},e.prototype.updatePayload=function(e,t){t!==`remain`&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,r){var i=this,a=t.seriesTaskMap,o=t.seriesTaskMap=X(),s=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(l):s?n.eachRawSeriesByType(s,l):c&&c(n,r).each(l);function l(t){var s=t.uid,c=o.set(s,a&&a.get(s)||_C({plan:fN,reset:pN,count:gN}));c.context={model:t,ecModel:n,api:r,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(t,c)}},e.prototype._createOverallStageTask=function(e,t,n,r){var i=this,a=t.overallTask=t.overallTask||_C({reset:cN});a.context={ecModel:n,api:r,overallReset:e.overallReset,scheduler:i};var o=a.agentStubMap,s=a.agentStubMap=X(),c=e.seriesType,l=e.getTargetSeries,u=e.dirtyOnOverallProgress,d=!1;ho(!e.createOnAllSeries,``),c?n.eachRawSeriesByType(c,f):l?l(n,r).each(f):H(n.getSeries(),f);function f(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,_C({reset:lN,onDirty:dN})));n.context={model:e,dirtyOnOverallProgress:u},n.agent=a,n.__block=u,i._pipe(e,n)}d&&a.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,r=this._pipelineMap.get(n);!r.head&&(r.head=t),r.tail&&r.tail.pipe(t),r.tail=t,t.__idxInPipeline=r.count++,t.__pipeline=r},e.wrapStageHandler=function(e,t){return K(e)&&(e={overallReset:e,seriesType:_N(e)}),e.uid=gx(`stageHandler`),t&&(e.visualType=t),e},e}();function cN(e){e.overallReset(e.ecModel,e.api,e.payload)}function lN(e){return e.dirtyOnOverallProgress&&uN}function uN(){this.agent.dirty(),this.getDownstream().dirty()}function dN(){this.agent&&this.agent.dirty()}function fN(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function pN(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Zp(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?U(t,function(e,t){return hN(t)}):mN}var mN=hN(0);function hN(e){return function(t,n){var r=n.data,i=n.resetDefines[e];if(i&&i.dataEach)for(var a=t.start;a0&&u===i.length-l.length){var d=i.slice(0,u);d!==`data`&&(t.mainType=d,t[l.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(i)&&(n[i]=e,s=!0),s||(r[i]=e)})}return{cptQuery:t,dataQuery:n,otherQuery:r}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var r=n.targetEl,i=n.packedEvent,a=n.model,o=n.view;if(!a||!o)return!0;var s=t.cptQuery,c=t.dataQuery;return l(s,a,`mainType`)&&l(s,a,`subType`)&&l(s,a,`index`,`componentIndex`)&&l(s,a,`name`)&&l(s,a,`id`)&&l(c,i,`name`)&&l(c,i,`dataIndex`)&&l(c,i,`dataType`)&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,r,i));function l(e,t,n,r){return e[n]==null||t[r||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),DN=[`symbol`,`symbolSize`,`symbolRotate`,`symbolOffset`],ON=DN.concat([`symbolKeepAspect`]),kN={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual(`legendIcon`,e.legendIcon),!e.hasSymbolVisual)return;for(var r={},i={},a=!1,o=0;o=0&&WN(c)?c:.5,e.createRadialGradient(o,s,0,o,s,c)}function qN(e,t,n){for(var r=t.type===`radial`?KN(e,t,n):GN(e,t,n),i=t.colorStops,a=0;a0)?null:e===`dashed`?[4*t,2*t]:e===`dotted`?[t]:io(e)?[e]:G(e)?e:null}function QN(e){var t=e.style,n=t.lineDash&&t.lineWidth>0&&ZN(t.lineDash,t.lineWidth),r=t.lineDashOffset;if(n){var i=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;i&&i!==1&&(n=U(n,function(e){return e/i}),r/=i)}return[n,r]}var $N=new Xd(!0);function eP(e){var t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))}function tP(e){return typeof e==`string`&&e!==`none`}function nP(e){var t=e.fill;return t!=null&&t!==`none`}function rP(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=n}else e.fill()}function iP(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=n}else e.stroke()}function aP(e,t,n){var r=es(t.image,t.__image,n);if(ns(r)){var i=e.createPattern(r,t.repeat||`repeat`);if(typeof DOMMatrix==`function`&&i&&i.setTransform){var a=new DOMMatrix;a.translateSelf(t.x||0,t.y||0),a.rotateSelf(0,0,(t.rotation||0)*Oo),a.scaleSelf(t.scaleX||1,t.scaleY||1),i.setTransform(a)}return i}}function oP(e,t,n,r,i){var a,o=eP(n),s=nP(n),c=n.strokePercent,l=c<1,u=!t.path;(!t.silent||l)&&u&&t.createPathProxy();var d=t.path||$N,f=t.__dirty;if(!r){var p=n.fill,m=n.stroke,h=s&&!!p.colorStops,g=o&&!!m.colorStops,_=s&&!!p.image,v=o&&!!m.image,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0;(h||g)&&(C=t.getBoundingRect()),h&&(y=f?qN(e,p,C):t.__canvasFillGradient,t.__canvasFillGradient=y),g&&(b=f?qN(e,m,C):t.__canvasStrokeGradient,t.__canvasStrokeGradient=b),_&&(x=f||!t.__canvasFillPattern?aP(e,p,t):t.__canvasFillPattern,t.__canvasFillPattern=x),v&&(S=f||!t.__canvasStrokePattern?aP(e,m,t):t.__canvasStrokePattern,t.__canvasStrokePattern=S),h?e.fillStyle=y:_&&(x?e.fillStyle=x:s=!1),g?e.strokeStyle=b:v&&(S?e.strokeStyle=S:o=!1)}var w=t.getGlobalScale();d.setScale(w[0],w[1],t.segmentIgnoreThreshold);var T,E;e.setLineDash&&n.lineDash&&(a=QN(t),T=a[0],E=a[1]);var D=!0;(u||f&4)&&(d.setDPR(e.dpr),l?d.setContext(null):(d.setContext(e),D=!1),d.reset(),t.buildPath(d,t.shape,r),d.toStatic(),t.pathUpdated()),D&&d.rebuildPath(e,l?c:1),T&&(e.setLineDash(T),e.lineDashOffset=E),r?(i.batchFill=s,i.batchStroke=o):n.strokeFirst?(o&&iP(e,n),s&&rP(e,n)):(s&&rP(e,n),o&&iP(e,n)),T&&e.setLineDash([])}function sP(e,t,n){var r=t.__image=es(n.image,t.__image,t,t.onload);if(r&&ns(r)){var i=n.x||0,a=n.y||0,o=t.getWidth(),s=t.getHeight(),c=r.width/r.height;if(o==null&&s!=null?o=s*c:s==null&&o!=null?s=o/c:o==null&&s==null&&(o=r.width,s=r.height),n.sWidth&&n.sHeight){var l=n.sx||0,u=n.sy||0;e.drawImage(r,l,u,n.sWidth,n.sHeight,i,a,o,s)}else if(n.sx&&n.sy){var l=n.sx,u=n.sy,d=o-l,f=s-u;e.drawImage(r,l,u,d,f,i,a,o,s)}else e.drawImage(r,i,a,o,s)}}function cP(e,t,n){var r,i=n.text;if(i!=null&&(i+=``),i){e.font=n.font||`12px sans-serif`,e.textAlign=n.textAlign,e.textBaseline=n.textBaseline;var a=void 0,o=void 0;e.setLineDash&&n.lineDash&&(r=QN(t),a=r[0],o=r[1]),a&&(e.setLineDash(a),e.lineDashOffset=o),n.strokeFirst?(eP(n)&&e.strokeText(i,n.x,n.y),nP(n)&&e.fillText(i,n.x,n.y)):(nP(n)&&e.fillText(i,n.x,n.y),eP(n)&&e.strokeText(i,n.x,n.y)),a&&e.setLineDash([])}}var lP=[`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`],uP=[[`lineCap`,`butt`],[`lineJoin`,`miter`],[`miterLimit`,10]];function dP(e,t,n,r,i){var a=!1;if(!r&&(n||={},t===n))return!1;if(r||t.opacity!==n.opacity){SP(e,i),a=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?ld.opacity:o}(r||t.blend!==n.blend)&&(a||=(SP(e,i),!0),e.globalCompositeOperation=t.blend||ld.blend);for(var s=0;s0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[nF]){if(this._disposed){this.id;return}var r,i,a;if(J(t)&&(n=t.lazyUpdate,r=t.silent,i=t.replaceMerge,a=t.transition,t=t.notMerge),this[nF]=!0,PF(this),!this._model||t){var o=new _M(this._api),s=this._theme,c=this._model=new uM;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:i},HF);var l={seriesTransition:a,optionChanged:!0};if(n)this[iF]={silent:r,updateParams:l},this[nF]=!1,this.getZr().wakeUp();else{try{gF(this),yF.update.call(this,null,l)}catch(e){throw this[iF]=null,this[nF]=!1,e}this._ssr||this._zr.flush(),this[iF]=null,this[nF]=!1,CF.call(this,r),wF.call(this,r)}}},t.prototype.setTheme=function(e,t){if(!this[nF]){if(this._disposed){this.id;return}var n=this._model;if(n){var r=t&&t.silent,i=null;this[iF]&&(r??=this[iF].silent,i=this[iF].updateParams,this[iF]=null),this[nF]=!0,PF(this);try{this._updateTheme(e),n.setTheme(this._theme),gF(this),yF.update.call(this,{type:`setTheme`},i)}catch(e){throw this[nF]=!1,e}this[nF]=!1,CF.call(this,r),wF.call(this,r)}}},t.prototype._updateTheme=function(e){q(e)&&(e=WF[e]),e&&(e=B(e),e&&GM(e,!0),this._theme=e)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||Ao.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){return e||={},this._zr.painter.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get(`backgroundColor`),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){return e||={},this._zr.painter.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){var e=this._zr;return H(e.storage.getDisplayList(),function(e){e.stopAnimation(null,!0)}),e.painter.toDataURL()},t.prototype.getDataURL=function(e){if(this._disposed){this.id;return}e||={};var t=e.excludeComponents,n=this._model,r=[],i=this;H(t,function(e){n.eachComponent({mainType:e},function(e){var t=i._componentsMap[e.__viewId];t.group.ignore||(r.push(t),t.group.ignore=!0)})});var a=this._zr.painter.getType()===`svg`?this.getSvgDataURL():this.renderToCanvas(e).toDataURL(`image/`+(e&&e.type||`png`));return H(r,function(e){e.group.ignore=!1}),a},t.prototype.getConnectedDataURL=function(e){if(this._disposed){this.id;return}var t=e.type===`svg`,n=this.group,r=Math.min,i=Math.max,a=1/0;if(qF[n]){var o=a,s=a,c=-a,l=-a,u=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();H(KF,function(a,d){if(a.group===n){var f=t?a.getZr().painter.getSvgDom().innerHTML:a.renderToCanvas(B(e)),p=a.getDom().getBoundingClientRect();o=r(p.left,o),s=r(p.top,s),c=i(p.right,c),l=i(p.bottom,l),u.push({dom:f,left:p.left,top:p.top})}}),o*=d,s*=d,c*=d,l*=d;var f=c-o,p=l-s,m=Oa.createCanvas(),h=qj(m,{renderer:t?`svg`:`canvas`});if(h.resize({width:f,height:p}),t){var g=``;return H(u,function(e){var t=e.left-o,n=e.top-s;g+=``+e.dom+``}),h.painter.getSvgRoot().innerHTML=g,e.connectedBackgroundColor&&h.painter.setBackgroundColor(e.connectedBackgroundColor),h.refreshImmediately(),h.painter.toDataURL()}return e.connectedBackgroundColor&&h.add(new If({shape:{x:0,y:0,width:f,height:p},style:{fill:e.connectedBackgroundColor}})),H(u,function(e){var t=new Of({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});h.add(t)}),h.refreshImmediately(),m.toDataURL(`image/`+(e&&e.type||`png`))}return this.getDataURL(e)},t.prototype.convertToPixel=function(e,t,n){return bF(this,`convertToPixel`,e,t,n)},t.prototype.convertToLayout=function(e,t,n){return bF(this,`convertToLayout`,e,t,n)},t.prototype.convertFromPixel=function(e,t,n){return bF(this,`convertFromPixel`,e,t,n)},t.prototype.containPixel=function(e,t){if(this._disposed){this.id;return}var n=this._model,r;return H(bm(n,e),function(e,n){n.indexOf(`Models`)>=0&&H(e,function(e){var i=e.coordinateSystem;if(i&&i.containPoint)r||=!!i.containPoint(t);else if(n===`seriesModels`){var a=this._chartsMap[e.__viewId];a&&a.containPoint&&(r||=a.containPoint(t,e))}},this)},this),!!r},t.prototype.getVisual=function(e,t){var n=this._model,r=bm(n,e,{defaultMainType:`series`}),i=r.seriesModel.getData(),a=r.hasOwnProperty(`dataIndexInside`)?r.dataIndexInside:r.hasOwnProperty(`dataIndex`)?i.indexOfRawIndex(r.dataIndex):null;return a==null?MN(i,t):jN(i,a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e=this;H(LF,function(t){var n=function(n){var r=e.getModel(),i=n.target,a;if(t===`globalout`?a={}:i&&PN(i,function(e){var t=qm(e);if(t&&t.dataIndex!=null){var n=t.dataModel||r.getSeriesByIndex(t.seriesIndex);return a=n&&n.getDataParams(t.dataIndex,t.dataType,i)||{},!0}if(t.eventData)return a=V({},t.eventData),!0},!0),a){var o=a.componentType,s=a.componentIndex;(o===`markLine`||o===`markPoint`||o===`markArea`)&&(o=`series`,s=a.seriesIndex);var c=o&&s!=null&&r.getComponent(o,s),l=c&&e[c.mainType===`series`?`_chartsMap`:`_componentsMap`][c.__viewId];a.event=n,a.type=t,e._$eventProcessor.eventInfo={targetEl:i,packedEvent:a,model:c,view:l},e.trigger(t,a)}};n.zrEventfulCallAtLast=!0,e._zr.on(t,n,e)});var t=this._messageCenter;H(BF,function(n,r){t.on(r,function(t){e.trigger(r,t)})}),kA(t,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0,this.getDom()&&Tm(this.getDom(),YF,``);var e=this,t=e._api,n=e._model;H(e._componentsViews,function(e){e.dispose(n,t)}),H(e._chartsViews,function(e){e.dispose(n,t)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete KF[e.id]},t.prototype.resize=function(e){if(!this[nF]){if(this._disposed){this.id;return}this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption(`media`),r=e&&e.silent;this[iF]&&(r??=this[iF].silent,n=!0,this[iF]=null),this[nF]=!0,PF(this);try{n&&gF(this),yF.update.call(this,{type:`resize`,animation:V({duration:0},e&&e.animation)})}catch(e){throw this[nF]=!1,e}this[nF]=!1,CF.call(this,r),wF.call(this,r)}}},t.prototype.showLoading=function(e,t){if(this._disposed){this.id;return}if(J(e)&&(t=e,e=``),e||=`default`,this.hideLoading(),GF[e]){var n=GF[e](this._api,t),r=this._zr;this._loadingFX=n,r.add(n)}},t.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},t.prototype.makeActionFromEvent=function(e){var t=V({},e);return t.type=zF[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed){this.id;return}if(J(t)||(t={silent:!!t}),RF[e.type]&&this._model){if(this[nF]){this._pendingActions.push(e);return}var n=t.silent;SF.call(this,e,n);var r=t.flush;r?this._zr.flush():r!==!1&&Ao.browser.weChat&&this._throttledZrFlush(),CF.call(this,n),wF.call(this,n)}},t.prototype.updateLabelLayout=function(){FN.trigger(`series:layoutlabels`,this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed){this.id;return}var t=e.seriesIndex;this.getModel().getSeriesByIndex(t).appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){gF=function(e){yD(e._model);var t=e._scheduler;t.restorePipelines(e._zr,e._model),t.prepareStageTasks(),_F(e,!0),_F(e,!1),t.plan()},_F=function(e,t){for(var n=e._model,r=e._scheduler,i=t?e._componentsViews:e._chartsViews,a=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,c=0;cY(t.get(`hoverLayerThreshold`),nM.hoverLayerThreshold)&&!Ao.node&&!Ao.worker;(e._usingTHL||a)&&(t.eachSeries(function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered(function(e){var t=e.states.emphasis;t&&t.hoverLayer!==2&&(t.hoverLayer=+!!a)})}}),e._usingTHL=a)}}function a(e,t){var n=e.get(`blendMode`)||null;t.eachRendered(function(e){e.isGroup||(e.style.blend=n)})}function o(e,t){if(!e.preventAutoZ){var n=Nv(e);t.eachRendered(function(e){return Fv(e,n.z,n.zlevel),!0})}}function s(e,t){t.eachRendered(function(e){if(!H_(e)){var t=e.getTextContent(),n=e.getTextGuideLine();e.stateTransition&&=null,t&&t.stateTransition&&(t.stateTransition=null),n&&n.stateTransition&&(n.stateTransition=null),e.hasState()?(e.prevStates=e.currentStates,e.clearStates()):e.prevStates&&=null}})}function c(e,t){var n=e.getModel(`stateAnimation`),i=e.isAnimationEnabled(),a=n.get(`duration`),o=a>0?{duration:a,delay:n.get(`delay`),easing:n.get(`easing`)}:null;t.eachRendered(function(e){if(e.states&&e.states.emphasis){if(H_(e))return;if(e instanceof Sf&&mg(e),e.__dirty){var t=e.prevStates;t&&e.useStates(t)}if(i){e.stateTransition=o;var n=e.getTextContent(),a=e.getTextGuideLine();n&&(n.stateTransition=o),a&&(a.stateTransition=o)}e.__dirty&&r(e)}})}AF=function(e){return new(function(t){z(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}return n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(n!=null)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){zh(t,n),MF(e)},n.prototype.leaveEmphasis=function(t,n){Bh(t,n),MF(e)},n.prototype.enterBlur=function(t){Vh(t),MF(e)},n.prototype.leaveBlur=function(t){Hh(t),MF(e)},n.prototype.enterSelect=function(t){Uh(t),MF(e)},n.prototype.leaveSelect=function(t){Wh(t),MF(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n.prototype.getECUpdateCycleVersion=function(){return e[rF]},n.prototype.usingTHL=function(){return e._usingTHL},n}(oh))(e)},jF=function(e){function t(e,t){for(var n=0;n=0)){cI.push(n);var o=sN.wrapStageHandler(n,i);o.__prio=t,o.__raw=n,e.push(o)}}function uI(e,t){GF[e]=t}function dI(e,t,n){var r=RN(`registerMap`);r&&r(e,t,n)}var fI=DC;sI(qP,tN),sI(XP,rN),sI(XP,iN),sI(qP,kN),sI(XP,AN),sI(eF,IP),$F(GM),eI(BP,KM),uI(`default`,oN),iI({type:mh,event:mh,update:mh},Do),iI({type:hh,event:hh,update:hh},Do),iI({type:gh,event:yh,update:gh,action:Do,refineEvent:pI,publishNonRefinedEvent:!0}),iI({type:_h,event:yh,update:_h,action:Do,refineEvent:pI,publishNonRefinedEvent:!0}),iI({type:vh,event:yh,update:vh,action:Do,refineEvent:pI,publishNonRefinedEvent:!0});function pI(e,t,n,r){return{eventContent:{selected:tg(n),isFromClick:t.isFromClick||!1}}}QF(`default`,{}),QF(`dark`,TN);var mI=[],hI={registerPreprocessor:$F,registerProcessor:eI,registerPostInit:tI,registerPostUpdate:nI,registerUpdateLifecycle:rI,registerAction:iI,registerCoordinateSystem:aI,registerLayout:oI,registerVisual:sI,registerTransform:fI,registerLoading:uI,registerMap:dI,registerImpl:LN,PRIORITY:tF,ComponentModel:aC,ComponentView:YM,SeriesModel:cw,ChartView:nT,registerComponentModel:function(e){aC.registerClass(e)},registerComponentView:function(e){YM.registerClass(e)},registerSeriesModel:function(e){cw.registerClass(e)},registerChartView:function(e){nT.registerClass(e)},registerCustomSeries:function(e,t){BN(e,t)},registerSubTypeDefaulter:function(e,t){aC.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){Jj(e,t)}};function gI(e){if(G(e)){H(e,function(e){gI(e)});return}qa(mI,e)>=0||(mI.push(e),K(e)&&(e={install:e}),e.install(hI))}var _I=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),vI=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents(`grid`,Sm).models[0]},t.type=`cartesian2dAxis`,t}(aC);Ya(vI,_I);var yI={show:!0,z:0,inverse:!1,name:``,nameLocation:`end`,nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:`...`,placeholder:`.`},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:`auto`,onZeroAxisIndex:null,lineStyle:{color:Q.color.axisLine,width:1,type:`solid`},symbol:[`none`,`none`],symbolSize:[10,15],breakLine:!0},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12,color:Q.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:Q.color.axisSplitLine,width:1,type:`solid`}},splitArea:{show:!1,areaStyle:{color:[Q.color.backgroundTint,Q.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:Q.color.neutral00,borderColor:Q.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:`auto`}},bI=Wa({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:`auto`,show:`auto`},axisLabel:{interval:`auto`}},yI),xI=Wa({boundaryGap:[0,0],axisLine:{show:`auto`},axisTick:{show:`auto`},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:Q.color.axisMinorSplitLine,width:1}}},yI),SI={category:bI,value:xI,time:Wa({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:`bold`}}},splitLine:{show:!1}},xI),log:Ka({logBase:10},xI)};function CI(e,t,n,r){H(lE,function(i,a){var o=Wa(Wa({},SI[a],!0),r,!0),s=function(e){z(n,e);function n(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t+`Axis.`+a,n}return n.prototype.mergeDefaultAndTheme=function(e,t){var n=eC(this),r=n?nC(e):{};Wa(e,t.getTheme().get(a+`Axis`)),Wa(e,this.getDefaultOption()),e.type=wI(e),n&&tC(e,r,n)},n.prototype.optionUpdated=function(){this.option.type===`category`&&(this.__ordinalMeta=mT.createByAxisModel(this))},n.prototype.getCategories=function(e){var t=this.option;if(t.type===`category`)return e?t.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.prototype.updateAxisBreaks=function(e){var t=mO();return t?t.updateModelAxisBreak(this,e):{breaks:[]}},n.type=t+`Axis.`+a,n.defaultOption=o,n}(n);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+`Axis`,wI)}function wI(e){return e.type||(e.data?`category`:`value`)}var TI=function(){function e(e){this.type=`cartesian`,this._dimList=[],this._axes={},this.name=e||``}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return U(this._dimList,function(e){return this._axes[e]},this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Qa(this.getAxes(),function(t){return t.scale.type===e})},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),EI=[`x`,`y`];function DI(e){return(e.type===`interval`||e.type===`time`)&&!Zx(e)}var OI=function(e){z(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=Ok,t.dimensions=EI,t}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis(`x`).scale,t=this.getAxis(`y`).scale;if(DI(e)&&DI(t)){var n=xT(e,null),r=xT(t,null),i=this.dataToPoint([n[0],r[0]]),a=this.dataToPoint([n[1],r[1]]),o=n[1]-n[0],s=r[1]-r[0];if(o&&s){var c=(a[0]-i[0])/o,l=(a[1]-i[1])/s,u=i[0]-n[0]*c,d=i[1]-r[0]*l,f=this._transform=[c,0,0,l,u,d];this._invTransform=us([],f)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale(`ordinal`)[0]||this.getAxesByScale(`time`)[0]||this.getAxis(`x`)},t.prototype.containPoint=function(e){var t=this.getAxis(`x`),n=this.getAxis(`y`);return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis(`x`).containData(e[0])&&this.getAxis(`y`).containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),r=this.dataToPoint(t),i=this.getArea(),a=new Z(n[0],n[1],r[0]-n[0],r[1]-n[1]);return i.intersect(a)},t.prototype.dataToPoint=function(e,t,n){n||=[];var r=e[0],i=e[1];if(this._transform&&r!=null&&isFinite(r)&&i!=null&&isFinite(i))return Es(n,e,this._transform);var a=this.getAxis(`x`),o=this.getAxis(`y`);return n[0]=a.toGlobalCoord(a.dataToCoord(r,t)),n[1]=o.toGlobalCoord(o.dataToCoord(i,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis(`x`).scale,r=this.getAxis(`y`).scale,i=n.getExtent(),a=r.getExtent(),o=n.parse(e[0]),s=r.parse(e[1]);return t||=[],t[0]=Math.min(Math.max(Math.min(i[0],i[1]),o),Math.max(i[0],i[1])),t[1]=Math.min(Math.max(Math.min(a[0],a[1]),s),Math.max(a[0],a[1])),t},t.prototype.pointToData=function(e,t,n){if(n||=[],this._invTransform)return Es(n,e,this._invTransform);var r=this.getAxis(`x`),i=this.getAxis(`y`);return n[0]=r.coordToData(r.toLocalCoord(e[0]),t),n[1]=i.coordToData(i.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis(e.dim===`x`?`y`:`x`)},t.prototype.getArea=function(e){e||=0;var t=this.getAxis(`x`).getGlobalExtent(),n=this.getAxis(`y`).getGlobalExtent(),r=Math.min(t[0],t[1])-e,i=Math.min(n[0],n[1])-e;return new Z(r,i,Math.max(t[0],t[1])-r+e,Math.max(n[0],n[1])-i+e)},t}(TI);function kI(e,t){var n=e.scale,r=e.model,i=hk(n,r,r.ecModel,e,null),a=AT(n),o=AT(t)?t.intervalStub:t,s=a?n.intervalStub:n,c=n.base,l=o.getTicks(),u=o.getTicks({expandToNicedExtent:!0}),d=l.length-1,f,p,m;if(d===1)f=p=0,m=1;else if(d===2){var h=op(l[0].value-l[1].value),g=op(l[1].value-l[2].value);f=p=0,h===g?m=2:(m=1,h=C[1])return!0})):b[1]?(T=C[1],A(function(){if(P(),k=xp(O-E*m,D),j(),w<=C[0])return!0})):A(function(){k=xp(lp(C[0]/E)*E,D),O=xp(cp(C[1]/E)*E,D);var e=sp((O-k)/E);if(e<=m){var t=m-e,n=void 0,r=i.incl0||a;if(r&&C[0]===0)n=[0,t];else if(r&&C[1]===0)n=[t,0];else{var o=cp(t/2);n=t%2==0?[o,o]:w+T=C[1])return!0}})}TE(n,b,S,[w,T],x,{interval:E,intervalCount:m,intervalPrecision:D,niceExtent:[k,O]})}function AI(e,t){var n=AT(e),r=n?e.intervalStub:e,i=t.fixMinMax||[],a=n?e.getExtent():null,o=r.getExtent(),s=IT(o,i,t.rawExtentResult);r.setExtent(s[0],s[1]),s=r.getExtent();var c=n?MI(r,t):jI(r,t),l=c.intervalPrecision,u=c.interval,d=t.userInterval;d!=null&&(c.interval=d,c.intervalPrecision=NT(d)),i[0]||(s[0]=xp(cp(s[0]/u)*u,l)),i[1]||(s[1]=xp(lp(s[1]/u)*u,l)),d!=null&&(c.niceExtent=s.slice()),TE(e,i,o,s,a,c)}function jI(e,t){var n=RT(t.splitNumber,5),r=CT(e),i=t.minInterval,a=t.maxInterval,o=Pp(r/n,!0);i!=null&&oa&&(o=a);var s=NT(o),c=e.getExtent(),l=[xp(lp(c[0]/o)*o,s),xp(cp(c[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:l}}function MI(e,t){var n=RT(t.splitNumber,10),r=e.getExtent(),i=CT(e),a=ap(Mp(i),1);n/i*a<=.5&&(a*=10);var o=NT(a),s=[xp(lp(r[0]/a)*a,o),xp(cp(r[1]/a)*a,o)];return{intervalPrecision:o,interval:a,niceExtent:s}}function NI(e){var t=e.scale,n=e.model,r=n.axis,i=n.ecModel;PI(t,n,r,i,null)}function PI(e,t,n,r,i){var a=hk(e,t,r,n,i),o=OT(e)||kT(e);FI(e,{splitNumber:t.get(`splitNumber`),fixMinMax:a.fixMM,userInterval:t.get(`interval`),minInterval:o?t.get(`minInterval`):null,maxInterval:o?t.get(`maxInterval`):null,rawExtentResult:a}),n&&r&&_k(n,e,a,r)}function FI(e,t){II[e.type](e,t)}var II={interval:AI,log:AI,time:tE,ordinal:Do},LI=[[3,1],[0,2]],RI=function(){function e(e,t,n){this.type=`grid`,this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=EI,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;H(this._axesList,function(e){lk(e,1);var t=e.scale;jT(t)&&t.setSortInfo(e.model.get(`categorySortInfo`))});function r(e){for(var t=eo(e),n=[],r=t.length-1;r>=0;r--){var i=e[+t[r]];i.__alignTo?n.push(i):NI(i)}H(n,function(e){UI(e,e.__alignTo)?NI(e):kI(e,e.__alignTo.scale)})}r(n.x),r(n.y);var i={};H(n.x,function(e){BI(n,`y`,e,i)}),H(n.y,function(e){BI(n,`x`,e,i)}),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var r=QS(e,t),i=this._rect=YS(e.getBoxLayoutParams(),r.refContainer),a=this._axesMap,o=this._coordsList,s=e.get(`containLabel`);if(GI(a,i),!n){var c=YI(i,o,a,s,t),l=void 0;if(s)qI?(qI(this._axesList,i),GI(a,i)):l=JI(i.clone(),`axisLabel`,null,i,a,c,r);else{var u=ZI(e,i,r),d=u.outerBoundsRect,f=u.parsedOuterBoundsContain,p=u.outerBoundsClamp;d&&(l=JI(d,f,p,i,a,c,r))}XI(i,a,QE.determine,null,l,r),H(this._coordsList,function(e){e.calcAffineTransform()})}},e.prototype.getAxis=function(e,t){var n=this._axesMap[e];if(n!=null)return n[t||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var n=`x`+e+`y`+t;return this._coordsMap[n]}J(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var r=0,i=this._coordsList;r=0;i--){var a=e[+t[i]];DT(a.scale)&&CE(a.model,a.type,!0)==null&&(a.model.get(`alignTicks`)&&a.model.get(`interval`)==null?r.push(a):n=a)}n||=r.pop(),n&&H(r,function(e){e.__alignTo=n})}function UI(e,t){return Zx(e.scale)||Zx(t.scale)||t.scale.getTicks().length<2}function WI(e,t){var n=e.getExtent(),r=n[0]+n[1];e.toGlobalCoord=e.dim===`x`?function(e){return e+t}:function(e){return r-e+t},e.toLocalCoord=e.dim===`x`?function(e){return e-t}:function(e){return r-e+t}}function GI(e,t){H(e.x,function(e){return KI(e,t.x,t.width)}),H(e.y,function(e){return KI(e,t.y,t.height)})}function KI(e,t,n){var r=[0,n],i=+!!e.inverse;e.setExtent(r[i],r[1-i]),WI(e,t)}var qI;function JI(e,t,n,r,i,a,o){XI(r,i,QE.estimate,t,!1,o);var s=[0,0,0,0];l(0),l(1),u(r,0,NaN),u(r,1,NaN);var c=$a(s,function(e){return e>0})==null;return Cv(r,s,!0,!0,n),GI(i,r),c;function l(e){H(i[Y_[e]],function(t){if(SE(t.model)){var n=a.ensureRecord(t.model),r=n.labelInfoList;if(r)for(var i=0;i0&&!lo(t)&&t>1e-4&&(e/=t),e}}function YI(e,t,n,r,i){var a=new xO(QI);return H(n,function(n){return H(n,function(n){if(SE(n.model)){var o=!r;n.axisBuilder=QO(e,t,n.model,i,a,o)}})}),a}function XI(e,t,n,r,i,a){var o=n===QE.determine;H(t,function(t){return H(t,function(t){SE(t.model)&&($O(t.axisBuilder,e,t.model),t.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:i}))})});var s={x:0,y:0};c(0),c(1);function c(t){s[Y_[1-t]]=e[X_[t]]<=a.refContainer[X_[t]]*.5?0:1-t==1?2:1}H(t,function(e,t){return H(e,function(e){SE(e.model)&&((r===`all`||o)&&e.axisBuilder.build({axisName:!0},{nameMarginLevel:s[t]}),o&&e.axisBuilder.build({axisLine:!0}))})})}function ZI(e,t,n){var r,i=e.get(`outerBoundsMode`,!0);i===`same`?r=t.clone():(i==null||i===`auto`)&&(r=YS(e.get(`outerBounds`,!0)||Ek,n.refContainer));var a=e.get(`outerBoundsContain`,!0),o=a==null||a===`auto`||qa([`all`,`axisLabel`],a)<0?`all`:a,s=[vp(Y(e.get(`outerBoundsClampWidth`,!0),Dk[0]),t.width),vp(Y(e.get(`outerBoundsClampHeight`,!0),Dk[1]),t.height)];return{outerBoundsRect:r,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var QI=function(e,t,n,r,i,a){var o=n.axis.dim===`x`?`y`:`x`;TO(e,t,n,r,i,a),xE(e.nameLocation)||H(t.recordMap[o],function(e){e&&e.labelInfoList&&e.dirVec&&DO(e.labelInfoList,e.dirVec,r,i)})};function $I(e,t){var n={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return eL(n,e,t),n.seriesInvolved&&nL(n,e),n}function eL(e,t,n){var r=t.getComponent(`tooltip`),i=t.getComponent(`axisPointer`),a=i.get(`link`,!0)||[],o=[];H(n.getCoordinateSystems(),function(n){if(!n.axisPointerEnabled)return;var s=lL(n.model),c=e.coordSysAxesInfo[s]={};e.coordSysMap[s]=n;var l=n.model.getModel(`tooltip`,r);if(H(n.getAxes(),no(p,!1,null)),n.getTooltipAxes&&r&&l.get(`show`)){var u=l.get(`trigger`)===`axis`,d=l.get([`axisPointer`,`type`])===`cross`,f=n.getTooltipAxes(l.get([`axisPointer`,`axis`]));(u||d)&&H(f.baseAxes,no(p,!d||`cross`,u)),d&&H(f.otherAxes,no(p,`cross`,!1))}function p(r,s,u){var d=u.model.getModel(`axisPointer`,i),f=d.get(`show`);if(f&&(f!==`auto`||r||cL(d))){s??=d.get(`triggerTooltip`),d=r?tL(u,l,i,t,r,s):d;var p=d.get(`snap`),m=d.get(`triggerEmphasis`),h=lL(u.model),g=s||p||u.type===`category`,_=e.axesInfo[h]={key:h,axis:u,coordSys:n,axisPointerModel:d,triggerTooltip:s,triggerEmphasis:m,involveSeries:g,snap:p,useHandle:cL(d),seriesModels:[],linkGroup:null};c[h]=_,e.seriesInvolved=e.seriesInvolved||g;var v=rL(a,u);if(v!=null){var y=o[v]||(o[v]={axesInfo:{}});y.axesInfo[h]=_,y.mapper=a[v].mapper,_.linkGroup=y}}}})}function tL(e,t,n,r,i,a){var o=t.getModel(`axisPointer`),s=[`type`,`snap`,`lineStyle`,`shadowStyle`,`label`,`animation`,`animationDurationUpdate`,`animationEasingUpdate`,`z`],c={};H(s,function(e){c[e]=B(o.get(e))}),c.snap=e.type!==`category`&&!!a,o.get(`type`)===`cross`&&(c.type=`line`);var l=c.label||={};if(l.show??=!1,i===`cross`&&(l.show=o.get([`label`,`show`])??!0,!a)){var u=c.lineStyle=o.get(`crossStyle`);u&&Ka(l,u.textStyle)}return e.model.getModel(`axisPointer`,new my(c,n,r))}function nL(e,t){t.eachSeries(function(t){var n=t.coordinateSystem,r=t.get([`tooltip`,`trigger`],!0),i=t.get([`tooltip`,`show`],!0);n&&n.model&&r!==`none`&&r!==!1&&r!==`item`&&i!==!1&&t.get([`axisPointer`,`show`],!0)!==!1&&H(e.coordSysAxesInfo[lL(n.model)],function(e){var r=e.axis;n.getAxis(r.dim)===r&&(e.seriesModels.push(t),e.seriesDataCount??=0,e.seriesDataCount+=t.getData().count())})})}function rL(e,t){for(var n=t.model,r=t.dim,i=0;i=0||e===t}function aL(e){var t=oL(e);if(t){var n=t.axisPointerModel,r=t.axis.scale,i=n.option,a=n.get(`status`),o=n.get(`value`);o!=null&&(o=r.parse(o));var s=cL(n);a??(i.status=s?`show`:`hide`);var c=r.getExtent();(o==null||o>c[1])&&(o=c[1]),o3?1.4:i>1?1.2:1.1,c=r>0?s:1/s;this._checkTriggerMoveZoom(this,`zoom`,`zoomOnMouseWheel`,e,{scale:c,originX:a,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(r),u=(r>0?1:-1)*(l>3?.4:l>1?.15:.05);this._checkTriggerMoveZoom(this,`scrollMove`,`moveOnMouseWheel`,e,{scrollDelta:u,originX:a,originY:o,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(e){if(!(wL(this._zr,`globalPan`)||OL(e))){var t=e.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,`zoom`,null,e,{scale:t,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(e,t,n,r,i){e._checkPointer(r,i.originX,i.originY)&&(UA(r.event),r.__ecRoamConsumed=!0,FL(e,t,n,r,i))},t}(Ru);function OL(e){return e.__ecRoamConsumed}var kL=vm();function AL(e){var t=kL(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function jL(e,t,n,r){for(var i=AL(e).roam,a=i[t]=i[t]||[],o=0;o1e-6;DR[0]=o?(i[0]-r.x)/a:i[0],DR[1]=o?(i[1]-r.y)/a:i[1],Es(DR,DR,e.mtRawInv);var s=CR(e,DR);OR(t,s,a),H(n,function(e){e!==t&&OR(e,s.slice(),a)})}var DR=[];function OR(e,t,n){var r=e.option;r.center=t,r.zoom=n}function kR(e,t){if(t){var n=t.min||0,r=t.max||1/0;e=Math.max(Math.min(r,e),n)}return e}function AR(e,t){var n=t.getShallow(`nodeScaleRatio`,!0)||1,r=LL(e);return((r.zoom-1)*n+1)/(r.trans[2].scaleX||1)}function jR(e,t,n,r,i,a,o,s){if(!vR(e)){n.disable();return}n.enable(Y(e.get(`roam`),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get(`roamTrigger`),isInSelf:r,isInClip:function(e,t,n){return!i||i.contain(t,n)}}});function c(n){var r=e.mainType,i=Lv(Ka({type:NR(r,e.subType,ih)},n));s&&(i.componentType=r),i[r+`Id`]=e.id,t.dispatchAction(i)}n.off(`pan`).off(`zoom`).on(`pan`,function(e){a&&a(`pan`),c({dx:e.dx,dy:e.dy})}).on(`zoom`,function(e){a&&a(`zoom`),c({zoom:e.scale,originX:e.originX,originY:e.originY})})}new Z(0,0,0,0);function MR(e,t,n){var r=NR(t,n,ih);e.registerAction({type:r,event:r,update:`none`},function(e,r,i){r.eachComponent(wm(e,t,n),function(t){_R(e,t),yR(e,t,r,i)})})}function NR(e,t,n){return(e===`series`?t===`map`?`geo`:t:e)+n}function PR(e){return e.zoom!=null}function FR(e,t,n,r,i,a,o){var s=new zL(null,TR(e.ecModel,t));return XL(s,n,r,i,a),o?ZL(s,o.x,o.y,o.width,o.height):ZL(s,n,r,i,a),YL(s,e),s}var IR=vm();function LR(e){var t=e.mainData,n=e.datas;n||(n={main:t},e.datasAttr={main:`data`}),e.datas=e.mainData=null,WR(t,n,e),H(n,function(n){H(t.TRANSFERABLE_METHODS,function(t){n.wrapMethod(t,no(RR,e))})}),t.wrapMethod(`cloneShallow`,no(BR,e)),H(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,no(zR,e))}),ho(n[t.dataType]===t)}function RR(e,t){if(UR(this)){var n=V({},IR(this).datas);n[this.dataType]=t,WR(t,n,e)}else GR(t,this.dataType,IR(this).mainData,e);return t}function zR(e,t){return e.struct&&e.struct.update(),t}function BR(e,t){return H(IR(t).datas,function(n,r){n!==t&&GR(n.cloneShallow(),r,t,e)}),t}function VR(e){var t=IR(this).mainData;return e==null||t==null?t:IR(t).datas[e]}function HR(){var e=IR(this).mainData;return e==null?[{data:e}]:U(eo(IR(e).datas),function(t){return{type:t,data:IR(e).datas[t]}})}function UR(e){return IR(e).mainData===e}function WR(e,t,n){IR(e).datas={},H(t,function(t,r){GR(t,r,e,n)})}function GR(e,t,n,r){IR(n).datas[t]=e,IR(e).mainData=n,e.dataType=t,r.struct&&(e[r.structAttr]=r.struct,r.struct[r.datasAttr[t]]=e),e.getLinkedData=VR,e.getLinkedDataAll=HR}var KR=H,qR=J,JR=-1,YR=function(){function e(t){var n=t.mappingMethod,r=t.type,i=this.option=B(t);this.type=r,this.mappingMethod=n,this._normalizeData=sz[n];var a=e.visualHandlers[r];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[n],n===`piecewise`?(QR(i),XR(i)):n===`category`?i.categories?ZR(i):QR(i,!0):(ho(n!==`linear`||i.dataExtent),QR(i))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return W(this._normalizeData,this)},e.listVisualTypes=function(){return eo(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){J(e)?H(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,r){var i,a=G(t)?[]:J(t)?{}:(i=!0,null);return e.eachVisual(t,function(e,t){var o=n.call(r,e,t);i?a=o:a[t]=o}),a},e.retrieveVisuals=function(t){var n={},r;return t&&KR(e.visualHandlers,function(e,i){t.hasOwnProperty(i)&&(n[i]=t[i],r=!0)}),r?n:null},e.prepareVisualTypes=function(e){if(G(e))e=e.slice();else if(qR(e)){var t=[];KR(e,function(e,n){t.push(n)}),e=t}else return[];return e.sort(function(e,t){return t===`color`&&e!==`color`&&e.indexOf(`color`)===0?1:-1}),e},e.dependsOn=function(e,t){return t===`color`?!!(e&&e.indexOf(t)===0):e===t},e.findPieceIndex=function(e,t,n){for(var r,i=1/0,a=0,o=t.length;a=0;a--)r[a]??(delete n[t[a]],t.pop())}function QR(e,t){var n=e.visual,r=[];J(n)?KR(n,function(e){r.push(e)}):n!=null&&r.push(n),!t&&r.length===1&&!{color:1,symbol:1}.hasOwnProperty(e.type)&&(r[1]=r[0]),oz(e,r)}function $R(e){return{applyVisual:function(t,n,r){var i=this.mapValueToVisual(t);r(`color`,e(n(`color`),i))},_normalizedToVisual:iz([0,1])}}function ez(e){var t=this.option.visual;return t[Math.round(hp(e,[0,1],[0,t.length-1],!0))]||{}}function tz(e){return function(t,n,r){r(e,this.mapValueToVisual(t))}}function nz(e){var t=this.option.visual;return t[this.option.loop&&e!==JR?e%t.length:e]}function rz(){return this.option.visual[0]}function iz(e){return{linear:function(t){return hp(t,e,this.option.visual,!0)},category:nz,piecewise:function(t,n){var r=az.call(this,n);return r??=hp(t,e,this.option.visual,!0),r},fixed:rz}}function az(e){var t=this.option,n=t.pieceList;if(t.hasSpecialVisual){var r=n[YR.findPieceIndex(e,n)];if(r&&r.visual)return r.visual[this.type]}}function oz(e,t){return e.visual=t,e.type===`color`&&(e.parsedVisual=U(t,function(e){return Il(e)||[0,0,0,1]})),t}var sz={linear:function(e){return hp(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,n=YR.findPieceIndex(e,t,!0);if(n!=null)return hp(n,[0,t.length-1],[0,1],!0)},category:function(e){return(this.option.categories?this.option.categoryMap[e]:e)??JR},fixed:Do};function cz(e,t,n){return e?t<=n:t=0&&e.call(t,n[i],i)},e.prototype.eachEdge=function(e,t){for(var n=this.edges,r=n.length,i=0;i=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&e.call(t,n[i],i)},e.prototype.breadthFirstTraverse=function(e,t,n,r){if(t instanceof dz||(t=this._nodesMap[lz(t)]),t){for(var i=n===`out`?`outEdges`:n===`in`?`inEdges`:`edges`,a=0;a=0&&n.node2.dataIndex>=0});for(var i=0,a=r.length;i=0&&!e.hasKey(p)&&(e.set(p,!0),a.push(f.node1))}for(s=0;s=0&&!e.hasKey(v)&&(e.set(v,!0),o.push(_.node2))}}}return{edge:e.keys(),node:t.keys()}},e}(),fz=function(){function e(e,t,n){this.dataIndex=-1,this.node1=e,this.node2=t,this.dataIndex=n??-1}return e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostGraph.edgeData.getItemModel(this.dataIndex).getModel(e)},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var e=X(),t=X();e.set(this.dataIndex,!0);for(var n=[this.node1],r=[this.node2],i=0;i=0&&!e.hasKey(u)&&(e.set(u,!0),n.push(l.node1))}for(i=0;i=0&&!e.hasKey(m)&&(e.set(m,!0),r.push(p.node2))}return{edge:e.keys(),node:t.keys()}},e}();function pz(e,t){return{getValue:function(n){var r=this[e][t];return r.getStore().get(r.getDimensionIndex(n||`value`),this.dataIndex)},setVisual:function(n,r){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,n,r)},getVisual:function(n){return this[e][t].getItemVisual(this.dataIndex,n)},setLayout:function(n,r){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,n,r)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}Ya(dz,pz(`hostGraph`,`data`)),Ya(fz,pz(`hostGraph`,`edgeData`));function mz(e,t,n,r,i){for(var a=new uz(r),o=0;o `+f)),l++)}var p=n.get(`coordinateSystem`),m;if(p===`cartesian2d`||p===`polar`||p===`matrix`)m=fx(e,n);else{var h=Xb.get(p),g=h&&h.dimensions||[];qa(g,`value`)<0&&g.concat([`value`]);var _=Gb(e,{coordDimensions:g,encodeDefine:n.getEncode()}).dimensions;m=new Wb(_,n),m.initData(e)}var v=new Wb([`value`],n);return v.initData(c,s),i&&i(m,v),LR({mainData:m,struct:a,structAttr:`graph`,datas:{node:m,edge:v},datasAttr:{node:`data`,edge:`edgeData`}}),a.update(),a}var hz=`-->`,gz=function(e){return e.get(`autoCurveness`)||null},_z=function(e,t){var n=gz(e),r=20,i=[];if(io(n))r=n;else if(G(n)){e.__curvenessList=n;return}t>r&&(r=t);var a=r%2?r+2:r+3;i=[];for(var o=0;o `),value:i.value,noValue:i.value==null})}return iw({series:this,dataIndex:e,multipleSeries:t})},t.prototype._updateCategoriesData=function(){var e=U(this.option.categories||[],function(e){return e.value==null?V({value:0},e):e}),t=new Wb([`value`],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray(function(e){return t.getItemModel(e)})},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!(this.get(`layout`)===`force`&&this.get([`force`,`layoutAnimation`]))},t.prototype.__ownRoamView=function(){var e=this.coordinateSystem;return fR(e)&&e},t.type=`series.`+Ez,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`],t.defaultOption={z:2,coordinateSystem:`view`,legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:`center`,top:`center`,symbol:`circle`,symbolSize:10,edgeSymbol:[`none`,`none`],edgeSymbolSize:10,edgeLabel:{position:`middle`,distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:`{b}`},itemStyle:{},lineStyle:{color:Q.color.neutral50,width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:Q.color.primary}}},t}(cw);function Oz(e){return e instanceof Array||(e=[e,e]),e}var kz=Gm(Ez,Az);function Az(e){e.eachSeriesByType(Ez,function(e){var t=e.getGraph(),n=e.getEdgeData(),r=Oz(e.get(`edgeSymbol`)),i=Oz(e.get(`edgeSymbolSize`));n.setVisual(`fromSymbol`,r&&r[0]),n.setVisual(`toSymbol`,r&&r[1]),n.setVisual(`fromSymbolSize`,i&&i[0]),n.setVisual(`toSymbolSize`,i&&i[1]),n.setVisual(`style`,e.getModel(`lineStyle`).getLineStyle()),n.each(function(e){var r=n.getItemModel(e),i=t.getEdgeByIndex(e),a=Oz(r.getShallow(`symbol`,!0)),o=Oz(r.getShallow(`symbolSize`,!0)),s=r.getModel(`lineStyle`).getLineStyle(),c=n.ensureUniqueItemVisual(e,`style`);switch(V(c,s),c.stroke){case`source`:var l=i.node1.getVisual(`style`);c.stroke=l&&l.fill;break;case`target`:var l=i.node2.getVisual(`style`);c.stroke=l&&l.fill}a[0]&&i.setVisual(`fromSymbol`,a[0]),a[1]&&i.setVisual(`toSymbol`,a[1]),o[0]&&i.setVisual(`fromSymbolSize`,o[0]),o[1]&&i.setVisual(`toSymbolSize`,o[1])})})}function jz(e){var t=e.coordinateSystem;if(!(t&&t.type!==`view`)){var n=e.getGraph();n.eachNode(function(e){var t=e.getModel();e.setLayout([+t.get(`x`),+t.get(`y`)])}),Mz(n,e)}}function Mz(e,t){e.eachEdge(function(e,n){var r=fo(e.getModel().get([`lineStyle`,`curveness`]),-Tz(e,t,n,!0),0),i=ps(e.node1.getLayout()),a=ps(e.node2.getLayout()),o=[i,a];+r&&o.push([(i[0]+a[0])/2-(i[1]-a[1])*r,(i[1]+a[1])/2-(a[0]-i[0])*r]),e.setLayout(o)})}var Nz=Gm(Ez,Pz);function Pz(e,t){e.eachSeriesByType(Ez,function(e){var t=e.get(`layout`),n=e.coordinateSystem;if(n&&n.type!==`view`){var r=e.getData(),i=[];H(n.dimensions,function(e){i=i.concat(r.mapDimensionsAll(e))});for(var a=0;a0&&(y[0]=-y[0],y[1]=-y[1]);var x=v[0]<0?-1:1;if(r.__position!==`start`&&r.__position!==`end`){var S=-Math.atan2(v[1],v[0]);l[0].8?`left`:u[0]<-.8?`right`:`center`,p=u[1]>.8?`top`:u[1]<-.8?`bottom`:`middle`;break;case`start`:r.x=-u[0]*h+c[0],r.y=-u[1]*g+c[1],f=u[0]>.8?`right`:u[0]<-.8?`left`:`center`,p=u[1]>.8?`bottom`:u[1]<-.8?`top`:`middle`;break;case`insideStartTop`:case`insideStart`:case`insideStartBottom`:r.x=h*x+c[0],r.y=c[1]+C,f=v[0]<0?`right`:`left`,r.originX=-h*x,r.originY=-C;break;case`insideMiddleTop`:case`insideMiddle`:case`insideMiddleBottom`:case`middle`:r.x=b[0],r.y=b[1]+C,f=`center`,r.originY=-C;break;case`insideEndTop`:case`insideEnd`:case`insideEndBottom`:r.x=-h*x+l[0],r.y=l[1]+C,f=v[0]>=0?`right`:`left`,r.originX=h*x,r.originY=-C}r.scaleX=r.scaleY=i,r.setStyle({verticalAlign:r.__verticalAlign||p,align:r.__align||f})}},t}(Lg),cB=function(){function e(e){this.group=new Lg,this._LineCtor=e||sB}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,r=n.group,i=n._lineData;n._lineData=e,i||r.removeAll();var a=uB(e);e.diff(i).add(function(n){t._doAdd(e,n,a)}).update(function(n,r){t._doUpdate(i,e,r,n,a)}).remove(function(e){r.remove(i.getItemGraphicEl(e))}).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,n){t.updateLayout(e,n)},this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=uB(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){this._progressiveEls=[];function r(e){!e.isGroup&&!lB(e)&&(e.incremental=n,e.ensureState(`emphasis`).hoverLayer=2)}for(var i=e.start;i0}function uB(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{lineStyle:t.getModel(`lineStyle`).getLineStyle(),emphasisLineStyle:n.getModel([`lineStyle`]).getLineStyle(),blurLineStyle:t.getModel([`blur`,`lineStyle`]).getLineStyle(),selectLineStyle:t.getModel([`select`,`lineStyle`]).getLineStyle(),emphasisDisabled:n.get(`disabled`),blurScope:n.get(`blurScope`),focus:n.get(`focus`),labelStatesModels:Gv(t)}}function dB(e){return isNaN(e[0])||isNaN(e[1])}function fB(e){return e&&!dB(e[0])&&!dB(e[1])}var pB=[],mB=[],hB=[],gB=pl,_B=Ts,vB=Math.abs;function yB(e,t,n){for(var r=e[0],i=e[1],a=e[2],o=1/0,s,c=n*n,l=.1,u=.1;u<=.9;u+=.1){pB[0]=gB(r[0],i[0],a[0],u),pB[1]=gB(r[1],i[1],a[1],u);var d=vB(_B(pB,t)-c);d=0?s+=l:s-=l:m>=0?s-=l:s+=l}return s}function bB(e,t){var n=[],r=_l,i=[[],[],[]],a=[[],[]],o=[];t/=2,e.eachEdge(function(e,s){var c=e.getLayout(),l=e.getVisual(`fromSymbol`),u=e.getVisual(`toSymbol`);c.__original||(c.__original=[ps(c[0]),ps(c[1])],c[2]&&c.__original.push(ps(c[2])));var d=c.__original;if(c[2]!=null){if(fs(i[0],d[0]),fs(i[1],d[2]),fs(i[2],d[1]),l&&l!==`none`){var f=Iz(e.node1),p=yB(i,d[0],f*t);r(i[0][0],i[1][0],i[2][0],p,n),i[0][0]=n[3],i[1][0]=n[4],r(i[0][1],i[1][1],i[2][1],p,n),i[0][1]=n[3],i[1][1]=n[4]}if(u&&u!==`none`){var f=Iz(e.node2),p=yB(i,d[1],f*t);r(i[0][0],i[1][0],i[2][0],p,n),i[1][0]=n[1],i[2][0]=n[2],r(i[0][1],i[1][1],i[2][1],p,n),i[1][1]=n[1],i[2][1]=n[2]}fs(c[0],i[0]),fs(c[1],i[2]),fs(c[2],i[1])}else{if(fs(a[0],d[0]),fs(a[1],d[1]),_s(o,a[1],a[0]),xs(o,o),l&&l!==`none`){var f=Iz(e.node1);gs(a[0],a[0],o,f*t)}if(u&&u!==`none`){var f=Iz(e.node2);gs(a[1],a[1],o,-f*t)}fs(c[0],a[0]),fs(c[1],a[1])}})}var xB=vm();function SB(e){if(e)return xB(e).bridge}var CB=function(e){z(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=Ez,t}return t.prototype.init=function(e,t){var n=new Fw,r=new cB,i=this.group,a=new Lg;this._controller=new DL(t.getZr()),a.add(n.group),a.add(r.group),i.add(a),this._symbolDraw=n,this._lineDraw=r,this._mainGroup=a,this._firstRender=!0},t.prototype.render=function(e,t,n){var r=this,i=vR(e),a=!1;this._model=e,this._api=n,this._active=!0;var o=this._mainGroup,s=this._getThumbnailInfo();s&&s.bridge.reset(n);var c=this._symbolDraw,l=this._lineDraw;i&&pR(o,2,i,this._firstRender?null:e),bB(e.getGraph(),Fz(e));var u=e.getData();c.updateData(u);var d=e.getEdgeData();l.updateData(d),this._updateNodeAndLinkScale(),i&&jR(e,n,this._controller,function(t,n,r){return e.coordinateSystem.containPoint([n,r])},null),clearTimeout(this._layoutTimeout);var f=e.forceLayout,p=e.get([`force`,`layoutAnimation`]);f&&(a=!0,this._startForceLayoutIteration(f,n,p));var m=e.get(`layout`);u.graph.eachNode(function(t){var i=t.dataIndex,a=t.getGraphicEl(),o=t.getModel();if(a){a.off(`drag`).off(`dragend`);var s=o.get(`draggable`);s&&a.on(`drag`,function(o){switch(m){case`force`:f.warmUp(),!r._layouting&&r._startForceLayoutIteration(f,n,p),f.setFixed(i),u.setItemLayout(i,[a.x,a.y]);break;case`circular`:u.setItemLayout(i,[a.x,a.y]),t.setLayout({fixed:!0},!0),zz(e,`symbolSize`,t,[o.offsetX,o.offsetY]),r.updateLayout(e);break;default:u.setItemLayout(i,[a.x,a.y]),Mz(e.getGraph(),e),r.updateLayout(e)}}).on(`dragend`,function(){f&&f.setUnfixed(i)}),a.setDraggable(s,!!o.get(`cursor`)),o.get([`emphasis`,`focus`])===`adjacency`&&(qm(a).focus=t.getAdjacentDataIndices())}}),u.graph.eachEdge(function(e){var t=e.getGraphicEl(),n=e.getModel().get([`emphasis`,`focus`]);t&&n===`adjacency`&&(qm(t).focus={edge:[e.dataIndex],node:[e.node1.dataIndex,e.node2.dataIndex]})});var h=e.get(`layout`)===`circular`&&e.get([`circular`,`rotateLabel`]),g=u.getLayout(`cx`),_=u.getLayout(`cy`);u.graph.eachNode(function(e){Vz(e,h,g,_)}),this._firstRender=!1,a||this._renderThumbnail(e,n,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose()},t.prototype._startForceLayoutIteration=function(e,t,n){var r=this,i=!1;(function a(){e.step(function(e){r.updateLayout(r._model),(e||!i)&&(i=!0,r._renderThumbnail(r._model,t,r._symbolDraw,r._lineDraw)),(r._layouting=!e)&&(n?r._layoutTimeout=setTimeout(a,16):a())})})()},t.prototype.__updateOnOwnRoam=function(e,t,n){var r=vR(t);this._active&&r&&(pR(this._mainGroup,2,r,null),PR(e)&&(this._updateNodeAndLinkScale(),bB(t.getGraph(),Fz(t)),this._lineDraw.updateLayout(),n.updateLabelLayout()),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var e=this._model,t=e.getData(),n=Fz(e);t.eachItemGraphicEl(function(e,t){e&&e.setSymbolScale(n)})},t.prototype.updateLayout=function(e){this._active&&(bB(e.getGraph(),Fz(e)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout())},t.prototype.remove=function(){this._active=!1,clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove(),this._controller&&this._controller.disable()},t.prototype._getThumbnailInfo=function(){var e=this._model,t=e.coordinateSystem;if(t.type===`view`){var n=SB(e);if(n)return{bridge:n,coordSys:t}}},t.prototype._updateThumbnailWindow=function(){var e=this._getThumbnailInfo();e&&e.bridge.updateWindow(VL(null,e.coordSys),this._api)},t.prototype._renderThumbnail=function(e,t,n,r){var i=this._getThumbnailInfo();if(i){var a=new Lg,o=n.group.children(),s=r.group.children(),c=new Lg,l=new Lg;a.add(l),a.add(c);for(var u=0;ua&&(t[1-r]=Ep(t[r],d.sign*a)),t}function AB(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function jB(e,t){return Math.min(t[1]==null?1/0:t[1],Math.max(t[0]==null?-1/0:t[0],e))}var MB=vm(),NB=B,PB=W,FB=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,r){var i=t.get(`value`),a=t.get(`status`);if(this._axisModel=e,this._axisPointerModel=t,this._api=n,r||this._lastValue!==i||this._lastStatus!==a){this._lastValue=i,this._lastStatus=a;var o=this._group,s=this._handle;if(!a||a===`hide`){o&&o.hide(),s&&s.hide();return}o&&o.show(),s&&s.show();var c={};this.makeElOption(c,i,e,t,n);var l=c.graphicKey;l!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=l;var u=this._moveAnimation=this.determineAnimation(e,t);if(!o)o=this._group=new Lg,this.createPointerEl(o,c,e,t),this.createLabelEl(o,c,e,t),n.getZr().add(o);else{var d=no(IB,t,u);this.updatePointerEl(o,c,d),this.updateLabelEl(o,c,d,t)}BB(o,t,!0),this._renderHandle(i)}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get(`animation`),r=e.axis,i=r.type===`category`,a=t.get(`snap`);if(!a&&!i)return!1;if(n===`auto`||n==null){var o=this.animationThreshold;if(i&&WD(r).w>o)return!0;if(a){var s=oL(e).seriesDataCount,c=r.getExtent();return Math.abs(c[0]-c[1])/s>o}return!1}return n===!0},e.prototype.makeElOption=function(e,t,n,r,i){},e.prototype.createPointerEl=function(e,t,n,r){var i=t.pointer;if(i){var a=MB(e).pointerEl=new q_[i.type](NB(t.pointer));e.add(a)}},e.prototype.createLabelEl=function(e,t,n,r){if(t.label){var i=MB(e).labelEl=new Vf(NB(t.label));e.add(i),RB(i,r)}},e.prototype.updatePointerEl=function(e,t,n){var r=MB(e).pointerEl;r&&t.pointer&&(r.setStyle(t.pointer.style),n(r,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,r){var i=MB(e).labelEl;i&&(i.setStyle(t.label.style),n(i,{x:t.label.x,y:t.label.y}),RB(i,r))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t=this._axisPointerModel,n=this._api.getZr(),r=this._handle,i=t.getModel(`handle`),a=t.get(`status`);if(!i.get(`show`)||!a||a===`hide`){r&&n.remove(r),this._handle=null;return}var o;this._handle||(o=!0,r=this._handle=vv(i.get(`icon`),{cursor:`move`,draggable:!0,onmousemove:function(e){UA(e.event)},onmousedown:PB(this._onHandleDragMove,this,0,0),drift:PB(this._onHandleDragMove,this),ondragend:PB(this._onHandleDragEnd,this)}),n.add(r)),BB(r,t,!1),r.setStyle(i.getItemStyle(null,[`color`,`borderColor`,`borderWidth`,`opacity`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`]));var s=i.get(`size`);G(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,qk(this,`_doDispatchAxisPointer`,i.get(`throttle`)||0,`fixRate`),this._moveHandleToValue(e,o)}},e.prototype._moveHandleToValue=function(e,t){IB(this._axisPointerModel,!t&&this._moveAnimation,this._handle,zB(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var r=this.updateHandleTransform(zB(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=r,n.stopAnimation(),n.attr(zB(r)),MB(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:`updateAxisPointer`,x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get(`value`);this._moveHandleToValue(e),this._api.dispatchAction({type:`hideTip`})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,r=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),r&&t.remove(r),this._group=null,this._handle=null,this._payloadInfo=null),Jk(this,`_doDispatchAxisPointer`)},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}},e}();function IB(e,t,n,r){LB(MB(n).lastProp,r)||(MB(n).lastProp=r,t?B_(n,r,e):(n.stopAnimation(),n.attr(r)))}function LB(e,t){if(J(e)&&J(t)){var n=!0;return H(t,function(t,r){n&&=LB(e[r],t)}),!!n}return e===t}function RB(e,t){e[t.get([`label`,`show`])?`show`:`hide`]()}function zB(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function BB(e,t,n){var r=t.get(`z`),i=t.get(`zlevel`);e&&e.traverse(function(e){e.type!==`group`&&(r!=null&&(e.z=r),i!=null&&(e.zlevel=i),e.silent=n)})}function VB(e){var t=e.get(`type`),n=e.getModel(t+`Style`),r;return t===`line`?(r=n.getLineStyle(),r.fill=null):t===`shadow`&&(r=n.getAreaStyle(),r.stroke=null),r}function HB(e,t,n,r,i){var a=WB(n.get(`value`),t.axis,t.ecModel,n.get(`seriesDataIndices`),{precision:n.get([`label`,`precision`]),formatter:n.get([`label`,`formatter`])}),o=n.getModel(`label`),s=IS(o.get(`padding`)||0),c=o.getFont(),l=cc(a,c),u=i.position,d=l.width+s[1]+s[3],f=l.height+s[0]+s[2],p=i.align;p===`right`&&(u[0]-=d),p===`center`&&(u[0]-=d/2);var m=i.verticalAlign;m===`bottom`&&(u[1]-=f),m===`middle`&&(u[1]-=f/2),UB(u,d,f,r);var h=o.get(`backgroundColor`);(!h||h===`auto`)&&(h=t.get([`axisLine`,`lineStyle`,`color`])),e.label={x:u[0],y:u[1],style:Kv(o,{text:a,font:c,fill:o.getTextColor(),padding:s,backgroundColor:h}),z2:10}}function UB(e,t,n,r){var i=r.getWidth(),a=r.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+n,a)-n,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function WB(e,t,n,r,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:_E(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};H(r,function(e){var t=n.getSeriesByIndex(e.seriesIndex),r=e.dataIndexInside,i=t&&t.getDataParams(r);i&&s.seriesData.push(i)}),q(o)?a=o.replace(`{value}`,a):K(o)&&(a=o(s))}return a}function GB(e,t,n){var r=rs();return cs(r,r,n.rotation),ss(r,r,n.position),dv([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],r)}function KB(e,t,n,r,i,a){var o=OO.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=i.get([`label`,`margin`]),HB(t,r,i,a,{position:GB(r.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function qB(e,t,n){return n||=0,{x1:e[n],y1:e[1-n],x2:t[n],y2:t[1-n]}}function JB(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}}function YB(e,t,n){return WD(e,{fromStat:{sers:U(t,function(e){return n.getSeriesByIndex(e.seriesIndex)})},min:1}).w}function XB(e,t,n){return[ap(ip(t[0],t[1]),e-n/2),ip(e+n/2,ap(t[0],t[1]))]}var ZB=function(e){z(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(e,t,n,r,i){var a=n.axis,o=a.grid,s=r.get(`type`),c=a.getGlobalExtent(),l=QB(o,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(t,!0));if(s&&s!==`none`){var d=VB(r),f=$B[s](a,u,c,l,r.get(`seriesDataIndices`),r.ecModel);f.style=d,e.graphicKey=f.type,e.pointer=f}KB(t,e,YO(o.getRect(),n),n,r,i)},t.prototype.getHandleTransform=function(e,t,n){var r=YO(t.axis.grid.getRect(),t,{labelInside:!1});r.labelMargin=n.get([`handle`,`margin`]);var i=GB(t.axis,e,r);return{x:i[0],y:i[1],rotation:r.rotation+(r.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,r){var i=n.axis,a=i.grid,o=i.getGlobalExtent(!0),s=QB(a,i).getOtherAxis(i).getGlobalExtent(),c=i.dim===`x`?0:1,l=[e.x,e.y];l[c]+=t[c],l[c]=ip(o[1],l[c]),l[c]=ap(o[0],l[c]);var u=(s[1]+s[0])/2,d=[u,u];return d[c]=l[c],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:`middle`},{align:`center`}][c]}},t}(FB);function QB(e,t){var n={};return n[t.dim+`AxisIndex`]=t.index,e.getCartesian(n)}var $B={line:function(e,t,n,r){return{type:`Line`,subPixelOptimize:!0,shape:qB([t,r[0]],[t,r[1]],eV(e))}},shadow:function(e,t,n,r,i,a){var o=YB(e,i,a),s=r[1]-r[0],c=XB(t,n,o),l=c[0],u=c[1];return{type:`Rect`,shape:JB([l,r[0]],[u-l,s],eV(e))}}};function eV(e){return e.dim===`x`?0:1}var tV=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`axisPointer`,t.defaultOption={show:`auto`,z:50,type:`line`,snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:Q.color.border,width:1,type:`dashed`},shadowStyle:{color:Q.color.shadowTint},label:{show:!0,formatter:null,precision:`auto`,margin:3,color:Q.color.neutral00,padding:[5,7,5,7],backgroundColor:Q.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:`M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z`,size:45,margin:50,color:Q.color.accent40,throttle:40}},t}(aC),nV=vm(),rV=H;function iV(e,t,n){if(!Ao.node){var r=t.getZr();nV(r).records||(nV(r).records={}),aV(r,t);var i=nV(r).records[e]||(nV(r).records[e]={});i.handler=n}}function aV(e,t){if(nV(e).initialized)return;nV(e).initialized=!0,n(`click`,no(cV,`click`)),n(`mousemove`,no(cV,`mousemove`)),n(`mousewheel`,no(cV,`mousewheel`)),n(`globalout`,sV);function n(n,r){e.on(n,function(n){var i=lV(t);rV(nV(e).records,function(e){e&&r(e,n,i.dispatchAction)}),oV(i.pendings,t)})}}function oV(e,t){var n=e.showTip.length,r=e.hideTip.length,i;n?i=e.showTip[n-1]:r&&(i=e.hideTip[r-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function sV(e,t,n){e.handler(`leave`,null,n)}function cV(e,t,n,r){t.handler(e,n,r)}function lV(e){var t={showTip:[],hideTip:[]},n=function(r){var i=t[r.type];i?i.push(r):(r.dispatchAction=n,e.dispatchAction(r))};return{dispatchAction:n,pendings:t}}function uV(e,t){if(!Ao.node){var n=t.getZr();(nV(n).records||{})[e]&&(nV(n).records[e]=null)}}var dV=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=t.getComponent(`tooltip`),i=e.get(`triggerOn`)||r&&r.get(`triggerOn`)||`mousemove|click|mousewheel`;iV(`axisPointer`,n,function(e,t,n){i!==`none`&&(e===`leave`||i.indexOf(e)>=0)&&n({type:`updateAxisPointer`,currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})})},t.prototype.remove=function(e,t){uV(`axisPointer`,t)},t.prototype.dispose=function(e,t){uV(`axisPointer`,t)},t.type=`axisPointer`,t}(YM);function fV(e,t){var n=[],r=e.seriesIndex,i;if(r==null||!(i=t.getSeriesByIndex(r)))return{point:[]};var a=i.getData(),o=_m(a,e);if(o==null||o<0||G(o))return{point:[]};var s=a.getItemGraphicEl(o),c=i.coordinateSystem;if(i.getTooltipPosition)n=i.getTooltipPosition(o)||[];else if(c&&c.dataToPoint){if(e.isStacked){var l=c.getBaseAxis(),u=c.getOtherAxis(l).dim,d=l.dim,f=+(u===`x`||u===`radius`),p=a.mapDimension(d),m=[];m[f]=a.get(p,o),m[1-f]=a.get(a.getCalculationInfo(`stackResultDimension`),o),n=c.dataToPoint(m)||[]}else n=c.dataToPoint(a.getValues(U(c.dimensions,function(e){return a.mapDimension(e)}),o))||[]}else if(s){var h=s.getBoundingRect().clone();h.applyTransform(s.transform),n=[h.x+h.width/2,h.y+h.height/2]}return{point:n,el:s}}var pV=vm();function mV(e,t,n){var r=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||W(n.dispatchAction,n),s=t.getComponent(`axisPointer`).coordSysAxesInfo;if(s){wV(i)&&(i=fV({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var c=wV(i),l=a.axesInfo,u=s.axesInfo,d=r===`leave`||wV(i),f={},p={},m={list:[],map:{}},h={showPointer:no(_V,p),showTooltip:no(vV,m)};H(s.coordSysMap,function(e,t){var n=c||e.containPoint(i);H(s.coordSysAxesInfo[t],function(e,t){var r=e.axis,a=SV(l,e);if(!d&&n&&(!l||a)){var o=a&&a.value;o==null&&!c&&(o=r.pointToData(i)),o!=null&&hV(e,o,h,!1,f)}})});var g={};return H(u,function(e,t){var n=e.linkGroup;n&&!p[t]&&H(n.axesInfo,function(t,r){var i=p[r];if(t!==e&&i){var a=i.value;n.mapper&&(a=e.axis.scale.parse(n.mapper(a,CV(t),CV(e)))),g[e.key]=a}})}),H(g,function(e,t){hV(u[t],e,h,!0,f)}),yV(p,u,f),bV(m,i,e,o),xV(u,o,n),f}}function hV(e,t,n,r,i){var a=e.axis;if(!a.scale.isBlank()&&a.containData(t)){if(!e.involveSeries){n.showPointer(e,t);return}var o=gV(t,e),s=o.payloadBatch,c=o.snapToValue;s[0]&&i.seriesIndex==null&&V(i,s[0]),!r&&e.snap&&a.containData(c)&&c!=null&&(t=c),n.showPointer(e,t,s),n.showTooltip(e,o,c)}}function gV(e,t){var n=t.axis,r=n.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return H(t.seriesModels,function(t,c){var l=t.getData().mapDimensionsAll(r),u,d;if(t.getAxisTooltipData){var f=t.getAxisTooltipData(l,e,n);d=f.dataIndices,u=f.nestestValue}else{if(d=t.indicesOfNearest(r,l[0],e,n.type===`category`?.5:null),!d.length)return;u=t.getData().get(l[0],d[0])}if(Vp(u)){var p=e-u,m=Math.abs(p);m<=o&&((m=0&&s<0)&&(o=m,s=p,i=u,a.length=0),H(d,function(e){a.push({seriesIndex:t.seriesIndex,dataIndexInside:e,dataIndex:t.getData().getRawIndex(e)})}))}}),{payloadBatch:a,snapToValue:i}}function _V(e,t,n,r){e[t.key]={value:n,payloadBatch:r}}function vV(e,t,n,r){var i=n.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(t.triggerTooltip&&i.length){var c=t.coordSys.model,l=lL(c),u=e.map[l];u||(u=e.map[l]={coordSysId:c.id,coordSysIndex:c.componentIndex,coordSysType:c.type,coordSysMainType:c.mainType,dataByAxis:[]},e.list.push(u)),u.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:r,valueLabelOpt:{precision:s.get([`label`,`precision`]),formatter:s.get([`label`,`formatter`])},seriesDataIndices:i.slice()})}}function yV(e,t,n){var r=n.axesInfo=[];H(t,function(t,n){var i=t.axisPointerModel.option,a=e[n];a?(!t.useHandle&&(i.status=`show`),i.value=a.value,i.seriesDataIndices=(a.payloadBatch||[]).slice()):!t.useHandle&&(i.status=`hide`),i.status===`show`&&r.push({axisDim:t.axis.dim,axisIndex:t.axis.model.componentIndex,value:i.value})})}function bV(e,t,n,r){if(wV(t)||!e.list.length){r({type:`hideTip`});return}var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};r({type:`showTip`,escapeConnect:!0,x:t[0],y:t[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}function xV(e,t,n){var r=n.getZr(),i=`axisPointerLastHighlights`,a=pV(r)[i]||{},o=pV(r)[i]={};H(e,function(e,t){var n=e.axisPointerModel.option;n.status===`show`&&e.triggerEmphasis&&H(n.seriesDataIndices,function(e){o[e.seriesIndex+`|`+e.dataIndex]=e})});var s=[],c=[];function l(e){return{seriesIndex:e.seriesIndex,dataIndex:e.dataIndex}}H(a,function(e,t){!o[t]&&c.push(l(e))}),H(o,function(e,t){!a[t]&&s.push(l(e))}),c.length&&n.dispatchAction({type:`downplay`,escapeConnect:!0,notBlur:!0,batch:c}),s.length&&n.dispatchAction({type:`highlight`,escapeConnect:!0,notBlur:!0,batch:s})}function SV(e,t){for(var n=0;n<(e||[]).length;n++){var r=e[n];if(t.axis.dim===r.axisDim&&t.axis.model.componentIndex===r.axisIndex)return r}}function CV(e){var t=e.axis.model,n={},r=n.axisDim=e.axis.dim;return n.axisIndex=n[r+`AxisIndex`]=t.componentIndex,n.axisName=n[r+`AxisName`]=t.name,n.axisId=n[r+`AxisId`]=t.id,n}function wV(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function TV(e){dL.registerAxisPointerClass(`CartesianAxisPointer`,ZB),e.registerComponentModel(tV),e.registerComponentView(dV),e.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!G(t)&&(e.axisPointer.link=[t])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(e,t){e.getComponent(`axisPointer`).coordSysAxesInfo=$I(e,t)}}),e.registerAction({type:`updateAxisPointer`,event:`updateAxisPointer`,update:`:updateAxisPointer`},mV)}function EV(e){gI(SL),gI(TV)}function DV(e,t){var n=IS(t.get(`padding`)),r=t.getItemStyle([`color`,`opacity`]);return r.fill=t.get(`backgroundColor`),new If({shape:{x:e.x-n[3],y:e.y-n[0],width:e.width+n[1]+n[3],height:e.height+n[0]+n[2],r:t.get(`borderRadius`)},style:r,silent:!0,z2:-1})}var OV=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`tooltip`,t.dependencies=[`axisPointer`],t.defaultOption={z:60,show:!0,showContent:!0,trigger:`item`,triggerOn:`mousemove|click|mousewheel`,alwaysShowContent:!1,renderMode:`auto`,confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:Q.color.neutral00,shadowBlur:10,shadowColor:`rgba(0, 0, 0, .2)`,shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:Q.color.border,padding:null,extraCssText:``,axisPointer:{type:`line`,axis:`auto`,animation:`auto`,animationDurationUpdate:200,animationEasingUpdate:`exponentialOut`,crossStyle:{color:Q.color.borderShade,width:1,type:`dashed`,textStyle:{}}},textStyle:{color:Q.color.tertiary,fontSize:14}},t}(aC);function kV(e){var t=e.get(`confine`);return t==null?e.get(`renderMode`)===`richText`:!!t}function AV(e){if(Ao.domSupported){for(var t=document.documentElement.style,n=0,r=e.length;n-1?(s+=`top:50%`,c+=`translateY(-50%) rotate(`+(l=a===`left`?-225:-45)+`deg)`):(s+=`left:50%`,c+=`translateX(-50%) rotate(`+(l=a===`top`?225:45)+`deg)`);var u=l*Math.PI/180,d=o+i,f=d*Math.abs(Math.cos(u))+d*Math.abs(Math.sin(u)),p=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-d)/2)*100)/100;s+=`;`+a+`:-`+p+`px`;var m=t+` solid `+i+`px;`;return`
`}function BV(e,t,n){var r=`cubic-bezier(0.23,1,0.32,1)`,i=``,a=``;return n&&(i=` `+e/2+`s `+r,a=`opacity`+i+`,visibility`+i),t||(i=` `+e+`s `+r,a+=(a.length?`,`:``)+(Ao.transformSupported?``+IV+i:`,left`+i+`,top`+i)),FV+`:`+a}function VV(e,t,n){var r=e.toFixed(0)+`px`,i=t.toFixed(0)+`px`;if(!Ao.transformSupported)return n?`top:`+i+`;left:`+r+`;`:[[`top`,i],[`left`,r]];var a=Ao.transform3dSupported,o=`translate`+(a?`3d`:``)+`(`+r+`,`+i+(a?`,0`:``)+`)`;return n?`top:0;left:0;`+IV+`:`+o+`;`:[[`top`,0],[`left`,0],[jV,o]]}function HV(e){var t=[],n=e.get(`fontSize`),r=e.getTextColor();r&&t.push(`color:`+r),t.push(`font:`+e.getFont());var i=Y(e.get(`lineHeight`),Math.round(n*3/2));n&&t.push(`line-height:`+i+`px`);var a=e.get(`textShadowColor`),o=e.get(`textShadowBlur`)||0,s=e.get(`textShadowOffsetX`)||0,c=e.get(`textShadowOffsetY`)||0;return a&&o&&t.push(`text-shadow:`+s+`px `+c+`px `+o+`px `+a),H([`decoration`,`align`],function(n){var r=e.get(n);r&&t.push(`text-`+n+`:`+r)}),t.join(`;`)}function UV(e,t,n,r){var i=[],a=e.get(`transitionDuration`),o=e.get(`backgroundColor`),s=e.get(`shadowBlur`),c=e.get(`shadowColor`),l=e.get(`shadowOffsetX`),u=e.get(`shadowOffsetY`),d=e.getModel(`textStyle`),f=nw(e,`html`),p=l+`px `+u+`px `+s+`px `+c;return i.push(`box-shadow:`+p),t&&a>0&&i.push(BV(a,n,r)),o&&i.push(`background-color:`+o),H([`width`,`color`,`radius`],function(t){var n=`border-`+t,r=FS(n),a=e.get(r);a!=null&&i.push(n+`:`+a+(t===`color`?``:`px`))}),i.push(HV(d)),f!=null&&i.push(`padding:`+IS(f).join(`px `)+`px`),i.join(`;`)+`;`}function WV(e,t,n,r,i){var a=t&&t.painter;if(n){var o=a&&a.getViewportRoot();o&&Ex(e,o,n,r,i)}else{e[0]=r,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var GV=function(){function e(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,Ao.wxa)return null;var n=document.createElement(`div`);n.domBelongToZr=!0,this.el=n;var r=this._zr=e.getZr(),i=t.appendTo,a=i&&(q(i)?document.querySelector(i):so(i)?i:K(i)&&i(e.getDom()));WV(this._styleCoord,r,a,e.getWidth()/2,e.getHeight()/2),(a||e.getDom()).appendChild(n),this._api=e,this._container=a;var o=this;n.onmouseenter=function(){o._enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},n.onmousemove=function(e){if(e||=window.event,!o._enterable){var t=r.handler;zA(r.painter.getViewportRoot(),e,!0),t.dispatch(`mousemove`,e)}},n.onmouseleave=function(){o._inContent=!1,o._enterable&&o._show&&o.hideLater(o._hideDelay)}}return e.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),n=PV(t,`position`),r=t.style;r.position!==`absolute`&&n!==`absolute`&&(r.position=`relative`)}var i=e.get(`alwaysShowContent`);i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=e.get(`displayTransition`)&&e.get(`transitionDuration`)>0,this.el.className=e.get(`className`)||``},e.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,r=n.style,i=this._styleCoord;n.innerHTML?r.cssText=LV+UV(e,!this._firstShow,this._longHide,this._enableDisplayTransition)+VV(i[0],i[1],!0)+(`border-color:`+HS(t)+`;`)+(e.get(`extraCssText`)||``)+(`;pointer-events:`+(this._enterable?`auto`:`none`)):r.display=`none`,this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(e,t,n,r,i){var a=this.el;if(e==null){a.innerHTML=``;return}var o=``;if(q(i)&&n.get(`trigger`)===`item`&&!kV(n)&&(o=zV(n,r,i)),q(e))a.innerHTML=e+o;else if(e){a.innerHTML=``,G(e)||(e=[e]);for(var s=0;s=0?this._tryShow(n,r):t===`leave`&&this._hide(r))},this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,r=e.get(`triggerOn`);if(e.get(`trigger`)!==`axis`&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&r!==`none`&&r!==`click`){var i=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&i.manuallyShowTip(e,t,n,{x:i._lastX,y:i._lastY,dataByCoordSys:i._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(e,t,n,r){if(r.from!==this.uid&&!Ao.node&&n.getDom()){var i=$V(r,n);this._ticket=``;var a=r.dataByCoordSys,o=iH(r,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:r.position,positionDefault:`bottom`},i)}else if(r.tooltip&&r.x!=null&&r.y!=null){var c=XV;c.x=r.x,c.y=r.y,c.update(),qm(c).tooltipConfig={name:null,option:r.tooltip},this._tryShow({offsetX:r.x,offsetY:r.y,target:c},i)}else if(a)this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,dataByCoordSys:a,tooltipOption:r.tooltipOption},i);else if(r.seriesIndex!=null){if(this._manuallyAxisShowTip(e,t,n,r))return;var l=fV(r,t),u=l.point[0],d=l.point[1];u!=null&&d!=null&&this._tryShow({offsetX:u,offsetY:d,target:l.el,position:r.position,positionDefault:`bottom`},i)}else r.x!=null&&r.y!=null&&(n.dispatchAction({type:`updateAxisPointer`,x:r.x,y:r.y}),this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,target:n.getZr().findHover(r.x,r.y).target},i))}},t.prototype.manuallyHideTip=function(e,t,n,r){var i=this._tooltipContent;this._tooltipModel&&i.hideLater(this._tooltipModel.get(`hideDelay`)),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,r.from!==this.uid&&this._hide($V(r,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,r){var i=r.seriesIndex,a=r.dataIndex,o=t.getComponent(`axisPointer`).coordSysAxesInfo;if(i!=null&&a!=null&&o!=null){var s=t.getSeriesByIndex(i);if(s&&QV([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model],this._tooltipModel).get(`trigger`)===`axis`)return n.dispatchAction({type:`updateAxisPointer`,seriesIndex:i,dataIndex:a,position:r.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var r=e.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,e);else if(n){if(qm(n).ssrType===`legend`)return;this._lastDataByCoordSys=null,this._cbParamsList=null;var i,a;PN(n,function(e){if(e.tooltipDisabled)return i=a=null,!0;i||a||(qm(e).dataIndex==null?qm(e).tooltipConfig!=null&&(a=e):i=e)},!0),i?this._showSeriesItemTooltip(e,i,t):a?this._showComponentItemTooltip(e,a,t):this._hide(t)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get(`showDelay`);t=W(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,r=this._tooltipModel,i=[t.offsetX,t.offsetY],a=QV([t.tooltipOption],r),o=this._renderMode,s=[],c=HC(`section`,{blocks:[],noHeader:!0}),l=[],u=new rw;H(e,function(e){H(e.dataByAxis,function(e){var t=n.getComponent(e.axisDim+`Axis`,e.axisIndex),i=e.value,a=t.axis,d=a.scale.parse(i);if(t&&i!=null){var f=WB(i,a,n,e.seriesDataIndices,e.valueLabelOpt),p=HC(`section`,{header:f,noHeader:!go(f),sortBlocks:!0,blocks:[]});c.blocks.push(p),H(e.seriesDataIndices,function(i){var a=n.getSeriesByIndex(i.seriesIndex),c=i.dataIndexInside,m=a.getDataParams(c);if(!(m.dataIndex<0)){m.axisDim=e.axisDim,m.axisIndex=e.axisIndex,m.axisType=e.axisType,m.axisId=e.axisId,m.axisValue=_E(t.axis,{value:d}),m.axisValueLabel=f,m.marker=u.makeTooltipMarker(`item`,HS(m.color),o);var h=gC(a.formatTooltip(c,!0,null)),g=h.frag;if(g){var _=QV([a],r).get(`valueFormatter`);p.blocks.push(_?V({valueFormatter:_},g):g)}h.text&&l.push(h.text),s.push(m)}})}})}),c.blocks.reverse(),l.reverse();var d=t.position,f=JC(c,u,o,a.get(`order`),n.get(`useUTC`),a.get(`textStyle`));f&&l.unshift(f);var p=o===`richText`?` -`:`
`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=rh(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=cH([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(m==null||m===`item`){var h=s.getDataParams(c,l),g=new pw;h.marker=g.makeTooltipMarker(`item`,QS(h.color),d);var _=EC(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?iw(y?V({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=rh(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(q(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=B(a),a.content=Wx(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=cH(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new pw;this._showOrMove(d,function(){var n=B(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,e.get(`showContent`)&&e.get(`show`)){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o||=e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`),e.get(`defaultBorderColor`,!0)).color;if(u){if(q(u)){var p=e.ecModel.get(`useUTC`),m=G(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=ES(m.axisValue,d,p)),d=XS(d,n,!0)}else if(K(u)){var g=W(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u}l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r,i){if(n===`axis`||G(t))return{color:r||i};if(!G(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t||=e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),K(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),G(t))n=Ep(t[0],s),r=Ep(t[1],c);else if(J(t)){var p=t;p.width=l[0],p.height=l[1];var m=aC(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(q(t)&&o){var h=fH(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=uH(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=pH(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=pH(d)?l[1]/2:d===`bottom`?l[1]:0),zV(e)){var h=dH(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&H(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i&&=o.length===s.length,i&&H(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&H(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&H(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,this._cbParamsList=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){!Bo.node&&t.getDom()&&(iA(this,`_updatePosition`),this._tooltipContent.dispose(),bV(`itemTooltip`,t),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type=`tooltip`,t}(aN);function cH(e,t,n){var r=t.ecModel,i;n?(i=new wy(n,r,r),i=new wy(t.option,i,r)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof wy&&(o=o.get(`tooltip`,!0)),q(o)&&(o={formatter:o}),o&&(i=new wy(o,i,r)))}return i}function lH(e,t){return e.dispatchAction||W(t.dispatchAction,t)}function uH(e,t,n,r,i,a,o){var s=n.getSize(),c=s[0],l=s[1];return a!=null&&(e+c+a+2>r?e-=c+a:e+=a),o!=null&&(t+l+o>i?t-=l+o:t+=o),[e,t]}function dH(e,t,n,r,i){var a=n.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,r)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function fH(e,t,n,r){var i=n[0],a=n[1],o=Math.ceil(Math.SQRT2*r)+8,s=0,c=0,l=t.width,u=t.height;switch(e){case`inside`:s=t.x+l/2-i/2,c=t.y+u/2-a/2;break;case`top`:s=t.x+l/2-i/2,c=t.y-a-o;break;case`bottom`:s=t.x+l/2-i/2,c=t.y+u+o;break;case`left`:s=t.x-i-o,c=t.y+u/2-a/2;break;case`right`:s=t.x+l+o,c=t.y+u/2-a/2}return[s,c]}function pH(e){return e===`center`||e===`middle`}function mH(e,t,n){var r=jm(e).queryOptionMap,i=r.keys()[0];if(i&&i!==`series`){var a=Nm(t,i,r.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a){var o=n.getViewOfComponentModel(a),s;if(o.group.traverse(function(t){var n=rh(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:i,componentIndex:a.componentIndex,el:s}}}}function hH(e){EI(FV),e.registerComponentModel(RV),e.registerComponentView(sH),e.registerAction({type:`showTip`,event:`showTip`,update:`tooltip:manuallyShowTip`},Lo),e.registerAction({type:`hideTip`,event:`hideTip`,update:`tooltip:manuallyHideTip`},Lo)}var gH=H;function _H(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function vH(e,t,n){var r={};return gH(t,function(t){var a=r[t]=i();gH(e[t],function(e,r){if(az.isValidType(r)){var i={type:r,visual:e};n&&n(i,t),a[r]=new az(i),r===`opacity`&&(i=B(i),i.type=`colorAlpha`,a.__hidden.__alphaForOpacity=new az(i))}})}),r;function i(){var e=function(){};return e.prototype.__hidden=e.prototype,new e}}function yH(e,t,n){var r;H(n,function(e){t.hasOwnProperty(e)&&_H(t[e])&&(r=!0)}),r&&H(n,function(n){t.hasOwnProperty(n)&&_H(t[n])?e[n]=B(t[n]):delete e[n]})}function bH(e,t,n,r){var i={};return H(e,function(e){i[e]=az.prepareVisualTypes(t[e])}),{progress:function(e,a){var o;r!=null&&(o=a.getDimensionIndex(r));function s(e){return VN(a,l,e)}function c(e,t){UN(a,l,e,t)}for(var l,u=a.getStore();(l=e.next())!=null;){var d=a.getRawDataItem(l);if(!(d&&d.visualMap===!1))for(var f=r==null?l:u.get(o,l),p=n(f),m=t[p],h=i[p],g=0,_=h.length;g<_;g++){var v=h[g];m[v]&&m[v].applyVisual(f,s,c)}}}}}var xH=function(e,t){if(t===`all`)return{type:`all`,title:e.getLocaleModel().get([`legend`,`selector`,`all`])};if(t===`inverse`)return{type:`inverse`,title:e.getLocaleModel().get([`legend`,`selector`,`inverse`])}},SH=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode={type:`box`,ignoreSize:!0},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n),e.selected=e.selected||{},this._updateSelector(e)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),this._updateSelector(t)},t.prototype._updateSelector=function(e){var t=e.selector,n=this.ecModel;t===!0&&(t=e.selector=[`all`,`inverse`]),G(t)&&H(t,function(e,r){q(e)&&(e={type:e}),t[r]=eo(e,xH(n,e.type))})},t.prototype.optionUpdated=function(){this._updateData(this.ecModel);var e=this._data;if(e[0]&&this.get(`selectedMode`)===`single`){for(var t=!1,n=0;n=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,bottom:Q.size.m,align:`auto`,backgroundColor:Q.color.transparent,borderColor:Q.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:Q.color.disabled,inactiveBorderColor:Q.color.disabled,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:Q.color.disabled,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:Q.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:Q.color.tertiary,borderWidth:1,borderColor:Q.color.border},emphasis:{selectorLabel:{show:!0,color:Q.color.quaternary}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(hC),CH=po,wH=H,TH=qg,EH=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new TH),this.group.add(this._selectorGroup=new TH),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);(!i||i===`auto`)&&(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=cC(e,n).refContainer,l=e.getBoxLayoutParams(),u=e.get(`padding`),d=aC(l,c,u),f=this.layoutInner(e,i,d,r,o,s),p=aC(no({width:f.width,height:f.height},l),c,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=LV(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=X(),l=t.get(`selectedMode`),u=t.get(`triggerEvent`),d=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&d.push(e.id)}),wH(t.getData(),function(i,a){var o=this,f=i.get(`name`);if(!this.newlineDisabled&&(f===``||f===` -`)){var p=new TH;p.newline=!0,s.add(p);return}var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,CH(kH,f,null,r,d)).on(`mouseover`,CH(AH,m.name,null,r,d)).on(`mouseout`,CH(jH,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=rh(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=Kl(h.fill);_&&_[3]===0&&(_[3]=.2,h=V(V({},h),{fill:eu(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,CH(kH,null,f,r,d)).on(`mouseover`,CH(AH,null,f,r,d)).on(`mouseout`,CH(jH,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=rh(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};rh(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();wH(e,function(e){var r=e.type,i=new Zf({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),ey(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),fg(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=DH(c,r,o,s,d,m,u),y=new TH,b=r.getModel(`textStyle`);if(K(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(OH({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;q(w)&&w?T=w.replace(`{name}`,t??``):K(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new Zf({style:ny(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new Kf({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&Iv({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),fg(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();rC(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){rC(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(aN);function DH(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),wH(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:BP(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function OH(e){var t=e.icon||`roundRect`,n=Nw(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=Q.color.neutral00,n.style.lineWidth=2),n}function kH(e,t,n,r){jH(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),AH(e,t,n,r)}function AH(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function jH(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function MH(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),NH(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){H(i,function(t,n){e[t?`select`:`unSelect`](n)}),NH(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function NH(e,t){var n=t||{};return H(e.getData(),function(t){var r=t.get(`name`);if(r!==` -`&&r!==``){var i=e.isSelected(r);n[r]=Io(n,r)?n[r]&&i:i}}),n}function PH(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,po(MH,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,po(MH,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,po(MH,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,po(MH,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,po(MH,`unSelect`))}var FH=nh(IH);function IH(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;nn[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=Y(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new Kf({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&X_(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;H([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,q(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=VH[i],o=HH[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(EH);function WH(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function GH(e){EI(LH),e.registerComponentModel(RH),e.registerComponentView(UH),WH(e)}function KH(e){EI(LH),EI(GH)}var qH={get:function(e,t,n){var r=B((JH[e]||{})[t]);return n&&G(r)?r[r.length-1]:r}},JH={color:{active:[`#006edd`,`#e0ffff`],inactive:[Q.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},YH=az.mapVisual,XH=az.eachVisual,ZH=G,QH=H,$H=Mp,eU=Tp,tU=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&yH(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=W(e,this),this.controllerVisuals=vH(this.option.controller,t,e),this.targetVisuals=vH(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return QH(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=Nm(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return U(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){H(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],G(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);if(q(o))return o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c);if(K(o))return s?o(e[0],e[1]):o(e);if(s)return e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1];return c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=$H([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=lo(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};eo(r,n),eo(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){ZH(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},QH(r,function(e,t){if(az.isValidType(t)){var n=qH.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;QH(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&B(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&B(n)||(a?s[0]:[s[0],s[0]])),c.symbol=YH(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;XH(l,function(e){e>u&&(u=e)}),c.symbolSize=YH(l,function(e){return eU(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:Q.color.transparent,borderColor:Q.color.borderTint,contentColor:Q.color.theme[0],inactiveColor:Q.color.disabled,borderWidth:0,padding:Q.size.m,textGap:10,precision:0,textStyle:{color:Q.color.secondary}},t}(hC),nU=[20,140],rU=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(e){e.mappingMethod=`linear`,e.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=nU[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=nU[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):G(t)&&(t[0]>t[1]&&t.reverse(),t[0]=Math.max(t[0],e[0]),t[1]=Math.min(t[1],e[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),H(this.stateList,function(e){var t=this.option.controller[e].symbolSize;t&&t[0]!==t[1]&&(t[0]=t[1]/3)},this)},t.prototype.setSelected=function(e){this.option.range=e.slice(),this._resetRange()},t.prototype.getSelected=function(){var e=this.getExtent(),t=Mp((this.get(`range`)||[]).slice());return t[0]>e[1]&&(t[0]=e[1]),t[1]>e[1]&&(t[1]=e[1]),t[0]=n[1]||e<=t[1])?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[];return this.eachTargetSeries(function(n){var r=[],i=n.getData();i.each(this.getDataDimensionIndex(i),function(t,n){e[0]<=t&&t<=e[1]&&r.push(n)},this),t.push({seriesId:n.id,dataIndex:r})},this),t},t.prototype.getVisualMeta=function(e){var t=iU(this,`outOfRange`,this.getExtent()),n=iU(this,`inRange`,this.option.range.slice()),r=[];function i(t,n){r.push({value:t,color:e(t,n)})}for(var a=0,o=0,s=n.length,c=t.length;oe[1])break;r.push({color:this.getControllerVisual(o,`color`,t),offset:a/n})}return r.push({color:this.getControllerVisual(e[1],`color`,t),offset:1}),r},t.prototype._createBarPoints=function(e,t){var n=this.visualMapModel.itemSize;return[[n[0]-t[0],e[0]],[n[0],e[0]],[n[0],e[1]],[n[0]-t[1],e[1]]]},t.prototype._createBarGroup=function(e){var t=this._orient,n=this.visualMapModel.get(`inverse`);return new qg(t===`horizontal`&&!n?{scaleX:e===`bottom`?1:-1,rotation:Math.PI/2}:t===`horizontal`&&n?{scaleX:e===`bottom`?-1:1,rotation:-Math.PI/2}:t===`vertical`&&!n?{scaleX:e===`left`?1:-1,scaleY:-1}:{scaleX:e===`left`?1:-1})},t.prototype._updateHandle=function(e,t){if(this._useHandle){var n=this._shapes,r=this.visualMapModel,i=n.handleThumbs,a=n.handleLabels,o=r.itemSize,s=r.getExtent(),c=this._applyTransform(`left`,n.mainGroup);uU([0,1],function(l){var u=i[l];u.setStyle(`fill`,t.handlesColor[l]),u.y=e[l];var d=lU(e[l],[0,o[1]],s,!0),f=this.getControllerVisual(d,`symbolSize`);u.scaleX=u.scaleY=f/o[0],u.x=o[0]-f/2;var p=xv(n.handleLabelPoints[l],bv(u,this.group));if(this._orient===`horizontal`){var m=c===`left`||c===`top`?(o[0]-f)/2:(o[0]-f)/-2;p[1]+=m}a[l].setStyle({x:p[0],y:p[1],text:r.formatValueText(this._dataInterval[l]),verticalAlign:`middle`,align:this._orient===`vertical`?this._applyTransform(`left`,n.mainGroup):`center`})},this)}},t.prototype._showIndicator=function(e,t,n,r){var i=this.visualMapModel,a=i.getExtent(),o=i.itemSize,s=[0,o[1]],c=this._shapes,l=c.indicator;if(l){l.attr(`invisible`,!1);var u=this.getControllerVisual(e,`color`,{convertOpacityToAlpha:!0}),d=this.getControllerVisual(e,`symbolSize`),f=lU(e,a,s,!0),p=o[0]-d/2,m={x:l.x,y:l.y};l.y=f,l.x=p;var h=xv(c.indicatorLabelPoint,bv(l,this.group)),g=c.indicatorLabel;g.attr(`invisible`,!1);var _=this._applyTransform(`left`,c.mainGroup),v=this._orient===`horizontal`;g.setStyle({text:(n||``)+i.formatValueText(t),verticalAlign:v?_:`middle`,align:v?`center`:_});var y={x:p,y:f,style:{fill:u}},b={style:{x:h[0],y:h[1]}};if(i.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var x={duration:100,easing:`cubicInOut`,additive:!0};l.x=m.x,l.y=m.y,l.animateTo(y,x),g.animateTo(b,x)}else l.attr(y),g.attr(b);this._firstShowIndicator=!1;var S=this._shapes.handleLabels;if(S)for(var C=0;Ci[1]&&(l[1]=1/0),t&&(l[0]===-1/0?this._showIndicator(c,l[1],`< `,o):l[1]===1/0?this._showIndicator(c,l[0],`> `,o):this._showIndicator(c,c,`≈ `,o));var u=this._hoverLinkDataIndices,d=[];(t||vU(n))&&(d=this._hoverLinkDataIndices=n.findTargetDataIndices(l));var f=Em(u,d);this._dispatchHighDown(`downplay`,cU(f[0],n)),this._dispatchHighDown(`highlight`,cU(f[1],n))}},t.prototype._hoverLinkFromSeriesMouseOver=function(e){var t;if(WN(e.target,function(e){var n=rh(e);if(n.dataIndex!=null)return t=n,!0},!0),t){var n=this.ecModel.getSeriesByIndex(t.seriesIndex),r=this.visualMapModel;if(r.isTargetSeries(n)){var i=n.getData(t.dataType),a=i.getStore().get(r.getDataDimensionIndex(i),t.dataIndex);isNaN(a)||this._showIndicator(a,a)}}},t.prototype._hideIndicator=function(){var e=this._shapes;e.indicator&&e.indicator.attr(`invisible`,!0),e.indicatorLabel&&e.indicatorLabel.attr(`invisible`,!0);var t=this._shapes.handleLabels;if(t)for(var n=0;n=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function CU(e,t,n,r){for(var i=t.targetVisuals[r],a=az.prepareVisualTypes(i),o={color:HN(e.getData(),`color`)},s=0,c=a.length;s0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(bU,xU),H(SU,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(TU))}function kU(e){e.registerComponentModel(rU),e.registerComponentView(hU),OU(e)}var AU=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],jU[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=B(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=U(this._pieceList,function(e){return e=B(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=az.listVisualTypes(),i=this.isCategory();H(t.pieces,function(e){H(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),H(n,function(e,n){var r=!1;H(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&H(this.stateList,function(e){(t[e]||(t[e]={}))[n]=qH.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,H(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;H(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=B(e)},t.prototype.getValueState=function(e){var t=az.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){az.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return H(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=Ax(tU.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(tU),jU={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}};function MU(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var NU=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=xo(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),H(o.viewPieceList,function(o){var s=o.piece,u=new qg;u.onclick=W(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new Zf({style:ny(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:Y(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),rC(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:cU(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return sU(e,this.api,e.itemSize);var n=t.align;return(!n||n===`auto`)&&(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new qg,o=this.visualMapModel.textStyleModel;a.add(new Zf({style:ny(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=U(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=Nw(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=B(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,H(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(aU);function PU(e){e.registerComponentModel(AU),e.registerComponentView(NU),OU(e)}function FU(e){EI(kU),EI(PU)}var IU={label:{enabled:!0},decal:{show:!1}},LU=Om(),RU=Om(),zU=nh(BU);function BU(e,t){var n=e.getModel(`aria`);if(!n.get(`enabled`))return;var r=RU(e).scope||(RU(e).scope={}),i=B(IU);eo(i.label,e.getLocaleModel().get(`aria`),!1),eo(n.option,i,!1),a(),o();function a(){if(n.getModel(`decal`).get(`show`)){var t=X();e.eachSeries(function(e){e.isColorBySeries()||(LU(e).scope=t.get(e.type)||t.set(e.type,{}))}),e.eachSeries(function(t){if(K(t.enableAriaDecal)){t.enableAriaDecal();return}var n=t.getData();if(t.isColorBySeries()){var i=bC(t.ecModel,t.name,r,e.getSeriesCount()),a=n.getVisual(`decal`);n.setVisual(`decal`,u(a,i))}else{var o=t.getRawData(),s={},c=LU(t).scope;n.each(function(e){var t=n.getRawIndex(e);s[t]=e});var l=o.count();o.each(function(e){var r=s[e],i=o.getName(e)||e+``,a=bC(t.ecModel,i,c,l),d=n.getItemVisual(r,`decal`);n.setItemVisual(r,`decal`,u(d,a))})}function u(e,t){var n=e?V(V({},t),e):t;return n.dirty=!0,n}})}}function o(){var r=t.getZr().dom;if(r){var i=e.getLocaleModel().get(`aria`),a=n.getModel(`label`);if(a.option=no(a.option,i),a.get(`enabled`)){if(r.setAttribute(`role`,`img`),a.get(`description`)){r.setAttribute(`aria-label`,a.get(`description`));return}var o=e.getSeriesCount(),u=a.get([`data`,`maxCount`])||10,d=a.get([`series`,`maxCount`])||10,f=Math.min(o,d),p;if(!(o<1)){var m=c();p=m?s(a.get([`general`,`withTitle`]),{title:m}):a.get([`general`,`withoutTitle`]);var h=[],g=o>1?a.get([`series`,`multiple`,`prefix`]):a.get([`series`,`single`,`prefix`]);p+=s(g,{seriesCount:o}),e.eachSeries(function(e,t){if(t1?a.get([`series`,`multiple`,r]):a.get([`series`,`single`,r]),n=s(n,{seriesId:e.seriesIndex,seriesName:e.get(`name`),seriesType:l(e.subType)});var i=e.getData();if(i.count()>u){var c=a.get([`data`,`partialData`]);n+=s(c,{displayCnt:u})}else n+=a.get([`data`,`allData`]);for(var d=a.get([`data`,`separator`,`middle`]),p=a.get([`data`,`separator`,`end`]),m=a.get([`data`,`excludeDimensionId`]),g=[],_=0;_=KU:-c>=KU),f=c>0?c%KU:c%KU+KU,p=!1;p=d?!0:!su(u)&&f>=GU==!!l;var m=e+n*WU(a),h=t+r*UU(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*qU);if(d){var _=1/this._p,v=(l?1:-1)*(KU-_);this._add(`A`,n,r,g,1,+l,e+n*WU(a+v),t+r*UU(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*WU(o),b=t+r*UU(o);this._add(`A`,n,r,g,+p,+l,y,b)}},e.prototype.rect=function(e,t,n,r){this._add(`M`,e,t),this._add(`l`,n,0),this._add(`l`,0,r),this._add(`l`,-n,0),this._add(`Z`)},e.prototype.closePath=function(){this._d.length>0&&this._add(`Z`)},e.prototype._add=function(e,t,n,r,i,a,o,s,c){for(var l=[],u=this._p,d=1;d`}function uW(e){return``}function dW(e,t){t||={};var n=t.newline?` -`:``;function r(e){var t=e.children,i=e.tag,a=e.attrs,o=e.text;return lW(i,a)+(i===`style`?o||``:Wx(o))+(t?``+n+U(t,function(e){return r(e)}).join(n)+n:``)+uW(i)}return r(e)}function fW(e,t,n){n||={};var r=n.newline?` -`:``,i=` {`+r,a=r+`}`,o=U(uo(e),function(t){return t+i+U(uo(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=U(uo(t),function(e){return`@keyframes `+e+i+U(uo(t[e]),function(n){return n+i+U(uo(t[e][n]),function(r){var i=t[e][n][r];return r===`d`&&(i=`path("`+i+`")`),r+`:`+i+`;`}).join(r)+a}).join(r)+a}).join(r);return!o&&!s?``:[``].join(r)}function pW(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function mW(e,t,n,r){return cW(`svg`,`root`,{width:e,height:t,xmlns:nW,"xmlns:xlink":rW,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var hW=0;function gW(){return hW++}var _W={cubicIn:`0.32,0,0.67,0`,cubicOut:`0.33,1,0.68,1`,cubicInOut:`0.65,0,0.35,1`,quadraticIn:`0.11,0,0.5,0`,quadraticOut:`0.5,1,0.89,1`,quadraticInOut:`0.45,0,0.55,1`,quarticIn:`0.5,0,0.75,0`,quarticOut:`0.25,1,0.5,1`,quarticInOut:`0.76,0,0.24,1`,quinticIn:`0.64,0,0.78,0`,quinticOut:`0.22,1,0.36,1`,quinticInOut:`0.83,0,0.17,1`,sinusoidalIn:`0.12,0,0.39,0`,sinusoidalOut:`0.61,1,0.88,1`,sinusoidalInOut:`0.37,0,0.63,1`,exponentialIn:`0.7,0,0.84,0`,exponentialOut:`0.16,1,0.3,1`,exponentialInOut:`0.87,0,0.13,1`,circularIn:`0.55,0,1,0.45`,circularOut:`0,0.55,0.45,1`,circularInOut:`0.85,0,0.15,1`},vW=`transform-origin`;function yW(e,t,n){var r=V({},e.shape);V(r,t),e.buildPath(n,r);var i=new JU;return i.reset(Su(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function bW(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[vW]=n+`px `+r+`px`)}var xW={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function SW(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function CW(e,t,n){var r=e.shape.paths,i={},a,o;if(H(r,function(e){var t=pW(n.zrId);t.animation=!0,TW(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=uo(r),l=c.length;if(l){o=c[l-1];var u=r[o];for(var d in u){var f=u[d];i[d]=i[d]||{d:``},i[d].d+=f.d||``}for(var p in s){var m=s[p].animation;m.indexOf(o)>=0&&(a=m)}}}),a){t.d=!1;var s=SW(i,n);return a.replace(o,s)}}function wW(e){return q(e)?_W[e]?`cubic-bezier(`+_W[e]+`)`:jl(e)?e:``:``}function TW(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof M_){var s=CW(e,t,n);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var c={},l=0;l0}).length)return SW(l,n)+` `+i[0]+` both`}for(var g in c){var s=h(c[g]);s&&o.push(s)}if(o.length){var _=n.zrId+`-cls-`+gW();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function EW(e,t,n){if(!e.ignore){if(e.isSilent()){var r={"pointer-events":`none`};DW(r,t,n,!0)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,c=e.currentStates.indexOf(`select`)>=0&&s||o;c&&(a=ru(c))}var l=i.lineWidth;if(l){var u=!i.strokeNoScale&&e.transform?e.transform[0]:1;l/=u}var r={cursor:`pointer`};a&&(r.fill=a),i.stroke&&(r.stroke=i.stroke),l&&(r[`stroke-width`]=l),DW(r,t,n,!0)}}}function DW(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+gW(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var OW=Math.round;function kW(e){return e&&q(e.src)}function AW(e){return e&&K(e.toDataURL)}function jW(e,t,n,r){tW(function(i,a){var o=i===`fill`||i===`stroke`;o&&bu(a)?KW(t,e,i,r):o&&_u(a)?qW(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),GW(n,e,r)}function MW(e,t){var n=oM(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[oW+`silent`]=`true`))}function NW(e){return su(e[0]-1)&&su(e[1])&&su(e[2])&&su(e[3]-1)}function PW(e){return su(e[4])&&su(e[5])}function FW(e,t,n){if(t&&!(PW(t)&&NW(t))){var r=n?10:1e4;e.transform=NW(t)?`translate(`+OW(t[4]*r)/r+` `+OW(t[5]*r)/r+`)`:uu(t)}}function IW(e,t,n){for(var r=e.points,i=[],a=0;a`u`){var g=`Image width/height must been given explictly in svg-ssr renderer.`;To(f,g),To(p,g)}else if(f==null||p==null){var _=function(e,t){if(e){var n=e.elm,r=f||t.width,i=p||t.height;e.tag===`pattern`&&(l?(i=1,r/=a.width):u&&(r=1,i/=a.height)),e.attrs.width=r,e.attrs.height=i,n&&(n.setAttribute(`width`,r),n.setAttribute(`height`,i))}},v=us(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=cW(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=B(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(d){var y,b;c?y=b=1:l?(b=1,y=o.width/a.width):u?(y=1,b=o.height/a.height):o.patternUnits=`userSpaceOnUse`,y!=null&&!isNaN(y)&&(o.width=y),b!=null&&!isNaN(b)&&(o.height=b);var x=Cu(i);x&&(o.patternTransform=x);var S=cW(`pattern`,``,o,[d]),C=dW(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=cW(`pattern`,T,o,[d])),t[n]=xu(T)}}function JW(e,t,n){var r=n.clipPathCache,i=n.defs,a=r[e.id];if(!a){a=n.zrId+`-c`+n.clipPathIdx++;var o={id:a};r[e.id]=a,i[a]=cW(`clipPath`,a,o,[VW(e,n)])}t[`clip-path`]=xu(a)}function YW(e){return document.createTextNode(e)}function XW(e,t,n){e.insertBefore(t,n)}function ZW(e,t){e.removeChild(t)}function QW(e,t){e.appendChild(t)}function $W(e){return e.parentNode}function eG(e){return e.nextSibling}function tG(e,t){e.textContent=t}var nG=58,rG=120,iG=cW(``,``);function aG(e){return e===void 0}function oG(e){return e!==void 0}function sG(e,t,n){for(var r={},i=t;i<=n;++i){var a=e[i].key;a!==void 0&&(r[a]=i)}return r}function cG(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function lG(e){var t,n=e.children,r=e.tag;if(oG(r)){var i=e.elm=sW(r);if(fG(iG,e),G(n))for(t=0;ta?(m=n[c+1]==null?null:n[c+1].elm,uG(e,m,n,i,c)):dG(e,t,r,a))}function mG(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(fG(e,t),aG(t.text)?oG(r)&&oG(i)?r!==i&&pG(n,r,i):oG(i)?(oG(e.text)&&tG(n,``),uG(n,null,i,0,i.length-1)):oG(r)?dG(n,r,0,r.length-1):oG(e.text)&&tG(n,``):e.text!==t.text&&(oG(r)&&dG(n,r,0,r.length-1),tG(n,t.text)))}function hG(e,t){if(cG(e,t))mG(e,t);else{var n=e.elm,r=$W(n);lG(t),r!==null&&(XW(r,t.elm,eG(n)),dG(r,[e],0,0))}return t}var gG=0,_G=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=vG(`configLayer`),this.storage=t,this._opts=n=V({},n),this.root=e,this._id=`zr`+gG++,this._oldVNode=mW(n.width,n.height),e&&!n.ssr){var r=this._viewport=document.createElement(`div`);r.style.cssText=`position:relative;overflow:hidden`;var i=this._svgDom=this._oldVNode.elm=sW(`svg`);fG(null,this._oldVNode),r.appendChild(i),e.appendChild(r)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style=`position:absolute;left:0;top:0;user-select:none`,hG(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return WW(e,pW(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=pW(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var a=[],o=this._bgVNode=yG(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=cW(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=U(uo(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(cW(`defs`,`defs`,{},c)),e.animation){var l=fW(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=cW(`style`,`stl`,{},[],l);a.push(u)}}return mW(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},dW(this.renderToVNode({animation:Y(e.cssAnimation,!0),emphasis:Y(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Y(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var r=e.length,i=[],a=0,o,s,c=0,l=0;l=0&&!(d&&s&&d[m]===s[m]);m--);for(var h=p-1;h>m;h--)a--,o=i[a-1];for(var g=m+1;g{if(!a.current)return;let e=oI(a.current,void 0,{renderer:`svg`});o.current=e,e.on(`click`,e=>s.current?.(e));let t=new ResizeObserver(()=>e.resize());return t.observe(a.current),()=>{t.disconnect(),e.dispose(),o.current=null}},[]),(0,L.useEffect)(()=>{o.current?.setOption({animationDuration:280,aria:{enabled:!0,decal:{show:!0},description:n},...e},{notMerge:!0})},[n,e]),(0,R.jsx)(`div`,{ref:a,className:i?`echart ${i}`:`echart`,style:{height:t,width:`100%`,minWidth:0},role:`img`,"aria-label":n})}function SG(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function CG(e){return Ne[e?`dark`:`light`]}function wG(e){let t=e?5:7;return{ok:Ve[t],warn:He[t],bad:Le[t],info:Re[t]}}function TG(e,t){let n=Te[t?`dark`:`light`],r=0;for(let t of e)r=r*31+t.charCodeAt(0)|0;return n[Math.abs(r)%n.length]}function EG(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function DG(e){return e===`unknown`?`dashed`:`solid`}function OG(e){return e===`unhealthy`?1.25:e===`degraded`?.91:1}function kG(e){let t=String(e).toUpperCase();return t===`ERROR`||t===`FATAL`?`bad`:t===`WARN`||t===`WARNING`?`warn`:t===`INFO`?`info`:`gray`}function AG(e,t){let n=wG(t),r=String(e).toUpperCase();return r===`ERROR`||r===`FATAL`?n.bad:r===`WARN`||r===`WARNING`?n.warn:r===`INFO`?n.info:CG(t).muted}function jG({label:e,value:t,color:n,hint:r,children:i}){return(0,R.jsxs)(ce,{withBorder:!0,radius:`md`,p:`sm`,bg:`var(--mantine-color-default)`,miw:0,h:`100%`,children:[(0,R.jsx)(y,{c:`dimmed`,size:`xs`,truncate:!0,children:e}),(0,R.jsx)(y,{fw:600,fz:`xl`,c:n,mt:2,lh:1.2,truncate:!0,children:t}),r&&(0,R.jsx)(y,{c:`dimmed`,size:`xs`,mt:2,truncate:!0,children:r}),i&&(0,R.jsx)(se,{mt:4,children:i})]})}var MG={unhealthy:`◆`,degraded:`■`,healthy:`●`,unknown:`○`},NG={unhealthy:`unhealthy`,degraded:`degraded`,healthy:`healthy`,unknown:`health unknown`};function PG({health:e,label:t}){return(0,R.jsxs)(de,{color:SG(e),variant:`light`,tt:`none`,style:{minWidth:`max-content`},leftSection:(0,R.jsx)(se,{component:`span`,"aria-hidden":!0,style:{fontSize:Fe.micro,lineHeight:1},children:MG[e]??MG.unknown}),children:[t,(0,R.jsxs)(Ee,{children:[` — `,NG[e]??NG.unknown]})]})}function FG({text:e}){return(0,R.jsxs)(A,{py:`xl`,children:[(0,R.jsx)(In,{size:20}),(0,R.jsx)(y,{c:`dimmed`,size:`sm`,ml:`xs`,children:e})]})}function IG({retry:e}){return(0,R.jsxs)(A,{py:`xl`,style:{flexDirection:`column`,gap:8},children:[(0,R.jsxs)(se,{display:`flex`,style:{alignItems:`center`,gap:8},children:[(0,R.jsx)(Bn,{size:20,weight:`fill`,color:`var(--mantine-color-bad-filled)`}),(0,R.jsx)(y,{c:`bad`,fw:500,size:`sm`,children:`Couldn't load this view`})]}),(0,R.jsx)(ae,{size:`compact-xs`,variant:`light`,color:`bad`,onClick:e,children:`Retry now`}),(0,R.jsx)(y,{c:`dimmed`,size:`xs`,children:`Retrying automatically`})]})}EI([aD]);function LG({values:e,color:t,label:n,format:r}){let i=e.length?Math.max(...e):0,a=(0,L.useMemo)(()=>({animation:!1,grid:{left:0,right:0,top:2,bottom:2},xAxis:{type:`category`,show:!1,data:e.map((e,t)=>t)},yAxis:{type:`value`,show:!1,min:0},tooltip:{show:!1},aria:{enabled:!0,decal:{show:!1},description:n},series:[{type:`line`,data:e,showSymbol:!1,smooth:.3,lineStyle:{width:1.5,color:t},areaStyle:{opacity:.12,color:t}}]}),[e,t,n]);return(0,R.jsxs)(se,{children:[(0,R.jsx)(xG,{option:a,height:28,label:n}),i>0&&r&&(0,R.jsxs)(y,{c:`dimmed`,size:`xs`,ta:`right`,mt:2,children:[`peak `,r(i)]})]})}var RG={unhealthy:0,degraded:1,healthy:2};function zG({widget:e,filters:t,agentAvailable:n,onOpenChat:r}){let i=Me(`overview`,Ae(t,e.config,[`service`]));if(i.isError)return(0,R.jsx)(IG,{retry:()=>void i.refetch()});let a=[...i.data?.data.services??[]].sort((e,t)=>(RG[e.health]??3)-(RG[t.health]??3)||t.error_rate-e.error_rate);if(i.data&&a.length===0)return(0,R.jsx)(FG,{text:`No recent activity`});let o=e=>r(`Investigate the ${e} service. Explain its errors and latency.`);return(0,R.jsx)(Qe,{type:`auto`,offsetScrollbars:!0,h:`100%`,children:(0,R.jsxs)(rt,{verticalSpacing:`xs`,fz:`sm`,highlightOnHover:n,children:[(0,R.jsx)(rt.Thead,{children:(0,R.jsxs)(rt.Tr,{children:[(0,R.jsx)(rt.Th,{children:`Service`}),(0,R.jsx)(rt.Th,{ta:`right`,children:`P95`}),(0,R.jsx)(rt.Th,{ta:`right`,children:`Errors`})]})}),(0,R.jsx)(rt.Tbody,{children:a.map(e=>(0,R.jsxs)(rt.Tr,{...n&&{onClick:()=>o(e.service),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e.service))},tabIndex:0,role:`button`,"aria-label":`Investigate ${e.service}`,style:{cursor:`pointer`}},children:[(0,R.jsx)(rt.Td,{children:(0,R.jsx)(PG,{health:e.health,label:e.service})}),(0,R.jsx)(rt.Td,{ta:`right`,children:(0,R.jsx)(y,{component:`span`,size:`sm`,ff:`monospace`,c:ka(e.p95_ms),children:Da(e.p95_ms)})}),(0,R.jsx)(rt.Td,{ta:`right`,children:(0,R.jsx)(y,{component:`span`,size:`sm`,c:Aa(e.error_rate),children:Ea(e.error_rate)})})]},e.service))})]})})}function BG({filters:e,agentAvailable:t,onOpenChat:n}){if(!t)return(0,R.jsx)(y,{c:`dimmed`,size:`sm`,children:`Configure an AI provider to enable this view. The rest of this dashboard remains available.`});let r=Ce(e.window),i=[`Summarize the last ${r}`,`What changed in the last ${r}?`,`Which service needs attention right now?`];return(0,R.jsx)(re,{gap:`xs`,align:`flex-start`,children:i.map(e=>(0,R.jsx)(ae,{variant:`default`,size:`xs`,radius:`xl`,leftSection:(0,R.jsx)(fe,{size:13,weight:`fill`}),onClick:()=>n(e),children:e},e))})}var VG={overview:[`service`],topology:[`service`],performance:[`service`],logs:[`service`,`severity`,`search`],trace:[`trace_id`,`service`]};function HG(e){return Object.hasOwn(VG,e)?VG[e]:void 0}function UG(e){return(HG(e)?.length??0)>0}function WG({opened:e,widget:t,services:n,onClose:r,onSave:i}){let[a,o]=(0,L.useState)({service:``,severity:``,search:``,trace_id:``});(0,L.useEffect)(()=>{e&&o({service:Oe(t.config,`service`),severity:Oe(t.config,`severity`),search:Oe(t.config,`search`),trace_id:Oe(t.config,`trace_id`)})},[e,t.config]);let s=HG(t.type)??[],c=[...new Set([...n,a.service].filter(Boolean))];function l(){let e={...t.config??{}};for(let t of s){let n=a[t].trim();n?e[t]=n:delete e[t]}i(e),r()}return(0,R.jsx)(Se,{opened:e,onClose:r,title:`Configure ${t.title}`,centered:!0,children:(0,R.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),l()},children:(0,R.jsxs)(re,{children:[s.includes(`service`)&&(0,R.jsx)(mn,{label:`Service`,placeholder:`All services`,data:c,value:a.service||null,onChange:e=>o({...a,service:e??``}),clearable:!0,searchable:!0,"aria-label":`Service`}),s.includes(`severity`)&&(0,R.jsx)(mn,{label:`Severity`,placeholder:`All severities`,data:[`ERROR`,`WARN`,`INFO`,`DEBUG`],value:a.severity||null,onChange:e=>o({...a,severity:e??``}),clearable:!0,"aria-label":`Severity`}),s.includes(`search`)&&(0,R.jsx)(F,{label:`Search`,placeholder:`Text the log body must contain`,value:a.search,onChange:e=>o({...a,search:e.currentTarget.value}),"aria-label":`Search`}),s.includes(`trace_id`)&&(0,R.jsx)(F,{label:`Trace id`,placeholder:`Leave empty for the most relevant recent trace`,value:a.trace_id,onChange:e=>o({...a,trace_id:e.currentTarget.value}),ff:`monospace`,"aria-label":`Trace id`}),(0,R.jsxs)(w,{justify:`flex-end`,children:[(0,R.jsx)(ae,{variant:`default`,onClick:r,children:`Cancel`}),(0,R.jsx)(ae,{type:`submit`,children:`Save`})]})]})})})}EI([LA]);function GG({widget:e,filters:t,dark:n}){let r=Me(`logs`,Ae(t,e.config,[`service`,`severity`,`search`])),i=r.data,a=(0,L.useMemo)(()=>{if(!i||i.data.buckets.length===0)return null;let e=CG(n),t=i.provenance.window,r=[...new Set(i.data.buckets.map(e=>e.time))],a=[...new Set(i.data.buckets.map(e=>e.severity))],o=new Map(i.data.buckets.map(e=>[`${e.time} ${e.severity}`,e.count]));return{color:a.map(e=>AG(e,n)),grid:{left:28,right:8,top:8,bottom:20},tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:Fe.micro}},xAxis:{type:`category`,data:r.map(e=>Oa(e,t)),axisLabel:{color:e.muted,fontSize:Fe.micro,hideOverlap:!0},axisLine:{lineStyle:{color:e.border}}},yAxis:{type:`value`,minInterval:1,splitLine:{lineStyle:{color:e.grid}},axisLabel:{color:e.muted,fontSize:Fe.micro}},series:a.map(e=>({name:e,type:`bar`,stack:`logs`,barMaxWidth:14,data:r.map(t=>o.get(`${t} ${e}`)??0),itemStyle:{borderRadius:[2,2,0,0]}}))}},[n,i]);if(r.isError)return(0,R.jsx)(IG,{retry:()=>void r.refetch()});let o=(i?.data.entries??[]).slice(0,5);return i&&o.length===0?(0,R.jsx)(FG,{text:`No matching logs in this window`}):(0,R.jsxs)(re,{gap:`xs`,h:`100%`,children:[a&&(0,R.jsx)(se,{h:72,children:(0,R.jsx)(xG,{option:a,height:72,label:`Log volume by severity`})}),(0,R.jsx)(Qe,{type:`auto`,offsetScrollbars:!0,style:{flex:1},children:(0,R.jsx)(rt,{verticalSpacing:4,fz:`sm`,children:(0,R.jsx)(rt.Tbody,{children:o.map((e,t)=>(0,R.jsxs)(rt.Tr,{children:[(0,R.jsx)(rt.Td,{style:{whiteSpace:`nowrap`},children:(0,R.jsx)(y,{component:`span`,size:`xs`,ff:`monospace`,c:`dimmed`,children:i?Oa(e.time,i.provenance.window,!0):e.time})}),(0,R.jsx)(rt.Td,{style:{whiteSpace:`nowrap`},children:(0,R.jsx)(de,{size:`xs`,color:kG(e.severity),variant:`light`,style:{minWidth:`max-content`},children:e.severity||`LOG`})}),(0,R.jsx)(rt.Td,{style:{whiteSpace:`nowrap`},children:(0,R.jsx)(y,{component:`span`,size:`sm`,fw:600,children:e.service})}),(0,R.jsx)(rt.Td,{style:{width:`100%`},children:(0,R.jsx)(y,{size:`sm`,lineClamp:1,title:e.body,children:e.body})})]},`${e.time}-${t}`))})})})]})}function KG({widget:e,filters:t,dark:n}){let r=Ae(t,e.config,[`service`]),i=Me(`overview`,r),a=Me(`performance`,r);if(i.isError)return(0,R.jsx)(IG,{retry:()=>void i.refetch()});let o=i.data?.data,s=(a.data?.data.points??[]).map(e=>e.error_rate*100),c=Math.max(o?.service_count??0,1),l=wG(n),u=o?.health===`unknown`,d=o?u?`No data`:o.health.charAt(0).toUpperCase()+o.health.slice(1):`—`;return(0,R.jsxs)(re,{gap:`sm`,children:[(0,R.jsxs)(Cn,{cols:2,spacing:`sm`,children:[(0,R.jsx)(jG,{label:`Health`,value:d,color:o?SG(o.health):void 0,hint:o?u?`No telemetry in this window`:`${Ta.format(o.service_count)} services`:void 0}),(0,R.jsx)(jG,{label:`Error rate`,value:o&&!u?Ea(o.error_rate):`—`,color:o&&o.error_rate>=.01?`bad`:void 0,hint:o&&!u?`${Ta.format(o.total_spans)} operations`:void 0,children:s.length>1&&(0,R.jsx)(LG,{values:s,color:l.bad,label:`Error rate trend`,format:e=>`${e.toFixed(2)}%`})})]}),o&&!u&&(0,R.jsxs)(se,{children:[(0,R.jsxs)(fn.Root,{size:`md`,"aria-label":`Service health distribution`,children:[(0,R.jsx)(fn.Section,{value:o.counts.healthy/c*100,color:`ok`}),(0,R.jsx)(fn.Section,{value:o.counts.degraded/c*100,color:`warn`}),(0,R.jsx)(fn.Section,{value:o.counts.unhealthy/c*100,color:`bad`})]}),(0,R.jsxs)(w,{mt:6,gap:`md`,children:[(0,R.jsx)(qG,{color:`ok`,text:`${o.counts.healthy} healthy`}),(0,R.jsx)(qG,{color:`warn`,text:`${o.counts.degraded} degraded`}),(0,R.jsx)(qG,{color:`bad`,text:`${o.counts.unhealthy} unhealthy`})]})]})]})}function qG({color:e,text:t}){return(0,R.jsxs)(w,{gap:6,children:[(0,R.jsx)(se,{w:8,h:8,bg:e,style:{borderRadius:`50%`}}),(0,R.jsx)(y,{c:`dimmed`,size:`xs`,children:t})]})}EI([aD]);function JG({widget:e,filters:t,dark:n}){let r=Me(`performance`,Ae(t,e.config,[`service`])),i=r.data,a=(0,L.useMemo)(()=>{if(!i||i.data.points.length===0)return null;let e=CG(n),t=i.provenance.window;return{color:[TG(`operations`,n),wG(n).warn],grid:{left:36,right:40,top:24,bottom:22},legend:{top:0,left:0,textStyle:{color:e.muted,fontSize:Fe.micro},icon:`circle`,itemWidth:7,itemHeight:7},tooltip:{trigger:`axis`,backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:Fe.micro}},xAxis:{type:`category`,data:i.data.points.map(e=>Oa(e.time,t)),boundaryGap:!1,axisLine:{lineStyle:{color:e.border}},axisTick:{show:!1},axisLabel:{color:e.muted,fontSize:Fe.micro,hideOverlap:!0}},yAxis:[{type:`value`,splitLine:{lineStyle:{color:e.grid}},axisLabel:{color:e.muted,fontSize:Fe.micro}},{type:`value`,splitLine:{show:!1},axisLabel:{color:e.muted,fontSize:Fe.micro,formatter:e=>Da(e)}}],series:[{name:`Operations`,type:`line`,data:i.data.points.map(e=>e.spans),smooth:.22,showSymbol:!1,lineStyle:{width:2},areaStyle:{opacity:.05}},{name:`P95`,type:`line`,yAxisIndex:1,data:i.data.points.map(e=>e.p95_ms),smooth:.22,showSymbol:!1,lineStyle:{width:2}}]}},[n,i]);if(r.isError)return(0,R.jsx)(IG,{retry:()=>void r.refetch()});if(i&&i.data.points.length===0)return(0,R.jsx)(FG,{text:`No endpoint activity in this window`});let o=(i?.data.endpoints??[]).slice(0,3);return(0,R.jsxs)(re,{gap:`xs`,h:`100%`,children:[a&&(0,R.jsx)(se,{style:{flex:1,minHeight:120},children:(0,R.jsx)(xG,{option:a,height:`100%`,label:`Operations and P95 latency`})}),o.length>0&&(0,R.jsx)(rt,{verticalSpacing:4,fz:`sm`,children:(0,R.jsx)(rt.Tbody,{children:o.map(e=>(0,R.jsxs)(rt.Tr,{children:[(0,R.jsxs)(rt.Td,{children:[(0,R.jsx)(de,{variant:`light`,size:`xs`,mr:6,style:{minWidth:`max-content`},children:e.method}),(0,R.jsx)(y,{component:`span`,size:`sm`,ff:`monospace`,children:e.path})]}),(0,R.jsx)(rt.Td,{ta:`right`,children:(0,R.jsxs)(y,{component:`span`,size:`sm`,c:`dimmed`,children:[Ta.format(e.calls),` calls`]})}),(0,R.jsx)(rt.Td,{ta:`right`,children:(0,R.jsx)(y,{component:`span`,size:`sm`,ff:`monospace`,children:Da(e.p95_ms)})})]},`${e.method}-${e.path}`))})})]})}EI([RB]);function YG({widget:e,filters:t,dark:n,onOpenChat:r}){let i=Ae(t,e.config,[`service`]),a=Me(`topology`,i),o=a.data?.data,s=(0,L.useMemo)(()=>{if(!o)return null;let e=CG(n),t=wG(n),r=n=>n===`unhealthy`?t.bad:n===`degraded`?t.warn:n===`unknown`?e.muted:t.ok,i=[...o.nodes].sort((e,t)=>e.service.localeCompare(t.service));return{tooltip:{backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:Fe.micro}},series:[{type:`graph`,layout:`circular`,circular:{rotateLabel:!1},roam:!1,draggable:!1,label:{show:!0,position:`bottom`,color:e.text,fontSize:Fe.micro},edgeSymbol:[`none`,`arrow`],edgeSymbolSize:6,data:i.map(t=>({id:t.service,name:t.service,value:t.spans,symbol:EG(t.health),symbolSize:OG(t.health)*Math.min(34,18+Math.log10(Math.max(t.spans,1))*4),itemStyle:{color:e.surface,borderColor:r(t.health),borderWidth:3,borderType:DG(t.health)}})),links:o.edges.map(n=>{let r=n.error_rate>=.05;return{source:n.caller,target:n.callee,value:n.calls,lineStyle:{width:r?3.5:Math.min(3,1+Math.log10(Math.max(n.calls,1))),color:r?t.bad:e.muted,opacity:r?.95:.35,curveness:.08}}}),emphasis:{focus:`adjacency`}}]}},[n,o]);return a.isError?(0,R.jsx)(IG,{retry:()=>void a.refetch()}):o&&o.nodes.length===0?(0,R.jsx)(FG,{text:`No service relationships in this window`}):(0,R.jsxs)(re,{gap:4,h:`100%`,children:[s&&(0,R.jsx)(xG,{option:s,height:`100%`,className:`widget-chart`,label:`Service dependency graph`,onClick:e=>{let t=e;t.dataType===`node`&&t.data?.id&&r(`Investigate the ${t.data.id} service. Explain its errors and latency.`)}}),o&&(0,R.jsxs)(y,{c:`dimmed`,size:`xs`,children:[o.nodes.length,` services · `,o.edges.length,` `,o.edges.length===1?`route`:`routes`]})]})}function XG(e){return e.length>12?`${e.slice(0,8)}…${e.slice(-4)}`:e}function ZG({widget:e,filters:t,dark:n}){let r=Me(`trace`,Ae(t,e.config,[`trace_id`,`service`]));if(r.isError)return(0,R.jsx)(IG,{retry:()=>void r.refetch()});let i=r.data?.data;if(i&&i.spans.length===0)return(0,R.jsx)(FG,{text:`No traces in this window`});let a=[...i?.spans??[]].sort((e,t)=>t.duration_ms-e.duration_ms).slice(0,6);return(0,R.jsxs)(re,{gap:`sm`,children:[(0,R.jsxs)(Cn,{cols:{base:2,sm:4},spacing:`sm`,children:[(0,R.jsx)(jG,{label:`Duration`,value:i?Da(i.duration_ms):`—`}),(0,R.jsx)(jG,{label:`Spans`,value:i?Ta.format(i.spans.length):`—`}),(0,R.jsx)(jG,{label:`Services`,value:i?Ta.format(i.services.length):`—`}),(0,R.jsx)(jG,{label:`Status`,value:i?i.has_error?`Error`:`OK`:`—`,color:i?i.has_error?`bad`:`ok`:void 0})]}),a.length>0&&(0,R.jsx)(QG,{spans:a,dark:n}),i&&(0,R.jsxs)(w,{gap:4,children:[(0,R.jsxs)(y,{c:`dimmed`,size:`xs`,ff:`monospace`,children:[`Trace `,XG(i.trace_id)]}),(0,R.jsx)($G,{value:i.trace_id})]})]})}function QG({spans:e,dark:t}){let n=Math.min(...e.map(e=>new Date(e.start).valueOf())),r=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),i=Math.max(r-n,1);return(0,R.jsx)(re,{gap:4,children:e.map(e=>{let r=(new Date(e.start).valueOf()-n)/i*100,a=Math.max(e.duration_ms/i*100,.6),o=e.status.toUpperCase().includes(`ERROR`);return(0,R.jsxs)(w,{gap:`sm`,wrap:`nowrap`,children:[(0,R.jsxs)(se,{w:170,miw:0,children:[(0,R.jsx)(y,{size:`xs`,fw:600,truncate:!0,children:e.operation}),(0,R.jsx)(y,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]}),(0,R.jsx)(et,{label:`${e.service} · ${e.operation} · ${Da(e.duration_ms)}`,withArrow:!0,children:(0,R.jsx)(se,{pos:`relative`,h:10,flex:1,bg:`var(--mantine-color-default-hover)`,style:{borderRadius:`var(--mantine-radius-sm)`},children:(0,R.jsx)(se,{pos:`absolute`,left:`${r}%`,w:`${Math.min(a,100-r)}%`,h:`100%`,bg:o?`bad`:TG(e.service,t),style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}})})}),(0,R.jsx)(y,{size:`xs`,ff:`monospace`,w:56,ta:`right`,children:Da(e.duration_ms)})]},e.span_id)})})}function $G({value:e}){let{state:t,copy:n}=it();return(0,R.jsx)(et,{label:t===`failed`?`Could not copy`:t===`copied`?`Copied`:`Copy trace id`,children:(0,R.jsx)(tt,{variant:`subtle`,color:`gray`,size:`xs`,"aria-label":`Copy trace id`,"data-state":t===`idle`?void 0:t,onClick:()=>n(e),children:t===`copied`?(0,R.jsx)(E,{size:12,weight:`bold`}):(0,R.jsx)(ne,{size:12})})})}var eK={overview:`System health`,topology:`Service map`,activity:`Recent activity`,assistant:`Ask Fanout`,performance:`Performance`,trace:`Trace focus`,logs:`Logs`},tK={overview:KG,topology:YG,activity:zG,assistant:BG,performance:JG,trace:ZG,logs:GG};function nK(){return(0,R.jsx)(FG,{text:`This view type is not supported by this version`})}function rK(e){return Object.hasOwn(tK,e)?tK[e]:nK}function iK(e){let{widget:t,services:n,onRemove:r,onConfigure:i}=e,[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1),d=rK(t.type);return(0,R.jsxs)(ce,{withBorder:!0,radius:`lg`,p:`md`,h:`100%`,className:`widget-card`,style:{overflow:`hidden`},children:[(0,R.jsxs)(re,{h:`100%`,gap:`sm`,children:[(0,R.jsxs)(w,{justify:`space-between`,align:`center`,wrap:`nowrap`,className:`widget-drag`,style:{cursor:`grab`},children:[(0,R.jsx)(P,{order:2,fz:`md`,fw:500,lineClamp:1,miw:0,children:t.title}),(0,R.jsxs)(_e,{position:`bottom-end`,withinPortal:!0,opened:a,onChange:o,children:[(0,R.jsx)(_e.Target,{children:(0,R.jsx)(tt,{className:`widget-actions`,"data-open":a||void 0,variant:`subtle`,color:`gray`,size:`sm`,"aria-label":`Actions for ${t.title}`,children:(0,R.jsx)(ye,{size:18,weight:`bold`})})}),(0,R.jsxs)(_e.Dropdown,{children:[UG(t.type)&&(0,R.jsx)(_e.Item,{leftSection:(0,R.jsx)(Rn,{size:15}),onClick:()=>c(!0),children:`Configure`}),(0,R.jsx)(_e.Item,{color:`bad`,leftSection:(0,R.jsx)(ve,{size:15}),onClick:()=>u(!0),children:`Remove`})]})]})]}),(0,R.jsx)(`div`,{className:`widget-body`,children:(0,R.jsx)(d,{...e})})]}),(0,R.jsx)(WG,{opened:s,widget:t,services:n,onClose:()=>c(!1),onSave:i}),(0,R.jsx)(Se,{opened:l,onClose:()=>u(!1),title:`Remove ${t.title}?`,centered:!0,radius:`md`,children:(0,R.jsxs)(re,{gap:`md`,children:[(0,R.jsx)(y,{size:`sm`,c:`dimmed`,children:`This takes the card off the dashboard for everyone who opens it. You can add it again from Add view, but its size and settings are not kept.`}),(0,R.jsxs)(w,{justify:`flex-end`,gap:`sm`,children:[(0,R.jsx)(ae,{variant:`default`,size:`sm`,onClick:()=>u(!1),children:`Cancel`}),(0,R.jsx)(ae,{color:`bad`,size:`sm`,onClick:()=>{u(!1),r()},children:`Remove`})]})]})})]})}var aK=va(ga),oK=`fanout.dashboard-id`,sK={layout:[],widgets:[],filters:{window:`1h`,namespace:``}};function cK(e){return Object.hasOwn(Sa,e)?Sa[e]:void 0}function lK({dashboardID:e=``,agentAvailable:t,onOpenChat:n,onDashboardChange:r,urlFilters:i,onFiltersChange:a}){let o=xe(),s=nt(`light`)===`dark`,c=pe({queryKey:qe,queryFn:()=>we(`/api/dashboards`),refetchInterval:3e4}),[l,u]=(0,L.useState)(()=>e||localStorage.getItem(oK)||``),d=Tn({mutationFn:async e=>{if(!f.data)throw Error(`No dashboard selected`);let t=await ue(`/api/dashboards/${encodeURIComponent(f.data.id)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({name:f.data.name,description:f.data.description,state:e})});if(!t.ok)throw Error(`Unable to save dashboard`);return t.json()},scope:{id:`dashboard-${l}`},onSuccess:e=>{o.setQueryData([`dashboard`,e.id],e),o.invalidateQueries({queryKey:qe})},onError:e=>console.error(`Dashboard save failed`,e)}),f=pe({queryKey:[`dashboard`,l],queryFn:()=>we(`/api/dashboards/${encodeURIComponent(l)}`),enabled:!!l,refetchInterval:d.isPending||d.isError?!1:3e4}),[p,m]=(0,L.useState)(sK),[h,g]=(0,L.useState)(`lg`),[_,v]=(0,L.useState)(null),b=(0,L.useMemo)(()=>({window:ze.some(e=>e.value===i?.window)?i.window:p.filters.window,namespace:i?.namespace??p.filters.namespace}),[i?.window,i?.namespace,p.filters.window,p.filters.namespace]),x=Me(`overview`,Ae(b),!!f.data),C=(0,L.useMemo)(()=>(x.data?.data.services??[]).map(e=>e.service),[x.data]),T=Ie();(0,L.useEffect)(()=>{e&&e!==l&&(u(e),localStorage.setItem(oK,e))},[e,l]),(0,L.useEffect)(()=>{let t=c.data?.dashboards;if(t?.length&&!(e&&t.some(t=>t.id===e))&&!e){if(l&&t.some(e=>e.id===l)){r?.(l,!0);return}D((t.find(e=>e.is_default)??t[0]).id,!0)}},[e,c.data,l]),(0,L.useEffect)(()=>{d.isPending||d.isError||f.data?.state&&m(f.data.state)},[f.data?.updated_at,d.isPending,d.isError]),(0,L.useEffect)(()=>{d.reset()},[l]);let E=(0,L.useMemo)(()=>{let e=new Map(p.widgets.map(e=>[e.id,e.type])),t=p.layout.map(t=>{let n=cK(e.get(t.i)??`overview`)??Sa.overview;return{...t,h:Math.max(t.h,n.minH),minW:Math.max(t.minW??0,n.minW),minH:Math.max(t.minH??0,n.minH)}});return{lg:t,md:t,sm:ba(t,6),xs:ba(t,2),xxs:ba(t,1)}},[p.layout,p.widgets]);function D(e,t=!1){u(e),localStorage.setItem(oK,e),r?.(e,t)}function O(e){m(e),d.mutate(e)}function k(e){let t=We(),n=Sa[e],r=wa(p.layout,n.w,n.h,12,n.minW);O({...p,widgets:[...p.widgets,{id:t,type:e,title:eK[e],enabled:!0}],layout:[...p.layout,{i:t,x:r.x,y:r.y,w:r.w,h:n.h,minW:n.minW,minH:n.minH}]})}function A(e){O({...p,filters:e}),a?.(e)}function j(e){O({...p,widgets:p.widgets.filter(t=>t.id!==e),layout:p.layout.filter(t=>t.i!==e)})}function M(e,t){O({...p,widgets:p.widgets.map(n=>n.id===e?{...n,config:t}:n)})}if(c.isLoading||l&&f.isLoading)return(0,R.jsx)(uK,{label:`Loading your dashboard…`});let N=c.data?.dashboards??[];if(e&&N.length>0&&!N.some(t=>t.id===e))return(0,R.jsx)(dK,{onOpenDefault:()=>D((N.find(e=>e.is_default)??N[0]).id,!0)});if(c.isError||f.isError)return(0,R.jsx)(uK,{label:`Your dashboard is unavailable. Try refreshing.`});let ee=f.data;return ee?(0,R.jsxs)(se,{component:`main`,maw:1440,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,R.jsxs)(re,{gap:`md`,mb:`lg`,children:[(0,R.jsxs)(se,{children:[(0,R.jsx)(P,{order:1,fz:32,lts:`-0.03em`,children:ee.name}),(0,R.jsx)(y,{c:`dimmed`,mt:2,children:ee.description||`A focused view of the signals that matter now.`})]}),(0,R.jsxs)(pt,{align:{base:`stretch`,md:`center`},justify:`space-between`,direction:{base:`column`,md:`row`},gap:`sm`,role:`group`,"aria-label":`Dashboard controls`,children:[(0,R.jsxs)(w,{gap:`sm`,wrap:`wrap`,children:[(0,R.jsx)(mn,{"aria-label":`Window`,value:b.window,onChange:e=>e&&A({...b,window:e}),data:ze,w:{base:`100%`,xs:150},size:`sm`}),(0,R.jsx)(F,{"aria-label":`Namespace`,value:_??b.namespace,onChange:e=>v(e.currentTarget.value),onBlur:e=>{v(null),A({...b,namespace:e.currentTarget.value.trim()})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},placeholder:`All namespaces`,w:{base:`100%`,xs:200},size:`sm`})]}),(0,R.jsxs)(w,{gap:`sm`,wrap:`wrap`,justify:`flex-end`,children:[T&&(0,R.jsxs)(y,{c:`dimmed`,size:`xs`,children:[`Updated `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(T))]}),(0,R.jsxs)(_e,{shadow:`md`,position:`bottom-end`,withinPortal:!0,children:[(0,R.jsx)(_e.Target,{children:(0,R.jsx)(ae,{variant:`default`,size:`sm`,leftSection:(0,R.jsx)(Ke,{size:15,weight:`bold`}),rightSection:(0,R.jsx)(Pn,{size:13,weight:`bold`}),children:`Add view`})}),(0,R.jsx)(_e.Dropdown,{children:xa.filter(e=>t||e!==`assistant`).map(e=>(0,R.jsx)(_e.Item,{onClick:()=>k(e),children:eK[e]},e))})]}),t&&(0,R.jsx)(ae,{variant:`subtle`,color:`gray`,size:`sm`,rightSection:(0,R.jsx)(Mn,{size:15,weight:`bold`}),onClick:()=>n(),children:`Ask Fanout`})]})]})]}),d.isError&&(0,R.jsx)(S,{color:`bad`,radius:`lg`,mb:`lg`,icon:(0,R.jsx)(Bn,{size:18,weight:`fill`}),title:`Dashboard changes not saved`,children:(0,R.jsxs)(w,{justify:`space-between`,gap:`sm`,children:[(0,R.jsx)(y,{size:`sm`,children:`Your latest edits are kept on this screen but Fanout could not store them.`}),(0,R.jsx)(ae,{size:`compact-sm`,color:`bad`,variant:`light`,onClick:()=>d.mutate(p),children:`Retry save`})]})}),(0,R.jsx)(aK,{className:`dashboard-grid`,layouts:E,breakpoints:{lg:1100,md:800,sm:600,xs:420,xxs:0},cols:{lg:12,md:10,sm:6,xs:2,xxs:1},rowHeight:76,margin:[16,16],containerPadding:[0,0],compactType:`vertical`,draggableHandle:`.widget-drag`,draggableCancel:`button,input,select,textarea,a,label,[role=menu],[role=dialog],.widget-actions`,onBreakpointChange:g,onDragStop:e=>{h===`lg`&&O({...p,layout:[...e]})},onResizeStop:e=>{h===`lg`&&O({...p,layout:[...e]})},children:p.widgets.map(e=>(0,R.jsx)(`div`,{children:(0,R.jsx)(iK,{widget:e,filters:b,dark:s,services:C,agentAvailable:t,onOpenChat:n,onRemove:()=>j(e.id),onConfigure:t=>M(e.id,t)})},e.id))})]}):(0,R.jsx)(uK,{label:`Preparing your dashboard…`})}function uK({label:e}){return(0,R.jsxs)(A,{mih:`50vh`,children:[(0,R.jsx)(m,{size:`sm`}),(0,R.jsx)(y,{c:`dimmed`,size:`sm`,ml:`sm`,children:e})]})}function dK({onOpenDefault:e}){return(0,R.jsx)(A,{mih:`50vh`,children:(0,R.jsxs)(re,{align:`center`,gap:`xs`,children:[(0,R.jsx)(P,{order:1,fz:24,lts:`-0.02em`,children:`This dashboard isn't here`}),(0,R.jsx)(y,{c:`dimmed`,size:`sm`,ta:`center`,children:`The link may be out of date, or the dashboard may have been renamed or deleted.`}),(0,R.jsx)(ae,{mt:`sm`,variant:`default`,size:`sm`,onClick:e,children:`Open your default dashboard`})]})})}export{lK as t}; \ No newline at end of file +`:`
`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=qm(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=QV([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(m==null||m===`item`){var h=s.getDataParams(c,l),g=new rw;h.marker=g.makeTooltipMarker(`item`,HS(h.color),d);var _=gC(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?JC(y?V({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=qm(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(q(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=B(a),a.content=Px(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=QV(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new rw;this._showOrMove(d,function(){var n=B(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,e.get(`showContent`)&&e.get(`show`)){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o||=e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`),e.get(`defaultBorderColor`,!0)).color;if(u){if(q(u)){var p=e.ecModel.get(`useUTC`),m=G(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=gS(m.axisValue,d,p)),d=BS(d,n,!0)}else if(K(u)){var g=W(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u}l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r,i){if(n===`axis`||G(t))return{color:r||i};if(!G(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t||=e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),K(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),G(t))n=gp(t[0],s),r=gp(t[1],c);else if(J(t)){var p=t;p.width=l[0],p.height=l[1];var m=YS(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(q(t)&&o){var h=nH(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=eH(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=rH(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=rH(d)?l[1]/2:d===`bottom`?l[1]:0),kV(e)){var h=tH(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&H(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i&&=o.length===s.length,i&&H(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&H(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&H(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,this._cbParamsList=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){!Ao.node&&t.getDom()&&(Jk(this,`_updatePosition`),this._tooltipContent.dispose(),uV(`itemTooltip`,t),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type=`tooltip`,t}(YM);function QV(e,t,n){var r=t.ecModel,i;n?(i=new my(n,r,r),i=new my(t.option,i,r)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof my&&(o=o.get(`tooltip`,!0)),q(o)&&(o={formatter:o}),o&&(i=new my(o,i,r)))}return i}function $V(e,t){return e.dispatchAction||W(t.dispatchAction,t)}function eH(e,t,n,r,i,a,o){var s=n.getSize(),c=s[0],l=s[1];return a!=null&&(e+c+a+2>r?e-=c+a:e+=a),o!=null&&(t+l+o>i?t-=l+o:t+=o),[e,t]}function tH(e,t,n,r,i){var a=n.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,r)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function nH(e,t,n,r){var i=n[0],a=n[1],o=Math.ceil(Math.SQRT2*r)+8,s=0,c=0,l=t.width,u=t.height;switch(e){case`inside`:s=t.x+l/2-i/2,c=t.y+u/2-a/2;break;case`top`:s=t.x+l/2-i/2,c=t.y-a-o;break;case`bottom`:s=t.x+l/2-i/2,c=t.y+u+o;break;case`left`:s=t.x-i-o,c=t.y+u/2-a/2;break;case`right`:s=t.x+l+o,c=t.y+u/2-a/2}return[s,c]}function rH(e){return e===`center`||e===`middle`}function iH(e,t,n){var r=xm(e).queryOptionMap,i=r.keys()[0];if(i&&i!==`series`){var a=Cm(t,i,r.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a){var o=n.getViewOfComponentModel(a),s;if(o.group.traverse(function(t){var n=qm(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:i,componentIndex:a.componentIndex,el:s}}}}function aH(e){gI(TV),e.registerComponentModel(OV),e.registerComponentView(ZV),e.registerAction({type:`showTip`,event:`showTip`,update:`tooltip:manuallyShowTip`},Do),e.registerAction({type:`hideTip`,event:`hideTip`,update:`tooltip:manuallyHideTip`},Do)}var oH=H;function sH(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function cH(e,t,n){var r={};return oH(t,function(t){var a=r[t]=i();oH(e[t],function(e,r){if(YR.isValidType(r)){var i={type:r,visual:e};n&&n(i,t),a[r]=new YR(i),r===`opacity`&&(i=B(i),i.type=`colorAlpha`,a.__hidden.__alphaForOpacity=new YR(i))}})}),r;function i(){var e=function(){};return e.prototype.__hidden=e.prototype,new e}}function lH(e,t,n){var r;H(n,function(e){t.hasOwnProperty(e)&&sH(t[e])&&(r=!0)}),r&&H(n,function(n){t.hasOwnProperty(n)&&sH(t[n])?e[n]=B(t[n]):delete e[n]})}function uH(e,t,n,r){var i={};return H(e,function(e){i[e]=YR.prepareVisualTypes(t[e])}),{progress:function(e,a){var o;r!=null&&(o=a.getDimensionIndex(r));function s(e){return jN(a,l,e)}function c(e,t){NN(a,l,e,t)}for(var l,u=a.getStore();(l=e.next())!=null;){var d=a.getRawDataItem(l);if(!(d&&d.visualMap===!1))for(var f=r==null?l:u.get(o,l),p=n(f),m=t[p],h=i[p],g=0,_=h.length;g<_;g++){var v=h[g];m[v]&&m[v].applyVisual(f,s,c)}}}}}var dH=function(e,t){if(t===`all`)return{type:`all`,title:e.getLocaleModel().get([`legend`,`selector`,`all`])};if(t===`inverse`)return{type:`inverse`,title:e.getLocaleModel().get([`legend`,`selector`,`inverse`])}},fH=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode={type:`box`,ignoreSize:!0},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n),e.selected=e.selected||{},this._updateSelector(e)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),this._updateSelector(t)},t.prototype._updateSelector=function(e){var t=e.selector,n=this.ecModel;t===!0&&(t=e.selector=[`all`,`inverse`]),G(t)&&H(t,function(e,r){q(e)&&(e={type:e}),t[r]=Wa(e,dH(n,e.type))})},t.prototype.optionUpdated=function(){this._updateData(this.ecModel);var e=this._data;if(e[0]&&this.get(`selectedMode`)===`single`){for(var t=!1,n=0;n=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,bottom:Q.size.m,align:`auto`,backgroundColor:Q.color.transparent,borderColor:Q.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:Q.color.disabled,inactiveBorderColor:Q.color.disabled,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:Q.color.disabled,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:Q.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:Q.color.tertiary,borderWidth:1,borderColor:Q.color.border},emphasis:{selectorLabel:{show:!0,color:Q.color.quaternary}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(aC),pH=no,mH=H,hH=Lg,gH=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new hH),this.group.add(this._selectorGroup=new hH),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);(!i||i===`auto`)&&(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=QS(e,n).refContainer,l=e.getBoxLayoutParams(),u=e.get(`padding`),d=YS(l,c,u),f=this.layoutInner(e,i,d,r,o,s),p=YS(Ka({width:f.width,height:f.height},l),c,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=DV(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=X(),l=t.get(`selectedMode`),u=t.get(`triggerEvent`),d=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&d.push(e.id)}),mH(t.getData(),function(i,a){var o=this,f=i.get(`name`);if(!this.newlineDisabled&&(f===``||f===` +`)){var p=new hH;p.newline=!0,s.add(p);return}var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,pH(yH,f,null,r,d)).on(`mouseover`,pH(bH,m.name,null,r,d)).on(`mouseout`,pH(xH,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=qm(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=Il(h.fill);_&&_[3]===0&&(_[3]=.2,h=V(V({},h),{fill:Wl(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,pH(yH,null,f,r,d)).on(`mouseover`,pH(bH,null,f,r,d)).on(`mouseout`,pH(xH,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=qm(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};qm(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();mH(e,function(e){var r=e.type,i=new Vf({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),Wv(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),ng(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=_H(c,r,o,s,d,m,u),y=new hH,b=r.getModel(`textStyle`);if(K(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(vH({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;q(w)&&w?T=w.replace(`{name}`,t??``):K(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new Vf({style:Kv(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new If({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&Ev({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),ng(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();qS(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){qS(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(YM);function _H(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),mH(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:AP(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function vH(e){var t=e.icon||`roundRect`,n=Cw(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=Q.color.neutral00,n.style.lineWidth=2),n}function yH(e,t,n,r){xH(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),bH(e,t,n,r)}function bH(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function xH(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function SH(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),CH(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){H(i,function(t,n){e[t?`select`:`unSelect`](n)}),CH(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function CH(e,t){var n=t||{};return H(e.getData(),function(t){var r=t.get(`name`);if(r!==` +`&&r!==``){var i=e.isSelected(r);n[r]=Eo(n,r)?n[r]&&i:i}}),n}function wH(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,no(SH,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,no(SH,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,no(SH,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,no(SH,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,no(SH,`unSelect`))}var TH=Km(EH);function EH(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;nn[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=Y(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new If({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&B_(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;H([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,q(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=jH[i],o=MH[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(gH);function PH(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function FH(e){gI(DH),e.registerComponentModel(OH),e.registerComponentView(NH),PH(e)}function IH(e){gI(DH),gI(FH)}var LH={get:function(e,t,n){var r=B((RH[e]||{})[t]);return n&&G(r)?r[r.length-1]:r}},RH={color:{active:[`#006edd`,`#e0ffff`],inactive:[Q.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},zH=YR.mapVisual,BH=YR.eachVisual,VH=G,HH=H,UH=Sp,WH=hp,GH=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&lH(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=W(e,this),this.controllerVisuals=cH(this.option.controller,t,e),this.targetVisuals=cH(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return HH(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=Cm(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return U(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){H(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],G(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);if(q(o))return o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c);if(K(o))return s?o(e[0],e[1]):o(e);if(s)return e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1];return c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=UH([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=$a(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};Wa(r,n),Wa(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){VH(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},HH(r,function(e,t){if(YR.isValidType(t)){var n=LH.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;HH(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&B(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&B(n)||(a?s[0]:[s[0],s[0]])),c.symbol=zH(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;BH(l,function(e){e>u&&(u=e)}),c.symbolSize=zH(l,function(e){return WH(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:Q.color.transparent,borderColor:Q.color.borderTint,contentColor:Q.color.theme[0],inactiveColor:Q.color.disabled,borderWidth:0,padding:Q.size.m,textGap:10,precision:0,textStyle:{color:Q.color.secondary}},t}(aC),KH=[20,140],qH=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(e){e.mappingMethod=`linear`,e.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=KH[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=KH[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):G(t)&&(t[0]>t[1]&&t.reverse(),t[0]=Math.max(t[0],e[0]),t[1]=Math.min(t[1],e[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),H(this.stateList,function(e){var t=this.option.controller[e].symbolSize;t&&t[0]!==t[1]&&(t[0]=t[1]/3)},this)},t.prototype.setSelected=function(e){this.option.range=e.slice(),this._resetRange()},t.prototype.getSelected=function(){var e=this.getExtent(),t=Sp((this.get(`range`)||[]).slice());return t[0]>e[1]&&(t[0]=e[1]),t[1]>e[1]&&(t[1]=e[1]),t[0]=n[1]||e<=t[1])?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[];return this.eachTargetSeries(function(n){var r=[],i=n.getData();i.each(this.getDataDimensionIndex(i),function(t,n){e[0]<=t&&t<=e[1]&&r.push(n)},this),t.push({seriesId:n.id,dataIndex:r})},this),t},t.prototype.getVisualMeta=function(e){var t=JH(this,`outOfRange`,this.getExtent()),n=JH(this,`inRange`,this.option.range.slice()),r=[];function i(t,n){r.push({value:t,color:e(t,n)})}for(var a=0,o=0,s=n.length,c=t.length;oe[1])break;r.push({color:this.getControllerVisual(o,`color`,t),offset:a/n})}return r.push({color:this.getControllerVisual(e[1],`color`,t),offset:1}),r},t.prototype._createBarPoints=function(e,t){var n=this.visualMapModel.itemSize;return[[n[0]-t[0],e[0]],[n[0],e[0]],[n[0],e[1]],[n[0]-t[1],e[1]]]},t.prototype._createBarGroup=function(e){var t=this._orient,n=this.visualMapModel.get(`inverse`);return new Lg(t===`horizontal`&&!n?{scaleX:e===`bottom`?1:-1,rotation:Math.PI/2}:t===`horizontal`&&n?{scaleX:e===`bottom`?-1:1,rotation:-Math.PI/2}:t===`vertical`&&!n?{scaleX:e===`left`?1:-1,scaleY:-1}:{scaleX:e===`left`?1:-1})},t.prototype._updateHandle=function(e,t){if(this._useHandle){var n=this._shapes,r=this.visualMapModel,i=n.handleThumbs,a=n.handleLabels,o=r.itemSize,s=r.getExtent(),c=this._applyTransform(`left`,n.mainGroup);eU([0,1],function(l){var u=i[l];u.setStyle(`fill`,t.handlesColor[l]),u.y=e[l];var d=$H(e[l],[0,o[1]],s,!0),f=this.getControllerVisual(d,`symbolSize`);u.scaleX=u.scaleY=f/o[0],u.x=o[0]-f/2;var p=dv(n.handleLabelPoints[l],uv(u,this.group));if(this._orient===`horizontal`){var m=c===`left`||c===`top`?(o[0]-f)/2:(o[0]-f)/-2;p[1]+=m}a[l].setStyle({x:p[0],y:p[1],text:r.formatValueText(this._dataInterval[l]),verticalAlign:`middle`,align:this._orient===`vertical`?this._applyTransform(`left`,n.mainGroup):`center`})},this)}},t.prototype._showIndicator=function(e,t,n,r){var i=this.visualMapModel,a=i.getExtent(),o=i.itemSize,s=[0,o[1]],c=this._shapes,l=c.indicator;if(l){l.attr(`invisible`,!1);var u=this.getControllerVisual(e,`color`,{convertOpacityToAlpha:!0}),d=this.getControllerVisual(e,`symbolSize`),f=$H(e,a,s,!0),p=o[0]-d/2,m={x:l.x,y:l.y};l.y=f,l.x=p;var h=dv(c.indicatorLabelPoint,uv(l,this.group)),g=c.indicatorLabel;g.attr(`invisible`,!1);var _=this._applyTransform(`left`,c.mainGroup),v=this._orient===`horizontal`;g.setStyle({text:(n||``)+i.formatValueText(t),verticalAlign:v?_:`middle`,align:v?`center`:_});var y={x:p,y:f,style:{fill:u}},b={style:{x:h[0],y:h[1]}};if(i.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var x={duration:100,easing:`cubicInOut`,additive:!0};l.x=m.x,l.y=m.y,l.animateTo(y,x),g.animateTo(b,x)}else l.attr(y),g.attr(b);this._firstShowIndicator=!1;var S=this._shapes.handleLabels;if(S)for(var C=0;Ci[1]&&(l[1]=1/0),t&&(l[0]===-1/0?this._showIndicator(c,l[1],`< `,o):l[1]===1/0?this._showIndicator(c,l[0],`> `,o):this._showIndicator(c,c,`≈ `,o));var u=this._hoverLinkDataIndices,d=[];(t||cU(n))&&(d=this._hoverLinkDataIndices=n.findTargetDataIndices(l));var f=gm(u,d);this._dispatchHighDown(`downplay`,QH(f[0],n)),this._dispatchHighDown(`highlight`,QH(f[1],n))}},t.prototype._hoverLinkFromSeriesMouseOver=function(e){var t;if(PN(e.target,function(e){var n=qm(e);if(n.dataIndex!=null)return t=n,!0},!0),t){var n=this.ecModel.getSeriesByIndex(t.seriesIndex),r=this.visualMapModel;if(r.isTargetSeries(n)){var i=n.getData(t.dataType),a=i.getStore().get(r.getDataDimensionIndex(i),t.dataIndex);isNaN(a)||this._showIndicator(a,a)}}},t.prototype._hideIndicator=function(){var e=this._shapes;e.indicator&&e.indicator.attr(`invisible`,!0),e.indicatorLabel&&e.indicatorLabel.attr(`invisible`,!0);var t=this._shapes.handleLabels;if(t)for(var n=0;n=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function pU(e,t,n,r){for(var i=t.targetVisuals[r],a=YR.prepareVisualTypes(i),o={color:MN(e.getData(),`color`)},s=0,c=a.length;s0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(uU,dU),H(fU,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(hU))}function yU(e){e.registerComponentModel(qH),e.registerComponentView(aU),vU(e)}var bU=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],xU[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=B(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=U(this._pieceList,function(e){return e=B(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=YR.listVisualTypes(),i=this.isCategory();H(t.pieces,function(e){H(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),H(n,function(e,n){var r=!1;H(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&H(this.stateList,function(e){(t[e]||(t[e]={}))[n]=LH.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,H(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;H(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=B(e)},t.prototype.getValueState=function(e){var t=YR.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){YR.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return H(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=yx(GH.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(GH),xU={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}};function SU(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var CU=function(e){z(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=uo(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),H(o.viewPieceList,function(o){var s=o.piece,u=new Lg;u.onclick=W(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new Vf({style:Kv(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:Y(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),qS(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:QH(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return ZH(e,this.api,e.itemSize);var n=t.align;return(!n||n===`auto`)&&(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new Lg,o=this.visualMapModel.textStyleModel;a.add(new Vf({style:Kv(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=U(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=Cw(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=B(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,H(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(YH);function wU(e){e.registerComponentModel(bU),e.registerComponentView(CU),vU(e)}function TU(e){gI(yU),gI(wU)}var EU={label:{enabled:!0},decal:{show:!1}},DU=vm(),OU=vm(),kU=Km(AU);function AU(e,t){var n=e.getModel(`aria`);if(!n.get(`enabled`))return;var r=OU(e).scope||(OU(e).scope={}),i=B(EU);Wa(i.label,e.getLocaleModel().get(`aria`),!1),Wa(n.option,i,!1),a(),o();function a(){if(n.getModel(`decal`).get(`show`)){var t=X();e.eachSeries(function(e){e.isColorBySeries()||(DU(e).scope=t.get(e.type)||t.set(e.type,{}))}),e.eachSeries(function(t){if(K(t.enableAriaDecal)){t.enableAriaDecal();return}var n=t.getData();if(t.isColorBySeries()){var i=uC(t.ecModel,t.name,r,e.getSeriesCount()),a=n.getVisual(`decal`);n.setVisual(`decal`,u(a,i))}else{var o=t.getRawData(),s={},c=DU(t).scope;n.each(function(e){var t=n.getRawIndex(e);s[t]=e});var l=o.count();o.each(function(e){var r=s[e],i=o.getName(e)||e+``,a=uC(t.ecModel,i,c,l),d=n.getItemVisual(r,`decal`);n.setItemVisual(r,`decal`,u(d,a))})}function u(e,t){var n=e?V(V({},t),e):t;return n.dirty=!0,n}})}}function o(){var r=t.getZr().dom;if(r){var i=e.getLocaleModel().get(`aria`),a=n.getModel(`label`);if(a.option=Ka(a.option,i),a.get(`enabled`)){if(r.setAttribute(`role`,`img`),a.get(`description`)){r.setAttribute(`aria-label`,a.get(`description`));return}var o=e.getSeriesCount(),u=a.get([`data`,`maxCount`])||10,d=a.get([`series`,`maxCount`])||10,f=Math.min(o,d),p;if(!(o<1)){var m=c();p=m?s(a.get([`general`,`withTitle`]),{title:m}):a.get([`general`,`withoutTitle`]);var h=[],g=o>1?a.get([`series`,`multiple`,`prefix`]):a.get([`series`,`single`,`prefix`]);p+=s(g,{seriesCount:o}),e.eachSeries(function(e,t){if(t1?a.get([`series`,`multiple`,r]):a.get([`series`,`single`,r]),n=s(n,{seriesId:e.seriesIndex,seriesName:e.get(`name`),seriesType:l(e.subType)});var i=e.getData();if(i.count()>u){var c=a.get([`data`,`partialData`]);n+=s(c,{displayCnt:u})}else n+=a.get([`data`,`allData`]);for(var d=a.get([`data`,`separator`,`middle`]),p=a.get([`data`,`separator`,`end`]),m=a.get([`data`,`excludeDimensionId`]),g=[],_=0;_=IU:-c>=IU),f=c>0?c%IU:c%IU+IU,p=!1;p=d?!0:!Zl(u)&&f>=FU==!!l;var m=e+n*PU(a),h=t+r*NU(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*LU);if(d){var _=1/this._p,v=(l?1:-1)*(IU-_);this._add(`A`,n,r,g,1,+l,e+n*PU(a+v),t+r*NU(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*PU(o),b=t+r*NU(o);this._add(`A`,n,r,g,+p,+l,y,b)}},e.prototype.rect=function(e,t,n,r){this._add(`M`,e,t),this._add(`l`,n,0),this._add(`l`,0,r),this._add(`l`,-n,0),this._add(`Z`)},e.prototype.closePath=function(){this._d.length>0&&this._add(`Z`)},e.prototype._add=function(e,t,n,r,i,a,o,s,c){for(var l=[],u=this._p,d=1;d`}function eW(e){return``}function tW(e,t){t||={};var n=t.newline?` +`:``;function r(e){var t=e.children,i=e.tag,a=e.attrs,o=e.text;return $U(i,a)+(i===`style`?o||``:Px(o))+(t?``+n+U(t,function(e){return r(e)}).join(n)+n:``)+eW(i)}return r(e)}function nW(e,t,n){n||={};var r=n.newline?` +`:``,i=` {`+r,a=r+`}`,o=U(eo(e),function(t){return t+i+U(eo(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=U(eo(t),function(e){return`@keyframes `+e+i+U(eo(t[e]),function(n){return n+i+U(eo(t[e][n]),function(r){var i=t[e][n][r];return r===`d`&&(i=`path("`+i+`")`),r+`:`+i+`;`}).join(r)+a}).join(r)+a}).join(r);return!o&&!s?``:[``].join(r)}function rW(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function iW(e,t,n,r){return QU(`svg`,`root`,{width:e,height:t,xmlns:KU,"xmlns:xlink":qU,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var aW=0;function oW(){return aW++}var sW={cubicIn:`0.32,0,0.67,0`,cubicOut:`0.33,1,0.68,1`,cubicInOut:`0.65,0,0.35,1`,quadraticIn:`0.11,0,0.5,0`,quadraticOut:`0.5,1,0.89,1`,quadraticInOut:`0.45,0,0.55,1`,quarticIn:`0.5,0,0.75,0`,quarticOut:`0.25,1,0.5,1`,quarticInOut:`0.76,0,0.24,1`,quinticIn:`0.64,0,0.78,0`,quinticOut:`0.22,1,0.36,1`,quinticInOut:`0.83,0,0.17,1`,sinusoidalIn:`0.12,0,0.39,0`,sinusoidalOut:`0.61,1,0.88,1`,sinusoidalInOut:`0.37,0,0.63,1`,exponentialIn:`0.7,0,0.84,0`,exponentialOut:`0.16,1,0.3,1`,exponentialInOut:`0.87,0,0.13,1`,circularIn:`0.55,0,1,0.45`,circularOut:`0,0.55,0.45,1`,circularInOut:`0.85,0,0.15,1`},cW=`transform-origin`;function lW(e,t,n){var r=V({},e.shape);V(r,t),e.buildPath(n,r);var i=new RU;return i.reset(fu(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function uW(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[cW]=n+`px `+r+`px`)}var dW={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function fW(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function pW(e,t,n){var r=e.shape.paths,i={},a,o;if(H(r,function(e){var t=rW(n.zrId);t.animation=!0,hW(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=eo(r),l=c.length;if(l){o=c[l-1];var u=r[o];for(var d in u){var f=u[d];i[d]=i[d]||{d:``},i[d].d+=f.d||``}for(var p in s){var m=s[p].animation;m.indexOf(o)>=0&&(a=m)}}}),a){t.d=!1;var s=fW(i,n);return a.replace(o,s)}}function mW(e){return q(e)?sW[e]?`cubic-bezier(`+sW[e]+`)`:xl(e)?e:``:``}function hW(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof S_){var s=pW(e,t,n);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var c={},l=0;l0}).length)return fW(l,n)+` `+i[0]+` both`}for(var g in c){var s=h(c[g]);s&&o.push(s)}if(o.length){var _=n.zrId+`-cls-`+oW();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function gW(e,t,n){if(!e.ignore){if(e.isSilent()){var r={"pointer-events":`none`};_W(r,t,n,!0)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,c=e.currentStates.indexOf(`select`)>=0&&s||o;c&&(a=ql(c))}var l=i.lineWidth;if(l){var u=!i.strokeNoScale&&e.transform?e.transform[0]:1;l/=u}var r={cursor:`pointer`};a&&(r.fill=a),i.stroke&&(r.stroke=i.stroke),l&&(r[`stroke-width`]=l),_W(r,t,n,!0)}}}function _W(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+oW(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var vW=Math.round;function yW(e){return e&&q(e.src)}function bW(e){return e&&K(e.toDataURL)}function xW(e,t,n,r){GU(function(i,a){var o=i===`fill`||i===`stroke`;o&&uu(a)?IW(t,e,i,r):o&&su(a)?LW(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),FW(n,e,r)}function SW(e,t){var n=Xj(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[XU+`silent`]=`true`))}function CW(e){return Zl(e[0]-1)&&Zl(e[1])&&Zl(e[2])&&Zl(e[3]-1)}function wW(e){return Zl(e[4])&&Zl(e[5])}function TW(e,t,n){if(t&&!(wW(t)&&CW(t))){var r=n?10:1e4;e.transform=CW(t)?`translate(`+vW(t[4]*r)/r+` `+vW(t[5]*r)/r+`)`:eu(t)}}function EW(e,t,n){for(var r=e.points,i=[],a=0;a`u`){var g=`Image width/height must been given explictly in svg-ssr renderer.`;ho(f,g),ho(p,g)}else if(f==null||p==null){var _=function(e,t){if(e){var n=e.elm,r=f||t.width,i=p||t.height;e.tag===`pattern`&&(l?(i=1,r/=a.width):u&&(r=1,i/=a.height)),e.attrs.width=r,e.attrs.height=i,n&&(n.setAttribute(`width`,r),n.setAttribute(`height`,i))}},v=es(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=QU(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=B(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(d){var y,b;c?y=b=1:l?(b=1,y=o.width/a.width):u?(y=1,b=o.height/a.height):o.patternUnits=`userSpaceOnUse`,y!=null&&!isNaN(y)&&(o.width=y),b!=null&&!isNaN(b)&&(o.height=b);var x=pu(i);x&&(o.patternTransform=x);var S=QU(`pattern`,``,o,[d]),C=tW(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=QU(`pattern`,T,o,[d])),t[n]=du(T)}}function RW(e,t,n){var r=n.clipPathCache,i=n.defs,a=r[e.id];if(!a){a=n.zrId+`-c`+n.clipPathIdx++;var o={id:a};r[e.id]=a,i[a]=QU(`clipPath`,a,o,[jW(e,n)])}t[`clip-path`]=du(a)}function zW(e){return document.createTextNode(e)}function BW(e,t,n){e.insertBefore(t,n)}function VW(e,t){e.removeChild(t)}function HW(e,t){e.appendChild(t)}function UW(e){return e.parentNode}function WW(e){return e.nextSibling}function GW(e,t){e.textContent=t}var KW=58,qW=120,JW=QU(``,``);function YW(e){return e===void 0}function XW(e){return e!==void 0}function ZW(e,t,n){for(var r={},i=t;i<=n;++i){var a=e[i].key;a!==void 0&&(r[a]=i)}return r}function QW(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function $W(e){var t,n=e.children,r=e.tag;if(XW(r)){var i=e.elm=ZU(r);if(nG(JW,e),G(n))for(t=0;ta?(m=n[c+1]==null?null:n[c+1].elm,eG(e,m,n,i,c)):tG(e,t,r,a))}function iG(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(nG(e,t),YW(t.text)?XW(r)&&XW(i)?r!==i&&rG(n,r,i):XW(i)?(XW(e.text)&&GW(n,``),eG(n,null,i,0,i.length-1)):XW(r)?tG(n,r,0,r.length-1):XW(e.text)&&GW(n,``):e.text!==t.text&&(XW(r)&&tG(n,r,0,r.length-1),GW(n,t.text)))}function aG(e,t){if(QW(e,t))iG(e,t);else{var n=e.elm,r=UW(n);$W(t),r!==null&&(BW(r,t.elm,WW(n)),tG(r,[e],0,0))}return t}var oG=0,sG=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=cG(`configLayer`),this.storage=t,this._opts=n=V({},n),this.root=e,this._id=`zr`+oG++,this._oldVNode=iW(n.width,n.height),e&&!n.ssr){var r=this._viewport=document.createElement(`div`);r.style.cssText=`position:relative;overflow:hidden`;var i=this._svgDom=this._oldVNode.elm=ZU(`svg`);nG(null,this._oldVNode),r.appendChild(i),e.appendChild(r)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style=`position:absolute;left:0;top:0;user-select:none`,aG(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return PW(e,rW(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=rW(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var a=[],o=this._bgVNode=lG(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=QU(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=U(eo(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(QU(`defs`,`defs`,{},c)),e.animation){var l=nW(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=QU(`style`,`stl`,{},[],l);a.push(u)}}return iW(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},tW(this.renderToVNode({animation:Y(e.cssAnimation,!0),emphasis:Y(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Y(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var r=e.length,i=[],a=0,o,s,c=0,l=0;l=0&&!(d&&s&&d[m]===s[m]);m--);for(var h=p-1;h>m;h--)a--,o=i[a-1];for(var g=m+1;g{if(!a.current)return;let e=XF(a.current,void 0,{renderer:`svg`});o.current=e,e.on(`click`,e=>s.current?.(e));let t=new ResizeObserver(()=>e.resize());return t.observe(a.current),()=>{t.disconnect(),e.dispose(),o.current=null}},[]),(0,L.useEffect)(()=>{o.current?.setOption({animationDuration:280,aria:{enabled:!0,decal:{show:!0},description:n},...e},{notMerge:!0})},[n,e]),(0,R.jsx)(`div`,{ref:a,className:i?`echart ${i}`:`echart`,style:{height:t,width:`100%`,minWidth:0},role:`img`,"aria-label":n})}function fG(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function pG(e){return we[e?`dark`:`light`]}function mG(e){let t=e?5:7;return{ok:Ae[t],warn:je[t],bad:De[t],info:Oe[t]}}function hG(e,t){let n=be[t?`dark`:`light`],r=0;for(let t of e)r=r*31+t.charCodeAt(0)|0;return n[Math.abs(r)%n.length]}function gG(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function _G(e){return e===`unknown`?`dashed`:`solid`}function vG(e){return e===`unhealthy`?1.25:e===`degraded`?.91:1}function yG(e){let t=String(e).toUpperCase();return t===`ERROR`||t===`FATAL`?`bad`:t===`WARN`||t===`WARNING`?`warn`:t===`INFO`?`info`:`gray`}function bG(e,t){let n=mG(t),r=String(e).toUpperCase();return r===`ERROR`||r===`FATAL`?n.bad:r===`WARN`||r===`WARNING`?n.warn:r===`INFO`?n.info:pG(t).muted}function xG({label:e,value:t,color:n,hint:r,children:i}){return(0,R.jsxs)(ce,{withBorder:!0,radius:`md`,p:`sm`,bg:`var(--mantine-color-default)`,miw:0,h:`100%`,children:[(0,R.jsx)(y,{c:`dimmed`,size:`xs`,truncate:!0,children:e}),(0,R.jsx)(y,{fw:600,fz:`xl`,c:n,mt:2,lh:1.2,truncate:!0,children:t}),r&&(0,R.jsx)(y,{c:`dimmed`,size:`xs`,mt:2,truncate:!0,children:r}),i&&(0,R.jsx)(se,{mt:4,children:i})]})}var SG={unhealthy:`◆`,degraded:`■`,healthy:`●`,unknown:`○`},CG={unhealthy:`unhealthy`,degraded:`degraded`,healthy:`healthy`,unknown:`health unknown`};function wG({health:e,label:t}){return(0,R.jsxs)(Ne,{color:fG(e),variant:`light`,tt:`none`,style:{minWidth:`max-content`},leftSection:(0,R.jsx)(se,{component:`span`,"aria-hidden":!0,style:{fontSize:Te.micro,lineHeight:1},children:SG[e]??SG.unknown}),children:[t,(0,R.jsxs)(We,{children:[` — `,CG[e]??CG.unknown]})]})}function TG({text:e}){return(0,R.jsxs)(A,{py:`xl`,children:[(0,R.jsx)(On,{size:20}),(0,R.jsx)(y,{c:`dimmed`,size:`sm`,ml:`xs`,children:e})]})}function EG({retry:e}){return(0,R.jsxs)(A,{py:`xl`,style:{flexDirection:`column`,gap:8},children:[(0,R.jsxs)(se,{display:`flex`,style:{alignItems:`center`,gap:8},children:[(0,R.jsx)($e,{size:20,weight:`fill`,color:`var(--mantine-color-bad-filled)`}),(0,R.jsx)(y,{c:`bad`,fw:500,size:`sm`,children:`Couldn't load this view`})]}),(0,R.jsx)(ae,{size:`compact-xs`,variant:`light`,color:`bad`,onClick:e,children:`Retry now`}),(0,R.jsx)(y,{c:`dimmed`,size:`xs`,children:`Retrying automatically`})]})}gI([YE]);function DG({values:e,color:t,label:n,format:r}){let i=e.length?Math.max(...e):0,a=(0,L.useMemo)(()=>({animation:!1,grid:{left:0,right:0,top:2,bottom:2},xAxis:{type:`category`,show:!1,data:e.map((e,t)=>t)},yAxis:{type:`value`,show:!1,min:0},tooltip:{show:!1},aria:{enabled:!0,decal:{show:!1},description:n},series:[{type:`line`,data:e,showSymbol:!1,smooth:.3,lineStyle:{width:1.5,color:t},areaStyle:{opacity:.12,color:t}}]}),[e,t,n]);return(0,R.jsxs)(se,{children:[(0,R.jsx)(dG,{option:a,height:28,label:n}),i>0&&r&&(0,R.jsxs)(y,{c:`dimmed`,size:`xs`,ta:`right`,mt:2,children:[`peak `,r(i)]})]})}var OG={unhealthy:0,degraded:1,healthy:2};function kG({widget:e,filters:t,agentAvailable:n,onOpenChat:r}){let i=Ce(`overview`,Se(t,e.config,[`service`]));if(i.isError)return(0,R.jsx)(EG,{retry:()=>void i.refetch()});let a=[...i.data?.data.services??[]].sort((e,t)=>(OG[e.health]??3)-(OG[t.health]??3)||t.error_rate-e.error_rate);if(i.data&&a.length===0)return(0,R.jsx)(TG,{text:`No recent activity`});let o=e=>r(`Investigate the ${e} service. Explain its errors and latency.`);return(0,R.jsx)(Re,{type:`auto`,offsetScrollbars:!0,h:`100%`,children:(0,R.jsxs)(Xe,{verticalSpacing:`xs`,fz:`sm`,highlightOnHover:n,children:[(0,R.jsx)(Xe.Thead,{children:(0,R.jsxs)(Xe.Tr,{children:[(0,R.jsx)(Xe.Th,{children:`Service`}),(0,R.jsx)(Xe.Th,{ta:`right`,children:`P95`}),(0,R.jsx)(Xe.Th,{ta:`right`,children:`Errors`})]})}),(0,R.jsx)(Xe.Tbody,{children:a.map(e=>(0,R.jsxs)(Xe.Tr,{...n&&{onClick:()=>o(e.service),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e.service))},tabIndex:0,role:`button`,"aria-label":`Investigate ${e.service}`,style:{cursor:`pointer`}},children:[(0,R.jsx)(Xe.Td,{children:(0,R.jsx)(wG,{health:e.health,label:e.service})}),(0,R.jsx)(Xe.Td,{ta:`right`,children:(0,R.jsx)(y,{component:`span`,size:`sm`,ff:`monospace`,c:ya(e.p95_ms),children:_a(e.p95_ms)})}),(0,R.jsx)(Xe.Td,{ta:`right`,children:(0,R.jsx)(y,{component:`span`,size:`sm`,c:ba(e.error_rate),children:ga(e.error_rate)})})]},e.service))})]})})}function AG({filters:e,agentAvailable:t,onOpenChat:n}){if(!t)return(0,R.jsx)(y,{c:`dimmed`,size:`sm`,children:`Configure an AI provider to enable this view. The rest of this dashboard remains available.`});let r=ve(e.window),i=[`Summarize the last ${r}`,`What changed in the last ${r}?`,`Which service needs attention right now?`];return(0,R.jsx)(re,{gap:`xs`,align:`flex-start`,children:i.map(e=>(0,R.jsx)(ae,{variant:`default`,size:`xs`,radius:`xl`,leftSection:(0,R.jsx)(ye,{size:13,weight:`fill`}),onClick:()=>n(e),children:e},e))})}var jG={overview:[`service`],topology:[`service`],performance:[`service`],logs:[`service`,`severity`,`search`],trace:[`trace_id`,`service`]};function MG(e){return Object.hasOwn(jG,e)?jG[e]:void 0}function NG(e){return(MG(e)?.length??0)>0}function PG({opened:e,widget:t,services:n,onClose:r,onSave:i}){let[a,o]=(0,L.useState)({service:``,severity:``,search:``,trace_id:``});(0,L.useEffect)(()=>{e&&o({service:xe(t.config,`service`),severity:xe(t.config,`severity`),search:xe(t.config,`search`),trace_id:xe(t.config,`trace_id`)})},[e,t.config]);let s=MG(t.type)??[],c=[...new Set([...n,a.service].filter(Boolean))];function l(){let e={...t.config??{}};for(let t of s){let n=a[t].trim();n?e[t]=n:delete e[t]}i(e),r()}return(0,R.jsx)(Ke,{opened:e,onClose:r,title:`Configure ${t.title}`,centered:!0,children:(0,R.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),l()},children:(0,R.jsxs)(re,{children:[s.includes(`service`)&&(0,R.jsx)(ln,{label:`Service`,placeholder:`All services`,data:c,value:a.service||null,onChange:e=>o({...a,service:e??``}),clearable:!0,searchable:!0,"aria-label":`Service`}),s.includes(`severity`)&&(0,R.jsx)(ln,{label:`Severity`,placeholder:`All severities`,data:[`ERROR`,`WARN`,`INFO`,`DEBUG`],value:a.severity||null,onChange:e=>o({...a,severity:e??``}),clearable:!0,"aria-label":`Severity`}),s.includes(`search`)&&(0,R.jsx)(I,{label:`Search`,placeholder:`Text the log body must contain`,value:a.search,onChange:e=>o({...a,search:e.currentTarget.value}),"aria-label":`Search`}),s.includes(`trace_id`)&&(0,R.jsx)(I,{label:`Trace id`,placeholder:`Leave empty for the most relevant recent trace`,value:a.trace_id,onChange:e=>o({...a,trace_id:e.currentTarget.value}),ff:`monospace`,"aria-label":`Trace id`}),(0,R.jsxs)(w,{justify:`flex-end`,children:[(0,R.jsx)(ae,{variant:`default`,onClick:r,children:`Cancel`}),(0,R.jsx)(ae,{type:`submit`,children:`Save`})]})]})})})}gI([DA]);function FG({widget:e,filters:t,dark:n}){let r=Ce(`logs`,Se(t,e.config,[`service`,`severity`,`search`])),i=r.data,a=(0,L.useMemo)(()=>{if(!i||i.data.buckets.length===0)return null;let e=pG(n),t=i.provenance.window,r=[...new Set(i.data.buckets.map(e=>e.time))],a=[...new Set(i.data.buckets.map(e=>e.severity))],o=new Map(i.data.buckets.map(e=>[`${e.time} ${e.severity}`,e.count]));return{color:a.map(e=>bG(e,n)),grid:{left:28,right:8,top:8,bottom:20},tooltip:{trigger:`axis`,axisPointer:{type:`shadow`},backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:Te.micro}},xAxis:{type:`category`,data:r.map(e=>va(e,t)),axisLabel:{color:e.muted,fontSize:Te.micro,hideOverlap:!0},axisLine:{lineStyle:{color:e.border}}},yAxis:{type:`value`,minInterval:1,splitLine:{lineStyle:{color:e.grid}},axisLabel:{color:e.muted,fontSize:Te.micro}},series:a.map(e=>({name:e,type:`bar`,stack:`logs`,barMaxWidth:14,data:r.map(t=>o.get(`${t} ${e}`)??0),itemStyle:{borderRadius:[2,2,0,0]}}))}},[n,i]);if(r.isError)return(0,R.jsx)(EG,{retry:()=>void r.refetch()});let o=(i?.data.entries??[]).slice(0,5);return i&&o.length===0?(0,R.jsx)(TG,{text:`No matching logs in this window`}):(0,R.jsxs)(re,{gap:`xs`,h:`100%`,children:[a&&(0,R.jsx)(se,{h:72,children:(0,R.jsx)(dG,{option:a,height:72,label:`Log volume by severity`})}),(0,R.jsx)(Re,{type:`auto`,offsetScrollbars:!0,style:{flex:1},children:(0,R.jsx)(Xe,{verticalSpacing:4,fz:`sm`,children:(0,R.jsx)(Xe.Tbody,{children:o.map((e,t)=>(0,R.jsxs)(Xe.Tr,{children:[(0,R.jsx)(Xe.Td,{style:{whiteSpace:`nowrap`},children:(0,R.jsx)(y,{component:`span`,size:`xs`,ff:`monospace`,c:`dimmed`,children:i?va(e.time,i.provenance.window,!0):e.time})}),(0,R.jsx)(Xe.Td,{style:{whiteSpace:`nowrap`},children:(0,R.jsx)(Ne,{size:`xs`,color:yG(e.severity),variant:`light`,style:{minWidth:`max-content`},children:e.severity||`LOG`})}),(0,R.jsx)(Xe.Td,{style:{whiteSpace:`nowrap`},children:(0,R.jsx)(y,{component:`span`,size:`sm`,fw:600,children:e.service})}),(0,R.jsx)(Xe.Td,{style:{width:`100%`},children:(0,R.jsx)(y,{size:`sm`,lineClamp:1,title:e.body,children:e.body})})]},`${e.time}-${t}`))})})})]})}function IG({widget:e,filters:t,dark:n}){let r=Se(t,e.config,[`service`]),i=Ce(`overview`,r),a=Ce(`performance`,r);if(i.isError)return(0,R.jsx)(EG,{retry:()=>void i.refetch()});let o=i.data?.data,s=(a.data?.data.points??[]).map(e=>e.error_rate*100),c=Math.max(o?.service_count??0,1),l=mG(n),u=o?.health===`unknown`,d=o?u?`No data`:o.health.charAt(0).toUpperCase()+o.health.slice(1):`—`;return(0,R.jsxs)(re,{gap:`sm`,children:[(0,R.jsxs)(vn,{cols:2,spacing:`sm`,children:[(0,R.jsx)(xG,{label:`Health`,value:d,color:o?fG(o.health):void 0,hint:o?u?`No telemetry in this window`:`${ha.format(o.service_count)} services`:void 0}),(0,R.jsx)(xG,{label:`Error rate`,value:o&&!u?ga(o.error_rate):`—`,color:o&&o.error_rate>=.01?`bad`:void 0,hint:o&&!u?`${ha.format(o.total_spans)} operations`:void 0,children:s.length>1&&(0,R.jsx)(DG,{values:s,color:l.bad,label:`Error rate trend`,format:e=>`${e.toFixed(2)}%`})})]}),o&&!u&&(0,R.jsxs)(se,{children:[(0,R.jsxs)(sn.Root,{size:`md`,"aria-label":`Service health distribution`,children:[(0,R.jsx)(sn.Section,{value:o.counts.healthy/c*100,color:`ok`}),(0,R.jsx)(sn.Section,{value:o.counts.degraded/c*100,color:`warn`}),(0,R.jsx)(sn.Section,{value:o.counts.unhealthy/c*100,color:`bad`})]}),(0,R.jsxs)(w,{mt:6,gap:`md`,children:[(0,R.jsx)(LG,{color:`ok`,text:`${o.counts.healthy} healthy`}),(0,R.jsx)(LG,{color:`warn`,text:`${o.counts.degraded} degraded`}),(0,R.jsx)(LG,{color:`bad`,text:`${o.counts.unhealthy} unhealthy`})]})]})]})}function LG({color:e,text:t}){return(0,R.jsxs)(w,{gap:6,children:[(0,R.jsx)(se,{w:8,h:8,bg:e,style:{borderRadius:`50%`}}),(0,R.jsx)(y,{c:`dimmed`,size:`xs`,children:t})]})}gI([YE]);function RG({widget:e,filters:t,dark:n}){let r=Ce(`performance`,Se(t,e.config,[`service`])),i=r.data,a=(0,L.useMemo)(()=>{if(!i||i.data.points.length===0)return null;let e=pG(n),t=i.provenance.window;return{color:[hG(`operations`,n),mG(n).warn],grid:{left:36,right:40,top:24,bottom:22},legend:{top:0,left:0,textStyle:{color:e.muted,fontSize:Te.micro},icon:`circle`,itemWidth:7,itemHeight:7},tooltip:{trigger:`axis`,backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:Te.micro}},xAxis:{type:`category`,data:i.data.points.map(e=>va(e.time,t)),boundaryGap:!1,axisLine:{lineStyle:{color:e.border}},axisTick:{show:!1},axisLabel:{color:e.muted,fontSize:Te.micro,hideOverlap:!0}},yAxis:[{type:`value`,splitLine:{lineStyle:{color:e.grid}},axisLabel:{color:e.muted,fontSize:Te.micro}},{type:`value`,splitLine:{show:!1},axisLabel:{color:e.muted,fontSize:Te.micro,formatter:e=>_a(e)}}],series:[{name:`Operations`,type:`line`,data:i.data.points.map(e=>e.spans),smooth:.22,showSymbol:!1,lineStyle:{width:2},areaStyle:{opacity:.05}},{name:`P95`,type:`line`,yAxisIndex:1,data:i.data.points.map(e=>e.p95_ms),smooth:.22,showSymbol:!1,lineStyle:{width:2}}]}},[n,i]);if(r.isError)return(0,R.jsx)(EG,{retry:()=>void r.refetch()});if(i&&i.data.points.length===0)return(0,R.jsx)(TG,{text:`No endpoint activity in this window`});let o=(i?.data.endpoints??[]).slice(0,3);return(0,R.jsxs)(re,{gap:`xs`,h:`100%`,children:[a&&(0,R.jsx)(se,{style:{flex:1,minHeight:120},children:(0,R.jsx)(dG,{option:a,height:`100%`,label:`Operations and P95 latency`})}),o.length>0&&(0,R.jsx)(Xe,{verticalSpacing:4,fz:`sm`,children:(0,R.jsx)(Xe.Tbody,{children:o.map(e=>(0,R.jsxs)(Xe.Tr,{children:[(0,R.jsxs)(Xe.Td,{children:[(0,R.jsx)(Ne,{variant:`light`,size:`xs`,mr:6,style:{minWidth:`max-content`},children:e.method}),(0,R.jsx)(y,{component:`span`,size:`sm`,ff:`monospace`,children:e.path})]}),(0,R.jsx)(Xe.Td,{ta:`right`,children:(0,R.jsxs)(y,{component:`span`,size:`sm`,c:`dimmed`,children:[ha.format(e.calls),` calls`]})}),(0,R.jsx)(Xe.Td,{ta:`right`,children:(0,R.jsx)(y,{component:`span`,size:`sm`,ff:`monospace`,children:_a(e.p95_ms)})})]},`${e.method}-${e.path}`))})})]})}gI([OB]);function zG({widget:e,filters:t,dark:n,onOpenChat:r}){let i=Se(t,e.config,[`service`]),a=Ce(`topology`,i),o=a.data?.data,s=(0,L.useMemo)(()=>{if(!o)return null;let e=pG(n),t=mG(n),r=n=>n===`unhealthy`?t.bad:n===`degraded`?t.warn:n===`unknown`?e.muted:t.ok,i=[...o.nodes].sort((e,t)=>e.service.localeCompare(t.service));return{tooltip:{backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:Te.micro}},series:[{type:`graph`,layout:`circular`,circular:{rotateLabel:!1},roam:!1,draggable:!1,label:{show:!0,position:`bottom`,color:e.text,fontSize:Te.micro},edgeSymbol:[`none`,`arrow`],edgeSymbolSize:6,data:i.map(t=>({id:t.service,name:t.service,value:t.spans,symbol:gG(t.health),symbolSize:vG(t.health)*Math.min(34,18+Math.log10(Math.max(t.spans,1))*4),itemStyle:{color:e.surface,borderColor:r(t.health),borderWidth:3,borderType:_G(t.health)}})),links:o.edges.map(n=>{let r=n.error_rate>=.05;return{source:n.caller,target:n.callee,value:n.calls,lineStyle:{width:r?3.5:Math.min(3,1+Math.log10(Math.max(n.calls,1))),color:r?t.bad:e.muted,opacity:r?.95:.35,curveness:.08}}}),emphasis:{focus:`adjacency`}}]}},[n,o]);return a.isError?(0,R.jsx)(EG,{retry:()=>void a.refetch()}):o&&o.nodes.length===0?(0,R.jsx)(TG,{text:`No service relationships in this window`}):(0,R.jsxs)(re,{gap:4,h:`100%`,children:[s&&(0,R.jsx)(dG,{option:s,height:`100%`,className:`widget-chart`,label:`Service dependency graph`,onClick:e=>{let t=e;t.dataType===`node`&&t.data?.id&&r(`Investigate the ${t.data.id} service. Explain its errors and latency.`)}}),o&&(0,R.jsxs)(y,{c:`dimmed`,size:`xs`,children:[o.nodes.length,` services · `,o.edges.length,` `,o.edges.length===1?`route`:`routes`]})]})}function BG(e){return e.length>12?`${e.slice(0,8)}…${e.slice(-4)}`:e}function VG({widget:e,filters:t,dark:n}){let r=Ce(`trace`,Se(t,e.config,[`trace_id`,`service`]));if(r.isError)return(0,R.jsx)(EG,{retry:()=>void r.refetch()});let i=r.data?.data;if(i&&i.spans.length===0)return(0,R.jsx)(TG,{text:`No traces in this window`});let a=[...i?.spans??[]].sort((e,t)=>t.duration_ms-e.duration_ms).slice(0,6);return(0,R.jsxs)(re,{gap:`sm`,children:[(0,R.jsxs)(vn,{cols:{base:2,sm:4},spacing:`sm`,children:[(0,R.jsx)(xG,{label:`Duration`,value:i?_a(i.duration_ms):`—`}),(0,R.jsx)(xG,{label:`Spans`,value:i?ha.format(i.spans.length):`—`}),(0,R.jsx)(xG,{label:`Services`,value:i?ha.format(i.services.length):`—`}),(0,R.jsx)(xG,{label:`Status`,value:i?i.has_error?`Error`:`OK`:`—`,color:i?i.has_error?`bad`:`ok`:void 0})]}),a.length>0&&(0,R.jsx)(HG,{spans:a,dark:n}),i&&(0,R.jsxs)(w,{gap:4,children:[(0,R.jsxs)(y,{c:`dimmed`,size:`xs`,ff:`monospace`,children:[`Trace `,BG(i.trace_id)]}),(0,R.jsx)(UG,{value:i.trace_id})]})]})}function HG({spans:e,dark:t}){let n=Math.min(...e.map(e=>new Date(e.start).valueOf())),r=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),i=Math.max(r-n,1);return(0,R.jsx)(re,{gap:4,children:e.map(e=>{let r=(new Date(e.start).valueOf()-n)/i*100,a=Math.max(e.duration_ms/i*100,.6),o=e.status.toUpperCase().includes(`ERROR`);return(0,R.jsxs)(w,{gap:`sm`,wrap:`nowrap`,children:[(0,R.jsxs)(se,{w:170,miw:0,children:[(0,R.jsx)(y,{size:`xs`,fw:600,truncate:!0,children:e.operation}),(0,R.jsx)(y,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]}),(0,R.jsx)(ze,{label:`${e.service} · ${e.operation} · ${_a(e.duration_ms)}`,withArrow:!0,children:(0,R.jsx)(se,{pos:`relative`,h:10,flex:1,bg:`var(--mantine-color-default-hover)`,style:{borderRadius:`var(--mantine-radius-sm)`},children:(0,R.jsx)(se,{pos:`absolute`,left:`${r}%`,w:`${Math.min(a,100-r)}%`,h:`100%`,bg:o?`bad`:hG(e.service,t),style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}})})}),(0,R.jsx)(y,{size:`xs`,ff:`monospace`,w:56,ta:`right`,children:_a(e.duration_ms)})]},e.span_id)})})}function UG({value:e}){let{state:t,copy:n}=Ze();return(0,R.jsx)(ze,{label:t===`failed`?`Could not copy`:t===`copied`?`Copied`:`Copy trace id`,children:(0,R.jsx)(Ye,{variant:`subtle`,color:`gray`,size:`xs`,"aria-label":`Copy trace id`,"data-state":t===`idle`?void 0:t,onClick:()=>n(e),children:t===`copied`?(0,R.jsx)(E,{size:12,weight:`bold`}):(0,R.jsx)(ne,{size:12})})})}var WG={overview:`System health`,topology:`Service map`,activity:`Recent activity`,assistant:`Ask Fanout`,performance:`Performance`,trace:`Trace focus`,logs:`Logs`},GG={overview:IG,topology:zG,activity:kG,assistant:AG,performance:RG,trace:VG,logs:FG};function KG(){return(0,R.jsx)(TG,{text:`This view type is not supported by this version`})}function qG(e){return Object.hasOwn(GG,e)?GG[e]:KG}function JG(e){let{widget:t,services:n,onRemove:r,onConfigure:i}=e,[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1),d=qG(t.type);return(0,R.jsxs)(ce,{withBorder:!0,radius:`lg`,p:`md`,h:`100%`,className:`widget-card`,style:{overflow:`hidden`},children:[(0,R.jsxs)(re,{h:`100%`,gap:`sm`,children:[(0,R.jsxs)(w,{justify:`space-between`,align:`center`,wrap:`nowrap`,className:`widget-drag`,style:{cursor:`grab`},children:[(0,R.jsx)(P,{order:2,fz:`md`,fw:500,lineClamp:1,miw:0,children:t.title}),(0,R.jsxs)(fe,{position:`bottom-end`,withinPortal:!0,opened:a,onChange:o,children:[(0,R.jsx)(fe.Target,{children:(0,R.jsx)(Ye,{className:`widget-actions`,"data-open":a||void 0,variant:`subtle`,color:`gray`,size:`sm`,"aria-label":`Actions for ${t.title}`,children:(0,R.jsx)(ge,{size:18,weight:`bold`})})}),(0,R.jsxs)(fe.Dropdown,{children:[NG(t.type)&&(0,R.jsx)(fe.Item,{leftSection:(0,R.jsx)(An,{size:15}),onClick:()=>c(!0),children:`Configure`}),(0,R.jsx)(fe.Item,{color:`bad`,leftSection:(0,R.jsx)(Fe,{size:15}),onClick:()=>u(!0),children:`Remove`})]})]})]}),(0,R.jsx)(`div`,{className:`widget-body`,children:(0,R.jsx)(d,{...e})})]}),(0,R.jsx)(PG,{opened:s,widget:t,services:n,onClose:()=>c(!1),onSave:i}),(0,R.jsx)(Ke,{opened:l,onClose:()=>u(!1),title:`Remove ${t.title}?`,centered:!0,radius:`md`,children:(0,R.jsxs)(re,{gap:`md`,children:[(0,R.jsx)(y,{size:`sm`,c:`dimmed`,children:`This takes the card off the dashboard for everyone who opens it. You can add it again from Add view, but its size and settings are not kept.`}),(0,R.jsxs)(w,{justify:`flex-end`,gap:`sm`,children:[(0,R.jsx)(ae,{variant:`default`,size:`sm`,onClick:()=>u(!1),children:`Cancel`}),(0,R.jsx)(ae,{color:`bad`,size:`sm`,onClick:()=>{u(!1),r()},children:`Remove`})]})]})})]})}var YG=ca(oa),XG=`fanout.dashboard-id`,ZG={layout:[],widgets:[],filters:{window:`1h`,namespace:``}};function QG(e){return Object.hasOwn(fa,e)?fa[e]:void 0}function $G({dashboardID:e=``,agentAvailable:t,onOpenChat:n,onDashboardChange:r,urlFilters:i,onFiltersChange:a}){let o=Ue(),s=He(`light`)===`dark`,c=Ge({queryKey:Je,queryFn:()=>qe(`/api/dashboards`),refetchInterval:3e4}),[l,u]=(0,L.useState)(()=>e||localStorage.getItem(XG)||``),d=Qe({mutationFn:async e=>{if(!f.data)throw Error(`No dashboard selected`);let t=await F(`/api/dashboards/${encodeURIComponent(f.data.id)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({name:f.data.name,description:f.data.description,state:e})});if(!t.ok)throw Error(`Unable to save dashboard`);return t.json()},scope:{id:`dashboard-${l}`},onSuccess:e=>{o.setQueryData([`dashboard`,e.id],e),o.invalidateQueries({queryKey:Je})},onError:e=>console.error(`Dashboard save failed`,e)}),f=Ge({queryKey:[`dashboard`,l],queryFn:()=>qe(`/api/dashboards/${encodeURIComponent(l)}`),enabled:!!l,refetchInterval:d.isPending||d.isError?!1:3e4}),[p,m]=(0,L.useState)(ZG),[h,g]=(0,L.useState)(`lg`),[_,v]=(0,L.useState)(null),b=(0,L.useMemo)(()=>({window:ke.some(e=>e.value===i?.window)?i.window:p.filters.window,namespace:i?.namespace??p.filters.namespace}),[i?.window,i?.namespace,p.filters.window,p.filters.namespace]),x=Ce(`overview`,Se(b),!!f.data),C=(0,L.useMemo)(()=>(x.data?.data.services??[]).map(e=>e.service),[x.data]),T=Ee();(0,L.useEffect)(()=>{e&&e!==l&&(u(e),localStorage.setItem(XG,e))},[e,l]),(0,L.useEffect)(()=>{let t=c.data?.dashboards;if(t?.length&&!(e&&t.some(t=>t.id===e))&&!e){if(l&&t.some(e=>e.id===l)){r?.(l,!0);return}D((t.find(e=>e.is_default)??t[0]).id,!0)}},[e,c.data,l]),(0,L.useEffect)(()=>{d.isPending||d.isError||f.data?.state&&m(f.data.state)},[f.data?.updated_at,d.isPending,d.isError]),(0,L.useEffect)(()=>{d.reset()},[l]);let E=(0,L.useMemo)(()=>{let e=new Map(p.widgets.map(e=>[e.id,e.type])),t=p.layout.map(t=>{let n=QG(e.get(t.i)??`overview`)??fa.overview;return{...t,h:Math.max(t.h,n.minH),minW:Math.max(t.minW??0,n.minW),minH:Math.max(t.minH??0,n.minH)}});return{lg:t,md:t,sm:ua(t,6),xs:ua(t,2),xxs:ua(t,1)}},[p.layout,p.widgets]);function D(e,t=!1){u(e),localStorage.setItem(XG,e),r?.(e,t)}function O(e){m(e),d.mutate(e)}function k(e){let t=Me(),n=fa[e],r=ma(p.layout,n.w,n.h,12,n.minW);O({...p,widgets:[...p.widgets,{id:t,type:e,title:WG[e],enabled:!0}],layout:[...p.layout,{i:t,x:r.x,y:r.y,w:r.w,h:n.h,minW:n.minW,minH:n.minH}]})}function A(e){O({...p,filters:e}),a?.(e)}function j(e){O({...p,widgets:p.widgets.filter(t=>t.id!==e),layout:p.layout.filter(t=>t.i!==e)})}function M(e,t){O({...p,widgets:p.widgets.map(n=>n.id===e?{...n,config:t}:n)})}if(c.isLoading||l&&f.isLoading)return(0,R.jsx)(eK,{label:`Loading your dashboard…`});let N=c.data?.dashboards??[];if(e&&N.length>0&&!N.some(t=>t.id===e))return(0,R.jsx)(tK,{onOpenDefault:()=>D((N.find(e=>e.is_default)??N[0]).id,!0)});if(c.isError||f.isError)return(0,R.jsx)(eK,{label:`Your dashboard is unavailable. Try refreshing.`});let ee=f.data;return ee?(0,R.jsxs)(se,{component:`main`,maw:1440,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,R.jsxs)(re,{gap:`md`,mb:`lg`,children:[(0,R.jsxs)(se,{children:[(0,R.jsx)(P,{order:1,fz:32,lts:`-0.03em`,children:ee.name}),(0,R.jsx)(y,{c:`dimmed`,mt:2,children:ee.description||`A focused view of the signals that matter now.`})]}),(0,R.jsxs)(ct,{align:{base:`stretch`,md:`center`},justify:`space-between`,direction:{base:`column`,md:`row`},gap:`sm`,role:`group`,"aria-label":`Dashboard controls`,children:[(0,R.jsxs)(w,{gap:`sm`,wrap:`wrap`,children:[(0,R.jsx)(ln,{"aria-label":`Window`,value:b.window,onChange:e=>e&&A({...b,window:e}),data:ke,w:{base:`100%`,xs:150},size:`sm`}),(0,R.jsx)(I,{"aria-label":`Namespace`,value:_??b.namespace,onChange:e=>v(e.currentTarget.value),onBlur:e=>{v(null),A({...b,namespace:e.currentTarget.value.trim()})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},placeholder:`All namespaces`,w:{base:`100%`,xs:200},size:`sm`})]}),(0,R.jsxs)(w,{gap:`sm`,wrap:`wrap`,justify:`flex-end`,children:[T&&(0,R.jsxs)(y,{c:`dimmed`,size:`xs`,children:[`Updated `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(T))]}),(0,R.jsxs)(fe,{shadow:`md`,position:`bottom-end`,withinPortal:!0,children:[(0,R.jsx)(fe.Target,{children:(0,R.jsx)(ae,{variant:`default`,size:`sm`,leftSection:(0,R.jsx)(Pe,{size:15,weight:`bold`}),rightSection:(0,R.jsx)(En,{size:13,weight:`bold`}),children:`Add view`})}),(0,R.jsx)(fe.Dropdown,{children:da.filter(e=>t||e!==`assistant`).map(e=>(0,R.jsx)(fe.Item,{onClick:()=>k(e),children:WG[e]},e))})]}),t&&(0,R.jsx)(ae,{variant:`subtle`,color:`gray`,size:`sm`,rightSection:(0,R.jsx)(wn,{size:15,weight:`bold`}),onClick:()=>n(),children:`Ask Fanout`})]})]})]}),d.isError&&(0,R.jsx)(S,{color:`bad`,radius:`lg`,mb:`lg`,icon:(0,R.jsx)($e,{size:18,weight:`fill`}),title:`Dashboard changes not saved`,children:(0,R.jsxs)(w,{justify:`space-between`,gap:`sm`,children:[(0,R.jsx)(y,{size:`sm`,children:`Your latest edits are kept on this screen but Fanout could not store them.`}),(0,R.jsx)(ae,{size:`compact-sm`,color:`bad`,variant:`light`,onClick:()=>d.mutate(p),children:`Retry save`})]})}),(0,R.jsx)(YG,{className:`dashboard-grid`,layouts:E,breakpoints:{lg:1100,md:800,sm:600,xs:420,xxs:0},cols:{lg:12,md:10,sm:6,xs:2,xxs:1},rowHeight:76,margin:[16,16],containerPadding:[0,0],compactType:`vertical`,draggableHandle:`.widget-drag`,draggableCancel:`button,input,select,textarea,a,label,[role=menu],[role=dialog],.widget-actions`,onBreakpointChange:g,onDragStop:e=>{h===`lg`&&O({...p,layout:[...e]})},onResizeStop:e=>{h===`lg`&&O({...p,layout:[...e]})},children:p.widgets.map(e=>(0,R.jsx)(`div`,{children:(0,R.jsx)(JG,{widget:e,filters:b,dark:s,services:C,agentAvailable:t,onOpenChat:n,onRemove:()=>j(e.id),onConfigure:t=>M(e.id,t)})},e.id))})]}):(0,R.jsx)(eK,{label:`Preparing your dashboard…`})}function eK({label:e}){return(0,R.jsxs)(A,{mih:`50vh`,children:[(0,R.jsx)(m,{size:`sm`}),(0,R.jsx)(y,{c:`dimmed`,size:`sm`,ml:`sm`,children:e})]})}function tK({onOpenDefault:e}){return(0,R.jsx)(A,{mih:`50vh`,children:(0,R.jsxs)(re,{align:`center`,gap:`xs`,children:[(0,R.jsx)(P,{order:1,fz:24,lts:`-0.02em`,children:`This dashboard isn't here`}),(0,R.jsx)(y,{c:`dimmed`,size:`sm`,ta:`center`,children:`The link may be out of date, or the dashboard may have been renamed or deleted.`}),(0,R.jsx)(ae,{mt:`sm`,variant:`default`,size:`sm`,onClick:e,children:`Open your default dashboard`})]})})}export{$G as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards._dashboardId-8CsBOcHC.js b/internal/ui/dist/assets/dashboards._dashboardId-DT7kwfWv.js similarity index 53% rename from internal/ui/dist/assets/dashboards._dashboardId-8CsBOcHC.js rename to internal/ui/dist/assets/dashboards._dashboardId-DT7kwfWv.js index 3a37506ff..1ddea1059 100644 --- a/internal/ui/dist/assets/dashboards._dashboardId-8CsBOcHC.js +++ b/internal/ui/dist/assets/dashboards._dashboardId-DT7kwfWv.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{l as t}from"./auth-DNoFbJyG.js";import{a as n}from"./preload-helper-xxyQ8-YB.js";import{t as r}from"./dashboard-BdaKmdJW.js";import{t as i}from"./index-BDUrV3R6.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=n();return(0,a.jsx)(r,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-DGL83-Oj.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-DZaR38po.js b/internal/ui/dist/assets/dashboards.index-DZaR38po.js deleted file mode 100644 index 6516ffba8..000000000 --- a/internal/ui/dist/assets/dashboards.index-DZaR38po.js +++ /dev/null @@ -1 +0,0 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{l as t}from"./auth-DNoFbJyG.js";import{a as n}from"./preload-helper-xxyQ8-YB.js";import{t as r}from"./dashboard-BdaKmdJW.js";import{n as i}from"./index-BDUrV3R6.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=n();return(0,a.jsx)(r,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-Ds_9_kmf.js b/internal/ui/dist/assets/dashboards.index-Ds_9_kmf.js new file mode 100644 index 000000000..a6bcd1471 --- /dev/null +++ b/internal/ui/dist/assets/dashboards.index-Ds_9_kmf.js @@ -0,0 +1 @@ +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-DGL83-Oj.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-BDUrV3R6.js b/internal/ui/dist/assets/index-DGL83-Oj.js similarity index 89% rename from internal/ui/dist/assets/index-BDUrV3R6.js rename to internal/ui/dist/assets/index-DGL83-Oj.js index c9dc7f231..8edf69096 100644 --- a/internal/ui/dist/assets/index-BDUrV3R6.js +++ b/internal/ui/dist/assets/index-DGL83-Oj.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-wwkRMEW5.js","assets/brand-MzZ03bSa.js","assets/auth-DNoFbJyG.js","assets/chat.index-DjTlEgB5.js","assets/chat-B0CA6UcR.js","assets/preload-helper-xxyQ8-YB.js","assets/copy-tlUaIRYM.js","assets/chat._threadId-DjTlEgB5.js","assets/dashboards.index-DZaR38po.js","assets/dashboard-BdaKmdJW.js","assets/tokens-6to9Eext.js","assets/use-computed-color-scheme-6JIsge00.js","assets/dashboards._dashboardId-8CsBOcHC.js"])))=>i.map(i=>d[i]); -import{B as e,C as t,F as n,G as r,H as i,I as a,J as o,K as s,L as c,M as l,N as u,O as d,P as f,S as p,St as m,V as h,W as g,X as _,Y as v,_ as y,_t as b,a as x,at as ee,b as te,ct as ne,d as re,dt as S,et as ie,f as ae,ft as oe,gt as se,h as ce,ht as le,j as ue,k as de,l as C,mt as fe,nt as pe,pt as me,rt as he,s as ge,st as _e,t as ve,u as ye,ut as be,x as xe,yt as Se}from"./brand-MzZ03bSa.js";import{a as Ce,c as we,d as Te,h as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./auth-DNoFbJyG.js";import{$ as Pe,A as Fe,At as Ie,B as Le,Bt as Re,C as ze,Ct as Be,D as Ve,Dt as He,E as Ue,Et as We,F as Ge,Ft as Ke,G as qe,Gt as Je,H as Ye,Ht as Xe,I as Ze,It as Qe,J as $e,Jt as et,Kt as tt,L as nt,Lt as rt,M as it,Mt as at,N as ot,Nt as st,O as ct,Ot as lt,P as ut,Pt as dt,Q as ft,Qt as pt,R as mt,Rt as ht,S as gt,St as _t,T as vt,Tt as yt,U as bt,Ut as xt,V as St,Vt as Ct,W as wt,Wt as Tt,X as Et,Xt as Dt,Y as Ot,Yt as kt,Z as At,Zt as jt,_t as Mt,a as Nt,at as Pt,b as Ft,bt as It,ct as Lt,d as Rt,g as zt,gt as Bt,h as Vt,ht as Ht,i as Ut,it as Wt,j as Gt,jt as Kt,kt as qt,l as Jt,lt as Yt,mt as Xt,n as Zt,nt as Qt,o as $t,ot as en,pt as tn,qt as nn,r as rn,rt as an,s as on,st as sn,t as cn,tt as ln,u as un,v as dn,vt as fn,w as pn,wt as mn,x as hn,xt as gn,y as _n,yt as vn,z as yn,zt as bn}from"./tokens-6to9Eext.js";import{A as xn,E as Sn,a as Cn,f as wn,i as Tn,k as En,n as Dn,o as On,r as kn,s as An,t as jn}from"./preload-helper-xxyQ8-YB.js";import{n as Mn,t as Nn}from"./use-computed-color-scheme-6JIsge00.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Pn=b((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,re=-1;function S(){return g?!0:!(e.unstable_now()-ret&&S());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=S,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Fn=b(((e,t)=>{t.exports=Pn()})),In=b((e=>{var t=Fn(),n=se(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){e.memoizedState!==null&&ve(Se,e);var t=ye.current,n=ef(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sp._currentValue=pe)}var De,Oe;function ke(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1i.map(i=>d[i]); +import{B as e,C as t,F as n,G as r,H as i,I as a,J as o,K as s,L as c,M as l,N as u,O as d,P as f,S as p,St as m,V as h,W as g,X as _,Y as v,_ as y,_t as b,a as x,at as ee,b as te,ct as ne,d as re,dt as S,et as ie,f as ae,ft as oe,gt as se,h as ce,ht as le,j as ue,k as de,l as C,mt as fe,nt as pe,pt as me,rt as he,s as ge,st as _e,t as ve,u as ye,ut as be,x as xe,yt as Se}from"./brand-MzZ03bSa.js";import{a as Ce,d as we,f as Te,g as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./auth-BeUORN-q.js";import{$ as Pe,A as Fe,B as Ie,C as Le,F as Re,G as ze,H as Be,I as Ve,J as He,K as Ue,L as We,M as Ge,N as Ke,O as qe,P as Je,Q as Ye,R as Xe,S as Ze,U as Qe,V as $e,W as et,X as tt,Y as nt,Z as rt,a as it,at,b as ot,ct as st,d as ct,dt as lt,et as ut,ft as dt,g as ft,h as pt,i as mt,it as ht,j as gt,k as _t,l as vt,lt as yt,n as bt,nt as xt,o as St,ot as Ct,q as wt,r as Tt,rt as Et,s as Dt,st as Ot,t as kt,tt as At,u as jt,ut as Mt,v as Nt,w as Pt,x as Ft,y as It,z as Lt}from"./tokens-CvbGYJRX.js";import{C as Rt,b as zt,o as Bt,t as Vt,w as Ht}from"./Tooltip-BJiO7C_G.js";import{n as Ut,t as Wt}from"./use-computed-color-scheme-6JIsge00.js";import{A as Gt,C as Kt,D as qt,E as Jt,F as Yt,H as Xt,I as Zt,L as Qt,M as $t,N as en,O as tn,P as nn,R as rn,S as an,_ as on,a as sn,b as cn,c as ln,d as un,f as dn,g as fn,h as pn,i as mn,j as hn,k as gn,l as _n,m as vn,n as yn,o as bn,p as xn,r as Sn,t as Cn,u as wn,v as Tn,x as En,y as Dn}from"./api-Be5Lq4YA.js";import{a as On,i as kn,n as An,o as jn,r as Mn,t as Nn}from"./preload-helper-BL3qEkUh.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Pn=b((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,re=-1;function S(){return g?!0:!(e.unstable_now()-ret&&S());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=S,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Fn=b(((e,t)=>{t.exports=Pn()})),In=b((e=>{var t=Fn(),n=se(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){e.memoizedState!==null&&ve(Se,e);var t=ye.current,n=ef(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sp._currentValue=pe)}var De,Oe;function ke(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1)`:-1`)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ae=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ke(n):``}function Me(e,t){switch(e.tag){case 26:case 27:case 5:return ke(e.type);case 16:return ke(`Lazy`);case 13:return e.child!==t&&t!==null?ke(`Suspense Fallback`):ke(`Suspense`);case 19:return ke(`SuspenseList`);case 0:case 15:return je(e.type,!1);case 11:return je(e.type.render,!1);case 1:return je(e.type,!0);case 31:return ke(`Activity`);default:return``}}function Ne(e){try{var t=``,n=null;do t+=Me(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var Pe=Object.prototype.hasOwnProperty,Fe=t.unstable_scheduleCallback,Ie=t.unstable_cancelCallback,Le=t.unstable_shouldYield,Re=t.unstable_requestPaint,ze=t.unstable_now,Be=t.unstable_getCurrentPriorityLevel,Ve=t.unstable_ImmediatePriority,He=t.unstable_UserBlockingPriority,Ue=t.unstable_NormalPriority,We=t.unstable_LowPriority,Ge=t.unstable_IdlePriority,Ke=t.log,qe=t.unstable_setDisableYieldValue,Je=null,Ye=null;function Xe(e){if(typeof Ke==`function`&&qe(e),Ye&&typeof Ye.setStrictMode==`function`)try{Ye.setStrictMode(Je,e)}catch{}}var Ze=Math.clz32?Math.clz32:et,Qe=Math.log,$e=Math.LN2;function et(e){return e>>>=0,e===0?32:31-(Qe(e)/$e|0)|0}var tt=256,nt=262144,rt=4194304;function it(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function at(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=it(n))):i=it(o):i=it(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=it(n))):i=it(o)):i=it(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function ot(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function st(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ct(){var e=rt;return rt<<=1,!(rt&62914560)&&(rt=4194304),e}function lt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ut(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function dt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),wn=!1;if(Cn)try{var Tn={};Object.defineProperty(Tn,"passive",{get:function(){wn=!0}}),window.addEventListener(`test`,Tn,Tn),window.removeEventListener(`test`,Tn,Tn)}catch{wn=!1}var En=null,Dn=null,On=null;function kn(){if(On)return On;var e,t=Dn,n=t.length,r,i=`value`in En?En.value:En.textContent,a=i.length;for(e=0;e=cr),dr=` `,fr=!1;function pr(e,t){switch(e){case`keyup`:return or.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function mr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var hr=!1;function gr(e,t){switch(e){case`compositionend`:return mr(t);case`keypress`:return t.which===32?(fr=!0,dr):null;case`textInput`:return e=t.data,e===dr&&fr?null:e;default:return null}}function _r(e,t){if(hr)return e===`compositionend`||!sr&&pr(e,t)?(e=kn(),On=Dn=En=null,hr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=zr(n)}}function Vr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Xt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Xt(e.document)}return t}function Ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Wr=Cn&&`documentMode`in document&&11>=document.documentMode,Gr=null,Kr=null,qr=null,Jr=!1;function Yr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jr||Gr==null||Gr!==Xt(r)||(r=Gr,`selectionStart`in r&&Ur(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),qr&&Rr(qr,r)||(qr=r,r=Ld(Kr,`onSelect`),0>=o,i-=o,zi=1<<32-Ze(t)+i|n<m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Ji&&Vi(i,m),l;if(d===null){for(;mh?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),Ji&&Vi(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Ji&&Vi(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Ji&&Vi(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===re&&Ha(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ya(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=Ei(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=Ti(o.type,o.key,o.props,null,e.mode,c),Ya(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ki(o,e.mode,c),c.return=e,e=c}return s(e);case re:return o=Ha(o),x(e,r,o,c)}if(de(o))return v(e,r,o,c);if(oe(o)){if(l=oe(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Ja(o),c);if(o.$$typeof===b)return x(e,r,ga(e,o),c);Xa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{qa=0;var i=x(e,t,n,r);return Ka=null,i}catch(t){if(t===Ia||t===Ra)throw t;var a=Ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Qa=Za(!0),$a=Za(!1),eo=!1;function to(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function no(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ro(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function io(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Wl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=bi(e),yi(e,null,n),t}return gi(e,r,t,n),bi(e)}function ao(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,pt(e,n)}}function oo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var so=!1;function co(){if(so){var e=Da;if(e!==null)throw e}}function lo(e,t,n,r){so=!1;var i=e.updateQueue;eo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(ql&p)===p:(r&p)===p){p!==0&&p===Ea&&(so=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:eo=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),tu|=o,e.lanes=o,e.memoizedState=d}}function uo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function fo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=C.T,s={};C.T=s,Ws(e,!1,t,n);try{var c=i(),l=C.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Us(e,t,Aa(c,r),Cu(e)):Us(e,t,r,Cu(e))}catch(n){Us(e,t,{then:function(){},status:`rejected`,reason:n},Cu())}finally{fe.p=a,o!==null&&s.types!==null&&(o.types=s.types),C.T=o}}function Ns(){}function Ps(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Fs(e).queue;Ms(e,a,t,pe,n===null?Ns:function(){return Is(e),n(r)})}function Fs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:pe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Is(e){var t=Fs(e);t.next===null&&(t=e.alternate.memoizedState),Us(e,t.next.queue,{},Cu())}function Ls(){return ha(sp)}function Rs(){return Ko().memoizedState}function zs(){return Ko().memoizedState}function Bs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Cu();e=ro(n);var r=io(t,e,n);r!==null&&(Tu(r,t,n),ao(r,t,n)),t={cache:Sa()},e.payload=t;return}t=t.return}}function Vs(e,t,n){var r=Cu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Gs(e)?Ks(t,n):(n=_i(e,t,n,r),n!==null&&(Tu(n,e,r),qs(n,t,r)))}function Hs(e,t,n){Us(e,t,n,Cu())}function Us(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Gs(e))Ks(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Lr(s,o))return gi(e,t,i,0),Gl===null&&hi(),!1}catch{}if(n=_i(e,t,i,r),n!==null)return Tu(n,e,r),qs(n,t,r),!0}return!1}function Ws(e,t,n,r){if(r={lane:2,revertLane:Sd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Gs(e)){if(t)throw Error(i(479))}else t=_i(e,n,r,2),t!==null&&Tu(t,e,2)}function Gs(e){var t=e.alternate;return e===E||t!==null&&t===E}function Ks(e,t){jo=Ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,pt(e,n)}}var Js={readContext:ha,use:k,useCallback:Lo,useContext:Lo,useEffect:Lo,useImperativeHandle:Lo,useLayoutEffect:Lo,useInsertionEffect:Lo,useMemo:Lo,useReducer:Lo,useRef:Lo,useState:Lo,useDebugValue:Lo,useDeferredValue:Lo,useTransition:Lo,useSyncExternalStore:Lo,useId:Lo,useHostTransitionStatus:Lo,useFormState:Lo,useActionState:Lo,useOptimistic:Lo,useMemoCache:Lo,useCacheRefresh:Lo};Js.useEffectEvent=Lo;var Ys={readContext:ha,use:k,useCallback:function(e,t){return D().memoizedState=[e,t===void 0?null:t],e},useContext:ha,useEffect:ys,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),_s(4194308,4,Ts.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _s(4194308,4,e,t)},useInsertionEffect:function(e,t){_s(4,2,e,t)},useMemo:function(e,t){var n=D();t=t===void 0?null:t;var r=e();if(Mo){Xe(!0);try{e()}finally{Xe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=D();if(n!==void 0){var i=n(t);if(Mo){Xe(!0);try{n(t)}finally{Xe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Vs.bind(null,E,e),[r.memoizedState,e]},useRef:function(e){var t=D();return e={current:e},t.memoizedState=e},useState:function(e){e=rs(e);var t=e.queue,n=Hs.bind(null,E,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ds,useDeferredValue:function(e,t){return As(D(),e,t)},useTransition:function(){var e=rs(!1);return e=Ms.bind(null,E,e.queue,!0,!1),D().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=E,a=D();if(Ji){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Gl===null)throw Error(i(349));ql&127||$o(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ys(es.bind(null,r,o,e),[e]),r.flags|=2048,hs(9,{destroy:void 0},j.bind(null,r,o,n,t),null),n},useId:function(){var e=D(),t=Gl.identifierPrefix;if(Ji){var n=Bi,r=zi;n=(r&~(1<<32-Ze(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=No++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[bt]=t,o[xt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Kd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&zc(t)}}return Wc(t),Bc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&zc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=xe.current,ta(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ki,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[bt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ud(e.nodeValue,n)),e||Qi(t,!0)}else e=Qd(e).createTextNode(r),e[bt]=t,t.stateNode=e}return Wc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ta(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[bt]=t}else na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wc(t),e=!1}else n=ra(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(wo(t),t):(wo(t),null);if(t.flags&128)throw Error(i(558))}return Wc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ta(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[bt]=t}else na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wc(t),a=!1}else a=ra(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(wo(t),t):(wo(t),null)}return wo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Hc(t,t.updateQueue),Wc(t),null);case 4:return we(),e===null&&Nd(t.stateNode.containerInfo),Wc(t),null;case 10:return la(t.type),Wc(t),null;case 19:if(_e(To),r=t.memoizedState,r===null)return Wc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Uc(r,!1);else{if(eu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Eo(e),o!==null){for(t.flags|=128,Uc(r,!1),e=o.updateQueue,t.updateQueue=e,Hc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)wi(n,e),n=n.sibling;return ve(To,To.current&1|2),Ji&&Vi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ze()>du&&(t.flags|=128,a=!0,Uc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Eo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Hc(t,e),Uc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ji)return Wc(t),null}else 2*ze()-r.renderingStartTime>du&&n!==536870912&&(t.flags|=128,a=!0,Uc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Wc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ze(),e.sibling=null,n=To.current,ve(To,a?n&1|2:n&1),Ji&&Vi(t,r.treeForkCount),e);case 22:case 23:return wo(t),_o(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Wc(t),t.subtreeFlags&6&&(t.flags|=8192)):Wc(t),n=t.updateQueue,n!==null&&Hc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&_e(Ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),la(xa),Wc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Kc(e,t){switch(Wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return la(xa),we(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ee(t),null;case 31:if(t.memoizedState!==null){if(wo(t),t.alternate===null)throw Error(i(340));na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(wo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(To),null;case 4:return we(),null;case 10:return la(t.type),null;case 22:case 23:return wo(t),_o(),e!==null&&_e(Ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return la(xa),null;case 25:return null;default:return null}}function qc(e,t){switch(Wi(t),t.tag){case 3:la(xa),we();break;case 26:case 27:case 5:Ee(t);break;case 4:we();break;case 31:t.memoizedState!==null&&wo(t);break;case 13:wo(t);break;case 19:_e(To);break;case 10:la(t.type);break;case 22:case 23:wo(t),_o(),e!==null&&_e(Ma);break;case 24:la(xa)}}function Jc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){td(t,t.return,e)}}function Yc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){td(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){td(t,t.return,e)}}function Xc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{fo(t,n)}catch(t){td(e,e.return,t)}}}function Zc(e,t,n){n.props=nc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){td(e,t,n)}}function R(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){td(e,t,n)}}function Qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){td(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){td(e,t,n)}else n.current=null}}function $c(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){td(e,e.return,t)}}function el(e,t,n){try{var r=e.stateNode;qd(r,e.type,n,t),r[xt]=t}catch(t){td(e,e.return,t)}}function tl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&uf(e.type)||e.tag===4}function nl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||tl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&uf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function rl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=mn));else if(r!==4&&(r===27&&uf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(rl(e,t,n),e=e.sibling;e!==null;)rl(e,t,n),e=e.sibling}function il(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&uf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(il(e,t,n),e=e.sibling;e!==null;)il(e,t,n),e=e.sibling}function al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Kd(t,r,n),t[bt]=e,t[xt]=n}catch(t){td(e,e.return,t)}}var ol=!1,sl=!1,cl=!1,ll=typeof WeakSet==`function`?WeakSet:Set,ul=null;function dl(e,t){if(e=e.containerInfo,Xd=hp,e=Hr(e),Ur(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Zd={focusedElem:e,selectionRange:n},hp=!1,ul=t;ul!==null;)if(t=ul,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ul=e;else for(;ul!==null;){switch(t=ul,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Kd(o,r,n),o[bt]=e,Nt(o),r=o;break a;case`link`:var s=Zf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Br(s,h),v=Br(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,C.T=null,n=yu,yu=null;var o=hu,s=_u;if(mu=0,gu=hu=null,_u=0,Wl&6)throw Error(i(331));var c=Wl;if(Wl|=4,zl(o.current),jl(o,o.current,s,n),Wl=c,hd(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot==`function`)try{Ye.onPostCommitFiberRoot(Je,o)}catch{}return!0}finally{fe.p=a,C.T=r,Zu(e,t)}}function ed(e,t,n){t=ji(n,t),t=cc(e.stateNode,t,2),e=io(e,t,2),e!==null&&(ut(e,2),md(e))}function td(e,t,n){if(e.tag===3)ed(e,e,n);else for(;t!==null;){if(t.tag===3){ed(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(pu===null||!pu.has(r))){e=ji(n,e),n=lc(2),r=io(t,n,2),r!==null&&(uc(n,r,t,e),ut(r,2),md(r));break}}t=t.return}}function nd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ul;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ql=!0,i.add(n),e=rd.bind(null,e,t,n),t.then(e,e))}function rd(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Gl===e&&(ql&n)===n&&(eu===4||eu===3&&(ql&62914560)===ql&&300>ze()-lu?!(Wl&2)&&Mu(e,0):ru|=n,au===ql&&(au=0)),md(e)}function id(e,t){t===0&&(t=ct()),e=vi(e,t),e!==null&&(ut(e,t),md(e))}function ad(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),id(e,n)}function od(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),id(e,n)}function sd(e,t){return Fe(e,t)}var cd=null,ld=null,ud=!1,dd=!1,fd=!1,pd=0;function md(e){e!==ld&&e.next===null&&(ld===null?cd=ld=e:ld=ld.next=e),dd=!0,ud||(ud=!0,xd())}function hd(e,t){if(!fd&&dd){fd=!0;do for(var n=!1,r=cd;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ze(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,bd(r,a))}else a=ql,a=at(r,r===Gl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ot(r,a)||(n=!0,bd(r,a))}r=r.next}while(n);fd=!1}}function gd(){_d()}function _d(){dd=ud=!1;var e=0;pd!==0&&rf()&&(e=pd);for(var t=ze(),n=null,r=cd;r!==null;){var i=r.next,a=vd(r,t);a===0?(r.next=null,n===null?cd=i:n.next=i,i===null&&(ld=n)):(n=r,(e!==0||a&3)&&(dd=!0)),r=i}mu!==0&&mu!==5||hd(e,!1),pd!==0&&(pd=0)}function vd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Jd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Mf(e,t,n){var r=jf;if(r&&typeof t==`string`&&t){var i=Qt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Ef.has(i)||(Ef.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Kd(t,`link`,e),Nt(t),r.head.appendChild(t)))}}function Nf(e){Of.D(e),Mf(`dns-prefetch`,e,null)}function Pf(e,t){Of.C(e,t),Mf(`preconnect`,e,t)}function Ff(e,t,n){Of.L(e,t,n);var r=jf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Qt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Qt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Qt(n.imageSizes)+`"]`)):i+=`[href="`+Qt(e)+`"]`;var a=i;switch(t){case`style`:a=Vf(e);break;case`script`:a=Gf(e)}Tf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Tf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Hf(a))||t===`script`&&r.querySelector(Kf(a))||(t=r.createElement(`link`),Kd(t,`link`,e),Nt(t),r.head.appendChild(t)))}}function If(e,t){Of.m(e,t);var n=jf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Qt(r)+`"][href="`+Qt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Gf(e)}if(!Tf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Tf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Kf(a)))return}r=n.createElement(`link`),Kd(r,`link`,e),Nt(r),n.head.appendChild(r)}}}function Lf(e,t,n){Of.S(e,t,n);var r=jf;if(r&&e){var i=Mt(r).hoistableStyles,a=Vf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Hf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Tf.get(a))&&Yf(e,n);var c=o=r.createElement(`link`);Nt(c),Kd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Jf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Rf(e,t){Of.X(e,t);var n=jf;if(n&&e){var r=Mt(n).hoistableScripts,i=Gf(e),a=r.get(i);a||(a=n.querySelector(Kf(i)),a||(e=f({src:e,async:!0},t),(t=Tf.get(i))&&Xf(e,t),a=n.createElement(`script`),Nt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function zf(e,t){Of.M(e,t);var n=jf;if(n&&e){var r=Mt(n).hoistableScripts,i=Gf(e),a=r.get(i);a||(a=n.querySelector(Kf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Tf.get(i))&&Xf(e,t),a=n.createElement(`script`),Nt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bf(e,t,n,r){var a=(a=xe.current)?Df(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Vf(n.href),n=Mt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Vf(n.href);var o=Mt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Hf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Tf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Tf.set(e,n),o||Wf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Gf(n),n=Mt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Vf(e){return`href="`+Qt(e)+`"`}function Hf(e){return`link[rel="stylesheet"][`+e+`]`}function Uf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Wf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Kd(t,`link`,n),Nt(t),e.head.appendChild(t))}function Gf(e){return`[src="`+Qt(e)+`"]`}function Kf(e){return`script[async]`+e}function qf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Qt(n.href)+`"]`);if(r)return t.instance=r,Nt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Nt(r),Kd(r,`style`,a),Jf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Vf(n.href);var o=e.querySelector(Hf(a));if(o)return t.state.loading|=4,t.instance=o,Nt(o),o;r=Uf(n),(a=Tf.get(a))&&Yf(r,a),o=(e.ownerDocument||e).createElement(`link`),Nt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Kd(o,`link`,r),t.state.loading|=4,Jf(o,n.precedence,e),t.instance=o;case`script`:return o=Gf(n.src),(a=e.querySelector(Kf(o)))?(t.instance=a,Nt(a),a):(r=n,(a=Tf.get(o))&&(r=f({},n),Xf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Nt(a),Kd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Jf(r,n.precedence,e));return t.instance}function Jf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function $f(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function ep(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function tp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Vf(r.href),a=t.querySelector(Hf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Nt(a);return}a=t.ownerDocument||t,r=Uf(r),(i=Tf.get(i))&&Yf(r,i),a=a.createElement(`link`),Nt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Kd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=rp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var np=0;function W(e,t){return e.stylesheets&&e.count===0&&ap(e,e.stylesheets),0np?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ap(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ip=null;function ap(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ip=new Map,t.forEach(op,e),ip=null,rp.call(e))}function op(e,t){if(!(t.state.loading&4)){var n=ip.get(e);if(n)var r=n.get(null);else{n=new Map,ip.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=In()}));function Rn(e){return e?.isNotFound===!0}function zn(){try{return sessionStorage}catch{return}}var Bn=`tsr-scroll-restoration-v1_3`,Vn=zn();function Hn(){try{return JSON.parse(Vn?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Un(){try{Vn?.setItem(Bn,JSON.stringify(Wn))}catch{}}var Wn=Hn(),Gn=`data-scroll-restoration-id`,Kn=e=>e.state.__TSR_key||e.href;function qn(e){let t=e.getAttribute(Gn);if(t)return`[${Gn}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Jn=!1,Yn=`window`;function Xn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Zn(e){let t=new Set;for(let n of e){if(n===Yn)continue;let e=Xn(n);e&&t.add(e)}return t}function Qn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Kn,a=new Set,o=e=>{let t=Wn[e]||={};for(let e of a)e===document?t[Yn]={scrollX,scrollY}:e.isConnected&&(t[qn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Jn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Jn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Un()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=Wn[d];if(e){let t=Wn[u];for(let n in e){if(n===Yn){if(s)continue}else{let e=Xn(n);if(!e||s&&o&&(l??=Zn(o),l.has(e)))continue}t||=Wn[u]={},t[n]??=e[n]}}}Jn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Zn(o));let t=e&&i&&c,s=r.restoring?Wn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Yn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Xn(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Jn=!1}}))}function $n(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function er(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function tr(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=er(r):Array.isArray(t)?t.push(er(r)):n[e]=[t,er(r)]}return n}var nr=/^(?:\s|["[{\d-]|fa|nu|tr)/,rr=ar(JSON.parse),ir=or(JSON.stringify,JSON.parse);function ar(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=tr(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function or(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!nr.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=$n(e,r);return t?`?${t}`:``}}function sr(e){return{input:({url:t})=>{for(let n of e)t=lr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=ur(e[n],t);return t}}}function cr(e){let t=st(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=Kt([`/`,t,e.pathname]),e)}}function lr(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function ur(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function dr(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{xt(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var fr=`__TSR_index`,pr=`popstate`,mr=`beforeunload`;function hr(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=yr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[fr];i=gr(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[fr];i=gr(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[fr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function gr(e,t){t||={};let n=br();return{...t,key:n,__TSR_key:n,[fr]:e}}function _r(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>yr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=br();t.history.replaceState({[fr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(ee._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),ee._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=yr(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),ee.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[fr]-l.state[fr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),ee.notify(u);return}}}l=c(),ee.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},ee=hr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(mr,x,{capture:!0}),t.removeEventListener(pr,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(mr,x,{capture:!0}),t.addEventListener(pr,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return ee._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return ee._ignoreSubscribers||y(`REPLACE`),n},ee}function vr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function yr(e,t){let n=vr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=br();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[fr]:0,key:a,__TSR_key:a}}}function br(){return(Math.random()+1).toString(36).substring(7)}function xr(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Sr(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Cr({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function wr(e,t,n,r){for(let i of t){if(r&&e._tx!==r)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r&&e._tx!==r)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var Tr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=qt(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:_r()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Ct(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=dr(this.latestLocation,e),Qn(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=st(a);t&&t!==`/`&&e.push(cr({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:sr(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Re(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&bn(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Tt(e).path,external:!1,searchStr:o,search:jt(t?.search,i),hash:Tt(r.slice(1)).path,state:pt(t?.state,a)}}let o=new URL(i,this.origin),s=lr(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Tt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:jt(t?.search,c),hash:Tt(s.hash.slice(1)).path,state:pt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>at({base:e,to:t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=rt(dt(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{if(t.href){let e=yr(t.href,{});t={...t,to:lr(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=r[2],o=r[3],s=this.resolvePathWithBase(i,t.to?`${t.to}`:`.`),c=jr(t.params,o),l=this.routesByPath[dt(s)],u;if(l)u=this.getRouteBranch(l);else if(s.includes(`$`))u=[];else{let[e,t,n]=this.getMatchedRoutes(s);u=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(u=[...u,this.options.notFoundRoute])}if(u.length&&et(c))for(let e of u){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){c===o&&(c=Object.assign(Object.create(null),c));try{Object.assign(c,t(c))}catch{}}}let d=e.leaveParams?s:Tt(Ie({path:s,params:c,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,f=a;if(e._includeValidateSearch&&this.options.search?.strict){let e={};u.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Or(t.options.validateSearch,{...e,...f}))}catch{}}),f=e}f=kr(f,t,u,e._includeValidateSearch),f=jt(a,f);let p=this.options.stringifySearch(f),m=t.hash===!0?n.hash:t.hash?nn(t.hash,n.hash):void 0,h=m?`#${m}`:``,g=t.state===!0?n.state:t.state?nn(t.state,n.state):{};t.state&&(g=pt(n.state,g));let _=`${d}${p}${h}`,v,y,b=!1;if(this.rewrite){let e=new URL(_,this.origin),t=ur(this.rewrite,e);v=e.href.replace(e.origin,``),t.origin===this.origin?y=t.pathname+t.search+t.hash:(y=t.href,b=!0)}else v=tt(_),y=v;return{publicHref:y,href:v,pathname:d,search:f,searchStr:p,state:g,hash:m??``,external:b,unmaskOnReload:t.unmaskOnReload}},n=t(e);if(e.mask)n.maskedLocation=t({from:e.from,...e.mask});else if(this.options.routeMasks){let r=Qe(n.pathname,this.processedTree);if(r){let i=Object.assign(Object.create(null),r.rawParams),{from:a,params:o,...s}=r.route,c=jr(o,i);n.maskedLocation=t({from:e.from,...s,params:c})}}return n},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=dt(this.latestLocation.href)===dt(n.href)&&Je(Cr(n.state),Cr(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(kt(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Si(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Sr(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&xr(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href){let t=this.buildLocation(e.options).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&kt(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Fr,this.preloadRoute=e=>Ci(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=ht(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!Je(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Je(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??ir,parseSearch:e.parseSearch??rr,protocolAllowlist:e.protocolAllowlist??Xe}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Ke(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:dt(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Ar(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;r&&n&&i.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=Or(n,i);if(r&&e)for(let t in e)t in i||(r.defaulted||=new Map).set(t,e[t]);return{...i,...e}}catch{}return i})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=nn(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function Ar(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return lt}function jr(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let n=Object.assign(Object.create(null),t);return Object.assign(n,nn(e,n))}function Mr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Nr(e,t){return e.options[t]?.preload?.()}function Pr(e,t){let n=Nr(e,`component`),r=Nr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Fr(e,t,n){let r=()=>t===!1?void 0:t?Nr(e,t):Pr(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function Ir(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function Wr(e,t){return e.routesById[t.routeId]}function Gr(e,t,n){return He(e)?[Br,e]:Rn(e)?(e.routeId||=n,[zr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[Rr,e]):[Lr,e]}function Kr(e,t){let n=Gr(t,!0,e.id);if(n[0]!==Rr)return n;try{e.options.onError?.(n[1])}catch(t){n=Gr(t,!0,e.id)}return n}function qr(e,t,n,r,i){return i[0].signal.aborted?Vr:li(e,t,n,Kr(n,r),i)}async function Jr(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;ie.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Xr(e,r),[i,qr(e,t,u,a,n)]}if(c.aborted)return[i,Vr];let p=r.paramsError??r.searchError;if(p!==void 0)return Xr(e,r),[i,qr(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{$r(e,r,`beforeLoad`,n[0]);let a=await Ur(m({...f,search:r.search,context:r.context,...e.options.additionalContext}),c);if(c.aborted)return[i,Vr];let o=li(e,t,u,Gr(a,!1,u.id),n);if(o[0]!==Lr)return Xr(e,r),[i,o];r.context={...r.context,...a}}catch(a){return Xr(e,r),[i,qr(e,t,u,a,n)]}finally{r.status=h,$r(e,r,!1,n[0])}}i()}function Yr(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Xr(e,t){let n=t._flight;t._flight=void 0,Yr(e,t,n)?.abort()}function Zr(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Yr(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Qr(e){for(let t of e){let e=t._flight;e&&e[2]++}}function $r(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function ei(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function ti(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return Vr;if(!i)return[Lr,void 0];let l=n._flight;$r(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(ei(e,t,n,r,s,a,!!o[3]))).then(e=>Gr(e,!1,r.id),e=>Gr(e,!0,r.id)).then(t=>(t[0]!==Lr&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Rr&&l[2]?Kr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],li(e,t,r,await Ur(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Xr(e,n),Vr}finally{$r(e,n,!1,s)}}function ni(e,t,n){t[0]!==Br&&(e.status=`success`,e.error=void 0,t[0]===Lr?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function ri(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Xr(e,r)}function ii(e,t){return t[0]===Rr||t[0]===zr?{...e,status:t[0]===Rr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function ai(e,t,n,r,i,a,o){let s=t[1][n],c=Wr(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(ei(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=Vr)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Xr(e,s),p=qr(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),ee=n>=o?a[7]:void 0,te=c.lazyFn&&c._lazy!==!0?ee:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Yr(e,s,t)?.abort(),n>=o&&(s.status=`pending`),ee?.()}b||(s.isFetching=!1);let ne=(p?Promise.resolve(p):x?ti(e,t,s,c,g,i,a):Promise.resolve([Lr,s.loaderData])).then(t=>(x&&(ni(s,t,l),t[0]===Lr&&(m&&!a[0].signal.aborted&&ri(e,s,u),n>=o&&(s.status=`pending`))),t)),re=Ur(Promise.resolve().then(()=>Fr(c,void 0,te)),a[0].signal).then(()=>void 0,r=>t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound))?void 0:[n,qr(e,t,c,r,a)]).then(e=>ne.then(t=>(x&&!e&&t[0]===Lr&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,ee?.()),e)));if(r.push([n,ne,re]),!y)return ne.then(e=>ii(s,e));let S={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let ie=ti(e,t,S,c,g,i,a).then(e=>(s.isFetching=!1,ni(S,e,!1),e));return(t[2]??=[]).push([n,ie,re,S]),ie.then(e=>ii(S,e))}async function oi(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Wr(e,t[n]);try{let e=Fr(i,!1);e&&await Ur(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function si(e,t){t[2]&&=(Zr(e,t[2].map(e=>e[3])),void 0)}async function ci(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=Br)throw[a,t];!i&&t[0]!==Lr&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===Br)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function li(e,t,n,r,i,a){for(;r[0]===Br;){let o=r[1],s=o.options;if(s.reloadDocument?i[3]:i[1]>=20)return r;try{return s.href&&s.reloadDocument?(e.resolveRedirect(o),r):[Br,o,e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0})]}catch(e){r=a?[Rr,e]:Kr(n,e),a=!0}}return r}async function ui(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===zr?oi(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=Br)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==Lr&&t[0]=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=Br){let n=s[1];if(n[0]!==Br||n[1].options.reloadDocument||n[2])return si(e,t),n;c=!0,s=[0,[Rr,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===Rr?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=Wr(e,u);try{await Ur(i?Promise.resolve().then(()=>Fr(m,l===Rr?`errorComponent`:`notFoundComponent`)):Promise.all([Fr(m),Fr(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return si(e,t),Vr}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),si(e,t),Zr(e,o),p()):u.status=`success`}return t}async function di(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;te._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await oi(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l{for(let t=d;t=Br&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=ui(e,i,u,r[0],ci(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=ci(i[2],void 0,void 0,h.then(e=>Hr(e)?0:Ir(n).length,()=>0))),o=await h}catch(t){if(si(e,i),t===a&&a.aborted)return Vr;throw t}return Hr(o)?o:di(e,o,a,r[6]===n.length?r[6]:0)}function pi(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a0){i[3]=setTimeout(()=>pi(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function mi(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function hi(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!Ir(t[3]).some(e=>e.id===n[1]))return;let i;try{await Ur(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function gi(e,t){e._committed=t,e.stores.setMatches(t)}function _i(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=Ir(n).length,s=new Map;{let t=Date.now();for(let r of[...i,...a.values()]){if(r.status!==`success`||n.some((e,t)=>e.id===r.id&&(t=(r.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||s.set(r.id,a.get(r.id)===r?r:{...r,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=s,gi(e,n),Zr(e,[...a.values(),...i],[...n,...s.values()]),wr(e,i,n,t)}async function vi(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}function yi(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:i.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function bi(e,t,n,r,i){let a=n.map(e=>({...e}));Qr(a);for(let t of r)Xr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await ui(e,o,r,t[0],i)}catch(t){throw Zr(e,a),t}if(Hr(s)){Zr(e,a),s[0]===Br&&e._tx===t&&e._committed===n&&await yi(e,t,s);return}if(await di(e,s,t[0].signal),e._tx!==t||e._committed!==n){Zr(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Xr(e,n))}gi(e,a),Zr(e,n,a)}async function xi(e,t,n,r,i,a){let o=await fi(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Hr(o)){let n=o[0]===Br&&e._tx===t;if((!n||o[1].options.reloadDocument)&&mi(e,t),Zr(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){mi(e,t);return}await yi(e,t,o);return}let s=o[1];if(e._tx===t&&await hi(e,t),e._tx!==t){mi(e,t),Zr(e,s),si(e,o);return}let c=t[2],l=Sr(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await hi(e,t),e._tx!==t){mi(e,t),Zr(e,s),si(e,o);return}let n=await e.startTransition(()=>{mi(e,t),_i(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){si(e,o);return}u?.length&&bi(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function Si(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=Sr(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await vi(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Qr(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){Zr(e,m),await vi(e,n);return}e._preflight=void 0;let g,_=()=>xi(e,y,f,()=>pi(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_).then(),y=[p,s,a,m,Date.now(),v];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&$r(e,t,!1)}n[0].abort(),Zr(e,n[3],y[3],!0)}if(e._tx!==y){Zr(e,y[3]),y[3]=[],g?.(),await vi(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&pi(e,y),g?.(_()),await v,await vi(e,y)}async function Ci(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Qr(a),o=(e._preloads??=new Map).set(i,a),s=await fi(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),Zr(e,a)),i.abort()}if(!Hr(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Rn(e)||console.error(e);return}}}var w=m(se(),1),T=fe(),wi=class extends w.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?w.createElement(this.props.errorComponent??Ti,{error:e,reset:this.reset}):this.props.children}};function Ti({error:e}){let[t,n]=w.useState(!1);return(0,T.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,T.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,T.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,T.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,T.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,T.jsx)(`div`,{children:(0,T.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,T.jsx)(`code`,{children:e.message}):null})}):null]})}var Ei=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(Ei||{});function Di({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Oi(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ki=[],Ai=0,{link:ji,unlink:Mi,propagate:Ni,checkDirty:Pi,shallowPropagate:Fi}=Di({update(e){return e._update()},notify(e){ki[Li++]=e,e.flags&=~Ei.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Ei.Mutable|Ei.Dirty,Vi(e))}}),Ii=0,Li=0,Ri,zi=0;function Bi(e){try{++zi,e()}finally{--zi||Hi()}}function Vi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Mi(n,e)}function Hi(){if(!(zi>0)){for(;Ii{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ri,o=t?.compare??Object.is;if(n)Ri=i,++Ai,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=Ei.Mutable|Ei.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ri=a,n&&(i.flags&=~Ei.RecursedCheck),Vi(i)}}};return n?(i.flags=Ei.Mutable|Ei.Dirty,i.get=function(){let e=i.flags;if(e&Ei.Dirty||e&Ei.Pending&&Pi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Fi(e)}}else e&Ei.Pending&&(i.flags=e&~Ei.Pending);return Ri!==void 0&&ji(i,Ri,Ai),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Ni(e),Fi(e),Hi())}},i}function Wi(e){let t=()=>{let t=Ri;Ri=n,++Ai,n.depsTail=void 0,n.flags=Ei.Watching|Ei.RecursedCheck;try{return e()}finally{Ri=t,n.flags&=~Ei.RecursedCheck,Vi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Ei.Watching|Ei.RecursedCheck,notify(){let e=this.flags;e&Ei.Dirty||e&Ei.Pending&&Pi(this.deps,this)?t():this.flags=Ei.Watching},stop(){this.flags=Ei.None,this.depsTail=void 0,Vi(this)}};return t(),n}function Gi(e){let t=Ne(),n=`not-found-${mn(t.stores.location,e=>e.pathname)}-${mn(t.stores.status,e=>e)}`;return(0,T.jsx)(wi,{getResetKey:()=>n,onCatch:(t,n)=>{if(Rn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Rn(t))return e.fallback?.(t);throw t},children:e.children})}function Ki(){return(0,T.jsx)(`p`,{children:`Not Found`})}function qi(e){return(0,T.jsx)(T.Fragment,{children:e.children})}function Ji(e,t,n){return t.options.notFoundComponent?(0,T.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,T.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,T.jsx)(Ki,{})}function Yi(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,T.jsx)(n,{}):null}var Xi=(e,t)=>e[0]===t[0]&&e[1]===t[1],Zi=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Qi=w.memo(function({routeId:e}){let t=Ne();return(0,T.jsx)($i,{router:t,match:mn(t.stores.getMatchStore(e),e=>e)})});function $i({router:e,match:t}){let n=e.routesById[t.routeId],r=Yi(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=Zi(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?w.Suspense:qi,l=i?wi:qi,u=o?Gi:qi;return(0,T.jsxs)(n.isRoot?n.options.shellComponent??qi:qi,{children:[(0,T.jsx)(yt.Provider,{value:t.routeId,children:(0,T.jsx)(c,{fallback:r,children:(0,T.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Rn(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,T.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return w.createElement(o,e)},children:s?(0,T.jsx)(We,{fallback:r,children:(0,T.jsx)(ea,{match:t})}):(0,T.jsx)(ea,{match:t})})})})}),null]})}var ea=w.memo(function({match:e}){let t=Ne(),n=e.routeId,r=t.routesById[n],i=w.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=w.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,T.jsx)(e,{},i):(0,T.jsx)(ta,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Zi(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Yi(t,r)}if(e.status===`notFound`)return Ji(t,r,e.error);if(e.status===`error`)throw e.error;return a}),ta=w.memo(function(){let e=Ne(),t=w.useContext(yt),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=mn(a,e=>[!!e._notFound,e.error],Xi),i=mn(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Ji(e,e.routesById[t],r);if(!i)return null;let a=(0,T.jsx)(Qi,{routeId:i});return t===`__root__`?(0,T.jsx)(w.Suspense,{fallback:Yi(e),children:a}):a});function na(e,t){let n=e[1];e.length=0,n?.(t)}function ra({t:e}){let t=Ne(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{na(n,!1),n.push(i,a),e(t),w.startTransition(r)}),Ee(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(dt(r.publicHref)!==dt(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...Sr(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function ia(){let e=Ne(),t=e.routesById[lt],n=Yi(e,t),r=e.ssr?qi:w.Suspense,i=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ra,{t:w.useState()[1]}),(0,T.jsx)(r,{fallback:n,children:(0,T.jsx)(aa,{})})]});return e.options.InnerWrap?(0,T.jsx)(e.options.InnerWrap,{children:i}):i}function aa(){let e=Ne(),t=e._rendered,n=mn(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;Ee(()=>{t[0]===n&&na(t,!0)},[t,n]);let a=i?(0,T.jsx)(Qi,{routeId:i}):null;return(0,T.jsx)(yt.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,T.jsx)(wi,{getResetKey:()=>r,onCatch:void 0,children:a})})}var oa=e=>({createMutableStore:Ui,createReadonlyStore:Ui,batch:Bi}),sa=e=>new ca(e),ca=class extends Tr{constructor(e){super(e,oa)}};function la({router:e,children:t,...n}){et(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,T.jsx)(Te.Provider,{value:e,children:t});return e.options.Wrap?(0,T.jsx)(e.options.Wrap,{children:r}):r}function ua({router:e,...t}){return(0,T.jsx)(la,{router:e,...t,children:(0,T.jsx)(ia,{})})}function da(e){let t=Ne({warn:e?.router===void 0}),n=e?.router||t;return mn(n.stores.__store,Be(e,n))}function fa(e,t,n={leading:!1}){let[r,i]=(0,w.useState)(e),a=(0,w.useRef)(!1),o=(0,w.useRef)(null),s=(0,w.useRef)(!1),c=(0,w.useRef)(e);c.current=e;let l=(0,w.useCallback)(()=>{window.clearTimeout(o.current),o.current=null},[]),u=(0,w.useCallback)(()=>{l(),s.current=!1},[]),d=(0,w.useCallback)(()=>{o.current&&(u(),s.current=!1,i(c.current))},[]);return(0,w.useEffect)(()=>{a.current&&(l(),!s.current&&n.leading?(s.current=!0,i(e),o.current=window.setTimeout(()=>{s.current=!1},t)):o.current=window.setTimeout(()=>{s.current=!1,i(e)},t))},[e,n.leading,t]),(0,w.useEffect)(()=>(a.current=!0,u),[]),[r,u,{cancel:u,flush:d}]}function pa(e=!1,t={}){let[n,r]=(0,w.useState)(e),i=(0,w.useCallback)(()=>{r(e=>e||(t.onOpen?.(),!0))},[t.onOpen]),a=(0,w.useCallback)(()=>{r(e=>e&&(t.onClose?.(),!1))},[t.onClose]);return[n,{open:i,close:a,toggle:(0,w.useCallback)(()=>{n?a():i()},[a,i,n]),set:r}]}function ma(e){return e===`auto`||e===`dark`||e===`light`}function ha({key:e=`mantine-color-scheme-value`}={}){let t;return{get:t=>{if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return ma(n)?n:t}catch{return t}},set:t=>{try{window.localStorage.setItem(e,t)}catch(e){console.warn(`[@mantine/core] Local storage color scheme manager was unable to save color scheme.`,e)}},subscribe:n=>{t=t=>{t.storageArea===window.localStorage&&t.key===e&&ma(t.newValue)&&n(t.newValue)},window.addEventListener(`storage`,t)},unsubscribe:()=>{window.removeEventListener(`storage`,t)},clear:()=>{window.localStorage.removeItem(e)}}}function ga(e,t){let n=typeof window<`u`&&`matchMedia`in window&&window.matchMedia(`(prefers-color-scheme: dark)`)?.matches,r=e===`auto`?n?`dark`:`light`:e;t()?.setAttribute(`data-mantine-color-scheme`,r)}function _a({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){let i=(0,w.useRef)(null),[a,o]=(0,w.useState)(()=>e.get(t)),s=r||a,c=(0,w.useCallback)(t=>{r||(ga(t,n),o(t),e.set(t))},[e.set,s,r]),l=(0,w.useCallback)(()=>{o(t),ga(t,n),e.clear()},[e.clear,t]);return(0,w.useEffect)(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),pe(()=>{ga(e.get(t),n)},[]),(0,w.useEffect)(()=>{if(r)return ga(r,n),()=>{};r===void 0&&ga(a,n),typeof window<`u`&&`matchMedia`in window&&(i.current=window.matchMedia(`(prefers-color-scheme: dark)`));let e=e=>{a===`auto`&&ga(e.matches?`dark`:`light`,n)};return i.current?.addEventListener(`change`,e),()=>i.current?.removeEventListener(`change`,e)},[a,r]),{colorScheme:s,setColorScheme:c,clearColorScheme:l}}function va(e){return Object.entries(e).map(([e,t])=>`${e}: ${t};`).join(``)}function ya(e,t){let n=t?[t]:[`:root`,`:host`],r=va(e.variables),i=r?`${n.join(`, `)}{${r}}`:``,a=va(e.dark),o=va(e.light),s=e=>n.map(t=>t===`:host`?`${t}([data-mantine-color-scheme="${e}"])`:`${t}[data-mantine-color-scheme="${e}"]`).join(`, `);return`${i}\n\n${a?`${s(`dark`)}{${a}}`:``}\n\n${o?`${s(`light`)}{${o}}`:``}`}function ba({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:a=!0}){if(!e.colors[t])return{};if(n===`light`){let n=o(e,`light`),s={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${n})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${n===9?8:n+1})`,[`--mantine-color-${r}-light`]:`var(--mantine-color-${r}-1)`,[`--mantine-color-${r}-light-hover`]:`var(--mantine-color-${r}-2)`,[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-9)`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${n})`,[`--mantine-color-${r}-outline-hover`]:i(e.colors[t][n],.05)};return a?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...s}:s}let s=o(e,`dark`),c={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${s})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${s===9?8:s+1})`,[`--mantine-color-${r}-light`]:g(e.colors[t][9],.5),[`--mantine-color-${r}-light-hover`]:g(e.colors[t][9],.3),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-0)`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(s-4,0)})`,[`--mantine-color-${r}-outline-hover`]:i(e.colors[t][Math.max(s-4,0)],.05)};return a?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...c}:c}function xa(e,t,n){me(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}var Sa=e=>{let t=o(e,`light`),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:S(e.defaultRadius),i={variables:{"--mantine-z-index-app":`100`,"--mantine-z-index-modal":`200`,"--mantine-z-index-popover":`300`,"--mantine-z-index-overlay":`400`,"--mantine-z-index-max":`9999`,"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?`antialiased`:`unset`,"--mantine-moz-font-smoothing":e.fontSmoothing?`grayscale`:`unset`,"--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-color-scheme":`light`,"--mantine-primary-color-contrast":tn(e,`light`),"--mantine-color-bright":`var(--mantine-color-black)`,"--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":`var(--mantine-color-red-6)`,"--mantine-color-success":`var(--mantine-color-teal-8)`,"--mantine-color-placeholder":`var(--mantine-color-gray-5)`,"--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":`var(--mantine-color-white)`,"--mantine-color-default-hover":`var(--mantine-color-gray-0)`,"--mantine-color-default-color":`var(--mantine-color-black)`,"--mantine-color-default-border":`var(--mantine-color-gray-4)`,"--mantine-color-dimmed":`var(--mantine-color-gray-6)`,"--mantine-color-disabled":`var(--mantine-color-gray-2)`,"--mantine-color-disabled-color":`var(--mantine-color-gray-5)`,"--mantine-color-disabled-border":`var(--mantine-color-gray-3)`},dark:{"--mantine-color-scheme":`dark`,"--mantine-primary-color-contrast":tn(e,`dark`),"--mantine-color-bright":`var(--mantine-color-white)`,"--mantine-color-text":`var(--mantine-color-dark-0)`,"--mantine-color-body":`var(--mantine-color-dark-7)`,"--mantine-color-error":`var(--mantine-color-red-8)`,"--mantine-color-success":`var(--mantine-color-teal-8)`,"--mantine-color-placeholder":`var(--mantine-color-dark-3)`,"--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":`var(--mantine-color-dark-6)`,"--mantine-color-default-hover":`var(--mantine-color-dark-5)`,"--mantine-color-default-color":`var(--mantine-color-white)`,"--mantine-color-default-border":`var(--mantine-color-dark-4)`,"--mantine-color-dimmed":`var(--mantine-color-dark-2)`,"--mantine-color-disabled":`var(--mantine-color-dark-6)`,"--mantine-color-disabled-color":`var(--mantine-color-dark-3)`,"--mantine-color-disabled-border":`var(--mantine-color-dark-4)`}};xa(i.variables,e.breakpoints,`breakpoint`),xa(i.variables,e.spacing,`spacing`),xa(i.variables,e.fontSizes,`font-size`),xa(i.variables,e.lineHeights,`line-height`),xa(i.variables,e.shadows,`shadow`),xa(i.variables,e.radius,`radius`),xa(i.variables,e.fontWeights,`font-weight`),e.colors[e.primaryColor].forEach((t,n)=>{i.variables[`--mantine-primary-color-${n}`]=`var(--mantine-color-${e.primaryColor}-${n})`}),me(e.colors).forEach(t=>{let n=e.colors[t];if(r(n)){Object.assign(i.light,ba({theme:e,name:n.name,color:n.light,colorScheme:`light`,withColorValues:!0})),Object.assign(i.dark,ba({theme:e,name:n.name,color:n.dark,colorScheme:`dark`,withColorValues:!0})),i.light[`--mantine-color-${n.name}-contrast`]=Xt(n,e,`light`),i.dark[`--mantine-color-${n.name}-contrast`]=Xt(n,e,`dark`);return}n.forEach((e,n)=>{i.variables[`--mantine-color-${t}-${n}`]=e}),Object.assign(i.light,ba({theme:e,color:t,colorScheme:`light`,withColorValues:!1})),Object.assign(i.dark,ba({theme:e,color:t,colorScheme:`dark`,withColorValues:!1}))});let a=e.headings.sizes;return me(a).forEach(t=>{i.variables[`--mantine-${t}-font-size`]=a[t].fontSize,i.variables[`--mantine-${t}-line-height`]=a[t].lineHeight,i.variables[`--mantine-${t}-font-weight`]=a[t].fontWeight||e.headings.fontWeight}),i};function Ca(){let t=u(),n=e(),r=me(t.breakpoints).reduce((e,n)=>{let r=t.breakpoints[n].includes(`px`),i=fn(t.breakpoints[n]);return`${e}@media (max-width: ${r?`${i-.1}px`:be(i-.1)}) {.mantine-visible-from-${n} {display: none !important;}}@media (min-width: ${r?`${i}px`:be(i)}) {.mantine-hidden-from-${n} {display: none !important;}}`},``);return(0,T.jsx)(`style`,{"data-mantine-styles":`classes`,nonce:n?.(),dangerouslySetInnerHTML:{__html:r}})}function wa({theme:e,generator:t}){let n=Sa(e),r=t?.(e);return r?oe(n,r):n}var Ta=Sa(f);function Ea(e){let t={variables:{},light:{},dark:{}};return me(e.variables).forEach(n=>{Ta.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),me(e.light).forEach(n=>{Ta.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),me(e.dark).forEach(n=>{Ta.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function Da(e){return ya({variables:{},dark:{"--mantine-color-scheme":`dark`},light:{"--mantine-color-scheme":`light`}},e)}function Oa({cssVariablesSelector:t,deduplicateCssVariables:n}){let r=u(),i=e(),a=wa({theme:r,generator:c()}),o=(t===void 0||t===`:root`||t===`:host`)&&n,s=ya(o?Ea(a):a,t);return s?(0,T.jsx)(`style`,{"data-mantine-styles":!0,nonce:i?.(),dangerouslySetInnerHTML:{__html:`${s}${o?``:Da(t)}`}}):null}Oa.displayName=`@mantine/CssVariables`;function ka({respectReducedMotion:e,getRootElement:t}){pe(()=>{e&&t()?.setAttribute(`data-respect-reduced-motion`,`true`)},[e])}function Aa({theme:e,children:t,getStyleNonce:r,withStaticClasses:i=!0,withGlobalClasses:a=!0,deduplicateCssVariables:o=!0,withCssVariables:s=!0,cssVariablesSelector:c,classNamesPrefix:u=`mantine`,colorSchemeManager:d=ha(),defaultColorScheme:f=`light`,getRootElement:p=()=>document.documentElement,cssVariablesResolver:m,forceColorScheme:h,stylesTransform:g,env:_,deduplicateInlineStyles:v=!1}){let{colorScheme:y,setColorScheme:b,clearColorScheme:x}=_a({defaultColorScheme:f,forceColorScheme:h,manager:d,getRootElement:p});return ka({respectReducedMotion:e?.respectReducedMotion||!1,getRootElement:p}),(0,T.jsx)(n,{value:{colorScheme:y,setColorScheme:b,clearColorScheme:x,getRootElement:p,classNamesPrefix:u,getStyleNonce:r,cssVariablesResolver:m,cssVariablesSelector:c??`:root`,withStaticClasses:i,stylesTransform:g,env:_,deduplicateInlineStyles:v},children:(0,T.jsxs)(l,{theme:e,children:[s&&(0,T.jsx)(Oa,{cssVariablesSelector:c,deduplicateCssVariables:o}),a&&(0,T.jsx)(Ca,{}),t]})})}Aa.displayName=`@mantine/core/MantineProvider`;function ja(e){return e}var[Ma,Na]=xn(`AppShell was not found in tree`),Pa={root:`m_89ab340`,navbar:`m_45252eee`,aside:`m_9cdde9a`,header:`m_3b16f56b`,main:`m_8983817`,footer:`m_3840c879`,section:`m_6dcfc7c7`},Fa=t(e=>{let{classNames:t,className:n,style:r,styles:i,unstyled:a,vars:o,withBorder:s,zIndex:c,mod:l,...u}=ue(`AppShellAside`,null,e),d=Na();return d.disabled?null:(0,T.jsx)(xe,{component:`aside`,mod:[{"with-border":s??d.withBorder},l],...d.getStyles(`aside`,{className:v({[Yt.classNames.zeroRight]:d.offsetScrollbars},n),classNames:t,styles:i,style:r}),...u,__vars:{"--app-shell-aside-z-index":`calc(${c??d.zIndex} + 1)`}})});Fa.classes=Pa,Fa.displayName=`@mantine/core/AppShellAside`;var Ia=t(e=>{let{classNames:t,className:n,style:r,styles:i,unstyled:a,vars:o,withBorder:s,zIndex:c,mod:l,...u}=ue(`AppShellFooter`,null,e),d=Na();return d.disabled?null:(0,T.jsx)(xe,{component:`footer`,mod:[{"with-border":s??d.withBorder},l],...d.getStyles(`footer`,{className:v({[Yt.classNames.zeroRight]:d.offsetScrollbars},n),classNames:t,styles:i,style:r}),...u,__vars:{"--app-shell-footer-z-index":(c??d.zIndex)?.toString()}})});Ia.classes=Pa,Ia.displayName=`@mantine/core/AppShellFooter`;var La=t(e=>{let{classNames:t,className:n,style:r,styles:i,unstyled:a,vars:o,withBorder:s,zIndex:c,mod:l,...u}=ue(`AppShellHeader`,null,e),d=Na();return d.disabled?null:(0,T.jsx)(xe,{component:`header`,mod:[{"with-border":s??d.withBorder},l],...d.getStyles(`header`,{className:v({[Yt.classNames.zeroRight]:d.offsetScrollbars},n),classNames:t,styles:i,style:r}),...u,__vars:{"--app-shell-header-z-index":(c??d.zIndex)?.toString()}})});La.classes=Pa,La.displayName=`@mantine/core/AppShellHeader`;var Ra=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`AppShellMain`,null,e);return(0,T.jsx)(xe,{component:`main`,...Na().getStyles(`main`,{className:n,style:r,classNames:t,styles:i}),...o})});Ra.classes=Pa,Ra.displayName=`@mantine/core/AppShellMain`;var za=t(e=>{let{classNames:t,className:n,style:r,styles:i,unstyled:a,vars:o,withBorder:s,zIndex:c,mod:l,...u}=ue(`AppShellNavbar`,null,e),d=Na();return d.disabled?null:(0,T.jsx)(xe,{component:`nav`,mod:[{"with-border":s??d.withBorder},l],...d.getStyles(`navbar`,{className:n,classNames:t,styles:i,style:r}),...u,__vars:{"--app-shell-navbar-z-index":`calc(${c??d.zIndex} + 1)`}})});za.classes=Pa,za.displayName=`@mantine/core/AppShellNavbar`;var Ba=p(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,grow:o,mod:s,...c}=ue(`AppShellSection`,null,e),l=Na();return(0,T.jsx)(xe,{mod:[{grow:o},s],...l.getStyles(`section`,{className:n,style:r,classNames:t,styles:i}),...c})});Ba.classes=Pa,Ba.displayName=`@mantine/core/AppShellSection`;function Va(e){return typeof e==`object`?e.base:e}function Ha(e){let t=typeof e==`object`&&!!e&&e.base!==void 0&&Object.keys(e).length===1;return typeof e==`number`||typeof e==`string`||t}function Ua(e){return!(typeof e!=`object`||!e||Object.keys(e).length===1&&`base`in e)}function Wa({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,aside:r,theme:i,mode:a}){let o=r?.width,s=`translateX(var(--app-shell-aside-width))`,c=`translateX(calc(var(--app-shell-aside-width) * -1))`;if(r?.breakpoint!==void 0&&!r?.collapsed?.mobile&&(n[r?.breakpoint]=n[r?.breakpoint]||{},a===`fixed`?(n[r?.breakpoint][`--app-shell-aside-width`]=`100%`,n[r?.breakpoint][`--app-shell-aside-offset`]=`0px`):(n[r?.breakpoint][`--app-shell-aside-width`]=`0px`,n[r?.breakpoint][`--app-shell-aside-offset`]=`0px`)),Ha(o)){let t=S(Va(o));e[`--app-shell-aside-width`]=t,e[`--app-shell-aside-offset`]=t}if(Ua(o)&&(o.base!==void 0&&(e[`--app-shell-aside-width`]=S(o.base),e[`--app-shell-aside-offset`]=S(o.base)),me(o).forEach(e=>{e!==`base`&&(t[e]=t[e]||{},t[e][`--app-shell-aside-width`]=S(o[e]),t[e][`--app-shell-aside-offset`]=S(o[e]))})),r?.breakpoint!==void 0&&a===`static`&&(t[r.breakpoint]=t[r.breakpoint]||{},t[r.breakpoint][`--app-shell-aside-position`]=`sticky`,t[r.breakpoint][`--app-shell-aside-grid-row`]=`2`,t[r.breakpoint][`--app-shell-aside-grid-column`]=`3`,t[r.breakpoint][`--app-shell-main-column-end`]=`3`),r?.collapsed?.desktop){let e=r.breakpoint;t[e]=t[e]||{},t[e][`--app-shell-aside-transform`]=s,t[e][`--app-shell-aside-transform-rtl`]=c,a===`fixed`?t[e][`--app-shell-aside-offset`]=`0px !important`:(t[e][`--app-shell-aside-width`]=`0px`,t[e][`--app-shell-aside-display`]=`none`,t[e][`--app-shell-main-column-end`]=`-1`),t[e][`--app-shell-aside-scroll-locked-visibility`]=`hidden`}if(r?.collapsed?.mobile){let e=Mt(r.breakpoint,i.breakpoints)-.1;n[e]=n[e]||{},a===`fixed`?(n[e][`--app-shell-aside-width`]=`100%`,n[e][`--app-shell-aside-offset`]=`0px`):n[e][`--app-shell-aside-width`]=`0px`,n[e][`--app-shell-aside-transform`]=s,n[e][`--app-shell-aside-transform-rtl`]=c,n[e][`--app-shell-aside-scroll-locked-visibility`]=`hidden`}}function Ga({baseStyles:e,minMediaStyles:t,footer:n,mode:r}){let i=n?.height,a=r===`static`?!0:n?.offset??!0;if(r===`static`&&n&&(e[`--app-shell-footer-position`]=`sticky`,e[`--app-shell-footer-grid-column`]=`1 / -1`,e[`--app-shell-footer-grid-row`]=`3`),Ha(i)){let t=S(Va(i));e[`--app-shell-footer-height`]=t,a&&(e[`--app-shell-footer-offset`]=t)}Ua(i)&&(i.base!==void 0&&(e[`--app-shell-footer-height`]=S(i.base),a&&(e[`--app-shell-footer-offset`]=S(i.base))),me(i).forEach(e=>{e!==`base`&&(t[e]=t[e]||{},t[e][`--app-shell-footer-height`]=S(i[e]),a&&(t[e][`--app-shell-footer-offset`]=S(i[e])))})),n?.collapsed&&(e[`--app-shell-footer-transform`]=`translateY(var(--app-shell-footer-height))`,r===`fixed`&&(e[`--app-shell-footer-offset`]=`0px !important`))}function Ka({baseStyles:e,minMediaStyles:t,header:n,mode:r}){let i=n?.height,a=r===`static`?!0:n?.offset??!0;if(r===`static`&&n&&(e[`--app-shell-header-position`]=`sticky`,e[`--app-shell-header-grid-column`]=`1 / -1`,e[`--app-shell-header-grid-row`]=`1`),Ha(i)){let t=S(Va(i));e[`--app-shell-header-height`]=t,a&&(e[`--app-shell-header-offset`]=t)}Ua(i)&&(i.base!==void 0&&(e[`--app-shell-header-height`]=S(i.base),a&&(e[`--app-shell-header-offset`]=S(i.base))),me(i).forEach(e=>{e!==`base`&&(t[e]=t[e]||{},t[e][`--app-shell-header-height`]=S(i[e]),a&&(t[e][`--app-shell-header-offset`]=S(i[e])))})),n?.collapsed&&(e[`--app-shell-header-transform`]=`translateY(calc(var(--app-shell-header-height) * -1))`,r===`fixed`&&(e[`--app-shell-header-offset`]=`0px !important`))}function qa({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,navbar:r,theme:i,mode:a}){let o=r?.width,s=`translateX(calc(var(--app-shell-navbar-width) * -1))`,c=`translateX(var(--app-shell-navbar-width))`;if(r?.breakpoint!==void 0&&!r?.collapsed?.mobile&&(n[r?.breakpoint]=n[r?.breakpoint]||{},n[r?.breakpoint][`--app-shell-navbar-offset`]=`0px`,n[r?.breakpoint][`--app-shell-navbar-width`]=`100%`,a===`static`&&(n[r?.breakpoint][`--app-shell-navbar-grid-width`]=`0px`)),Ha(o)){let t=S(Va(o));e[`--app-shell-navbar-width`]=t,e[`--app-shell-navbar-offset`]=t,a===`static`&&(e[`--app-shell-navbar-grid-width`]=t)}if(Ua(o)&&(o.base!==void 0&&(e[`--app-shell-navbar-width`]=S(o.base),e[`--app-shell-navbar-offset`]=S(o.base),a===`static`&&(e[`--app-shell-navbar-grid-width`]=S(o.base))),me(o).forEach(e=>{e!==`base`&&(t[e]=t[e]||{},t[e][`--app-shell-navbar-width`]=S(o[e]),t[e][`--app-shell-navbar-offset`]=S(o[e]),a===`static`&&(t[e][`--app-shell-navbar-grid-width`]=S(o[e])))})),r?.breakpoint!==void 0&&a===`static`&&(t[r.breakpoint]=t[r.breakpoint]||{},t[r.breakpoint][`--app-shell-navbar-position`]=`sticky`,t[r.breakpoint][`--app-shell-navbar-grid-row`]=`2`,t[r.breakpoint][`--app-shell-navbar-grid-column`]=`1`,t[r.breakpoint][`--app-shell-main-column-start`]=`2`),r?.collapsed?.desktop){let e=r.breakpoint;t[e]=t[e]||{},t[e][`--app-shell-navbar-transform`]=s,t[e][`--app-shell-navbar-transform-rtl`]=c,a===`fixed`?t[e][`--app-shell-navbar-offset`]=`0px !important`:(t[e][`--app-shell-navbar-width`]=`0px`,t[e][`--app-shell-navbar-display`]=`none`,t[e][`--app-shell-main-column-start`]=`1`)}if(r?.collapsed?.mobile){let e=Mt(r.breakpoint,i.breakpoints)-.1;n[e]=n[e]||{},n[e][`--app-shell-navbar-width`]=`100%`,n[e][`--app-shell-navbar-offset`]=`0px`,a===`static`&&(n[e][`--app-shell-navbar-grid-width`]=`0px`),n[e][`--app-shell-navbar-transform`]=s,n[e][`--app-shell-navbar-transform-rtl`]=c}}function Ja(e){return Number(e)===0?`0px`:ne(e)}function Ya({padding:e,baseStyles:t,minMediaStyles:n}){Ha(e)&&(t[`--app-shell-padding`]=Ja(Va(e))),Ua(e)&&(e.base&&(t[`--app-shell-padding`]=Ja(e.base)),me(e).forEach(t=>{t!==`base`&&(n[t]=n[t]||{},n[t][`--app-shell-padding`]=Ja(e[t]))}))}function Xa({navbar:e,header:t,footer:n,aside:r,padding:i,theme:a,mode:o}){let s={},c={},l={};o===`static`&&(l[`--app-shell-main-grid-column`]=`1 / -1`,l[`--app-shell-main-grid-row`]=`2`),qa({baseStyles:l,minMediaStyles:s,maxMediaStyles:c,navbar:e,theme:a,mode:o}),Wa({baseStyles:l,minMediaStyles:s,maxMediaStyles:c,aside:r,theme:a,mode:o}),Ka({baseStyles:l,minMediaStyles:s,header:t,mode:o}),Ga({baseStyles:l,minMediaStyles:s,footer:n,mode:o}),Ya({baseStyles:l,minMediaStyles:s,padding:i});let u=Bt(me(s),a.breakpoints).map(e=>({query:`(min-width: ${be(e.px)})`,styles:s[e.value]})),d=Bt(me(c),a.breakpoints).map(e=>({query:`(max-width: ${be(e.px)})`,styles:c[e.value]}));return{baseStyles:l,media:[...u,...d]}}function Za({navbar:e,header:t,aside:n,footer:r,padding:i,mode:o,selector:s}){let c=u(),l=a(),{media:f,baseStyles:p}=Xa({navbar:e,header:t,footer:r,aside:n,padding:i,theme:c,mode:o});return(0,T.jsx)(d,{media:f,styles:p,selector:s||l.cssVariablesSelector})}function Qa({transitionDuration:e,disabled:t}){let[n,r]=(0,w.useState)(!0),i=(0,w.useRef)(-1),a=(0,w.useRef)(-1);return Ht(`resize`,()=>{r(!0),clearTimeout(i.current),i.current=window.setTimeout(()=>(0,w.startTransition)(()=>{r(!1)}),200)}),pe(()=>{r(!0),clearTimeout(a.current),a.current=window.setTimeout(()=>(0,w.startTransition)(()=>{r(!1)}),e||0)},[t,e]),n}var $a={withBorder:!0,padding:0,transitionDuration:200,transitionTimingFunction:`ease`,zIndex:En(`app`),mode:`fixed`},eo=_((e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}})),to=t(e=>{let t=ue(`AppShell`,$a,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,navbar:c,withBorder:l,padding:u,transitionDuration:d,transitionTimingFunction:f,header:p,zIndex:m,layout:h,disabled:g,aside:_,footer:v,offsetScrollbars:y=!0,mode:b,mod:x,attributes:ee,id:te,...ne}=t,re=de({name:`AppShell`,classes:Pa,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:ee,vars:s,varsResolver:eo}),S=Qa({disabled:g,transitionDuration:d}),ae=ie(te);return(0,T.jsxs)(Ma,{value:{getStyles:re,withBorder:l,zIndex:m,disabled:g,offsetScrollbars:y,mode:b},children:[(0,T.jsx)(Za,{navbar:c,header:p,aside:_,footer:v,padding:u,mode:b,selector:b===`static`?`#${ae}`:void 0}),(0,T.jsx)(xe,{...re(`root`),id:ae,mod:[{resizing:S,layout:h,disabled:g,mode:b},x],...ne})]})});to.classes=Pa,to.varsResolver=eo,to.displayName=`@mantine/core/AppShell`,to.Navbar=za,to.Header=La,to.Main=Ra,to.Aside=Fa,to.Footer=Ia,to.Section=Ba;var no={group:`m_11def92b`,root:`m_f85678b6`,image:`m_11f8ac07`,placeholder:`m_104cd71f`},ro=(0,w.createContext)({withinGroup:!1}),io=_((e,{spacing:t})=>({group:{"--ag-spacing":ne(t)}})),ao=t(e=>{let t=ue(`AvatarGroup`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,spacing:c,attributes:l,...u}=t,d=de({name:`AvatarGroup`,classes:no,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:l,vars:s,varsResolver:io,rootSelector:`group`});return(0,T.jsx)(ro,{value:{withinGroup:!0},children:(0,T.jsx)(xe,{...d(`group`),...u})})});ao.classes=no,ao.varsResolver=io,ao.displayName=`@mantine/core/AvatarGroup`;function oo(e){return(0,T.jsx)(`svg`,{...e,"data-avatar-placeholder-icon":!0,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,T.jsx)(`path`,{d:`M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}function so(e){let t=0;for(let n=0;ne[0]).slice(0,t).join(``).toUpperCase()}var fo=_((e,{size:t,radius:n,variant:r,gradient:i,color:a,autoContrast:o,name:s,allowedInitialsColors:c})=>{let l=a===`initials`&&typeof s==`string`?lo(s,c):a,u=e.variantColorResolver({color:l||`gray`,theme:e,gradient:i,variant:r||`light`,autoContrast:o});return{root:{"--avatar-size":_e(t,`avatar-size`),"--avatar-radius":n===void 0?void 0:ee(n),"--avatar-bg":l||r?u.background:void 0,"--avatar-color":l||r?u.color:void 0,"--avatar-bd":l||r?u.border:void 0}}}),po=p(e=>{let t=ue(`Avatar`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,src:c,alt:l,radius:u,color:d,gradient:f,imageProps:p,children:m,autoContrast:h,mod:g,name:_,allowedInitialsColors:v,attributes:y,...b}=t,x=(0,w.use)(ro),[ee,te]=(0,w.useState)(!c),ne=de({name:`Avatar`,props:t,classes:no,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:y,vars:s,varsResolver:fo});return(0,w.useEffect)(()=>te(!c),[c]),(0,T.jsx)(xe,{...ne(`root`),mod:[{"within-group":x.withinGroup},g],...b,children:ee||!c?(0,T.jsx)(`span`,{...ne(`placeholder`),title:l,children:m||typeof _==`string`&&uo(_)||(0,T.jsx)(oo,{})}):(0,T.jsx)(`img`,{...p,...ne(`image`),src:c,alt:l,onError:e=>{te(!0),p?.onError?.(e)}})})});po.classes=no,po.varsResolver=fo,po.displayName=`@mantine/core/Avatar`,po.Group=ao;var mo={root:`m_fea6bf1a`,burger:`m_d4fb9cad`},ho=_((e,{color:t,size:n,lineSize:r,transitionDuration:i,transitionTimingFunction:a})=>({root:{"--burger-color":t?s(t,e):void 0,"--burger-size":_e(n,`burger-size`),"--burger-line-size":r?S(r):void 0,"--burger-transition-duration":i===void 0?void 0:`${i}ms`,"--burger-transition-timing-function":a}})),go=t(e=>{let t=ue(`Burger`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,opened:c,children:l,transitionDuration:u,transitionTimingFunction:d,lineSize:f,attributes:p,...m}=t,h=de({name:`Burger`,classes:mo,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:p,vars:s,varsResolver:ho});return(0,T.jsxs)(te,{...h(`root`),...m,children:[(0,T.jsx)(xe,{mod:[`reduce-motion`,{opened:c}],...h(`burger`)}),l]})});go.classes=mo,go.varsResolver=ho,go.displayName=`@mantine/core/Burger`;var[_o,vo]=xn(`Drawer component was not found in tree`),yo={root:`m_f11b401e`,header:`m_5a7c2c9`,content:`m_b8a05bbd`,inner:`m_31cd769a`},bo=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerBody`,null,e);return(0,T.jsx)(sn,{...vo().getStyles(`body`,{classNames:t,style:r,styles:i,className:n}),...o})});bo.classes=yo,bo.displayName=`@mantine/core/DrawerBody`;var xo=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerCloseButton`,null,e);return(0,T.jsx)(en,{...vo().getStyles(`close`,{classNames:t,style:r,styles:i,className:n}),...o})});xo.classes=yo,xo.displayName=`@mantine/core/DrawerCloseButton`;var So=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,radius:s,__hidden:c,...l}=ue(`DrawerContent`,null,e),u=vo(),d=u.scrollAreaComponent||ln;return(0,T.jsx)(Pt,{...u.getStyles(`content`,{className:n,style:r,styles:i,classNames:t}),innerProps:u.getStyles(`inner`,{className:n,style:r,styles:i,classNames:t}),...l,radius:s||u.radius||0,"data-hidden":c||void 0,children:(0,T.jsx)(d,{style:{height:`calc(100vh - var(--drawer-offset) * 2)`},children:o})})});So.classes=yo,So.displayName=`@mantine/core/DrawerContent`;var Co=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerHeader`,null,e);return(0,T.jsx)(Wt,{...vo().getStyles(`header`,{classNames:t,style:r,styles:i,className:n}),...o})});Co.classes=yo,Co.displayName=`@mantine/core/DrawerHeader`;var wo=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerOverlay`,null,e);return(0,T.jsx)(an,{...vo().getStyles(`overlay`,{classNames:t,style:r,styles:i,className:n}),...o})});wo.classes=yo,wo.displayName=`@mantine/core/DrawerOverlay`;function To(e){switch(e){case`top`:return`flex-start`;case`bottom`:return`flex-end`;default:return}}function Eo(e){if(e===`top`||e===`bottom`)return`0 0 calc(100% - var(--drawer-offset, 0rem) * 2)`}var Do={top:`slide-down`,bottom:`slide-up`,left:`slide-right`,right:`slide-left`},E={top:`slide-down`,bottom:`slide-up`,right:`slide-right`,left:`slide-left`},Oo={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:En(`modal`),position:`left`},ko=_((e,{position:t,size:n,offset:r})=>({root:{"--drawer-size":_e(n,`drawer-size`),"--drawer-flex":Eo(t),"--drawer-height":t===`left`||t===`right`?void 0:`var(--drawer-size)`,"--drawer-align":To(t),"--drawer-justify":t===`right`?`flex-end`:void 0,"--drawer-offset":S(r)}})),Ao=t(e=>{let t=ue(`DrawerRoot`,Oo,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,scrollAreaComponent:c,position:l,transitionProps:u,radius:d,attributes:f,...p}=t,{dir:m}=Sn(),h=de({name:`Drawer`,classes:yo,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:f,vars:s,varsResolver:ko}),g=(m===`rtl`?E:Do)[l];return(0,T.jsx)(_o,{value:{scrollAreaComponent:c,getStyles:h,radius:d},children:(0,T.jsx)(Lt,{...h(`root`),transitionProps:{transition:g,...u},"data-offset-scrollbars":c===wn.Autosize||void 0,unstyled:o,...p})})});Ao.classes=yo,Ao.varsResolver=ko,Ao.displayName=`@mantine/core/DrawerRoot`;var jo=(0,w.createContext)(null);function Mo({children:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(En(`modal`));return(0,T.jsx)(jo,{value:{stack:t,addModal:(e,t)=>{n(t=>[...new Set([...t,e])]),i(e=>typeof t==`number`&&typeof e==`number`?Math.max(e,t):e)},removeModal:e=>n(t=>t.filter(t=>t!==e)),getZIndex:e=>`calc(${r} + ${t.indexOf(e)} + 1)`,currentId:t[t.length-1],maxZIndex:r},children:e})}Mo.displayName=`@mantine/core/DrawerStack`;var No=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerTitle`,null,e);return(0,T.jsx)(Qt,{...vo().getStyles(`title`,{classNames:t,style:r,styles:i,className:n}),...o})});No.classes=yo,No.displayName=`@mantine/core/DrawerTitle`;var Po={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:En(`modal`),withOverlay:!0,withCloseButton:!0},Fo=t(e=>{let{title:t,withOverlay:n,overlayProps:r,withCloseButton:i,closeButtonProps:a,children:o,opened:s,stackId:c,zIndex:l,...u}=ue(`Drawer`,Po,e),d=(0,w.use)(jo),f=!!t||i,p=d&&c?{closeOnEscape:d.currentId===c,trapFocus:d.currentId===c,zIndex:d.getZIndex(c)}:{},m=n===!1?!1:c&&d?d.currentId===c:s;return(0,w.useEffect)(()=>{d&&c&&(s?d.addModal(c,l||En(`modal`)):d.removeModal(c))},[s,c,l]),(0,T.jsxs)(Ao,{opened:s,zIndex:d&&c?d.getZIndex(c):l,...u,...p,children:[n&&(0,T.jsx)(wo,{visible:m,transitionProps:d&&c?{duration:0}:void 0,...r}),(0,T.jsxs)(So,{__hidden:d&&c&&s?c!==d.currentId:!1,children:[f&&(0,T.jsxs)(Co,{children:[t&&(0,T.jsx)(No,{children:t}),i&&(0,T.jsx)(xo,{...a})]}),(0,T.jsx)(bo,{children:o})]})]})});Fo.classes=yo,Fo.displayName=`@mantine/core/Drawer`,Fo.Root=Ao,Fo.Overlay=wo,Fo.Content=So,Fo.Body=bo,Fo.Header=Co,Fo.Title=No,Fo.CloseButton=xo,Fo.Stack=Mo;var Io={root:`m_dc6f14e2`},Lo=_((e,{size:t})=>({root:{"--kbd-fz":_e(t,`kbd-fz`)}})),Ro=t(e=>{let t=ue(`Kbd`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t;return(0,T.jsx)(xe,{component:`kbd`,...de({name:`Kbd`,classes:Io,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c,vars:s,varsResolver:Lo})(`root`),...l})});Ro.classes=Io,Ro.varsResolver=Lo,Ro.displayName=`@mantine/core/Kbd`;var zo=[];for(let e=0;e<256;++e)zo.push((e+256).toString(16).slice(1));function Bo(e,t=0){return(zo[e[t+0]]+zo[e[t+1]]+zo[e[t+2]]+zo[e[t+3]]+`-`+zo[e[t+4]]+zo[e[t+5]]+`-`+zo[e[t+6]]+zo[e[t+7]]+`-`+zo[e[t+8]]+zo[e[t+9]]+`-`+zo[e[t+10]]+zo[e[t+11]]+zo[e[t+12]]+zo[e[t+13]]+zo[e[t+14]]+zo[e[t+15]]).toLowerCase()}var Vo,Ho=new Uint8Array(16);function Uo(){if(!Vo){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Vo=crypto.getRandomValues.bind(crypto)}return Vo(Ho)}var Wo={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Go(e,t,n){if(Wo.randomUUID&&!t&&!e)return Wo.randomUUID();e||={};let r=e.random??e.rng?.()??Uo();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Bo(r)}var D;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(D||={});var Ko;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ko||={});var O=D.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),qo=e=>{switch(typeof e){case`undefined`:return O.undefined;case`string`:return O.string;case`number`:return Number.isNaN(e)?O.nan:O.number;case`boolean`:return O.boolean;case`function`:return O.function;case`bigint`:return O.bigint;case`symbol`:return O.symbol;case`object`:return Array.isArray(e)?O.array:e===null?O.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?O.promise:typeof Map<`u`&&e instanceof Map?O.map:typeof Set<`u`&&e instanceof Set?O.set:typeof Date<`u`&&e instanceof Date?O.date:O.object;default:return O.unknown}},k=D.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Jo=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Jo.create=e=>new Jo(e);var Yo=(e,t)=>{let n;switch(e.code){case k.invalid_type:n=e.received===O.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,D.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:n=`Unrecognized key(s) in object: ${D.joinValues(e.keys,`, `)}`;break;case k.invalid_union:n=`Invalid input`;break;case k.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${D.joinValues(e.options)}`;break;case k.invalid_enum_value:n=`Invalid enum value. Expected ${D.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:n=`Invalid function arguments`;break;case k.invalid_return_type:n=`Invalid function return type`;break;case k.invalid_date:n=`Invalid date`;break;case k.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:D.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case k.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case k.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case k.custom:n=`Invalid input`;break;case k.invalid_intersection_types:n=`Intersection results could not be merged`;break;case k.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,D.assertNever(e)}return{message:n}},Xo=Yo;function Zo(){return Xo}var Qo=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function A(e,t){let n=Zo(),r=Qo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Yo?void 0:Yo].filter(e=>!!e)});e.common.issues.push(r)}var $o=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return j;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return j;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},j=Object.freeze({status:`aborted`}),es=e=>({status:`dirty`,value:e}),ts=e=>({status:`valid`,value:e}),ns=e=>e.status===`aborted`,rs=e=>e.status===`dirty`,is=e=>e.status===`valid`,as=e=>typeof Promise<`u`&&e instanceof Promise,M;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(M||={});var os=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ss=(e,t)=>{if(is(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Jo(e.common.issues);return this._error=t,this._error}}};function N(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var cs=class{get description(){return this._def.description}_getType(e){return qo(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:qo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $o,ctx:{common:e.parent.common,data:e.data,parsedType:qo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(as(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)};return ss(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return is(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>is(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)},r=this._parse({data:e,path:n.path,parent:n});return ss(n,await(as(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:k.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new dc({schema:this,typeName:P.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return fc.create(this,this._def)}nullable(){return pc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ks.create(this)}promise(){return uc.create(this,this._def)}or(e){return Ys.create([this,e],this._def)}and(e){return $s.create(this,e,this._def)}transform(e){return new dc({...N(this._def),schema:this,typeName:P.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new mc({...N(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new _c({typeName:P.ZodBranded,type:this,...N(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new hc({...N(this._def),innerType:this,catchValue:t,typeName:P.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return vc.create(this,e)}readonly(){return yc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ls=/^c[^\s-]{8,}$/i,us=/^[0-9a-z]+$/,ds=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ps=/^[a-z0-9_-]{21}$/i,ms=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hs=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_s=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,vs,ys=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ss=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ws=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ts=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,Es=RegExp(`^${Ts}$`);function Ds(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Os(e){return RegExp(`^${Ds(e)}$`)}function ks(e){let t=`${Ts}T${Ds(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function As(e,t){return!((t!==`v4`&&t||!ys.test(e))&&(t!==`v6`&&t||!xs.test(e)))}function js(e,t){if(!ms.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ms(e,t){return!((t!==`v4`&&t||!bs.test(e))&&(t!==`v6`&&t||!Ss.test(e)))}var Ns=class e extends cs{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.string,received:t.parsedType}),j}let t=new $o,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),A(n,{code:k.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:k.invalid_string,...M.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...M.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...M.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...M.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...M.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...M.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...M.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...M.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...M.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...M.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...M.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...M.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...M.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...M.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...M.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...M.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...M.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...M.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...M.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...M.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...M.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...M.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...M.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...M.errToObj(t)})}nonempty(e){return this.min(1,M.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ns({checks:[],typeName:P.ZodString,coerce:e?.coerce??!1,...N(e)});function Ps(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Fs=class e extends cs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.number,received:t.parsedType}),j}let t,n=new $o;for(let r of this._def.checks)r.kind===`int`?D.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),A(t,{code:k.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),A(t,{code:k.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Ps(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),A(t,{code:k.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),A(t,{code:k.not_finite,message:r.message}),n.dirty()):D.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,M.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,M.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,M.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,M.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:M.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:M.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:M.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:M.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:M.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:M.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:M.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&D.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew Fs({checks:[],typeName:P.ZodNumber,coerce:e?.coerce||!1,...N(e)});var Is=class e extends cs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let t,n=new $o;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),A(t,{code:k.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),A(t,{code:k.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):D.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.bigint,received:t.parsedType}),j}gte(e,t){return this.setLimit(`min`,e,!0,M.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,M.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,M.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,M.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:M.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:M.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:M.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Is({checks:[],typeName:P.ZodBigInt,coerce:e?.coerce??!1,...N(e)});var Ls=class extends cs{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.boolean,received:t.parsedType}),j}return ts(e.data)}};Ls.create=e=>new Ls({typeName:P.ZodBoolean,coerce:e?.coerce||!1,...N(e)});var Rs=class e extends cs{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.date,received:t.parsedType}),j}if(Number.isNaN(e.data.getTime()))return A(this._getOrReturnCtx(e),{code:k.invalid_date}),j;let t=new $o,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),A(n,{code:k.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):D.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:M.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:M.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Rs({checks:[],coerce:e?.coerce||!1,typeName:P.ZodDate,...N(e)});var zs=class extends cs{_parse(e){if(this._getType(e)!==O.symbol){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.symbol,received:t.parsedType}),j}return ts(e.data)}};zs.create=e=>new zs({typeName:P.ZodSymbol,...N(e)});var Bs=class extends cs{_parse(e){if(this._getType(e)!==O.undefined){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.undefined,received:t.parsedType}),j}return ts(e.data)}};Bs.create=e=>new Bs({typeName:P.ZodUndefined,...N(e)});var Vs=class extends cs{_parse(e){if(this._getType(e)!==O.null){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.null,received:t.parsedType}),j}return ts(e.data)}};Vs.create=e=>new Vs({typeName:P.ZodNull,...N(e)});var Hs=class extends cs{constructor(){super(...arguments),this._any=!0}_parse(e){return ts(e.data)}};Hs.create=e=>new Hs({typeName:P.ZodAny,...N(e)});var Us=class extends cs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ts(e.data)}};Us.create=e=>new Us({typeName:P.ZodUnknown,...N(e)});var Ws=class extends cs{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.never,received:t.parsedType}),j}};Ws.create=e=>new Ws({typeName:P.ZodNever,...N(e)});var Gs=class extends cs{_parse(e){if(this._getType(e)!==O.undefined){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.void,received:t.parsedType}),j}return ts(e.data)}};Gs.create=e=>new Gs({typeName:P.ZodVoid,...N(e)});var Ks=class e extends cs{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==O.array)return A(t,{code:k.invalid_type,expected:O.array,received:t.parsedType}),j;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(A(t,{code:k.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new os(t,e,t.path,n)))).then(e=>$o.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new os(t,e,t.path,n)));return $o.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:M.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:M.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:M.toString(n)}})}nonempty(e){return this.min(1,e)}};Ks.create=(e,t)=>new Ks({type:e,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...N(t)});function qs(e){if(e instanceof Js){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=fc.create(qs(r))}return new Js({...e._def,shape:()=>t})}return e instanceof Ks?new Ks({...e._def,type:qs(e.element)}):e instanceof fc?fc.create(qs(e.unwrap())):e instanceof pc?pc.create(qs(e.unwrap())):e instanceof ec?ec.create(e.items.map(e=>qs(e))):e}var Js=class e extends cs{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=D.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==O.object){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.object,received:t.parsedType}),j}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ws&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new os(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ws){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(A(n,{code:k.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new os(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>$o.mergeObjectSync(t,e)):$o.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return M.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:M.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of D.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of D.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return qs(this)}partial(t){let n={};for(let e of D.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of D.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof fc;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return sc(D.objectKeys(this.shape))}};Js.create=(e,t)=>new Js({shape:()=>e,unknownKeys:`strip`,catchall:Ws.create(),typeName:P.ZodObject,...N(t)}),Js.strictCreate=(e,t)=>new Js({shape:()=>e,unknownKeys:`strict`,catchall:Ws.create(),typeName:P.ZodObject,...N(t)}),Js.lazycreate=(e,t)=>new Js({shape:e,unknownKeys:`strip`,catchall:Ws.create(),typeName:P.ZodObject,...N(t)});var Ys=class extends cs{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Jo(e.ctx.common.issues));return A(t,{code:k.invalid_union,unionErrors:n}),j}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Jo(e));return A(t,{code:k.invalid_union,unionErrors:i}),j}}get options(){return this._def.options}};Ys.create=(e,t)=>new Ys({options:e,typeName:P.ZodUnion,...N(t)});var Xs=e=>e instanceof ac?Xs(e.schema):e instanceof dc?Xs(e.innerType()):e instanceof oc?[e.value]:e instanceof cc?e.options:e instanceof lc?D.objectValues(e.enum):e instanceof mc?Xs(e._def.innerType):e instanceof Bs?[void 0]:e instanceof Vs?[null]:e instanceof fc?[void 0,...Xs(e.unwrap())]:e instanceof pc?[null,...Xs(e.unwrap())]:e instanceof _c||e instanceof yc?Xs(e.unwrap()):e instanceof hc?Xs(e._def.innerType):[],Zs=class e extends cs{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return A(t,{code:k.invalid_type,expected:O.object,received:t.parsedType}),j;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(A(t,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),j)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Xs(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:P.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...N(r)})}};function Qs(e,t){let n=qo(e),r=qo(t);if(e===t)return{valid:!0,data:e};if(n===O.object&&r===O.object){let n=D.objectKeys(t),r=D.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Qs(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===O.array&&r===O.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if(ns(e)||ns(r))return j;let i=Qs(e.value,r.value);return i.valid?((rs(e)||rs(r))&&t.dirty(),{status:t.value,value:i.data}):(A(n,{code:k.invalid_intersection_types}),j)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};$s.create=(e,t,n)=>new $s({left:e,right:t,typeName:P.ZodIntersection,...N(n)});var ec=class e extends cs{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.array)return A(n,{code:k.invalid_type,expected:O.array,received:n.parsedType}),j;if(n.data.lengththis._def.items.length&&(A(n,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new os(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>$o.mergeArray(t,e)):$o.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ec.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new ec({items:e,typeName:P.ZodTuple,rest:null,...N(t)})};var tc=class e extends cs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return A(n,{code:k.invalid_type,expected:O.object,received:n.parsedType}),j;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new os(n,e,n.path,e)),value:a._parse(new os(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?$o.mergeObjectAsync(t,r):$o.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof cs?new e({keyType:t,valueType:n,typeName:P.ZodRecord,...N(r)}):new e({keyType:Ns.create(),valueType:t,typeName:P.ZodRecord,...N(n)})}},nc=class extends cs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.map)return A(n,{code:k.invalid_type,expected:O.map,received:n.parsedType}),j;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new os(n,e,n.path,[a,`key`])),value:i._parse(new os(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return j;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return j;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};nc.create=(e,t,n)=>new nc({valueType:t,keyType:e,typeName:P.ZodMap,...N(n)});var rc=class e extends cs{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.set)return A(n,{code:k.invalid_type,expected:O.set,received:n.parsedType}),j;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(A(n,{code:k.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return j;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new os(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:M.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:M.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};rc.create=(e,t)=>new rc({valueType:e,minSize:null,maxSize:null,typeName:P.ZodSet,...N(t)});var ic=class e extends cs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return A(t,{code:k.invalid_type,expected:O.function,received:t.parsedType}),j;function n(e,n){return Qo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zo(),Yo].filter(e=>!!e),issueData:{code:k.invalid_arguments,argumentsError:n}})}function r(e,n){return Qo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zo(),Yo].filter(e=>!!e),issueData:{code:k.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof uc){let e=this;return ts(async function(...t){let o=new Jo([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return ts(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Jo([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Jo([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ec.create(t).rest(Us.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||ec.create([]).rest(Us.create()),returns:n||Us.create(),typeName:P.ZodFunction,...N(r)})}},ac=class extends cs{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ac.create=(e,t)=>new ac({getter:e,typeName:P.ZodLazy,...N(t)});var oc=class extends cs{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return A(t,{received:t.data,code:k.invalid_literal,expected:this._def.value}),j}return{status:`valid`,value:e.data}}get value(){return this._def.value}};oc.create=(e,t)=>new oc({value:e,typeName:P.ZodLiteral,...N(t)});function sc(e,t){return new cc({values:e,typeName:P.ZodEnum,...N(t)})}var cc=class e extends cs{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return A(t,{expected:D.joinValues(n),received:t.parsedType,code:k.invalid_type}),j}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return A(t,{received:t.data,code:k.invalid_enum_value,options:n}),j}return ts(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};cc.create=sc;var lc=class extends cs{_parse(e){let t=D.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==O.string&&n.parsedType!==O.number){let e=D.objectValues(t);return A(n,{expected:D.joinValues(e),received:n.parsedType,code:k.invalid_type}),j}if(this._cache||=new Set(D.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=D.objectValues(t);return A(n,{received:n.data,code:k.invalid_enum_value,options:e}),j}return ts(e.data)}get enum(){return this._def.values}};lc.create=(e,t)=>new lc({values:e,typeName:P.ZodNativeEnum,...N(t)});var uc=class extends cs{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==O.promise&&t.common.async===!1?(A(t,{code:k.invalid_type,expected:O.promise,received:t.parsedType}),j):ts((t.parsedType===O.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};uc.create=(e,t)=>new uc({type:e,typeName:P.ZodPromise,...N(t)});var dc=class extends cs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{A(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return j;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?j:r.status===`dirty`||t.value===`dirty`?es(r.value):r});{if(t.value===`aborted`)return j;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?j:r.status===`dirty`||t.value===`dirty`?es(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?j:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?j:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!is(e))return j;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>is(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):j)}D.assertNever(r)}};dc.create=(e,t,n)=>new dc({schema:e,typeName:P.ZodEffects,effect:t,...N(n)}),dc.createWithPreprocess=(e,t,n)=>new dc({schema:t,effect:{type:`preprocess`,transform:e},typeName:P.ZodEffects,...N(n)});var fc=class extends cs{_parse(e){return this._getType(e)===O.undefined?ts(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};fc.create=(e,t)=>new fc({innerType:e,typeName:P.ZodOptional,...N(t)});var pc=class extends cs{_parse(e){return this._getType(e)===O.null?ts(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pc.create=(e,t)=>new pc({innerType:e,typeName:P.ZodNullable,...N(t)});var mc=class extends cs{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===O.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};mc.create=(e,t)=>new mc({innerType:e,typeName:P.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...N(t)});var hc=class extends cs{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return as(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Jo(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Jo(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};hc.create=(e,t)=>new hc({innerType:e,typeName:P.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...N(t)});var gc=class extends cs{_parse(e){if(this._getType(e)!==O.nan){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.nan,received:t.parsedType}),j}return{status:`valid`,value:e.data}}};gc.create=e=>new gc({typeName:P.ZodNaN,...N(e)});var _c=class extends cs{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},vc=class e extends cs{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?j:e.status===`dirty`?(t.dirty(),es(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?j:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:P.ZodPipeline})}},yc=class extends cs{_parse(e){let t=this._def.innerType._parse(e),n=e=>(is(e)&&(e.value=Object.freeze(e.value)),e);return as(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};yc.create=(e,t)=>new yc({innerType:e,typeName:P.ZodReadonly,...N(t)}),Js.lazycreate;var P;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(P||={});var F=Ns.create,bc=Fs.create;gc.create,Is.create;var xc=Ls.create;Rs.create,zs.create,Bs.create,Vs.create;var Sc=Hs.create,Cc=Us.create;Ws.create,Gs.create;var wc=Ks.create,I=Js.create;Js.strictCreate;var Tc=Ys.create,Ec=Zs.create;$s.create,ec.create;var Dc=tc.create;nc.create,rc.create,ic.create,ac.create;var L=oc.create,Oc=cc.create,kc=lc.create;uc.create,dc.create,fc.create,pc.create,dc.createWithPreprocess,vc.create;var Ac=Ln(),jc=Dc(Sc()).optional();function Mc(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var Nc=I({name:F(),arguments:F()}),Pc=I({id:F(),type:L(`function`),function:Nc,encryptedValue:F().optional(),metadata:jc}),Fc=I({id:F(),role:F(),content:F().optional(),name:F().optional(),encryptedValue:F().optional(),subagentRunId:F().optional(),metadata:jc}),Ic=I({type:L(`text`),text:F()}),Lc=Ec(`type`,[I({type:L(`data`),value:F(),mimeType:F()}),I({type:L(`url`),value:F(),mimeType:F().optional()})]),Rc=I({type:L(`image`),source:Lc,metadata:Cc().optional()}),zc=I({type:L(`audio`),source:Lc,metadata:Cc().optional()}),Bc=I({type:L(`video`),source:Lc,metadata:Cc().optional()}),Vc=I({type:L(`document`),source:Lc,metadata:Cc().optional()}),Hc=I({type:L(`binary`),mimeType:F(),id:F().optional(),url:F().optional(),data:F().optional(),filename:F().optional()}),Uc=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:k.custom,message:`BinaryInputContent requires at least one of id, url, or data.`,path:[`id`]})};Hc.superRefine((e,t)=>{Uc(e,t)});var Wc=Ec(`type`,[Ic,Rc,zc,Bc,Vc,Hc]).superRefine((e,t)=>{e.type===`binary`&&Uc(e,t)}),Gc=Ec(`role`,[Fc.extend({role:L(`developer`),content:F()}),Fc.extend({role:L(`system`),content:F()}),Fc.extend({role:L(`assistant`),content:F().optional(),toolCalls:wc(Pc).optional()}),Fc.extend({role:L(`user`),content:Tc([F(),wc(Wc)])}),I({id:F(),content:F(),role:L(`tool`),toolCallId:F(),error:F().optional(),encryptedValue:F().optional(),subagentRunId:F().optional(),metadata:jc}),I({id:F(),role:L(`activity`),activityType:F(),content:Dc(Sc()),subagentRunId:F().optional(),metadata:jc}),I({id:F(),role:L(`reasoning`),content:F(),encryptedValue:F().optional(),subagentRunId:F().optional(),metadata:jc})]);Tc([L(`developer`),L(`system`),L(`assistant`),L(`user`),L(`tool`),L(`activity`),L(`reasoning`)]);var Kc=I({description:F(),value:F()}),qc=I({name:F(),description:F(),parameters:Sc(),metadata:Dc(Sc()).optional()}),Jc=I({id:F(),reason:F(),message:F().optional(),toolCallId:F().optional(),responseSchema:Dc(Sc()).optional(),expiresAt:F().optional(),metadata:Dc(Sc()).optional(),subagentRunId:F().optional()}),Yc=I({interruptId:F(),status:Oc([`resolved`,`cancelled`]),payload:Sc().optional(),metadata:jc}),Xc=I({threadId:F(),runId:F(),parentRunId:F().optional(),state:Sc().transform(e=>e??void 0),messages:wc(Gc),tools:wc(qc),context:wc(Kc),forwardedProps:Sc(),resume:wc(Yc).optional()}),Zc=Sc(),R=class extends Error{constructor(e){super(e)}},Qc=class extends R{constructor(){super(`Connect not implemented. This method is not supported by the current agent.`)}},$c=I({name:F(),description:F().optional()}),el=I({name:F().optional(),type:F().optional(),description:F().optional(),version:F().optional(),provider:F().optional(),documentationUrl:F().optional(),metadata:Dc(Cc()).optional()}),tl=I({streaming:xc().optional(),websocket:xc().optional(),httpBinary:xc().optional(),pushNotifications:xc().optional(),resumable:xc().optional()}),nl=I({supported:xc().optional(),items:wc(qc).optional(),parallelCalls:xc().optional(),clientProvided:xc().optional()}),rl=I({structuredOutput:xc().optional(),supportedMimeTypes:wc(F()).optional()}),il=I({snapshots:xc().optional(),deltas:xc().optional(),memory:xc().optional(),persistentState:xc().optional()}),al=I({supported:xc().optional(),delegation:xc().optional(),handoffs:xc().optional(),subAgents:wc($c).optional()}),ol=I({supported:xc().optional(),streaming:xc().optional(),encrypted:xc().optional()}),sl=I({image:xc().optional(),audio:xc().optional(),video:xc().optional(),pdf:xc().optional(),file:xc().optional()}),cl=I({image:xc().optional(),audio:xc().optional()}),ll=I({input:sl.optional(),output:cl.optional()}),ul=I({codeExecution:xc().optional(),sandboxed:xc().optional(),maxIterations:bc().optional(),maxExecutionTime:bc().optional()}),dl=I({supported:xc().optional(),approvals:xc().optional(),interventions:xc().optional(),feedback:xc().optional(),interrupts:xc().optional(),approveWithEdits:xc().optional()});I({identity:el.optional(),transport:tl.optional(),tools:nl.optional(),output:rl.optional(),state:il.optional(),multiAgent:al.optional(),reasoning:ol.optional(),multimodal:ll.optional(),execution:ul.optional(),humanInTheLoop:dl.optional(),custom:Dc(Cc()).optional()});var fl=Tc([L(`developer`),L(`system`),L(`assistant`),L(`user`)]),z=function(e){return e.TEXT_MESSAGE_START=`TEXT_MESSAGE_START`,e.TEXT_MESSAGE_CONTENT=`TEXT_MESSAGE_CONTENT`,e.TEXT_MESSAGE_END=`TEXT_MESSAGE_END`,e.TEXT_MESSAGE_CHUNK=`TEXT_MESSAGE_CHUNK`,e.TOOL_CALL_START=`TOOL_CALL_START`,e.TOOL_CALL_ARGS=`TOOL_CALL_ARGS`,e.TOOL_CALL_END=`TOOL_CALL_END`,e.TOOL_CALL_CHUNK=`TOOL_CALL_CHUNK`,e.TOOL_CALL_RESULT=`TOOL_CALL_RESULT`,e.THINKING_START=`THINKING_START`,e.THINKING_END=`THINKING_END`,e.THINKING_TEXT_MESSAGE_START=`THINKING_TEXT_MESSAGE_START`,e.THINKING_TEXT_MESSAGE_CONTENT=`THINKING_TEXT_MESSAGE_CONTENT`,e.THINKING_TEXT_MESSAGE_END=`THINKING_TEXT_MESSAGE_END`,e.STATE_SNAPSHOT=`STATE_SNAPSHOT`,e.STATE_DELTA=`STATE_DELTA`,e.MESSAGES_SNAPSHOT=`MESSAGES_SNAPSHOT`,e.ACTIVITY_SNAPSHOT=`ACTIVITY_SNAPSHOT`,e.ACTIVITY_DELTA=`ACTIVITY_DELTA`,e.RAW=`RAW`,e.CUSTOM=`CUSTOM`,e.RUN_STARTED=`RUN_STARTED`,e.RUN_FINISHED=`RUN_FINISHED`,e.RUN_ERROR=`RUN_ERROR`,e.STEP_STARTED=`STEP_STARTED`,e.STEP_FINISHED=`STEP_FINISHED`,e.REASONING_START=`REASONING_START`,e.REASONING_MESSAGE_START=`REASONING_MESSAGE_START`,e.REASONING_MESSAGE_CONTENT=`REASONING_MESSAGE_CONTENT`,e.REASONING_MESSAGE_END=`REASONING_MESSAGE_END`,e.REASONING_MESSAGE_CHUNK=`REASONING_MESSAGE_CHUNK`,e.REASONING_END=`REASONING_END`,e.REASONING_ENCRYPTED_VALUE=`REASONING_ENCRYPTED_VALUE`,e.SUBAGENT_STARTED=`SUBAGENT_STARTED`,e.SUBAGENT_FINISHED=`SUBAGENT_FINISHED`,e.SUBAGENT_ERROR=`SUBAGENT_ERROR`,e}({}),B=I({type:kc(z),timestamp:bc().optional(),rawEvent:Sc().optional(),metadata:jc}).passthrough(),pl=B.extend({type:L(z.TEXT_MESSAGE_START),messageId:F(),role:fl.default(`assistant`),name:F().optional(),subagentRunId:F().optional()}),ml=B.extend({type:L(z.TEXT_MESSAGE_CONTENT),messageId:F(),delta:F(),subagentRunId:F().optional()}),hl=B.extend({type:L(z.TEXT_MESSAGE_END),messageId:F(),subagentRunId:F().optional()}),gl=B.extend({type:L(z.TEXT_MESSAGE_CHUNK),messageId:F().optional(),role:fl.optional(),delta:F().optional(),name:F().optional(),subagentRunId:F().optional()}),_l=B.extend({type:L(z.THINKING_TEXT_MESSAGE_START)}),vl=ml.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:L(z.THINKING_TEXT_MESSAGE_CONTENT)}),yl=B.extend({type:L(z.THINKING_TEXT_MESSAGE_END)}),bl=B.extend({type:L(z.TOOL_CALL_START),toolCallId:F(),toolCallName:F(),parentMessageId:F().nullable().optional().transform(e=>e??void 0),subagentRunId:F().optional()}),xl=B.extend({type:L(z.TOOL_CALL_ARGS),toolCallId:F(),delta:F(),subagentRunId:F().optional()}),Sl=B.extend({type:L(z.TOOL_CALL_END),toolCallId:F(),subagentRunId:F().optional()}),Cl=B.extend({messageId:F(),type:L(z.TOOL_CALL_RESULT),toolCallId:F(),content:F(),role:L(`tool`).optional(),subagentRunId:F().optional()}),wl=B.extend({type:L(z.TOOL_CALL_CHUNK),toolCallId:F().optional(),toolCallName:F().optional(),parentMessageId:F().nullable().optional().transform(e=>e??void 0),delta:F().optional(),subagentRunId:F().optional()}),Tl=B.extend({type:L(z.THINKING_START),title:F().optional()}),El=B.extend({type:L(z.THINKING_END)}),Dl=B.extend({type:L(z.STATE_SNAPSHOT),snapshot:Zc,subagentRunId:F().optional()}),Ol=B.extend({type:L(z.STATE_DELTA),delta:wc(Sc()),subagentRunId:F().optional()}),kl=B.extend({type:L(z.MESSAGES_SNAPSHOT),messages:wc(Gc)}),Al=B.extend({type:L(z.ACTIVITY_SNAPSHOT),messageId:F(),activityType:F(),content:Dc(Sc()),replace:xc().optional().default(!0),subagentRunId:F().optional()}),jl=B.extend({type:L(z.ACTIVITY_DELTA),messageId:F(),activityType:F(),patch:wc(Sc()),subagentRunId:F().optional()}),Ml=B.extend({type:L(z.RAW),event:Sc(),source:F().optional(),subagentRunId:F().optional()}),Nl=B.extend({type:L(z.CUSTOM),name:F(),value:Sc(),subagentRunId:F().optional()}),Pl=B.extend({type:L(z.RUN_STARTED),threadId:F(),runId:F(),parentRunId:F().optional(),input:Xc.optional()}),Fl=Ec(`type`,[I({type:L(`success`)}).strict(),I({type:L(`interrupt`),interrupts:wc(Jc).min(1)}).strict()]),Il=I({provider:F().optional(),model:F().optional(),inputTokens:bc().int().nonnegative().optional(),outputTokens:bc().int().nonnegative().optional(),totalTokens:bc().int().nonnegative().optional(),reasoningTokens:bc().int().nonnegative().optional(),cachedInputTokens:bc().int().nonnegative().optional()}),Ll=B.extend({type:L(z.RUN_FINISHED),threadId:F(),runId:F(),result:Sc().optional(),outcome:Fl.nullable().optional().transform(e=>e??void 0),usage:wc(Il).optional()}),Rl=B.extend({type:L(z.RUN_ERROR),message:F(),code:F().optional(),usage:wc(Il).optional()}),zl=B.extend({type:L(z.STEP_STARTED),stepName:F(),subagentRunId:F().optional()}),Bl=B.extend({type:L(z.STEP_FINISHED),stepName:F(),subagentRunId:F().optional()}),Vl=Tc([L(`tool-call`),L(`message`)]),Hl=B.extend({type:L(z.REASONING_START),messageId:F(),subagentRunId:F().optional()}),Ul=B.extend({type:L(z.REASONING_MESSAGE_START),messageId:F(),role:L(`reasoning`),subagentRunId:F().optional()}),Wl=B.extend({type:L(z.REASONING_MESSAGE_CONTENT),messageId:F(),delta:F(),subagentRunId:F().optional()}),Gl=B.extend({type:L(z.REASONING_MESSAGE_END),messageId:F(),subagentRunId:F().optional()}),Kl=B.extend({type:L(z.REASONING_MESSAGE_CHUNK),messageId:F().optional(),delta:F().optional(),subagentRunId:F().optional()}),ql=B.extend({type:L(z.REASONING_END),messageId:F(),subagentRunId:F().optional()}),Jl=B.extend({type:L(z.REASONING_ENCRYPTED_VALUE),subtype:Vl,entityId:F(),encryptedValue:F(),subagentRunId:F().optional()}),Yl=B.extend({type:L(z.SUBAGENT_STARTED),subagentRunId:F(),name:F(),description:F().optional(),parentSubagentRunId:F().optional(),parentToolCallId:F().optional(),parentMessageId:F().optional()}),Xl=Ec(`type`,[I({type:L(`success`)}).strict(),I({type:L(`suspended`),interruptIds:wc(F()).optional()}).strict()]),Zl=Ec(`type`,[pl,ml,hl,gl,Tl,El,_l,vl,yl,bl,xl,Sl,wl,Cl,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Ll,Rl,zl,Bl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,B.extend({type:L(z.SUBAGENT_FINISHED),subagentRunId:F(),result:Sc().optional(),outcome:Xl.optional()}),B.extend({type:L(z.SUBAGENT_ERROR),subagentRunId:F(),message:F(),code:F().optional()})]),Ql=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),$l=Object.prototype.hasOwnProperty;function eu(e,t){return $l.call(e,t)}function tu(e){if(Array.isArray(e)){for(var t=Array(e.length),n=0;n=48&&r<=57){t++;continue}return!1}return!0}function iu(e){return e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function au(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function ou(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;ts)break;var u=c.transferSize,d=c.initiatorType;u&&Jd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Mf(e,t,n){var r=jf;if(r&&typeof t==`string`&&t){var i=Qt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Ef.has(i)||(Ef.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Kd(t,`link`,e),Nt(t),r.head.appendChild(t)))}}function Nf(e){Of.D(e),Mf(`dns-prefetch`,e,null)}function Pf(e,t){Of.C(e,t),Mf(`preconnect`,e,t)}function Ff(e,t,n){Of.L(e,t,n);var r=jf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Qt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Qt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Qt(n.imageSizes)+`"]`)):i+=`[href="`+Qt(e)+`"]`;var a=i;switch(t){case`style`:a=Vf(e);break;case`script`:a=Gf(e)}Tf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Tf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Hf(a))||t===`script`&&r.querySelector(Kf(a))||(t=r.createElement(`link`),Kd(t,`link`,e),Nt(t),r.head.appendChild(t)))}}function If(e,t){Of.m(e,t);var n=jf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Qt(r)+`"][href="`+Qt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Gf(e)}if(!Tf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Tf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Kf(a)))return}r=n.createElement(`link`),Kd(r,`link`,e),Nt(r),n.head.appendChild(r)}}}function Lf(e,t,n){Of.S(e,t,n);var r=jf;if(r&&e){var i=Mt(r).hoistableStyles,a=Vf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Hf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Tf.get(a))&&Yf(e,n);var c=o=r.createElement(`link`);Nt(c),Kd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Jf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Rf(e,t){Of.X(e,t);var n=jf;if(n&&e){var r=Mt(n).hoistableScripts,i=Gf(e),a=r.get(i);a||(a=n.querySelector(Kf(i)),a||(e=f({src:e,async:!0},t),(t=Tf.get(i))&&Xf(e,t),a=n.createElement(`script`),Nt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function zf(e,t){Of.M(e,t);var n=jf;if(n&&e){var r=Mt(n).hoistableScripts,i=Gf(e),a=r.get(i);a||(a=n.querySelector(Kf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Tf.get(i))&&Xf(e,t),a=n.createElement(`script`),Nt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bf(e,t,n,r){var a=(a=xe.current)?Df(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Vf(n.href),n=Mt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Vf(n.href);var o=Mt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Hf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Tf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Tf.set(e,n),o||Wf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Gf(n),n=Mt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Vf(e){return`href="`+Qt(e)+`"`}function Hf(e){return`link[rel="stylesheet"][`+e+`]`}function Uf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Wf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Kd(t,`link`,n),Nt(t),e.head.appendChild(t))}function Gf(e){return`[src="`+Qt(e)+`"]`}function Kf(e){return`script[async]`+e}function qf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Qt(n.href)+`"]`);if(r)return t.instance=r,Nt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Nt(r),Kd(r,`style`,a),Jf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Vf(n.href);var o=e.querySelector(Hf(a));if(o)return t.state.loading|=4,t.instance=o,Nt(o),o;r=Uf(n),(a=Tf.get(a))&&Yf(r,a),o=(e.ownerDocument||e).createElement(`link`),Nt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Kd(o,`link`,r),t.state.loading|=4,Jf(o,n.precedence,e),t.instance=o;case`script`:return o=Gf(n.src),(a=e.querySelector(Kf(o)))?(t.instance=a,Nt(a),a):(r=n,(a=Tf.get(o))&&(r=f({},n),Xf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Nt(a),Kd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Jf(r,n.precedence,e));return t.instance}function Jf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function $f(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function ep(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function tp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Vf(r.href),a=t.querySelector(Hf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Nt(a);return}a=t.ownerDocument||t,r=Uf(r),(i=Tf.get(i))&&Yf(r,i),a=a.createElement(`link`),Nt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Kd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=rp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var np=0;function W(e,t){return e.stylesheets&&e.count===0&&ap(e,e.stylesheets),0np?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ap(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ip=null;function ap(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ip=new Map,t.forEach(op,e),ip=null,rp.call(e))}function op(e,t){if(!(t.state.loading&4)){var n=ip.get(e);if(n)var r=n.get(null);else{n=new Map,ip.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=In()}));function Rn(e){return e?.isNotFound===!0}function zn(){try{return sessionStorage}catch{return}}var Bn=`tsr-scroll-restoration-v1_3`,Vn=zn();function Hn(){try{return JSON.parse(Vn?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Un(){try{Vn?.setItem(Bn,JSON.stringify(Wn))}catch{}}var Wn=Hn(),Gn=`data-scroll-restoration-id`,Kn=e=>e.state.__TSR_key||e.href;function qn(e){let t=e.getAttribute(Gn);if(t)return`[${Gn}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Jn=!1,Yn=`window`;function Xn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Zn(e){let t=new Set;for(let n of e){if(n===Yn)continue;let e=Xn(n);e&&t.add(e)}return t}function Qn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Kn,a=new Set,o=e=>{let t=Wn[e]||={};for(let e of a)e===document?t[Yn]={scrollX,scrollY}:e.isConnected&&(t[qn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Jn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Jn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Un()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=Wn[d];if(e){let t=Wn[u];for(let n in e){if(n===Yn){if(s)continue}else{let e=Xn(n);if(!e||s&&o&&(l??=Zn(o),l.has(e)))continue}t||=Wn[u]={},t[n]??=e[n]}}}Jn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Zn(o));let t=e&&i&&c,s=r.restoring?Wn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Yn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Xn(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Jn=!1}}))}function $n(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function er(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function tr(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=er(r):Array.isArray(t)?t.push(er(r)):n[e]=[t,er(r)]}return n}var nr=/^(?:\s|["[{\d-]|fa|nu|tr)/,rr=ar(JSON.parse),ir=or(JSON.stringify,JSON.parse);function ar(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=tr(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function or(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!nr.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=$n(e,r);return t?`?${t}`:``}}function sr(e){return{input:({url:t})=>{for(let n of e)t=lr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=ur(e[n],t);return t}}}function cr(e){let t=wt(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=ze([`/`,t,e.pathname]),e)}}function lr(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function ur(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function dr(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{Et(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var fr=`__TSR_index`,pr=`popstate`,mr=`beforeunload`;function hr(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=yr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[fr];i=gr(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[fr];i=gr(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[fr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function gr(e,t){t||={};let n=br();return{...t,key:n,__TSR_key:n,[fr]:e}}function _r(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>yr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=br();t.history.replaceState({[fr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(ee._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),ee._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=yr(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),ee.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[fr]-l.state[fr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),ee.notify(u);return}}}l=c(),ee.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},ee=hr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(mr,x,{capture:!0}),t.removeEventListener(pr,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(mr,x,{capture:!0}),t.addEventListener(pr,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return ee._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return ee._ignoreSubscribers||y(`REPLACE`),n},ee}function vr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function yr(e,t){let n=vr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=br();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[fr]:0,key:a,__TSR_key:a}}}function br(){return(Math.random()+1).toString(36).substring(7)}function xr(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Sr(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Cr({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function wr(e,t,n,r){for(let i of t){if(r&&e._tx!==r)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r&&e._tx!==r)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var Tr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Qe(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:_r()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=At(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=dr(this.latestLocation,e),Qn(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=wt(a);t&&t!==`/`&&e.push(cr({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:sr(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=ut(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Pe(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:ht(e).path,external:!1,searchStr:o,search:lt(t?.search,i),hash:ht(r.slice(1)).path,state:dt(t?.state,a)}}let o=new URL(i,this.origin),s=lr(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:ht(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:lt(t?.search,c),hash:ht(s.hash.slice(1)).path,state:dt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>Ue({base:e,to:t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=rt(He(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{if(t.href){let e=yr(t.href,{});t={...t,to:lr(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=r[2],o=r[3],s=this.resolvePathWithBase(i,t.to?`${t.to}`:`.`),c=jr(t.params,o),l=this.routesByPath[He(s)],u;if(l)u=this.getRouteBranch(l);else if(s.includes(`$`))u=[];else{let[e,t,n]=this.getMatchedRoutes(s);u=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(u=[...u,this.options.notFoundRoute])}if(u.length&&st(c))for(let e of u){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){c===o&&(c=Object.assign(Object.create(null),c));try{Object.assign(c,t(c))}catch{}}}let d=e.leaveParams?s:ht(et({path:s,params:c,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,f=a;if(e._includeValidateSearch&&this.options.search?.strict){let e={};u.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Or(t.options.validateSearch,{...e,...f}))}catch{}}),f=e}f=kr(f,t,u,e._includeValidateSearch),f=lt(a,f);let p=this.options.stringifySearch(f),m=t.hash===!0?n.hash:t.hash?Ot(t.hash,n.hash):void 0,h=m?`#${m}`:``,g=t.state===!0?n.state:t.state?Ot(t.state,n.state):{};t.state&&(g=dt(n.state,g));let _=`${d}${p}${h}`,v,y,b=!1;if(this.rewrite){let e=new URL(_,this.origin),t=ur(this.rewrite,e);v=e.href.replace(e.origin,``),t.origin===this.origin?y=t.pathname+t.search+t.hash:(y=t.href,b=!0)}else v=Ct(_),y=v;return{publicHref:y,href:v,pathname:d,search:f,searchStr:p,state:g,hash:m??``,external:b,unmaskOnReload:t.unmaskOnReload}},n=t(e);if(e.mask)n.maskedLocation=t({from:e.from,...e.mask});else if(this.options.routeMasks){let r=tt(n.pathname,this.processedTree);if(r){let i=Object.assign(Object.create(null),r.rawParams),{from:a,params:o,...s}=r.route,c=jr(o,i);n.maskedLocation=t({from:e.from,...s,params:c})}}return n},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=He(this.latestLocation.href)===He(n.href)&&at(Cr(n.state),Cr(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(yt(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Si(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Sr(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&xr(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href){let t=this.buildLocation(e.options).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&yt(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Fr,this.preloadRoute=e=>Ci(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Ye(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!at(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?at(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??ir,parseSearch:e.parseSearch??rr,protocolAllowlist:e.protocolAllowlist??xt}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=nt(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:He(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Ar(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;r&&n&&i.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=Or(n,i);if(r&&e)for(let t in e)t in i||(r.defaulted||=new Map).set(t,e[t]);return{...i,...e}}catch{}return i})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=Ot(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function Ar(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Be}function jr(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let n=Object.assign(Object.create(null),t);return Object.assign(n,Ot(e,n))}function Mr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Nr(e,t){return e.options[t]?.preload?.()}function Pr(e,t){let n=Nr(e,`component`),r=Nr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Fr(e,t,n){let r=()=>t===!1?void 0:t?Nr(e,t):Pr(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function Ir(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function Wr(e,t){return e.routesById[t.routeId]}function Gr(e,t,n){return $e(e)?[Br,e]:Rn(e)?(e.routeId||=n,[zr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[Rr,e]):[Lr,e]}function Kr(e,t){let n=Gr(t,!0,e.id);if(n[0]!==Rr)return n;try{e.options.onError?.(n[1])}catch(t){n=Gr(t,!0,e.id)}return n}function qr(e,t,n,r,i){return i[0].signal.aborted?Vr:li(e,t,n,Kr(n,r),i)}async function Jr(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;ie.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Xr(e,r),[i,qr(e,t,u,a,n)]}if(c.aborted)return[i,Vr];let p=r.paramsError??r.searchError;if(p!==void 0)return Xr(e,r),[i,qr(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{$r(e,r,`beforeLoad`,n[0]);let a=await Ur(m({...f,search:r.search,context:r.context,...e.options.additionalContext}),c);if(c.aborted)return[i,Vr];let o=li(e,t,u,Gr(a,!1,u.id),n);if(o[0]!==Lr)return Xr(e,r),[i,o];r.context={...r.context,...a}}catch(a){return Xr(e,r),[i,qr(e,t,u,a,n)]}finally{r.status=h,$r(e,r,!1,n[0])}}i()}function Yr(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Xr(e,t){let n=t._flight;t._flight=void 0,Yr(e,t,n)?.abort()}function Zr(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Yr(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Qr(e){for(let t of e){let e=t._flight;e&&e[2]++}}function $r(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function ei(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function ti(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return Vr;if(!i)return[Lr,void 0];let l=n._flight;$r(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(ei(e,t,n,r,s,a,!!o[3]))).then(e=>Gr(e,!1,r.id),e=>Gr(e,!0,r.id)).then(t=>(t[0]!==Lr&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Rr&&l[2]?Kr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],li(e,t,r,await Ur(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Xr(e,n),Vr}finally{$r(e,n,!1,s)}}function ni(e,t,n){t[0]!==Br&&(e.status=`success`,e.error=void 0,t[0]===Lr?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function ri(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Xr(e,r)}function ii(e,t){return t[0]===Rr||t[0]===zr?{...e,status:t[0]===Rr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function ai(e,t,n,r,i,a,o){let s=t[1][n],c=Wr(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(ei(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=Vr)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Xr(e,s),p=qr(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),ee=n>=o?a[7]:void 0,te=c.lazyFn&&c._lazy!==!0?ee:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Yr(e,s,t)?.abort(),n>=o&&(s.status=`pending`),ee?.()}b||(s.isFetching=!1);let ne=(p?Promise.resolve(p):x?ti(e,t,s,c,g,i,a):Promise.resolve([Lr,s.loaderData])).then(t=>(x&&(ni(s,t,l),t[0]===Lr&&(m&&!a[0].signal.aborted&&ri(e,s,u),n>=o&&(s.status=`pending`))),t)),re=Ur(Promise.resolve().then(()=>Fr(c,void 0,te)),a[0].signal).then(()=>void 0,r=>t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound))?void 0:[n,qr(e,t,c,r,a)]).then(e=>ne.then(t=>(x&&!e&&t[0]===Lr&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,ee?.()),e)));if(r.push([n,ne,re]),!y)return ne.then(e=>ii(s,e));let S={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let ie=ti(e,t,S,c,g,i,a).then(e=>(s.isFetching=!1,ni(S,e,!1),e));return(t[2]??=[]).push([n,ie,re,S]),ie.then(e=>ii(S,e))}async function oi(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Wr(e,t[n]);try{let e=Fr(i,!1);e&&await Ur(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function si(e,t){t[2]&&=(Zr(e,t[2].map(e=>e[3])),void 0)}async function ci(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=Br)throw[a,t];!i&&t[0]!==Lr&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===Br)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function li(e,t,n,r,i,a){for(;r[0]===Br;){let o=r[1],s=o.options;if(s.reloadDocument?i[3]:i[1]>=20)return r;try{return s.href&&s.reloadDocument?(e.resolveRedirect(o),r):[Br,o,e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0})]}catch(e){r=a?[Rr,e]:Kr(n,e),a=!0}}return r}async function ui(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===zr?oi(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=Br)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==Lr&&t[0]=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=Br){let n=s[1];if(n[0]!==Br||n[1].options.reloadDocument||n[2])return si(e,t),n;c=!0,s=[0,[Rr,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===Rr?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=Wr(e,u);try{await Ur(i?Promise.resolve().then(()=>Fr(m,l===Rr?`errorComponent`:`notFoundComponent`)):Promise.all([Fr(m),Fr(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return si(e,t),Vr}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),si(e,t),Zr(e,o),p()):u.status=`success`}return t}async function di(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;te._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await oi(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l{for(let t=d;t=Br&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=ui(e,i,u,r[0],ci(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=ci(i[2],void 0,void 0,h.then(e=>Hr(e)?0:Ir(n).length,()=>0))),o=await h}catch(t){if(si(e,i),t===a&&a.aborted)return Vr;throw t}return Hr(o)?o:di(e,o,a,r[6]===n.length?r[6]:0)}function pi(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a0){i[3]=setTimeout(()=>pi(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function mi(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function hi(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!Ir(t[3]).some(e=>e.id===n[1]))return;let i;try{await Ur(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function gi(e,t){e._committed=t,e.stores.setMatches(t)}function _i(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=Ir(n).length,s=new Map;{let t=Date.now();for(let r of[...i,...a.values()]){if(r.status!==`success`||n.some((e,t)=>e.id===r.id&&(t=(r.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||s.set(r.id,a.get(r.id)===r?r:{...r,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=s,gi(e,n),Zr(e,[...a.values(),...i],[...n,...s.values()]),wr(e,i,n,t)}async function vi(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}function yi(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:i.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function bi(e,t,n,r,i){let a=n.map(e=>({...e}));Qr(a);for(let t of r)Xr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await ui(e,o,r,t[0],i)}catch(t){throw Zr(e,a),t}if(Hr(s)){Zr(e,a),s[0]===Br&&e._tx===t&&e._committed===n&&await yi(e,t,s);return}if(await di(e,s,t[0].signal),e._tx!==t||e._committed!==n){Zr(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Xr(e,n))}gi(e,a),Zr(e,n,a)}async function xi(e,t,n,r,i,a){let o=await fi(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Hr(o)){let n=o[0]===Br&&e._tx===t;if((!n||o[1].options.reloadDocument)&&mi(e,t),Zr(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){mi(e,t);return}await yi(e,t,o);return}let s=o[1];if(e._tx===t&&await hi(e,t),e._tx!==t){mi(e,t),Zr(e,s),si(e,o);return}let c=t[2],l=Sr(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await hi(e,t),e._tx!==t){mi(e,t),Zr(e,s),si(e,o);return}let n=await e.startTransition(()=>{mi(e,t),_i(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){si(e,o);return}u?.length&&bi(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function Si(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=Sr(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await vi(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Qr(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){Zr(e,m),await vi(e,n);return}e._preflight=void 0;let g,_=()=>xi(e,y,f,()=>pi(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_).then(),y=[p,s,a,m,Date.now(),v];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&$r(e,t,!1)}n[0].abort(),Zr(e,n[3],y[3],!0)}if(e._tx!==y){Zr(e,y[3]),y[3]=[],g?.(),await vi(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&pi(e,y),g?.(_()),await v,await vi(e,y)}async function Ci(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Qr(a),o=(e._preloads??=new Map).set(i,a),s=await fi(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),Zr(e,a)),i.abort()}if(!Hr(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Rn(e)||console.error(e);return}}}var w=m(se(),1),T=fe(),wi=class extends w.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?w.createElement(this.props.errorComponent??Ti,{error:e,reset:this.reset}):this.props.children}};function Ti({error:e}){let[t,n]=w.useState(!1);return(0,T.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,T.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,T.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,T.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,T.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,T.jsx)(`div`,{children:(0,T.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,T.jsx)(`code`,{children:e.message}):null})}):null]})}var Ei=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(Ei||{});function Di({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Oi(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ki=[],Ai=0,{link:ji,unlink:Mi,propagate:Ni,checkDirty:Pi,shallowPropagate:Fi}=Di({update(e){return e._update()},notify(e){ki[Li++]=e,e.flags&=~Ei.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Ei.Mutable|Ei.Dirty,Vi(e))}}),Ii=0,Li=0,Ri,zi=0;function Bi(e){try{++zi,e()}finally{--zi||Hi()}}function Vi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Mi(n,e)}function Hi(){if(!(zi>0)){for(;Ii{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ri,o=t?.compare??Object.is;if(n)Ri=i,++Ai,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=Ei.Mutable|Ei.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ri=a,n&&(i.flags&=~Ei.RecursedCheck),Vi(i)}}};return n?(i.flags=Ei.Mutable|Ei.Dirty,i.get=function(){let e=i.flags;if(e&Ei.Dirty||e&Ei.Pending&&Pi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Fi(e)}}else e&Ei.Pending&&(i.flags=e&~Ei.Pending);return Ri!==void 0&&ji(i,Ri,Ai),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Ni(e),Fi(e),Hi())}},i}function Wi(e){let t=()=>{let t=Ri;Ri=n,++Ai,n.depsTail=void 0,n.flags=Ei.Watching|Ei.RecursedCheck;try{return e()}finally{Ri=t,n.flags&=~Ei.RecursedCheck,Vi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Ei.Watching|Ei.RecursedCheck,notify(){let e=this.flags;e&Ei.Dirty||e&Ei.Pending&&Pi(this.deps,this)?t():this.flags=Ei.Watching},stop(){this.flags=Ei.None,this.depsTail=void 0,Vi(this)}};return t(),n}function Gi(e){let t=we(),n=`not-found-${Xe(t.stores.location,e=>e.pathname)}-${Xe(t.stores.status,e=>e)}`;return(0,T.jsx)(wi,{getResetKey:()=>n,onCatch:(t,n)=>{if(Rn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Rn(t))return e.fallback?.(t);throw t},children:e.children})}function Ki(){return(0,T.jsx)(`p`,{children:`Not Found`})}function qi(e){return(0,T.jsx)(T.Fragment,{children:e.children})}function Ji(e,t,n){return t.options.notFoundComponent?(0,T.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,T.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,T.jsx)(Ki,{})}function Yi(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,T.jsx)(n,{}):null}var Xi=(e,t)=>e[0]===t[0]&&e[1]===t[1],Zi=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Qi=w.memo(function({routeId:e}){let t=we();return(0,T.jsx)($i,{router:t,match:Xe(t.stores.getMatchStore(e),e=>e)})});function $i({router:e,match:t}){let n=e.routesById[t.routeId],r=Yi(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=Zi(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?w.Suspense:qi,l=i?wi:qi,u=o?Gi:qi;return(0,T.jsxs)(n.isRoot?n.options.shellComponent??qi:qi,{children:[(0,T.jsx)(Lt.Provider,{value:t.routeId,children:(0,T.jsx)(c,{fallback:r,children:(0,T.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Rn(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,T.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return w.createElement(o,e)},children:s?(0,T.jsx)(Ie,{fallback:r,children:(0,T.jsx)(ea,{match:t})}):(0,T.jsx)(ea,{match:t})})})})}),null]})}var ea=w.memo(function({match:e}){let t=we(),n=e.routeId,r=t.routesById[n],i=w.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=w.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,T.jsx)(e,{},i):(0,T.jsx)(ta,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Zi(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Yi(t,r)}if(e.status===`notFound`)return Ji(t,r,e.error);if(e.status===`error`)throw e.error;return a}),ta=w.memo(function(){let e=we(),t=w.useContext(Lt),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=Xe(a,e=>[!!e._notFound,e.error],Xi),i=Xe(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Ji(e,e.routesById[t],r);if(!i)return null;let a=(0,T.jsx)(Qi,{routeId:i});return t===`__root__`?(0,T.jsx)(w.Suspense,{fallback:Yi(e),children:a}):a});function na(e,t){let n=e[1];e.length=0,n?.(t)}function ra({t:e}){let t=we(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{na(n,!1),n.push(i,a),e(t),w.startTransition(r)}),Ee(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(He(r.publicHref)!==He(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...Sr(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function ia(){let e=we(),t=e.routesById[Be],n=Yi(e,t),r=e.ssr?qi:w.Suspense,i=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ra,{t:w.useState()[1]}),(0,T.jsx)(r,{fallback:n,children:(0,T.jsx)(aa,{})})]});return e.options.InnerWrap?(0,T.jsx)(e.options.InnerWrap,{children:i}):i}function aa(){let e=we(),t=e._rendered,n=Xe(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;Ee(()=>{t[0]===n&&na(t,!0)},[t,n]);let a=i?(0,T.jsx)(Qi,{routeId:i}):null;return(0,T.jsx)(Lt.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,T.jsx)(wi,{getResetKey:()=>r,onCatch:void 0,children:a})})}var oa=e=>({createMutableStore:Ui,createReadonlyStore:Ui,batch:Bi}),sa=e=>new ca(e),ca=class extends Tr{constructor(e){super(e,oa)}};function la({router:e,children:t,...n}){st(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,T.jsx)(Te.Provider,{value:e,children:t});return e.options.Wrap?(0,T.jsx)(e.options.Wrap,{children:r}):r}function ua({router:e,...t}){return(0,T.jsx)(la,{router:e,...t,children:(0,T.jsx)(ia,{})})}function da(e){let t=we({warn:e?.router===void 0}),n=e?.router||t;return Xe(n.stores.__store,We(e,n))}function fa(e,t,n={leading:!1}){let[r,i]=(0,w.useState)(e),a=(0,w.useRef)(!1),o=(0,w.useRef)(null),s=(0,w.useRef)(!1),c=(0,w.useRef)(e);c.current=e;let l=(0,w.useCallback)(()=>{window.clearTimeout(o.current),o.current=null},[]),u=(0,w.useCallback)(()=>{l(),s.current=!1},[]),d=(0,w.useCallback)(()=>{o.current&&(u(),s.current=!1,i(c.current))},[]);return(0,w.useEffect)(()=>{a.current&&(l(),!s.current&&n.leading?(s.current=!0,i(e),o.current=window.setTimeout(()=>{s.current=!1},t)):o.current=window.setTimeout(()=>{s.current=!1,i(e)},t))},[e,n.leading,t]),(0,w.useEffect)(()=>(a.current=!0,u),[]),[r,u,{cancel:u,flush:d}]}function pa(e=!1,t={}){let[n,r]=(0,w.useState)(e),i=(0,w.useCallback)(()=>{r(e=>e||(t.onOpen?.(),!0))},[t.onOpen]),a=(0,w.useCallback)(()=>{r(e=>e&&(t.onClose?.(),!1))},[t.onClose]);return[n,{open:i,close:a,toggle:(0,w.useCallback)(()=>{n?a():i()},[a,i,n]),set:r}]}function ma(e){return e===`auto`||e===`dark`||e===`light`}function ha({key:e=`mantine-color-scheme-value`}={}){let t;return{get:t=>{if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return ma(n)?n:t}catch{return t}},set:t=>{try{window.localStorage.setItem(e,t)}catch(e){console.warn(`[@mantine/core] Local storage color scheme manager was unable to save color scheme.`,e)}},subscribe:n=>{t=t=>{t.storageArea===window.localStorage&&t.key===e&&ma(t.newValue)&&n(t.newValue)},window.addEventListener(`storage`,t)},unsubscribe:()=>{window.removeEventListener(`storage`,t)},clear:()=>{window.localStorage.removeItem(e)}}}function ga(e,t){let n=typeof window<`u`&&`matchMedia`in window&&window.matchMedia(`(prefers-color-scheme: dark)`)?.matches,r=e===`auto`?n?`dark`:`light`:e;t()?.setAttribute(`data-mantine-color-scheme`,r)}function _a({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){let i=(0,w.useRef)(null),[a,o]=(0,w.useState)(()=>e.get(t)),s=r||a,c=(0,w.useCallback)(t=>{r||(ga(t,n),o(t),e.set(t))},[e.set,s,r]),l=(0,w.useCallback)(()=>{o(t),ga(t,n),e.clear()},[e.clear,t]);return(0,w.useEffect)(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),pe(()=>{ga(e.get(t),n)},[]),(0,w.useEffect)(()=>{if(r)return ga(r,n),()=>{};r===void 0&&ga(a,n),typeof window<`u`&&`matchMedia`in window&&(i.current=window.matchMedia(`(prefers-color-scheme: dark)`));let e=e=>{a===`auto`&&ga(e.matches?`dark`:`light`,n)};return i.current?.addEventListener(`change`,e),()=>i.current?.removeEventListener(`change`,e)},[a,r]),{colorScheme:s,setColorScheme:c,clearColorScheme:l}}function va(e){return Object.entries(e).map(([e,t])=>`${e}: ${t};`).join(``)}function ya(e,t){let n=t?[t]:[`:root`,`:host`],r=va(e.variables),i=r?`${n.join(`, `)}{${r}}`:``,a=va(e.dark),o=va(e.light),s=e=>n.map(t=>t===`:host`?`${t}([data-mantine-color-scheme="${e}"])`:`${t}[data-mantine-color-scheme="${e}"]`).join(`, `);return`${i}\n\n${a?`${s(`dark`)}{${a}}`:``}\n\n${o?`${s(`light`)}{${o}}`:``}`}function ba({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:a=!0}){if(!e.colors[t])return{};if(n===`light`){let n=o(e,`light`),s={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${n})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${n===9?8:n+1})`,[`--mantine-color-${r}-light`]:`var(--mantine-color-${r}-1)`,[`--mantine-color-${r}-light-hover`]:`var(--mantine-color-${r}-2)`,[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-9)`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${n})`,[`--mantine-color-${r}-outline-hover`]:i(e.colors[t][n],.05)};return a?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...s}:s}let s=o(e,`dark`),c={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${s})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${s===9?8:s+1})`,[`--mantine-color-${r}-light`]:g(e.colors[t][9],.5),[`--mantine-color-${r}-light-hover`]:g(e.colors[t][9],.3),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-0)`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(s-4,0)})`,[`--mantine-color-${r}-outline-hover`]:i(e.colors[t][Math.max(s-4,0)],.05)};return a?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...c}:c}function xa(e,t,n){me(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}var Sa=e=>{let t=o(e,`light`),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:S(e.defaultRadius),i={variables:{"--mantine-z-index-app":`100`,"--mantine-z-index-modal":`200`,"--mantine-z-index-popover":`300`,"--mantine-z-index-overlay":`400`,"--mantine-z-index-max":`9999`,"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?`antialiased`:`unset`,"--mantine-moz-font-smoothing":e.fontSmoothing?`grayscale`:`unset`,"--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-color-scheme":`light`,"--mantine-primary-color-contrast":qe(e,`light`),"--mantine-color-bright":`var(--mantine-color-black)`,"--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":`var(--mantine-color-red-6)`,"--mantine-color-success":`var(--mantine-color-teal-8)`,"--mantine-color-placeholder":`var(--mantine-color-gray-5)`,"--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":`var(--mantine-color-white)`,"--mantine-color-default-hover":`var(--mantine-color-gray-0)`,"--mantine-color-default-color":`var(--mantine-color-black)`,"--mantine-color-default-border":`var(--mantine-color-gray-4)`,"--mantine-color-dimmed":`var(--mantine-color-gray-6)`,"--mantine-color-disabled":`var(--mantine-color-gray-2)`,"--mantine-color-disabled-color":`var(--mantine-color-gray-5)`,"--mantine-color-disabled-border":`var(--mantine-color-gray-3)`},dark:{"--mantine-color-scheme":`dark`,"--mantine-primary-color-contrast":qe(e,`dark`),"--mantine-color-bright":`var(--mantine-color-white)`,"--mantine-color-text":`var(--mantine-color-dark-0)`,"--mantine-color-body":`var(--mantine-color-dark-7)`,"--mantine-color-error":`var(--mantine-color-red-8)`,"--mantine-color-success":`var(--mantine-color-teal-8)`,"--mantine-color-placeholder":`var(--mantine-color-dark-3)`,"--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":`var(--mantine-color-dark-6)`,"--mantine-color-default-hover":`var(--mantine-color-dark-5)`,"--mantine-color-default-color":`var(--mantine-color-white)`,"--mantine-color-default-border":`var(--mantine-color-dark-4)`,"--mantine-color-dimmed":`var(--mantine-color-dark-2)`,"--mantine-color-disabled":`var(--mantine-color-dark-6)`,"--mantine-color-disabled-color":`var(--mantine-color-dark-3)`,"--mantine-color-disabled-border":`var(--mantine-color-dark-4)`}};xa(i.variables,e.breakpoints,`breakpoint`),xa(i.variables,e.spacing,`spacing`),xa(i.variables,e.fontSizes,`font-size`),xa(i.variables,e.lineHeights,`line-height`),xa(i.variables,e.shadows,`shadow`),xa(i.variables,e.radius,`radius`),xa(i.variables,e.fontWeights,`font-weight`),e.colors[e.primaryColor].forEach((t,n)=>{i.variables[`--mantine-primary-color-${n}`]=`var(--mantine-color-${e.primaryColor}-${n})`}),me(e.colors).forEach(t=>{let n=e.colors[t];if(r(n)){Object.assign(i.light,ba({theme:e,name:n.name,color:n.light,colorScheme:`light`,withColorValues:!0})),Object.assign(i.dark,ba({theme:e,name:n.name,color:n.dark,colorScheme:`dark`,withColorValues:!0})),i.light[`--mantine-color-${n.name}-contrast`]=_t(n,e,`light`),i.dark[`--mantine-color-${n.name}-contrast`]=_t(n,e,`dark`);return}n.forEach((e,n)=>{i.variables[`--mantine-color-${t}-${n}`]=e}),Object.assign(i.light,ba({theme:e,color:t,colorScheme:`light`,withColorValues:!1})),Object.assign(i.dark,ba({theme:e,color:t,colorScheme:`dark`,withColorValues:!1}))});let a=e.headings.sizes;return me(a).forEach(t=>{i.variables[`--mantine-${t}-font-size`]=a[t].fontSize,i.variables[`--mantine-${t}-line-height`]=a[t].lineHeight,i.variables[`--mantine-${t}-font-weight`]=a[t].fontWeight||e.headings.fontWeight}),i};function Ca(){let t=u(),n=e(),r=me(t.breakpoints).reduce((e,n)=>{let r=t.breakpoints[n].includes(`px`),i=Ge(t.breakpoints[n]);return`${e}@media (max-width: ${r?`${i-.1}px`:be(i-.1)}) {.mantine-visible-from-${n} {display: none !important;}}@media (min-width: ${r?`${i}px`:be(i)}) {.mantine-hidden-from-${n} {display: none !important;}}`},``);return(0,T.jsx)(`style`,{"data-mantine-styles":`classes`,nonce:n?.(),dangerouslySetInnerHTML:{__html:r}})}function wa({theme:e,generator:t}){let n=Sa(e),r=t?.(e);return r?oe(n,r):n}var Ta=Sa(f);function Ea(e){let t={variables:{},light:{},dark:{}};return me(e.variables).forEach(n=>{Ta.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),me(e.light).forEach(n=>{Ta.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),me(e.dark).forEach(n=>{Ta.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function Da(e){return ya({variables:{},dark:{"--mantine-color-scheme":`dark`},light:{"--mantine-color-scheme":`light`}},e)}function Oa({cssVariablesSelector:t,deduplicateCssVariables:n}){let r=u(),i=e(),a=wa({theme:r,generator:c()}),o=(t===void 0||t===`:root`||t===`:host`)&&n,s=ya(o?Ea(a):a,t);return s?(0,T.jsx)(`style`,{"data-mantine-styles":!0,nonce:i?.(),dangerouslySetInnerHTML:{__html:`${s}${o?``:Da(t)}`}}):null}Oa.displayName=`@mantine/CssVariables`;function ka({respectReducedMotion:e,getRootElement:t}){pe(()=>{e&&t()?.setAttribute(`data-respect-reduced-motion`,`true`)},[e])}function Aa({theme:e,children:t,getStyleNonce:r,withStaticClasses:i=!0,withGlobalClasses:a=!0,deduplicateCssVariables:o=!0,withCssVariables:s=!0,cssVariablesSelector:c,classNamesPrefix:u=`mantine`,colorSchemeManager:d=ha(),defaultColorScheme:f=`light`,getRootElement:p=()=>document.documentElement,cssVariablesResolver:m,forceColorScheme:h,stylesTransform:g,env:_,deduplicateInlineStyles:v=!1}){let{colorScheme:y,setColorScheme:b,clearColorScheme:x}=_a({defaultColorScheme:f,forceColorScheme:h,manager:d,getRootElement:p});return ka({respectReducedMotion:e?.respectReducedMotion||!1,getRootElement:p}),(0,T.jsx)(n,{value:{colorScheme:y,setColorScheme:b,clearColorScheme:x,getRootElement:p,classNamesPrefix:u,getStyleNonce:r,cssVariablesResolver:m,cssVariablesSelector:c??`:root`,withStaticClasses:i,stylesTransform:g,env:_,deduplicateInlineStyles:v},children:(0,T.jsxs)(l,{theme:e,children:[s&&(0,T.jsx)(Oa,{cssVariablesSelector:c,deduplicateCssVariables:o}),a&&(0,T.jsx)(Ca,{}),t]})})}Aa.displayName=`@mantine/core/MantineProvider`;function ja(e){return e}var[Ma,Na]=Ht(`AppShell was not found in tree`),Pa={root:`m_89ab340`,navbar:`m_45252eee`,aside:`m_9cdde9a`,header:`m_3b16f56b`,main:`m_8983817`,footer:`m_3840c879`,section:`m_6dcfc7c7`},Fa=t(e=>{let{classNames:t,className:n,style:r,styles:i,unstyled:a,vars:o,withBorder:s,zIndex:c,mod:l,...u}=ue(`AppShellAside`,null,e),d=Na();return d.disabled?null:(0,T.jsx)(xe,{component:`aside`,mod:[{"with-border":s??d.withBorder},l],...d.getStyles(`aside`,{className:v({[rn.classNames.zeroRight]:d.offsetScrollbars},n),classNames:t,styles:i,style:r}),...u,__vars:{"--app-shell-aside-z-index":`calc(${c??d.zIndex} + 1)`}})});Fa.classes=Pa,Fa.displayName=`@mantine/core/AppShellAside`;var Ia=t(e=>{let{classNames:t,className:n,style:r,styles:i,unstyled:a,vars:o,withBorder:s,zIndex:c,mod:l,...u}=ue(`AppShellFooter`,null,e),d=Na();return d.disabled?null:(0,T.jsx)(xe,{component:`footer`,mod:[{"with-border":s??d.withBorder},l],...d.getStyles(`footer`,{className:v({[rn.classNames.zeroRight]:d.offsetScrollbars},n),classNames:t,styles:i,style:r}),...u,__vars:{"--app-shell-footer-z-index":(c??d.zIndex)?.toString()}})});Ia.classes=Pa,Ia.displayName=`@mantine/core/AppShellFooter`;var La=t(e=>{let{classNames:t,className:n,style:r,styles:i,unstyled:a,vars:o,withBorder:s,zIndex:c,mod:l,...u}=ue(`AppShellHeader`,null,e),d=Na();return d.disabled?null:(0,T.jsx)(xe,{component:`header`,mod:[{"with-border":s??d.withBorder},l],...d.getStyles(`header`,{className:v({[rn.classNames.zeroRight]:d.offsetScrollbars},n),classNames:t,styles:i,style:r}),...u,__vars:{"--app-shell-header-z-index":(c??d.zIndex)?.toString()}})});La.classes=Pa,La.displayName=`@mantine/core/AppShellHeader`;var Ra=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`AppShellMain`,null,e);return(0,T.jsx)(xe,{component:`main`,...Na().getStyles(`main`,{className:n,style:r,classNames:t,styles:i}),...o})});Ra.classes=Pa,Ra.displayName=`@mantine/core/AppShellMain`;var za=t(e=>{let{classNames:t,className:n,style:r,styles:i,unstyled:a,vars:o,withBorder:s,zIndex:c,mod:l,...u}=ue(`AppShellNavbar`,null,e),d=Na();return d.disabled?null:(0,T.jsx)(xe,{component:`nav`,mod:[{"with-border":s??d.withBorder},l],...d.getStyles(`navbar`,{className:n,classNames:t,styles:i,style:r}),...u,__vars:{"--app-shell-navbar-z-index":`calc(${c??d.zIndex} + 1)`}})});za.classes=Pa,za.displayName=`@mantine/core/AppShellNavbar`;var Ba=p(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,grow:o,mod:s,...c}=ue(`AppShellSection`,null,e),l=Na();return(0,T.jsx)(xe,{mod:[{grow:o},s],...l.getStyles(`section`,{className:n,style:r,classNames:t,styles:i}),...c})});Ba.classes=Pa,Ba.displayName=`@mantine/core/AppShellSection`;function Va(e){return typeof e==`object`?e.base:e}function Ha(e){let t=typeof e==`object`&&!!e&&e.base!==void 0&&Object.keys(e).length===1;return typeof e==`number`||typeof e==`string`||t}function Ua(e){return!(typeof e!=`object`||!e||Object.keys(e).length===1&&`base`in e)}function Wa({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,aside:r,theme:i,mode:a}){let o=r?.width,s=`translateX(var(--app-shell-aside-width))`,c=`translateX(calc(var(--app-shell-aside-width) * -1))`;if(r?.breakpoint!==void 0&&!r?.collapsed?.mobile&&(n[r?.breakpoint]=n[r?.breakpoint]||{},a===`fixed`?(n[r?.breakpoint][`--app-shell-aside-width`]=`100%`,n[r?.breakpoint][`--app-shell-aside-offset`]=`0px`):(n[r?.breakpoint][`--app-shell-aside-width`]=`0px`,n[r?.breakpoint][`--app-shell-aside-offset`]=`0px`)),Ha(o)){let t=S(Va(o));e[`--app-shell-aside-width`]=t,e[`--app-shell-aside-offset`]=t}if(Ua(o)&&(o.base!==void 0&&(e[`--app-shell-aside-width`]=S(o.base),e[`--app-shell-aside-offset`]=S(o.base)),me(o).forEach(e=>{e!==`base`&&(t[e]=t[e]||{},t[e][`--app-shell-aside-width`]=S(o[e]),t[e][`--app-shell-aside-offset`]=S(o[e]))})),r?.breakpoint!==void 0&&a===`static`&&(t[r.breakpoint]=t[r.breakpoint]||{},t[r.breakpoint][`--app-shell-aside-position`]=`sticky`,t[r.breakpoint][`--app-shell-aside-grid-row`]=`2`,t[r.breakpoint][`--app-shell-aside-grid-column`]=`3`,t[r.breakpoint][`--app-shell-main-column-end`]=`3`),r?.collapsed?.desktop){let e=r.breakpoint;t[e]=t[e]||{},t[e][`--app-shell-aside-transform`]=s,t[e][`--app-shell-aside-transform-rtl`]=c,a===`fixed`?t[e][`--app-shell-aside-offset`]=`0px !important`:(t[e][`--app-shell-aside-width`]=`0px`,t[e][`--app-shell-aside-display`]=`none`,t[e][`--app-shell-main-column-end`]=`-1`),t[e][`--app-shell-aside-scroll-locked-visibility`]=`hidden`}if(r?.collapsed?.mobile){let e=gt(r.breakpoint,i.breakpoints)-.1;n[e]=n[e]||{},a===`fixed`?(n[e][`--app-shell-aside-width`]=`100%`,n[e][`--app-shell-aside-offset`]=`0px`):n[e][`--app-shell-aside-width`]=`0px`,n[e][`--app-shell-aside-transform`]=s,n[e][`--app-shell-aside-transform-rtl`]=c,n[e][`--app-shell-aside-scroll-locked-visibility`]=`hidden`}}function Ga({baseStyles:e,minMediaStyles:t,footer:n,mode:r}){let i=n?.height,a=r===`static`?!0:n?.offset??!0;if(r===`static`&&n&&(e[`--app-shell-footer-position`]=`sticky`,e[`--app-shell-footer-grid-column`]=`1 / -1`,e[`--app-shell-footer-grid-row`]=`3`),Ha(i)){let t=S(Va(i));e[`--app-shell-footer-height`]=t,a&&(e[`--app-shell-footer-offset`]=t)}Ua(i)&&(i.base!==void 0&&(e[`--app-shell-footer-height`]=S(i.base),a&&(e[`--app-shell-footer-offset`]=S(i.base))),me(i).forEach(e=>{e!==`base`&&(t[e]=t[e]||{},t[e][`--app-shell-footer-height`]=S(i[e]),a&&(t[e][`--app-shell-footer-offset`]=S(i[e])))})),n?.collapsed&&(e[`--app-shell-footer-transform`]=`translateY(var(--app-shell-footer-height))`,r===`fixed`&&(e[`--app-shell-footer-offset`]=`0px !important`))}function Ka({baseStyles:e,minMediaStyles:t,header:n,mode:r}){let i=n?.height,a=r===`static`?!0:n?.offset??!0;if(r===`static`&&n&&(e[`--app-shell-header-position`]=`sticky`,e[`--app-shell-header-grid-column`]=`1 / -1`,e[`--app-shell-header-grid-row`]=`1`),Ha(i)){let t=S(Va(i));e[`--app-shell-header-height`]=t,a&&(e[`--app-shell-header-offset`]=t)}Ua(i)&&(i.base!==void 0&&(e[`--app-shell-header-height`]=S(i.base),a&&(e[`--app-shell-header-offset`]=S(i.base))),me(i).forEach(e=>{e!==`base`&&(t[e]=t[e]||{},t[e][`--app-shell-header-height`]=S(i[e]),a&&(t[e][`--app-shell-header-offset`]=S(i[e])))})),n?.collapsed&&(e[`--app-shell-header-transform`]=`translateY(calc(var(--app-shell-header-height) * -1))`,r===`fixed`&&(e[`--app-shell-header-offset`]=`0px !important`))}function qa({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,navbar:r,theme:i,mode:a}){let o=r?.width,s=`translateX(calc(var(--app-shell-navbar-width) * -1))`,c=`translateX(var(--app-shell-navbar-width))`;if(r?.breakpoint!==void 0&&!r?.collapsed?.mobile&&(n[r?.breakpoint]=n[r?.breakpoint]||{},n[r?.breakpoint][`--app-shell-navbar-offset`]=`0px`,n[r?.breakpoint][`--app-shell-navbar-width`]=`100%`,a===`static`&&(n[r?.breakpoint][`--app-shell-navbar-grid-width`]=`0px`)),Ha(o)){let t=S(Va(o));e[`--app-shell-navbar-width`]=t,e[`--app-shell-navbar-offset`]=t,a===`static`&&(e[`--app-shell-navbar-grid-width`]=t)}if(Ua(o)&&(o.base!==void 0&&(e[`--app-shell-navbar-width`]=S(o.base),e[`--app-shell-navbar-offset`]=S(o.base),a===`static`&&(e[`--app-shell-navbar-grid-width`]=S(o.base))),me(o).forEach(e=>{e!==`base`&&(t[e]=t[e]||{},t[e][`--app-shell-navbar-width`]=S(o[e]),t[e][`--app-shell-navbar-offset`]=S(o[e]),a===`static`&&(t[e][`--app-shell-navbar-grid-width`]=S(o[e])))})),r?.breakpoint!==void 0&&a===`static`&&(t[r.breakpoint]=t[r.breakpoint]||{},t[r.breakpoint][`--app-shell-navbar-position`]=`sticky`,t[r.breakpoint][`--app-shell-navbar-grid-row`]=`2`,t[r.breakpoint][`--app-shell-navbar-grid-column`]=`1`,t[r.breakpoint][`--app-shell-main-column-start`]=`2`),r?.collapsed?.desktop){let e=r.breakpoint;t[e]=t[e]||{},t[e][`--app-shell-navbar-transform`]=s,t[e][`--app-shell-navbar-transform-rtl`]=c,a===`fixed`?t[e][`--app-shell-navbar-offset`]=`0px !important`:(t[e][`--app-shell-navbar-width`]=`0px`,t[e][`--app-shell-navbar-display`]=`none`,t[e][`--app-shell-main-column-start`]=`1`)}if(r?.collapsed?.mobile){let e=gt(r.breakpoint,i.breakpoints)-.1;n[e]=n[e]||{},n[e][`--app-shell-navbar-width`]=`100%`,n[e][`--app-shell-navbar-offset`]=`0px`,a===`static`&&(n[e][`--app-shell-navbar-grid-width`]=`0px`),n[e][`--app-shell-navbar-transform`]=s,n[e][`--app-shell-navbar-transform-rtl`]=c}}function Ja(e){return Number(e)===0?`0px`:ne(e)}function Ya({padding:e,baseStyles:t,minMediaStyles:n}){Ha(e)&&(t[`--app-shell-padding`]=Ja(Va(e))),Ua(e)&&(e.base&&(t[`--app-shell-padding`]=Ja(e.base)),me(e).forEach(t=>{t!==`base`&&(n[t]=n[t]||{},n[t][`--app-shell-padding`]=Ja(e[t]))}))}function Xa({navbar:e,header:t,footer:n,aside:r,padding:i,theme:a,mode:o}){let s={},c={},l={};o===`static`&&(l[`--app-shell-main-grid-column`]=`1 / -1`,l[`--app-shell-main-grid-row`]=`2`),qa({baseStyles:l,minMediaStyles:s,maxMediaStyles:c,navbar:e,theme:a,mode:o}),Wa({baseStyles:l,minMediaStyles:s,maxMediaStyles:c,aside:r,theme:a,mode:o}),Ka({baseStyles:l,minMediaStyles:s,header:t,mode:o}),Ga({baseStyles:l,minMediaStyles:s,footer:n,mode:o}),Ya({baseStyles:l,minMediaStyles:s,padding:i});let u=Fe(me(s),a.breakpoints).map(e=>({query:`(min-width: ${be(e.px)})`,styles:s[e.value]})),d=Fe(me(c),a.breakpoints).map(e=>({query:`(max-width: ${be(e.px)})`,styles:c[e.value]}));return{baseStyles:l,media:[...u,...d]}}function Za({navbar:e,header:t,aside:n,footer:r,padding:i,mode:o,selector:s}){let c=u(),l=a(),{media:f,baseStyles:p}=Xa({navbar:e,header:t,footer:r,aside:n,padding:i,theme:c,mode:o});return(0,T.jsx)(d,{media:f,styles:p,selector:s||l.cssVariablesSelector})}function Qa({transitionDuration:e,disabled:t}){let[n,r]=(0,w.useState)(!0),i=(0,w.useRef)(-1),a=(0,w.useRef)(-1);return Xt(`resize`,()=>{r(!0),clearTimeout(i.current),i.current=window.setTimeout(()=>(0,w.startTransition)(()=>{r(!1)}),200)}),pe(()=>{r(!0),clearTimeout(a.current),a.current=window.setTimeout(()=>(0,w.startTransition)(()=>{r(!1)}),e||0)},[t,e]),n}var $a={withBorder:!0,padding:0,transitionDuration:200,transitionTimingFunction:`ease`,zIndex:Rt(`app`),mode:`fixed`},eo=_((e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}})),to=t(e=>{let t=ue(`AppShell`,$a,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,navbar:c,withBorder:l,padding:u,transitionDuration:d,transitionTimingFunction:f,header:p,zIndex:m,layout:h,disabled:g,aside:_,footer:v,offsetScrollbars:y=!0,mode:b,mod:x,attributes:ee,id:te,...ne}=t,re=de({name:`AppShell`,classes:Pa,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:ee,vars:s,varsResolver:eo}),S=Qa({disabled:g,transitionDuration:d}),ae=ie(te);return(0,T.jsxs)(Ma,{value:{getStyles:re,withBorder:l,zIndex:m,disabled:g,offsetScrollbars:y,mode:b},children:[(0,T.jsx)(Za,{navbar:c,header:p,aside:_,footer:v,padding:u,mode:b,selector:b===`static`?`#${ae}`:void 0}),(0,T.jsx)(xe,{...re(`root`),id:ae,mod:[{resizing:S,layout:h,disabled:g,mode:b},x],...ne})]})});to.classes=Pa,to.varsResolver=eo,to.displayName=`@mantine/core/AppShell`,to.Navbar=za,to.Header=La,to.Main=Ra,to.Aside=Fa,to.Footer=Ia,to.Section=Ba;var no={group:`m_11def92b`,root:`m_f85678b6`,image:`m_11f8ac07`,placeholder:`m_104cd71f`},ro=(0,w.createContext)({withinGroup:!1}),io=_((e,{spacing:t})=>({group:{"--ag-spacing":ne(t)}})),ao=t(e=>{let t=ue(`AvatarGroup`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,spacing:c,attributes:l,...u}=t,d=de({name:`AvatarGroup`,classes:no,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:l,vars:s,varsResolver:io,rootSelector:`group`});return(0,T.jsx)(ro,{value:{withinGroup:!0},children:(0,T.jsx)(xe,{...d(`group`),...u})})});ao.classes=no,ao.varsResolver=io,ao.displayName=`@mantine/core/AvatarGroup`;function oo(e){return(0,T.jsx)(`svg`,{...e,"data-avatar-placeholder-icon":!0,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,T.jsx)(`path`,{d:`M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}function so(e){let t=0;for(let n=0;ne[0]).slice(0,t).join(``).toUpperCase()}var fo=_((e,{size:t,radius:n,variant:r,gradient:i,color:a,autoContrast:o,name:s,allowedInitialsColors:c})=>{let l=a===`initials`&&typeof s==`string`?lo(s,c):a,u=e.variantColorResolver({color:l||`gray`,theme:e,gradient:i,variant:r||`light`,autoContrast:o});return{root:{"--avatar-size":_e(t,`avatar-size`),"--avatar-radius":n===void 0?void 0:ee(n),"--avatar-bg":l||r?u.background:void 0,"--avatar-color":l||r?u.color:void 0,"--avatar-bd":l||r?u.border:void 0}}}),po=p(e=>{let t=ue(`Avatar`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,src:c,alt:l,radius:u,color:d,gradient:f,imageProps:p,children:m,autoContrast:h,mod:g,name:_,allowedInitialsColors:v,attributes:y,...b}=t,x=(0,w.use)(ro),[ee,te]=(0,w.useState)(!c),ne=de({name:`Avatar`,props:t,classes:no,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:y,vars:s,varsResolver:fo});return(0,w.useEffect)(()=>te(!c),[c]),(0,T.jsx)(xe,{...ne(`root`),mod:[{"within-group":x.withinGroup},g],...b,children:ee||!c?(0,T.jsx)(`span`,{...ne(`placeholder`),title:l,children:m||typeof _==`string`&&uo(_)||(0,T.jsx)(oo,{})}):(0,T.jsx)(`img`,{...p,...ne(`image`),src:c,alt:l,onError:e=>{te(!0),p?.onError?.(e)}})})});po.classes=no,po.varsResolver=fo,po.displayName=`@mantine/core/Avatar`,po.Group=ao;var mo={root:`m_fea6bf1a`,burger:`m_d4fb9cad`},ho=_((e,{color:t,size:n,lineSize:r,transitionDuration:i,transitionTimingFunction:a})=>({root:{"--burger-color":t?s(t,e):void 0,"--burger-size":_e(n,`burger-size`),"--burger-line-size":r?S(r):void 0,"--burger-transition-duration":i===void 0?void 0:`${i}ms`,"--burger-transition-timing-function":a}})),go=t(e=>{let t=ue(`Burger`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,opened:c,children:l,transitionDuration:u,transitionTimingFunction:d,lineSize:f,attributes:p,...m}=t,h=de({name:`Burger`,classes:mo,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:p,vars:s,varsResolver:ho});return(0,T.jsxs)(te,{...h(`root`),...m,children:[(0,T.jsx)(xe,{mod:[`reduce-motion`,{opened:c}],...h(`burger`)}),l]})});go.classes=mo,go.varsResolver=ho,go.displayName=`@mantine/core/Burger`;var[_o,vo]=Ht(`Drawer component was not found in tree`),yo={root:`m_f11b401e`,header:`m_5a7c2c9`,content:`m_b8a05bbd`,inner:`m_31cd769a`},bo=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerBody`,null,e);return(0,T.jsx)(Zt,{...vo().getStyles(`body`,{classNames:t,style:r,styles:i,className:n}),...o})});bo.classes=yo,bo.displayName=`@mantine/core/DrawerBody`;var xo=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerCloseButton`,null,e);return(0,T.jsx)(Yt,{...vo().getStyles(`close`,{classNames:t,style:r,styles:i,className:n}),...o})});xo.classes=yo,xo.displayName=`@mantine/core/DrawerCloseButton`;var So=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,radius:s,__hidden:c,...l}=ue(`DrawerContent`,null,e),u=vo(),d=u.scrollAreaComponent||Gt;return(0,T.jsx)(nn,{...u.getStyles(`content`,{className:n,style:r,styles:i,classNames:t}),innerProps:u.getStyles(`inner`,{className:n,style:r,styles:i,classNames:t}),...l,radius:s||u.radius||0,"data-hidden":c||void 0,children:(0,T.jsx)(d,{style:{height:`calc(100vh - var(--drawer-offset) * 2)`},children:o})})});So.classes=yo,So.displayName=`@mantine/core/DrawerContent`;var Co=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerHeader`,null,e);return(0,T.jsx)(en,{...vo().getStyles(`header`,{classNames:t,style:r,styles:i,className:n}),...o})});Co.classes=yo,Co.displayName=`@mantine/core/DrawerHeader`;var wo=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerOverlay`,null,e);return(0,T.jsx)($t,{...vo().getStyles(`overlay`,{classNames:t,style:r,styles:i,className:n}),...o})});wo.classes=yo,wo.displayName=`@mantine/core/DrawerOverlay`;function To(e){switch(e){case`top`:return`flex-start`;case`bottom`:return`flex-end`;default:return}}function Eo(e){if(e===`top`||e===`bottom`)return`0 0 calc(100% - var(--drawer-offset, 0rem) * 2)`}var Do={top:`slide-down`,bottom:`slide-up`,left:`slide-right`,right:`slide-left`},E={top:`slide-down`,bottom:`slide-up`,right:`slide-right`,left:`slide-left`},Oo={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Rt(`modal`),position:`left`},ko=_((e,{position:t,size:n,offset:r})=>({root:{"--drawer-size":_e(n,`drawer-size`),"--drawer-flex":Eo(t),"--drawer-height":t===`left`||t===`right`?void 0:`var(--drawer-size)`,"--drawer-align":To(t),"--drawer-justify":t===`right`?`flex-end`:void 0,"--drawer-offset":S(r)}})),Ao=t(e=>{let t=ue(`DrawerRoot`,Oo,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,scrollAreaComponent:c,position:l,transitionProps:u,radius:d,attributes:f,...p}=t,{dir:m}=zt(),h=de({name:`Drawer`,classes:yo,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:f,vars:s,varsResolver:ko}),g=(m===`rtl`?E:Do)[l];return(0,T.jsx)(_o,{value:{scrollAreaComponent:c,getStyles:h,radius:d},children:(0,T.jsx)(Qt,{...h(`root`),transitionProps:{transition:g,...u},"data-offset-scrollbars":c===Bt.Autosize||void 0,unstyled:o,...p})})});Ao.classes=yo,Ao.varsResolver=ko,Ao.displayName=`@mantine/core/DrawerRoot`;var jo=(0,w.createContext)(null);function Mo({children:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(Rt(`modal`));return(0,T.jsx)(jo,{value:{stack:t,addModal:(e,t)=>{n(t=>[...new Set([...t,e])]),i(e=>typeof t==`number`&&typeof e==`number`?Math.max(e,t):e)},removeModal:e=>n(t=>t.filter(t=>t!==e)),getZIndex:e=>`calc(${r} + ${t.indexOf(e)} + 1)`,currentId:t[t.length-1],maxZIndex:r},children:e})}Mo.displayName=`@mantine/core/DrawerStack`;var No=t(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=ue(`DrawerTitle`,null,e);return(0,T.jsx)(hn,{...vo().getStyles(`title`,{classNames:t,style:r,styles:i,className:n}),...o})});No.classes=yo,No.displayName=`@mantine/core/DrawerTitle`;var Po={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Rt(`modal`),withOverlay:!0,withCloseButton:!0},Fo=t(e=>{let{title:t,withOverlay:n,overlayProps:r,withCloseButton:i,closeButtonProps:a,children:o,opened:s,stackId:c,zIndex:l,...u}=ue(`Drawer`,Po,e),d=(0,w.use)(jo),f=!!t||i,p=d&&c?{closeOnEscape:d.currentId===c,trapFocus:d.currentId===c,zIndex:d.getZIndex(c)}:{},m=n===!1?!1:c&&d?d.currentId===c:s;return(0,w.useEffect)(()=>{d&&c&&(s?d.addModal(c,l||Rt(`modal`)):d.removeModal(c))},[s,c,l]),(0,T.jsxs)(Ao,{opened:s,zIndex:d&&c?d.getZIndex(c):l,...u,...p,children:[n&&(0,T.jsx)(wo,{visible:m,transitionProps:d&&c?{duration:0}:void 0,...r}),(0,T.jsxs)(So,{__hidden:d&&c&&s?c!==d.currentId:!1,children:[f&&(0,T.jsxs)(Co,{children:[t&&(0,T.jsx)(No,{children:t}),i&&(0,T.jsx)(xo,{...a})]}),(0,T.jsx)(bo,{children:o})]})]})});Fo.classes=yo,Fo.displayName=`@mantine/core/Drawer`,Fo.Root=Ao,Fo.Overlay=wo,Fo.Content=So,Fo.Body=bo,Fo.Header=Co,Fo.Title=No,Fo.CloseButton=xo,Fo.Stack=Mo;var Io={root:`m_dc6f14e2`},Lo=_((e,{size:t})=>({root:{"--kbd-fz":_e(t,`kbd-fz`)}})),Ro=t(e=>{let t=ue(`Kbd`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t;return(0,T.jsx)(xe,{component:`kbd`,...de({name:`Kbd`,classes:Io,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c,vars:s,varsResolver:Lo})(`root`),...l})});Ro.classes=Io,Ro.varsResolver=Lo,Ro.displayName=`@mantine/core/Kbd`;var zo=[];for(let e=0;e<256;++e)zo.push((e+256).toString(16).slice(1));function Bo(e,t=0){return(zo[e[t+0]]+zo[e[t+1]]+zo[e[t+2]]+zo[e[t+3]]+`-`+zo[e[t+4]]+zo[e[t+5]]+`-`+zo[e[t+6]]+zo[e[t+7]]+`-`+zo[e[t+8]]+zo[e[t+9]]+`-`+zo[e[t+10]]+zo[e[t+11]]+zo[e[t+12]]+zo[e[t+13]]+zo[e[t+14]]+zo[e[t+15]]).toLowerCase()}var Vo,Ho=new Uint8Array(16);function Uo(){if(!Vo){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Vo=crypto.getRandomValues.bind(crypto)}return Vo(Ho)}var Wo={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Go(e,t,n){if(Wo.randomUUID&&!t&&!e)return Wo.randomUUID();e||={};let r=e.random??e.rng?.()??Uo();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Bo(r)}var D;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(D||={});var Ko;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Ko||={});var O=D.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),qo=e=>{switch(typeof e){case`undefined`:return O.undefined;case`string`:return O.string;case`number`:return Number.isNaN(e)?O.nan:O.number;case`boolean`:return O.boolean;case`function`:return O.function;case`bigint`:return O.bigint;case`symbol`:return O.symbol;case`object`:return Array.isArray(e)?O.array:e===null?O.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?O.promise:typeof Map<`u`&&e instanceof Map?O.map:typeof Set<`u`&&e instanceof Set?O.set:typeof Date<`u`&&e instanceof Date?O.date:O.object;default:return O.unknown}},k=D.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Jo=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Jo.create=e=>new Jo(e);var Yo=(e,t)=>{let n;switch(e.code){case k.invalid_type:n=e.received===O.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,D.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:n=`Unrecognized key(s) in object: ${D.joinValues(e.keys,`, `)}`;break;case k.invalid_union:n=`Invalid input`;break;case k.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${D.joinValues(e.options)}`;break;case k.invalid_enum_value:n=`Invalid enum value. Expected ${D.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:n=`Invalid function arguments`;break;case k.invalid_return_type:n=`Invalid function return type`;break;case k.invalid_date:n=`Invalid date`;break;case k.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:D.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case k.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case k.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case k.custom:n=`Invalid input`;break;case k.invalid_intersection_types:n=`Intersection results could not be merged`;break;case k.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,D.assertNever(e)}return{message:n}},Xo=Yo;function Zo(){return Xo}var Qo=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function A(e,t){let n=Zo(),r=Qo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Yo?void 0:Yo].filter(e=>!!e)});e.common.issues.push(r)}var $o=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return j;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return j;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},j=Object.freeze({status:`aborted`}),es=e=>({status:`dirty`,value:e}),ts=e=>({status:`valid`,value:e}),ns=e=>e.status===`aborted`,rs=e=>e.status===`dirty`,is=e=>e.status===`valid`,as=e=>typeof Promise<`u`&&e instanceof Promise,M;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(M||={});var os=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ss=(e,t)=>{if(is(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Jo(e.common.issues);return this._error=t,this._error}}};function N(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var cs=class{get description(){return this._def.description}_getType(e){return qo(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:qo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $o,ctx:{common:e.parent.common,data:e.data,parsedType:qo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(as(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)};return ss(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return is(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>is(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)},r=this._parse({data:e,path:n.path,parent:n});return ss(n,await(as(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:k.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new dc({schema:this,typeName:P.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return fc.create(this,this._def)}nullable(){return pc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ks.create(this)}promise(){return uc.create(this,this._def)}or(e){return Ys.create([this,e],this._def)}and(e){return $s.create(this,e,this._def)}transform(e){return new dc({...N(this._def),schema:this,typeName:P.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new mc({...N(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new _c({typeName:P.ZodBranded,type:this,...N(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new hc({...N(this._def),innerType:this,catchValue:t,typeName:P.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return vc.create(this,e)}readonly(){return yc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ls=/^c[^\s-]{8,}$/i,us=/^[0-9a-z]+$/,ds=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ps=/^[a-z0-9_-]{21}$/i,ms=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hs=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_s=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,vs,ys=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ss=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ws=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ts=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,Es=RegExp(`^${Ts}$`);function Ds(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Os(e){return RegExp(`^${Ds(e)}$`)}function ks(e){let t=`${Ts}T${Ds(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function As(e,t){return!((t!==`v4`&&t||!ys.test(e))&&(t!==`v6`&&t||!xs.test(e)))}function js(e,t){if(!ms.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ms(e,t){return!((t!==`v4`&&t||!bs.test(e))&&(t!==`v6`&&t||!Ss.test(e)))}var Ns=class e extends cs{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.string,received:t.parsedType}),j}let t=new $o,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),A(n,{code:k.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:k.invalid_string,...M.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...M.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...M.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...M.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...M.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...M.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...M.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...M.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...M.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...M.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...M.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...M.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...M.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...M.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...M.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...M.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...M.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...M.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...M.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...M.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...M.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...M.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...M.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...M.errToObj(t)})}nonempty(e){return this.min(1,M.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ns({checks:[],typeName:P.ZodString,coerce:e?.coerce??!1,...N(e)});function Ps(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Fs=class e extends cs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.number,received:t.parsedType}),j}let t,n=new $o;for(let r of this._def.checks)r.kind===`int`?D.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),A(t,{code:k.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),A(t,{code:k.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Ps(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),A(t,{code:k.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),A(t,{code:k.not_finite,message:r.message}),n.dirty()):D.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,M.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,M.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,M.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,M.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:M.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:M.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:M.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:M.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:M.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:M.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:M.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&D.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew Fs({checks:[],typeName:P.ZodNumber,coerce:e?.coerce||!1,...N(e)});var Is=class e extends cs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let t,n=new $o;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),A(t,{code:k.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),A(t,{code:k.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):D.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.bigint,received:t.parsedType}),j}gte(e,t){return this.setLimit(`min`,e,!0,M.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,M.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,M.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,M.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:M.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:M.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:M.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Is({checks:[],typeName:P.ZodBigInt,coerce:e?.coerce??!1,...N(e)});var Ls=class extends cs{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.boolean,received:t.parsedType}),j}return ts(e.data)}};Ls.create=e=>new Ls({typeName:P.ZodBoolean,coerce:e?.coerce||!1,...N(e)});var Rs=class e extends cs{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.date,received:t.parsedType}),j}if(Number.isNaN(e.data.getTime()))return A(this._getOrReturnCtx(e),{code:k.invalid_date}),j;let t=new $o,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),A(n,{code:k.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):D.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:M.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:M.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Rs({checks:[],coerce:e?.coerce||!1,typeName:P.ZodDate,...N(e)});var zs=class extends cs{_parse(e){if(this._getType(e)!==O.symbol){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.symbol,received:t.parsedType}),j}return ts(e.data)}};zs.create=e=>new zs({typeName:P.ZodSymbol,...N(e)});var Bs=class extends cs{_parse(e){if(this._getType(e)!==O.undefined){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.undefined,received:t.parsedType}),j}return ts(e.data)}};Bs.create=e=>new Bs({typeName:P.ZodUndefined,...N(e)});var Vs=class extends cs{_parse(e){if(this._getType(e)!==O.null){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.null,received:t.parsedType}),j}return ts(e.data)}};Vs.create=e=>new Vs({typeName:P.ZodNull,...N(e)});var Hs=class extends cs{constructor(){super(...arguments),this._any=!0}_parse(e){return ts(e.data)}};Hs.create=e=>new Hs({typeName:P.ZodAny,...N(e)});var Us=class extends cs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ts(e.data)}};Us.create=e=>new Us({typeName:P.ZodUnknown,...N(e)});var Ws=class extends cs{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.never,received:t.parsedType}),j}};Ws.create=e=>new Ws({typeName:P.ZodNever,...N(e)});var Gs=class extends cs{_parse(e){if(this._getType(e)!==O.undefined){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.void,received:t.parsedType}),j}return ts(e.data)}};Gs.create=e=>new Gs({typeName:P.ZodVoid,...N(e)});var Ks=class e extends cs{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==O.array)return A(t,{code:k.invalid_type,expected:O.array,received:t.parsedType}),j;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(A(t,{code:k.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new os(t,e,t.path,n)))).then(e=>$o.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new os(t,e,t.path,n)));return $o.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:M.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:M.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:M.toString(n)}})}nonempty(e){return this.min(1,e)}};Ks.create=(e,t)=>new Ks({type:e,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...N(t)});function qs(e){if(e instanceof Js){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=fc.create(qs(r))}return new Js({...e._def,shape:()=>t})}return e instanceof Ks?new Ks({...e._def,type:qs(e.element)}):e instanceof fc?fc.create(qs(e.unwrap())):e instanceof pc?pc.create(qs(e.unwrap())):e instanceof ec?ec.create(e.items.map(e=>qs(e))):e}var Js=class e extends cs{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=D.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==O.object){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.object,received:t.parsedType}),j}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ws&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new os(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ws){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(A(n,{code:k.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new os(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>$o.mergeObjectSync(t,e)):$o.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return M.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:M.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of D.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of D.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return qs(this)}partial(t){let n={};for(let e of D.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of D.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof fc;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return sc(D.objectKeys(this.shape))}};Js.create=(e,t)=>new Js({shape:()=>e,unknownKeys:`strip`,catchall:Ws.create(),typeName:P.ZodObject,...N(t)}),Js.strictCreate=(e,t)=>new Js({shape:()=>e,unknownKeys:`strict`,catchall:Ws.create(),typeName:P.ZodObject,...N(t)}),Js.lazycreate=(e,t)=>new Js({shape:e,unknownKeys:`strip`,catchall:Ws.create(),typeName:P.ZodObject,...N(t)});var Ys=class extends cs{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Jo(e.ctx.common.issues));return A(t,{code:k.invalid_union,unionErrors:n}),j}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Jo(e));return A(t,{code:k.invalid_union,unionErrors:i}),j}}get options(){return this._def.options}};Ys.create=(e,t)=>new Ys({options:e,typeName:P.ZodUnion,...N(t)});var Xs=e=>e instanceof ac?Xs(e.schema):e instanceof dc?Xs(e.innerType()):e instanceof oc?[e.value]:e instanceof cc?e.options:e instanceof lc?D.objectValues(e.enum):e instanceof mc?Xs(e._def.innerType):e instanceof Bs?[void 0]:e instanceof Vs?[null]:e instanceof fc?[void 0,...Xs(e.unwrap())]:e instanceof pc?[null,...Xs(e.unwrap())]:e instanceof _c||e instanceof yc?Xs(e.unwrap()):e instanceof hc?Xs(e._def.innerType):[],Zs=class e extends cs{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return A(t,{code:k.invalid_type,expected:O.object,received:t.parsedType}),j;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(A(t,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),j)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Xs(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:P.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...N(r)})}};function Qs(e,t){let n=qo(e),r=qo(t);if(e===t)return{valid:!0,data:e};if(n===O.object&&r===O.object){let n=D.objectKeys(t),r=D.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Qs(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===O.array&&r===O.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if(ns(e)||ns(r))return j;let i=Qs(e.value,r.value);return i.valid?((rs(e)||rs(r))&&t.dirty(),{status:t.value,value:i.data}):(A(n,{code:k.invalid_intersection_types}),j)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};$s.create=(e,t,n)=>new $s({left:e,right:t,typeName:P.ZodIntersection,...N(n)});var ec=class e extends cs{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.array)return A(n,{code:k.invalid_type,expected:O.array,received:n.parsedType}),j;if(n.data.lengththis._def.items.length&&(A(n,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new os(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>$o.mergeArray(t,e)):$o.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ec.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new ec({items:e,typeName:P.ZodTuple,rest:null,...N(t)})};var tc=class e extends cs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return A(n,{code:k.invalid_type,expected:O.object,received:n.parsedType}),j;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new os(n,e,n.path,e)),value:a._parse(new os(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?$o.mergeObjectAsync(t,r):$o.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof cs?new e({keyType:t,valueType:n,typeName:P.ZodRecord,...N(r)}):new e({keyType:Ns.create(),valueType:t,typeName:P.ZodRecord,...N(n)})}},nc=class extends cs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.map)return A(n,{code:k.invalid_type,expected:O.map,received:n.parsedType}),j;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new os(n,e,n.path,[a,`key`])),value:i._parse(new os(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return j;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return j;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};nc.create=(e,t,n)=>new nc({valueType:t,keyType:e,typeName:P.ZodMap,...N(n)});var rc=class e extends cs{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.set)return A(n,{code:k.invalid_type,expected:O.set,received:n.parsedType}),j;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(A(n,{code:k.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return j;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new os(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:M.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:M.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};rc.create=(e,t)=>new rc({valueType:e,minSize:null,maxSize:null,typeName:P.ZodSet,...N(t)});var ic=class e extends cs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return A(t,{code:k.invalid_type,expected:O.function,received:t.parsedType}),j;function n(e,n){return Qo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zo(),Yo].filter(e=>!!e),issueData:{code:k.invalid_arguments,argumentsError:n}})}function r(e,n){return Qo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Zo(),Yo].filter(e=>!!e),issueData:{code:k.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof uc){let e=this;return ts(async function(...t){let o=new Jo([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return ts(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Jo([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Jo([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ec.create(t).rest(Us.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||ec.create([]).rest(Us.create()),returns:n||Us.create(),typeName:P.ZodFunction,...N(r)})}},ac=class extends cs{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ac.create=(e,t)=>new ac({getter:e,typeName:P.ZodLazy,...N(t)});var oc=class extends cs{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return A(t,{received:t.data,code:k.invalid_literal,expected:this._def.value}),j}return{status:`valid`,value:e.data}}get value(){return this._def.value}};oc.create=(e,t)=>new oc({value:e,typeName:P.ZodLiteral,...N(t)});function sc(e,t){return new cc({values:e,typeName:P.ZodEnum,...N(t)})}var cc=class e extends cs{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return A(t,{expected:D.joinValues(n),received:t.parsedType,code:k.invalid_type}),j}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return A(t,{received:t.data,code:k.invalid_enum_value,options:n}),j}return ts(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};cc.create=sc;var lc=class extends cs{_parse(e){let t=D.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==O.string&&n.parsedType!==O.number){let e=D.objectValues(t);return A(n,{expected:D.joinValues(e),received:n.parsedType,code:k.invalid_type}),j}if(this._cache||=new Set(D.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=D.objectValues(t);return A(n,{received:n.data,code:k.invalid_enum_value,options:e}),j}return ts(e.data)}get enum(){return this._def.values}};lc.create=(e,t)=>new lc({values:e,typeName:P.ZodNativeEnum,...N(t)});var uc=class extends cs{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==O.promise&&t.common.async===!1?(A(t,{code:k.invalid_type,expected:O.promise,received:t.parsedType}),j):ts((t.parsedType===O.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};uc.create=(e,t)=>new uc({type:e,typeName:P.ZodPromise,...N(t)});var dc=class extends cs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{A(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return j;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?j:r.status===`dirty`||t.value===`dirty`?es(r.value):r});{if(t.value===`aborted`)return j;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?j:r.status===`dirty`||t.value===`dirty`?es(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?j:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?j:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!is(e))return j;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>is(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):j)}D.assertNever(r)}};dc.create=(e,t,n)=>new dc({schema:e,typeName:P.ZodEffects,effect:t,...N(n)}),dc.createWithPreprocess=(e,t,n)=>new dc({schema:t,effect:{type:`preprocess`,transform:e},typeName:P.ZodEffects,...N(n)});var fc=class extends cs{_parse(e){return this._getType(e)===O.undefined?ts(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};fc.create=(e,t)=>new fc({innerType:e,typeName:P.ZodOptional,...N(t)});var pc=class extends cs{_parse(e){return this._getType(e)===O.null?ts(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pc.create=(e,t)=>new pc({innerType:e,typeName:P.ZodNullable,...N(t)});var mc=class extends cs{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===O.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};mc.create=(e,t)=>new mc({innerType:e,typeName:P.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...N(t)});var hc=class extends cs{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return as(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Jo(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Jo(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};hc.create=(e,t)=>new hc({innerType:e,typeName:P.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...N(t)});var gc=class extends cs{_parse(e){if(this._getType(e)!==O.nan){let t=this._getOrReturnCtx(e);return A(t,{code:k.invalid_type,expected:O.nan,received:t.parsedType}),j}return{status:`valid`,value:e.data}}};gc.create=e=>new gc({typeName:P.ZodNaN,...N(e)});var _c=class extends cs{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},vc=class e extends cs{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?j:e.status===`dirty`?(t.dirty(),es(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?j:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:P.ZodPipeline})}},yc=class extends cs{_parse(e){let t=this._def.innerType._parse(e),n=e=>(is(e)&&(e.value=Object.freeze(e.value)),e);return as(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};yc.create=(e,t)=>new yc({innerType:e,typeName:P.ZodReadonly,...N(t)}),Js.lazycreate;var P;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(P||={});var F=Ns.create,bc=Fs.create;gc.create,Is.create;var xc=Ls.create;Rs.create,zs.create,Bs.create,Vs.create;var Sc=Hs.create,Cc=Us.create;Ws.create,Gs.create;var wc=Ks.create,I=Js.create;Js.strictCreate;var Tc=Ys.create,Ec=Zs.create;$s.create,ec.create;var Dc=tc.create;nc.create,rc.create,ic.create,ac.create;var L=oc.create,Oc=cc.create,kc=lc.create;uc.create,dc.create,fc.create,pc.create,dc.createWithPreprocess,vc.create;var Ac=Ln(),jc=Dc(Sc()).optional();function Mc(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var Nc=I({name:F(),arguments:F()}),Pc=I({id:F(),type:L(`function`),function:Nc,encryptedValue:F().optional(),metadata:jc}),Fc=I({id:F(),role:F(),content:F().optional(),name:F().optional(),encryptedValue:F().optional(),subagentRunId:F().optional(),metadata:jc}),Ic=I({type:L(`text`),text:F()}),Lc=Ec(`type`,[I({type:L(`data`),value:F(),mimeType:F()}),I({type:L(`url`),value:F(),mimeType:F().optional()})]),Rc=I({type:L(`image`),source:Lc,metadata:Cc().optional()}),zc=I({type:L(`audio`),source:Lc,metadata:Cc().optional()}),Bc=I({type:L(`video`),source:Lc,metadata:Cc().optional()}),Vc=I({type:L(`document`),source:Lc,metadata:Cc().optional()}),Hc=I({type:L(`binary`),mimeType:F(),id:F().optional(),url:F().optional(),data:F().optional(),filename:F().optional()}),Uc=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:k.custom,message:`BinaryInputContent requires at least one of id, url, or data.`,path:[`id`]})};Hc.superRefine((e,t)=>{Uc(e,t)});var Wc=Ec(`type`,[Ic,Rc,zc,Bc,Vc,Hc]).superRefine((e,t)=>{e.type===`binary`&&Uc(e,t)}),Gc=Ec(`role`,[Fc.extend({role:L(`developer`),content:F()}),Fc.extend({role:L(`system`),content:F()}),Fc.extend({role:L(`assistant`),content:F().optional(),toolCalls:wc(Pc).optional()}),Fc.extend({role:L(`user`),content:Tc([F(),wc(Wc)])}),I({id:F(),content:F(),role:L(`tool`),toolCallId:F(),error:F().optional(),encryptedValue:F().optional(),subagentRunId:F().optional(),metadata:jc}),I({id:F(),role:L(`activity`),activityType:F(),content:Dc(Sc()),subagentRunId:F().optional(),metadata:jc}),I({id:F(),role:L(`reasoning`),content:F(),encryptedValue:F().optional(),subagentRunId:F().optional(),metadata:jc})]);Tc([L(`developer`),L(`system`),L(`assistant`),L(`user`),L(`tool`),L(`activity`),L(`reasoning`)]);var Kc=I({description:F(),value:F()}),qc=I({name:F(),description:F(),parameters:Sc(),metadata:Dc(Sc()).optional()}),Jc=I({id:F(),reason:F(),message:F().optional(),toolCallId:F().optional(),responseSchema:Dc(Sc()).optional(),expiresAt:F().optional(),metadata:Dc(Sc()).optional(),subagentRunId:F().optional()}),Yc=I({interruptId:F(),status:Oc([`resolved`,`cancelled`]),payload:Sc().optional(),metadata:jc}),Xc=I({threadId:F(),runId:F(),parentRunId:F().optional(),state:Sc().transform(e=>e??void 0),messages:wc(Gc),tools:wc(qc),context:wc(Kc),forwardedProps:Sc(),resume:wc(Yc).optional()}),Zc=Sc(),R=class extends Error{constructor(e){super(e)}},Qc=class extends R{constructor(){super(`Connect not implemented. This method is not supported by the current agent.`)}},$c=I({name:F(),description:F().optional()}),el=I({name:F().optional(),type:F().optional(),description:F().optional(),version:F().optional(),provider:F().optional(),documentationUrl:F().optional(),metadata:Dc(Cc()).optional()}),tl=I({streaming:xc().optional(),websocket:xc().optional(),httpBinary:xc().optional(),pushNotifications:xc().optional(),resumable:xc().optional()}),nl=I({supported:xc().optional(),items:wc(qc).optional(),parallelCalls:xc().optional(),clientProvided:xc().optional()}),rl=I({structuredOutput:xc().optional(),supportedMimeTypes:wc(F()).optional()}),il=I({snapshots:xc().optional(),deltas:xc().optional(),memory:xc().optional(),persistentState:xc().optional()}),al=I({supported:xc().optional(),delegation:xc().optional(),handoffs:xc().optional(),subAgents:wc($c).optional()}),ol=I({supported:xc().optional(),streaming:xc().optional(),encrypted:xc().optional()}),sl=I({image:xc().optional(),audio:xc().optional(),video:xc().optional(),pdf:xc().optional(),file:xc().optional()}),cl=I({image:xc().optional(),audio:xc().optional()}),ll=I({input:sl.optional(),output:cl.optional()}),ul=I({codeExecution:xc().optional(),sandboxed:xc().optional(),maxIterations:bc().optional(),maxExecutionTime:bc().optional()}),dl=I({supported:xc().optional(),approvals:xc().optional(),interventions:xc().optional(),feedback:xc().optional(),interrupts:xc().optional(),approveWithEdits:xc().optional()});I({identity:el.optional(),transport:tl.optional(),tools:nl.optional(),output:rl.optional(),state:il.optional(),multiAgent:al.optional(),reasoning:ol.optional(),multimodal:ll.optional(),execution:ul.optional(),humanInTheLoop:dl.optional(),custom:Dc(Cc()).optional()});var fl=Tc([L(`developer`),L(`system`),L(`assistant`),L(`user`)]),z=function(e){return e.TEXT_MESSAGE_START=`TEXT_MESSAGE_START`,e.TEXT_MESSAGE_CONTENT=`TEXT_MESSAGE_CONTENT`,e.TEXT_MESSAGE_END=`TEXT_MESSAGE_END`,e.TEXT_MESSAGE_CHUNK=`TEXT_MESSAGE_CHUNK`,e.TOOL_CALL_START=`TOOL_CALL_START`,e.TOOL_CALL_ARGS=`TOOL_CALL_ARGS`,e.TOOL_CALL_END=`TOOL_CALL_END`,e.TOOL_CALL_CHUNK=`TOOL_CALL_CHUNK`,e.TOOL_CALL_RESULT=`TOOL_CALL_RESULT`,e.THINKING_START=`THINKING_START`,e.THINKING_END=`THINKING_END`,e.THINKING_TEXT_MESSAGE_START=`THINKING_TEXT_MESSAGE_START`,e.THINKING_TEXT_MESSAGE_CONTENT=`THINKING_TEXT_MESSAGE_CONTENT`,e.THINKING_TEXT_MESSAGE_END=`THINKING_TEXT_MESSAGE_END`,e.STATE_SNAPSHOT=`STATE_SNAPSHOT`,e.STATE_DELTA=`STATE_DELTA`,e.MESSAGES_SNAPSHOT=`MESSAGES_SNAPSHOT`,e.ACTIVITY_SNAPSHOT=`ACTIVITY_SNAPSHOT`,e.ACTIVITY_DELTA=`ACTIVITY_DELTA`,e.RAW=`RAW`,e.CUSTOM=`CUSTOM`,e.RUN_STARTED=`RUN_STARTED`,e.RUN_FINISHED=`RUN_FINISHED`,e.RUN_ERROR=`RUN_ERROR`,e.STEP_STARTED=`STEP_STARTED`,e.STEP_FINISHED=`STEP_FINISHED`,e.REASONING_START=`REASONING_START`,e.REASONING_MESSAGE_START=`REASONING_MESSAGE_START`,e.REASONING_MESSAGE_CONTENT=`REASONING_MESSAGE_CONTENT`,e.REASONING_MESSAGE_END=`REASONING_MESSAGE_END`,e.REASONING_MESSAGE_CHUNK=`REASONING_MESSAGE_CHUNK`,e.REASONING_END=`REASONING_END`,e.REASONING_ENCRYPTED_VALUE=`REASONING_ENCRYPTED_VALUE`,e.SUBAGENT_STARTED=`SUBAGENT_STARTED`,e.SUBAGENT_FINISHED=`SUBAGENT_FINISHED`,e.SUBAGENT_ERROR=`SUBAGENT_ERROR`,e}({}),B=I({type:kc(z),timestamp:bc().optional(),rawEvent:Sc().optional(),metadata:jc}).passthrough(),pl=B.extend({type:L(z.TEXT_MESSAGE_START),messageId:F(),role:fl.default(`assistant`),name:F().optional(),subagentRunId:F().optional()}),ml=B.extend({type:L(z.TEXT_MESSAGE_CONTENT),messageId:F(),delta:F(),subagentRunId:F().optional()}),hl=B.extend({type:L(z.TEXT_MESSAGE_END),messageId:F(),subagentRunId:F().optional()}),gl=B.extend({type:L(z.TEXT_MESSAGE_CHUNK),messageId:F().optional(),role:fl.optional(),delta:F().optional(),name:F().optional(),subagentRunId:F().optional()}),_l=B.extend({type:L(z.THINKING_TEXT_MESSAGE_START)}),vl=ml.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:L(z.THINKING_TEXT_MESSAGE_CONTENT)}),yl=B.extend({type:L(z.THINKING_TEXT_MESSAGE_END)}),bl=B.extend({type:L(z.TOOL_CALL_START),toolCallId:F(),toolCallName:F(),parentMessageId:F().nullable().optional().transform(e=>e??void 0),subagentRunId:F().optional()}),xl=B.extend({type:L(z.TOOL_CALL_ARGS),toolCallId:F(),delta:F(),subagentRunId:F().optional()}),Sl=B.extend({type:L(z.TOOL_CALL_END),toolCallId:F(),subagentRunId:F().optional()}),Cl=B.extend({messageId:F(),type:L(z.TOOL_CALL_RESULT),toolCallId:F(),content:F(),role:L(`tool`).optional(),subagentRunId:F().optional()}),wl=B.extend({type:L(z.TOOL_CALL_CHUNK),toolCallId:F().optional(),toolCallName:F().optional(),parentMessageId:F().nullable().optional().transform(e=>e??void 0),delta:F().optional(),subagentRunId:F().optional()}),Tl=B.extend({type:L(z.THINKING_START),title:F().optional()}),El=B.extend({type:L(z.THINKING_END)}),Dl=B.extend({type:L(z.STATE_SNAPSHOT),snapshot:Zc,subagentRunId:F().optional()}),Ol=B.extend({type:L(z.STATE_DELTA),delta:wc(Sc()),subagentRunId:F().optional()}),kl=B.extend({type:L(z.MESSAGES_SNAPSHOT),messages:wc(Gc)}),Al=B.extend({type:L(z.ACTIVITY_SNAPSHOT),messageId:F(),activityType:F(),content:Dc(Sc()),replace:xc().optional().default(!0),subagentRunId:F().optional()}),jl=B.extend({type:L(z.ACTIVITY_DELTA),messageId:F(),activityType:F(),patch:wc(Sc()),subagentRunId:F().optional()}),Ml=B.extend({type:L(z.RAW),event:Sc(),source:F().optional(),subagentRunId:F().optional()}),Nl=B.extend({type:L(z.CUSTOM),name:F(),value:Sc(),subagentRunId:F().optional()}),Pl=B.extend({type:L(z.RUN_STARTED),threadId:F(),runId:F(),parentRunId:F().optional(),input:Xc.optional()}),Fl=Ec(`type`,[I({type:L(`success`)}).strict(),I({type:L(`interrupt`),interrupts:wc(Jc).min(1)}).strict()]),Il=I({provider:F().optional(),model:F().optional(),inputTokens:bc().int().nonnegative().optional(),outputTokens:bc().int().nonnegative().optional(),totalTokens:bc().int().nonnegative().optional(),reasoningTokens:bc().int().nonnegative().optional(),cachedInputTokens:bc().int().nonnegative().optional()}),Ll=B.extend({type:L(z.RUN_FINISHED),threadId:F(),runId:F(),result:Sc().optional(),outcome:Fl.nullable().optional().transform(e=>e??void 0),usage:wc(Il).optional()}),Rl=B.extend({type:L(z.RUN_ERROR),message:F(),code:F().optional(),usage:wc(Il).optional()}),zl=B.extend({type:L(z.STEP_STARTED),stepName:F(),subagentRunId:F().optional()}),Bl=B.extend({type:L(z.STEP_FINISHED),stepName:F(),subagentRunId:F().optional()}),Vl=Tc([L(`tool-call`),L(`message`)]),Hl=B.extend({type:L(z.REASONING_START),messageId:F(),subagentRunId:F().optional()}),Ul=B.extend({type:L(z.REASONING_MESSAGE_START),messageId:F(),role:L(`reasoning`),subagentRunId:F().optional()}),Wl=B.extend({type:L(z.REASONING_MESSAGE_CONTENT),messageId:F(),delta:F(),subagentRunId:F().optional()}),Gl=B.extend({type:L(z.REASONING_MESSAGE_END),messageId:F(),subagentRunId:F().optional()}),Kl=B.extend({type:L(z.REASONING_MESSAGE_CHUNK),messageId:F().optional(),delta:F().optional(),subagentRunId:F().optional()}),ql=B.extend({type:L(z.REASONING_END),messageId:F(),subagentRunId:F().optional()}),Jl=B.extend({type:L(z.REASONING_ENCRYPTED_VALUE),subtype:Vl,entityId:F(),encryptedValue:F(),subagentRunId:F().optional()}),Yl=B.extend({type:L(z.SUBAGENT_STARTED),subagentRunId:F(),name:F(),description:F().optional(),parentSubagentRunId:F().optional(),parentToolCallId:F().optional(),parentMessageId:F().optional()}),Xl=Ec(`type`,[I({type:L(`success`)}).strict(),I({type:L(`suspended`),interruptIds:wc(F()).optional()}).strict()]),Zl=Ec(`type`,[pl,ml,hl,gl,Tl,El,_l,vl,yl,bl,xl,Sl,wl,Cl,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Ll,Rl,zl,Bl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,B.extend({type:L(z.SUBAGENT_FINISHED),subagentRunId:F(),result:Sc().optional(),outcome:Xl.optional()}),B.extend({type:L(z.SUBAGENT_ERROR),subagentRunId:F(),message:F(),code:F().optional()})]),Ql=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),$l=Object.prototype.hasOwnProperty;function eu(e,t){return $l.call(e,t)}function tu(e){if(Array.isArray(e)){for(var t=Array(e.length),n=0;n=48&&r<=57){t++;continue}return!1}return!0}function iu(e){return e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function au(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function ou(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;tuu,_areEquals:()=>bu,applyOperation:()=>hu,applyPatch:()=>gu,applyReducer:()=>_u,deepClone:()=>du,getValueByPointer:()=>mu,validate:()=>yu,validator:()=>vu}),uu=cu,du=nu,fu={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=mu(n,this.path);r&&=nu(r);var i=hu(n,{op:`remove`,path:this.from}).removed;return hu(n,{op:`add`,path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=mu(n,this.from);return hu(n,{op:`add`,path:this.path,value:nu(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:bu(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},pu={add:function(e,t,n){return ru(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:fu.move,copy:fu.copy,test:fu.test,_get:fu._get};function mu(e,t){if(t==``)return e;var n={op:`_get`,path:t};return hu(e,n),n.value}function hu(e,t,n,r,i,a){if(n===void 0&&(n=!1),r===void 0&&(r=!0),i===void 0&&(i=!0),a===void 0&&(a=0),n&&(typeof n==`function`?n(t,0,e,t.path):vu(t,0)),t.path===``){var o={newDocument:e};if(t.op===`add`)return o.newDocument=t.value,o;if(t.op===`replace`)return o.newDocument=t.value,o.removed=e,o;if(t.op===`move`||t.op===`copy`)return o.newDocument=mu(e,t.from),t.op===`move`&&(o.removed=e),o;if(t.op===`test`){if(o.test=bu(e,t.value),o.test===!1)throw new uu(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o.newDocument=e,o}if(t.op===`remove`)return o.removed=e,o.newDocument=null,o;if(t.op===`_get`)return t.value=e,o;if(n)throw new uu("Operation `op` property is not one of operations defined in RFC-6902",`OPERATION_OP_INVALID`,a,t,e);return o}r||(e=nu(e));var s=(t.path||``).split(`/`),c=e,l=1,u=s.length,d=void 0,f=void 0,p=void 0;for(p=typeof n==`function`?n:vu;;){if(f=s[l],f&&f.indexOf(`~`)!=-1&&(f=au(f)),i&&(f==`__proto__`||f==`prototype`&&l>0&&s[l-1]==`constructor`))throw TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(c[f]===void 0?d=s.slice(0,l).join(`/`):l==u-1&&(d=t.path),d!==void 0&&p(t,0,e,d)),l++,Array.isArray(c)){if(f===`-`)f=c.length;else if(n&&!ru(f))throw new uu(`Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index`,`OPERATION_PATH_ILLEGAL_ARRAY_INDEX`,a,t,e);else ru(f)&&(f=~~f);if(l>=u){if(n&&t.op===`add`&&f>c.length)throw new uu(`The specified index MUST NOT be greater than the number of elements in the array`,`OPERATION_VALUE_OUT_OF_BOUNDS`,a,t,e);var o=pu[t.op].call(t,c,f,e);if(o.test===!1)throw new uu(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}}else if(l>=u){var o=fu[t.op].call(t,c,f,e);if(o.test===!1)throw new uu(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}if(c=c[f],n&&l0)throw new uu('Operation `path` property must start with "/"',`OPERATION_PATH_INVALID`,t,e,n);if((e.op===`move`||e.op===`copy`)&&typeof e.from!=`string`)throw new uu("Operation `from` property is not present (applicable in `move` and `copy` operations)",`OPERATION_FROM_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&e.value===void 0)throw new uu("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&ou(e.value))throw new uu("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED`,t,e,n);if(n){if(e.op==`add`){var i=e.path.split(`/`).length,a=r.split(`/`).length;if(i!==a+1&&i!==a)throw new uu("Cannot perform an `add` operation at the desired path",`OPERATION_PATH_CANNOT_ADD`,t,e,n)}else if(e.op===`replace`||e.op===`remove`||e.op===`_get`){if(e.path!==r)throw new uu(`Cannot perform the operation at a path that does not exist`,`OPERATION_PATH_UNRESOLVABLE`,t,e,n)}else if(e.op===`move`||e.op===`copy`){var o=yu([{op:`_get`,path:e.from,value:void 0}],n);if(o&&o.name===`OPERATION_PATH_UNRESOLVABLE`)throw new uu(`Cannot perform the operation from a path that does not exist`,`OPERATION_FROM_UNRESOLVABLE`,t,e,n)}}}function yu(e,t,n){try{if(!Array.isArray(e))throw new uu(`Patch sequence must be an array`,`SEQUENCE_NOT_AN_ARRAY`);if(t)gu(nu(t),nu(e),n||!0);else{n||=vu;for(var r=0;rMu,generate:()=>Au,observe:()=>ku,unobserve:()=>Ou}),Su=new WeakMap,Cu=function(){function e(e){this.observers=new Map,this.obj=e}return e}(),wu=function(){function e(e,t){this.callback=e,this.observer=t}return e}();function Tu(e){return Su.get(e)}function Eu(e,t){return e.observers.get(t)}function Du(e,t){e.observers.delete(t.callback)}function Ou(e,t){t.unobserve()}function ku(e,t){var n=[],r,i=Tu(e);if(!i)i=new Cu(e),Su.set(e,i);else{var a=Eu(i,t);r=a&&a.observer}if(r)return r;if(r={},i.value=nu(e),t){r.callback=t,r.next=null;var o=function(){Au(r)},s=function(){clearTimeout(r.next),r.next=setTimeout(o)};typeof window<`u`&&(window.addEventListener(`mouseup`,s),window.addEventListener(`keyup`,s),window.addEventListener(`mousedown`,s),window.addEventListener(`keydown`,s),window.addEventListener(`change`,s))}return r.patches=n,r.object=e,r.unobserve=function(){Au(r),clearTimeout(r.next),Du(i,r),typeof window<`u`&&(window.removeEventListener(`mouseup`,s),window.removeEventListener(`keyup`,s),window.removeEventListener(`mousedown`,s),window.removeEventListener(`keydown`,s),window.removeEventListener(`change`,s))},i.observers.set(t,new wu(t,r)),r}function Au(e,t){t===void 0&&(t=!1);var n=Su.get(e.object);ju(n.value,e.object,e.patches,``,t),e.patches.length&&gu(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function ju(e,t,n,r,i){if(t!==e){typeof t.toJSON==`function`&&(t=t.toJSON());for(var a=tu(t),o=tu(e),s=!1,c=o.length-1;c>=0;c--){var l=o[c],u=e[l];if(eu(t,l)&&(t[l]!==void 0||u===void 0||Array.isArray(t)!==!1)){var d=t[l];typeof u==`object`&&u&&typeof d==`object`&&d&&Array.isArray(u)===Array.isArray(d)?ju(u,d,n,r+`/`+iu(l),i):u!==d&&(i&&n.push({op:`test`,path:r+`/`+iu(l),value:nu(u)}),n.push({op:`replace`,path:r+`/`+iu(l),value:nu(d)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:`test`,path:r+`/`+iu(l),value:nu(u)}),n.push({op:`remove`,path:r+`/`+iu(l)}),s=!0):(i&&n.push({op:`test`,path:r,value:e}),n.push({op:`replace`,path:r,value:t}))}if(s||a.length!=o.length)for(var c=0;c0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function zu(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Bu(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Vu?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function Uu(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Ru==`function`?Ru(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Wu(e){return typeof e==`function`}function Gu(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Ku=Gu(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription: `+t.map(function(e,t){return t+1+`) `+e.toString()}).join(` `):``,this.name=`UnsubscriptionError`,this.errors=t}});function qu(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Ju=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a){if(this._parentage=null,Array.isArray(a))try{for(var o=Ru(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this)}var c=this.initialTeardown;if(Wu(c))try{c()}catch(e){i=e instanceof Ku?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=Ru(l),d=u.next();!d.done;d=u.next()){var f=d.value;try{Zu(f)}catch(e){i??=[],e instanceof Ku?i=Bu(Bu([],zu(i)),zu(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new Ku(i)}},e.prototype.add=function(t){if(t&&t!==this){if(this.closed)Zu(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&qu(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&qu(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),Yu=Ju.EMPTY;function Xu(e){return e instanceof Ju||e&&`closed`in e&&Wu(e.remove)&&Wu(e.add)&&Wu(e.unsubscribe)}function Zu(e){Wu(e)?e():e.unsubscribe()}var Qu={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},$u={setTimeout:function(e,t){var n=[...arguments].slice(2),r=$u.delegate;return r?.setTimeout?r.setTimeout.apply(r,Bu([e,t],zu(n))):setTimeout.apply(void 0,Bu([e,t],zu(n)))},clearTimeout:function(e){return($u.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function ed(e){$u.setTimeout(function(){var t=Qu.onUnhandledError;if(t)t(e);else throw e})}function td(){}var nd=(function(){return ad(`C`,void 0,void 0)})();function rd(e){return ad(`E`,void 0,e)}function id(e){return ad(`N`,e,void 0)}function ad(e,t,n){return{kind:e,value:t,error:n}}var od=null;function sd(e){if(Qu.useDeprecatedSynchronousErrorHandling){var t=!od;if(t&&(od={errorThrown:!1,error:null}),e(),t){var n=od,r=n.errorThrown,i=n.error;if(od=null,r)throw i}}else e()}function cd(e){Qu.useDeprecatedSynchronousErrorHandling&&od&&(od.errorThrown=!0,od.error=e)}var ld=function(e){Fu(t,e);function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Xu(t)&&t.add(n)):n.destination=_d,n}return t.create=function(e,t,n){return new pd(e,t,n)},t.prototype.next=function(e){this.isStopped?gd(id(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?gd(rd(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?gd(nd,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Ju),ud=Function.prototype.bind;function dd(e,t){return ud.call(e,t)}var fd=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){md(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){md(e)}else md(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){md(e)}},e}(),pd=function(e){Fu(t,e);function t(t,n,r){var i=e.call(this)||this,a;if(Wu(t)||!t)a={next:t??void 0,error:n??void 0,complete:r??void 0};else{var o;i&&Qu.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&dd(t.next,o),error:t.error&&dd(t.error,o),complete:t.complete&&dd(t.complete,o)}):a=t}return i.destination=new fd(a),i}return t}(ld);function md(e){Qu.useDeprecatedSynchronousErrorHandling?cd(e):ed(e)}function hd(e){throw e}function gd(e,t){var n=Qu.onStoppedNotification;n&&$u.setTimeout(function(){return n(e,t)})}var _d={closed:!0,next:td,error:hd,complete:td},vd=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function yd(e){return e}function bd(){return xd([...arguments])}function xd(e){return e.length===0?yd:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Sd=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=Td(e)?e:new pd(e,t,n);return sd(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=Cd(t),new t(function(t,r){var i=new pd({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[vd]=function(){return this},e.prototype.pipe=function(){return xd([...arguments])(this)},e.prototype.toPromise=function(e){var t=this;return e=Cd(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function Cd(e){return e??Qu.Promise??Promise}function wd(e){return e&&Wu(e.next)&&Wu(e.error)&&Wu(e.complete)}function Td(e){return e&&e instanceof ld||wd(e)&&Xu(e)}function Ed(e){return Wu(e?.lift)}function Dd(e){return function(t){if(Ed(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function Od(e,t,n,r,i){return new kd(e,t,n,r,i)}var kd=function(e){Fu(t,e);function t(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},t}(ld),Ad=Gu(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}}),V=function(e){Fu(t,e);function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t.prototype.lift=function(e){var t=new jd(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Ad},t.prototype.next=function(e){var t=this;sd(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var i=Ru(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;sd(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;sd(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?Yu:(this.currentObservers=null,a.push(e),new Ju(function(){t.currentObservers=null,qu(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new Sd;return e.source=this,e},t.create=function(e,t){return new jd(e,t)},t}(Sd),jd=function(e){Fu(t,e);function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},t.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},t.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},t.prototype._subscribe=function(e){return this.source?.subscribe(e)??Yu},t}(V),Md={now:function(){return(Md.delegate||Date).now()},delegate:void 0},Nd=function(e){Fu(t,e);function t(t,n,r){t===void 0&&(t=1/0),n===void 0&&(n=1/0),r===void 0&&(r=Md);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,o=n._timestampProvider,s=n._windowTime;r||(i.push(t),!a&&i.push(o.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this,r=n._infiniteTimeWindow,i=n._buffer.slice(),a=0;a=0}function jf(e){for(var t=[`topLevel`],n=0,r,i,a,o=function(e){return t.push(e)},s=function(e){return t[t.length-1]=e},c=function(e){r??(r=n,i=t.length,a=e)},l=function(e){e===a&&(r=void 0,i=void 0,a=void 0)},u=function(){return t.pop()},d=function(){return n--},f=function(e){if(`0`<=e&&e<=`9`){o(`number`);return}switch(e){case`"`:o(`string`);return;case`-`:o(`numberNeedsDigit`);return;case`t`:o(`true`);return;case`f`:o(`false`);return;case`n`:o(`null`);return;case`[`:o(`arrayNeedsValue`);return;case`{`:o(`objectNeedsKey`);return}},p=e.length;n`9`)&&(d(),u());break;case`numberNeedsDigit`:s(`number`);break;case`numberNeedsExponent`:s(m===`+`||m===`-`?`numberNeedsDigit`:`number`);break;case`true`:case`false`:case`null`:(m<`a`||m>`z`)&&(d(),u());break;case`arrayNeedsValue`:m===`]`?u():Af(m)||(l(`collectionItem`),s(`arrayNeedsComma`),f(m));break;case`arrayNeedsComma`:m===`]`?u():m===`,`&&(c(`collectionItem`),s(`arrayNeedsValue`));break;case`objectNeedsKey`:m===`}`?u():m===`"`&&(c(`collectionItem`),s(`objectNeedsColon`),o(`string`));break;case`objectNeedsColon`:m===`:`&&s(`objectNeedsValue`);break;case`objectNeedsValue`:Af(m)||(l(`collectionItem`),s(`objectNeedsComma`),f(m));break;case`objectNeedsComma`:m===`}`?u():m===`,`&&(c(`collectionItem`),s(`objectNeedsKey`))}}i!=null&&(t.length=i);for(var h=[r==null?e:e.slice(0,r)],g=function(t){return h.push(t.slice(e.length-e.lastIndexOf(t[0])))},_=t.length-1;_>=0;_--)switch(t[_]){case`string`:h.push(`"`);break;case`numberNeedsDigit`:case`numberNeedsExponent`:h.push(`0`);break;case`true`:g(`true`);break;case`false`:g(`false`);break;case`null`:g(`null`);break;case`arrayNeedsValue`:case`arrayNeedsComma`:h.push(`]`);break;case`objectNeedsKey`:case`objectNeedsColon`:case`objectNeedsValue`:case`objectNeedsComma`:h.push(`}`)}return h.join(``)}function Mf(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let a=e[t++];if(n|=(a&127)<>4,!(i&128)){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(r|=(a&127)<=Nf&&(i+=r/Nf|0,r%=Nf)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?zf(r,i):Rf(r,i)}function Ff(e,t){let n=Rf(e,t),r=n.hi&2147483648;r&&(n=zf(n.lo,n.hi));let i=If(n.lo,n.hi);return r?`-`+i:i}function If(e,t){if({lo:e,hi:t}=Lf(e,t),t<=2097151)return String(Nf*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+Bf(o)+Bf(a)}function Lf(e,t){return{lo:e>>>0,hi:t>>>0}}function Rf(e,t){return{lo:e|0,hi:t|0}}function zf(e,t){return t=~t,e?e=~e+1:t+=1,Rf(e,t)}var Bf=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function Vf(){let e=this.buf[this.pos++];if(!(e&128))return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}var Hf=Uf();function Uf(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||globalThis.Bun||typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||ri||ta.call(e)),qf(i)}return Kf}function Yf(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var Xf;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(Xf||={});var U=class{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?Yf(e):Jf().encodeUtf8Into,this.buffer=$f,this.viewCache=ep,this.pos=0}ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||Zf;for(;e0&&n.set(this.buffer),this.buffer=n}}view(){let e=this.buffer,t=this.viewCache;if(t.byteLength===e.byteLength)return t;let n=new DataView(e.buffer);return this.viewCache=n,n}finish(){let e=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],e}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Qf),this.buffer[this.pos++]=0,this}join(){let e=this.stackPos.pop();if(e===void 0)throw Error(`invalid state, fork stack empty`);let t=this.pos-e-Qf,n=np(t);return n>Qf&&(this.ensureCapacity(n-Qf),this.buffer.copyWithin(e+n,e+Qf,this.pos)),this.pos=e,this.uint32(t),this.pos+=t,this}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.ensureCapacity(e.length),this.buffer.set(e,this.pos),this.pos+=e.length,this}uint32(e){if(ip(e),this.ensureCapacity(5),e<128)return this.buffer[this.pos++]=e,this;for(;e>127;)this.buffer[this.pos++]=e&127|128,e>>>=7;return this.buffer[this.pos++]=e,this}int32(e){if(rp(e),e>=0)return this.uint32(e);this.ensureCapacity(10);for(let t=0;t<9;t++)this.buffer[this.pos++]=e&127|128,e>>=7;return this.buffer[this.pos++]=1,this}bool(e){return this.ensureCapacity(1),this.buffer[this.pos++]=+!!e,this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){typeof e!=`string`&&(e=String(e));let t=e.length;if(t<=tp){this.ensureCapacity(t+1);let n=this.buffer,r=this.pos;n[r++]=t;let i=0;for(;i127)break;n[r++]=t}if(i==t)return this.pos=r,this}this.ensureCapacity(t*3+5);let n=np(t),r=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(e,r.subarray(i+n)),o=np(a);return o!=n&&r.copyWithin(i+o,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(e){return ap(e),this.ensureCapacity(4),this.view().setFloat32(this.pos,e,!0),this.pos+=4,this}double(e){return this.ensureCapacity(8),this.view().setFloat64(this.pos,e,!0),this.pos+=8,this}fixed32(e){return ip(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return rp(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return rp(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=Hf.enc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}fixed64(e){let t=Hf.uEnc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}int64(e){let t=Hf.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=Hf.enc(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return this.writeVarint64(r,i)}uint64(e){let t=Hf.uEnc(e);return this.writeVarint64(t.lo,t.hi)}writeVarint64(e,t){this.ensureCapacity(10);let n=this.buffer,r=this.pos;for(let i=0;i<28;i+=7){let a=e>>>i,o=!(!(a>>>7)&&t==0);if(n[r++]=(o?a|128:a)&255,!o)return this.pos=r,this}let i=e>>>28&15|(t&7)<<4,a=!!(t>>3);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this;for(let e=3;e<31;e+=7){let i=t>>>e,a=!!(i>>>7);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this}return n[r++]=t>>>31&1,this.pos=r,this}},Zf=128,Qf=1,$f=new Uint8Array,ep=new DataView($f.buffer),tp=32;function np(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var W=class{constructor(e,t=Jf().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=Mf,this.uint32=Vf,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.pos,t=this.uint32(),n=this.pos-e;if(n>5||n==5&&this.buf[this.pos-1]>15)throw Error(`illegal tag: varint overflows uint32`);let r=t>>>3,i=t&7;if(r<=0||i>5)throw Error(`illegal tag: field no `+r+` wire type `+i);return[r,i]}skip(e,t,n=100){let r=this.pos;switch(e){case Xf.Varint:for(;this.buf[this.pos++]&128;);break;case Xf.Bit64:this.pos+=4;case Xf.Bit32:this.pos+=4;break;case Xf.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Xf.StartGroup:if(n<=0)throw Error(`maximum recursion depth reached`);for(;;){let[e,r]=this.tag();if(r===Xf.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(r,e,n-1)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return this.varint64(),Hf.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Hf.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let e=this.varint64Lo,t=this.varint64Hi,n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,Hf.dec(e,t)}bool(){let e=this.buf[this.pos];return e<128?(this.pos++,e!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Hf.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Hf.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(e){let t=this.bytes(),n=t.length;if(n<=tp){let r=Array(n);for(let i=0;i127)return this.decodeUtf8(t,e);r[i]=n}return String.fromCharCode.apply(String,r)}return this.decodeUtf8(t,e)}};function rp(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid int32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int32: `+e)}function ip(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid uint32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint32: `+e)}function ap(e){if(typeof e==`string`){let t=e;if(e=Number(e),Number.isNaN(e)&&t!==`NaN`)throw Error(`invalid float32: `+t)}else if(typeof e!=`number`)throw Error(`invalid float32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float32: `+e)}var op=function(e){return e[e.NULL_VALUE=0]=`NULL_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function sp(){return{fields:{}}}var cp={encode(e,t=new U){return Object.entries(e.fields).forEach(([e,n])=>{n!==void 0&&up.encode({key:e,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=sp();for(;n.pos>>3){case 1:{if(e!==10)break;let t=up.decode(n,n.uint32());t.value!==void 0&&(i.fields[t.key]=t.value);continue}}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cp.fromPartial(e??{})},fromPartial(e){let t=sp();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(n!==void 0&&(e[t]=n),e),{}),t},wrap(e){let t=sp();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function lp(){return{key:``,value:void 0}}var up={encode(e,t=new U){return e.key!==``&&t.uint32(10).string(e.key),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=lp();for(;n.pos>>3){case 1:if(e!==10)break;i.key=n.string();continue;case 2:if(e!==18)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return up.fromPartial(e??{})},fromPartial(e){let t=lp();return t.key=e.key??``,t.value=e.value??void 0,t}};function dp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var G={encode(e,t=new U){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&cp.encode(cp.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&pp.encode(pp.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=dp();for(;n.pos>>3){case 1:if(e!==8)break;i.nullValue=n.int32();continue;case 2:if(e!==17)break;i.numberValue=n.double();continue;case 3:if(e!==26)break;i.stringValue=n.string();continue;case 4:if(e!==32)break;i.boolValue=n.bool();continue;case 5:if(e!==42)break;i.structValue=cp.unwrap(cp.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.listValue=pp.unwrap(pp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=dp();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=dp();if(e===null)t.nullValue=op.NULL_VALUE;else if(typeof e==`boolean`)t.boolValue=e;else if(typeof e==`number`)t.numberValue=e;else if(typeof e==`string`)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e==`object`)t.structValue=e;else if(e!==void 0)throw new globalThis.Error(`Unsupported any value type: `+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function fp(){return{values:[]}}var pp={encode(e,t=new U){for(let n of e.values)G.encode(G.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=fp();for(;n.pos>>3){case 1:if(e!==10)break;i.values.push(G.unwrap(G.decode(n,n.uint32())));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return pp.fromPartial(e??{})},fromPartial(e){let t=fp();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=fp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty(`values`)&&globalThis.Array.isArray(e.values)?e.values:e}},mp=function(e){return e[e.ADD=0]=`ADD`,e[e.REMOVE=1]=`REMOVE`,e[e.REPLACE=2]=`REPLACE`,e[e.MOVE=3]=`MOVE`,e[e.COPY=4]=`COPY`,e[e.TEST=5]=`TEST`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function hp(){return{op:0,path:``,from:void 0,value:void 0}}var gp={encode(e,t=new U){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==``&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=hp();for(;n.pos>>3){case 1:if(e!==8)break;i.op=n.int32();continue;case 2:if(e!==18)break;i.path=n.string();continue;case 3:if(e!==26)break;i.from=n.string();continue;case 4:if(e!==34)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gp.fromPartial(e??{})},fromPartial(e){let t=hp();return t.op=e.op??0,t.path=e.path??``,t.from=e.from??void 0,t.value=e.value??void 0,t}};function _p(){return{id:``,type:``,function:void 0,metadata:void 0}}var vp={encode(e,t=new U){return e.id!==``&&t.uint32(10).string(e.id),e.type!==``&&t.uint32(18).string(e.type),e.function!==void 0&&bp.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=_p();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.type=n.string();continue;case 3:if(e!==26)break;i.function=bp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vp.fromPartial(e??{})},fromPartial(e){let t=_p();return t.id=e.id??``,t.type=e.type??``,t.function=e.function!==void 0&&e.function!==null?bp.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function yp(){return{name:``,arguments:``}}var bp={encode(e,t=new U){return e.name!==``&&t.uint32(10).string(e.name),e.arguments!==``&&t.uint32(18).string(e.arguments),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=yp();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.arguments=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bp.fromPartial(e??{})},fromPartial(e){let t=yp();return t.name=e.name??``,t.arguments=e.arguments??``,t}};function xp(){return{value:``,mimeType:``}}var Sp={encode(e,t=new U){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==``&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=xp();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sp.fromPartial(e??{})},fromPartial(e){let t=xp();return t.value=e.value??``,t.mimeType=e.mimeType??``,t}};function Cp(){return{value:``,mimeType:void 0}}var wp={encode(e,t=new U){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Cp();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wp.fromPartial(e??{})},fromPartial(e){let t=Cp();return t.value=e.value??``,t.mimeType=e.mimeType??void 0,t}};function Tp(){return{data:void 0,url:void 0}}var Ep={encode(e,t=new U){return e.data!==void 0&&Sp.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&wp.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Tp();for(;n.pos>>3){case 1:if(e!==10)break;i.data=Sp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.url=wp.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ep.fromPartial(e??{})},fromPartial(e){let t=Tp();return t.data=e.data!==void 0&&e.data!==null?Sp.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?wp.fromPartial(e.url):void 0,t}};function Dp(){return{text:``}}var Op={encode(e,t=new U){return e.text!==``&&t.uint32(10).string(e.text),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Dp();for(;n.pos>>3){case 1:if(e!==10)break;i.text=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Op.fromPartial(e??{})},fromPartial(e){let t=Dp();return t.text=e.text??``,t}};function kp(){return{source:void 0,metadata:void 0}}var Ap={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=kp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ap.fromPartial(e??{})},fromPartial(e){let t=kp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function jp(){return{source:void 0,metadata:void 0}}var Mp={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=jp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Mp.fromPartial(e??{})},fromPartial(e){let t=jp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Np(){return{source:void 0,metadata:void 0}}var Pp={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Np();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Pp.fromPartial(e??{})},fromPartial(e){let t=Np();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Fp(){return{source:void 0,metadata:void 0}}var Ip={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Fp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ip.fromPartial(e??{})},fromPartial(e){let t=Fp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Lp(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Rp={encode(e,t=new U){return e.text!==void 0&&Op.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Ap.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Mp.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Pp.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Ip.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Lp();for(;n.pos>>3){case 1:if(e!==10)break;i.text=Op.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.image=Ap.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.audio=Mp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.video=Pp.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.document=Ip.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Rp.fromPartial(e??{})},fromPartial(e){let t=Lp();return t.text=e.text!==void 0&&e.text!==null?Op.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Ap.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Mp.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Pp.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Ip.fromPartial(e.document):void 0,t}};function zp(){return{id:``,role:``,content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Bp={encode(e,t=new U){e.id!==``&&t.uint32(10).string(e.id),e.role!==``&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let n of e.toolCalls)vp.encode(n,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let n of e.contentParts)Rp.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=zp();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.role=n.string();continue;case 3:if(e!==26)break;i.content=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.toolCalls.push(vp.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.toolCallId=n.string();continue;case 7:if(e!==58)break;i.error=n.string();continue;case 8:if(e!==66)break;i.contentParts.push(Rp.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Bp.fromPartial(e??{})},fromPartial(e){let t=zp();return t.id=e.id??``,t.role=e.role??``,t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(e=>vp.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>Rp.fromPartial(e))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Vp(){return{id:``,reason:``,message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Hp={encode(e,t=new U){return e.id!==``&&t.uint32(10).string(e.id),e.reason!==``&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&G.encode(G.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Vp();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.reason=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.responseSchema=G.unwrap(G.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.expiresAt=n.string();continue;case 7:if(e!==58)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Hp.fromPartial(e??{})},fromPartial(e){let t=Vp();return t.id=e.id??``,t.reason=e.reason??``,t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},Up=function(e){return e[e.TEXT_MESSAGE_START=0]=`TEXT_MESSAGE_START`,e[e.TEXT_MESSAGE_CONTENT=1]=`TEXT_MESSAGE_CONTENT`,e[e.TEXT_MESSAGE_END=2]=`TEXT_MESSAGE_END`,e[e.TOOL_CALL_START=3]=`TOOL_CALL_START`,e[e.TOOL_CALL_ARGS=4]=`TOOL_CALL_ARGS`,e[e.TOOL_CALL_END=5]=`TOOL_CALL_END`,e[e.STATE_SNAPSHOT=6]=`STATE_SNAPSHOT`,e[e.STATE_DELTA=7]=`STATE_DELTA`,e[e.MESSAGES_SNAPSHOT=8]=`MESSAGES_SNAPSHOT`,e[e.RAW=9]=`RAW`,e[e.CUSTOM=10]=`CUSTOM`,e[e.RUN_STARTED=11]=`RUN_STARTED`,e[e.RUN_FINISHED=12]=`RUN_FINISHED`,e[e.RUN_ERROR=13]=`RUN_ERROR`,e[e.STEP_STARTED=14]=`STEP_STARTED`,e[e.STEP_FINISHED=15]=`STEP_FINISHED`,e[e.SUBAGENT_STARTED=16]=`SUBAGENT_STARTED`,e[e.SUBAGENT_FINISHED=17]=`SUBAGENT_FINISHED`,e[e.SUBAGENT_ERROR=18]=`SUBAGENT_ERROR`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function Wp(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var K={encode(e,t=new U){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&G.encode(G.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Wp();for(;n.pos>>3){case 1:if(e!==8)break;i.type=n.int32();continue;case 2:if(e!==16)break;i.timestamp=Lm(n.int64());continue;case 3:if(e!==26)break;i.rawEvent=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return K.fromPartial(e??{})},fromPartial(e){let t=Wp();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function Gp(){return{baseEvent:void 0,messageId:``,role:void 0,name:void 0,subagentRunId:void 0}}var Kp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Gp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Kp.fromPartial(e??{})},fromPartial(e){let t=Gp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function qp(){return{baseEvent:void 0,messageId:``,delta:``,subagentRunId:void 0}}var Jp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=qp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Jp.fromPartial(e??{})},fromPartial(e){let t=qp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Yp(){return{baseEvent:void 0,messageId:``,subagentRunId:void 0}}var Xp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Yp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Xp.fromPartial(e??{})},fromPartial(e){let t=Yp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Zp(){return{baseEvent:void 0,toolCallId:``,toolCallName:``,parentMessageId:void 0,subagentRunId:void 0}}var Qp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.toolCallName!==``&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Zp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Qp.fromPartial(e??{})},fromPartial(e){let t=Zp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.toolCallName=e.toolCallName??``,t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function $p(){return{baseEvent:void 0,toolCallId:``,delta:``,subagentRunId:void 0}}var em={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=$p();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return em.fromPartial(e??{})},fromPartial(e){let t=$p();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function tm(){return{baseEvent:void 0,toolCallId:``,subagentRunId:void 0}}var nm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=tm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return nm.fromPartial(e??{})},fromPartial(e){let t=tm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function rm(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var im={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&G.encode(G.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=rm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.snapshot=G.unwrap(G.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return im.fromPartial(e??{})},fromPartial(e){let t=rm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function am(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var om={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)gp.encode(n,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=am();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.delta.push(gp.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return om.fromPartial(e??{})},fromPartial(e){let t=am();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>gp.fromPartial(e))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function sm(){return{baseEvent:void 0,messages:[]}}var cm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)Bp.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=sm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messages.push(Bp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cm.fromPartial(e??{})},fromPartial(e){let t=sm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>Bp.fromPartial(e))||[],t}};function lm(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var um={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&G.encode(G.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=lm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.event=G.unwrap(G.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.source=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return um.fromPartial(e??{})},fromPartial(e){let t=lm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function dm(){return{baseEvent:void 0,name:``,value:void 0,subagentRunId:void 0}}var fm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==``&&t.uint32(18).string(e.name),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=dm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.name=n.string();continue;case 3:if(e!==26)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return fm.fromPartial(e??{})},fromPartial(e){let t=dm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.name=e.name??``,t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function pm(){return{baseEvent:void 0,threadId:``,runId:``}}var mm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=pm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mm.fromPartial(e??{})},fromPartial(e){let t=pm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t}};function hm(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var gm={encode(e,t=new U){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=hm();for(;n.pos>>3){case 1:if(e!==10)break;i.provider=n.string();continue;case 2:if(e!==18)break;i.model=n.string();continue;case 3:if(e!==24)break;i.inputTokens=Lm(n.int64());continue;case 4:if(e!==32)break;i.outputTokens=Lm(n.int64());continue;case 5:if(e!==40)break;i.totalTokens=Lm(n.int64());continue;case 6:if(e!==48)break;i.reasoningTokens=Lm(n.int64());continue;case 7:if(e!==56)break;i.cachedInputTokens=Lm(n.int64());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gm.fromPartial(e??{})},fromPartial(e){let t=hm();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function _m(){return{baseEvent:void 0,threadId:``,runId:``,result:void 0,outcome:``,interrupts:[],usage:[]}}var vm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.result!==void 0&&G.encode(G.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==``&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)Hp.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)gm.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=_m();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.result=G.unwrap(G.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.outcome=n.string();continue;case 6:if(e!==50)break;i.interrupts.push(Hp.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.usage.push(gm.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vm.fromPartial(e??{})},fromPartial(e){let t=_m();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interrupts=e.interrupts?.map(e=>Hp.fromPartial(e))||[],t.usage=e.usage?.map(e=>gm.fromPartial(e))||[],t}};function ym(){return{baseEvent:void 0,code:void 0,message:``,usage:[]}}var bm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==``&&t.uint32(26).string(e.message);for(let n of e.usage)gm.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=ym();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.code=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.usage.push(gm.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bm.fromPartial(e??{})},fromPartial(e){let t=ym();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??``,t.usage=e.usage?.map(e=>gm.fromPartial(e))||[],t}};function xm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Sm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=xm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sm.fromPartial(e??{})},fromPartial(e){let t=xm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Cm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var wm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Cm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wm.fromPartial(e??{})},fromPartial(e){let t=Cm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Tm(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Em={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Tm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue;case 5:if(e!==42)break;i.name=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Em.fromPartial(e??{})},fromPartial(e){let t=Tm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Dm(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Om={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Dm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.delta=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Om.fromPartial(e??{})},fromPartial(e){let t=Dm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function km(){return{baseEvent:void 0,subagentRunId:``,name:``,description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Am={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.name!==``&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=km();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.name=n.string();continue;case 4:if(e!==34)break;i.description=n.string();continue;case 5:if(e!==42)break;i.parentSubagentRunId=n.string();continue;case 6:if(e!==50)break;i.parentToolCallId=n.string();continue;case 7:if(e!==58)break;i.parentMessageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Am.fromPartial(e??{})},fromPartial(e){let t=km();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.name=e.name??``,t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function jm(){return{baseEvent:void 0,subagentRunId:``,result:void 0,outcome:``,interruptIds:[]}}var Mm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&G.encode(G.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==``&&t.uint32(34).string(e.outcome);for(let n of e.interruptIds)t.uint32(42).string(n);return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=jm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.result=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.outcome=n.string();continue;case 5:if(e!==42)break;i.interruptIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Mm.fromPartial(e??{})},fromPartial(e){let t=jm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interruptIds=e.interruptIds?.map(e=>e)||[],t}};function Nm(){return{baseEvent:void 0,subagentRunId:``,message:``,code:void 0}}var Pm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.message!==``&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Nm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.code=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Pm.fromPartial(e??{})},fromPartial(e){let t=Nm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.message=e.message??``,t.code=e.code??void 0,t}};function Fm(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var Im={encode(e,t=new U){return e.textMessageStart!==void 0&&Kp.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Jp.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Xp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Qp.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&em.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&nm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&im.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&om.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&cm.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&um.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&fm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&mm.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&vm.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&bm.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Sm.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&wm.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Em.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Om.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Am.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Mm.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Pm.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Fm();for(;n.pos>>3){case 1:if(e!==10)break;i.textMessageStart=Kp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.textMessageContent=Jp.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.textMessageEnd=Xp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.toolCallStart=Qp.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.toolCallArgs=em.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.toolCallEnd=nm.decode(n,n.uint32());continue;case 7:if(e!==58)break;i.stateSnapshot=im.decode(n,n.uint32());continue;case 8:if(e!==66)break;i.stateDelta=om.decode(n,n.uint32());continue;case 9:if(e!==74)break;i.messagesSnapshot=cm.decode(n,n.uint32());continue;case 10:if(e!==82)break;i.raw=um.decode(n,n.uint32());continue;case 11:if(e!==90)break;i.custom=fm.decode(n,n.uint32());continue;case 12:if(e!==98)break;i.runStarted=mm.decode(n,n.uint32());continue;case 13:if(e!==106)break;i.runFinished=vm.decode(n,n.uint32());continue;case 14:if(e!==114)break;i.runError=bm.decode(n,n.uint32());continue;case 15:if(e!==122)break;i.stepStarted=Sm.decode(n,n.uint32());continue;case 16:if(e!==130)break;i.stepFinished=wm.decode(n,n.uint32());continue;case 17:if(e!==138)break;i.textMessageChunk=Em.decode(n,n.uint32());continue;case 18:if(e!==146)break;i.toolCallChunk=Om.decode(n,n.uint32());continue;case 19:if(e!==154)break;i.subagentStarted=Am.decode(n,n.uint32());continue;case 20:if(e!==162)break;i.subagentFinished=Mm.decode(n,n.uint32());continue;case 21:if(e!==170)break;i.subagentError=Pm.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Im.fromPartial(e??{})},fromPartial(e){let t=Fm();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Kp.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Jp.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Xp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Qp.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?em.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?nm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?im.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?om.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?cm.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?um.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?fm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?mm.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?vm.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?bm.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Sm.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?wm.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Em.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Om.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Am.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Mm.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Pm.fromPartial(e.subagentError):void 0,t}};function Lm(e){let t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error(`Value is larger than Number.MAX_SAFE_INTEGER`);if(te&&typeof e==`object`?e:void 0,zm=e=>{let t=Rm(e);if(t){if(t.data){let e=t.data;return{type:`data`,value:e.value,mimeType:e.mimeType}}if(t.url){let e=t.url;return{type:`url`,value:e.value,mimeType:e.mimeType}}}},Bm=e=>{let t=Rm(e);if(t){if(t.text)return{type:`text`,text:t.text.text};if(t.image){let e=t.image;return{type:`image`,source:zm(e.source),metadata:e.metadata}}if(t.audio){let e=t.audio;return{type:`audio`,source:zm(e.source),metadata:e.metadata}}if(t.video){let e=t.video;return{type:`video`,source:zm(e.source),metadata:e.metadata}}if(t.document){let e=t.document;return{type:`document`,source:zm(e.source),metadata:e.metadata}}}};function Vm(e){let t=Im.decode(e),n=Object.values(t).find(e=>e!==void 0);if(!n)throw Error(`Invalid event`);if(n.type=Up[n.baseEvent.type],n.timestamp=n.baseEvent.timestamp,n.rawEvent=n.baseEvent.rawEvent,n.baseEvent.metadata!==void 0&&(n.metadata=n.baseEvent.metadata),delete n.baseEvent,n.type===z.MESSAGES_SNAPSHOT)for(let e of n.messages){let t=e;if(t.role===`user`&&Array.isArray(t.contentParts)){let e=t.contentParts.map(e=>Bm(e)).filter(e=>e!==void 0);e.length>0&&(t.content=e)}Array.isArray(t.contentParts)&&t.contentParts.length===0&&(t.contentParts=void 0),t.toolCalls?.length===0&&(t.toolCalls=void 0)}if(n.type===z.RUN_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interrupts)?e.interrupts:[];delete e.interrupts,t===`interrupt`?e.outcome={type:`interrupt`,interrupts:r}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if(n.type===z.SUBAGENT_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interruptIds)?e.interruptIds:[];delete e.interruptIds,t===`suspended`?e.outcome={type:`suspended`,...r.length>0&&{interruptIds:r}}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if((n.type===z.RUN_FINISHED||n.type===z.RUN_ERROR)&&Array.isArray(n.usage)&&n.usage.length===0&&delete n.usage,n.type===z.STATE_DELTA)for(let e of n.delta)e.op=mp[e.op].toLowerCase(),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]});return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),Zl.parse(n)}var Hm;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Hm||={});var Um;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Um||={});var q=Hm.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Wm=e=>{switch(typeof e){case`undefined`:return q.undefined;case`string`:return q.string;case`number`:return Number.isNaN(e)?q.nan:q.number;case`boolean`:return q.boolean;case`function`:return q.function;case`bigint`:return q.bigint;case`symbol`:return q.symbol;case`object`:return Array.isArray(e)?q.array:e===null?q.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?q.promise:typeof Map<`u`&&e instanceof Map?q.map:typeof Set<`u`&&e instanceof Set?q.set:typeof Date<`u`&&e instanceof Date?q.date:q.object;default:return q.unknown}},J=Hm.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Gm=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Gm.create=e=>new Gm(e);var Km=(e,t)=>{let n;switch(e.code){case J.invalid_type:n=e.received===q.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case J.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Hm.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:n=`Unrecognized key(s) in object: ${Hm.joinValues(e.keys,`, `)}`;break;case J.invalid_union:n=`Invalid input`;break;case J.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Hm.joinValues(e.options)}`;break;case J.invalid_enum_value:n=`Invalid enum value. Expected ${Hm.joinValues(e.options)}, received '${e.received}'`;break;case J.invalid_arguments:n=`Invalid function arguments`;break;case J.invalid_return_type:n=`Invalid function return type`;break;case J.invalid_date:n=`Invalid date`;break;case J.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Hm.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case J.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case J.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case J.custom:n=`Invalid input`;break;case J.invalid_intersection_types:n=`Intersection results could not be merged`;break;case J.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case J.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Hm.assertNever(e)}return{message:n}},qm=Km;function Jm(){return qm}var Ym=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Y(e,t){let n=Jm(),r=Ym({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Km?void 0:Km].filter(e=>!!e)});e.common.issues.push(r)}var Xm=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return X;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return X;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},X=Object.freeze({status:`aborted`}),Zm=e=>({status:`dirty`,value:e}),Qm=e=>({status:`valid`,value:e}),$m=e=>e.status===`aborted`,eh=e=>e.status===`dirty`,th=e=>e.status===`valid`,nh=e=>typeof Promise<`u`&&e instanceof Promise,Z;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(Z||={});var rh=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ih=(e,t)=>{if(th(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Gm(e.common.issues);return this._error=t,this._error}}};function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var ah=class{get description(){return this._def.description}_getType(e){return Wm(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Wm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Xm,ctx:{common:e.parent.common,data:e.data,parsedType:Wm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nh(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)};return ih(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return th(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>th(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)},r=this._parse({data:e,path:n.path,parent:n});return ih(n,await(nh(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:J.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new cg({schema:this,typeName:$.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return lg.create(this,this._def)}nullable(){return ug.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Uh.create(this)}promise(){return sg.create(this,this._def)}or(e){return Kh.create([this,e],this._def)}and(e){return Xh.create(this,e,this._def)}transform(e){return new cg({...Q(this._def),schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new dg({...Q(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new mg({typeName:$.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new fg({...Q(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hg.create(this,e)}readonly(){return gg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},oh=/^c[^\s-]{8,}$/i,sh=/^[0-9a-z]+$/,ch=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lh=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,uh=/^[a-z0-9_-]{21}$/i,dh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fh=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ph=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mh=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,hh,gh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_h=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,vh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,yh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sh=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,Ch=RegExp(`^${Sh}$`);function wh(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Th(e){return RegExp(`^${wh(e)}$`)}function Eh(e){let t=`${Sh}T${wh(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Dh(e,t){return!((t!==`v4`&&t||!gh.test(e))&&(t!==`v6`&&t||!vh.test(e)))}function Oh(e,t){if(!dh.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function kh(e,t){return!((t!==`v4`&&t||!_h.test(e))&&(t!==`v6`&&t||!yh.test(e)))}var Ah=class e extends ah{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.string,received:t.parsedType}),X}let t=new Xm,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:J.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...Z.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...Z.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...Z.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...Z.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...Z.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...Z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ah({checks:[],typeName:$.ZodString,coerce:e?.coerce??!1,...Q(e)});function jh(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Mh=class e extends ah{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==q.number){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.number,received:t.parsedType}),X}let t,n=new Xm;for(let r of this._def.checks)r.kind===`int`?Hm.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?jh(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_finite,message:r.message}),n.dirty()):Hm.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:Z.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Z.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Z.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&Hm.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew Mh({checks:[],typeName:$.ZodNumber,coerce:e?.coerce||!1,...Q(e)});var Nh=class e extends ah{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==q.bigint)return this._getInvalidInput(e);let t,n=new Xm;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Hm.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.bigint,received:t.parsedType}),X}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Nh({checks:[],typeName:$.ZodBigInt,coerce:e?.coerce??!1,...Q(e)});var Ph=class extends ah{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.boolean,received:t.parsedType}),X}return Qm(e.data)}};Ph.create=e=>new Ph({typeName:$.ZodBoolean,coerce:e?.coerce||!1,...Q(e)});var Fh=class e extends ah{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.date,received:t.parsedType}),X}if(Number.isNaN(e.data.getTime()))return Y(this._getOrReturnCtx(e),{code:J.invalid_date}),X;let t=new Xm,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Hm.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Fh({checks:[],coerce:e?.coerce||!1,typeName:$.ZodDate,...Q(e)});var Ih=class extends ah{_parse(e){if(this._getType(e)!==q.symbol){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.symbol,received:t.parsedType}),X}return Qm(e.data)}};Ih.create=e=>new Ih({typeName:$.ZodSymbol,...Q(e)});var Lh=class extends ah{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.undefined,received:t.parsedType}),X}return Qm(e.data)}};Lh.create=e=>new Lh({typeName:$.ZodUndefined,...Q(e)});var Rh=class extends ah{_parse(e){if(this._getType(e)!==q.null){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.null,received:t.parsedType}),X}return Qm(e.data)}};Rh.create=e=>new Rh({typeName:$.ZodNull,...Q(e)});var zh=class extends ah{constructor(){super(...arguments),this._any=!0}_parse(e){return Qm(e.data)}};zh.create=e=>new zh({typeName:$.ZodAny,...Q(e)});var Bh=class extends ah{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Qm(e.data)}};Bh.create=e=>new Bh({typeName:$.ZodUnknown,...Q(e)});var Vh=class extends ah{_parse(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.never,received:t.parsedType}),X}};Vh.create=e=>new Vh({typeName:$.ZodNever,...Q(e)});var Hh=class extends ah{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.void,received:t.parsedType}),X}return Qm(e.data)}};Hh.create=e=>new Hh({typeName:$.ZodVoid,...Q(e)});var Uh=class e extends ah{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==q.array)return Y(t,{code:J.invalid_type,expected:q.array,received:t.parsedType}),X;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(Y(t,{code:J.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new rh(t,e,t.path,n)))).then(e=>Xm.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new rh(t,e,t.path,n)));return Xm.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Z.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Z.toString(n)}})}nonempty(e){return this.min(1,e)}};Uh.create=(e,t)=>new Uh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...Q(t)});function Wh(e){if(e instanceof Gh){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=lg.create(Wh(r))}return new Gh({...e._def,shape:()=>t})}return e instanceof Uh?new Uh({...e._def,type:Wh(e.element)}):e instanceof lg?lg.create(Wh(e.unwrap())):e instanceof ug?ug.create(Wh(e.unwrap())):e instanceof Zh?Zh.create(e.items.map(e=>Wh(e))):e}var Gh=class e extends ah{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Hm.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Vh&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new rh(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Vh){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Y(n,{code:J.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new rh(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Xm.mergeObjectSync(t,e)):Xm.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:Z.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of Hm.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of Hm.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Wh(this)}partial(t){let n={};for(let e of Hm.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of Hm.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof lg;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return ig(Hm.objectKeys(this.shape))}};Gh.create=(e,t)=>new Gh({shape:()=>e,unknownKeys:`strip`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)}),Gh.strictCreate=(e,t)=>new Gh({shape:()=>e,unknownKeys:`strict`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)}),Gh.lazycreate=(e,t)=>new Gh({shape:e,unknownKeys:`strip`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)});var Kh=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Gm(e.ctx.common.issues));return Y(t,{code:J.invalid_union,unionErrors:n}),X}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Gm(e));return Y(t,{code:J.invalid_union,unionErrors:i}),X}}get options(){return this._def.options}};Kh.create=(e,t)=>new Kh({options:e,typeName:$.ZodUnion,...Q(t)});var qh=e=>e instanceof ng?qh(e.schema):e instanceof cg?qh(e.innerType()):e instanceof rg?[e.value]:e instanceof ag?e.options:e instanceof og?Hm.objectValues(e.enum):e instanceof dg?qh(e._def.innerType):e instanceof Lh?[void 0]:e instanceof Rh?[null]:e instanceof lg?[void 0,...qh(e.unwrap())]:e instanceof ug?[null,...qh(e.unwrap())]:e instanceof mg||e instanceof gg?qh(e.unwrap()):e instanceof fg?qh(e._def.innerType):[],Jh=class e extends ah{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Y(t,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=qh(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Q(r)})}};function Yh(e,t){let n=Wm(e),r=Wm(t);if(e===t)return{valid:!0,data:e};if(n===q.object&&r===q.object){let n=Hm.objectKeys(t),r=Hm.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Yh(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===q.array&&r===q.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if($m(e)||$m(r))return X;let i=Yh(e.value,r.value);return i.valid?((eh(e)||eh(r))&&t.dirty(),{status:t.value,value:i.data}):(Y(n,{code:J.invalid_intersection_types}),X)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Xh.create=(e,t,n)=>new Xh({left:e,right:t,typeName:$.ZodIntersection,...Q(n)});var Zh=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.array)return Y(n,{code:J.invalid_type,expected:q.array,received:n.parsedType}),X;if(n.data.lengththis._def.items.length&&(Y(n,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new rh(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Xm.mergeArray(t,e)):Xm.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Zh.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Zh({items:e,typeName:$.ZodTuple,rest:null,...Q(t)})};var Qh=class e extends ah{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return Y(n,{code:J.invalid_type,expected:q.object,received:n.parsedType}),X;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new rh(n,e,n.path,e)),value:a._parse(new rh(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Xm.mergeObjectAsync(t,r):Xm.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ah?new e({keyType:t,valueType:n,typeName:$.ZodRecord,...Q(r)}):new e({keyType:Ah.create(),valueType:t,typeName:$.ZodRecord,...Q(n)})}},$h=class extends ah{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.map)return Y(n,{code:J.invalid_type,expected:q.map,received:n.parsedType}),X;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new rh(n,e,n.path,[a,`key`])),value:i._parse(new rh(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};$h.create=(e,t,n)=>new $h({valueType:t,keyType:e,typeName:$.ZodMap,...Q(n)});var eg=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.set)return Y(n,{code:J.invalid_type,expected:q.set,received:n.parsedType}),X;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(Y(n,{code:J.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return X;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new rh(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Z.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};eg.create=(e,t)=>new eg({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet,...Q(t)});var tg=class e extends ah{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return Y(t,{code:J.invalid_type,expected:q.function,received:t.parsedType}),X;function n(e,n){return Ym({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jm(),Km].filter(e=>!!e),issueData:{code:J.invalid_arguments,argumentsError:n}})}function r(e,n){return Ym({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jm(),Km].filter(e=>!!e),issueData:{code:J.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof sg){let e=this;return Qm(async function(...t){let o=new Gm([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return Qm(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Gm([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Gm([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Zh.create(t).rest(Bh.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Zh.create([]).rest(Bh.create()),returns:n||Bh.create(),typeName:$.ZodFunction,...Q(r)})}},ng=class extends ah{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ng.create=(e,t)=>new ng({getter:e,typeName:$.ZodLazy,...Q(t)});var rg=class extends ah{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:J.invalid_literal,expected:this._def.value}),X}return{status:`valid`,value:e.data}}get value(){return this._def.value}};rg.create=(e,t)=>new rg({value:e,typeName:$.ZodLiteral,...Q(t)});function ig(e,t){return new ag({values:e,typeName:$.ZodEnum,...Q(t)})}var ag=class e extends ah{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:Hm.joinValues(n),received:t.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{received:t.data,code:J.invalid_enum_value,options:n}),X}return Qm(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};ag.create=ig;var og=class extends ah{_parse(e){let t=Hm.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){let e=Hm.objectValues(t);return Y(n,{expected:Hm.joinValues(e),received:n.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(Hm.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=Hm.objectValues(t);return Y(n,{received:n.data,code:J.invalid_enum_value,options:e}),X}return Qm(e.data)}get enum(){return this._def.values}};og.create=(e,t)=>new og({values:e,typeName:$.ZodNativeEnum,...Q(t)});var sg=class extends ah{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==q.promise&&t.common.async===!1?(Y(t,{code:J.invalid_type,expected:q.promise,received:t.parsedType}),X):Qm((t.parsedType===q.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};sg.create=(e,t)=>new sg({type:e,typeName:$.ZodPromise,...Q(t)});var cg=class extends ah{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Y(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return X;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Zm(r.value):r});{if(t.value===`aborted`)return X;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Zm(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?X:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?X:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!th(e))return X;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>th(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):X)}Hm.assertNever(r)}};cg.create=(e,t,n)=>new cg({schema:e,typeName:$.ZodEffects,effect:t,...Q(n)}),cg.createWithPreprocess=(e,t,n)=>new cg({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects,...Q(n)});var lg=class extends ah{_parse(e){return this._getType(e)===q.undefined?Qm(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lg.create=(e,t)=>new lg({innerType:e,typeName:$.ZodOptional,...Q(t)});var ug=class extends ah{_parse(e){return this._getType(e)===q.null?Qm(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ug.create=(e,t)=>new ug({innerType:e,typeName:$.ZodNullable,...Q(t)});var dg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};dg.create=(e,t)=>new dg({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Q(t)});var fg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return nh(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Gm(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Gm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fg.create=(e,t)=>new fg({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Q(t)});var pg=class extends ah{_parse(e){if(this._getType(e)!==q.nan){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.nan,received:t.parsedType}),X}return{status:`valid`,value:e.data}}};pg.create=e=>new pg({typeName:$.ZodNaN,...Q(e)});var mg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},hg=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),Zm(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},gg=class extends ah{_parse(e){let t=this._def.innerType._parse(e),n=e=>(th(e)&&(e.value=Object.freeze(e.value)),e);return nh(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};gg.create=(e,t)=>new gg({innerType:e,typeName:$.ZodReadonly,...Q(t)}),Gh.lazycreate;var $;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})($||={});var _g=Ah.create;Mh.create,pg.create,Nh.create;var vg=Ph.create;Fh.create,Ih.create,Lh.create,Rh.create;var yg=zh.create;Bh.create,Vh.create,Hh.create,Uh.create;var bg=Gh.create;Gh.strictCreate,Kh.create;var xg=Jh.create;Xh.create,Zh.create,Qh.create,$h.create,eg.create,tg.create,ng.create;var Sg=rg.create,Cg=ag.create;og.create,sg.create,cg.create,lg.create,ug.create,cg.createWithPreprocess,hg.create;var wg=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Tg=e=>{if(typeof e!=`string`)throw TypeError(`Invalid argument expected string`);let t=e.match(wg);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Eg=e=>e===`*`||e===`x`||e===`X`,Dg=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},Og=(e,t)=>typeof e==typeof t?[e,t]:[String(e),String(t)],kg=(e,t)=>{if(Eg(e)||Eg(t))return 0;let[n,r]=Og(Dg(e),Dg(t));return n>r?1:n{for(let n=0;n{let n=Tg(e),r=Tg(t),i=n.pop(),a=r.pop(),o=Ag(n,r);return o===0?i&&a?Ag(i.split(`.`),a.split(`.`)):i||a?i?-1:1:0:o},Mg=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Ng(){return Go()}function Pg(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&Pg(t);return e}var Fg=524288;function Ig(e,t,n){let r=0,i=[e,t],a=new WeakSet;for(;i.length>0;){let e=i.pop();if(typeof e==`string`){if(r+=e.length,r>n)return!0}else if(typeof e==`object`&&e){if(a.has(e))continue;if(a.add(e),Array.isArray(e))for(let t=0;tn)return!0;i.push(e[o])}}}}return!1}async function Lg(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!Ig(t,n,Fg),c=s?Mg(t):t,l=s?Mg(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(Pg(c),Pg(l));let e=await r(t,c,l);if(e===void 0)continue;let n=!1;if(e.messages!==void 0&&e.messages!==c&&(c=Mg(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=Mg(e.state),d=!0,n=!0),s&&n&&Ig(c,l,Fg)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(o&&e instanceof TypeError){if(a)throw e;console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e)}else a||console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?Mg(c):c}:{},...d?{state:Object.isFrozen(l)?Mg(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function Rg(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function zg(e){if(e instanceof Bg)return e;if(e===!0)return new Bg(Rg(!0))}var Bg=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n==`string`?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function Vg(e){return e.enabled?new Bg(e):void 0}function Hg(e,t,n){if(t){let r=e.find(e=>e.id===t);if(r?.role===`assistant`)return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant — falling back to toolCallId`);let i={id:r?n:t,role:`assistant`,toolCalls:[]};return e.push(i),i}let r={id:n,role:`assistant`,toolCalls:[]};return e.push(r),r}function Ug(e,t){return!e||t.metadata===void 0?!1:(e.metadata=Mc(e.metadata,Mg(t.metadata)),!0)}var Wg=(e,t,n,r,i)=>{let a=zg(i),o=Mg(n.messages),s=Mg(e.state),c={},l=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},u=()=>{let e=Mg(c);return c={},e.messages!==void 0||e.state!==void 0?mf(e):Pd};return t.pipe(wf(async t=>{let i=await Lg(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(l(i),i.stopPropagation===!0?a?.event(`APPLY`,`Event dropped:`,t,{type:t.type,reason:`stopPropagation by subscriber`}):a?.event(`APPLY`,`Event applied:`,t,{type:t.type,subscribers:r.length}),i.stopPropagation===!0)return u();switch(t.type){case z.TEXT_MESSAGE_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:e,role:n=`assistant`,name:r,subagentRunId:i}=t,a=o.find(t=>t.id===e);if(a?.role===`activity`)return console.warn(`TEXT_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and text messages`),u();let s=a;if(!s){let t={id:e,role:n,content:``,...r!==void 0&&{name:r},...i!=null&&{subagentRunId:i}};o.push(t),s=t}let c=Ug(s,t);(!a||c)&&l({messages:o})}return u()}case z.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),u();if(c.role===`activity`)return console.warn(`TEXT_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),u();let d=await Lg(r,o,s,(r,i,a)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,textMessageBuffer:typeof c.content==`string`?c.content:``}));return l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Ug(c,t),l({messages:o})),u()}case z.TEXT_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),u();if(a.role===`activity`)return console.warn(`TEXT_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),u();let c=await Lg(r,o,s,(r,i,o)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,textMessageBuffer:typeof a.content==`string`?a.content:``}));return l(c),c.stopPropagation!==!0&&Ug(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case z.TOOL_CALL_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t,a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(Ug(a,t)||r)&&l({messages:o}),u()}let s=new Set(o.map(e=>e.id)),c=Hg(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let d={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(d),Ug(d,t),l({messages:o})}return u()}case z.TOOL_CALL_ARGS:{let{toolCallId:i,delta:a}=t,c=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!c)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),u();let d=c.toolCalls?.find(e=>e.id===i);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),u();let f=await Lg(r,o,s,(r,i,a)=>{let o=d.function.arguments,s=d.function.name,c={};try{c=jf(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return l(f),f.stopPropagation!==!0&&(d.function.arguments+=a,Ug(d,t),l({messages:o})),u()}case z.TOOL_CALL_END:{let{toolCallId:i}=t,a=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!a)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),u();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),u();let d=await Lg(r,o,s,(r,i,a)=>{let o=c.function.arguments,s=c.function.name,l={};try{l=JSON.parse(o)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallName:s,toolCallArgs:l})});return l(d),d.stopPropagation!==!0&&Ug(c,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),u()}case z.TOOL_CALL_RESULT:{let i=await Lg(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:u,subagentRunId:d}=t,f={id:i,toolCallId:a,role:u||`tool`,content:c,...d!=null&&{subagentRunId:d}};Ug(f,t);let p=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(p===-1)o.push(f);else{let e=p+1;for(;e{t.onNewMessage?.({message:f,messages:o,state:s,agent:n,input:e})})),l({messages:o})}return u()}case z.STATE_SNAPSHOT:{let i=await Lg(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,l({state:s})}return u()}case z.STATE_DELTA:{let i=await Lg(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Nu.applyPatch(s,e,!0,!1).newDocument,l({state:s})}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Failed to apply state patch:\nCurrent state: ${JSON.stringify(s,null,2)}\nPatch operations: ${JSON.stringify(e,null,2)}\nError: ${n}`)}}return u()}case z.MESSAGES_SNAPSHOT:{let i=await Lg(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=n.some(e=>e.role===`activity`),a=n.some(e=>e.role===`reasoning`),s=e=>e.role===`activity`&&!i||e.role===`reasoning`&&!a;o=o.filter(e=>s(e)||r.has(e.id)).map(e=>s(e)?e:r.get(e.id));let c=new Set(o.map(e=>e.id));for(let e of n)c.has(e.id)||o.push(e);l({messages:o})}return u()}case z.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,d=c?.role===`activity`?c:void 0,f=i.replace??!0,p=await Lg(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d,existingMessage:c}));if(l(p),p.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:Mg(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,u;a===-1?(o.push(t),c=t,u=t):d?(f&&(o[a]={...d,activityType:i.activityType,content:Mg(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),u=o[a]):f&&(o[a]=t,c=t,u=t),Ug(u,i),l({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return u()}case z.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return u();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),u();let d=c,f=await Lg(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d}));if(l(f),f.stopPropagation!==!0)try{Ug(d,i)&&l({messages:o});let e=Mg(d.content??{}),t=Nu.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...d,content:Mg(t),activityType:i.activityType},l({messages:o})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`Failed to apply activity patch for '${i.messageId}': ${t}`)}return u()}case z.RAW:return l(await Lg(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.CUSTOM:return l(await Lg(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.RUN_STARTED:{let i=await Lg(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}l({messages:o})}}return u()}case z.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:{event:i,outcome:`success`,result:i.result},c=await Lg(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return l(c),c.stopPropagation!==!0&&(n.pendingInterrupts=a.outcome===`interrupt`?a.interrupts.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}):[]),u()}case z.RUN_ERROR:return l(await Lg(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.STEP_STARTED:return l(await Lg(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.STEP_FINISHED:return l(await Lg(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case z.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case z.THINKING_START:return u();case z.THINKING_END:return u();case z.THINKING_TEXT_MESSAGE_START:return u();case z.THINKING_TEXT_MESSAGE_CONTENT:return u();case z.THINKING_TEXT_MESSAGE_END:return u();case z.REASONING_START:return l(await Lg(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.REASONING_MESSAGE_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e),i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=Ug(i,t);(!r||a)&&l({messages:o})}return u()}case z.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),u();let d=await Lg(r,o,s,(r,i,a)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,reasoningMessageBuffer:typeof c.content==`string`?c.content:``}));return l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Ug(c,t),l({messages:o})),u()}case z.REASONING_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),u();let c=await Lg(r,o,s,(r,i,o)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,reasoningMessageBuffer:typeof a.content==`string`?a.content:``}));return l(c),c.stopPropagation!==!0&&Ug(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case z.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case z.REASONING_END:return l(await Lg(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:d}=t,f=await Lg(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(f),f.stopPropagation!==!0){let e=!1;if(i===`tool-call`){for(let t of o)if(t.role===`assistant`&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===a);if(n){n.encryptedValue=d,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=d,e=!0)}e&&(c.messages=o)}return u()}case z.SUBAGENT_STARTED:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.SUBAGENT_FINISHED:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.SUBAGENT_ERROR:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u()}return t.type,u()}),bf(),r.length>0?Tf({}):e=>e)},Gg=e=>t=>{let n=zg(e),r=new Set,i=new Set,a=new Set,o={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,c=!1,l=!1,u=new Map,d=e=>{let t=u.get(e);return t||(t=new Map,u.set(e,t)),t},f=()=>{for(let e of u.values())if(e.size>0)return!0;return!1},p=new Map,m=new Set,h=!1,g=!1,_=!1,v=()=>{r.clear(),i.clear(),a.clear(),o.message.clear(),o.toolCall.clear(),o.activity.clear(),o.reasoning.clear(),u.clear(),p.clear(),m.clear(),h=!1,g=!1,s=!1,c=!1,_=!0},y=(e,t)=>{let n=e??[];if(Array.isArray(n))for(let e of n){if(!e||typeof e.id!=`string`)continue;if(e.subagentRunId===null)return new R(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?o.reasoning:e.role===`activity`?o.activity:o.message;(t||!n.has(e.id))&&n.set(e.id,{subagentRunId:e.subagentRunId});for(let n of e.toolCalls??[])n&&typeof n.id==`string`&&(t||!o.toolCall.has(n.id))&&o.toolCall.set(n.id,{subagentRunId:e.subagentRunId??void 0})}},b=(e,t,n,r,i)=>{if(t!==void 0&&n&&n.subagentRunId!==t)return new R(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(yf(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),c&&t!==z.RUN_STARTED)return H(()=>new R(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&t!==z.RUN_ERROR&&t!==z.RUN_STARTED)return H(()=>new R(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!l){if(l=!0,t!==z.RUN_STARTED&&t!==z.RUN_ERROR)return H(()=>new R(`First event must be 'RUN_STARTED'`))}else if(t===z.RUN_STARTED){if(_&&!s&&!c)return H(()=>new R(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(s||c)&&v()}if(e.subagentRunId===null)return H(()=>new R(`Cannot send '${t}' with 'subagentRunId: null'. The field is optional — omit it entirely.`));if(t===z.SUBAGENT_STARTED||t===z.SUBAGENT_FINISHED||t===z.SUBAGENT_ERROR){let n=t===z.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===z.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return H(()=>new R(`Cannot send '${t}' with '${r}: null'. The field is optional — omit it entirely.`));let r=e.outcome;if(r!=null&&r.type!==`success`&&r.type!==`suspended`)return H(()=>new R(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return H(()=>new R(`Cannot send '${t}' with 'outcome.interruptIds: null'. The field is optional — omit it entirely.`));if(r&&Array.isArray(r.interruptIds)&&r.interruptIds.some(e=>typeof e!=`string`))return H(()=>new R(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===z.RUN_FINISHED){let t=e.outcome;if(t?.type===`interrupt`&&Array.isArray(t.interrupts)){for(let e of t.interrupts)if(e&&e.subagentRunId===null)return H(()=>new R(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case z.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${n}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let i=o.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return H(()=>r)}return r.add(n),i||o.message.set(n,{subagentRunId:e.subagentRunId}),mf(e)}case z.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${n}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let i=b(t,e.subagentRunId,o.message.get(n),`message`,n);return i?H(()=>i):mf(e)}case z.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${n}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let i=b(t,e.subagentRunId,o.message.get(n),`message`,n);return i?H(()=>i):(r.delete(n),mf(e))}case z.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${n}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let r=e.parentMessageId,a=e.subagentRunId,s;if(r!==void 0){let e=o.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return H(()=>new R(`Cannot send 'TOOL_CALL_START': subagentRunId '${a}' does not match its parent message '${r}' owner '${e.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`));s=e}}let c=o.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return H(()=>e);if(a===void 0&&s&&s.subagentRunId!==c.subagentRunId)return H(()=>new R(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${s.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||o.toolCall.set(n,a===void 0?s??{subagentRunId:void 0}:{subagentRunId:a}),mf(e)}case z.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${n}'. Start a tool call with 'TOOL_CALL_START' first.`));let r=b(t,e.subagentRunId,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):mf(e)}case z.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${n}'. A 'TOOL_CALL_START' event must be sent first.`));let r=b(t,e.subagentRunId,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):(i.delete(n),mf(e))}case z.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return d(n).has(t)?H(()=>new R(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(d(n).set(t,!0),mf(e))}case z.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!d(n).has(t)){let e,r=!1;for(let[i,a]of u)if(i!==n&&a.has(t)){e=i,r=!0;break}return H(r?()=>new R(`Cannot send 'STEP_FINISHED' for step "${t}" attributed to ${n===void 0?`the parent agent`:`subagent '${n}'`}: that step is open under ${e===void 0?`the parent agent`:`subagent '${e}'`}. A step must be finished by whoever started it.`):()=>new R(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return d(n).delete(t),mf(e)}case z.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!o.activity.has(t)||e.replace!==!1)&&o.activity.set(t,{subagentRunId:e.subagentRunId}),mf(e)}case z.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&o.message.set(t,{subagentRunId:e.subagentRunId}),mf(e)}case z.REASONING_START:case z.REASONING_MESSAGE_START:{let n=e.messageId,r=o.reasoning.get(n);if(r){let i=b(t,e.subagentRunId,r,`reasoning message`,n);if(i)return H(()=>i)}return a.add(n),r||o.reasoning.set(n,{subagentRunId:e.subagentRunId}),mf(e)}case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:{let n=e.messageId,r=b(t,e.subagentRunId,o.reasoning.get(n),`reasoning message`,n);return r?H(()=>r):(t===z.REASONING_END&&a.delete(n),mf(e))}case z.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?o.toolCall.get(n):r===`message`?o.message.get(n)??o.reasoning.get(n):o.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,s=b(t,e.subagentRunId,i,a,n);return s?H(()=>s):mf(e)}case z.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,o.activity.get(n),`activity`,n);return r?H(()=>r):mf(e)}case z.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return p.has(t)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):m.has(t)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!p.has(n)&&!m.has(n)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(p.set(t,!0),mf(e))}case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return H(()=>new R(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===z.SUBAGENT_ERROR&&typeof e.message!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return p.has(n)?(p.delete(n),m.add(n),mf(e)):H(()=>new R(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case z.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return H(()=>t)}return mf(e);case z.RUN_STARTED:_=!0;{let t=y((e.input??{}).messages,!1);if(t)return H(()=>t)}return mf(e);case z.RUN_FINISHED:if(f()){let e=[];for(let[t,n]of u)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(p.size>0){let e=Array.from(p.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return s=!0,mf(e);case z.RUN_ERROR:return c=!0,mf(e);case z.CUSTOM:return mf(e);case z.THINKING_TEXT_MESSAGE_START:return h?g?H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.`)):(g=!0,mf(e)):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first.`));case z.THINKING_TEXT_MESSAGE_CONTENT:return g?mf(e):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first.`));case z.THINKING_TEXT_MESSAGE_END:return g?(g=!1,mf(e)):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first.`));case z.THINKING_START:return h?H(()=>new R(`Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.`)):(h=!0,mf(e));case z.THINKING_END:return h?(h=!1,mf(e)):H(()=>new R(`Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first.`));default:return mf(e)}}))},Kg=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),qg=e=>xf(()=>pf(e())).pipe(Df(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return pf(e.text()).pipe(yf(n=>{let r=n;if(t.includes(`application/json`))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${typeof r==`string`?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,H(()=>i)}))}let t={type:Kg.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Sd(e=>(e.next(t),(async()=>{try{for(;;){let{done:t,value:r}=await n.read();if(t)break;let i={type:Kg.DATA,data:r};e.next(i)}e.complete()}catch(t){e.error(t)}})(),()=>{n.cancel().catch(e=>{if(e?.name!==`AbortError`)throw e})})):H(()=>Error(`Failed to getReader() from response`))})),Jg=(e,t)=>{let n=zg(t),r=new V,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==Kg.HEADERS&&e.type===Kg.DATA&&e.data){let t=i.decode(e.data,{stream:!0});a+=t;let n=a.split(/\n\n/);a=n.pop()||``;for(let e of n)o(e)}},error:e=>r.error(e),complete:()=>{a&&(a+=i.decode(),o(a)),r.complete()}});function o(e){let t=e.split(` `),i=[];for(let e of t)e.startsWith(`data:`)&&i.push(e.slice(5).replace(/^ /,``));if(i.length>0)try{let e=i.join(` `),t=JSON.parse(e);n?.event(`SSE`,`Event received:`,t,{type:t.type}),r.next(t)}catch(e){r.error(e)}}return r.asObservable()},Yg=e=>{let t=new V,n=new Uint8Array;e.subscribe({next:e=>{if(e.type!==Kg.HEADERS&&e.type===Kg.DATA&&e.data){let t=new Uint8Array(n.length+e.data.length);t.set(n,0),t.set(e.data,n.length),n=t,r()}},error:e=>t.error(e),complete:()=>{if(n.length>0)try{r()}catch{console.warn(`Incomplete or invalid protocol buffer data at stream end`)}t.complete()}});function r(){for(;n.length>=4;){let e=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length{let n=zg(t),r=new V,i=new Nd,a=!1;return e.subscribe({next:e=>{if(i.next(e),e.type===Kg.HEADERS&&!a){a=!0;let t=e.headers.get(`content-type`);n?.lifecycle(`HTTP`,`Stream format detected:`,{contentType:t,parser:t===`application/vnd.ag-ui.event+proto`?`protobuf`:`sse`}),t===`application/vnd.ag-ui.event+proto`?Yg(i).subscribe({next:e=>r.next(e),error:e=>r.error(e),complete:()=>r.complete()}):Jg(i,n).subscribe({next:e=>{try{let t=Zl.parse(e);n?.event(`HTTP`,`Event validated:`,t,{type:t.type,valid:!0}),r.next(t)}catch(t){n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),r.error(t)}},error:e=>{if(e?.name===`AbortError`){r.next({type:z.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),r.complete();return}return r.error(e)},complete:()=>r.complete()})}else a||r.error(Error(`No headers event received before data events`))},error:e=>{i.error(e),r.error(e)},complete:()=>{i.complete()}}),r.asObservable()},Zg=Cg([`TextMessageStart`,`TextMessageContent`,`TextMessageEnd`,`ActionExecutionStart`,`ActionExecutionArgs`,`ActionExecutionEnd`,`ActionExecutionResult`,`AgentStateMessage`,`MetaEvent`,`RunStarted`,`RunFinished`,`RunError`,`NodeStarted`,`NodeFinished`]),Qg=Cg([`LangGraphInterruptEvent`,`PredictState`,`Exit`]);xg(`type`,[bg({type:Sg(Zg.enum.TextMessageStart),messageId:_g(),parentMessageId:_g().optional(),role:_g().optional()}),bg({type:Sg(Zg.enum.TextMessageContent),messageId:_g(),content:_g()}),bg({type:Sg(Zg.enum.TextMessageEnd),messageId:_g()}),bg({type:Sg(Zg.enum.ActionExecutionStart),actionExecutionId:_g(),actionName:_g(),parentMessageId:_g().optional()}),bg({type:Sg(Zg.enum.ActionExecutionArgs),actionExecutionId:_g(),args:_g()}),bg({type:Sg(Zg.enum.ActionExecutionEnd),actionExecutionId:_g()}),bg({type:Sg(Zg.enum.ActionExecutionResult),actionName:_g(),actionExecutionId:_g(),result:_g()}),bg({type:Sg(Zg.enum.AgentStateMessage),threadId:_g(),agentName:_g(),nodeName:_g(),runId:_g(),active:vg(),role:_g(),state:_g(),running:vg()}),bg({type:Sg(Zg.enum.MetaEvent),name:Qg,value:yg()}),bg({type:Sg(Zg.enum.RunError),message:_g(),code:_g().optional()})]),bg({id:_g(),role:_g(),content:_g(),parentMessageId:_g().optional()}),bg({id:_g(),name:_g(),arguments:yg(),parentMessageId:_g().optional()}),bg({id:_g(),result:yg(),actionExecutionId:_g(),actionName:_g()});var $g=e=>{if(typeof e==`string`)return e;if(!Array.isArray(e))return;let t=e.filter(e=>e.type===`text`).map(e=>e.text).filter(e=>e.length>0);if(t.length!==0)return t.join(` -`)},e_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(yf(r=>{switch(r.type){case z.TEXT_MESSAGE_START:{let e=r;return[{type:Zg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case z.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Zg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case z.TEXT_MESSAGE_END:{let e=r;return[{type:Zg.enum.TextMessageEnd,messageId:e.messageId}]}case z.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:Zg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case z.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(jf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Zg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case z.TOOL_CALL_END:{let e=r;return[{type:Zg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case z.TOOL_CALL_RESULT:{let e=r;return[{type:Zg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case z.RAW:return[];case z.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Zg.enum.MetaEvent,name:e.name,value:e.value}]}case z.STATE_SNAPSHOT:return f(r.snapshot),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case z.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case z.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case z.RUN_STARTED:return[];case z.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:t_(c)}:{}}),active:!1}];case z.RUN_ERROR:{let e=r;return[{type:Zg.enum.RunError,message:e.message,code:e.code}]}case z.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case z.STEP_FINISHED:return u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function t_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=$g(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var n_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,r_=e=>e===`tool`?`toolCallId`:`messageId`,i_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},a_=e=>t=>{let n=zg(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:z.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:z.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:z.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&n_(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${r_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(yf(e=>{switch(e.type){case z.TEXT_MESSAGE_START:case z.TEXT_MESSAGE_CONTENT:case z.TEXT_MESSAGE_END:case z.TOOL_CALL_START:case z.TOOL_CALL_ARGS:case z.TOOL_CALL_END:case z.TOOL_CALL_RESULT:case z.STATE_SNAPSHOT:case z.STATE_DELTA:case z.CUSTOM:case z.STEP_STARTED:case z.STEP_FINISHED:case z.THINKING_START:case z.THINKING_END:case z.THINKING_TEXT_MESSAGE_START:case z.THINKING_TEXT_MESSAGE_CONTENT:case z.THINKING_TEXT_MESSAGE_END:case z.REASONING_START:case z.REASONING_MESSAGE_START:case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:return[...i(e.subagentRunId??void 0),e];case z.RUN_STARTED:case z.RUN_FINISHED:case z.RUN_ERROR:case z.MESSAGES_SNAPSHOT:return[...a(),e];case z.RAW:case z.ACTIVITY_SNAPSHOT:case z.ACTIVITY_DELTA:case z.REASONING_ENCRYPTED_VALUE:case z.SUBAGENT_STARTED:return[e];case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case z.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=i_({type:z.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=i_({type:z.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=i_({type:z.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Ef(()=>{a()}))};function o_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var s_=class{runNext(e,t){return t.run(e).pipe(a_(!1))}runNextWithState(e,t){let n=Mg(e.messages||[]),r=Mg(e.state||{}),i=new Nd;return Wg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(wf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Mg(n),state:Mg(r)})))}},c_=class extends s_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function l_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var u_=class extends s_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(l_)};return this.runNext(i,t)}},d_=`THINKING_START`,f_=`THINKING_END`,p_=`THINKING_TEXT_MESSAGE_START`,m_=`THINKING_TEXT_MESSAGE_CONTENT`,h_=`THINKING_TEXT_MESSAGE_END`,g_=class extends s_{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(_f(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case d_:{this.currentReasoningId=Ng();let{title:t,...n}=e;return this.warnAboutTransformation(d_,z.REASONING_START),{...n,type:z.REASONING_START,messageId:this.currentReasoningId}}case p_:return this.currentMessageId=Ng(),this.warnAboutTransformation(p_,z.REASONING_MESSAGE_START),{...e,type:z.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case m_:{let{delta:t,...n}=e;return this.warnAboutTransformation(m_,z.REASONING_MESSAGE_CONTENT),{...n,type:z.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ng(),delta:t}}case h_:{let t=this.currentMessageId??Ng();return this.warnAboutTransformation(h_,z.REASONING_MESSAGE_END),{...e,type:z.REASONING_MESSAGE_END,messageId:t}}case f_:{let t=this.currentReasoningId??Ng();return this.warnAboutTransformation(f_,z.REASONING_END),{...e,type:z.REASONING_END,messageId:t}}default:return e}}};function __(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function v_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function y_(e){let t=__(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e}function b_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>v_(e)?y_(e):e);return{...e,content:n}}var x_=class extends s_{run(e,t){let n={...e,messages:e.messages.map(b_)};return this.runNext(n,t)}},S_=`SUBAGENT_STARTED`,C_=`SUBAGENT_FINISHED`,w_=`SUBAGENT_ERROR`;function T_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function E_(e){return e.map(e=>T_(e))}var D_=class extends s_{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>T_(e))};return this.runNext(n,t).pipe(kf(e=>{let t=e.type;(t===S_||t===C_||t===w_)&&this.warnDroppedLifecycleEvent(t)}),Sf(e=>{let t=e.type;return t!==S_&&t!==C_&&t!==w_}),_f(e=>{let t=T_(e);if(t.type===z.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:E_(e.messages)}}if(t.type===z.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>T_(e))}}}if(t.type===z.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:E_(e.input.messages)}}}return t}))}},O_=`0.0.59`,k_=class{get maxVersion(){return O_}get debug(){return this._debug}set debug(e){this._debug=Rg(e),this._debugLogger=Vg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Vg(Rg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Mg(r??[]),this.state=Mg(i??{}),this._debug=Rg(a),this._debugLogger=Vg(this._debug),jg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new u_),jg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new g_),jg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new x_),jg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new D_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new c_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ef(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)));let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>xf(()=>this.connect(n)),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.isRunning=!1,e instanceof Qc?Pd:this.onError(n,e,a))),Ef(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)),{defaultValue:void 0});let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,n){return Wg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(kf(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Mg(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Mg(e?.tools??[]),context:Mg(e?.context??[]),forwardedProps:Mg(e?.forwardedProps??{}),state:Mg(this.state),messages:n,...e?.resume===void 0?{}:{resume:Mg(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new R(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(o_(e))throw new R(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return pf(Lg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(_f(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Mg(this.messages),e.state=Mg(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Mg(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=Mg(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Mg(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(a_(this.debugLogger),Gg(this.debugLogger),e_(this.threadId,t.runId,this.agentId),e=>e.pipe(_f(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function A_(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var j_=class extends k_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(A_(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=Mg(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Xg(qg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Mg(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},M_=class extends Fe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:it(t,n.data),hasPreviousPage:ot(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},N_=class extends nt{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new ct({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=P_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Ge.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>St(t,e))}findAll(e={}){return this.getAll().filter(t=>St(e,t))}notify(e){Ge.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Ge.batch(()=>Promise.all(e.map(e=>e.continue().catch(bt))))}};function P_(e){return e.options.scope?.id}var F_=class extends nt{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Le(r,t),a=this.get(i);return a||(a=new Gt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Ge.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ye(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ye(e,t)):t}notify(e){Ge.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ge.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ge.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},I_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new F_,this.#t=e.mutationCache||new N_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Ze.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ut.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qe(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=mt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Ge.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Ge.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Ge.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Ge.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(bt).catch(bt)}invalidateQueries(e,t={}){return Ge.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ge.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(bt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(bt)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(qe(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bt).catch(bt)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bt).catch(bt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ut.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(yn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{wt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(yn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{wt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Le(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===$e&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function L_(e,t){return Ve(e,M_,t)}var R_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M212.62,75.17A63.7,63.7,0,0,0,206.39,26,12,12,0,0,0,196,20a63.71,63.71,0,0,0-50,24H126A63.71,63.71,0,0,0,76,20a12,12,0,0,0-10.39,6,63.7,63.7,0,0,0-6.23,49.17A61.5,61.5,0,0,0,52,104v8a60.1,60.1,0,0,0,45.76,58.28A43.66,43.66,0,0,0,92,192v4H76a20,20,0,0,1-20-20,44.05,44.05,0,0,0-44-44,12,12,0,0,0,0,24,20,20,0,0,1,20,20,44.05,44.05,0,0,0,44,44H92v12a12,12,0,0,0,24,0V192a20,20,0,0,1,40,0v40a12,12,0,0,0,24,0V192a43.66,43.66,0,0,0-5.76-21.72A60.1,60.1,0,0,0,220,112v-8A61.5,61.5,0,0,0,212.62,75.17ZM196,112a36,36,0,0,1-36,36H112a36,36,0,0,1-36-36v-8a37.87,37.87,0,0,1,6.13-20.12,11.65,11.65,0,0,0,1.58-11.49,39.9,39.9,0,0,1-.4-27.72,39.87,39.87,0,0,1,26.41,17.8A12,12,0,0,0,119.82,68h32.35a12,12,0,0,0,10.11-5.53,39.84,39.84,0,0,1,26.41-17.8,39.9,39.9,0,0,1-.4,27.72,12,12,0,0,0,1.61,11.53A37.85,37.85,0,0,1,196,104Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M208,104v8a48,48,0,0,1-48,48H136a32,32,0,0,1,32,32v40H104V192a32,32,0,0,1,32-32H112a48,48,0,0,1-48-48v-8a49.28,49.28,0,0,1,8.51-27.3A51.92,51.92,0,0,1,76,32a52,52,0,0,1,43.83,24h32.34A52,52,0,0,1,196,32a51.92,51.92,0,0,1,3.49,44.7A49.28,49.28,0,0,1,208,104Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M208.3,75.68A59.74,59.74,0,0,0,202.93,28,8,8,0,0,0,196,24a59.75,59.75,0,0,0-48,24H124A59.75,59.75,0,0,0,76,24a8,8,0,0,0-6.93,4,59.78,59.78,0,0,0-5.38,47.68A58.14,58.14,0,0,0,56,104v8a56.06,56.06,0,0,0,48.44,55.47A39.8,39.8,0,0,0,96,192v8H72a24,24,0,0,1-24-24A40,40,0,0,0,8,136a8,8,0,0,0,0,16,24,24,0,0,1,24,24,40,40,0,0,0,40,40H96v16a8,8,0,0,0,16,0V192a24,24,0,0,1,48,0v40a8,8,0,0,0,16,0V192a39.8,39.8,0,0,0-8.44-24.53A56.06,56.06,0,0,0,216,112v-8A58,58,0,0,0,208.3,75.68ZM200,112a40,40,0,0,1-40,40H112a40,40,0,0,1-40-40v-8a41.74,41.74,0,0,1,6.9-22.48A8,8,0,0,0,80,73.83a43.81,43.81,0,0,1,.79-33.58,43.88,43.88,0,0,1,32.32,20.06A8,8,0,0,0,119.82,64h32.35a8,8,0,0,0,6.74-3.69,43.87,43.87,0,0,1,32.32-20.06A43.81,43.81,0,0,1,192,73.83a8.09,8.09,0,0,0,1,7.65A41.76,41.76,0,0,1,200,104Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M216,104v8a56.06,56.06,0,0,1-48.44,55.47A39.8,39.8,0,0,1,176,192v40a8,8,0,0,1-8,8H104a8,8,0,0,1-8-8V216H72a40,40,0,0,1-40-40A24,24,0,0,0,8,152a8,8,0,0,1,0-16,40,40,0,0,1,40,40,24,24,0,0,0,24,24H96v-8a39.8,39.8,0,0,1,8.44-24.53A56.06,56.06,0,0,1,56,112v-8a58.14,58.14,0,0,1,7.69-28.32A59.78,59.78,0,0,1,69.07,28,8,8,0,0,1,76,24a59.75,59.75,0,0,1,48,24h24a59.75,59.75,0,0,1,48-24,8,8,0,0,1,6.93,4,59.74,59.74,0,0,1,5.37,47.68A58,58,0,0,1,216,104Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M206.13,75.92A57.79,57.79,0,0,0,201.2,29a6,6,0,0,0-5.2-3,57.77,57.77,0,0,0-47,24H123A57.77,57.77,0,0,0,76,26a6,6,0,0,0-5.2,3,57.79,57.79,0,0,0-4.93,46.92A55.88,55.88,0,0,0,58,104v8a54.06,54.06,0,0,0,50.45,53.87A37.85,37.85,0,0,0,98,192v10H72a26,26,0,0,1-26-26A38,38,0,0,0,8,138a6,6,0,0,0,0,12,26,26,0,0,1,26,26,38,38,0,0,0,38,38H98v18a6,6,0,0,0,12,0V192a26,26,0,0,1,52,0v40a6,6,0,0,0,12,0V192a37.85,37.85,0,0,0-10.45-26.13A54.06,54.06,0,0,0,214,112v-8A55.88,55.88,0,0,0,206.13,75.92ZM202,112a42,42,0,0,1-42,42H112a42,42,0,0,1-42-42v-8a43.86,43.86,0,0,1,7.3-23.69,6,6,0,0,0,.81-5.76,45.85,45.85,0,0,1,1.43-36.42,45.85,45.85,0,0,1,35.23,21.1A6,6,0,0,0,119.83,62h32.34a6,6,0,0,0,5.06-2.76,45.83,45.83,0,0,1,35.23-21.11,45.85,45.85,0,0,1,1.43,36.42,6,6,0,0,0,.79,5.74A43.78,43.78,0,0,1,202,104Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M208.31,75.68A59.78,59.78,0,0,0,202.93,28,8,8,0,0,0,196,24a59.75,59.75,0,0,0-48,24H124A59.75,59.75,0,0,0,76,24a8,8,0,0,0-6.93,4,59.78,59.78,0,0,0-5.38,47.68A58.14,58.14,0,0,0,56,104v8a56.06,56.06,0,0,0,48.44,55.47A39.8,39.8,0,0,0,96,192v8H72a24,24,0,0,1-24-24A40,40,0,0,0,8,136a8,8,0,0,0,0,16,24,24,0,0,1,24,24,40,40,0,0,0,40,40H96v16a8,8,0,0,0,16,0V192a24,24,0,0,1,48,0v40a8,8,0,0,0,16,0V192a39.8,39.8,0,0,0-8.44-24.53A56.06,56.06,0,0,0,216,112v-8A58.14,58.14,0,0,0,208.31,75.68ZM200,112a40,40,0,0,1-40,40H112a40,40,0,0,1-40-40v-8a41.74,41.74,0,0,1,6.9-22.48A8,8,0,0,0,80,73.83a43.81,43.81,0,0,1,.79-33.58,43.88,43.88,0,0,1,32.32,20.06A8,8,0,0,0,119.82,64h32.35a8,8,0,0,0,6.74-3.69,43.87,43.87,0,0,1,32.32-20.06A43.81,43.81,0,0,1,192,73.83a8.09,8.09,0,0,0,1,7.65A41.72,41.72,0,0,1,200,104Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M203.94,76.16A55.73,55.73,0,0,0,199.46,30,4,4,0,0,0,196,28a55.78,55.78,0,0,0-46,24H122A55.78,55.78,0,0,0,76,28a4,4,0,0,0-3.46,2,55.73,55.73,0,0,0-4.48,46.16A53.78,53.78,0,0,0,60,104v8a52.06,52.06,0,0,0,52,52h1.41A36,36,0,0,0,100,192v12H72a28,28,0,0,1-28-28A36,36,0,0,0,8,140a4,4,0,0,0,0,8,28,28,0,0,1,28,28,36,36,0,0,0,36,36h28v20a4,4,0,0,0,8,0V192a28,28,0,0,1,56,0v40a4,4,0,0,0,8,0V192a36,36,0,0,0-13.41-28H160a52.06,52.06,0,0,0,52-52v-8A53.78,53.78,0,0,0,203.94,76.16ZM204,112a44.05,44.05,0,0,1-44,44H112a44.05,44.05,0,0,1-44-44v-8a45.76,45.76,0,0,1,7.71-24.89,4,4,0,0,0,.53-3.84,47.82,47.82,0,0,1,2.1-39.21,47.8,47.8,0,0,1,38.12,22.1A4,4,0,0,0,119.83,60h32.34a4,4,0,0,0,3.37-1.84,47.8,47.8,0,0,1,38.12-22.1,47.82,47.82,0,0,1,2.1,39.21,4,4,0,0,0,.53,3.83A45.85,45.85,0,0,1,204,104Z`}))]]),z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm84,108a83.64,83.64,0,0,1-4.47,27L167,130a19.65,19.65,0,0,0-7.8-2.78l-22.82-3.08A20.14,20.14,0,0,0,117.72,132h-4.07l-2.71-5.6a19.88,19.88,0,0,0-13.8-10.84L94.46,115l4-7h14.39a20,20,0,0,0,9.66-2.49l12.25-6.76a20.57,20.57,0,0,0,3.74-2.68l26.92-24.33A20,20,0,0,0,172,56.49,84,84,0,0,1,212,128ZM140.76,45l6.2,11.1L122.75,78l-10.93,6H96.14A20.05,20.05,0,0,0,78.78,94.06l-4.49,7.85L67.68,84.28l9.91-23.42A83.91,83.91,0,0,1,140.76,45ZM44,128a83.52,83.52,0,0,1,4.4-26.77l7.74,20.65a19.89,19.89,0,0,0,14.52,12.53l19.53,4.2,3,6.1a20.11,20.11,0,0,0,13.55,10.77l-5,11.12a20,20,0,0,0,3.58,21.71l.21.22,18.16,18.7-.89,4.59A84.09,84.09,0,0,1,44,128Zm103.65,81.66a20.11,20.11,0,0,0-5-17.3l-.21-.22-17.72-18.25,11.37-25.52,19,2.56,41.43,25.48A84.2,84.2,0,0,1,147.65,209.66Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M213.09,172.48a96,96,0,0,1-80.41,51.41l3.17-16.44a8,8,0,0,0-2-6.95l-19.74-20.33a8,8,0,0,1-1.44-8.69l13.7-30.74a8,8,0,0,1,8.38-4.67l22.82,3.08a8.11,8.11,0,0,1,3.12,1.11ZM116.71,95,129,88.24a7.46,7.46,0,0,0,1.5-1.07l26.91-24.33A8,8,0,0,0,159,53l-10.5-18.81A96.62,96.62,0,0,0,128,32,95.61,95.61,0,0,0,67.78,53.23L56,81.08A8,8,0,0,0,55.88,87l11.5,30.67a8,8,0,0,0,5.81,5l2.69.58L89.2,100a8,8,0,0,1,6.94-4h16.71A7.9,7.9,0,0,0,116.71,95Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.62,87.62,0,0,1-6.4,32.94l-44.7-27.49a15.92,15.92,0,0,0-6.24-2.23l-22.82-3.08a16.11,16.11,0,0,0-16,7.86h-8.72l-3.8-7.86a15.91,15.91,0,0,0-11-8.67l-8-1.73L96.14,104h16.71a16.06,16.06,0,0,0,7.73-2l12.25-6.76a16.62,16.62,0,0,0,3-2.14l26.91-24.34A15.93,15.93,0,0,0,166,49.1l-.36-.65A88.11,88.11,0,0,1,216,128ZM143.31,41.34,152,56.9,125.09,81.24,112.85,88H96.14a16,16,0,0,0-13.88,8l-8.73,15.23L63.38,84.19,74.32,58.32a87.87,87.87,0,0,1,69-17ZM40,128a87.53,87.53,0,0,1,8.54-37.8l11.34,30.27a16,16,0,0,0,11.62,10l21.43,4.61L96.74,143a16.09,16.09,0,0,0,14.4,9h1.48l-7.23,16.23a16,16,0,0,0,2.86,17.37l.14.14L128,205.94l-1.94,10A88.11,88.11,0,0,1,40,128Zm102.58,86.78,1.13-5.81a16.09,16.09,0,0,0-4-13.9,1.85,1.85,0,0,1-.14-.14L120,174.74,133.7,144l22.82,3.08,45.72,28.12A88.18,88.18,0,0,1,142.58,214.78Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.62,87.62,0,0,1-6.4,32.94l-44.7-27.49a15.92,15.92,0,0,0-6.24-2.23l-22.82-3.08a16.11,16.11,0,0,0-16,7.86h-8.72l-3.8-7.86a15.91,15.91,0,0,0-11-8.67l-8-1.73L96.14,104h16.71a16.06,16.06,0,0,0,7.73-2l12.25-6.76a16.62,16.62,0,0,0,3-2.14l26.91-24.34A15.93,15.93,0,0,0,166,49.1l-.36-.65A88.11,88.11,0,0,1,216,128ZM40,128a87.53,87.53,0,0,1,8.54-37.8l11.34,30.27a16,16,0,0,0,11.62,10l21.43,4.61L96.74,143a16.09,16.09,0,0,0,14.4,9h1.48l-7.23,16.23a16,16,0,0,0,2.86,17.37l.14.14L128,205.94l-1.94,10A88.11,88.11,0,0,1,40,128Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm90,102a89.55,89.55,0,0,1-7.46,35.86l-46.69-28.71a13.94,13.94,0,0,0-5.46-2l-22.82-3.07A14.06,14.06,0,0,0,121.06,138h-9.92a2,2,0,0,1-1.8-1.13l-3.8-7.86a13.94,13.94,0,0,0-9.66-7.59l-10.71-2.3L94.4,103a2,2,0,0,1,1.74-1h16.71a13.9,13.9,0,0,0,6.76-1.75l12.25-6.75a14.73,14.73,0,0,0,2.62-1.88l26.91-24.33a13.93,13.93,0,0,0,2.83-17.21L161,44.25A90.16,90.16,0,0,1,218,128ZM144.6,39.54l9.15,16.39a2,2,0,0,1-.41,2.46L126.43,82.72a1.84,1.84,0,0,1-.37.27l-12.25,6.76a2,2,0,0,1-1,.25H96.14A14,14,0,0,0,84,97L73.18,115.91a2,2,0,0,1-.19-.35L61.5,84.89a2,2,0,0,1,0-1.48L72.68,57.06A89.9,89.9,0,0,1,144.6,39.54ZM38,128A89.52,89.52,0,0,1,49.38,84.23a13.85,13.85,0,0,0,.89,4.87l11.49,30.67a13.94,13.94,0,0,0,10.16,8.78l21.44,4.6a2,2,0,0,1,1.38,1.09l3.8,7.86a14.07,14.07,0,0,0,12.6,7.9h4.56l-8.49,19a14,14,0,0,0,2.51,15.2l.1.11,19.68,20.26a2,2,0,0,1,.46,1.7L127.7,218A90.1,90.1,0,0,1,38,128Zm102.08,89.19,1.67-8.6a14.07,14.07,0,0,0-3.47-12.16l-.1-.11L118.5,176.06a2,2,0,0,1-.33-2.14l13.7-30.73A2,2,0,0,1,134,142l22.82,3.08a2,2,0,0,1,.78.27L205,174.55A90.18,90.18,0,0,1,140.08,217.19Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.62,87.62,0,0,1-6.4,32.94l-44.7-27.49a15.92,15.92,0,0,0-6.24-2.23l-22.82-3.08a16.11,16.11,0,0,0-16,7.86h-8.72l-3.8-7.86a15.91,15.91,0,0,0-11-8.67l-8-1.73L96.14,104h16.71a16.06,16.06,0,0,0,7.73-2l12.25-6.76a16.62,16.62,0,0,0,3-2.14l26.91-24.34A15.93,15.93,0,0,0,166,49.1l-.36-.65A88.11,88.11,0,0,1,216,128ZM143.31,41.34,152,56.9,125.09,81.24,112.85,88H96.14a16,16,0,0,0-13.88,8l-8.73,15.23L63.38,84.19,74.32,58.32a87.87,87.87,0,0,1,69-17ZM40,128a87.53,87.53,0,0,1,8.54-37.8l11.34,30.27a16,16,0,0,0,11.62,10l21.43,4.61L96.74,143a16.09,16.09,0,0,0,14.4,9h1.48l-7.23,16.23a16,16,0,0,0,2.86,17.37l.14.14L128,205.94l-1.94,10A88.11,88.11,0,0,1,40,128Zm102.58,86.78,1.13-5.81a16.09,16.09,0,0,0-4-13.9,1.85,1.85,0,0,1-.14-.14L120,174.74,133.7,144l22.82,3.08,45.72,28.12A88.18,88.18,0,0,1,142.58,214.78Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm92,100a91.44,91.44,0,0,1-8.58,38.76L162.8,136.85a12.07,12.07,0,0,0-4.68-1.67l-22.82-3.07a12,12,0,0,0-12.56,7l-.4.88h-11.2a4,4,0,0,1-3.6-2.26l-3.8-7.86a11.93,11.93,0,0,0-8.28-6.5L82.07,120.5,92.67,102a4,4,0,0,1,3.47-2h16.71a12,12,0,0,0,5.8-1.5l12.24-6.76a11.79,11.79,0,0,0,2.25-1.6L160.05,65.8a12,12,0,0,0,2.43-14.75l-5.86-10.49A92.17,92.17,0,0,1,220,128ZM145.89,37.75l9.6,17.2a4,4,0,0,1-.81,4.92L127.77,84.21a4.41,4.41,0,0,1-.75.53L114.78,91.5a4,4,0,0,1-1.93.5H96.14a12,12,0,0,0-10.41,6l-11.86,20.7a4,4,0,0,1-2.75-2.47L59.63,85.6a4,4,0,0,1,.06-3L71,55.81A91.51,91.51,0,0,1,128,36,92.53,92.53,0,0,1,145.89,37.75ZM36,128A91.52,91.52,0,0,1,56,70.77l-3.71,8.75a12,12,0,0,0-.18,8.88l11.49,30.67a11.93,11.93,0,0,0,8.72,7.52l21.43,4.61a4,4,0,0,1,2.76,2.17l3.8,7.86a12.07,12.07,0,0,0,10.8,6.77h7.64L109,169.85A12,12,0,0,0,111.26,183l19.68,20.26a4,4,0,0,1,1,3.47L129.36,220,128,220A92.1,92.1,0,0,1,36,128Zm101.6,91.5,2.18-11.29a12.08,12.08,0,0,0-3-10.49l-19.68-20.26a4,4,0,0,1-.71-4.35l13.7-30.74a4,4,0,0,1,4.18-2.33l22.82,3.07a4.12,4.12,0,0,1,1.56.56l49.11,30.2A92.12,92.12,0,0,1,137.6,219.5Z`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),G_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:R_}));G_.displayName=`GithubLogoIcon`;var K_=G_,q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));q_.displayName=`GlobeHemisphereWestIcon`;var J_=q_,Y_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));Y_.displayName=`MagnifyingGlassIcon`;var X_=Y_,Z_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));Z_.displayName=`MoonIcon`;var Q_=Z_,$_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));$_.displayName=`PencilSimpleIcon`;var ev=$_,tv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));tv.displayName=`SignOutIcon`;var nv=tv,rv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));rv.displayName=`SunIcon`;var iv=rv;async function av(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function ov({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=Et(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=L_({queryKey:[...hn,m],queryFn:({pageParam:e})=>av(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=Ue({queryKey:_n,queryFn:()=>Ft(`/api/dashboards`),refetchInterval:3e4}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>fv(ue),[ue]),fe=Vt(`overview`,zt({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:hn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:hn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(pn,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(wn,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(sv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(cv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(sv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(sv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Pe,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(ze,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(X_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(At,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(At,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function sv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function cv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:pv(e.updatedAt)})]})}),(0,T.jsxs)(ft,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(ft.Target,{children:(0,T.jsx)(An,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(vt,{size:18,weight:`bold`})})}),(0,T.jsxs)(ft.Dropdown,{children:[(0,T.jsx)(ft.Item,{leftSection:(0,T.jsx)(ev,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(ft.Item,{color:`bad`,leftSection:(0,T.jsx)(gt,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function lv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function uv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var dv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function fv(e){let t=uv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-uv(lv(r.updatedAt)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return dv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function pv(e){let t=lv(e),n=uv(new Date);return Math.floor((n-uv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function mv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=Cn(),s=Oe(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=_t({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(Tn),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(hv,{}),(0,T.jsx)(gv,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(ov,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(ov,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function hv(){let{setColorScheme:e}=Mn(),t=Nn(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`;return(0,T.jsx)(On,{label:`Switch to ${n} theme`,children:(0,T.jsx)(An,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onClick:()=>e(n),children:t===`dark`?(0,T.jsx)(iv,{size:17,weight:`bold`}):(0,T.jsx)(Q_,{size:17,weight:`bold`})})})}function gv({onError:e}){let t=je(),n=(t.name.trim()||t.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(ft,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(ft.Target,{children:(0,T.jsx)(An,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:n})})}),(0,T.jsxs)(ft.Dropdown,{children:[(0,T.jsx)(ft.Label,{children:t.email||`Signed in`}),(0,T.jsx)(ft.Item,{component:`a`,href:`https://github.com/labstack/fanout`,target:`_blank`,rel:`noopener noreferrer`,leftSection:(0,T.jsx)(K_,{size:15,weight:`bold`}),children:`Fanout on GitHub`}),(0,T.jsx)(ft.Item,{component:`a`,href:`https://labstack.com`,target:`_blank`,rel:`noopener noreferrer`,leftSection:(0,T.jsx)(J_,{size:15}),children:`LabStack`}),(0,T.jsx)(ft.Divider,{}),(0,T.jsx)(ft.Item,{leftSection:(0,T.jsx)(nv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function _v(){let{agent_available:e}=ke(),t=Oe(),n=Et(),{threadId:r}=_t({strict:!1}),[i,a]=(0,w.useState)(dn),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(null),oe=(0,w.useRef)(0),se=(0,w.useMemo)(()=>new j_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),ce=!e||f===s;function le(){oe.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),le(),te(``),!e){p(s);return}!r||o.current.has(s)?(se.setMessages([]),p(s)):De(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}se.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=se.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{oe.current+=1,y(kn(e.toolCallName))},onToolCallEndEvent:()=>{oe.current=Math.max(0,oe.current-1),oe.current===0&&y(``)},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:hn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:hn})}});return()=>{t=!1,i.unsubscribe(),se.abortRun()}},[se,e,n,ne,s]),(0,w.useEffect)(()=>{ie.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[c,g]),(0,w.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ae.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ae.current?.focus()))),e.key===`Escape`&&n===ae.current&&(x(``),ae.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function ue(){_(!0),te(``);try{await se.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s)}}async function de(n){let i=n.trim();if(!e||!i||g||!ce||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:dn(),role:`user`,content:i};se.addMessage(a),l([...se.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await ue()}(0,w.useEffect)(()=>{let e=S.current;ce&&r&&e&&(S.current=``,de(e))},[ce,r,s]);function C(e){e.preventDefault(),de(b)}function fe(){se.abortRun(),_(!1),le(),o.current.delete(s)}function pe(){!g&&se.messages.some(e=>e.role===`user`)&&ue()}function me(n){if(!e)return;let r=dn();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function he(){se.abortRun(),S.current=``,a(dn()),t({to:`/chat`})}function ge(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function _e(){re(e=>e+1)}return(0,T.jsx)(Dn.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ce,running:g,activity:v,input:b,setInput:x,error:ee,bottomRef:ie,inputRef:ae,send:de,submit:C,stop:fe,retry:pe,reloadThread:_e,openChat:me,newThread:he,selectThread:ge},children:(0,T.jsx)(mv,{children:(0,T.jsx)(ta,{})})})}function vv(){let e=(0,w.useMemo)(()=>new I_,[]);return(0,T.jsx)(Ot,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(_v,{})})})}var yv=gn({component:vv,notFoundComponent:()=>(0,T.jsx)(we,{to:`/`,replace:!0})}),bv=It(`/`)({component:vn(()=>jn(()=>import(`./routes-wwkRMEW5.js`),__vite__mapDeps([0,1,2])),`component`)}),xv=It(`/chat/`)({component:vn(()=>jn(()=>import(`./chat.index-DjTlEgB5.js`),__vite__mapDeps([3,4,1,5,6])),`component`)}),Sv=It(`/chat/$threadId`)({component:vn(()=>jn(()=>import(`./chat._threadId-DjTlEgB5.js`),__vite__mapDeps([7,4,1,5,6])),`component`)}),Cv=It(`/dashboards/`)({component:vn(()=>jn(()=>import(`./dashboards.index-DZaR38po.js`),__vite__mapDeps([8,1,2,5,9,10,11,6])),`component`),validateSearch:Rt}),wv=It(`/dashboards/$dashboardId`)({component:vn(()=>jn(()=>import(`./dashboards._dashboardId-8CsBOcHC.js`),__vite__mapDeps([12,1,2,5,9,10,11,6])),`component`),validateSearch:Rt}),Tv=bv.update({id:`/`,path:`/`,getParentRoute:()=>yv}),Ev=xv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>yv}),Dv=Sv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>yv}),Ov=Cv.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>yv}),kv={IndexRoute:Tv,ChatThreadIdRoute:Dv,DashboardsDashboardIdRoute:wv.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>yv}),ChatIndexRoute:Ev,DashboardsIndexRoute:Ov},Av=sa({routeTree:yv._addFileChildren(kv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),jv={brand:rn,ok:on,warn:un,bad:Zt,info:$t},Mv={light:7,dark:5};function Nv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Pv(e){let t=Nv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Fv(e){return Object.fromEntries(Object.entries(jv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Pv(n[Mv[e]])]))}function Iv(e){return t=>{let n=t.color??zv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(jv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Lv=.25,Rv={xs:9,sm:10,md:11,lg:13,xl:16},zv={primaryColor:`brand`,primaryShade:Mv,autoContrast:!0,luminanceThreshold:Lv,colors:{dark:cn,brand:rn,ok:on,warn:un,bad:Zt,info:$t},defaultRadius:`md`,fontFamily:Nt.body,fontFamilyMonospace:Nt.display,headings:{fontFamily:Nt.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Hv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Hv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Vv(t.size)})}}},Bv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":Ut.light.muted,...Fv(`light`)},dark:Fv(`dark`)});function Vv(e){let t=Rv[e??`md`];return t===void 0||t>=Jt.micro?{}:{"--badge-fz":`${Jt.micro/16}rem`}}function Hv(e,t){return!e||e===zv.primaryColor?{[t]:`var(--fanout-color-${zv.primaryColor}-contrast)`}:{}}var Uv=Iv(h),Wv=ja({...zv,variantColorResolver:Uv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:Wv,defaultColorScheme:`auto`,cssVariablesResolver:Bv,children:(0,T.jsx)(ua,{router:Av})})}));export{Cv as n,wv as t}; \ No newline at end of file +`)},e_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(yf(r=>{switch(r.type){case z.TEXT_MESSAGE_START:{let e=r;return[{type:Zg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case z.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Zg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case z.TEXT_MESSAGE_END:{let e=r;return[{type:Zg.enum.TextMessageEnd,messageId:e.messageId}]}case z.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:Zg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case z.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(jf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Zg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case z.TOOL_CALL_END:{let e=r;return[{type:Zg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case z.TOOL_CALL_RESULT:{let e=r;return[{type:Zg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case z.RAW:return[];case z.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Zg.enum.MetaEvent,name:e.name,value:e.value}]}case z.STATE_SNAPSHOT:return f(r.snapshot),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case z.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case z.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case z.RUN_STARTED:return[];case z.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:t_(c)}:{}}),active:!1}];case z.RUN_ERROR:{let e=r;return[{type:Zg.enum.RunError,message:e.message,code:e.code}]}case z.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case z.STEP_FINISHED:return u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function t_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=$g(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var n_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,r_=e=>e===`tool`?`toolCallId`:`messageId`,i_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},a_=e=>t=>{let n=zg(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:z.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:z.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:z.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&n_(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${r_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(yf(e=>{switch(e.type){case z.TEXT_MESSAGE_START:case z.TEXT_MESSAGE_CONTENT:case z.TEXT_MESSAGE_END:case z.TOOL_CALL_START:case z.TOOL_CALL_ARGS:case z.TOOL_CALL_END:case z.TOOL_CALL_RESULT:case z.STATE_SNAPSHOT:case z.STATE_DELTA:case z.CUSTOM:case z.STEP_STARTED:case z.STEP_FINISHED:case z.THINKING_START:case z.THINKING_END:case z.THINKING_TEXT_MESSAGE_START:case z.THINKING_TEXT_MESSAGE_CONTENT:case z.THINKING_TEXT_MESSAGE_END:case z.REASONING_START:case z.REASONING_MESSAGE_START:case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:return[...i(e.subagentRunId??void 0),e];case z.RUN_STARTED:case z.RUN_FINISHED:case z.RUN_ERROR:case z.MESSAGES_SNAPSHOT:return[...a(),e];case z.RAW:case z.ACTIVITY_SNAPSHOT:case z.ACTIVITY_DELTA:case z.REASONING_ENCRYPTED_VALUE:case z.SUBAGENT_STARTED:return[e];case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case z.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=i_({type:z.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=i_({type:z.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=i_({type:z.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Ef(()=>{a()}))};function o_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var s_=class{runNext(e,t){return t.run(e).pipe(a_(!1))}runNextWithState(e,t){let n=Mg(e.messages||[]),r=Mg(e.state||{}),i=new Nd;return Wg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(wf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Mg(n),state:Mg(r)})))}},c_=class extends s_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function l_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var u_=class extends s_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(l_)};return this.runNext(i,t)}},d_=`THINKING_START`,f_=`THINKING_END`,p_=`THINKING_TEXT_MESSAGE_START`,m_=`THINKING_TEXT_MESSAGE_CONTENT`,h_=`THINKING_TEXT_MESSAGE_END`,g_=class extends s_{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(_f(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case d_:{this.currentReasoningId=Ng();let{title:t,...n}=e;return this.warnAboutTransformation(d_,z.REASONING_START),{...n,type:z.REASONING_START,messageId:this.currentReasoningId}}case p_:return this.currentMessageId=Ng(),this.warnAboutTransformation(p_,z.REASONING_MESSAGE_START),{...e,type:z.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case m_:{let{delta:t,...n}=e;return this.warnAboutTransformation(m_,z.REASONING_MESSAGE_CONTENT),{...n,type:z.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ng(),delta:t}}case h_:{let t=this.currentMessageId??Ng();return this.warnAboutTransformation(h_,z.REASONING_MESSAGE_END),{...e,type:z.REASONING_MESSAGE_END,messageId:t}}case f_:{let t=this.currentReasoningId??Ng();return this.warnAboutTransformation(f_,z.REASONING_END),{...e,type:z.REASONING_END,messageId:t}}default:return e}}};function __(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function v_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function y_(e){let t=__(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e}function b_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>v_(e)?y_(e):e);return{...e,content:n}}var x_=class extends s_{run(e,t){let n={...e,messages:e.messages.map(b_)};return this.runNext(n,t)}},S_=`SUBAGENT_STARTED`,C_=`SUBAGENT_FINISHED`,w_=`SUBAGENT_ERROR`;function T_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function E_(e){return e.map(e=>T_(e))}var D_=class extends s_{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>T_(e))};return this.runNext(n,t).pipe(kf(e=>{let t=e.type;(t===S_||t===C_||t===w_)&&this.warnDroppedLifecycleEvent(t)}),Sf(e=>{let t=e.type;return t!==S_&&t!==C_&&t!==w_}),_f(e=>{let t=T_(e);if(t.type===z.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:E_(e.messages)}}if(t.type===z.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>T_(e))}}}if(t.type===z.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:E_(e.input.messages)}}}return t}))}},O_=`0.0.59`,k_=class{get maxVersion(){return O_}get debug(){return this._debug}set debug(e){this._debug=Rg(e),this._debugLogger=Vg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Vg(Rg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Mg(r??[]),this.state=Mg(i??{}),this._debug=Rg(a),this._debugLogger=Vg(this._debug),jg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new u_),jg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new g_),jg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new x_),jg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new D_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new c_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ef(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)));let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>xf(()=>this.connect(n)),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.isRunning=!1,e instanceof Qc?Pd:this.onError(n,e,a))),Ef(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)),{defaultValue:void 0});let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,n){return Wg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(kf(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Mg(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Mg(e?.tools??[]),context:Mg(e?.context??[]),forwardedProps:Mg(e?.forwardedProps??{}),state:Mg(this.state),messages:n,...e?.resume===void 0?{}:{resume:Mg(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new R(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(o_(e))throw new R(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return pf(Lg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(_f(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Mg(this.messages),e.state=Mg(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Mg(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=Mg(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Mg(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(a_(this.debugLogger),Gg(this.debugLogger),e_(this.threadId,t.runId,this.agentId),e=>e.pipe(_f(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function A_(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var j_=class extends k_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(A_(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=Mg(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Xg(qg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Mg(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},M_=class extends ln{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:wn(t,n.data),hasPreviousPage:un(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},N_=class extends pn{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new bn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=P_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){xn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Dn(t,e))}findAll(e={}){return this.getAll().filter(t=>Dn(e,t))}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return xn.batch(()=>Promise.all(e.map(e=>e.continue().catch(En))))}};function P_(e){return e.options.scope?.id}var F_=class extends pn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Tn(r,t),a=this.get(i);return a||(a=new _n({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){xn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>cn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>cn(e,t)):t}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},I_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new F_,this.#t=e.mutationCache||new N_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=vn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Kt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return xn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;xn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return xn.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=xn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(En).catch(En)}invalidateQueries(e,t={}){return xn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=xn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(En)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(En)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Kt(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Kt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(En).catch(En)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(En).catch(En)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return dn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(on(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{an(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(on(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{an(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Tn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Jt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function L_(e,t){return sn(e,M_,t)}var R_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),G_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:R_}));G_.displayName=`BookOpenIcon`;var K_=G_,q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));q_.displayName=`MagnifyingGlassIcon`;var J_=q_,Y_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));Y_.displayName=`MoonIcon`;var X_=Y_,Z_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));Z_.displayName=`PencilSimpleIcon`;var Q_=Z_,$_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));$_.displayName=`PlugsConnectedIcon`;var ev=$_,tv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));tv.displayName=`SignOutIcon`;var nv=tv,rv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));rv.displayName=`SunIcon`;var iv=rv,av={home:`https://fanout.run/docs`,ingest:`https://fanout.run/docs/ingest`};async function ov(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function sv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=tn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=L_({queryKey:[...Sn,m],queryFn:({pageParam:e})=>ov(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=mn({queryKey:Cn,queryFn:()=>yn(`/api/dashboards`),refetchInterval:3e4}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>pv(ue),[ue]),fe=pt(`overview`,ft({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Sn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Sn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Ft,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Bt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(lv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Pt,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(ot,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(J_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(gn,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(gn,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function cv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function lv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:mv(e.updatedAt)})]})}),(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Ze,{size:18,weight:`bold`})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(Q_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Le.Item,{color:`bad`,leftSection:(0,T.jsx)(It,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function uv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function dv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var fv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function pv(e){let t=dv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-dv(uv(r.updatedAt)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return fv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function mv(e){let t=uv(e),n=dv(new Date);return Math.floor((n-dv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function hv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=On(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=Ve({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(kn),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Vt,{label:`Documentation`,children:(0,T.jsx)(jn,{component:`a`,href:av.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(K_,{size:17,weight:`bold`})})}),(0,T.jsx)(gv,{}),(0,T.jsx)(_v,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(sv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(sv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function gv(){let{setColorScheme:e}=Ut(),t=Wt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`;return(0,T.jsx)(Vt,{label:`Switch to ${n} theme`,children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onClick:()=>e(n),children:t===`dark`?(0,T.jsx)(iv,{size:17,weight:`bold`}):(0,T.jsx)(X_,{size:17,weight:`bold`})})})}function _v({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(ev,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Le.Divider,{}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(nv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function vv(){let{agent_available:e}=ke(),t=Ne(),n=tn(),{threadId:r}=Ve({strict:!1}),[i,a]=(0,w.useState)(Nt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(null),oe=(0,w.useRef)(0),se=(0,w.useMemo)(()=>new j_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),ce=!e||f===s;function le(){oe.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),le(),te(``),!e){p(s);return}!r||o.current.has(s)?(se.setMessages([]),p(s)):De(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}se.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=se.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{oe.current+=1,y(Mn(e.toolCallName))},onToolCallEndEvent:()=>{oe.current=Math.max(0,oe.current-1),oe.current===0&&y(``)},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})}});return()=>{t=!1,i.unsubscribe(),se.abortRun()}},[se,e,n,ne,s]),(0,w.useEffect)(()=>{ie.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[c,g]),(0,w.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ae.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ae.current?.focus()))),e.key===`Escape`&&n===ae.current&&(x(``),ae.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function ue(){_(!0),te(``);try{await se.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s)}}async function de(n){let i=n.trim();if(!e||!i||g||!ce||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Nt(),role:`user`,content:i};se.addMessage(a),l([...se.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await ue()}(0,w.useEffect)(()=>{let e=S.current;ce&&r&&e&&(S.current=``,de(e))},[ce,r,s]);function C(e){e.preventDefault(),de(b)}function fe(){se.abortRun(),_(!1),le(),o.current.delete(s)}function pe(){!g&&se.messages.some(e=>e.role===`user`)&&ue()}function me(n){if(!e)return;let r=Nt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function he(){se.abortRun(),S.current=``,a(Nt()),t({to:`/chat`})}function ge(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function _e(){re(e=>e+1)}return(0,T.jsx)(An.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ce,running:g,activity:v,input:b,setInput:x,error:ee,bottomRef:ie,inputRef:ae,send:de,submit:C,stop:fe,retry:pe,reloadThread:_e,openChat:me,newThread:he,selectThread:ge},children:(0,T.jsx)(hv,{children:(0,T.jsx)(ta,{})})})}function yv(){let e=(0,w.useMemo)(()=>new I_,[]);return(0,T.jsx)(qt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(vv,{})})})}var bv=Re({component:yv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),xv=Je(`/`)({component:Ke(()=>Nn(()=>import(`./routes-D1xQhcK4.js`),__vite__mapDeps([0,1,2])),`component`)}),Sv=Je(`/settings`)({component:Ke(()=>Nn(()=>import(`./settings-D0Y7fLFc.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),Cv=Je(`/chat/`)({component:Ke(()=>Nn(()=>import(`./chat.index-DvqxaiRx.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),wv=Je(`/chat/$threadId`)({component:Ke(()=>Nn(()=>import(`./chat._threadId-DvqxaiRx.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Tv=Je(`/dashboards/`)({component:Ke(()=>Nn(()=>import(`./dashboards.index-Ds_9_kmf.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Ev=Je(`/dashboards/$dashboardId`)({component:Ke(()=>Nn(()=>import(`./dashboards._dashboardId-DT7kwfWv.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Dv=xv.update({id:`/`,path:`/`,getParentRoute:()=>bv}),Ov=Sv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>bv}),kv=Cv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>bv}),Av=wv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>bv}),jv=Tv.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>bv}),Mv={IndexRoute:Dv,SettingsRoute:Ov,ChatThreadIdRoute:Av,DashboardsDashboardIdRoute:Ev.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>bv}),ChatIndexRoute:kv,DashboardsIndexRoute:jv},Nv=sa({routeTree:bv._addFileChildren(Mv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Pv={brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},Fv={light:7,dark:5};function Iv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Lv(e){let t=Iv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Rv(e){return Object.fromEntries(Object.entries(Pv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Lv(n[Fv[e]])]))}function zv(e){return t=>{let n=t.color??Hv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Pv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Bv=.25,Vv={xs:9,sm:10,md:11,lg:13,xl:16},Hv={primaryColor:`brand`,primaryShade:Fv,autoContrast:!0,luminanceThreshold:Bv,colors:{dark:kt,brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},defaultRadius:`md`,fontFamily:it.body,fontFamilyMonospace:it.display,headings:{fontFamily:it.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Gv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Gv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Wv(t.size)})}}},Uv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...Rv(`light`)},dark:Rv(`dark`)});function Wv(e){let t=Vv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Gv(e,t){return!e||e===Hv.primaryColor?{[t]:`var(--fanout-color-${Hv.primaryColor}-contrast)`}:{}}var Kv=zv(h),qv=ja({...Hv,variantColorResolver:Kv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:qv,defaultColorScheme:`auto`,cssVariablesResolver:Uv,children:(0,T.jsx)(ua,{router:Nv})})}));export{Tv as n,av as r,Ev as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/mcp-app-frame-DQwCEkc1.js b/internal/ui/dist/assets/mcp-app-frame-BZJusU6-.js similarity index 99% rename from internal/ui/dist/assets/mcp-app-frame-DQwCEkc1.js rename to internal/ui/dist/assets/mcp-app-frame-BZJusU6-.js index 4732b4f0f..c54e4b0bc 100644 --- a/internal/ui/dist/assets/mcp-app-frame-DQwCEkc1.js +++ b/internal/ui/dist/assets/mcp-app-frame-BZJusU6-.js @@ -1,4 +1,4 @@ -import{St as e,_ as t,_t as n,bt as r,d as i,f as a,gt as o,l as s,mt as c,vt as l,x as u,xt as d,yt as f}from"./brand-MzZ03bSa.js";import{i as p}from"./auth-DNoFbJyG.js";import{t as m}from"./use-computed-color-scheme-6JIsge00.js";function h(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function g(e,t=`|`){return e.map(e=>se(e)).join(t)}function _(e,t){return typeof t==`bigint`?t.toString():t}function v(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function y(e){return e==null}function b(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function x(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var re=v(()=>{if(Ke.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function T(e){if(w(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return w(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ie(e){return T(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ae=new Set([`string`,`number`,`symbol`]);function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function E(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function D(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var le={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return E(e,C(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&S(e,r,n.shape[r])}return S(this,`shape`,e),e},checks:[]}))}function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return E(e,C(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return S(this,`shape`,r),r},checks:[]}))}function fe(e,t){if(!T(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function pe(e,t){if(!T(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function me(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return S(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function he(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return E(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return S(this,`shape`,i),i},checks:[]}))}function ge(e,t,n){return E(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return S(this,`shape`,i),i}}))}function _e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function be(e){return typeof e==`string`?e:e?.message}function xe(e,t,n){var r;for(let i=t;ie;return t[Le]=!0,t}var ze,Be=Object.freeze({status:`aborted`}),Ve={value:void 0,enumerable:!1},He=`captureStackTrace`in Error?Error:null;function Ue(e){let t=He;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return He=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function k(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ve.value=new a(r);try{Object.defineProperty(n,"_zod",Ve)}finally{Ve.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Oe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ue(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var We=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ze=globalThis).__zod_globalConfig??(ze.__zod_globalConfig={});var Ke=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(Ke,e),Ke}function Je(){let e=this._zod;return e.message??=JSON.stringify(e.def,_,2),e.message}function Ye(e){this._zod.message=e}var Xe={get:Je,set:Ye,enumerable:!0,configurable:!0},Ze={value:void 0,enumerable:!1},Qe={value:void 0,enumerable:!1},$e=new WeakSet([Object.prototype,Error.prototype]),et=(e,t)=>{e.name=`$ZodError`,Ze.value=e._zod,Object.defineProperty(e,"_zod",Ze),Qe.value=t,Object.defineProperty(e,"issues",Qe),Ze.value=void 0,Qe.value=void 0,Object.defineProperty(e,"message",Xe);let n=Object.getPrototypeOf(e);$e.has(n)||($e.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},tt=k(`$ZodError`,et),nt=k(`$ZodError`,et,void 0,{Parent:Error});function rt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function it(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?rt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function at(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new We;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw ne(n,a?.callee??t),n}return s.value};return t},ct=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw ne(n,a?.callee??t),n}return s.value};return t},lt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new We;return a.issues.length?{success:!1,error:new(e??tt)(a.issues.map(e=>Se(e,i,qe())))}:{success:!0,data:a.value}},ut=lt(nt),dt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Se(e,i,qe())))}:{success:!0,data:a.value}},ft=dt(nt),pt=e=>{let t=st(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ot(n,a))};return n},mt=e=>{let t=st(e),n=(e,r,i,a)=>t(e,r,i,ot(n,a));return n},ht=e=>{let t=ct(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ot(n,a))};return n},gt=e=>{let t=ct(e),n=async(e,r,i,a)=>await t(e,r,i,ot(n,a));return n},_t=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lt(e)(t,n,i)},vt=e=>(t,n,r)=>lt(e)(t,n,r),yt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dt(e)(t,n,i)},bt=e=>async(t,n,r)=>dt(e)(t,n,r),xt=/^[cC][0-9a-z]{6,}$/,St=/^[0-9a-z]+$/,Ct=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,wt=/^[0-9a-vA-V]{20}$/,Tt=/^[A-Za-z0-9]{27}$/,Et=/^[a-zA-Z0-9_-]{21}$/;function Dt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ot=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,At=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,jt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Mt=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Nt(){return new RegExp(Mt,`u`)}var Pt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ft=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,It=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Lt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zt=/^[A-Za-z0-9_-]*$/,Bt=/^https?$/,Vt=/^\+[1-9]\d{6,14}$/,Ht=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ut(e){return RegExp(`^${e}$`)}var Wt=Ut(Ht);function Gt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kt(e){return RegExp(`^${Gt(e)}$`)}function qt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Gt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Gt({precision:e.precision})}`:n;return RegExp(`^${Ht}T(?:${r})$`)}var Jt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yt=/^-?\d+$/,Xt=/^-?\d+(?:\.\d+)?$/,Zt=/^(?:true|false)$/i,Qt=/^null$/i,$t=/^undefined$/i,en=/^[^A-Z]*$/,tn=/^[^a-z]*$/,nn=k(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),rn=e=>{let t=e.value;return!y(t)&&t.length!==void 0},an={number:`number`,bigint:`bigint`,object:`date`},on=k(`$ZodCheckLessThan`,(e,t)=>{nn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{nn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:an[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=k(`$ZodCheckMultipleOf`,(e,t)=>{nn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):x(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ln=k(`$ZodCheckNumberFormat`,(e,t)=>{nn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=le[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Yt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),un=k(`$ZodCheckMaxLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?we(r):i)<=t.maximum)return;let a=Te(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=k(`$ZodCheckMinLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i=t.minimum)return;let a=Te(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fn=k(`$ZodCheckLengthEquals`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?we(r):i;if(a===t.length)return;let o=Te(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pn=k(`$ZodCheckStringFormat`,(e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mn=k(`$ZodCheckRegex`,(e,t)=>{pn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hn=k(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=en,pn.init(e,t)}),gn=k(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=tn,pn.init(e,t)}),_n=k(`$ZodCheckIncludes`,(e,t)=>{nn.init(e,t);let n=oe(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vn=k(`$ZodCheckStartsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`^${oe(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yn=k(`$ZodCheckEndsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`.*${oe(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),bn=k(`$ZodCheckOverwrite`,(e,t)=>{nn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` +import{St as e,_ as t,_t as n,bt as r,d as i,f as a,gt as o,l as s,mt as c,vt as l,x as u,xt as d,yt as f}from"./brand-MzZ03bSa.js";import{i as p}from"./auth-BeUORN-q.js";import{t as m}from"./use-computed-color-scheme-6JIsge00.js";function h(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function g(e,t=`|`){return e.map(e=>se(e)).join(t)}function _(e,t){return typeof t==`bigint`?t.toString():t}function v(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function y(e){return e==null}function b(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function x(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var re=v(()=>{if(Ke.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function T(e){if(w(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return w(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ie(e){return T(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ae=new Set([`string`,`number`,`symbol`]);function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function E(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function D(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var le={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return E(e,C(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&S(e,r,n.shape[r])}return S(this,`shape`,e),e},checks:[]}))}function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return E(e,C(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return S(this,`shape`,r),r},checks:[]}))}function fe(e,t){if(!T(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function pe(e,t){if(!T(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function me(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return S(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function he(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return E(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return S(this,`shape`,i),i},checks:[]}))}function ge(e,t,n){return E(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return S(this,`shape`,i),i}}))}function _e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function be(e){return typeof e==`string`?e:e?.message}function xe(e,t,n){var r;for(let i=t;ie;return t[Le]=!0,t}var ze,Be=Object.freeze({status:`aborted`}),Ve={value:void 0,enumerable:!1},He=`captureStackTrace`in Error?Error:null;function Ue(e){let t=He;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return He=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function k(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ve.value=new a(r);try{Object.defineProperty(n,"_zod",Ve)}finally{Ve.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Oe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ue(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var We=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ze=globalThis).__zod_globalConfig??(ze.__zod_globalConfig={});var Ke=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(Ke,e),Ke}function Je(){let e=this._zod;return e.message??=JSON.stringify(e.def,_,2),e.message}function Ye(e){this._zod.message=e}var Xe={get:Je,set:Ye,enumerable:!0,configurable:!0},Ze={value:void 0,enumerable:!1},Qe={value:void 0,enumerable:!1},$e=new WeakSet([Object.prototype,Error.prototype]),et=(e,t)=>{e.name=`$ZodError`,Ze.value=e._zod,Object.defineProperty(e,"_zod",Ze),Qe.value=t,Object.defineProperty(e,"issues",Qe),Ze.value=void 0,Qe.value=void 0,Object.defineProperty(e,"message",Xe);let n=Object.getPrototypeOf(e);$e.has(n)||($e.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},tt=k(`$ZodError`,et),nt=k(`$ZodError`,et,void 0,{Parent:Error});function rt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function it(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?rt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function at(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new We;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw ne(n,a?.callee??t),n}return s.value};return t},ct=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw ne(n,a?.callee??t),n}return s.value};return t},lt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new We;return a.issues.length?{success:!1,error:new(e??tt)(a.issues.map(e=>Se(e,i,qe())))}:{success:!0,data:a.value}},ut=lt(nt),dt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Se(e,i,qe())))}:{success:!0,data:a.value}},ft=dt(nt),pt=e=>{let t=st(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ot(n,a))};return n},mt=e=>{let t=st(e),n=(e,r,i,a)=>t(e,r,i,ot(n,a));return n},ht=e=>{let t=ct(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ot(n,a))};return n},gt=e=>{let t=ct(e),n=async(e,r,i,a)=>await t(e,r,i,ot(n,a));return n},_t=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lt(e)(t,n,i)},vt=e=>(t,n,r)=>lt(e)(t,n,r),yt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dt(e)(t,n,i)},bt=e=>async(t,n,r)=>dt(e)(t,n,r),xt=/^[cC][0-9a-z]{6,}$/,St=/^[0-9a-z]+$/,Ct=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,wt=/^[0-9a-vA-V]{20}$/,Tt=/^[A-Za-z0-9]{27}$/,Et=/^[a-zA-Z0-9_-]{21}$/;function Dt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ot=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,At=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,jt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Mt=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Nt(){return new RegExp(Mt,`u`)}var Pt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ft=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,It=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Lt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zt=/^[A-Za-z0-9_-]*$/,Bt=/^https?$/,Vt=/^\+[1-9]\d{6,14}$/,Ht=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ut(e){return RegExp(`^${e}$`)}var Wt=Ut(Ht);function Gt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kt(e){return RegExp(`^${Gt(e)}$`)}function qt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Gt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Gt({precision:e.precision})}`:n;return RegExp(`^${Ht}T(?:${r})$`)}var Jt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yt=/^-?\d+$/,Xt=/^-?\d+(?:\.\d+)?$/,Zt=/^(?:true|false)$/i,Qt=/^null$/i,$t=/^undefined$/i,en=/^[^A-Z]*$/,tn=/^[^a-z]*$/,nn=k(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),rn=e=>{let t=e.value;return!y(t)&&t.length!==void 0},an={number:`number`,bigint:`bigint`,object:`date`},on=k(`$ZodCheckLessThan`,(e,t)=>{nn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{nn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:an[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=k(`$ZodCheckMultipleOf`,(e,t)=>{nn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):x(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ln=k(`$ZodCheckNumberFormat`,(e,t)=>{nn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=le[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Yt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),un=k(`$ZodCheckMaxLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?we(r):i)<=t.maximum)return;let a=Te(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=k(`$ZodCheckMinLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i=t.minimum)return;let a=Te(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fn=k(`$ZodCheckLengthEquals`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?we(r):i;if(a===t.length)return;let o=Te(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pn=k(`$ZodCheckStringFormat`,(e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mn=k(`$ZodCheckRegex`,(e,t)=>{pn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hn=k(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=en,pn.init(e,t)}),gn=k(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=tn,pn.init(e,t)}),_n=k(`$ZodCheckIncludes`,(e,t)=>{nn.init(e,t);let n=oe(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vn=k(`$ZodCheckStartsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`^${oe(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yn=k(`$ZodCheckEndsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`.*${oe(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),bn=k(`$ZodCheckOverwrite`,(e,t)=>{nn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(` `)}\n};`)(...Object.values(this.closed))}},Sn={major:4,minor:5,patch:4},A=k(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=_e(t),a;for(let o of n){if(o._zod.def.when){if(ve(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new We;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(xe(t.issues,n,e),i||=_e(t,n))});else{if(t.issues.length===n)continue;xe(t.issues,n,e),i||=_e(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(_e(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new We;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new We;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ae(this,`~standard`,wn(this))},set"~standard"(e){ke(this,`~standard`,e)}}),Cn=e=>e.success?{value:e.data}:{issues:e.error?.issues};function wn(e){return{validate:t=>{try{return Cn(ut(e,t))}catch{return ft(e,t).then(Cn)}},vendor:`zod`,version:1}}var Tn=k(`$ZodString`,(e,t)=>{A.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Jt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),j=k(`$ZodStringFormat`,(e,t)=>{pn.init(e,t),Tn.init(e,t)}),En=k(`$ZodGUID`,(e,t)=>{t.pattern??=kt,j.init(e,t)}),Dn=k(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=At(e)}else t.pattern??=At();j.init(e,t)}),On=k(`$ZodEmail`,(e,t)=>{t.pattern??=jt,j.init(e,t)});function kn(e,t){if(!t.normalize&&t.protocol?.source===Bt.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}var An=/[\t\n\r]/g;function jn(e){return e.replace(An,``)}function Mn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Nn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Pn=k(`$ZodURL`,(e,t)=>{j.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=kn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!Mn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Nn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:jn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Fn=k(`$ZodEmoji`,(e,t)=>{t.pattern??=Nt(),j.init(e,t)}),In=k(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Et:Dt(t.length),j.init(e,t)}),Ln=k(`$ZodCUID`,(e,t)=>{t.pattern??=xt,j.init(e,t)}),Rn=k(`$ZodCUID2`,(e,t)=>{t.pattern??=St,j.init(e,t)}),zn=k(`$ZodULID`,(e,t)=>{t.pattern??=Ct,j.init(e,t)}),Bn=k(`$ZodXID`,(e,t)=>{t.pattern??=wt,j.init(e,t)}),Vn=k(`$ZodKSUID`,(e,t)=>{t.pattern??=Tt,j.init(e,t)}),Hn=k(`$ZodISODateTime`,(e,t)=>{t.pattern??=qt(t),j.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),Un=k(`$ZodISODate`,(e,t)=>{t.pattern??=Wt,j.init(e,t)}),Wn=k(`$ZodISOTime`,(e,t)=>{t.pattern??=Kt(t),j.init(e,t)}),Gn=k(`$ZodISODuration`,(e,t)=>{t.pattern??=Ot,j.init(e,t)}),Kn=k(`$ZodIPv4`,(e,t)=>{t.pattern??=Pt,j.init(e,t),e._zod.bag.format=`ipv4`}),qn=/^[0-9a-fA-F:.]+$/;function Jn(e){if(!qn.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Yn=k(`$ZodIPv6`,(e,t)=>{t.pattern??=Ft,j.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{Jn(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Xn=k(`$ZodCIDRv4`,(e,t)=>{t.pattern??=It,j.init(e,t)});function Zn(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Jn(n)}var Qn=k(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Lt,j.init(e,t),e._zod.check=n=>{Zn(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function $n(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var er=k(`$ZodBase64`,(e,t)=>{t.pattern??=Rt,j.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{$n(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function tr(e){if(!zt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return $n(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var nr=k(`$ZodBase64URL`,(e,t)=>{t.pattern??=zt,j.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{tr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),rr=k(`$ZodE164`,(e,t)=>{t.pattern??=Vt,j.init(e,t)});function ir(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ar=k(`$ZodJWT`,(e,t)=>{j.init(e,t),e._zod.check=n=>{ir(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),or=k(`$ZodNumber`,(e,t)=>{A.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),sr=k(`$ZodNumberFormat`,(e,t)=>{ln.init(e,t),or.init(e,t)}),cr=k(`$ZodBoolean`,(e,t)=>{A.init(e,t),e._zod.pattern=Zt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),lr=k(`$ZodUndefined`,(e,t)=>{A.init(e,t),e._zod.pattern=$t,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),ur=k(`$ZodNull`,(e,t)=>{A.init(e,t),e._zod.pattern=Qt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),dr=k(`$ZodAny`,(e,t)=>{A.init(e,t),e._zod.parse=e=>e}),fr=k(`$ZodUnknown`,(e,t)=>{A.init(e,t),e._zod.parse=e=>e}),pr=k(`$ZodNever`,(e,t)=>{A.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function mr(e,t,n){e.issues.length&&t.issues.push(...ye(n,e.issues)),t.value[n]=e.value}var hr=k(`$ZodArray`,(e,t)=>{A.init(e,t);let n=Ke.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;emr(t,r,e))):mr(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function gr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ye(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}var _r=[];function vr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:_r,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ce(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function yr(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>gr(e,n,i,t,u,d))):gr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var br=new WeakMap,xr=k(`$ZodObject`,(e,t)=>{if(A.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;br.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),br.set(t,n),n}})}let n=v(()=>vr(t));O(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||S(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=w,i=t.catchall,a,o=Ke.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>gr(n,t,e,c,r,i))):gr(a,t,e,c,r,i)}return i?yr(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Sr=k(`$ZodObjectJIT`,(e,t)=>{xr.init(e,t);let n=e._zod.parse,r=v(()=>vr(t)),i=Ke.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new xn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>` for (let i = 0; i < ${e}.issues.length; i++) { diff --git a/internal/ui/dist/assets/preload-helper-BL3qEkUh.js b/internal/ui/dist/assets/preload-helper-BL3qEkUh.js new file mode 100644 index 000000000..5e09fc2f3 --- /dev/null +++ b/internal/ui/dist/assets/preload-helper-BL3qEkUh.js @@ -0,0 +1 @@ +import{C as e,S as t,St as n,X as r,_ as i,at as a,b as o,dt as s,gt as c,it as l,j as u,k as d,mt as f,st as p,v as m,x as h}from"./brand-MzZ03bSa.js";var g={root:`m_8d3f4000`,icon:`m_8d3afb97`,loader:`m_302b9fb1`,group:`m_1a0f1b21`,groupSection:`m_437b6484`},_=f(),v={orientation:`horizontal`},y=r((e,{borderWidth:t})=>({group:{"--ai-border-width":s(t)}})),b=e(e=>{let t=u(`ActionIconGroup`,v,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,orientation:s,vars:c,borderWidth:l,variant:f,mod:p,attributes:m,...b}=t;return(0,_.jsx)(h,{...d({name:`ActionIconGroup`,props:t,classes:g,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:m,vars:c,varsResolver:y,rootSelector:`group`})(`group`),variant:f,mod:[{"data-orientation":s},p],role:`group`,...b})});b.classes=g,b.varsResolver=y,b.displayName=`@mantine/core/ActionIconGroup`;var x=r((e,{radius:t,color:n,gradient:r,variant:i,autoContrast:o,size:s})=>{let c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:o});return{groupSection:{"--section-height":p(s,`section-height`),"--section-padding-x":p(s,`section-padding-x`),"--section-fz":l(s),"--section-radius":t===void 0?void 0:a(t),"--section-bg":n||i?c.background:void 0,"--section-color":c.color,"--section-bd":n||i?c.border:void 0}}}),S=e(e=>{let t=u(`ActionIconGroupSection`,null,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,vars:s,variant:c,gradient:l,radius:f,autoContrast:p,attributes:m,...v}=t;return(0,_.jsx)(h,{...d({name:`ActionIconGroupSection`,props:t,classes:g,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:m,vars:s,varsResolver:x,rootSelector:`groupSection`})(`groupSection`),variant:c,...v})});S.classes=g,S.varsResolver=x,S.displayName=`@mantine/core/ActionIconGroupSection`;var C=r((e,{size:t,radius:n,variant:r,gradient:i,color:o,autoContrast:s})=>{let c=e.variantColorResolver({color:o||e.primaryColor,theme:e,gradient:i,variant:r||`filled`,autoContrast:s});return{root:{"--ai-size":p(t,`ai-size`),"--ai-radius":n===void 0?void 0:a(n),"--ai-bg":o||r?c.background:void 0,"--ai-hover":o||r?c.hover:void 0,"--ai-hover-color":o||r?c.hoverColor:void 0,"--ai-color":c.color,"--ai-bd":o||r?c.border:void 0}}}),w=t(e=>{let t=u(`ActionIcon`,null,e),{className:n,unstyled:r,variant:a,classNames:s,styles:c,style:l,loading:f,loaderProps:p,size:v,color:y,radius:b,__staticSelector:x,gradient:S,vars:w,children:T,disabled:E,"data-disabled":D,autoContrast:O,mod:k,attributes:A,...j}=t,M=d({name:[`ActionIcon`,x],props:t,className:n,style:l,classes:g,classNames:s,styles:c,unstyled:r,attributes:A,vars:w,varsResolver:C});return(0,_.jsxs)(o,{...M(`root`,{active:!E&&!f&&!D}),"aria-busy":f||void 0,...j,unstyled:r,variant:a,size:v,disabled:E||f,mod:[{loading:f,disabled:E||D},k],children:[typeof f==`boolean`&&(0,_.jsx)(m,{mounted:f,transition:`slide-down`,duration:150,children:e=>(0,_.jsx)(h,{component:`span`,...M(`loader`,{style:e}),"aria-hidden":!0,children:(0,_.jsx)(i,{color:`var(--ai-color)`,size:`calc(var(--ai-size) * 0.55)`,...p})})}),(0,_.jsx)(h,{component:`span`,mod:{loading:f},...M(`icon`),children:T})]})});w.classes=g,w.varsResolver=C,w.displayName=`@mantine/core/ActionIcon`,w.Group=b,w.GroupSection=S;var T=n(c(),1),E=(0,T.createContext)(null);function D(){let e=(0,T.useContext)(E);if(!e)throw Error(`Fanout app context is unavailable`);return e}var O=`Create a new dashboard for me. First ask what I want to monitor, then design it when you have enough context.`,k={observability_overview:`Checking system health…`,service_topology:`Mapping service dependencies…`,service_performance:`Reading performance signals…`,trace_detail:`Inspecting a trace…`,search_logs:`Searching logs…`,intelligence_snapshot:`Reviewing detected anomalies…`};function A(e){return k[e]??`Working on it…`}var j=`modulepreload`,M=function(e){return`/`+e},N={},P=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=M(t,n),t=s(t),t in N)return;N[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:j,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{D as a,O as i,E as n,w as o,A as r,P as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/preload-helper-xxyQ8-YB.js b/internal/ui/dist/assets/preload-helper-xxyQ8-YB.js deleted file mode 100644 index f2daf761f..000000000 --- a/internal/ui/dist/assets/preload-helper-xxyQ8-YB.js +++ /dev/null @@ -1 +0,0 @@ -import{$ as e,C as t,K as n,N as r,Q as i,S as a,St as o,X as s,Y as c,_ as l,at as u,b as d,dt as f,et as p,gt as m,ht as h,it as g,j as _,k as v,mt as y,nt as b,st as x,v as S,x as C,z as w}from"./brand-MzZ03bSa.js";var T=o(h(),1),E=y(),D=o(m(),1);function O(e){return Array.isArray(e)||e===null?!1:typeof e==`object`&&e.type!==D.Fragment}function k(e){let t=(0,D.createContext)(null);return[t,()=>{let n=(0,D.use)(t);if(n===null)throw Error(e);return n}]}var A={app:100,modal:200,popover:300,overlay:400,max:9999};function j(e){return A[e]}function M(e){let t=(0,D.useRef)(e);return(0,D.useEffect)(()=>{t.current=e}),(0,D.useMemo)(()=>((...e)=>t.current?.(...e)),[])}function N(e,t){let{delay:n,flushOnUnmount:r,leading:i,maxWait:a}=typeof t==`number`?{delay:t,flushOnUnmount:!1,leading:!1,maxWait:void 0}:t,o=M(e),s=(0,D.useRef)(0),c=(0,D.useRef)(0),l=(0,D.useRef)(null),u=(0,D.useMemo)(()=>{let e=Object.assign((...t)=>{window.clearTimeout(s.current),l.current=t;let r=e._isFirstCall;e._isFirstCall=!1;function u(){window.clearTimeout(s.current),window.clearTimeout(c.current),s.current=0,c.current=0,e._isFirstCall=!0,e._hasPendingCallback=!1}function d(){a!==void 0&&c.current===0&&(c.current=window.setTimeout(()=>{if(s.current!==0){let e=l.current;u(),o(...e)}},a))}if(i&&r){o(...t),e.flush=()=>{s.current!==0&&(u(),o(...t))},e.cancel=()=>{u()},s.current=window.setTimeout(()=>{u()},n),d();return}if(i&&!r){e._hasPendingCallback=!0,e.flush=()=>{s.current!==0&&(u(),o(...t))},e.cancel=()=>{u()},s.current=window.setTimeout(()=>{u()},n),d();return}e._hasPendingCallback=!0;let f=()=>{s.current!==0&&(u(),o(...t))};e.flush=f,e.cancel=()=>{u()},s.current=window.setTimeout(f,n),d()},{flush:()=>{},cancel:()=>{},isPending:()=>e._hasPendingCallback,_isFirstCall:!0,_hasPendingCallback:!1});return e},[o,n,i,a]);return(0,D.useEffect)(()=>()=>{r?u.flush():u.cancel()},[u,r]),u}function P(e){return e?.props?.ref}function ee(e){let t=D.Children.toArray(e);return t.length!==1||!O(t[0])?null:t[0]}function te(e,t){return Array.isArray(e)?[...e].reduce((e,n)=>({...e,...te(n,t)}),{}):typeof e==`function`?e(t):e??{}}var ne=(0,D.createContext)({dir:`ltr`,toggleDirection:()=>{},setDirection:()=>{}});function re(){return(0,D.use)(ne)}var[ie,F]=k(`ScrollArea.Root component was not found in tree`);function I(e,t){let n=(0,D.useEffectEvent)(t);b(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e])}function L(e){let{style:t,...n}=e,r=F(),[i,a]=(0,D.useState)(0),[o,s]=(0,D.useState)(0),c=!!(i&&o);return I(r.scrollbarX,()=>{let e=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(e),s(e)}),I(r.scrollbarY,()=>{let e=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(e),a(e)}),c?(0,E.jsx)(`div`,{...n,style:{...t,width:i,height:o}}):null}function ae(e){let t=F(),n=!!(t.scrollbarX&&t.scrollbarY);return t.type!==`scroll`&&n?(0,E.jsx)(L,{...e}):null}var R={scrollHideDelay:1e3,type:`hover`};function oe(t){let{type:n,scrollHideDelay:r,scrollbars:i,getStyles:a,ref:o,...s}=_(`ScrollAreaRoot`,R,t),[c,l]=(0,D.useState)(null),[u,d]=(0,D.useState)(null),[f,p]=(0,D.useState)(null),[m,h]=(0,D.useState)(null),[g,v]=(0,D.useState)(null),[y,b]=(0,D.useState)(0),[x,S]=(0,D.useState)(0),[w,T]=(0,D.useState)(!1),[O,k]=(0,D.useState)(!1),A=e(o,l);return(0,E.jsx)(ie,{value:{type:n,scrollHideDelay:r,scrollArea:c,viewport:u,onViewportChange:d,content:f,onContentChange:p,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:w,onScrollbarXEnabledChange:T,scrollbarY:g,onScrollbarYChange:v,scrollbarYEnabled:O,onScrollbarYEnabledChange:k,onCornerWidthChange:b,onCornerHeightChange:S,getStyles:a},children:(0,E.jsx)(C,{...s,ref:A,__vars:{"--sa-corner-width":i===`xy`?`${y}px`:`0px`,"--sa-corner-height":i===`xy`?`${x}px`:`0px`}})})}oe.displayName=`@mantine/core/ScrollAreaRoot`;function se(e,t){let n=e/t;return Number.isNaN(n)?0:n}function ce(e){let t=se(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function le(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function ue(e,[t,n]){return Math.min(n,Math.max(t,e))}function de(e,t,n=`ltr`){let r=ce(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=ue(e,n===`ltr`?[0,o]:[o*-1,0]);return le([0,o],[0,s])(c)}function fe(e,t,n,r=`ltr`){let i=ce(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return le([c,l],d)(e)}function pe(e,t){return e>0&&e{e?.(r),(n===!1||!r.defaultPrevented)&&t?.(r)}}var[z,ge]=k(`ScrollAreaScrollbar was not found in tree`);function _e(t){let{sizes:n,hasThumb:r,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:s,onDragScroll:c,onWheelScroll:l,onResize:u,ref:d,...f}=t,p=F(),[m,h]=(0,D.useState)(null),g=e(d,h),_=(0,D.useRef)(null),v=(0,D.useRef)(``),{viewport:y}=p,b=n.content-n.viewport,x=(0,D.useEffectEvent)(l),S=M(s),C=N(u,10),w=e=>{if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;c({x:t,y:n})}};return(0,D.useEffect)(()=>{let e=e=>{let t=e.target;m?.contains(t)&&x(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b]),(0,D.useEffect)(S,[n,S]),I(m,C),I(p.content,C),(0,E.jsx)(z,{value:{scrollbar:m,hasThumb:r,onThumbChange:M(i),onThumbPointerUp:M(a),onThumbPositionChange:S,onThumbPointerDown:M(o)},children:(0,E.jsx)(`div`,{...f,ref:g,"data-mantine-scrollbar":!0,style:{position:`absolute`,...f.style},onPointerDown:he(t.onPointerDown,e=>{e.preventDefault(),e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,w(e))}),onPointerMove:he(t.onPointerMove,w),onPointerUp:he(t.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(e.preventDefault(),t.releasePointerCapture(e.pointerId))}),onLostPointerCapture:()=>{document.body.style.webkitUserSelect=v.current,_.current=null}})})}var ve=t=>{let{sizes:n,onSizesChange:r,style:i,ref:a,...o}=t,s=F(),[c,l]=(0,D.useState)(),u=(0,D.useRef)(null),d=e(a,u,s.onScrollbarXChange);return(0,D.useEffect)(()=>{u.current&&l(getComputedStyle(u.current))},[u]),(0,E.jsx)(_e,{"data-orientation":`horizontal`,...o,ref:d,sizes:n,style:{...i,"--sa-thumb-width":`${ce(n)}px`},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,n)=>{if(s.viewport){let r=s.viewport.scrollLeft+e.deltaX;t.onWheelScroll(r),pe(r,n)&&e.preventDefault()}},onResize:()=>{u.current&&s.viewport&&c&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:me(c.paddingLeft),paddingEnd:me(c.paddingRight)}})}})};ve.displayName=`@mantine/core/ScrollAreaScrollbarX`;function ye(t){let{sizes:n,onSizesChange:r,style:i,ref:a,...o}=t,s=F(),[c,l]=(0,D.useState)(),u=(0,D.useRef)(null),d=e(a,u,s.onScrollbarYChange);return(0,D.useEffect)(()=>{u.current&&l(window.getComputedStyle(u.current))},[]),(0,E.jsx)(_e,{...o,"data-orientation":`vertical`,ref:d,sizes:n,style:{"--sa-thumb-height":`${ce(n)}px`,...i},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,n)=>{if(s.viewport){let r=s.viewport.scrollTop+e.deltaY;t.onWheelScroll(r),pe(r,n)&&e.preventDefault()}},onResize:()=>{u.current&&s.viewport&&c&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:me(c.paddingTop),paddingEnd:me(c.paddingBottom)}})}})}ye.displayName=`@mantine/core/ScrollAreaScrollbarY`;function B(e){let{orientation:t=`vertical`,...n}=e,{dir:r}=re(),i=F(),a=(0,D.useRef)(null),o=(0,D.useRef)(0),[s,c]=(0,D.useState)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=se(s.viewport,s.content),u={...n,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>{a.current=e},onThumbPointerUp:()=>{o.current=0},onThumbPointerDown:e=>{o.current=e}},d=(e,t)=>fe(e,o.current,s,t);return t===`horizontal`?(0,E.jsx)(ve,{...u,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=de(e,s,r);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,r))}}):t===`vertical`?(0,E.jsx)(ye,{...u,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=de(e,s);s.scrollbar.size===0?a.current.style.setProperty(`--thumb-opacity`,`0`):a.current.style.setProperty(`--thumb-opacity`,`1`),a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}B.displayName=`@mantine/core/ScrollAreaScrollbarVisible`;function be(e){let t=F(),{forceMount:n,...r}=e,[i,a]=(0,D.useState)(!1),o=e.orientation===`horizontal`,s=N(()=>{if(t.viewport){let e=t.viewport.offsetWidth{let{scrollArea:e}=r,t=0;if(e){let n=()=>{window.clearTimeout(t),a(!0)},i=()=>{t=window.setTimeout(()=>a(!1),r.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,i),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,i)}}},[r.scrollArea,r.scrollHideDelay]),t||i?(0,E.jsx)(be,{"data-state":i?`visible`:`hidden`,...n}):null}xe.displayName=`@mantine/core/ScrollAreaScrollbarHover`;function Se(e){let{forceMount:t,...n}=e,r=F(),i=e.orientation===`horizontal`,[a,o]=(0,D.useState)(`hidden`),s=N(()=>o(`idle`),100);return(0,D.useEffect)(()=>{if(a===`idle`){let e=window.setTimeout(()=>o(`hidden`),r.scrollHideDelay);return()=>window.clearTimeout(e)}},[a,r.scrollHideDelay]),(0,D.useEffect)(()=>{let{viewport:e}=r,t=i?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(o(`scrolling`),s()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[r.viewport,i,s]),t||a!==`hidden`?(0,E.jsx)(B,{"data-state":a===`hidden`?`hidden`:`visible`,...n,onPointerEnter:he(e.onPointerEnter,()=>o(`interacting`)),onPointerLeave:he(e.onPointerLeave,()=>o(`idle`))}):null}function Ce(e){let{forceMount:t,...n}=e,r=F(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=r,o=e.orientation===`horizontal`;return(0,D.useEffect)(()=>(o?i(!0):a(!0),()=>{o?i(!1):a(!1)}),[o,i,a]),r.type===`hover`?(0,E.jsx)(xe,{...n,forceMount:t}):r.type===`scroll`?(0,E.jsx)(Se,{...n,forceMount:t}):r.type===`auto`?(0,E.jsx)(be,{...n,forceMount:t}):r.type===`always`?(0,E.jsx)(B,{...n}):null}Ce.displayName=`@mantine/core/ScrollAreaScrollbar`;function we(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)}function Te(t){let{style:n,ref:r,...i}=t,a=F(),o=ge(),{onThumbPositionChange:s}=o,c=e(r,o.onThumbChange),l=(0,D.useRef)(void 0),u=N(()=>{l.current&&=(l.current(),void 0)},100);return(0,D.useEffect)(()=>{let{viewport:e}=a;if(e){let t=()=>{if(u(),!l.current){let t=we(e,s);l.current=t,s()}};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,E.jsx)(`div`,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--sa-thumb-width)`,height:`var(--sa-thumb-height)`,...n},onPointerDownCapture:he(t.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:he(t.onPointerUp,o.onThumbPointerUp)})}Te.displayName=`@mantine/core/ScrollAreaThumb`;function Ee(e){let{forceMount:t,...n}=e,r=ge();return t||r.hasThumb?(0,E.jsx)(Te,{...n}):null}Ee.displayName=`@mantine/core/ScrollAreaThumb`;function De({children:t,style:n,ref:r,onWheel:i,...a}){let o=F(),s=e(r,o.onViewportChange),c=e=>{if(i?.(e),o.scrollbarXEnabled&&o.viewport&&e.shiftKey){let{scrollTop:t,scrollHeight:n,clientHeight:r,scrollWidth:i,clientWidth:a}=o.viewport,s=t<1,c=t>=n-r-1;i>a&&(s||c)&&e.stopPropagation()}};return(0,E.jsx)(C,{...a,ref:s,onWheel:c,"data-scrollarea-viewport":!0,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...n},children:(0,E.jsx)(`div`,{...o.getStyles(`content`),ref:o.onContentChange,children:t})})}De.displayName=`@mantine/core/ScrollAreaViewport`;var Oe={root:`m_d57069b5`,content:`m_b1336c6`,viewport:`m_c0783ff9`,viewportInner:`m_f8f631dd`,scrollbar:`m_c44ba933`,thumb:`m_d8b5e363`,corner:`m_21657268`};function ke(){return typeof window<`u`}function Ae(e){return je(e)?(e.nodeName||``).toLowerCase():`#document`}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function H(e){return((je(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function je(e){return ke()?e instanceof Node||e instanceof V(e).Node:!1}function U(e){return ke()?e instanceof Element||e instanceof V(e).Element:!1}function W(e){return ke()?e instanceof HTMLElement||e instanceof V(e).HTMLElement:!1}function Me(e){return!ke()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}function Ne(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=G(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Pe(e){return/^(table|td|th)$/.test(Ae(e))}function Fe(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ie=/transform|translate|scale|rotate|perspective|filter/,Le=/paint|layout|strict|content/,Re=e=>!!e&&e!==`none`,ze;function Be(e){let t=U(e)?G(e):e;return Re(t.transform)||Re(t.translate)||Re(t.scale)||Re(t.rotate)||Re(t.perspective)||!He()&&(Re(t.backdropFilter)||Re(t.filter))||Ie.test(t.willChange||``)||Le.test(t.contain||``)}function Ve(e){let t=Ge(e);for(;W(t)&&!Ue(t);){if(Be(t))return t;if(Fe(t))return null;t=Ge(t)}return null}function He(){return ze??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ze}function Ue(e){return/^(html|body|#document)$/.test(Ae(e))}function G(e){return V(e).getComputedStyle(e)}function We(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ge(e){if(Ae(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Me(e)&&e.host||H(e);return Me(t)?t.host:t}function Ke(e){let t=Ge(e);return Ue(t)?(e.ownerDocument||e).body:W(t)&&Ne(t)?t:Ke(t)}function qe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ke(e),i=r===e.ownerDocument?.body,a=V(r);if(i){let e=Je(a);return t.concat(a,a.visualViewport||[],Ne(r)?r:[],e&&n?qe(e):[])}return t.concat(r,qe(r,[],n))}function Je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Ye=[`top`,`right`,`bottom`,`left`],K=Math.min,q=Math.max,Xe=Math.round,Ze=Math.floor,Qe=e=>({x:e,y:e}),$e={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function et(e,t,n){return q(e,K(t,n))}function J(e,t){return typeof e==`function`?e(t):e}function Y(e){return e.split(`-`)[0]}function tt(e){return e.split(`-`)[1]}function nt(e){return e===`x`?`y`:`x`}function rt(e){return e===`y`?`height`:`width`}function X(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function it(e){return nt(X(e))}function at(e,t,n){n===void 0&&(n=!1);let r=tt(e),i=it(e),a=rt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=mt(o)),[o,mt(o)]}function ot(e){let t=mt(e);return[st(e),t,st(t)]}function st(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ct=[`left`,`right`],lt=[`right`,`left`],ut=[`top`,`bottom`],dt=[`bottom`,`top`];function ft(e,t,n){switch(e){case`top`:case`bottom`:return n?t?lt:ct:t?ct:lt;case`left`:case`right`:return t?ut:dt;default:return[]}}function pt(e,t,n,r){let i=tt(e),a=ft(Y(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(st)))),a}function mt(e){let t=Y(e);return $e[t]+e.slice(t.length)}function ht(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function gt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ht(e)}function _t(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function vt(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function yt(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function bt(){return/apple/i.test(navigator.vendor)}function xt(){return vt().toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints}function St(){return yt().includes(`jsdom/`)}var Ct=`data-floating-ui-focusable`,wt=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function Tt(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Et(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Me(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Dt(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Ot(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function kt(e){return e.matches(`html,body`)}function At(e){return e?.ownerDocument||document}function jt(e){return W(e)&&e.matches(wt)}function Mt(e){if(!e||St())return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Nt(e){return e?e.hasAttribute(Ct)?e:e.querySelector(`[`+Ct+`]`)||e:null}function Pt(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Pt(e,t.id,n)])}function Ft(e){return`nativeEvent`in e}function It(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var Z=typeof document<`u`?D.useLayoutEffect:function(){},Lt={...D};function Rt(e){let t=D.useRef(e);return Z(()=>{t.current=e}),t}var zt=Lt.useInsertionEffect||(e=>e());function Q(e){let t=D.useRef(()=>{});return zt(()=>{t.current=e}),D.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Bt(e,t,n){let{reference:r,floating:i}=e,a=X(t),o=it(t),s=rt(o),c=Y(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=tt(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Vt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=J(t,e),p=gt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_t(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=_t(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ht=50,Ut=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Vt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Bt(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=J(e,t)||{};if(l==null)return{};let d=gt(u),f={x:n,y:r},p=it(i),m=rt(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=K(d[_],T),D=K(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=et(E,k,O),j=!c.arrow&&tt(i)!=null&&k!==A&&a.reference[m]/2-(ke<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===X(t)||T.every(e=>X(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=X(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Kt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qt(e){return Ye.some(t=>e[t]>=0)}var Jt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=J(e,t);switch(i){case`referenceHidden`:{let e=Kt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:qt(e)}}}case`escaped`:{let e=Kt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:qt(e)}}}default:return{}}}}};function Yt(e){let t=K(...e.map(e=>e.left)),n=K(...e.map(e=>e.top)),r=q(...e.map(e=>e.right)),i=q(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function Xt(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;er.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>_t(Yt(e)))}var Zt=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:a,strategy:o}=t,{padding:s=2,x:c,y:l}=J(e,t),u=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]);if(!u.length)return{};let d=Xt(u),f=_t(Yt(u)),p=gt(s);function m(){if(d.length===2&&(d[0].left>d[1].right||d[1].left>d[0].right)&&c!=null&&l!=null)return d.find(e=>c>e.left-p.left&&ce.top-p.top&&l=2){if(X(n)===`y`){let e=d[0],t=d[d.length-1],r=Y(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left;return _t({x:o,y:i,width:(r?e.right:t.right)-o,height:a-i})}let e=Y(n)===`left`,t=q(...d.map(e=>e.right)),r=K(...d.map(e=>e.left)),i=d.filter(n=>e?n.left===r:n.right===t),a=i[0].top,o=i[i.length-1].bottom;return _t({x:r,y:a,width:t-r,height:o-a})}return f}let h=await a.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Qt=new Set([`left`,`top`]);async function $t(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Y(n),s=tt(n),c=X(n)===`y`,l=Qt.has(o)?-1:1,u=a&&c?-1:1,d=J(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var en=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await $t(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},tn=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=J(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=X(i),p=nt(f),m=u[p],h=u[f],g=(e,t)=>et(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},nn=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=J(e,t),u={x:n,y:r},d=X(i),f=nt(d),p=u[f],m=u[d],h=J(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Qt.has(Y(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},rn=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=J(e,t),c=await i.detectOverflow(t,s),l=Y(n),u=tt(n),d=X(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=K(p-c[m],g),y=K(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*q(c.left,c.right):S=p-2*q(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function an(e){let t=G(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=W(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Xe(n)!==a||Xe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function on(e){return U(e)?e:e.contextElement}function sn(e){let t=on(e);if(!W(t))return Qe(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=an(t),o=(a?Xe(n.width):n.width)/r,s=(a?Xe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var cn=Qe(0);function ln(e){let t=V(e);return!He()||!t.visualViewport?cn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function un(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===V(e)}function dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=on(e),o=Qe(1);t&&(r?U(r)&&(o=sn(r)):o=sn(e));let s=un(a,n,r)?ln(a):Qe(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=V(a),t=U(r)?V(r):r,n=e,i=Je(n);for(;i&&t!==n;){let e=sn(i),t=i.getBoundingClientRect(),r=G(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=V(i),i=Je(n)}}return _t({width:u,height:d,x:c,y:l})}function fn(e,t){let n=We(e).scrollLeft;return t?t.left+n:dn(H(e)).left+n}function pn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-fn(e,n),y:n.top+t.scrollTop}}function mn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=H(r),s=t?Fe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Qe(1),u=Qe(0),d=W(r);if((d||!a)&&((Ae(r)!==`body`||Ne(o))&&(c=We(r)),d)){let e=dn(r);l=sn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?pn(o,c):Qe(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function hn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function gn(e){let t=We(e),n=e.ownerDocument.body,r=q(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=q(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+fn(e),o=-t.scrollTop;return G(n).direction===`rtl`&&(a+=q(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var _n=25;function vn(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=V(e),a=H(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!He()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(fn(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=_n&&(s-=o)}return{width:s,height:c,x:l,y:u}}function yn(e,t){let n=dn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=sn(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function bn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=vn(e,n,t);else if(t===`document`)r=gn(H(e));else if(U(t))r=yn(t,n);else{let n=ln(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _t(r)}function xn(e,t){let n=t.get(e);if(n)return n;let r=qe(e,[],!1).filter(e=>U(e)&&Ae(e)!==`body`),i=null,a=G(e).position===`fixed`,o=a?Ge(e):e;for(;U(o)&&!Ue(o);){let e=G(o),t=Be(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Ge(o)}return t.set(e,r),r}function Sn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Fe(t)?[]:xn(t,this._c):[].concat(n),r],o=bn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=V(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Nn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=on(e),u=i||a?[...l?qe(l):[],...t?qe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Mn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?dn(e):null;c&&g();function g(){let t=dn(e);h&&!jn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Pn=en,Fn=tn,In=Gt,Ln=rn,Rn=Jt,zn=Wt,Bn=Zt,Vn=nn,Hn=(e,t,n)=>{let r=new Map,i=n??{},a={...An,...i.platform,_c:r};return Ut(e,t,{...i,platform:a})},Un=typeof document<`u`?D.useLayoutEffect:function(){};function Wn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Wn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Wn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Gn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Kn(e,t){let n=Gn(e);return Math.round(t*n)/n}function qn(e){let t=D.useRef(e);return Un(()=>{t.current=e}),t}function Jn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=D.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=D.useState(r);Wn(f,r)||p(r);let[m,h]=D.useState(null),[g,_]=D.useState(null),v=D.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=D.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=D.useRef(null),C=D.useRef(null),w=D.useRef(u),E=c!=null,O=qn(c),k=qn(i),A=qn(l),j=D.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),Hn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Wn(w.current,t)&&(w.current=t,T.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Un(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=D.useRef(!1);Un(()=>(M.current=!0,()=>{M.current=!1}),[]),Un(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(O.current)return O.current(b,x,j);j()}},[b,x,j,O,E]);let N=D.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),P=D.useMemo(()=>({reference:b,floating:x}),[b,x]),ee=D.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Kn(P.floating,u.x),r=Kn(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Gn(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return D.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:ee}),[u,j,N,P,ee])}var Yn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:zn({element:r.current,padding:i}).fn(n):r?zn({element:r,padding:i}).fn(n):{}}}},Xn=(e,t)=>{let n=Pn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zn=(e,t)=>{let n=Fn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qn=(e,t)=>({fn:Vn(e).fn,options:[e,t]}),$n=(e,t)=>{let n=In(e);return{name:n.name,fn:n.fn,options:[e,t]}},er=(e,t)=>{let n=Ln(e);return{name:n.name,fn:n.fn,options:[e,t]}},tr=(e,t)=>{let n=Rn(e);return{name:n.name,fn:n.fn,options:[e,t]}},nr=(e,t)=>{let n=Bn(e);return{name:n.name,fn:n.fn,options:[e,t]}},rr=(e,t)=>{let n=Yn(e);return{name:n.name,fn:n.fn,options:[e,t]}};function ir(e){let t=D.useRef(void 0),n=D.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return D.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}var ar=`data-floating-ui-focusable`,or=`active`,sr=`selected`,cr=`ArrowLeft`,lr=`ArrowRight`,ur=`ArrowUp`,dr=`ArrowDown`,fr=[cr,lr],pr=[ur,dr];[...fr,...pr];var mr={...D},hr=!1,gr=0,_r=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+gr++;function vr(){let[e,t]=D.useState(()=>hr?_r():void 0);return Z(()=>{e??t(_r())},[]),D.useEffect(()=>{hr=!0},[]),e}var yr=mr.useId||vr;function br(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var xr=D.createContext(null),Sr=D.createContext(null),Cr=()=>D.useContext(xr)?.id||null,wr=()=>D.useContext(Sr);function Tr(e){return`data-floating-ui-`+e}function $(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var Er=Tr(`safe-polygon`);function Dr(e,t,n){if(n&&!It(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function Or(e){return typeof e==`function`?e():e}function kr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,p=wr(),m=Cr(),h=Rt(l),g=Rt(c),_=Rt(n),v=Rt(d),y=D.useRef(),b=D.useRef(-1),x=D.useRef(),S=D.useRef(-1),C=D.useRef(!0),w=D.useRef(!1),T=D.useRef(()=>{}),E=D.useRef(!1),O=Q(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});D.useEffect(()=>{if(!s)return;function e(e){let{open:t}=e;t||($(b),$(S),C.current=!0,E.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),D.useEffect(()=>{if(!s||!h.current||!n)return;function e(e){O()&&r(!1,e,`hover`)}let t=At(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,O]);let k=D.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Dr(g.current,`close`,y.current);i&&!x.current?($(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&($(b),r(!1,e,n))},[g,r]),A=Q(()=>{T.current(),x.current=void 0}),j=Q(()=>{if(w.current){let e=At(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(Er),w.current=!1}}),M=Q(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);D.useEffect(()=>{if(!s)return;function e(e){if($(b),C.current=!1,u&&!It(y.current)||Or(v.current)>0&&!Dr(g.current,`open`))return;let t=Dr(g.current,`open`,y.current);t?b.current=window.setTimeout(()=>{_.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(M()){j();return}T.current();let t=At(o.floating);if($(S),E.current=!1,h.current&&i.current.floatingContext){n||$(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){j(),A(),M()||k(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),T.current=()=>{t.removeEventListener(`mousemove`,r)};return}(y.current!==`touch`||!Et(o.floating,e.relatedTarget))&&k(e)}function a(e){M()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){j(),A(),M()||k(e)}})(e))}function c(){$(b)}function l(e){M()||k(e,!1)}if(U(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),f&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,c),i.addEventListener(`mouseleave`,l)),()=>{n&&r.removeEventListener(`mouseleave`,a),f&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,c),i.removeEventListener(`mouseleave`,l))}}},[o,s,e,u,f,k,A,j,r,n,_,p,g,h,i,M,v]),Z(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&O()){w.current=!0;let e=o.floating;if(U(o.domReference)&&e){var t;let n=At(o.floating).body;n.setAttribute(Er,``);let r=o.domReference,i=p==null||(t=p.nodesRef.current.find(e=>e.id===m))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,m,o,p,h,O]),Z(()=>{n||(y.current=void 0,E.current=!1,A(),j())},[n,A,j]),D.useEffect(()=>()=>{A(),$(b),$(S),j()},[s,o.domReference,A,j]);let N=D.useMemo(()=>{function e(e){y.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!C.current&&!_.current&&r(!0,t,`hover`)}(!u||It(y.current))&&(n||Or(v.current)===0||E.current&&e.movementX**2+e.movementY**2<2||($(S),y.current===`touch`?i():(E.current=!0,S.current=window.setTimeout(i,Or(v.current)))))}}},[u,r,n,_,v]);return D.useMemo(()=>s?{reference:N}:{},[s,N])}var Ar=()=>{},jr=D.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Ar,setState:Ar,isInstantPhase:!1}),Mr=()=>D.useContext(jr);function Nr(e){let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=D.useReducer((e,t)=>({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=D.useRef(null),s=D.useCallback(e=>{a({currentId:e})},[]);return Z(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||a({isInstantPhase:!0}):(i.isInstantPhase&&a({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),(0,E.jsx)(jr.Provider,{value:D.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,s]),children:t})}function Pr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,floatingId:i}=e,{id:a,enabled:o=!0}=t,s=a??i,c=Mr(),{currentId:l,setCurrentId:u,initialDelay:d,setState:f,timeoutMs:p}=c;return Z(()=>{o&&l&&(f({delay:{open:1,close:Dr(d,`close`)}}),l!==s&&r(!1))},[o,s,r,f,l,d]),Z(()=>{function e(){r(!1),f({delay:d,currentId:null})}if(o&&l&&!n&&l===s){if(p){let t=window.setTimeout(e,p);return()=>{clearTimeout(t)}}e()}},[o,n,f,l,s,r,d,p]),Z(()=>{o&&u!==Ar&&n&&u(s)},[o,n,u,s]),c}function Fr(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Me(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ir(e){return`composedPath`in e?e.composedPath()[0]:e.target}var Lr={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Rr={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},zr=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function Br(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:i,dataRef:a}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`pointerdown`,referencePress:u=!1,referencePressEvent:d=`pointerdown`,ancestorScroll:f=!1,bubbles:p,capture:m}=t,h=wr(),g=Q(typeof c==`function`?c:()=>!1),_=typeof c==`function`?g:c,v=D.useRef(!1),{escapeKey:y,outsidePress:b}=zr(p),{escapeKey:x,outsidePress:S}=zr(m),C=D.useRef(!1),w=Q(e=>{if(!n||!o||!s||e.key!==`Escape`||C.current)return;let t=a.current.floatingContext?.nodeId,i=h?Pt(h.nodesRef.current,t):[];if(!y&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}r(!1,Ft(e)?e.nativeEvent:e,`escape-key`)}),T=Q(e=>{var t;let n=()=>{var t;w(e),(t=Dt(e))==null||t.removeEventListener(`keydown`,n)};(t=Dt(e))==null||t.addEventListener(`keydown`,n)}),E=Q(e=>{let t=a.current.insideReactTree;a.current.insideReactTree=!1;let n=v.current;if(v.current=!1,l===`click`&&n||t||typeof _==`function`&&!_(e))return;let o=Dt(e),s=`[`+Tr(`inert`)+`]`,c=At(i.floating).querySelectorAll(s),u=U(o)?o:null;for(;u&&!Ue(u);){let e=Ge(u);if(Ue(e)||!U(e))break;u=e}if(c.length&&U(o)&&!kt(o)&&!Et(o,i.floating)&&Array.from(c).every(e=>!Et(u,e)))return;if(W(o)&&A){let t=Ue(o),n=G(o),r=/auto|scroll/,i=t||r.test(n.overflowX),a=t||r.test(n.overflowY),s=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,c=a&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),d=s&&e.offsetY>o.clientHeight;if(u||d)return}let d=a.current.floatingContext?.nodeId,f=h&&Pt(h.nodesRef.current,d).some(t=>Ot(e,t.context?.elements.floating));if(Ot(e,i.floating)||Ot(e,i.domReference)||f)return;let p=h?Pt(h.nodesRef.current,d):[];if(p.length>0){let e=!0;if(p.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}r(!1,e,`outside-press`)}),O=Q(e=>{var t;let n=()=>{var t;E(e),(t=Dt(e))==null||t.removeEventListener(l,n)};(t=Dt(e))==null||t.addEventListener(l,n)});D.useEffect(()=>{if(!n||!o)return;a.current.__escapeKeyBubbles=y,a.current.__outsidePressBubbles=b;let e=-1;function t(e){r(!1,e,`ancestor-scroll`)}function c(){window.clearTimeout(e),C.current=!0}function u(){e=window.setTimeout(()=>{C.current=!1},He()?5:0)}let d=At(i.floating);s&&(d.addEventListener(`keydown`,x?T:w,x),d.addEventListener(`compositionstart`,c),d.addEventListener(`compositionend`,u)),_&&d.addEventListener(l,S?O:E,S);let p=[];return f&&(U(i.domReference)&&(p=qe(i.domReference)),U(i.floating)&&(p=p.concat(qe(i.floating))),!U(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(qe(i.reference.contextElement)))),p=p.filter(e=>e!==d.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t)}),()=>{s&&(d.removeEventListener(`keydown`,x?T:w,x),d.removeEventListener(`compositionstart`,c),d.removeEventListener(`compositionend`,u)),_&&d.removeEventListener(l,S?O:E,S),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[a,i,s,_,l,n,r,f,o,y,b,w,x,T,E,S,O]),D.useEffect(()=>{a.current.insideReactTree=!1},[a,_,l]);let k=D.useMemo(()=>({onKeyDown:w,...u&&{[Lr[d]]:e=>{r(!1,e.nativeEvent,`reference-press`)},...d!==`click`&&{onClick(e){r(!1,e.nativeEvent,`reference-press`)}}}}),[w,r,u,d]),A=D.useMemo(()=>{function e(e){e.button===0&&(v.current=!0)}return{onKeyDown:w,onMouseDown:e,onMouseUp:e,[Rr[l]]:()=>{a.current.insideReactTree=!0}}},[w,l,a]);return D.useMemo(()=>o?{reference:k,floating:A}:{},[o,k,A])}function Vr(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=yr(),a=D.useRef({}),[o]=D.useState(()=>br()),s=Cr()!=null,[c,l]=D.useState(r.reference),u=Q((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=D.useMemo(()=>({setPositionReference:l}),[]),f=D.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return D.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function Hr(e){let{elements:t,...n}=e===void 0?{}:e,{nodeId:r}=n,i=Vr({...n,elements:{reference:t?.reference??null,floating:t?.floating??null}}),a=n.rootContext||i,o=a.elements,[s,c]=D.useState(null),[l,u]=D.useState(null),d=o?.domReference||s,f=D.useRef(null),p=wr();Z(()=>{d&&(f.current=d)},[d]);let m=Jn({...n,elements:{...o,...l&&{reference:l}}}),h=D.useCallback(e=>{let t=U(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=D.useCallback(e=>{(U(e)||e===null)&&(f.current=e,c(e)),(U(m.refs.reference.current)||m.refs.reference.current===null||e!==null&&!U(e))&&m.refs.setReference(e)},[m.refs]),_=D.useMemo(()=>({...m.refs,setReference:g,setPositionReference:h,domReference:f}),[m.refs,g,h]),v=D.useMemo(()=>({...m.elements,domReference:d}),[m.elements,d]),y=D.useMemo(()=>({...m,...a,refs:_,elements:v,nodeId:r}),[m,_,v,r,a]);return Z(()=>{a.dataRef.current.floatingContext=y;let e=p?.nodesRef.current.find(e=>e.id===r);e&&(e.context=y)}),D.useMemo(()=>({...m,context:y,refs:_,elements:v}),[m,_,v,y])}function Ur(){return xt()&&bt()}function Wr(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,events:i,dataRef:a,elements:o}=e,{enabled:s=!0,visibleOnly:c=!0}=t,l=D.useRef(!1),u=D.useRef(-1),d=D.useRef(!0);D.useEffect(()=>{if(!s)return;let e=V(o.domReference);function t(){!n&&W(o.domReference)&&o.domReference===Tt(At(o.domReference))&&(l.current=!0)}function r(){d.current=!0}function i(){d.current=!1}return e.addEventListener(`blur`,t),Ur()&&(e.addEventListener(`keydown`,r,!0),e.addEventListener(`pointerdown`,i,!0)),()=>{e.removeEventListener(`blur`,t),Ur()&&(e.removeEventListener(`keydown`,r,!0),e.removeEventListener(`pointerdown`,i,!0))}},[o.domReference,n,s]),D.useEffect(()=>{if(!s)return;function e(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(l.current=!0)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[i,s]),D.useEffect(()=>()=>{$(u)},[]);let f=D.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(e){if(l.current)return;let t=Dt(e.nativeEvent);if(c&&U(t)){if(Ur()&&!e.relatedTarget){if(!d.current&&!jt(t))return}else if(!Mt(t))return}r(!0,e.nativeEvent,`focus`)},onBlur(e){l.current=!1;let t=e.relatedTarget,n=e.nativeEvent,i=U(t)&&t.hasAttribute(Tr(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;u.current=window.setTimeout(()=>{let e=Tt(o.domReference?o.domReference.ownerDocument:document);(t||e!==o.domReference)&&(Et(a.current.floatingContext?.refs.floating.current,e)||Et(o.domReference,e)||i||r(!1,n,`focus`))})}}),[a,o.domReference,r,c]);return D.useMemo(()=>s?{reference:f}:{},[s,f])}function Gr(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[or]:t,[sr]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[ar]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[or,sr].includes(n))){if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}}),e),{})}}function Kr(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=D.useCallback(t=>Gr(t,e,`reference`),t),a=D.useCallback(t=>Gr(t,e,`floating`),n),o=D.useCallback(t=>Gr(t,e,`item`),r);return D.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var qr=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Jr(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=yr(),c=r.domReference?.id||s,l=D.useMemo(()=>Nt(r.floating)?.id||i,[r.floating,i]),u=qr.get(o)??o,d=Cr()!=null,f=D.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=D.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=D.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return D.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}function Yr(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Yr(e,t.id,n)])}function Xr(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function Zr(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Qr(e){e===void 0&&(e={});let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i={current:-1},a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=e=>{let{x:n,y:o,placement:s,elements:c,onClose:u,nodeId:d,tree:f}=e;return function(e){function p(){$(i),u()}if($(i),!c.domReference||!c.floating||s==null||n==null||o==null)return;let{clientX:m,clientY:h}=e,g=[m,h],_=Ir(e),v=e.type===`mouseleave`,y=Fr(c.floating,_),b=Fr(c.domReference,_),x=c.domReference.getBoundingClientRect(),S=c.floating.getBoundingClientRect(),C=s.split(`-`)[0],w=n>S.right-S.width/2,T=o>S.bottom-S.height/2,E=Zr(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&U(e.relatedTarget)&&Fr(c.floating,e.relatedTarget)||f&&Yr(f.nodesRef.current,d).length)return;if(C===`top`&&o>=x.bottom-1||C===`bottom`&&o<=x.top+1||C===`left`&&n>=x.right-1||C===`right`&&n<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]]}function P(e){let[n,r]=e;switch(C){case`top`:return[[D?n+t/2:w?n+t*4:n-t*4,r+t+1],[D?n-t/2:w?n+t*4:n-t*4,r+t+1],[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]];case`bottom`:return[[D?n+t/2:w?n+t*4:n-t*4,r-t],[D?n-t/2:w?n+t*4:n-t*4,r-t],[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]];case`left`:{let e=[n+t+1,O?r+t/2:T?r+t*4:r-t*4],i=[n+t+1,O?r-t/2:T?r+t*4:r-t*4];return[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom],e,i]}case`right`:return[[n-t,O?r+t/2:T?r+t*4:r-t*4],[n-t,O?r-t/2:T?r+t*4:r-t*4],[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]]}}if(!Xr([m,h],N)){if(a&&!E)return p();if(!v&&r){let t=l(e.clientX,e.clientY);if(t!==null&&t<.1)return p()}Xr([m,h],P([n,o]))?!a&&r&&(i.current=window.setTimeout(p,40)):p()}}};return u.__options={blockPointerEvents:n},u}var $r={scrollHideDelay:1e3,type:`hover`,scrollbars:`xy`},ei=s((e,{scrollbarSize:t,overscrollBehavior:n,scrollbars:r})=>{let i=n;return n&&r&&(r===`x`?i=`${n} auto`:r===`y`&&(i=`auto ${n}`)),{root:{"--scrollarea-scrollbar-size":f(t),"--scrollarea-over-scroll-behavior":i}}}),ti=t(e=>{let t=_(`ScrollArea`,$r,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,scrollbarSize:s,vars:c,type:l,scrollHideDelay:u,viewportProps:d,viewportRef:f,onScrollPositionChange:p,children:m,offsetScrollbars:h,scrollbars:g,onBottomReached:y,onTopReached:x,onLeftReached:S,onRightReached:C,overscrollBehavior:w,startScrollPosition:T,verticalScrollbarPosition:O,attributes:k,...A}=t,[j,M]=(0,D.useState)(!1),[N,P]=(0,D.useState)(!1),[ee,te]=(0,D.useState)(!1),ne=(0,D.useRef)(!0),re=(0,D.useRef)(!1),ie=(0,D.useRef)(!0),F=(0,D.useRef)(!1),L=v({name:`ScrollArea`,props:t,classes:Oe,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:k,vars:c,varsResolver:ei}),R=(0,D.useRef)(null),[se,ce]=(0,D.useState)(null),le=ir([f,R,(0,D.useCallback)(e=>{ce(t=>t===e?t:e)},[])]);return I(h===`present`?se:null,()=>{let e=R.current;e&&(P(e.scrollHeight>e.clientHeight),te(e.scrollWidth>e.clientWidth))}),b(()=>{T&&R.current&&R.current.scrollTo({left:T.x??0,top:T.y??0})},[]),(0,E.jsxs)(oe,{getStyles:L,type:l===`never`?`always`:l,scrollHideDelay:u,scrollbars:g,...L(`root`),...A,children:[(0,E.jsx)(De,{...d,...L(`viewport`,{style:d?.style}),ref:le,"data-offset-scrollbars":h===!0?`xy`:h||void 0,"data-scrollbars":g||void 0,"data-vertical-scrollbar-position":O||void 0,"data-horizontal-hidden":h===`present`&&!ee?`true`:void 0,"data-vertical-hidden":h===`present`&&!N?`true`:void 0,onScroll:e=>{d?.onScroll?.(e),p?.({x:e.currentTarget.scrollLeft,y:e.currentTarget.scrollTop});let{scrollTop:t,scrollHeight:n,clientHeight:r,scrollLeft:i,scrollWidth:a,clientWidth:o}=e.currentTarget,s=t-(n-r)>=-.8,c=t===0;s&&!re.current&&y?.(),c&&!ne.current&&x?.(),re.current=s,ne.current=c;let l=i-(a-o)>=-.8,u=i===0;l&&!F.current&&C?.(),u&&!ie.current&&S?.(),F.current=l,ie.current=u},children:m}),(g===`xy`||g===`x`)&&(0,E.jsx)(Ce,{...L(`scrollbar`),orientation:`horizontal`,"data-vertical-scrollbar-position":O||void 0,"data-hidden":l===`never`||h===`present`&&!ee||void 0,forceMount:!0,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:(0,E.jsx)(Ee,{...L(`thumb`)})}),(g===`xy`||g===`y`)&&(0,E.jsx)(Ce,{...L(`scrollbar`),orientation:`vertical`,"data-vertical-scrollbar-position":O||void 0,"data-hidden":l===`never`||h===`present`&&!N||void 0,forceMount:!0,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:(0,E.jsx)(Ee,{...L(`thumb`)})}),(0,E.jsx)(ae,{...L(`corner`),"data-vertical-scrollbar-position":O||void 0,"data-hovered":j||void 0,"data-hidden":l===`never`||void 0})]})});ti.displayName=`@mantine/core/ScrollArea`;var ni=t(e=>{let{children:t,classNames:n,styles:r,scrollbarSize:i,scrollHideDelay:a,type:o,dir:s,offsetScrollbars:c,overscrollBehavior:l,viewportRef:u,onScrollPositionChange:d,unstyled:f,variant:p,viewportProps:m,scrollbars:h,style:g,vars:v,onBottomReached:y,onTopReached:b,startScrollPosition:x,verticalScrollbarPosition:S,onOverflowChange:w,...T}=_(`ScrollAreaAutosize`,$r,e),O=(0,D.useRef)(null),[k,A]=(0,D.useState)(null),j=ir([u,O,(0,D.useCallback)(e=>{A(t=>t===e?t:e)},[])]),M=(0,D.useRef)(!1),N=(0,D.useRef)(!1),P=(0,D.useEffectEvent)(()=>{let e=O.current;if(!e||!w)return;let t=e.scrollHeight>e.clientHeight;t!==M.current&&(N.current?w(t):(N.current=!0,t&&w(!0)),M.current=t)});return I(w?k:null,P),(0,E.jsx)(C,{...T,variant:p,style:[{display:`flex`,overflow:`hidden`},g],children:(0,E.jsx)(C,{style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`,...h===`y`&&{minWidth:0},...h===`x`&&{minHeight:0},...h===`xy`&&{minWidth:0,minHeight:0},...h===!1&&{minWidth:0,minHeight:0}},children:(0,E.jsx)(ti,{classNames:n,styles:r,scrollHideDelay:a,scrollbarSize:i,type:o,dir:s,offsetScrollbars:c,overscrollBehavior:l,viewportRef:j,onScrollPositionChange:d,unstyled:f,variant:p,viewportProps:m,vars:v,scrollbars:h,onBottomReached:y,onTopReached:b,startScrollPosition:x,verticalScrollbarPosition:S,"data-autosize":`true`,children:t})})})});ti.classes=Oe,ti.varsResolver=ei,ni.displayName=`@mantine/core/ScrollAreaAutosize`,ni.classes=Oe,ti.Autosize=ni;function ri(e,t,n,r){return e===`center`||r===`center`?{top:t}:e===`end`?{bottom:n}:e===`start`?{top:n}:{}}function ii(e,t,n,r,i){return e===`center`||r===`center`?{left:t}:e===`end`?{[i===`ltr`?`right`:`left`]:n}:e===`start`?{[i===`ltr`?`left`:`right`]:n}:{}}var ai={bottom:`borderTopLeftRadius`,left:`borderTopRightRadius`,right:`borderBottomLeftRadius`,top:`borderBottomRightRadius`};function oi({position:e,arrowSize:t,dir:n}){let[r,i]=e.split(`-`);if(!i)return;let a={width:t,height:t,position:`absolute`};if(r===`bottom`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,top:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(100% 0%, 0% 100%, 100% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`}}if(r===`top`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,bottom:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(0% 0%, 100% 0%, 0% 100%)`}}if(r===`left`)return{...a,right:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 0% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`};if(r===`right`)return{...a,left:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(100% 0%, 0% 100%, 100% 100%)`}}function si({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,arrowX:a,arrowY:o,dir:s}){if(i===`merge`){let n=oi({position:e,arrowSize:t,dir:s});if(n)return n}let[c,l=`center`]=e.split(`-`),u={width:t,height:t,transform:`rotate(45deg)`,position:`absolute`,[ai[c]]:r},d=-t/2;return c===`left`?{...u,...ri(l,o,n,i),right:d,borderLeftColor:`transparent`,borderBottomColor:`transparent`,clipPath:`polygon(100% 0, 0 0, 100% 100%)`}:c===`right`?{...u,...ri(l,o,n,i),left:d,borderRightColor:`transparent`,borderTopColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 100%)`}:c===`top`?{...u,...ii(l,a,n,i,s),bottom:d,borderTopColor:`transparent`,borderLeftColor:`transparent`,clipPath:`polygon(0 100%, 100% 100%, 100% 0)`}:c===`bottom`?{...u,...ii(l,a,n,i,s),top:d,borderBottomColor:`transparent`,borderRightColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 0)`}:{}}function ci({position:e,dir:t}){let[n,r]=e.split(`-`);if(!r)return;let i=r===`start`&&t===`ltr`||r===`end`&&t===`rtl`;if(n===`bottom`)return i?{borderTopLeftRadius:0}:{borderTopRightRadius:0};if(n===`top`)return i?{borderBottomLeftRadius:0}:{borderBottomRightRadius:0};if(n===`left`)return r===`start`?{borderTopRightRadius:0}:{borderBottomRightRadius:0};if(n===`right`)return r===`start`?{borderTopLeftRadius:0}:{borderBottomLeftRadius:0}}function li({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,visible:a,arrowX:o,arrowY:s,style:c,...l}){let{dir:u}=re();return a?(0,E.jsx)(`div`,{role:`presentation`,...l,style:{...c,...si({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,dir:u,arrowX:o,arrowY:s})}}):null}li.displayName=`@mantine/core/FloatingArrow`;function ui(e,t){if(e===`rtl`&&(t.includes(`right`)||t.includes(`left`))){let[e,n]=t.split(`-`),r=e===`right`?`left`:`right`;return n===void 0?r:`${r}-${n}`}return t}function di(e){let t=document.createElement(`div`);return t.setAttribute(`data-portal`,`true`),typeof e.className==`string`&&t.classList.add(...e.className.split(` `).filter(Boolean)),typeof e.style==`object`&&Object.assign(t.style,e.style),typeof e.id==`string`&&t.setAttribute(`id`,e.id),t}function fi({target:e,reuseTargetNode:t,...n}){if(e)return typeof e==`string`?document.querySelector(e)||di(n):e;if(t){let e=document.querySelector(`[data-mantine-shared-portal-node]`);if(e)return e;let t=di(n);return t.setAttribute(`data-mantine-shared-portal-node`,`true`),document.body.appendChild(t),t}return di(n)}var pi={reuseTargetNode:!0},mi=t(e=>{let{children:t,target:n,reuseTargetNode:r,ref:a,...o}=_(`Portal`,pi,e),[s,c]=(0,D.useState)(!1),l=(0,D.useRef)(null);return b(()=>(c(!0),l.current=fi({target:n,reuseTargetNode:r,...o}),i(a,l.current),!n&&!r&&l.current&&document.body.appendChild(l.current),()=>{!n&&!r&&l.current&&document.body.removeChild(l.current)}),[n]),!s||!l.current?null:(0,T.createPortal)((0,E.jsx)(E.Fragment,{children:t}),l.current)});mi.displayName=`@mantine/core/Portal`;var hi=t(({withinPortal:e=!0,children:t,...n})=>w()===`test`||!e?(0,E.jsx)(E.Fragment,{children:t}):(0,E.jsx)(mi,{...n,children:t}));hi.displayName=`@mantine/core/OptionalPortal`;var gi={duration:100,transition:`fade`};function _i(e,t){return{...gi,...t,...e}}var vi={root:`m_8d3f4000`,icon:`m_8d3afb97`,loader:`m_302b9fb1`,group:`m_1a0f1b21`,groupSection:`m_437b6484`},yi={orientation:`horizontal`},bi=s((e,{borderWidth:t})=>({group:{"--ai-border-width":f(t)}})),xi=t(e=>{let t=_(`ActionIconGroup`,yi,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,orientation:s,vars:c,borderWidth:l,variant:u,mod:d,attributes:f,...p}=t;return(0,E.jsx)(C,{...v({name:`ActionIconGroup`,props:t,classes:vi,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:f,vars:c,varsResolver:bi,rootSelector:`group`})(`group`),variant:u,mod:[{"data-orientation":s},d],role:`group`,...p})});xi.classes=vi,xi.varsResolver=bi,xi.displayName=`@mantine/core/ActionIconGroup`;var Si=s((e,{radius:t,color:n,gradient:r,variant:i,autoContrast:a,size:o})=>{let s=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:a});return{groupSection:{"--section-height":x(o,`section-height`),"--section-padding-x":x(o,`section-padding-x`),"--section-fz":g(o),"--section-radius":t===void 0?void 0:u(t),"--section-bg":n||i?s.background:void 0,"--section-color":s.color,"--section-bd":n||i?s.border:void 0}}}),Ci=t(e=>{let t=_(`ActionIconGroupSection`,null,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,vars:s,variant:c,gradient:l,radius:u,autoContrast:d,attributes:f,...p}=t;return(0,E.jsx)(C,{...v({name:`ActionIconGroupSection`,props:t,classes:vi,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:f,vars:s,varsResolver:Si,rootSelector:`groupSection`})(`groupSection`),variant:c,...p})});Ci.classes=vi,Ci.varsResolver=Si,Ci.displayName=`@mantine/core/ActionIconGroupSection`;var wi=s((e,{size:t,radius:n,variant:r,gradient:i,color:a,autoContrast:o})=>{let s=e.variantColorResolver({color:a||e.primaryColor,theme:e,gradient:i,variant:r||`filled`,autoContrast:o});return{root:{"--ai-size":x(t,`ai-size`),"--ai-radius":n===void 0?void 0:u(n),"--ai-bg":a||r?s.background:void 0,"--ai-hover":a||r?s.hover:void 0,"--ai-hover-color":a||r?s.hoverColor:void 0,"--ai-color":s.color,"--ai-bd":a||r?s.border:void 0}}}),Ti=a(e=>{let t=_(`ActionIcon`,null,e),{className:n,unstyled:r,variant:i,classNames:a,styles:o,style:s,loading:c,loaderProps:u,size:f,color:p,radius:m,__staticSelector:h,gradient:g,vars:y,children:b,disabled:x,"data-disabled":w,autoContrast:T,mod:D,attributes:O,...k}=t,A=v({name:[`ActionIcon`,h],props:t,className:n,style:s,classes:vi,classNames:a,styles:o,unstyled:r,attributes:O,vars:y,varsResolver:wi});return(0,E.jsxs)(d,{...A(`root`,{active:!x&&!c&&!w}),"aria-busy":c||void 0,...k,unstyled:r,variant:i,size:f,disabled:x||c,mod:[{loading:c,disabled:x||w},D],children:[typeof c==`boolean`&&(0,E.jsx)(S,{mounted:c,transition:`slide-down`,duration:150,children:e=>(0,E.jsx)(C,{component:`span`,...A(`loader`,{style:e}),"aria-hidden":!0,children:(0,E.jsx)(l,{color:`var(--ai-color)`,size:`calc(var(--ai-size) * 0.55)`,...u})})}),(0,E.jsx)(C,{component:`span`,mod:{loading:c},...A(`icon`),children:b})]})});Ti.classes=vi,Ti.varsResolver=wi,Ti.displayName=`@mantine/core/ActionIcon`,Ti.Group=xi,Ti.GroupSection=Ci;function Ei({offset:e,position:t,defaultOpened:n}){let[r,i]=(0,D.useState)(n),a=(0,D.useRef)(null),{x:o,y:s,elements:c,refs:l,update:u,placement:d}=Hr({placement:t,middleware:[Zn({crossAxis:!0,padding:5,rootBoundary:`document`})]}),f=d.includes(`right`)?e:t.includes(`left`)?e*-1:0,p=d.includes(`bottom`)?e:t.includes(`top`)?e*-1:0,m=(0,D.useCallback)(({clientX:e,clientY:t})=>{Number.isFinite(e)&&Number.isFinite(t)&&l.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:e,y:t,left:e+f,top:t+p,right:e,bottom:t}}})},[c.reference]);return(0,D.useEffect)(()=>{if(l.floating.current){let e=a.current;e.addEventListener(`mousemove`,m);let t=qe(l.floating.current);return t.forEach(e=>{e.addEventListener(`scroll`,u)}),()=>{e.removeEventListener(`mousemove`,m),t.forEach(e=>{e.removeEventListener(`scroll`,u)})}}},[c.reference,l.floating.current,u,m,r]),{handleMouseMove:m,x:o,y:s,opened:r,setOpened:i,boundaryRef:a,floating:l.setFloating}}var Di={tooltip:`m_1b3c8819`,arrow:`m_f898399f`},Oi={refProp:`ref`,withinPortal:!0,offset:10,position:`right`,zIndex:j(`popover`)},ki=s((e,{radius:t,color:r})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:u(t),"--tooltip-bg":r?n(r,e):void 0,"--tooltip-color":r?`var(--mantine-color-white)`:void 0}})),Ai=t(t=>{let n=_(`TooltipFloating`,Oi,t),{children:i,refProp:a,withinPortal:o,style:s,className:c,classNames:l,styles:u,unstyled:d,radius:f,color:p,label:m,offset:h,position:g,multiline:y,zIndex:b,disabled:x,defaultOpened:S,variant:w,vars:T,portalProps:O,attributes:k,ref:A,...j}=n,M=r(),N=v({name:`TooltipFloating`,props:n,classes:Di,className:c,style:s,classNames:l,styles:u,unstyled:d,attributes:k,rootSelector:`tooltip`,vars:T,varsResolver:ki}),{handleMouseMove:ne,x:re,y:ie,opened:F,boundaryRef:I,floating:L,setOpened:ae}=Ei({offset:h,position:g,defaultOpened:S}),R=ee(i);if(!R)throw Error(`[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported`);let oe=e(I,P(R),A),se=R.props,ce=e=>{se.onMouseEnter?.(e),ne(e),ae(!0)},le=e=>{se.onMouseLeave?.(e),ae(!1)};return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(hi,{...O,withinPortal:o,children:(0,E.jsx)(C,{...j,...N(`tooltip`,{style:{...te(s,M),zIndex:b,display:!x&&F?`block`:`none`,top:Number.isFinite(ie)?Math.round(ie):``,left:Number.isFinite(re)?Math.round(re):``}}),variant:w,ref:L,mod:{multiline:y},children:m})}),(0,D.cloneElement)(R,{...se,[a]:oe,onMouseEnter:ce,onMouseLeave:le})]})});Ai.classes=Di,Ai.varsResolver=ki,Ai.displayName=`@mantine/core/TooltipFloating`;var ji=(0,D.createContext)({withinGroup:!1}),Mi={openDelay:0,closeDelay:0};function Ni(e){let{openDelay:t,closeDelay:n,children:r}=_(`TooltipGroup`,Mi,e);return(0,E.jsx)(ji,{value:{withinGroup:!0},children:(0,E.jsx)(Nr,{delay:{open:t,close:n},children:r})})}Ni.displayName=`@mantine/core/TooltipGroup`,Ni.extend=e=>e;function Pi(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Fi(e){let t=Pi(e.middlewares),n=[Xn(e.offset)];return t.shift&&n.push(Zn(typeof t.shift==`boolean`?{padding:8}:{padding:8,...t.shift})),t.flip&&n.push(typeof t.flip==`boolean`?$n():$n(t.flip)),n.push(rr({element:e.arrowRef,padding:e.arrowOffset})),t.inline?n.push(typeof t.inline==`boolean`?nr():nr(t.inline)):e.inline&&n.push(nr()),n}function Ii(e){let[t,n]=(0,D.useState)(e.defaultOpened),r=typeof e.opened==`boolean`?e.opened:t,i=(0,D.use)(ji).withinGroup,a=p(),o=(0,D.useCallback)(e=>{n(e),e&&_(a)},[a]),{x:s,y:c,context:l,refs:u,placement:d,middlewareData:{arrow:{x:f,y:m}={}}}=Hr({strategy:e.strategy,placement:e.position,open:r,onOpenChange:o,middleware:Fi(e),whileElementsMounted:Nn}),{delay:h,currentId:g,setCurrentId:_}=Pr(l,{id:a}),{getReferenceProps:v,getFloatingProps:y}=Kr([kr(l,{enabled:e.events?.hover,delay:i?h:{open:e.openDelay,close:e.closeDelay},mouseOnly:!e.events?.touch,handleClose:e.interactive?Qr():null}),Wr(l,{enabled:e.events?.focus,visibleOnly:!0}),Jr(l,{role:`tooltip`}),Br(l,{enabled:e.opened===void 0})]),x=(0,D.useRef)(d);b(()=>{x.current!==d&&(x.current=d,e.onPositionChange?.(d))},[d]);let S=r&&g&&g!==a;return{x:s,y:c,arrowX:f,arrowY:m,reference:u.setReference,floating:u.setFloating,getFloatingProps:y,getReferenceProps:v,isGroupPhase:S,opened:r,placement:d}}var Li={position:`top`,refProp:`ref`,withinPortal:!0,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,offset:5,transitionProps:{duration:100,transition:`fade`},events:{hover:!0,focus:!1,touch:!1},zIndex:j(`popover`),middlewares:{flip:!0,shift:!0,inline:!1}},Ri=s((e,{radius:t,color:n,variant:r,autoContrast:i})=>{let a=e.variantColorResolver({theme:e,color:n||e.primaryColor,autoContrast:i,variant:r||`filled`});return{tooltip:{"--tooltip-radius":t===void 0?void 0:u(t),"--tooltip-bg":n?a.background:void 0,"--tooltip-color":n?a.color:void 0}}}),zi=t(t=>{let n=_(`Tooltip`,Li,t),{children:r,position:i,refProp:a,label:o,openDelay:s,closeDelay:l,onPositionChange:u,opened:d,defaultOpened:f,withinPortal:p,radius:m,color:h,classNames:g,styles:y,unstyled:b,style:x,className:w,withArrow:T,arrowSize:O,arrowOffset:k,arrowRadius:A,arrowPosition:j,offset:M,transitionProps:N,multiline:te,events:ne,interactive:ie,zIndex:F,disabled:I,onClick:L,onMouseEnter:ae,onMouseLeave:R,inline:oe,variant:se,keepMounted:ce,vars:le,portalProps:ue,mod:de,floatingStrategy:fe,middlewares:pe,autoContrast:me,attributes:he,target:z,ref:ge,..._e}=n,{dir:ve}=re(),ye=(0,D.useRef)(null),B=Ii({position:ui(ve,i),closeDelay:l,openDelay:s,onPositionChange:u,opened:d,defaultOpened:f,events:ne,interactive:ie,arrowRef:ye,arrowOffset:k,offset:typeof M==`number`?M+(T?O/2:0):M,inline:oe,strategy:fe,middlewares:pe});(0,D.useEffect)(()=>{let e=z instanceof HTMLElement?z:typeof z==`string`?document.querySelector(z):z?.current||null;e&&B.reference(e)},[z,B]);let be=v({name:`Tooltip`,props:n,classes:Di,className:w,style:x,classNames:g,styles:y,unstyled:b,attributes:he,rootSelector:`tooltip`,vars:le,varsResolver:Ri}),xe=ee(r);if(!z&&!xe)throw Error(`[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported`);let Se=be(`tooltip`),Ce=ie&&!I&&!!B.opened,we=j===`merge`&&T?ci({position:B.placement,dir:ve}):void 0;if(z){let e=_i(N,{duration:100,transition:`fade`});return(0,E.jsx)(E.Fragment,{children:(0,E.jsx)(hi,{...ue,withinPortal:p,children:(0,E.jsx)(S,{...e,keepMounted:ce,mounted:!I&&!!B.opened,duration:B.isGroupPhase?10:e.duration,children:e=>(0,E.jsxs)(C,{..._e,"data-fixed":fe===`fixed`||void 0,variant:se,mod:[{multiline:te,interactive:Ce},de],...Se,...B.getFloatingProps({ref:B.floating,className:Se.className,style:{...Se.style,...e,...we,zIndex:F,top:B.y??0,left:B.x??0}}),children:[o,(0,E.jsx)(li,{ref:ye,arrowX:B.arrowX,arrowY:B.arrowY,visible:T,position:B.placement,arrowSize:O,arrowOffset:k,arrowRadius:A,arrowPosition:j,...be(`arrow`)})]})})})})}let Te=xe.props,Ee=e(B.reference,P(xe),ge),De=_i(N,{duration:100,transition:`fade`});return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(hi,{...ue,withinPortal:p,children:(0,E.jsx)(S,{...De,keepMounted:ce,mounted:!I&&!!B.opened,duration:B.isGroupPhase?10:De.duration,children:e=>(0,E.jsxs)(C,{..._e,"data-fixed":fe===`fixed`||void 0,variant:se,mod:[{multiline:te,interactive:Ce},de],...B.getFloatingProps({ref:B.floating,className:be(`tooltip`).className,style:{...be(`tooltip`).style,...e,...we,zIndex:F,top:B.y??0,left:B.x??0}}),children:[o,(0,E.jsx)(li,{ref:ye,arrowX:B.arrowX,arrowY:B.arrowY,visible:T,position:B.placement,arrowSize:O,arrowOffset:k,arrowRadius:A,arrowPosition:j,...be(`arrow`)})]})})}),(0,D.cloneElement)(xe,B.getReferenceProps({onClick:L,onMouseEnter:ae,onMouseLeave:R,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,...Te,className:c(w,Te.className),[a]:Ee}))]})});zi.classes=Di,zi.varsResolver=Ri,zi.displayName=`@mantine/core/Tooltip`,zi.Floating=Ai,zi.Group=Ni;var Bi=(0,D.createContext)(null);function Vi(){let e=(0,D.useContext)(Bi);if(!e)throw Error(`Fanout app context is unavailable`);return e}var Hi=`Create a new dashboard for me. First ask what I want to monitor, then design it when you have enough context.`,Ui={observability_overview:`Checking system health…`,service_topology:`Mapping service dependencies…`,service_performance:`Reading performance signals…`,trace_detail:`Inspecting a trace…`,search_logs:`Searching logs…`,intelligence_snapshot:`Reviewing detected anomalies…`};function Wi(e){return Ui[e]??`Working on it…`}var Gi=`modulepreload`,Ki=function(e){return`/`+e},qi={},Ji=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Ki(t,n),t=s(t),t in qi)return;qi[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Gi,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{k as A,Zn as C,ee as D,re as E,P as O,Xn as S,Nn as T,rr as _,Vi as a,nr as b,hi as c,ci as d,ti as f,Kr as g,kr as h,Hi as i,O as j,j as k,ui as l,Hr as m,Bi as n,zi as o,Qr as p,Wi as r,Ti as s,Ji as t,li as u,$n as v,er as w,Qn as x,tr as y}; \ No newline at end of file diff --git a/internal/ui/dist/assets/routes-wwkRMEW5.js b/internal/ui/dist/assets/routes-D1xQhcK4.js similarity index 69% rename from internal/ui/dist/assets/routes-wwkRMEW5.js rename to internal/ui/dist/assets/routes-D1xQhcK4.js index 2e992958f..b9c1fe212 100644 --- a/internal/ui/dist/assets/routes-wwkRMEW5.js +++ b/internal/ui/dist/assets/routes-D1xQhcK4.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{c as t,n}from"./auth-DNoFbJyG.js";var r=e();function i(){let{agent_available:e}=n();if(!e)return(0,r.jsx)(t,{to:`/dashboards`,replace:!0});let i=localStorage.getItem(`fanout.thread-id`);return i?(localStorage.removeItem(`fanout.thread-id`),(0,r.jsx)(t,{to:`/chat/$threadId`,params:{threadId:i},replace:!0})):(0,r.jsx)(t,{to:`/chat`,replace:!0})}export{i as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{l as t,n}from"./auth-BeUORN-q.js";var r=e();function i(){let{agent_available:e}=n();if(!e)return(0,r.jsx)(t,{to:`/dashboards`,replace:!0});let i=localStorage.getItem(`fanout.thread-id`);return i?(localStorage.removeItem(`fanout.thread-id`),(0,r.jsx)(t,{to:`/chat/$threadId`,params:{threadId:i},replace:!0})):(0,r.jsx)(t,{to:`/chat`,replace:!0})}export{i as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-D0Y7fLFc.js b/internal/ui/dist/assets/settings-D0Y7fLFc.js new file mode 100644 index 000000000..6876107c8 --- /dev/null +++ b/internal/ui/dist/assets/settings-D0Y7fLFc.js @@ -0,0 +1,16 @@ +import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-BeUORN-q.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{i as S,k as C,n as w}from"./api-Be5Lq4YA.js";import{n as T,t as E}from"./WarningCircle.es-DDq2AFnK.js";import{r as D}from"./index-DGL83-Oj.js";var O=t(s(),1);function k(e={}){let t=e.timeout??2e3,[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(!1),o=(0,O.useRef)(null);(0,O.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var A={root:`m_849cf0da`},j=d(),M={underline:`hover`},N=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,M,e);return(0,j.jsx)(a,{component:`a`,className:n({[A.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});N.classes=A,N.displayName=`@mantine/core/Anchor`;var P={timeout:1e3};function F(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,P,e),a=k({timeout:n});return(0,j.jsx)(j.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}F.displayName=`@mantine/core/CopyButton`;var I=new Map([[`bold`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),O.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),L=O.forwardRef((e,t)=>O.createElement(i,{ref:t,...e,weights:I}));L.displayName=`ArrowsClockwiseIcon`;var R=L,z=[`settings`,`ingest`];function B(e,t,n){return`exporters: + otlp/fanout: + endpoint: ${e} + headers: + ${t.toLowerCase()}: "Bearer $\{FANOUT_INGEST_TOKEN}"${n?``:` + tls: + insecure: true`} + +service: + pipelines: + traces: + exporters: [otlp/fanout] + logs: + exporters: [otlp/fanout] + metrics: + exporters: [otlp/fanout]`}function V({label:e,value:t,hint:n}){return(0,j.jsxs)(m,{gap:4,children:[(0,j.jsx)(a,{size:`sm`,fw:600,children:e}),(0,j.jsxs)(c,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,j.jsx)(b,{style:{flex:1,overflowX:`auto`},children:t}),(0,j.jsx)(F,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,j.jsx)(x,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,j.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,j.jsx)(l,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15})})})})]}),n&&(0,j.jsx)(a,{c:`dimmed`,size:`xs`,children:n})]})}function H(){let e=y(),t=S({queryKey:z,queryFn:()=>w(`/api/settings/ingest`)}),[n,r]=(0,O.useState)(!1),[i,s]=(0,O.useState)(null),u=T({mutationFn:async()=>{let e=await v(`/api/settings/ingest/rotate-token`,{method:`POST`});if(!e.ok)throw Error(`Fanout could not issue a new token. Try again.`);return e.json()},onSuccess:e=>{r(!1),s(e.ingest_token??null)}});if(t.isLoading)return(0,j.jsx)(U,{label:`Loading connection details…`});if(t.isError||!t.data)return(0,j.jsx)(U,{label:`Connection details are unavailable. Try refreshing.`});let{suggested_endpoint:d,header_name:x,tls_configured:k,token_required:A}=t.data,M=e.role===`admin`,P=`${x}: Bearer `;return(0,j.jsxs)(g,{component:`main`,maw:760,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,j.jsxs)(m,{gap:`xl`,children:[(0,j.jsxs)(g,{children:[(0,j.jsx)(f,{order:1,fz:32,lts:`-0.03em`,children:`Connect telemetry`}),(0,j.jsx)(a,{c:`dimmed`,mt:2,children:`Point an OpenTelemetry collector or SDK at this workspace.`})]}),(0,j.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,j.jsxs)(m,{gap:`lg`,children:[(0,j.jsx)(V,{label:`Endpoint`,value:d,hint:k?`OTLP over gRPC, TLS terminated at the edge.`:`OTLP over gRPC. This instance serves plaintext, so the exporter needs tls.insecure.`}),(0,j.jsx)(V,{label:`Authorization`,value:P,hint:`Send the token your workspace issued. Fanout stores only its hash, so it cannot show you an existing one.`})]})}),(0,j.jsxs)(m,{gap:`sm`,children:[(0,j.jsxs)(g,{children:[(0,j.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,j.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:`Paste this into your collector and set FANOUT_INGEST_TOKEN in its environment.`})]}),(0,j.jsx)(_,{withBorder:!0,radius:`lg`,p:`md`,children:(0,j.jsxs)(m,{gap:`sm`,children:[(0,j.jsx)(b,{block:!0,style:{fontSize:12},children:B(d,x,k)}),(0,j.jsx)(c,{justify:`flex-end`,children:(0,j.jsx)(F,{value:B(d,x,k),timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,j.jsx)(l,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,j.jsxs)(m,{gap:`sm`,children:[(0,j.jsxs)(g,{children:[(0,j.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Ingest token`}),(0,j.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:A?`This workspace has a token. Rotating issues a new one and stops the current one working immediately.`:`This workspace has no token yet, so it is rejecting telemetry. Issue one to start accepting data.`})]}),(0,j.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:i?(0,j.jsxs)(m,{gap:`sm`,children:[(0,j.jsx)(a,{size:`sm`,fw:600,children:`Your new token`}),(0,j.jsx)(b,{block:!0,children:`${x}: Bearer ${i}`}),(0,j.jsx)(a,{c:`dimmed`,size:`xs`,children:`Fanout shows this once. Store it with your collector secrets, then update any collector still using the old token.`}),(0,j.jsxs)(c,{children:[(0,j.jsx)(F,{value:`${x}: Bearer ${i}`,timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,j.jsx)(l,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy header`})}),(0,j.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:()=>s(null),children:`Done`})]})]}):M?(0,j.jsxs)(c,{justify:`space-between`,align:`center`,children:[(0,j.jsx)(a,{size:`sm`,c:`dimmed`,children:A?`Rotate when a token may have been exposed.`:`No token issued yet.`}),(0,j.jsx)(h,{variant:A?`default`:`filled`,leftSection:(0,j.jsx)(R,{size:15,weight:`bold`}),onClick:()=>r(!0),children:A?`Rotate token`:`Issue token`})]}):(0,j.jsx)(a,{size:`sm`,c:`dimmed`,children:`An administrator issues and rotates the ingest token.`})})]}),(0,j.jsxs)(a,{c:`dimmed`,size:`xs`,children:[(0,j.jsx)(N,{href:D.ingest,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Ingest documentation`}),` covers SDK setup, batching and the OTLP/HTTP endpoint.`]})]}),(0,j.jsx)(C,{opened:n,onClose:()=>!u.isPending&&r(!1),title:A?`Rotate the ingest token?`:`Issue an ingest token?`,centered:!0,radius:`md`,children:(0,j.jsxs)(m,{gap:`md`,children:[(0,j.jsx)(a,{size:`sm`,c:`dimmed`,children:A?`The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it.`:`Fanout will show the new token once, and store only its hash.`}),u.isError&&(0,j.jsx)(o,{color:`bad`,radius:`md`,icon:(0,j.jsx)(E,{size:18,weight:`fill`}),children:u.error instanceof Error?u.error.message:`Fanout could not issue a new token.`}),(0,j.jsxs)(c,{justify:`flex-end`,gap:`sm`,children:[(0,j.jsx)(h,{variant:`default`,size:`sm`,onClick:()=>r(!1),disabled:u.isPending,children:`Cancel`}),(0,j.jsx)(h,{color:A?`bad`:void 0,size:`sm`,loading:u.isPending,onClick:()=>u.mutate(),children:A?`Rotate token`:`Issue token`})]})]})})]})}function U({label:e}){return(0,j.jsxs)(c,{justify:`center`,mih:`50vh`,gap:`sm`,children:[(0,j.jsx)(r,{size:`sm`}),(0,j.jsx)(a,{c:`dimmed`,size:`sm`,children:e})]})}var W=H;export{W as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/tokens-6to9Eext.js b/internal/ui/dist/assets/tokens-6to9Eext.js deleted file mode 100644 index 3960687c4..000000000 --- a/internal/ui/dist/assets/tokens-6to9Eext.js +++ /dev/null @@ -1,41 +0,0 @@ -import{$ as e,A as t,C as n,G as r,J as i,K as a,N as o,S as s,St as c,U as l,X as u,Y as d,Z as f,_t as p,a as m,at as h,b as g,ct as _,dt as v,et as y,g as b,gt as x,j as S,k as C,m as w,mt as T,nt as E,ot as D,q as ee,st as O,tt as k,v as te,x as A,y as ne,z as re}from"./brand-MzZ03bSa.js";import{f as ie,i as ae,l as oe,m as se,p as ce,s as j,u as le}from"./auth-DNoFbJyG.js";import{A as M,C as ue,D as N,E as P,O as de,S as fe,T as F,_ as pe,b as I,c as L,d as me,f as he,g as ge,h as R,j as _e,k as z,l as ve,m as ye,p as be,u as xe,v as Se,w as Ce,x as we,y as Te}from"./preload-helper-xxyQ8-YB.js";import{r as Ee}from"./use-computed-color-scheme-6JIsge00.js";function De(e){return e[e.length-1]}function Oe(e,t){return typeof e==`function`?e(t):e}var B=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable;function Ae(e){for(let t in e)if(B.call(e,t))return!0;return!1}var je=()=>Object.create(null),Me=(e,t)=>Ne(e,t,je);function Ne(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Le(e)&&Le(i);if(!a&&!(Fe(e)&&Fe(i)))return i;let o=a?e:Pe(e);if(!o)return i;let s=a?i:Pe(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;ti||!Re(e[o],t[o],n)))return!1;return i===a}return!1}function ze(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var Be=/[\x00-\x1f\x7f"<>`{}]/g;function Ve(e){return e.replace(Be,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function He(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Ve(t)}var Ue=[`http:`,`https:`,`mailto:`,`tel:`];function We(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ge(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=He(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=He(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Ke(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function qe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var V=4,Xe=5;function Ze(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=tt(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=et(r);e.kind=Xe,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=et(r);e.kind=V,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)Qe(e,t,r,c,i,a,o,s)}function $e(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function et(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function tt(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function nt(e,t){let n=et(`/`),r=new Uint16Array(6),i=[];for(let t of e)Qe(!1,r,t,1,n,0,i);for(let e of i)e.sort($e);t.masksTree=n,t.flatCache=Ye(1e3)}function rt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=ct(e,t.masksTree);return t.flatCache.set(e,r),r}function it(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=et(`/`),Qe(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),ct(r,o,n)}function at(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=ct(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=ut(a.route)),t.matchCache.set(r,a),a}function ot(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function st(e,t=!1,n){let r=et(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;Qe(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&Je(),o[e.id]=e,c!==0&&e.path){let t=ot(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort($e);return{processedTree:{segmentTree:r,singleCache:Ye(1e3),matchCache:Ye(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function ct(e,t,n=!1){let r=e.split(`/`),i=ft(e,r,t,n);if(!i)return null;let[a]=lt(e,r,i);return{route:i.node.route,rawParams:a}}function lt(e,t,n){let r=dt(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;ee.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===V)>(e.node.kind===V)||t.node.kind===V==(e.node.kind===V)&&t.node.depth>e.node.depth)))}function _t(e){return vt(e.filter(e=>e!==void 0).join(`/`))}function vt(e){return e.replace(/\/{2,}/g,`/`)}function yt(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function bt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function xt(e){return bt(yt(e))}function St(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ct(e,t,n){return St(e,n)===St(t,n)}function wt({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=vt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=vt(e)),o=e.split(`/`);o.length>1&&De(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(De(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?vt(s):s)||`/`;return a&&r&&r.set(a,c),c}function Tt(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Et(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Ot(e,n)).join(`/`):Ot(r,n):r}function Dt({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=kt:this.parentRoute||Je();let r=n?kt:t?.path;r&&r!==`/`&&(r=yt(r));let i=t?.id||r,a=n?kt:_t([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=_t([`/`,a]));let o=a===`__root__`?`/`:_t([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=bt(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>At({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Pt=class extends Nt{constructor(e){super(e)}},H=c(x(),1),U=T();function Ft({children:e,fallback:t=null}){return(0,U.jsx)(H.Fragment,{children:It()?e:t})}function It(){return H.useSyncExternalStore(Lt,()=>!0,()=>!1)}function Lt(){return()=>{}}var Rt=H.createContext(void 0),zt=H.createContext(void 0),Bt=p((e=>{var t=x();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Vt=p(((e,t)=>{t.exports=Bt()})),Ht=p((e=>{var t=x(),n=Vt();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ut=p(((e,t)=>{t.exports=Ht()}))();function Wt(e,t){return e===t}function Gt(e,t,n=Wt){let r=(0,H.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,H.useCallback)(()=>e?.get(),[e]);return(0,Ut.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Kt={};function qt(e,t){let n=H.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Ne(n.current,i):i}}function Jt(e){let t=le(),n=H.useContext(e.from?zt:Rt),r=e.from??n,i=t.stores.getMatchStore(r),a=qt(e,t),o=Gt(i,e=>e?a(e):Kt);if(o!==Kt)return o;(e.shouldThrow??!0)&&Je()}function Yt(e){return Jt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Xt(e){let{select:t,...n}=e;return Jt({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Zt(e){return Jt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Qt(e){return Jt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function $t(e){return Jt({...e,select:t=>e.select?e.select(t.context):t.context})}function en(e){let t=H.useRef(e);return Re(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function tn(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function nn(e,t,n){if(e?.external)return We(e.href,n)?void 0:e.href;if(!mn(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),We(t,n)?void 0:t}catch{}}function rn(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Ct(e.pathname,t.pathname,r))return!1}else{let n=St(e.pathname,r),i=St(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!Re(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function an(e,t){let n=le(),r=ce(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:ee,search:O,hash:k,state:te,mask:A,reloadDocument:ne,unsafeRelative:re,from:ie,_fromLocation:ae,...oe}=e,j=It(),M=en(e.search),ue=en(e.params),N=en(o),P=H.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,M,ue,e.state,e.mask,e.unsafeRelative]),de=H.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...P}),r=pn(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=nn(r,s,n.protocolAllowlist);return[r?.href,i,rn(e,t,N,n.basepath,j,i!==void 0)]},[N,v,j,P,n,s]),[fe,F,pe]=Gt(n.stores.location,de,tn),I=pe?Oe(i,{})??sn:on,L=pe?on:Oe(a,{})??on,me=[b,I.className,L.className].filter(Boolean).join(` `),he=(y||I.style||L.style)&&{...y,...I.style,...L.style},ge=H.useRef(!1),R=e.reloadDocument||F||v?!1:c??n.options.defaultPreload,_e=l??n.options.defaultPreloadDelay??0,z=H.useCallback(()=>{n.preloadRoute(P).catch(e=>{console.warn(e),console.warn(Mt)})},[n,P]),ve=H.useCallback(e=>{if(!e){dn(r);return}if(!(e.isIntersecting??R===`intent`)){e.isIntersecting===!1&&dn(r);return}if(!_e){z();return}un.has(r)||un.set(r,setTimeout(()=>{un.delete(r),z()},_e))},[z,r,R,_e]);se(r,ve,R!==`viewport`),H.useEffect(()=>{ge.current||R===`render`&&(z(),ge.current=!0)},[z,R]);let ye=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...P,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(F)return{...oe,ref:r,href:F,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let be=()=>{R===`intent`&&z()},xe=()=>{R===`intent`&&dn(r)};return{...oe,...I,...L,href:fe,ref:r,onClick:fn([x,ye]),onBlur:fn([S,xe]),onFocus:fn([C,ve]),onMouseEnter:fn([w,ve]),onMouseLeave:fn([T,xe]),onTouchStart:fn([E,be]),disabled:!!v,target:_,...he&&{style:he},...me&&{className:me},...v&&cn,...pe&&ln}}var on={},sn={className:`active`},cn={role:`link`,"aria-disabled":!0},ln={"data-status":`active`,"aria-current":`page`},un=new WeakMap,dn=e=>{clearTimeout(un.get(e)),un.delete(e)},fn=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function pn(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function mn(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var hn=H.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=an(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return H.createElement(`a`,t,o)}return H.createElement(n,a,o)}),gn=class extends Nt{constructor(e){super(e),this.useMatch=e=>Jt({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>$t({...e,from:this.id}),this.useSearch=e=>Qt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Zt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Xt({...e,from:this.id}),this.useLoaderData=e=>Yt({...e,from:this.id}),this.useNavigate=()=>oe({from:this.fullPath}),this.Link=H.forwardRef((e,t)=>(0,U.jsx)(hn,{ref:t,from:this.fullPath,...e}))}};function _n(e){return new gn(e)}var vn=class extends Pt{constructor(e){super(e),this.useMatch=e=>Jt({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>$t({...e,from:this.id}),this.useSearch=e=>Qt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Zt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Xt({...e,from:this.id}),this.useLoaderData=e=>Yt({...e,from:this.id}),this.useNavigate=()=>oe({from:this.fullPath}),this.Link=H.forwardRef((e,t)=>(0,U.jsx)(hn,{ref:t,from:this.fullPath,...e}))}};function yn(e){return new vn(e)}function bn(e){return e=>{let t=_n(e);return t.isRoot=!1,t}}function xn(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,o.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(ze(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r){if(ie)ie(a());else throw a()}return H.createElement(r,e)};return o.preload=a,o}function Sn(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function Cn(e){let t=Sn(e);return typeof t==`number`?t:typeof t==`string`?t.includes(`calc`)||t.includes(`var`)?t:t.includes(`px`)?Number(t.replace(`px`,``)):t.includes(`rem`)?Number(t.replace(`rem`,``))*16:t.includes(`em`)?Number(t.replace(`em`,``))*16:Number(t):NaN}function wn(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function Tn(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].disabled)return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].disabled)return e}return e}function En(e,t,n){for(let n=e+1;n{n?.(s);let c=Array.from(wn(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>Dn(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=En(l,c,r),d=Tn(l,c,r),f=a===`rtl`?d:u,p=a===`rtl`?u:d;switch(s.key){case`ArrowRight`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[f].focus(),i&&c[f].click());break;case`ArrowLeft`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[p].focus(),i&&c[p].click());break;case`ArrowUp`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[d].focus(),i&&c[d].click());break;case`ArrowDown`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[u].focus(),i&&c[u].click());break;case`Home`:s.stopPropagation(),s.preventDefault(),c[En(-1,c,!1)]?.focus();break;case`End`:s.stopPropagation(),s.preventDefault(),c[Tn(c.length,c,!1)]?.focus()}}}function kn(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||Ee:n=>{n.key===`Escape`&&(e(n),t.onTrigger?.())}}function W(e,t){return n=>{e?.(n),t?.(n)}}function An(e,t){return e in t?Cn(t[e]):Cn(e)}function jn(e,t){let n=e.map(e=>({value:e,px:An(e,t)}));return n.sort((e,t)=>e.px-t.px),n}function Mn(e,t,n){return n?Array.from(wn(n,t)?.querySelectorAll(e)||[]).findIndex(e=>e===n):null}var Nn=[`mousedown`,`touchstart`];function Pn(e,t,n,r=!0){let i=(0,H.useRef)(null),a=t||Nn,o=(0,H.useEffectEvent)(t=>{let{target:r}=t??{};if(!document.body.contains(r)&&r?.tagName!==`HTML`)return;let a=t.composedPath();Array.isArray(n)?n.every(e=>!!e&&!a.includes(e))&&e(t):i.current&&!a.includes(i.current)&&e(t)}),s=a.join(`,`);return(0,H.useEffect)(()=>{if(!r)return;let e=s.split(`,`);return e.forEach(e=>document.addEventListener(e,o)),()=>{e.forEach(e=>document.removeEventListener(e,o))}},[s,r]),i}function Fn({opened:e,shouldReturnFocus:t=!0}){let n=(0,H.useRef)(null),r=()=>{n.current&&`focus`in n.current&&typeof n.current.focus==`function`&&n.current?.focus({preventScroll:!0})};return k(()=>{let i=-1,a=e=>{e.key===`Tab`&&window.clearTimeout(i)};if(document.addEventListener(`keydown`,a),e)n.current=document.activeElement;else if(t){let e=document.activeElement;i=window.setTimeout(()=>{let t=document.activeElement;(t===null||t===document.body||t===e)&&r()},10)}return()=>{window.clearTimeout(i),document.removeEventListener(`keydown`,a)}},[e,t]),r}var In=/input|select|textarea|button|object/,Ln=`a, input, select, textarea, button, object, [tabindex]`;function Rn(e){return e.style.display===`none`}function zn(e){if(e.getAttribute(`aria-hidden`)||e.getAttribute(`hidden`)||e.getAttribute(`type`)===`hidden`)return!1;let t=e;for(;t&&t!==document.body&&t.nodeType!==11;){if(Rn(t))return!1;t=t.parentNode}return!0}function Bn(e){let t=e.getAttribute(`tabindex`);return t===null&&(t=void 0),parseInt(t,10)}function Vn(e){let t=e.nodeName.toLowerCase(),n=!Number.isNaN(Bn(e));return(In.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&zn(e)}function Hn(e){let t=Bn(e);return(Number.isNaN(t)||t>=0)&&Vn(e)}function Un(e){return Array.from(e.querySelectorAll(Ln)).filter(Hn)}function Wn(e,t){let n=Un(e);if(!n.length){t.preventDefault();return}let r=n[t.shiftKey?0:n.length-1],i=e.getRootNode(),a=r===i.activeElement||e===i.activeElement,o=i.activeElement;if(o.tagName===`INPUT`&&o.getAttribute(`type`)===`radio`&&(a=n.filter(e=>e.getAttribute(`type`)===`radio`&&e.getAttribute(`name`)===o.getAttribute(`name`)).includes(r)),!a)return;t.preventDefault();let s=n[t.shiftKey?n.length-1:0];s&&s.focus()}function Gn(e=!0){let t=(0,H.useRef)(null),n=e=>{let t=e.querySelector(`[data-autofocus]`);if(!t){let n=Array.from(e.querySelectorAll(Ln));t=n.find(Hn)||n.find(Vn)||null,!t&&Vn(e)&&(t=e)}t?t.focus({preventScroll:!0}):console.warn(`[@mantine/hooks/use-focus-trap] Failed to find focusable element within provided node`,e)},r=(0,H.useCallback)(r=>{if(e){if(r===null){t.current=null;return}t.current!==r&&(setTimeout(()=>{r.getRootNode()?n(r):console.warn(`[@mantine/hooks/use-focus-trap] Ref node is not part of the dom`,r)}),t.current=r)}},[e]);return(0,H.useEffect)(()=>{if(!e)return;t.current&&setTimeout(()=>{t.current&&n(t.current)});let r=e=>{e.key===`Tab`&&t.current&&Wn(t.current,e)};return document.addEventListener(`keydown`,r),()=>document.removeEventListener(`keydown`,r)},[e]),r}function Kn(e,t,n){let r=(0,H.useEffectEvent)(t);(0,H.useEffect)(()=>(window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)),[e])}var qn=[`mouse`,`touch`],Jn=10;function Yn(e,t={}){let{threshold:n=400,events:r=qn,cancelOnMove:i=!1,onStart:a,onFinish:o,onCancel:s}=t,c=(0,H.useRef)(!1),l=(0,H.useRef)(!1),u=(0,H.useRef)(-1),d=(0,H.useRef)(null);return(0,H.useEffect)(()=>()=>window.clearTimeout(u.current),[]),(0,H.useMemo)(()=>{if(typeof e!=`function`)return{};let t=i!==!1,f=i===!0?Jn:i===!1?0:i,p=t=>{(Qn(t)||Zn(t))&&(a&&a(t),d.current=Xn(t),l.current=!0,u.current=window.setTimeout(()=>{e(t),c.current=!0},n))},m=e=>{(Qn(e)||Zn(e))&&(c.current?o&&o(e):l.current&&s&&s(e),c.current=!1,l.current=!1,d.current=null,u.current!==-1&&(window.clearTimeout(u.current),u.current=-1))},h=e=>{if(!t||!l.current||c.current)return;let n=Xn(e);if(!n||!d.current)return;let r=n.x-d.current.x,i=n.y-d.current.y;Math.sqrt(r*r+i*i)>f&&m(e)},g={};return r.includes(`mouse`)&&(g.onMouseDown=p,g.onMouseUp=m,g.onMouseLeave=m,t&&(g.onMouseMove=h)),r.includes(`touch`)&&(g.onTouchStart=p,g.onTouchEnd=m,g.onTouchCancel=m,t&&(g.onTouchMove=h)),g},[e,n,s,o,a,i,r.join(`,`)])}function Xn(e){if(Zn(e)){let t=e.touches[0]??e.changedTouches[0];return t?{x:t.clientX,y:t.clientY}:null}return{x:e.clientX,y:e.clientY}}function Zn(e){return window.TouchEvent?e.nativeEvent instanceof TouchEvent:`touches`in e.nativeEvent}function Qn(e){return e.nativeEvent instanceof MouseEvent}function $n({color:e,theme:t,autoContrast:n,colorScheme:r}){return(typeof n==`boolean`?n:t.autoContrast)&&ee({color:e||t.primaryColor,theme:t,colorScheme:r}).isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function er(e,t,n){return $n({color:n===`dark`?e.dark:e.light,theme:t,colorScheme:n,autoContrast:!0})}function tr(e,t){let n=e.colors[e.primaryColor];return r(n)?e.autoContrast?er(n,e,t):`var(--mantine-color-white)`:$n({color:n[i(e,t)],theme:e,autoContrast:null})}var nr={root:`m_515a97f8`},rr=n(e=>{let t=S(`VisuallyHidden`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t;return(0,U.jsx)(A,{component:`span`,...C({name:`VisuallyHidden`,classes:nr,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c})(`root`),...l})});rr.classes=nr,rr.displayName=`@mantine/core/VisuallyHidden`;function ir({open:e,close:t,openDelay:n,closeDelay:r}){let i=(0,H.useRef)(-1),a=(0,H.useRef)(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(a.current)};return(0,H.useEffect)(()=>o,[]),{openDropdown:()=>{o(),n===0||n===void 0?e():i.current=window.setTimeout(e,n)},closeDropdown:()=>{o(),r===0||r===void 0?t():a.current=window.setTimeout(t,r)}}}var ar={root:`m_9814e45f`},or={zIndex:z(`modal`)},sr=u((e,{gradient:t,color:n,backgroundOpacity:r,blur:i,radius:a,zIndex:o})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&l(n||`#000`,r??.6)||void 0,"--overlay-filter":i?`blur(${v(i)})`:void 0,"--overlay-radius":a===void 0?void 0:h(a),"--overlay-z-index":o?.toString()}})),cr=s(e=>{let t=S(`Overlay`,or,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,fixed:c,center:l,children:u,radius:d,zIndex:f,gradient:p,blur:m,color:h,backgroundOpacity:g,mod:_,attributes:v,...y}=t;return(0,U.jsx)(A,{...C({name:`Overlay`,props:t,classes:ar,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:v,vars:s,varsResolver:sr})(`root`),mod:[{center:l,fixed:c},_],...y,children:u})});cr.classes=ar,cr.varsResolver=sr,cr.displayName=`@mantine/core/Overlay`;var[lr,ur]=M(`Popover component was not found in the tree`);function dr({childProps:e,disabled:t,opened:n,longPressDelay:r=500,setReference:i,open:a}){let o=(0,H.useRef)(!1),s=(0,H.useRef)(!1),c=(0,H.useRef)(null),l=(0,H.useRef)(t);l.current=t;let u=(e,t,n)=>{i({getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t,toJSON:()=>void 0}),contextElement:n}),a()},d=W(e.onMouseDown,e=>{t||e.button===2&&e.stopPropagation()}),f=W(e.onContextMenu,e=>{t||e.defaultPrevented||(e.preventDefault(),!s.current&&(u(e.clientX,e.clientY,e.currentTarget),o.current&&(s.current=!0)))}),p=Yn(e=>{if(l.current||s.current)return;let t=e,n=t.touches[0]??t.changedTouches[0];n&&(u(n.clientX,n.clientY,c.current),s.current=!0)},{threshold:r,events:[`touch`],cancelOnMove:!0,onStart:e=>{o.current=!0,s.current=!1,c.current=e.currentTarget},onFinish:e=>{o.current=!1,s.current=!1,l.current||e.preventDefault()},onCancel:()=>{o.current=!1,s.current=!1}});return{onContextMenu:f,onMouseDown:d,onTouchStart:W(e.onTouchStart,p.onTouchStart),onTouchEnd:W(e.onTouchEnd,p.onTouchEnd),onTouchCancel:W(e.onTouchCancel,p.onTouchCancel),onTouchMove:W(e.onTouchMove,p.onTouchMove),style:t?e.style:{...e.style,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},"data-expanded":n?!0:void 0}}function fr(e){let{children:t,disabled:n,longPressDelay:r}=S(`PopoverContextMenu`,null,e),i=N(t);if(!i)throw Error(`Popover.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let a=ur();return(0,H.cloneElement)(i,dr({childProps:i.props,disabled:n||a.disabled,opened:a.opened,longPressDelay:r,setReference:a.reference,open:()=>{a.opened||a.onToggle()}}))}fr.displayName=`@mantine/core/PopoverContextMenu`;function pr({children:t,active:n=!0,refProp:r=`ref`,innerRef:i}){let a=e(Gn(n),i),o=N(t);return o?(0,H.cloneElement)(o,{[r]:a}):t}function mr(e){return(0,U.jsx)(rr,{tabIndex:-1,"data-autofocus":!0,...e})}pr.displayName=`@mantine/core/FocusTrap`,mr.displayName=`@mantine/core/FocusTrapInitialFocus`,pr.InitialFocus=mr;var hr={dropdown:`m_38a85659`,arrow:`m_a31dc6c1`,overlay:`m_3d7bc908`},gr=n(t=>{let n=S(`PopoverDropdown`,null,t),{className:r,style:i,vars:a,children:o,onKeyDownCapture:s,variant:c,classNames:l,styles:u,ref:d,...f}=n,p=ur(),{dir:m}=P(),h=p.arrowPosition===`merge`&&p.withArrow?me({position:p.placement,dir:m}):void 0,g=Fn({opened:p.opened,shouldReturnFocus:p.returnFocus}),_=p.withRoles?{"aria-labelledby":p.getTargetId(),id:p.getDropdownId(),role:`dialog`,tabIndex:-1}:{},y=e(d,p.floating);return p.disabled?null:(0,U.jsx)(L,{...p.portalProps,withinPortal:p.withinPortal,children:(0,U.jsx)(te,{mounted:p.opened,...p.transitionProps,transition:p.transitionProps?.transition||`fade`,duration:p.transitionProps?.duration??150,keepMounted:p.keepMounted,keepMountedMode:p.keepMountedMode,exitDuration:typeof p.transitionProps?.exitDuration==`number`?p.transitionProps.exitDuration:p.transitionProps?.duration,children:e=>(0,U.jsx)(pr,{active:p.trapFocus&&p.opened,innerRef:y,children:(0,U.jsxs)(A,{..._,...f,variant:c,onKeyDownCapture:kn(()=>{p.onClose?.(),p.onDismiss?.()},{active:p.closeOnEscape,onTrigger:g,onKeyDown:s}),"data-position":p.placement,"data-fixed":p.floatingStrategy===`fixed`||void 0,...p.getStyles(`dropdown`,{className:r,props:n,classNames:l,styles:u,style:[{...e,...h,zIndex:p.zIndex,top:p.y??0,left:p.x??0,width:p.width===`target`?void 0:v(p.width),...p.referenceHidden?{display:`none`}:null},p.resolvedStyles?.dropdown,u?.dropdown,i]}),children:[o,(0,U.jsx)(xe,{ref:p.arrowRef,arrowX:p.arrowX,arrowY:p.arrowY,visible:p.withArrow,position:p.placement,arrowSize:p.arrowSize,arrowRadius:p.arrowRadius,arrowOffset:p.arrowOffset,arrowPosition:p.arrowPosition,...p.getStyles(`arrow`,{props:n,classNames:l,styles:u})})]})})})})});gr.classes=hr,gr.displayName=`@mantine/core/PopoverDropdown`;var _r={refProp:`ref`,popupType:`dialog`},vr=n(t=>{let{children:n,refProp:r,popupType:i,ref:a,...o}=S(`PopoverTarget`,_r,t),s=N(n);if(!s)throw Error(`Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let c=o,l=ur(),u=e(l.reference,de(s),a),f=l.withRoles?{"aria-haspopup":i,"aria-expanded":l.opened,"aria-controls":l.opened?l.getDropdownId():void 0,id:l.getTargetId()}:{},p=s.props;return(0,H.cloneElement)(s,{...c,...f,...l.targetProps,className:d(l.targetProps.className,c.className,p.className),[r]:u,...l.controlled?null:{onClick:e=>{l.onToggle(),p.onClick?.(e)}}})});vr.displayName=`@mantine/core/PopoverTarget`;function yr(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function br(e,t,n,r){let i=yr(e.middlewares),a=[fe(e.offset),Te()];if(i.flip&&!n){let e=typeof i.flip==`boolean`?{}:i.flip,t=r?{fallbackStrategy:`initialPlacement`,...e}:e;a.push(Se(t))}if(i.shift){let t=typeof i.shift==`boolean`?{}:i.shift;a.push(ue(n=>{let r=n.placement.startsWith(`top`)||n.placement.startsWith(`bottom`);return{limiter:we(),padding:5,...e.width===`target`&&r?{mainAxis:!1}:null,...t}}))}return i.inline&&a.push(typeof i.inline==`boolean`?I():I(i.inline)),a.push(pe({element:e.arrowRef,padding:e.arrowOffset})),(i.size||e.width===`target`)&&a.push(Ce({...typeof i.size==`boolean`?{}:i.size,apply({rects:n,availableWidth:r,availableHeight:a,...o}){let s=t().refs.floating.current?.style??{};i.size&&(typeof i.size==`object`&&i.size.apply?i.size.apply({rects:n,availableWidth:r,availableHeight:a,...o}):Object.assign(s,{maxWidth:`${r}px`,maxHeight:`${a}px`})),e.width===`target`&&Object.assign(s,{width:`${n.reference.width}px`})}})),a}function xr(e){let[t,n]=j({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=(0,H.useRef)(t),[i,a]=(0,H.useState)(null),o=e.preventPositionChangeWhenVisible!==!1,s=(0,H.useRef)(t);t!==s.current&&(s.current=t,t&&i!==null&&a(null));let c=(0,H.useCallback)(()=>a(null),[]),l=()=>{t&&!e.disabled&&n(!1)},u=()=>{e.disabled||n(!t)},d=ye({open:t,strategy:e.strategy,placement:o?i??e.position:e.position,middleware:br(e,()=>d,o&&i!==null,o),whileElementsMounted:e.keepMounted?void 0:F});(0,H.useEffect)(()=>{if(!e.keepMounted)return;let n=d.refs.reference.current,r=d.refs.floating.current;if(t&&n&&r)return F(n,r,d.update)},[e.keepMounted,t,d.update,d.elements.reference,d.elements.floating]);let f=(0,H.useRef)(!1);E(()=>{if(!t){f.current=!1;return}if(!o||i!==null)return;let e=d.refs.floating.current;if(e&&e.offsetHeight!==0&&e.offsetWidth!==0){if(!f.current){f.current=!0,d.update();return}d.isPositioned&&a(d.placement)}},[o,t,d.isPositioned,d.placement,i,d.update]);let p=(0,H.useRef)(d.placement);return E(()=>{p.current!==d.placement&&(p.current=d.placement,e.onPositionChange?.(d.placement))},[d.placement]),k(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:d,controlled:typeof e.opened==`boolean`,opened:t,onClose:l,onToggle:u,resetLockedPlacement:c}}var Sr={position:`bottom`,offset:8,transitionProps:{transition:`fade`,duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,preventPositionChangeWhenVisible:!0,clickOutsideEvents:[`mousedown`,`touchstart`],zIndex:z(`popover`),__staticSelector:`Popover`,width:`max-content`},Cr=u((e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:h(t),"--popover-shadow":D(n)}}));function G(e){let n=S(`Popover`,Sr,e),{children:r,position:i,offset:a,onPositionChange:o,opened:s,transitionProps:c,onExitTransitionEnd:l,onEnterTransitionEnd:u,width:d,middlewares:f,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:g,arrowPosition:_,unstyled:v,classNames:b,styles:x,closeOnClickOutside:w,withinPortal:T,portalProps:E,closeOnEscape:D,clickOutsideEvents:ee,trapFocus:O,onClose:k,onDismiss:A,onOpen:ne,onChange:ie,zIndex:ae,radius:oe,shadow:se,id:ce,defaultOpened:j,__staticSelector:le,withRoles:M,disabled:ue,returnFocus:N,variant:de,keepMounted:fe,keepMountedMode:F,vars:pe,floatingStrategy:I,withOverlay:me,overlayProps:he,hideDetached:ge,attributes:R,preventPositionChangeWhenVisible:_e,...z}=n,ye=C({name:le,props:n,classes:hr,classNames:b,styles:x,unstyled:v,attributes:R,rootSelector:`dropdown`,vars:pe,varsResolver:Cr}),{resolvedStyles:be}=t({classNames:b,styles:x,props:n}),xe=(0,H.useRef)(null),[Se,Ce]=(0,H.useState)(null),[we,Te]=(0,H.useState)(null),{dir:Ee}=P(),De=re(),Oe=y(ce),B=xr({middlewares:f,width:d,position:ve(Ee,i),offset:typeof a==`number`?a+(p?m/2:0):a,arrowRef:xe,arrowOffset:h,onPositionChange:o,opened:s,defaultOpened:j,onChange:ie,onOpen:ne,onClose:k,onDismiss:A,strategy:I,disabled:ue,preventPositionChangeWhenVisible:_e,keepMounted:fe});Pn(()=>{w&&(B.onClose(),A?.())},ee,[Se,we]);let ke=(0,H.useCallback)(e=>{Ce(e),B.floating.refs.setReference(e)},[B.floating.refs.setReference]),Ae=(0,H.useCallback)(e=>{Te(e),B.floating.refs.setFloating(e)},[B.floating.refs.setFloating]),je=(0,H.useCallback)(()=>{c?.onExited?.(),l?.(),B.resetLockedPlacement()},[c?.onExited,l,B.resetLockedPlacement]),Me=(0,H.useCallback)(()=>{c?.onEntered?.(),u?.()},[c?.onEntered,u]);return(0,U.jsxs)(lr,{value:{returnFocus:N,disabled:ue,controlled:B.controlled,reference:ke,floating:Ae,x:B.floating.x,y:B.floating.y,arrowX:B.floating?.middlewareData?.arrow?.x,arrowY:B.floating?.middlewareData?.arrow?.y,opened:B.opened,arrowRef:xe,transitionProps:{...c,onExited:je,onEntered:Me},width:d,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:g,arrowPosition:_,placement:B.floating.placement,trapFocus:O,withinPortal:T,portalProps:E,zIndex:ae,radius:oe,shadow:se,closeOnEscape:D,onDismiss:A,onClose:B.onClose,onToggle:B.onToggle,getTargetId:()=>Oe,getDropdownId:()=>`${Oe}-dropdown`,withRoles:M,targetProps:z,__staticSelector:le,classNames:b,styles:x,unstyled:v,variant:de,keepMounted:fe,keepMountedMode:F,getStyles:ye,resolvedStyles:be,floatingStrategy:I,referenceHidden:ge&&De!==`test`?B.floating.middlewareData.hide?.referenceHidden:!1},children:[r,me&&(0,U.jsx)(te,{transition:`fade`,mounted:B.opened,duration:c?.duration||250,exitDuration:c?.exitDuration||250,children:e=>(0,U.jsx)(L,{withinPortal:T,children:(0,U.jsx)(cr,{...he,...ye(`overlay`,{className:he?.className,style:[e,he?.style]})})})})]})}G.Target=vr,G.Dropdown=gr,G.ContextMenu=fr,G.varsResolver=Cr,G.displayName=`@mantine/core/Popover`,G.extend=e=>e,G.withProps=e=>{let t=t=>(0,U.jsx)(G,{...e,...t});return t.extend=G.extend,t.displayName=`WithProps(${G.displayName})`,t};var[wr,K]=M(`ModalBase component was not found in tree`);function Tr({opened:e,transitionDuration:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(-1),a=f()?0:t;return(0,H.useEffect)(()=>(e?(r(!0),window.clearTimeout(i.current)):a===0?r(!1):i.current=window.setTimeout(()=>r(!1),a),()=>window.clearTimeout(i.current)),[e,a]),n}function Er({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:i,onClose:a,returnFocus:o}){let s=y(e),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(!1),f=Tr({opened:n,transitionDuration:typeof t?.duration==`number`?t?.duration:200});return Kn(`keydown`,e=>{e.key===`Escape`&&i&&!e.isComposing&&n&&e.target?.getAttribute(`data-mantine-stop-propagation`)!==`true`&&a()},{capture:!0}),Fn({opened:n,shouldReturnFocus:r&&o}),{_id:s,titleMounted:c,bodyMounted:u,shouldLockScroll:f,setTitleMounted:l,setBodyMounted:d}}var Dr=function(){return Dr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return ni;var t=ii(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},oi=ti(),si=`data-scroll-locked`,ci=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` - .${Mr} { - overflow: hidden ${r}; - padding-right: ${s}px ${r}; - } - body[${si}] { - overflow: hidden ${r}; - overscroll-behavior: contain; - ${[t&&`position: relative ${r};`,n===`margin`&&` - padding-left: ${i}px; - padding-top: ${a}px; - padding-right: ${o}px; - margin-left:0; - margin-top:0; - margin-right: ${s}px ${r}; - `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} - } - - .${Ar} { - right: ${s}px ${r}; - } - - .${jr} { - margin-right: ${s}px ${r}; - } - - .${Ar} .${Ar} { - right: 0 ${r}; - } - - .${jr} .${jr} { - margin-right: 0 ${r}; - } - - body[${si}] { - ${Nr}: ${s}px; - } -`},li=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ui=function(){H.useEffect(function(){return document.body.setAttribute(si,(li()+1).toString()),function(){var e=li()-1;e<=0?document.body.removeAttribute(si):document.body.setAttribute(si,e.toString())}},[])},di=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ui();var a=H.useMemo(function(){return ai(i)},[i]);return H.createElement(oi,{styles:ci(a,!t,i,n?``:`!important`)})},fi=!1;if(typeof window<`u`)try{var pi=Object.defineProperty({},"passive",{get:function(){return fi=!0,!0}});window.addEventListener(`test`,pi,pi),window.removeEventListener(`test`,pi,pi)}catch{fi=!1}var mi=fi?{passive:!1}:!1,hi=function(e){return e.tagName===`TEXTAREA`},gi=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!hi(e)&&n[t]===`visible`)},_i=function(e){return gi(e,`overflowY`)},vi=function(e){return gi(e,`overflowX`)},yi=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Si(e,r)){var i=Ci(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},bi=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},xi=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Si=function(e,t){return e===`v`?_i(t):vi(t)},Ci=function(e,t){return e===`v`?bi(t):xi(t)},wi=function(e,t){return e===`h`&&t===`rtl`?-1:1},Ti=function(e,t,n,r,i){var a=wi(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Ci(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Si(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ei=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Di=function(e){return[e.deltaX,e.deltaY]},Oi=function(e){return e&&`current`in e?e.current:e},ki=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ai=function(e){return` - .block-interactivity-${e} {pointer-events: none;} - .allow-interactivity-${e} {pointer-events: all;} -`},ji=0,Mi=[];function Ni(e){var t=H.useRef([]),n=H.useRef([0,0]),r=H.useRef(),i=H.useState(ji++)[0],a=H.useState(ti)[0],o=H.useRef(e);H.useEffect(function(){o.current=e},[e]),H.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=kr([e.lockRef.current],(e.shards||[]).map(Oi),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=H.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ei(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=yi(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=yi(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Ti(h,t,e,h===`h`?s:c,!0)},[]),c=H.useCallback(function(e){var n=e;if(Mi.length&&Mi[Mi.length-1]===a){var r=`deltaY`in n?Di(n):Ei(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ki(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Oi).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=H.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Pi(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=H.useCallback(function(e){n.current=Ei(e),r.current=void 0},[]),d=H.useCallback(function(t){l(t.type,Di(t),t.target,s(t,e.lockRef.current))},[]),f=H.useCallback(function(t){l(t.type,Ei(t),t.target,s(t,e.lockRef.current))},[]);H.useEffect(function(){return Mi.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,mi),document.addEventListener(`touchmove`,c,mi),document.addEventListener(`touchstart`,u,mi),function(){Mi=Mi.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,mi),document.removeEventListener(`touchmove`,c,mi),document.removeEventListener(`touchstart`,u,mi)}},[]);var p=e.removeScrollBar,m=e.inert;return H.createElement(H.Fragment,null,m?H.createElement(a,{styles:Ai(i)}):null,p?H.createElement(di,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Pi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Fi=Gr(Kr,Ni),Ii=H.forwardRef(function(e,t){return H.createElement(Jr,Dr({},e,{ref:t,sideCar:Fi}))});Ii.classNames=Jr.classNames;function Li({keepMounted:e,keepMountedMode:t=`activity`,opened:n,onClose:r,id:i,transitionProps:a,onExitTransitionEnd:o,onEnterTransitionEnd:s,trapFocus:c,closeOnEscape:l,returnFocus:u,closeOnClickOutside:d,withinPortal:f,portalProps:p,lockScroll:m,children:h,zIndex:g,shadow:v,padding:y,__vars:b,unstyled:x,removeScrollProps:S,...C}){let{_id:w,titleMounted:T,bodyMounted:E,shouldLockScroll:ee,setTitleMounted:O,setBodyMounted:k}=Er({id:i,transitionProps:a,opened:n,trapFocus:c,closeOnEscape:l,onClose:r,returnFocus:u}),{key:te,...ne}=S||{};return(0,U.jsx)(L,{...p,withinPortal:f,children:(0,U.jsx)(wr,{value:{opened:n,onClose:r,closeOnClickOutside:d,onExitTransitionEnd:o,onEnterTransitionEnd:s,transitionProps:{...a,keepMounted:e,keepMountedMode:t},getTitleId:()=>`${w}-title`,getBodyId:()=>`${w}-body`,titleMounted:T,bodyMounted:E,setTitleMounted:O,setBodyMounted:k,trapFocus:c,closeOnEscape:l,zIndex:g,unstyled:x},children:(0,U.jsx)(Ii,{enabled:ee&&m,...ne,children:(0,U.jsx)(A,{...C,id:w,__vars:{...b,"--mb-z-index":(g||z(`modal`)).toString(),"--mb-shadow":D(v),"--mb-padding":_(y)},children:h})},te)})})}Li.displayName=`@mantine/core/ModalBase`;function Ri(){let e=K();return(0,H.useEffect)(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var zi={title:`m_615af6c9`,header:`m_b5489c3c`,inner:`m_60c222c7`,content:`m_fd1ab0aa`,close:`m_606cb269`,body:`m_5df29311`};function Bi({className:e,...t}){let n=Ri(),r=K();return(0,U.jsx)(A,{id:n,className:d({[zi.body]:!r.unstyled},e),...t})}Bi.displayName=`@mantine/core/ModalBaseBody`;function Vi({className:e,onClick:t,...n}){let r=K();return(0,U.jsx)(b,{...n,onClick:e=>{r.onClose(),t?.(e)},className:d({[zi.close]:!r.unstyled},e),unstyled:r.unstyled})}Vi.displayName=`@mantine/core/ModalBaseCloseButton`;function Hi({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:i,ref:a,...o}){let s=K();return(0,U.jsx)(te,{mounted:s.opened,transition:`pop`,...s.transitionProps,onExited:()=>{s.onExitTransitionEnd?.(),s.transitionProps?.onExited?.()},onEntered:()=>{s.onEnterTransitionEnd?.(),s.transitionProps?.onEntered?.()},...e,children:e=>(0,U.jsx)(`div`,{...n,className:d({[zi.inner]:!s.unstyled},n.className),children:(0,U.jsx)(pr,{active:s.opened&&s.trapFocus,innerRef:a,children:(0,U.jsx)(ne,{...o,component:`section`,role:`dialog`,tabIndex:-1,"aria-modal":!0,"aria-describedby":s.bodyMounted?s.getBodyId():void 0,"aria-labelledby":s.titleMounted?s.getTitleId():void 0,style:[i,e],className:d({[zi.content]:!s.unstyled},t),unstyled:s.unstyled,children:o.children})})})})}Hi.displayName=`@mantine/core/ModalBaseContent`;function Ui({className:e,...t}){let n=K();return(0,U.jsx)(A,{component:`header`,className:d({[zi.header]:!n.unstyled},e),...t})}Ui.displayName=`@mantine/core/ModalBaseHeader`;var Wi={duration:200,timingFunction:`ease`,transition:`fade`};function Gi(e){let t=K();return{...Wi,...t.transitionProps,...e}}function Ki({onClick:e,transitionProps:t,style:n,visible:r,...i}){let a=K(),o=Gi(t);return(0,U.jsx)(te,{mounted:r===void 0?a.opened:r,...o,transition:`fade`,children:t=>(0,U.jsx)(cr,{fixed:!0,style:[n,t],zIndex:a.zIndex,unstyled:a.unstyled,onClick:t=>{e?.(t),a.closeOnClickOutside&&a.onClose()},...i})})}Ki.displayName=`@mantine/core/ModalBaseOverlay`;function qi(){let e=K();return(0,H.useEffect)(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}function Ji({className:e,...t}){let n=qi(),r=K();return(0,U.jsx)(A,{component:`h2`,className:d({[zi.title]:!r.unstyled},e),id:n,...t})}Ji.displayName=`@mantine/core/ModalBaseTitle`;function Yi({children:e}){return(0,U.jsx)(U.Fragment,{children:e})}function Xi({style:e,size:t=16,...n}){return(0,U.jsx)(`svg`,{viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{...e,width:v(t),height:v(t),display:`block`},...n,children:(0,U.jsx)(`path`,{d:`M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}Xi.displayName=`@mantine/core/AccordionChevron`;function Zi({size:e,style:t,...n}){return(0,U.jsx)(`svg`,{viewBox:`0 0 10 7`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:e===void 0?t:{width:v(e),height:v(e),...t},"aria-hidden":!0,...n,children:(0,U.jsx)(`path`,{d:`M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}var Qi={root:`m_347db0ec`,"root--dot":`m_fbd81e3d`,label:`m_5add502a`,section:`m_91fdda9b`},$i=u((e,{radius:t,color:n,gradient:r,variant:i,size:o,autoContrast:s,circle:c})=>{let l=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:s});return{root:{"--badge-height":O(o,`badge-height`),"--badge-padding-x":O(o,`badge-padding-x`),"--badge-fz":O(o,`badge-fz`),"--badge-radius":c||t===void 0?void 0:h(t),"--badge-bg":n||i?l.background:void 0,"--badge-color":n||i?l.color:void 0,"--badge-bd":n||i?l.border:void 0,"--badge-dot-color":i===`dot`?a(n,e):void 0}}}),ea=s(e=>{let t=S(`Badge`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,radius:c,color:l,gradient:u,leftSection:d,rightSection:f,children:p,variant:m,fullWidth:h,autoContrast:g,circle:_,mod:v,attributes:y,...b}=t,x=C({name:`Badge`,props:t,classes:Qi,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:y,vars:s,varsResolver:$i});return(0,U.jsxs)(A,{variant:m,mod:[{block:h,circle:_,"with-right-section":!!f,"with-left-section":!!d},v],...x(`root`,{variant:m}),...b,children:[d&&(0,U.jsx)(`span`,{...x(`section`),"data-position":`left`,children:d}),(0,U.jsx)(`span`,{...x(`label`),children:p}),f&&(0,U.jsx)(`span`,{...x(`section`),"data-position":`right`,children:f})]})});ea.classes=Qi,ea.varsResolver=$i,ea.displayName=`@mantine/core/Badge`;var[ta,q]=M(`Menu component was not found in the tree`),na=(0,H.createContext)(null);function ra(e){let{value:t,defaultValue:n,onChange:r,children:i}=S(`MenuCheckboxGroup`,null,e),[a,o]=j({value:t,defaultValue:n,finalValue:[],onChange:r});return(0,U.jsx)(na,{value:{values:a,onChange:(0,H.useCallback)(e=>{o(a.includes(e)?a.filter(t=>t!==e):[...a,e])},[a,o])},children:i})}ra.displayName=`@mantine/core/MenuCheckboxGroup`;var ia=(0,H.createContext)(null);function aa({role:t,checked:n,indicator:r,onSelect:i,color:a,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,dataDisabled:d,className:f,style:p,styles:m,classNames:h,buttonRef:_,others:v}){let y=q(),b=(0,H.use)(ia),x=o(),{dir:S}=P(),C=(0,H.useRef)(null),w=W(v.onClick,()=>{d||(i(),s&&y.closeDropdownImmediately())}),T=W(v.onMouseMove,()=>{if(!y.hasSearch)return;let e=C.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==C.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),E=W(v.onKeyDown,e=>{e.key===`ArrowLeft`&&b&&(b.close(),b.focusParentItem())}),D=a?x.variantColorResolver({color:a,theme:x,variant:`light`}):void 0,O=a?ee({color:a,theme:x}):null,k=y.alignItemsLabels!==`none`||n;return(0,U.jsxs)(g,{onMouseDown:e=>e.preventDefault(),...v,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:f,style:p,styles:m,classNames:h}),ref:e(C,_),role:t,"aria-checked":n,disabled:u,"data-menu-item":!0,"data-checked":n||void 0,"data-disabled":u||d||void 0,"data-mantine-stop-propagation":!0,onClick:w,onMouseMove:T,onKeyDown:On({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,orientation:`vertical`,onKeyDown:E}),__vars:{"--menu-item-color":O?.isThemeColor&&O?.shade===void 0?`var(--mantine-color-${O.color}-6)`:D?.color,"--menu-item-hover":D?.hover},children:[k&&(0,U.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:m,classNames:h}),"data-checked":n||void 0,children:n?r:null}),l&&(0,U.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:m,classNames:h}),"data-menu-item-label":!0,children:l}),c&&(0,U.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:m,classNames:h}),"data-position":`right`,children:c})]})}var J={dropdown:`m_dc9b7c9f`,label:`m_9bfac126`,divider:`m_efdf90cb`,item:`m_99ac2aa1`,search:`m_ef8769b6`,itemLabel:`m_5476e0d3`,itemIndicator:`m_8395186e`,itemSection:`m_8b75e504`,chevron:`m_b85b0bed`},oa=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,color:o,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,"data-disabled":d,value:f,checked:p,defaultChecked:m,onChange:h,checkIcon:g,ref:_,...v}=S(`MenuCheckboxItem`,null,e),y=q(),b=(0,H.use)(na),x=b&&f!==void 0?b.values.includes(f):void 0,[C,w]=j({value:p??x,defaultValue:m,finalValue:!1,onChange:h});return(0,U.jsx)(aa,{role:`menuitemcheckbox`,checked:C,indicator:g??y.checkIcon??(0,U.jsx)(Zi,{size:10}),onSelect:()=>{h?w(!C):b&&f!==void 0?b.onChange(f):w(!C)},color:o,closeMenuOnClick:s,rightSection:c,disabled:u,dataDisabled:d,className:n,style:r,styles:i,classNames:t,buttonRef:_,others:v,children:l})});oa.classes=J,oa.displayName=`@mantine/core/MenuCheckboxItem`;function sa(e){let{children:t,disabled:n,longPressDelay:r}=S(`MenuContextMenu`,null,e),i=N(t);if(!i)throw Error(`Menu.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let a=q(),o=ur();return(0,H.cloneElement)(i,dr({childProps:i.props,disabled:n||o.disabled,opened:a.opened,longPressDelay:r,setReference:o.reference,open:()=>a.openDropdown()}))}sa.displayName=`@mantine/core/MenuContextMenu`;var ca=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=S(`MenuDivider`,null,e);return(0,U.jsx)(A,{...q().getStyles(`divider`,{className:n,style:r,styles:i,classNames:t}),...o})});ca.classes=J,ca.displayName=`@mantine/core/MenuDivider`;var la=500;function ua(e){return((e.querySelector(`[data-menu-item-label]`)??e).textContent??``).trim().toLowerCase()}function da(e){return e.length>1&&e.split(``).every(t=>t===e[0])}function fa({enabled:e,opened:t,getDropdown:n}){let r=(0,H.useRef)({buffer:``,timeoutId:null});return(0,H.useEffect)(()=>{if(t&&e)return;let n=r.current;n.timeoutId!==null&&(window.clearTimeout(n.timeoutId),n.timeoutId=null),n.buffer=``},[t,e]),(0,H.useEffect)(()=>()=>{let{timeoutId:e}=r.current;e!==null&&window.clearTimeout(e)},[]),t=>{if(!e||t.defaultPrevented||t.ctrlKey||t.metaKey||t.altKey||t.key.length!==1||t.key===` `)return;let i=t.target;if(i&&(i.tagName===`INPUT`||i.tagName===`TEXTAREA`||i.tagName===`SELECT`||i.isContentEditable))return;let a=n();if(!a)return;let o=Array.from(a.querySelectorAll(`[data-menu-item]:not([data-disabled])`)).filter(e=>e.closest(`[data-menu-dropdown]`)===a);if(o.length===0)return;let s=r.current;s.buffer=(s.buffer+t.key).toLowerCase(),s.timeoutId!==null&&window.clearTimeout(s.timeoutId),s.timeoutId=window.setTimeout(()=>{s.buffer=``,s.timeoutId=null},la);let c=document.activeElement,l=c?o.indexOf(c):-1,u=null;if(s.buffer.length===1||da(s.buffer)){let e=s.buffer[0],t=l+1;for(let n=0;n{let{classNames:n,className:r,style:i,styles:a,vars:o,onMouseEnter:s,onMouseLeave:c,onKeyDown:l,children:u,ref:d,...f}=S(`MenuDropdown`,null,t),p=(0,H.useRef)(null),m=q(),h=fa({enabled:!m.hasSearch,opened:m.opened,getDropdown:()=>p.current}),g=W(l,e=>{h(e),!(e.defaultPrevented||m.hasSearch)&&(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),p.current?.querySelectorAll(`[data-menu-item]:not(:disabled)`)[0]?.focus())}),_=W(s,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.openDropdown()),v=W(c,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.closeDropdown());return(0,U.jsxs)(G.Dropdown,{...f,onMouseEnter:_,onMouseLeave:v,role:`menu`,"aria-orientation":`vertical`,ref:e(d,p),...m.getStyles(`dropdown`,{className:r,style:i,styles:a,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:g,children:[m.withInitialFocusPlaceholder&&!m.hasSearch&&(0,U.jsx)(`div`,{role:`presentation`,tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),u]})});pa.classes=J,pa.displayName=`@mantine/core/MenuDropdown`;var ma=s(t=>{let{classNames:n,className:r,style:i,styles:a,vars:s,color:c,closeMenuOnClick:l,leftSection:u,rightSection:d,children:f,disabled:p,"data-disabled":m,ref:h,..._}=S(`MenuItem`,null,t),v=q(),y=(0,H.use)(ia),b=o(),{dir:x}=P(),C=(0,H.useRef)(null),w=_,T=W(w.onClick,()=>{m||(typeof l==`boolean`?l&&v.closeDropdownImmediately():v.closeOnItemClick&&v.closeDropdownImmediately())}),E=W(w.onMouseMove,()=>{if(!v.hasSearch)return;let e=C.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==C.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),D=c?b.variantColorResolver({color:c,theme:b,variant:`light`}):void 0,O=c?ee({color:c,theme:b}):null,k=W(w.onKeyDown,e=>{e.key===`ArrowLeft`&&y&&(y.close(),y.focusParentItem())});return(0,U.jsxs)(g,{onMouseDown:e=>e.preventDefault(),..._,unstyled:v.unstyled,tabIndex:v.menuItemTabIndex,...v.getStyles(`item`,{className:r,style:i,styles:a,classNames:n}),ref:e(C,h),role:`menuitem`,disabled:p,"data-menu-item":!0,"data-disabled":p||m||void 0,"data-mantine-stop-propagation":!0,onClick:T,onMouseMove:E,onKeyDown:On({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:v.loop,dir:x,orientation:`vertical`,onKeyDown:k}),__vars:{"--menu-item-color":O?.isThemeColor&&O?.shade===void 0?`var(--mantine-color-${O.color}-6)`:D?.color,"--menu-item-hover":D?.hover},children:[v.alignItemsLabels===`all`&&(0,U.jsx)(`div`,{...v.getStyles(`itemIndicator`,{styles:a,classNames:n}),"data-placeholder":!0}),u&&(0,U.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`left`,children:u}),f&&(0,U.jsx)(`div`,{...v.getStyles(`itemLabel`,{styles:a,classNames:n}),"data-menu-item-label":!0,children:f}),d&&(0,U.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`right`,children:d})]})});ma.classes=J,ma.displayName=`@mantine/core/MenuItem`;var ha=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=S(`MenuLabel`,null,e);return(0,U.jsx)(A,{...q().getStyles(`label`,{className:n,style:r,styles:i,classNames:t}),...o})});ha.classes=J,ha.displayName=`@mantine/core/MenuLabel`;var ga=(0,H.createContext)(null);function _a(e){let{value:t,defaultValue:n,onChange:r,children:i}=S(`MenuRadioGroup`,null,e),[a,o]=j({value:t,defaultValue:n,finalValue:null,onChange:r});return(0,U.jsx)(ga,{value:{value:a,onChange:e=>o(e)},children:i})}_a.displayName=`@mantine/core/MenuRadioGroup`;function va({size:e,style:t,...n}){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 5 5`,style:{width:v(e),height:v(e),...t},"aria-hidden":!0,...n,children:(0,U.jsx)(`circle`,{cx:`2.5`,cy:`2.5`,r:`2.5`,fill:`currentColor`})})}var ya=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,color:o,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,"data-disabled":d,value:f,checked:p,onChange:m,checkIcon:h,ref:g,..._}=S(`MenuRadioItem`,null,e),v=q(),y=(0,H.use)(ga),b=p??(y?y.value===f:!1);return(0,U.jsx)(aa,{role:`menuitemradio`,checked:b,indicator:h??v.checkIcon??(0,U.jsx)(va,{size:5}),onSelect:()=>{b||(m?m(f):y&&y.onChange(f))},color:o,closeMenuOnClick:s,rightSection:c,disabled:u,dataDisabled:d,className:n,style:r,styles:i,classNames:t,buttonRef:g,others:_,children:l})});ya.classes=J,ya.displayName=`@mantine/core/MenuRadioItem`;var ba=`[data-menu-item]:not([data-disabled])`,xa=`[data-menu-active]`;function Sa(e){return e?.closest(`[data-menu-dropdown]`)}function Ca(e){return e?Array.from(e.querySelectorAll(ba)).filter(t=>t.closest(`[data-menu-dropdown]`)===e):[]}function wa(e){e&&e.querySelectorAll(xa).forEach(t=>{t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}function Ta(e,t){wa(t),e&&(e.setAttribute(`data-menu-active`,`true`),e.scrollIntoView({block:`nearest`}))}function Ea(e){return e.findIndex(e=>e.hasAttribute(`data-menu-active`))}var Da={clearSearchOnClose:!0},Oa=n(t=>{let{classNames:n,styles:r,onKeyDown:i,onChange:a,size:o,clearSearchOnClose:s,ref:c,...l}=S(`MenuSearch`,Da,t),u=q(),d=(0,H.useRef)(null),f=e(c,d),p=(0,H.useRef)(a);p.current=a,(0,H.useEffect)(()=>u.registerSearch(),[u.registerSearch]),(0,H.useEffect)(()=>{s?u.searchExitClearRef.current=()=>{p.current?.({currentTarget:{value:``}})}:u.searchExitClearRef.current=null},[s,u.searchExitClearRef]),(0,H.useEffect)(()=>{u.opened||wa(Sa(d.current))},[u.opened]);let m=W(a,e=>{wa(Sa(e.currentTarget))}),h=W(i,e=>{if(e.defaultPrevented)return;let t=Sa(e.currentTarget),n=Ca(t);if(e.key===`ArrowDown`){if(e.preventDefault(),n.length===0)return;let r=Ea(n);Ta(n[r>=n.length-1?u.loop?0:r:r+1]??null,t)}else if(e.key===`ArrowUp`){if(e.preventDefault(),n.length===0)return;let r=Ea(n);Ta(n[r<=0?r===-1||u.loop?n.length-1:0:r-1]??null,t)}else if(e.key===`Home`)e.preventDefault(),n.length>0&&Ta(n[0],t);else if(e.key===`End`)e.preventDefault(),n.length>0&&Ta(n[n.length-1],t);else if(e.key===`Enter`){if(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)return;let t=n[Ea(n)];t&&(e.preventDefault(),t.hasAttribute(`data-sub-menu-item`)?(t.focus(),t.dispatchEvent(new KeyboardEvent(`keydown`,{key:`ArrowRight`,bubbles:!0}))):t.click())}}),g=u.getStyles(`search`);return(0,U.jsx)(w,{"data-autofocus":!0,"data-mantine-stop-propagation":!0,type:`search`,size:o,...l,ref:f,classNames:[{input:g.className},n],styles:[{input:g.style},r],onKeyDown:h,onChange:m,__staticSelector:`Menu`})});Oa.classes=J,Oa.displayName=`@mantine/core/MenuSearch`;var ka=n(t=>{let{classNames:n,className:r,style:i,styles:a,vars:o,onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u,onKeyDown:d,children:f,ref:p,...m}=S(`MenuSubDropdown`,null,t),h=(0,H.useRef)(null),g=q(),_=(0,H.use)(ia),v=fa({enabled:!g.hasSearch,opened:_?.opened??!1,getDropdown:()=>h.current}),y=W(d,e=>{v(e),!e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1&&e.key!==` `&&e.stopPropagation()}),b=_?.getFloatingProps({onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u});return(0,U.jsx)(G.Dropdown,{...m,...b,role:`menu`,"aria-orientation":`vertical`,ref:e(p,h,_?.setFloating),...g.getStyles(`dropdown`,{className:r,style:i,styles:a,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:y,children:f})});ka.classes=J,ka.displayName=`@mantine/core/MenuSubDropdown`;var Aa=s(t=>{let{classNames:n,className:r,style:i,styles:a,vars:s,color:c,leftSection:l,rightSection:u,children:d,disabled:f,"data-disabled":p,closeMenuOnClick:m,ref:h,..._}=S(`MenuSubItem`,null,t),v=q(),y=(0,H.use)(ia),b=o(),{dir:x}=P(),C=(0,H.useRef)(null),w=_,T=c?b.variantColorResolver({color:c,theme:b,variant:`light`}):void 0,E=c?ee({color:c,theme:b}):null,D=W(w.onKeyDown,e=>{e.key===`ArrowRight`&&(y?.open(),y?.focusFirstItem()),e.key===`ArrowLeft`&&y?.parentContext&&(y.parentContext.close(),y.parentContext.focusParentItem())}),O=W(w.onClick,()=>{!p&&m&&v.closeDropdownImmediately()}),k=W(w.onMouseMove,()=>{if(!v.hasSearch)return;let e=C.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==C.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),te=y?.getReferenceProps({onMouseEnter:w.onMouseEnter,onMouseLeave:w.onMouseLeave,onPointerEnter:w.onPointerEnter,onPointerLeave:w.onPointerLeave});return(0,U.jsxs)(g,{onMouseDown:e=>e.preventDefault(),..._,...te,unstyled:v.unstyled,tabIndex:v.menuItemTabIndex,...v.getStyles(`item`,{className:r,style:i,styles:a,classNames:n}),ref:e(C,h,y?.setReference),role:`menuitem`,disabled:f,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":f||p||void 0,"data-mantine-stop-propagation":!0,onClick:O,onMouseMove:k,onKeyDown:On({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:v.loop,dir:x,orientation:`vertical`,onKeyDown:D}),__vars:{"--menu-item-color":E?.isThemeColor&&E?.shade===void 0?`var(--mantine-color-${E.color}-6)`:T?.color,"--menu-item-hover":T?.hover},children:[v.alignItemsLabels===`all`&&(0,U.jsx)(`div`,{...v.getStyles(`itemIndicator`,{styles:a,classNames:n}),"data-placeholder":!0}),l&&(0,U.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`left`,children:l}),d&&(0,U.jsx)(`div`,{...v.getStyles(`itemLabel`,{styles:a,classNames:n}),"data-menu-item-label":!0,children:d}),(0,U.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`right`,children:u||(0,U.jsx)(Xi,{...v.getStyles(`chevron`),size:14})})]})});Aa.classes=J,Aa.displayName=`@mantine/core/MenuSubItem`;function ja({children:e,refProp:t}){if(!_e(e))throw Error(`Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return q(),(0,U.jsx)(G.Target,{refProp:t,popupType:`menu`,children:e})}ja.displayName=`@mantine/core/MenuSubTarget`;var Ma={offset:0,position:`right-start`,safeAreaPolygon:!0,transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function Na(e){let{children:t,closeDelay:n,openDelay:r,position:i,safeAreaPolygon:a,opened:o,onChange:s,...c}=S(`MenuSub`,Ma,e),l=y(),[u,d]=j({value:o,finalValue:!1,onChange:s}),f=(0,H.use)(ia),p=q(),{dir:m}=P(),h=ve(m,i),g=f?.registerOpenSub??p.registerOpenSub,_=(0,H.useRef)(null),v=(0,H.useCallback)(e=>{let t=_.current;return t&&t!==e&&t(),_.current=e,()=>{_.current===e&&(_.current=null)}},[]),b=(0,H.useRef)(d);b.current=d;let x=(0,H.useCallback)(()=>b.current(!0),[]),C=(0,H.useCallback)(()=>b.current(!1),[]);(0,H.useEffect)(()=>{if(u)return g(C)},[u,g,C]);let{context:w,refs:T}=ye({placement:h,open:u,onOpenChange:e=>{e?x():C()}}),{getReferenceProps:E,getFloatingProps:D}=ge([R(w,{handleClose:a?be(typeof a==`object`?a:void 0):void 0,delay:{open:r,close:n}})]);return(0,U.jsx)(ia,{value:{opened:u,close:C,open:x,focusFirstItem:()=>window.setTimeout(()=>{document.getElementById(`${l}-dropdown`)?.querySelectorAll(`[data-menu-item]:not([data-disabled])`)[0]?.focus()},16),focusParentItem:()=>window.setTimeout(()=>{document.getElementById(`${l}-target`)?.focus()},16),parentContext:f,setReference:T.setReference,setFloating:T.setFloating,getReferenceProps:E,getFloatingProps:D,registerOpenSub:v},children:(0,U.jsx)(G,{opened:u,onChange:e=>e?x():C(),withinPortal:!1,withArrow:!1,id:l,position:i,...c,children:t})})}Na.extend=e=>e,Na.displayName=`@mantine/core/MenuSub`,Na.Target=ja,Na.Dropdown=ka,Na.Item=Aa;var Pa={refProp:`ref`};function Fa(e){let{children:t,refProp:n,...r}=S(`MenuTarget`,Pa,e),i=N(t);if(!i)throw Error(`Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let a=q(),o=i.props,s=W(o.onClick,()=>{a.trigger===`click`?a.toggleDropdown():a.trigger===`click-hover`&&(a.setOpenedViaClick(!0),a.opened||a.openDropdown())}),c=W(o.onMouseEnter,()=>(a.trigger===`hover`||a.trigger===`click-hover`)&&a.openDropdown()),l=W(o.onMouseLeave,()=>{(a.trigger===`hover`||a.trigger===`click-hover`&&!a.openedViaClick)&&a.closeDropdown()});return(0,U.jsx)(G.Target,{refProp:n,popupType:`menu`,...r,children:(0,H.cloneElement)(i,{onClick:s,onMouseEnter:c,onMouseLeave:l,"data-expanded":a.opened?!0:void 0})})}Fa.displayName=`@mantine/core/MenuTarget`;var Ia={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:[`mousedown`,`touchstart`,`keydown`],loop:!0,trigger:`click`,openDelay:0,closeDelay:100,menuItemTabIndex:-1,alignItemsLabels:`with-indicators`},Y=n(e=>{let n=S(`Menu`,Ia,e),{children:r,onOpen:i,onClose:a,opened:o,defaultOpened:s,trapFocus:c,onChange:l,closeOnItemClick:u,loop:d,closeOnEscape:f,trigger:p,openDelay:m,closeDelay:h,classNames:g,styles:_,unstyled:v,variant:y,vars:b,menuItemTabIndex:x,keepMounted:w,withInitialFocusPlaceholder:T,attributes:E,onExitTransitionEnd:D,alignItemsLabels:ee,checkIcon:O,...k}=n,te=C({name:`Menu`,classes:J,props:n,classNames:g,styles:_,unstyled:v,attributes:E}),[A,ne]=j({value:o,defaultValue:s,finalValue:!1,onChange:l}),[re,ie]=(0,H.useState)(!1),ae=()=>{ne(!1),ie(!1),A&&a?.()},oe=()=>{ne(!0),!A&&i?.()},se=()=>{A?ae():oe()},{openDropdown:ce,closeDropdown:le}=ir({open:oe,close:ae,closeDelay:h,openDelay:m}),M=(0,H.useRef)(null),ue=(0,H.useCallback)(e=>{let t=M.current;return t&&t!==e&&t(),M.current=e,()=>{M.current===e&&(M.current=null)}},[]),N=(0,H.useRef)(0),[P,de]=(0,H.useState)(!1),fe=(0,H.useCallback)(()=>(N.current+=1,N.current===1&&de(!0),()=>{--N.current,N.current===0&&de(!1)}),[]),F=(0,H.useRef)(null),pe=()=>{F.current?.(),D?.()},I=e=>Mn(`[data-menu-item]`,`[data-menu-dropdown]`,e),{resolvedClassNames:L,resolvedStyles:me}=t({classNames:g,styles:_,props:n});return(0,U.jsx)(ta,{value:{getStyles:te,opened:A,toggleDropdown:se,getItemIndex:I,openedViaClick:re,setOpenedViaClick:ie,closeOnItemClick:u,closeDropdown:p===`click`?ae:le,openDropdown:p===`click`?oe:ce,closeDropdownImmediately:ae,loop:d,trigger:p,unstyled:v,menuItemTabIndex:x,withInitialFocusPlaceholder:T,registerOpenSub:ue,hasSearch:P,registerSearch:fe,searchExitClearRef:F,alignItemsLabels:ee,checkIcon:O},children:(0,U.jsx)(G,{returnFocus:!0,...k,opened:A,onChange:se,defaultOpened:s,trapFocus:!w&&c,closeOnEscape:f,__staticSelector:`Menu`,classNames:L,styles:me,unstyled:v,variant:y,keepMounted:w,onExitTransitionEnd:pe,children:r})})});Y.displayName=`@mantine/core/Menu`,Y.classes=J,Y.Item=ma,Y.Label=ha,Y.Dropdown=pa,Y.Target=Fa,Y.Divider=ca,Y.Search=Oa,Y.Sub=Na,Y.CheckboxItem=oa,Y.CheckboxGroup=ra,Y.RadioItem=ya,Y.RadioGroup=_a,Y.ContextMenu=sa;var[La,Ra]=M(`Modal component was not found in tree`),X={root:`m_9df02822`,content:`m_54c44539`,inner:`m_1f958f16`,header:`m_d0e2b9cd`},za=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=S(`ModalBody`,null,e);return(0,U.jsx)(Bi,{...Ra().getStyles(`body`,{classNames:t,style:r,styles:i,className:n}),...o})});za.classes=X,za.displayName=`@mantine/core/ModalBody`;var Ba=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=S(`ModalCloseButton`,null,e);return(0,U.jsx)(Vi,{...Ra().getStyles(`close`,{classNames:t,style:r,styles:i,className:n}),...o})});Ba.classes=X,Ba.displayName=`@mantine/core/ModalCloseButton`;var Va=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,__hidden:s,...c}=S(`ModalContent`,null,e),l=Ra(),u=l.scrollAreaComponent||Yi;return(0,U.jsx)(Hi,{...l.getStyles(`content`,{className:n,style:r,styles:i,classNames:t}),innerProps:l.getStyles(`inner`,{className:n,style:r,styles:i,classNames:t}),"data-full-screen":l.fullScreen||void 0,"data-modal-content":!0,"data-hidden":s||void 0,...c,children:(0,U.jsx)(u,{style:{maxHeight:l.fullScreen?`100dvh`:`calc(100dvh - (${v(l.yOffset)} * 2))`},children:o})})});Va.classes=X,Va.displayName=`@mantine/core/ModalContent`;var Ha=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=S(`ModalHeader`,null,e);return(0,U.jsx)(Ui,{...Ra().getStyles(`header`,{classNames:t,style:r,styles:i,className:n}),...o})});Ha.classes=X,Ha.displayName=`@mantine/core/ModalHeader`;var Ua=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=S(`ModalOverlay`,null,e);return(0,U.jsx)(Ki,{...Ra().getStyles(`overlay`,{classNames:t,style:r,styles:i,className:n}),...o})});Ua.classes=X,Ua.displayName=`@mantine/core/ModalOverlay`;var Wa={__staticSelector:`Modal`,closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:z(`modal`),transitionProps:{duration:200,transition:`fade-down`},yOffset:`5dvh`},Ga=u((e,{radius:t,size:n,yOffset:r,xOffset:i})=>({root:{"--modal-radius":t===void 0?void 0:h(t),"--modal-size":O(n,`modal-size`),"--modal-y-offset":v(r),"--modal-x-offset":v(i)}})),Ka=n(e=>{let t=S(`ModalRoot`,Wa,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,yOffset:c,scrollAreaComponent:l,radius:u,fullScreen:d,centered:f,xOffset:p,__staticSelector:m,attributes:h,...g}=t,_=C({name:m,classes:X,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:h,vars:s,varsResolver:Ga});return(0,U.jsx)(La,{value:{yOffset:c,scrollAreaComponent:l,getStyles:_,fullScreen:d},children:(0,U.jsx)(Li,{..._(`root`),"data-full-screen":d||void 0,"data-centered":f||void 0,"data-offset-scrollbars":l===he.Autosize||void 0,unstyled:o,...g})})});Ka.classes=X,Ka.varsResolver=Ga,Ka.displayName=`@mantine/core/ModalRoot`;var qa=(0,H.createContext)(null);function Ja({children:e}){let[t,n]=(0,H.useState)([]),[r,i]=(0,H.useState)(z(`modal`));return(0,U.jsx)(qa,{value:{stack:t,addModal:(e,t)=>{n(t=>[...new Set([...t,e])]),i(e=>typeof t==`number`&&typeof e==`number`?Math.max(e,t):e)},removeModal:e=>n(t=>t.filter(t=>t!==e)),getZIndex:e=>`calc(${r} + ${t.indexOf(e)} + 1)`,currentId:t[t.length-1],maxZIndex:r},children:e})}Ja.displayName=`@mantine/core/ModalStack`;var Ya=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=S(`ModalTitle`,null,e);return(0,U.jsx)(Ji,{...Ra().getStyles(`title`,{classNames:t,style:r,styles:i,className:n}),...o})});Ya.classes=X,Ya.displayName=`@mantine/core/ModalTitle`;var Xa={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:z(`modal`),transitionProps:{duration:200,transition:`fade-down`},withOverlay:!0,withCloseButton:!0},Z=n(e=>{let{title:t,withOverlay:n,overlayProps:r,withCloseButton:i,closeButtonProps:a,children:o,radius:s,opened:c,stackId:l,zIndex:u,...d}=S(`Modal`,Xa,e),f=(0,H.use)(qa),p=!!t||i,m=f&&l?{closeOnEscape:f.currentId===l,trapFocus:f.currentId===l,zIndex:f.getZIndex(l)}:{},h=n===!1?!1:l&&f?f.currentId===l:c;return(0,H.useEffect)(()=>{f&&l&&(c?f.addModal(l,u||z(`modal`)):f.removeModal(l))},[c,l,u]),(0,U.jsxs)(Ka,{radius:s,opened:c,zIndex:f&&l?f.getZIndex(l):u,...d,...m,children:[n&&(0,U.jsx)(Ua,{visible:h,transitionProps:f&&l?{duration:0}:void 0,...r}),(0,U.jsxs)(Va,{radius:s,__hidden:f&&l&&c?l!==f.currentId:!1,children:[p&&(0,U.jsxs)(Ha,{children:[t&&(0,U.jsx)(Ya,{children:t}),i&&(0,U.jsx)(Ba,{...a})]}),(0,U.jsx)(za,{children:o})]})]})});Z.classes=X,Z.displayName=`@mantine/core/Modal`,Z.Root=Ka,Z.Overlay=Ua,Z.Content=Va,Z.Body=za,Z.Header=Ha,Z.Title=Ya,Z.CloseButton=Ba,Z.Stack=Ja;var Za=H.createContext(void 0),Qa=e=>{let t=H.useContext(Za);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},$a=({client:e,children:t})=>(H.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,U.jsx)(Za.Provider,{value:e,children:t})),eo={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},to=new class{#e=eo;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function no(e){setTimeout(e,0)}var ro=typeof window>`u`||`Deno`in globalThis;function io(){}function ao(e,t){return typeof e==`function`?e(t):e}function oo(e){return typeof e==`number`&&e>=0&&e!==1/0}function so(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Q(e,t){return typeof e==`function`?e(t):e}function co(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==uo(o,t.options))return!1}else if(!po(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function lo(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(fo(t.options.mutationKey)!==fo(a))return!1}else if(!po(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function uo(e,t){return(t?.queryKeyHashFn||fo)(e)}function fo(e){return JSON.stringify(e,(e,t)=>vo(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function po(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n500)return t;let r=_o(e)&&_o(t);if(!r&&!(vo(e)&&vo(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{to.setTimeout(t,e)})}function xo(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ho(e,t)}function So(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Co(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var wo=Symbol();function To(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===wo?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Eo(e,t){return typeof e==`function`?e(...t):!!e}function Do(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Oo=()=>ro,ko=()=>Oo(),Ao=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},jo=new class extends Ao{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Mo=no;function No(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Mo,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Po=No(),Fo=new class extends Ao{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Io(e){return Math.min(1e3*2**e,3e4)}function Lo(e){return(e??`online`)!==`online`||Fo.isOnline()}var Ro=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function zo(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(io);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Ro(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>jo.isFocused()&&(e.networkMode===`always`||Fo.isOnline())&&e.canRun(),p=()=>Lo(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(ko()?0:3),a=e.retryDelay??Io,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Bo=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),oo(this.gcTime)&&(this.#e=to.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ko()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(to.clearTimeout(this.#e),this.#e=void 0)}};function Vo(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Do(e,()=>t.signal,()=>n=!0)},u=To(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Co:So;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Uo:Ho,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ho(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ho(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Uo(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Wo(e,t){return t?Ho(e,t)!=null:!1}function Go(e,t){return!t||!e.getPreviousPageParam?!1:Uo(e,t)!=null}var Ko=class extends Bo{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Yo(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Yo(this.options);e.data!==void 0&&(this.setState(Jo(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=xo(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(io).catch(io):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Q(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wo||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Q(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!so(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=To(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Vo(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=zo({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ro&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ro){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...qo(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Jo(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Po.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function qo(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lo(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Jo(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Yo(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Xo=class extends Ao{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Qo(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return $o(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return $o(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Q(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!go(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&es(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Q(this.options.enabled,this.#t)!==Q(t.enabled,this.#t)||Q(this.options.staleTime,this.#t)!==Q(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Q(this.options.enabled,this.#t)!==Q(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return go(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(io)),t}#h(e){return!ko()&&Q(this.options.enabled,this.#t)!==!1&&oo(e)}#g(){this.#b();let e=Q(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=so(this.#r.dataUpdatedAt,e)+1;this.#u=to.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=to.setInterval(()=>{(this.options.refetchIntervalInBackground||jo.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(to.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(to.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Qo(e,t),o=i&&es(e,n,t,r);(a||o)&&(l={...l,...qo(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=xo(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=xo(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ts(e,t),refetch:this.refetch,isEnabled:Q(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),go(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Po.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Zo(e,t){return Q(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Q(t.retryOnMount,e)!==!1)}function Qo(e,t){return Zo(e,t)||e.state.data!==void 0&&$o(e,t,t.refetchOnMount)}function $o(e,t,n){if(Q(t.enabled,e)!==!1&&Q(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ts(e,t)}return!1}function es(e,t,n,r){return(e!==t||Q(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ts(e,n)}function ts(e,t){return Q(t.enabled,e)!==!1&&e.isStaleByTime(Q(t.staleTime,e))}var ns=class extends Bo{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||rs(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=zo({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Po.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function rs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var is=H.createContext(!1),as=()=>H.useContext(is);is.Provider;function os(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ss=H.createContext(os()),cs=()=>H.useContext(ss),ls=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Eo(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},us=e=>{H.useEffect(()=>{e.clearReset()},[e])},ds=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Eo(n,[e.error,r])),fs=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ps=(e,t)=>e?.suspense&&t.isPending,ms=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hs(e,t,n){let r=as(),i=cs(),a=Qa(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,fs(o),ls(o,i,s),us(i);let[l]=H.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(H.useSyncExternalStore(H.useCallback(e=>{let t=d?l.subscribe(Po.batchCalls(e)):io;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),H.useEffect(()=>{l.setOptions(o)},[o,l]),ps(o,u))throw ms(o,l,i);if(ds({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function gs(e,t){return hs(e,Xo,t)}var _s=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z`}))]]),vs=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),ys=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),bs=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),xs=H.forwardRef((e,t)=>H.createElement(m,{ref:t,...e,weights:_s}));xs.displayName=`DotsThreeIcon`;var Ss=xs,Cs=H.forwardRef((e,t)=>H.createElement(m,{ref:t,...e,weights:vs}));Cs.displayName=`PlusIcon`;var ws=Cs,Ts=H.forwardRef((e,t)=>H.createElement(m,{ref:t,...e,weights:ys}));Ts.displayName=`SparkleIcon`;var Es=Ts,Ds=H.forwardRef((e,t)=>H.createElement(m,{ref:t,...e,weights:bs}));Ds.displayName=`TrashIcon`;var Os=Ds,ks=[`dashboards`],As=[`agent-threads`];async function js(e){let t=await ae(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var $=[];for(let e=0;e<256;++e)$.push((e+256).toString(16).slice(1));function Ms(e,t=0){return($[e[t+0]]+$[e[t+1]]+$[e[t+2]]+$[e[t+3]]+`-`+$[e[t+4]]+$[e[t+5]]+`-`+$[e[t+6]]+$[e[t+7]]+`-`+$[e[t+8]]+$[e[t+9]]+`-`+$[e[t+10]]+$[e[t+11]]+$[e[t+12]]+$[e[t+13]]+$[e[t+14]]+$[e[t+15]]).toLowerCase()}var Ns=new Uint8Array(16);function Ps(){return crypto.getRandomValues(Ns)}var Fs={};function Is(e,t,n){let r;if(e)r=Rs(e.random??e.rng?.()??Ps(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=Ps();Ls(Fs,e,i),r=Rs(i,Fs.msecs,Fs.seq,t,n)}return t??Ms(r)}function Ls(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=zs(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Rs(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=zs(e),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}function zs(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function Bs(){return Is()}var Vs=[{value:`15m`,label:`15 minutes`},{value:`1h`,label:`1 hour`},{value:`6h`,label:`6 hours`},{value:`24h`,label:`24 hours`},{value:`168h`,label:`7 days`},{value:`720h`,label:`30 days`}];function Hs(e){return Vs.find(t=>t.value===e)?.label??e}function Us(e,t){let n=e?.[t];return typeof n==`string`?n:``}function Ws(e,t,n=[]){let r=new URLSearchParams({window:e.window,limit:`40`});e.namespace&&r.set(`namespace`,e.namespace);for(let e of n){let n=Us(t,e);n&&r.set(e,n)}return r}function Gs(e,t){return[`observability`,e,t.toString()]}var Ks=e=>e.state.status===`error`?15e3:3e4;function qs(e,t,n=!0){return gs({queryKey:Gs(e,t),queryFn:()=>js(`/api/observability/${e}?${t}`),enabled:n,refetchInterval:Ks})}function Js(e){return e.getQueryCache().findAll({queryKey:[`observability`]}).reduce((e,t)=>Math.max(e,t.state.dataUpdatedAt),0)||null}function Ys(){let e=Qa(),[t,n]=(0,H.useState)(()=>Js(e));return(0,H.useEffect)(()=>e.getQueryCache().subscribe(()=>n(Js(e))),[e]),t}function Xs(e){let t={};return typeof e.window==`string`&&Vs.some(t=>t.value===e.window)&&(t.window=e.window),typeof e.namespace==`string`&&e.namespace.trim()&&(t.namespace=e.namespace.trim()),t}var Zs=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],Qs=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],$s=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],ec=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],tc=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],nc=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],rc={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#565b69`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#a4abb4`}},ic={dark:[`#66d0ee`,`#a97ce0`,`#5fe8ce`,`#cb55e8`,`#41b6f8`,`#d2a6ff`],light:[`#2b93b5`,`#7c4dcc`,`#1a9c86`,`#a12fbf`,`#2f7fd4`,`#9163d6`]},ac={micro:11,small:12,body:14,title:16,section:22,page:32},oc={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`};export{ea as $,Xo as A,Dt as At,uo as B,st as Bt,Es as C,qt as Ct,hs as D,jt as Dt,gs as E,Ft as Et,Po as F,ut as Ft,Q as G,Re as Gt,co as H,Ue as Ht,jo as I,rt as It,wo as J,Ae as Jt,go as K,Ke as Kt,Ao as L,at as Lt,Wo as M,wt as Mt,Go as N,xt as Nt,ns as O,kt as Ot,Fo as P,bt as Pt,Y as Q,Ne as Qt,ao as R,it as Rt,Os as S,Zt as St,Ss as T,Rt as Tt,io as U,qe as Ut,lo as V,Ye as Vt,po as W,Ge as Wt,Qa as X,De as Xt,$a as Y,We as Yt,Z,Me as Zt,Hs as _,An as _t,oc as a,Hi as at,js as b,bn as bt,ic as c,Li as ct,Xs as d,rr as dt,Zi as et,Us as f,$n as ft,Ws as g,jn as gt,qs as h,Kn as ht,rc as i,Ui as it,Ko as j,_t as jt,rs as k,Tt as kt,ac as l,Ii as lt,Ys as m,er as mt,tc as n,Ji as nt,nc as o,Vi as ot,Vs as p,tr as pt,Eo as q,Oe as qt,Qs as r,Ki as rt,$s as s,Bi as st,Zs as t,Yi as tt,ec as u,G as ut,Bs as v,Cn as vt,ws as w,Gt as wt,As as x,yn as xt,ks as y,xn as yt,fo as z,nt as zt}; \ No newline at end of file diff --git a/internal/ui/dist/assets/tokens-CvbGYJRX.js b/internal/ui/dist/assets/tokens-CvbGYJRX.js new file mode 100644 index 000000000..8dac177b4 --- /dev/null +++ b/internal/ui/dist/assets/tokens-CvbGYJRX.js @@ -0,0 +1 @@ +import{$ as e,A as t,C as n,G as r,J as i,K as a,N as o,S as s,St as c,X as l,Y as u,_t as d,a as f,at as p,b as m,dt as h,et as g,gt as _,j as v,k as y,m as b,mt as x,nt as S,ot as C,q as w,st as T,tt as E,v as D,x as O,z as k}from"./brand-MzZ03bSa.js";import{c as A,d as ee,h as te,m as j,p as ne,u as re}from"./auth-BeUORN-q.js";import{C as ie,S as ae,T as oe,_ as se,a as ce,b as M,c as N,d as le,f as P,g as F,h as ue,i as de,l as I,m as L,n as R,p as z,r as fe,s as pe,u as B,v as V,w as me,x as H,y as he}from"./Tooltip-BJiO7C_G.js";import{r as ge}from"./use-computed-color-scheme-6JIsge00.js";import{B as _e,O as ve,U as ye,i as be,n as xe,z as Se}from"./api-Be5Lq4YA.js";function Ce(e){return e[e.length-1]}function we(e,t){return typeof e==`function`?e(t):e}var Te=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;function U(e){for(let t in e)if(Te.call(e,t))return!0;return!1}var De=()=>Object.create(null),Oe=(e,t)=>ke(e,t,De);function ke(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Ne(e)&&Ne(i);if(!a&&!(je(e)&&je(i)))return i;let o=a?e:Ae(e);if(!o)return i;let s=a?i:Ae(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;ti||!Pe(e[o],t[o],n)))return!1;return i===a}return!1}function Fe(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var Ie=/[\x00-\x1f\x7f"<>`{}]/g;function Le(e){return e.replace(Ie,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Re(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Le(t)}var ze=[`http:`,`https:`,`mailto:`,`tel:`];function Be(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ve(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Re(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Re(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function He(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ue(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var W=4,Ke=5;function qe(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=Ze(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Xe(r);e.kind=Ke,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=Xe(r);e.kind=W,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)Je(e,t,r,c,i,a,o,s)}function Ye(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Xe(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ze(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Qe(e,t){let n=Xe(`/`),r=new Uint16Array(6),i=[];for(let t of e)Je(!1,r,t,1,n,0,i);for(let e of i)e.sort(Ye);t.masksTree=n,t.flatCache=Ge(1e3)}function $e(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=it(e,t.masksTree);return t.flatCache.set(e,r),r}function et(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Xe(`/`),Je(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),it(r,o,n)}function tt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=it(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=ot(a.route)),t.matchCache.set(r,a),a}function nt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function rt(e,t=!1,n){let r=Xe(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;Je(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&We(),o[e.id]=e,c!==0&&e.path){let t=nt(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(Ye);return{processedTree:{segmentTree:r,singleCache:Ge(1e3),matchCache:Ge(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function it(e,t,n=!1){let r=e.split(`/`),i=ct(e,r,t,n);if(!i)return null;let[a]=at(e,r,i);return{route:i.node.route,rawParams:a}}function at(e,t,n){let r=st(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;ee.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===W)>(e.node.kind===W)||t.node.kind===W==(e.node.kind===W)&&t.node.depth>e.node.depth)))}function pt(e){return mt(e.filter(e=>e!==void 0).join(`/`))}function mt(e){return e.replace(/\/{2,}/g,`/`)}function ht(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function gt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function _t(e){return gt(ht(e))}function vt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function yt(e,t,n){return vt(e,n)===vt(t,n)}function bt({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=mt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=mt(e)),o=e.split(`/`);o.length>1&&Ce(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(Ce(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?mt(s):s)||`/`;return a&&r&&r.set(a,c),c}function xt(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function St(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>wt(e,n)).join(`/`):wt(r,n):r}function Ct({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Tt:this.parentRoute||We();let r=n?Tt:t?.path;r&&r!==`/`&&(r=ht(r));let i=t?.id||r,a=n?Tt:pt([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=pt([`/`,a]));let o=a===`__root__`?`/`:pt([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=gt(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Et({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},At=class extends kt{constructor(e){super(e)}},G=c(_(),1),K=x();function jt({children:e,fallback:t=null}){return(0,K.jsx)(G.Fragment,{children:Mt()?e:t})}function Mt(){return G.useSyncExternalStore(Nt,()=>!0,()=>!1)}function Nt(){return()=>{}}var Pt=G.createContext(void 0),Ft=G.createContext(void 0),It=d((e=>{var t=_();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Lt=d(((e,t)=>{t.exports=It()})),Rt=d((e=>{var t=_(),n=Lt();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),zt=d(((e,t)=>{t.exports=Rt()}))();function Bt(e,t){return e===t}function Vt(e,t,n=Bt){let r=(0,G.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,G.useCallback)(()=>e?.get(),[e]);return(0,zt.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ht={};function Ut(e,t){let n=G.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=ke(n.current,i):i}}function q(e){let t=ee(),n=G.useContext(e.from?Ft:Pt),r=e.from??n,i=t.stores.getMatchStore(r),a=Ut(e,t),o=Vt(i,e=>e?a(e):Ht);if(o!==Ht)return o;(e.shouldThrow??!0)&&We()}function Wt(e){return q({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Gt(e){let{select:t,...n}=e;return q({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Kt(e){return q({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function qt(e){return q({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Jt(e){return q({...e,select:t=>e.select?e.select(t.context):t.context})}function Yt(e){let t=G.useRef(e);return Pe(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Xt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Zt(e,t,n){if(e?.external)return Be(e.href,n)?void 0:e.href;if(!ln(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),Be(t,n)?void 0:t}catch{}}function Qt(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!yt(e.pathname,t.pathname,r))return!1}else{let n=vt(e.pathname,r),i=vt(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!Pe(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function $t(e,t){let n=ee(),r=j(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:ne,mask:re,reloadDocument:ie,unsafeRelative:ae,from:oe,_fromLocation:se,...ce}=e,M=Mt(),N=Yt(e.search),le=Yt(e.params),P=Yt(o),F=G.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,N,le,e.state,e.mask,e.unsafeRelative]),ue=G.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...F}),r=cn(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=Zt(r,s,n.protocolAllowlist);return[r?.href,i,Qt(e,t,P,n.basepath,M,i!==void 0)]},[P,v,M,F,n,s]),[de,I,L]=Vt(n.stores.location,ue,Xt),R=L?we(i,{})??tn:en,z=L?en:we(a,{})??en,fe=[b,R.className,z.className].filter(Boolean).join(` `),pe=(y||R.style||z.style)&&{...y,...R.style,...z.style},B=G.useRef(!1),V=e.reloadDocument||I||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,H=G.useCallback(()=>{n.preloadRoute(F).catch(e=>{console.warn(e),console.warn(Ot)})},[n,F]),he=G.useCallback(e=>{if(!e){on(r);return}if(!(e.isIntersecting??V===`intent`)){e.isIntersecting===!1&&on(r);return}if(!me){H();return}an.has(r)||an.set(r,setTimeout(()=>{an.delete(r),H()},me))},[H,r,V,me]);te(r,he,V!==`viewport`),G.useEffect(()=>{B.current||V===`render`&&(H(),B.current=!0)},[H,V]);let ge=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...F,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(I)return{...ce,ref:r,href:I,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let _e=()=>{V===`intent`&&H()},ve=()=>{V===`intent`&&on(r)};return{...ce,...R,...z,href:de,ref:r,onClick:sn([x,ge]),onBlur:sn([S,ve]),onFocus:sn([C,he]),onMouseEnter:sn([w,he]),onMouseLeave:sn([T,ve]),onTouchStart:sn([E,_e]),disabled:!!v,target:_,...pe&&{style:pe},...fe&&{className:fe},...v&&nn,...L&&rn}}var en={},tn={className:`active`},nn={role:`link`,"aria-disabled":!0},rn={"data-status":`active`,"aria-current":`page`},an=new WeakMap,on=e=>{clearTimeout(an.get(e)),an.delete(e)},sn=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function cn(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ln(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var un=G.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=$t(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return G.createElement(`a`,t,o)}return G.createElement(n,a,o)}),dn=class extends kt{constructor(e){super(e),this.useMatch=e=>q({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Jt({...e,from:this.id}),this.useSearch=e=>qt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Kt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Gt({...e,from:this.id}),this.useLoaderData=e=>Wt({...e,from:this.id}),this.useNavigate=()=>re({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(un,{ref:t,from:this.fullPath,...e}))}};function fn(e){return new dn(e)}var pn=class extends At{constructor(e){super(e),this.useMatch=e=>q({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Jt({...e,from:this.id}),this.useSearch=e=>qt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Kt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Gt({...e,from:this.id}),this.useLoaderData=e=>Wt({...e,from:this.id}),this.useNavigate=()=>re({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(un,{ref:t,from:this.fullPath,...e}))}};function mn(e){return new pn(e)}function hn(e){return e=>{let t=fn(e);return t.isRoot=!1,t}}function gn(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,o.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(Fe(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r){if(ne)ne(a());else throw a()}return G.createElement(r,e)};return o.preload=a,o}function _n(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function vn(e){let t=_n(e);return typeof t==`number`?t:typeof t==`string`?t.includes(`calc`)||t.includes(`var`)?t:t.includes(`px`)?Number(t.replace(`px`,``)):t.includes(`rem`)?Number(t.replace(`rem`,``))*16:t.includes(`em`)?Number(t.replace(`em`,``))*16:Number(t):NaN}function yn(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function bn(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].disabled)return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].disabled)return e}return e}function xn(e,t,n){for(let n=e+1;n{n?.(s);let c=Array.from(yn(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>Sn(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=xn(l,c,r),d=bn(l,c,r),f=a===`rtl`?d:u,p=a===`rtl`?u:d;switch(s.key){case`ArrowRight`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[f].focus(),i&&c[f].click());break;case`ArrowLeft`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[p].focus(),i&&c[p].click());break;case`ArrowUp`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[d].focus(),i&&c[d].click());break;case`ArrowDown`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[u].focus(),i&&c[u].click());break;case`Home`:s.stopPropagation(),s.preventDefault(),c[xn(-1,c,!1)]?.focus();break;case`End`:s.stopPropagation(),s.preventDefault(),c[bn(c.length,c,!1)]?.focus()}}}function wn(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||ge:n=>{n.key===`Escape`&&(e(n),t.onTrigger?.())}}function J(e,t){return n=>{e?.(n),t?.(n)}}function Tn(e,t){return e in t?vn(t[e]):vn(e)}function En(e,t){let n=e.map(e=>({value:e,px:Tn(e,t)}));return n.sort((e,t)=>e.px-t.px),n}function Dn(e,t,n){return n?Array.from(yn(n,t)?.querySelectorAll(e)||[]).findIndex(e=>e===n):null}var On=[`mousedown`,`touchstart`];function kn(e,t,n,r=!0){let i=(0,G.useRef)(null),a=t||On,o=(0,G.useEffectEvent)(t=>{let{target:r}=t??{};if(!document.body.contains(r)&&r?.tagName!==`HTML`)return;let a=t.composedPath();Array.isArray(n)?n.every(e=>!!e&&!a.includes(e))&&e(t):i.current&&!a.includes(i.current)&&e(t)}),s=a.join(`,`);return(0,G.useEffect)(()=>{if(!r)return;let e=s.split(`,`);return e.forEach(e=>document.addEventListener(e,o)),()=>{e.forEach(e=>document.removeEventListener(e,o))}},[s,r]),i}var An=[`mouse`,`touch`],jn=10;function Mn(e,t={}){let{threshold:n=400,events:r=An,cancelOnMove:i=!1,onStart:a,onFinish:o,onCancel:s}=t,c=(0,G.useRef)(!1),l=(0,G.useRef)(!1),u=(0,G.useRef)(-1),d=(0,G.useRef)(null);return(0,G.useEffect)(()=>()=>window.clearTimeout(u.current),[]),(0,G.useMemo)(()=>{if(typeof e!=`function`)return{};let t=i!==!1,f=i===!0?jn:i===!1?0:i,p=t=>{(Fn(t)||Pn(t))&&(a&&a(t),d.current=Nn(t),l.current=!0,u.current=window.setTimeout(()=>{e(t),c.current=!0},n))},m=e=>{(Fn(e)||Pn(e))&&(c.current?o&&o(e):l.current&&s&&s(e),c.current=!1,l.current=!1,d.current=null,u.current!==-1&&(window.clearTimeout(u.current),u.current=-1))},h=e=>{if(!t||!l.current||c.current)return;let n=Nn(e);if(!n||!d.current)return;let r=n.x-d.current.x,i=n.y-d.current.y;Math.sqrt(r*r+i*i)>f&&m(e)},g={};return r.includes(`mouse`)&&(g.onMouseDown=p,g.onMouseUp=m,g.onMouseLeave=m,t&&(g.onMouseMove=h)),r.includes(`touch`)&&(g.onTouchStart=p,g.onTouchEnd=m,g.onTouchCancel=m,t&&(g.onTouchMove=h)),g},[e,n,s,o,a,i,r.join(`,`)])}function Nn(e){if(Pn(e)){let t=e.touches[0]??e.changedTouches[0];return t?{x:t.clientX,y:t.clientY}:null}return{x:e.clientX,y:e.clientY}}function Pn(e){return window.TouchEvent?e.nativeEvent instanceof TouchEvent:`touches`in e.nativeEvent}function Fn(e){return e.nativeEvent instanceof MouseEvent}function In({color:e,theme:t,autoContrast:n,colorScheme:r}){return(typeof n==`boolean`?n:t.autoContrast)&&w({color:e||t.primaryColor,theme:t,colorScheme:r}).isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Ln(e,t,n){return In({color:n===`dark`?e.dark:e.light,theme:t,colorScheme:n,autoContrast:!0})}function Rn(e,t){let n=e.colors[e.primaryColor];return r(n)?e.autoContrast?Ln(n,e,t):`var(--mantine-color-white)`:In({color:n[i(e,t)],theme:e,autoContrast:null})}function zn({open:e,close:t,openDelay:n,closeDelay:r}){let i=(0,G.useRef)(-1),a=(0,G.useRef)(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(a.current)};return(0,G.useEffect)(()=>o,[]),{openDropdown:()=>{o(),n===0||n===void 0?e():i.current=window.setTimeout(e,n)},closeDropdown:()=>{o(),r===0||r===void 0?t():a.current=window.setTimeout(t,r)}}}var[Bn,Vn]=me(`Popover component was not found in the tree`);function Hn({childProps:e,disabled:t,opened:n,longPressDelay:r=500,setReference:i,open:a}){let o=(0,G.useRef)(!1),s=(0,G.useRef)(!1),c=(0,G.useRef)(null),l=(0,G.useRef)(t);l.current=t;let u=(e,t,n)=>{i({getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t,toJSON:()=>void 0}),contextElement:n}),a()},d=J(e.onMouseDown,e=>{t||e.button===2&&e.stopPropagation()}),f=J(e.onContextMenu,e=>{t||e.defaultPrevented||(e.preventDefault(),!s.current&&(u(e.clientX,e.clientY,e.currentTarget),o.current&&(s.current=!0)))}),p=Mn(e=>{if(l.current||s.current)return;let t=e,n=t.touches[0]??t.changedTouches[0];n&&(u(n.clientX,n.clientY,c.current),s.current=!0)},{threshold:r,events:[`touch`],cancelOnMove:!0,onStart:e=>{o.current=!0,s.current=!1,c.current=e.currentTarget},onFinish:e=>{o.current=!1,s.current=!1,l.current||e.preventDefault()},onCancel:()=>{o.current=!1,s.current=!1}});return{onContextMenu:f,onMouseDown:d,onTouchStart:J(e.onTouchStart,p.onTouchStart),onTouchEnd:J(e.onTouchEnd,p.onTouchEnd),onTouchCancel:J(e.onTouchCancel,p.onTouchCancel),onTouchMove:J(e.onTouchMove,p.onTouchMove),style:t?e.style:{...e.style,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},"data-expanded":n?!0:void 0}}function Un(e){let{children:t,disabled:n,longPressDelay:r}=v(`PopoverContextMenu`,null,e),i=H(t);if(!i)throw Error(`Popover.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let a=Vn();return(0,G.cloneElement)(i,Hn({childProps:i.props,disabled:n||a.disabled,opened:a.opened,longPressDelay:r,setReference:a.reference,open:()=>{a.opened||a.onToggle()}}))}Un.displayName=`@mantine/core/PopoverContextMenu`;var Wn={dropdown:`m_38a85659`,arrow:`m_a31dc6c1`,overlay:`m_3d7bc908`},Gn=n(t=>{let n=v(`PopoverDropdown`,null,t),{className:r,style:i,vars:a,children:o,onKeyDownCapture:s,variant:c,classNames:l,styles:u,ref:d,...f}=n,p=Vn(),{dir:m}=M(),g=p.arrowPosition===`merge`&&p.withArrow?ce({position:p.placement,dir:m}):void 0,_=ye({opened:p.opened,shouldReturnFocus:p.returnFocus}),y=p.withRoles?{"aria-labelledby":p.getTargetId(),id:p.getDropdownId(),role:`dialog`,tabIndex:-1}:{},b=e(d,p.floating);return p.disabled?null:(0,K.jsx)(R,{...p.portalProps,withinPortal:p.withinPortal,children:(0,K.jsx)(D,{mounted:p.opened,...p.transitionProps,transition:p.transitionProps?.transition||`fade`,duration:p.transitionProps?.duration??150,keepMounted:p.keepMounted,keepMountedMode:p.keepMountedMode,exitDuration:typeof p.transitionProps?.exitDuration==`number`?p.transitionProps.exitDuration:p.transitionProps?.duration,children:e=>(0,K.jsx)(Se,{active:p.trapFocus&&p.opened,innerRef:b,children:(0,K.jsxs)(O,{...y,...f,variant:c,onKeyDownCapture:wn(()=>{p.onClose?.(),p.onDismiss?.()},{active:p.closeOnEscape,onTrigger:_,onKeyDown:s}),"data-position":p.placement,"data-fixed":p.floatingStrategy===`fixed`||void 0,...p.getStyles(`dropdown`,{className:r,props:n,classNames:l,styles:u,style:[{...e,...g,zIndex:p.zIndex,top:p.y??0,left:p.x??0,width:p.width===`target`?void 0:h(p.width),...p.referenceHidden?{display:`none`}:null},p.resolvedStyles?.dropdown,u?.dropdown,i]}),children:[o,(0,K.jsx)(de,{ref:p.arrowRef,arrowX:p.arrowX,arrowY:p.arrowY,visible:p.withArrow,position:p.placement,arrowSize:p.arrowSize,arrowRadius:p.arrowRadius,arrowOffset:p.arrowOffset,arrowPosition:p.arrowPosition,...p.getStyles(`arrow`,{props:n,classNames:l,styles:u})})]})})})})});Gn.classes=Wn,Gn.displayName=`@mantine/core/PopoverDropdown`;var Kn={refProp:`ref`,popupType:`dialog`},qn=n(t=>{let{children:n,refProp:r,popupType:i,ref:a,...o}=v(`PopoverTarget`,Kn,t),s=H(n);if(!s)throw Error(`Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let c=o,l=Vn(),d=e(l.reference,ae(s),a),f=l.withRoles?{"aria-haspopup":i,"aria-expanded":l.opened,"aria-controls":l.opened?l.getDropdownId():void 0,id:l.getTargetId()}:{},p=s.props;return(0,G.cloneElement)(s,{...c,...f,...l.targetProps,className:u(l.targetProps.className,c.className,p.className),[r]:d,...l.controlled?null:{onClick:e=>{l.onToggle(),p.onClick?.(e)}}})});qn.displayName=`@mantine/core/PopoverTarget`;function Jn(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Yn(e,t,n,r){let i=Jn(e.middlewares),a=[F(e.offset),z()];if(i.flip&&!n){let e=typeof i.flip==`boolean`?{}:i.flip,t=r?{fallbackStrategy:`initialPlacement`,...e}:e;a.push(P(t))}if(i.shift){let t=typeof i.shift==`boolean`?{}:i.shift;a.push(se(n=>{let r=n.placement.startsWith(`top`)||n.placement.startsWith(`bottom`);return{limiter:ue(),padding:5,...e.width===`target`&&r?{mainAxis:!1}:null,...t}}))}return i.inline&&a.push(typeof i.inline==`boolean`?L():L(i.inline)),a.push(le({element:e.arrowRef,padding:e.arrowOffset})),(i.size||e.width===`target`)&&a.push(V({...typeof i.size==`boolean`?{}:i.size,apply({rects:n,availableWidth:r,availableHeight:a,...o}){let s=t().refs.floating.current?.style??{};i.size&&(typeof i.size==`object`&&i.size.apply?i.size.apply({rects:n,availableWidth:r,availableHeight:a,...o}):Object.assign(s,{maxWidth:`${r}px`,maxHeight:`${a}px`})),e.width===`target`&&Object.assign(s,{width:`${n.reference.width}px`})}})),a}function Xn(e){let[t,n]=A({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=(0,G.useRef)(t),[i,a]=(0,G.useState)(null),o=e.preventPositionChangeWhenVisible!==!1,s=(0,G.useRef)(t);t!==s.current&&(s.current=t,t&&i!==null&&a(null));let c=(0,G.useCallback)(()=>a(null),[]),l=()=>{t&&!e.disabled&&n(!1)},u=()=>{e.disabled||n(!t)},d=N({open:t,strategy:e.strategy,placement:o?i??e.position:e.position,middleware:Yn(e,()=>d,o&&i!==null,o),whileElementsMounted:e.keepMounted?void 0:he});(0,G.useEffect)(()=>{if(!e.keepMounted)return;let n=d.refs.reference.current,r=d.refs.floating.current;if(t&&n&&r)return he(n,r,d.update)},[e.keepMounted,t,d.update,d.elements.reference,d.elements.floating]);let f=(0,G.useRef)(!1);S(()=>{if(!t){f.current=!1;return}if(!o||i!==null)return;let e=d.refs.floating.current;if(e&&e.offsetHeight!==0&&e.offsetWidth!==0){if(!f.current){f.current=!0,d.update();return}d.isPositioned&&a(d.placement)}},[o,t,d.isPositioned,d.placement,i,d.update]);let p=(0,G.useRef)(d.placement);return S(()=>{p.current!==d.placement&&(p.current=d.placement,e.onPositionChange?.(d.placement))},[d.placement]),E(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:d,controlled:typeof e.opened==`boolean`,opened:t,onClose:l,onToggle:u,resetLockedPlacement:c}}var Zn={position:`bottom`,offset:8,transitionProps:{transition:`fade`,duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,preventPositionChangeWhenVisible:!0,clickOutsideEvents:[`mousedown`,`touchstart`],zIndex:ie(`popover`),__staticSelector:`Popover`,width:`max-content`},Qn=l((e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:p(t),"--popover-shadow":C(n)}}));function Y(e){let n=v(`Popover`,Zn,e),{children:r,position:i,offset:a,onPositionChange:o,opened:s,transitionProps:c,onExitTransitionEnd:l,onEnterTransitionEnd:u,width:d,middlewares:f,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:_,arrowPosition:b,unstyled:x,classNames:S,styles:C,closeOnClickOutside:w,withinPortal:T,portalProps:E,closeOnEscape:O,clickOutsideEvents:A,trapFocus:ee,onClose:te,onDismiss:j,onOpen:ne,onChange:re,zIndex:ie,radius:ae,shadow:oe,id:se,defaultOpened:ce,__staticSelector:N,withRoles:le,disabled:P,returnFocus:F,variant:ue,keepMounted:de,keepMountedMode:I,vars:L,floatingStrategy:z,withOverlay:pe,overlayProps:B,hideDetached:V,attributes:me,preventPositionChangeWhenVisible:H,...he}=n,ge=y({name:N,props:n,classes:Wn,classNames:S,styles:C,unstyled:x,attributes:me,rootSelector:`dropdown`,vars:L,varsResolver:Qn}),{resolvedStyles:ve}=t({classNames:S,styles:C,props:n}),ye=(0,G.useRef)(null),[be,xe]=(0,G.useState)(null),[Se,Ce]=(0,G.useState)(null),{dir:we}=M(),Te=k(),Ee=g(se),U=Xn({middlewares:f,width:d,position:fe(we,i),offset:typeof a==`number`?a+(p?m/2:0):a,arrowRef:ye,arrowOffset:h,onPositionChange:o,opened:s,defaultOpened:ce,onChange:re,onOpen:ne,onClose:te,onDismiss:j,strategy:z,disabled:P,preventPositionChangeWhenVisible:H,keepMounted:de});kn(()=>{w&&(U.onClose(),j?.())},A,[be,Se]);let De=(0,G.useCallback)(e=>{xe(e),U.floating.refs.setReference(e)},[U.floating.refs.setReference]),Oe=(0,G.useCallback)(e=>{Ce(e),U.floating.refs.setFloating(e)},[U.floating.refs.setFloating]),ke=(0,G.useCallback)(()=>{c?.onExited?.(),l?.(),U.resetLockedPlacement()},[c?.onExited,l,U.resetLockedPlacement]),Ae=(0,G.useCallback)(()=>{c?.onEntered?.(),u?.()},[c?.onEntered,u]);return(0,K.jsxs)(Bn,{value:{returnFocus:F,disabled:P,controlled:U.controlled,reference:De,floating:Oe,x:U.floating.x,y:U.floating.y,arrowX:U.floating?.middlewareData?.arrow?.x,arrowY:U.floating?.middlewareData?.arrow?.y,opened:U.opened,arrowRef:ye,transitionProps:{...c,onExited:ke,onEntered:Ae},width:d,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:_,arrowPosition:b,placement:U.floating.placement,trapFocus:ee,withinPortal:T,portalProps:E,zIndex:ie,radius:ae,shadow:oe,closeOnEscape:O,onDismiss:j,onClose:U.onClose,onToggle:U.onToggle,getTargetId:()=>Ee,getDropdownId:()=>`${Ee}-dropdown`,withRoles:le,targetProps:he,__staticSelector:N,classNames:S,styles:C,unstyled:x,variant:ue,keepMounted:de,keepMountedMode:I,getStyles:ge,resolvedStyles:ve,floatingStrategy:z,referenceHidden:V&&Te!==`test`?U.floating.middlewareData.hide?.referenceHidden:!1},children:[r,pe&&(0,K.jsx)(D,{transition:`fade`,mounted:U.opened,duration:c?.duration||250,exitDuration:c?.exitDuration||250,children:e=>(0,K.jsx)(R,{withinPortal:T,children:(0,K.jsx)(_e,{...B,...ge(`overlay`,{className:B?.className,style:[e,B?.style]})})})})]})}Y.Target=qn,Y.Dropdown=Gn,Y.ContextMenu=Un,Y.varsResolver=Qn,Y.displayName=`@mantine/core/Popover`,Y.extend=e=>e,Y.withProps=e=>{let t=t=>(0,K.jsx)(Y,{...e,...t});return t.extend=Y.extend,t.displayName=`WithProps(${Y.displayName})`,t};function $n({style:e,size:t=16,...n}){return(0,K.jsx)(`svg`,{viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{...e,width:h(t),height:h(t),display:`block`},...n,children:(0,K.jsx)(`path`,{d:`M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}$n.displayName=`@mantine/core/AccordionChevron`;function er({size:e,style:t,...n}){return(0,K.jsx)(`svg`,{viewBox:`0 0 10 7`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:e===void 0?t:{width:h(e),height:h(e),...t},"aria-hidden":!0,...n,children:(0,K.jsx)(`path`,{d:`M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}var tr={root:`m_347db0ec`,"root--dot":`m_fbd81e3d`,label:`m_5add502a`,section:`m_91fdda9b`},nr=l((e,{radius:t,color:n,gradient:r,variant:i,size:o,autoContrast:s,circle:c})=>{let l=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:s});return{root:{"--badge-height":T(o,`badge-height`),"--badge-padding-x":T(o,`badge-padding-x`),"--badge-fz":T(o,`badge-fz`),"--badge-radius":c||t===void 0?void 0:p(t),"--badge-bg":n||i?l.background:void 0,"--badge-color":n||i?l.color:void 0,"--badge-bd":n||i?l.border:void 0,"--badge-dot-color":i===`dot`?a(n,e):void 0}}}),rr=s(e=>{let t=v(`Badge`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,radius:c,color:l,gradient:u,leftSection:d,rightSection:f,children:p,variant:m,fullWidth:h,autoContrast:g,circle:_,mod:b,attributes:x,...S}=t,C=y({name:`Badge`,props:t,classes:tr,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:x,vars:s,varsResolver:nr});return(0,K.jsxs)(O,{variant:m,mod:[{block:h,circle:_,"with-right-section":!!f,"with-left-section":!!d},b],...C(`root`,{variant:m}),...S,children:[d&&(0,K.jsx)(`span`,{...C(`section`),"data-position":`left`,children:d}),(0,K.jsx)(`span`,{...C(`label`),children:p}),f&&(0,K.jsx)(`span`,{...C(`section`),"data-position":`right`,children:f})]})});rr.classes=tr,rr.varsResolver=nr,rr.displayName=`@mantine/core/Badge`;var[ir,X]=me(`Menu component was not found in the tree`),ar=(0,G.createContext)(null);function or(e){let{value:t,defaultValue:n,onChange:r,children:i}=v(`MenuCheckboxGroup`,null,e),[a,o]=A({value:t,defaultValue:n,finalValue:[],onChange:r});return(0,K.jsx)(ar,{value:{values:a,onChange:(0,G.useCallback)(e=>{o(a.includes(e)?a.filter(t=>t!==e):[...a,e])},[a,o])},children:i})}or.displayName=`@mantine/core/MenuCheckboxGroup`;var sr=(0,G.createContext)(null);function cr({role:t,checked:n,indicator:r,onSelect:i,color:a,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,dataDisabled:d,className:f,style:p,styles:h,classNames:g,buttonRef:_,others:v}){let y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=J(v.onClick,()=>{d||(i(),s&&y.closeDropdownImmediately())}),E=J(v.onMouseMove,()=>{if(!y.hasSearch)return;let e=C.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==C.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),D=J(v.onKeyDown,e=>{e.key===`ArrowLeft`&&b&&(b.close(),b.focusParentItem())}),O=a?x.variantColorResolver({color:a,theme:x,variant:`light`}):void 0,k=a?w({color:a,theme:x}):null,A=y.alignItemsLabels!==`none`||n;return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),...v,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:f,style:p,styles:h,classNames:g}),ref:e(C,_),role:t,"aria-checked":n,disabled:u,"data-menu-item":!0,"data-checked":n||void 0,"data-disabled":u||d||void 0,"data-mantine-stop-propagation":!0,onClick:T,onMouseMove:E,onKeyDown:Cn({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,orientation:`vertical`,onKeyDown:D}),__vars:{"--menu-item-color":k?.isThemeColor&&k?.shade===void 0?`var(--mantine-color-${k.color}-6)`:O?.color,"--menu-item-hover":O?.hover},children:[A&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:h,classNames:g}),"data-checked":n||void 0,children:n?r:null}),l&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:h,classNames:g}),"data-menu-item-label":!0,children:l}),c&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:h,classNames:g}),"data-position":`right`,children:c})]})}var Z={dropdown:`m_dc9b7c9f`,label:`m_9bfac126`,divider:`m_efdf90cb`,item:`m_99ac2aa1`,search:`m_ef8769b6`,itemLabel:`m_5476e0d3`,itemIndicator:`m_8395186e`,itemSection:`m_8b75e504`,chevron:`m_b85b0bed`},lr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,color:o,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,"data-disabled":d,value:f,checked:p,defaultChecked:m,onChange:h,checkIcon:g,ref:_,...y}=v(`MenuCheckboxItem`,null,e),b=X(),x=(0,G.use)(ar),S=x&&f!==void 0?x.values.includes(f):void 0,[C,w]=A({value:p??S,defaultValue:m,finalValue:!1,onChange:h});return(0,K.jsx)(cr,{role:`menuitemcheckbox`,checked:C,indicator:g??b.checkIcon??(0,K.jsx)(er,{size:10}),onSelect:()=>{h?w(!C):x&&f!==void 0?x.onChange(f):w(!C)},color:o,closeMenuOnClick:s,rightSection:c,disabled:u,dataDisabled:d,className:n,style:r,styles:i,classNames:t,buttonRef:_,others:y,children:l})});lr.classes=Z,lr.displayName=`@mantine/core/MenuCheckboxItem`;function ur(e){let{children:t,disabled:n,longPressDelay:r}=v(`MenuContextMenu`,null,e),i=H(t);if(!i)throw Error(`Menu.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let a=X(),o=Vn();return(0,G.cloneElement)(i,Hn({childProps:i.props,disabled:n||o.disabled,opened:a.opened,longPressDelay:r,setReference:o.reference,open:()=>a.openDropdown()}))}ur.displayName=`@mantine/core/MenuContextMenu`;var dr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=v(`MenuDivider`,null,e);return(0,K.jsx)(O,{...X().getStyles(`divider`,{className:n,style:r,styles:i,classNames:t}),...o})});dr.classes=Z,dr.displayName=`@mantine/core/MenuDivider`;var fr=500;function pr(e){return((e.querySelector(`[data-menu-item-label]`)??e).textContent??``).trim().toLowerCase()}function mr(e){return e.length>1&&e.split(``).every(t=>t===e[0])}function hr({enabled:e,opened:t,getDropdown:n}){let r=(0,G.useRef)({buffer:``,timeoutId:null});return(0,G.useEffect)(()=>{if(t&&e)return;let n=r.current;n.timeoutId!==null&&(window.clearTimeout(n.timeoutId),n.timeoutId=null),n.buffer=``},[t,e]),(0,G.useEffect)(()=>()=>{let{timeoutId:e}=r.current;e!==null&&window.clearTimeout(e)},[]),t=>{if(!e||t.defaultPrevented||t.ctrlKey||t.metaKey||t.altKey||t.key.length!==1||t.key===` `)return;let i=t.target;if(i&&(i.tagName===`INPUT`||i.tagName===`TEXTAREA`||i.tagName===`SELECT`||i.isContentEditable))return;let a=n();if(!a)return;let o=Array.from(a.querySelectorAll(`[data-menu-item]:not([data-disabled])`)).filter(e=>e.closest(`[data-menu-dropdown]`)===a);if(o.length===0)return;let s=r.current;s.buffer=(s.buffer+t.key).toLowerCase(),s.timeoutId!==null&&window.clearTimeout(s.timeoutId),s.timeoutId=window.setTimeout(()=>{s.buffer=``,s.timeoutId=null},fr);let c=document.activeElement,l=c?o.indexOf(c):-1,u=null;if(s.buffer.length===1||mr(s.buffer)){let e=s.buffer[0],t=l+1;for(let n=0;n{let{classNames:n,className:r,style:i,styles:a,vars:o,onMouseEnter:s,onMouseLeave:c,onKeyDown:l,children:u,ref:d,...f}=v(`MenuDropdown`,null,t),p=(0,G.useRef)(null),m=X(),h=hr({enabled:!m.hasSearch,opened:m.opened,getDropdown:()=>p.current}),g=J(l,e=>{h(e),!(e.defaultPrevented||m.hasSearch)&&(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),p.current?.querySelectorAll(`[data-menu-item]:not(:disabled)`)[0]?.focus())}),_=J(s,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.openDropdown()),y=J(c,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.closeDropdown());return(0,K.jsxs)(Y.Dropdown,{...f,onMouseEnter:_,onMouseLeave:y,role:`menu`,"aria-orientation":`vertical`,ref:e(d,p),...m.getStyles(`dropdown`,{className:r,style:i,styles:a,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:g,children:[m.withInitialFocusPlaceholder&&!m.hasSearch&&(0,K.jsx)(`div`,{role:`presentation`,tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),u]})});gr.classes=Z,gr.displayName=`@mantine/core/MenuDropdown`;var _r=s(t=>{let{classNames:n,className:r,style:i,styles:a,vars:s,color:c,closeMenuOnClick:l,leftSection:u,rightSection:d,children:f,disabled:p,"data-disabled":h,ref:g,..._}=v(`MenuItem`,null,t),y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=_,E=J(T.onClick,()=>{h||(typeof l==`boolean`?l&&y.closeDropdownImmediately():y.closeOnItemClick&&y.closeDropdownImmediately())}),D=J(T.onMouseMove,()=>{if(!y.hasSearch)return;let e=C.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==C.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),O=c?x.variantColorResolver({color:c,theme:x,variant:`light`}):void 0,k=c?w({color:c,theme:x}):null,A=J(T.onKeyDown,e=>{e.key===`ArrowLeft`&&b&&(b.close(),b.focusParentItem())});return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),..._,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:r,style:i,styles:a,classNames:n}),ref:e(C,g),role:`menuitem`,disabled:p,"data-menu-item":!0,"data-disabled":p||h||void 0,"data-mantine-stop-propagation":!0,onClick:E,onMouseMove:D,onKeyDown:Cn({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,orientation:`vertical`,onKeyDown:A}),__vars:{"--menu-item-color":k?.isThemeColor&&k?.shade===void 0?`var(--mantine-color-${k.color}-6)`:O?.color,"--menu-item-hover":O?.hover},children:[y.alignItemsLabels===`all`&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:a,classNames:n}),"data-placeholder":!0}),u&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`left`,children:u}),f&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:a,classNames:n}),"data-menu-item-label":!0,children:f}),d&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`right`,children:d})]})});_r.classes=Z,_r.displayName=`@mantine/core/MenuItem`;var vr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=v(`MenuLabel`,null,e);return(0,K.jsx)(O,{...X().getStyles(`label`,{className:n,style:r,styles:i,classNames:t}),...o})});vr.classes=Z,vr.displayName=`@mantine/core/MenuLabel`;var yr=(0,G.createContext)(null);function br(e){let{value:t,defaultValue:n,onChange:r,children:i}=v(`MenuRadioGroup`,null,e),[a,o]=A({value:t,defaultValue:n,finalValue:null,onChange:r});return(0,K.jsx)(yr,{value:{value:a,onChange:e=>o(e)},children:i})}br.displayName=`@mantine/core/MenuRadioGroup`;function xr({size:e,style:t,...n}){return(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 5 5`,style:{width:h(e),height:h(e),...t},"aria-hidden":!0,...n,children:(0,K.jsx)(`circle`,{cx:`2.5`,cy:`2.5`,r:`2.5`,fill:`currentColor`})})}var Sr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,color:o,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,"data-disabled":d,value:f,checked:p,onChange:m,checkIcon:h,ref:g,..._}=v(`MenuRadioItem`,null,e),y=X(),b=(0,G.use)(yr),x=p??(b?b.value===f:!1);return(0,K.jsx)(cr,{role:`menuitemradio`,checked:x,indicator:h??y.checkIcon??(0,K.jsx)(xr,{size:5}),onSelect:()=>{x||(m?m(f):b&&b.onChange(f))},color:o,closeMenuOnClick:s,rightSection:c,disabled:u,dataDisabled:d,className:n,style:r,styles:i,classNames:t,buttonRef:g,others:_,children:l})});Sr.classes=Z,Sr.displayName=`@mantine/core/MenuRadioItem`;var Cr=`[data-menu-item]:not([data-disabled])`,wr=`[data-menu-active]`;function Tr(e){return e?.closest(`[data-menu-dropdown]`)}function Er(e){return e?Array.from(e.querySelectorAll(Cr)).filter(t=>t.closest(`[data-menu-dropdown]`)===e):[]}function Dr(e){e&&e.querySelectorAll(wr).forEach(t=>{t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}function Or(e,t){Dr(t),e&&(e.setAttribute(`data-menu-active`,`true`),e.scrollIntoView({block:`nearest`}))}function kr(e){return e.findIndex(e=>e.hasAttribute(`data-menu-active`))}var Ar={clearSearchOnClose:!0},jr=n(t=>{let{classNames:n,styles:r,onKeyDown:i,onChange:a,size:o,clearSearchOnClose:s,ref:c,...l}=v(`MenuSearch`,Ar,t),u=X(),d=(0,G.useRef)(null),f=e(c,d),p=(0,G.useRef)(a);p.current=a,(0,G.useEffect)(()=>u.registerSearch(),[u.registerSearch]),(0,G.useEffect)(()=>{s?u.searchExitClearRef.current=()=>{p.current?.({currentTarget:{value:``}})}:u.searchExitClearRef.current=null},[s,u.searchExitClearRef]),(0,G.useEffect)(()=>{u.opened||Dr(Tr(d.current))},[u.opened]);let m=J(a,e=>{Dr(Tr(e.currentTarget))}),h=J(i,e=>{if(e.defaultPrevented)return;let t=Tr(e.currentTarget),n=Er(t);if(e.key===`ArrowDown`){if(e.preventDefault(),n.length===0)return;let r=kr(n);Or(n[r>=n.length-1?u.loop?0:r:r+1]??null,t)}else if(e.key===`ArrowUp`){if(e.preventDefault(),n.length===0)return;let r=kr(n);Or(n[r<=0?r===-1||u.loop?n.length-1:0:r-1]??null,t)}else if(e.key===`Home`)e.preventDefault(),n.length>0&&Or(n[0],t);else if(e.key===`End`)e.preventDefault(),n.length>0&&Or(n[n.length-1],t);else if(e.key===`Enter`){if(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)return;let t=n[kr(n)];t&&(e.preventDefault(),t.hasAttribute(`data-sub-menu-item`)?(t.focus(),t.dispatchEvent(new KeyboardEvent(`keydown`,{key:`ArrowRight`,bubbles:!0}))):t.click())}}),g=u.getStyles(`search`);return(0,K.jsx)(b,{"data-autofocus":!0,"data-mantine-stop-propagation":!0,type:`search`,size:o,...l,ref:f,classNames:[{input:g.className},n],styles:[{input:g.style},r],onKeyDown:h,onChange:m,__staticSelector:`Menu`})});jr.classes=Z,jr.displayName=`@mantine/core/MenuSearch`;var Mr=n(t=>{let{classNames:n,className:r,style:i,styles:a,vars:o,onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u,onKeyDown:d,children:f,ref:p,...m}=v(`MenuSubDropdown`,null,t),h=(0,G.useRef)(null),g=X(),_=(0,G.use)(sr),y=hr({enabled:!g.hasSearch,opened:_?.opened??!1,getDropdown:()=>h.current}),b=J(d,e=>{y(e),!e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1&&e.key!==` `&&e.stopPropagation()}),x=_?.getFloatingProps({onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u});return(0,K.jsx)(Y.Dropdown,{...m,...x,role:`menu`,"aria-orientation":`vertical`,ref:e(p,h,_?.setFloating),...g.getStyles(`dropdown`,{className:r,style:i,styles:a,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:b,children:f})});Mr.classes=Z,Mr.displayName=`@mantine/core/MenuSubDropdown`;var Nr=s(t=>{let{classNames:n,className:r,style:i,styles:a,vars:s,color:c,leftSection:l,rightSection:u,children:d,disabled:f,"data-disabled":p,closeMenuOnClick:h,ref:g,..._}=v(`MenuSubItem`,null,t),y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=_,E=c?x.variantColorResolver({color:c,theme:x,variant:`light`}):void 0,D=c?w({color:c,theme:x}):null,O=J(T.onKeyDown,e=>{e.key===`ArrowRight`&&(b?.open(),b?.focusFirstItem()),e.key===`ArrowLeft`&&b?.parentContext&&(b.parentContext.close(),b.parentContext.focusParentItem())}),k=J(T.onClick,()=>{!p&&h&&y.closeDropdownImmediately()}),A=J(T.onMouseMove,()=>{if(!y.hasSearch)return;let e=C.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==C.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),ee=b?.getReferenceProps({onMouseEnter:T.onMouseEnter,onMouseLeave:T.onMouseLeave,onPointerEnter:T.onPointerEnter,onPointerLeave:T.onPointerLeave});return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),..._,...ee,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:r,style:i,styles:a,classNames:n}),ref:e(C,g,b?.setReference),role:`menuitem`,disabled:f,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":f||p||void 0,"data-mantine-stop-propagation":!0,onClick:k,onMouseMove:A,onKeyDown:Cn({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,orientation:`vertical`,onKeyDown:O}),__vars:{"--menu-item-color":D?.isThemeColor&&D?.shade===void 0?`var(--mantine-color-${D.color}-6)`:E?.color,"--menu-item-hover":E?.hover},children:[y.alignItemsLabels===`all`&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:a,classNames:n}),"data-placeholder":!0}),l&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`left`,children:l}),d&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:a,classNames:n}),"data-menu-item-label":!0,children:d}),(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`right`,children:u||(0,K.jsx)($n,{...y.getStyles(`chevron`),size:14})})]})});Nr.classes=Z,Nr.displayName=`@mantine/core/MenuSubItem`;function Pr({children:e,refProp:t}){if(!oe(e))throw Error(`Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return X(),(0,K.jsx)(Y.Target,{refProp:t,popupType:`menu`,children:e})}Pr.displayName=`@mantine/core/MenuSubTarget`;var Fr={offset:0,position:`right-start`,safeAreaPolygon:!0,transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function Ir(e){let{children:t,closeDelay:n,openDelay:r,position:i,safeAreaPolygon:a,opened:o,onChange:s,...c}=v(`MenuSub`,Fr,e),l=g(),[u,d]=A({value:o,finalValue:!1,onChange:s}),f=(0,G.use)(sr),p=X(),{dir:m}=M(),h=fe(m,i),_=f?.registerOpenSub??p.registerOpenSub,y=(0,G.useRef)(null),b=(0,G.useCallback)(e=>{let t=y.current;return t&&t!==e&&t(),y.current=e,()=>{y.current===e&&(y.current=null)}},[]),x=(0,G.useRef)(d);x.current=d;let S=(0,G.useCallback)(()=>x.current(!0),[]),C=(0,G.useCallback)(()=>x.current(!1),[]);(0,G.useEffect)(()=>{if(u)return _(C)},[u,_,C]);let{context:w,refs:T}=N({placement:h,open:u,onOpenChange:e=>{e?S():C()}}),{getReferenceProps:E,getFloatingProps:D}=B([I(w,{handleClose:a?pe(typeof a==`object`?a:void 0):void 0,delay:{open:r,close:n}})]);return(0,K.jsx)(sr,{value:{opened:u,close:C,open:S,focusFirstItem:()=>window.setTimeout(()=>{document.getElementById(`${l}-dropdown`)?.querySelectorAll(`[data-menu-item]:not([data-disabled])`)[0]?.focus()},16),focusParentItem:()=>window.setTimeout(()=>{document.getElementById(`${l}-target`)?.focus()},16),parentContext:f,setReference:T.setReference,setFloating:T.setFloating,getReferenceProps:E,getFloatingProps:D,registerOpenSub:b},children:(0,K.jsx)(Y,{opened:u,onChange:e=>e?S():C(),withinPortal:!1,withArrow:!1,id:l,position:i,...c,children:t})})}Ir.extend=e=>e,Ir.displayName=`@mantine/core/MenuSub`,Ir.Target=Pr,Ir.Dropdown=Mr,Ir.Item=Nr;var Lr={refProp:`ref`};function Rr(e){let{children:t,refProp:n,...r}=v(`MenuTarget`,Lr,e),i=H(t);if(!i)throw Error(`Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let a=X(),o=i.props,s=J(o.onClick,()=>{a.trigger===`click`?a.toggleDropdown():a.trigger===`click-hover`&&(a.setOpenedViaClick(!0),a.opened||a.openDropdown())}),c=J(o.onMouseEnter,()=>(a.trigger===`hover`||a.trigger===`click-hover`)&&a.openDropdown()),l=J(o.onMouseLeave,()=>{(a.trigger===`hover`||a.trigger===`click-hover`&&!a.openedViaClick)&&a.closeDropdown()});return(0,K.jsx)(Y.Target,{refProp:n,popupType:`menu`,...r,children:(0,G.cloneElement)(i,{onClick:s,onMouseEnter:c,onMouseLeave:l,"data-expanded":a.opened?!0:void 0})})}Rr.displayName=`@mantine/core/MenuTarget`;var zr={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:[`mousedown`,`touchstart`,`keydown`],loop:!0,trigger:`click`,openDelay:0,closeDelay:100,menuItemTabIndex:-1,alignItemsLabels:`with-indicators`},Q=n(e=>{let n=v(`Menu`,zr,e),{children:r,onOpen:i,onClose:a,opened:o,defaultOpened:s,trapFocus:c,onChange:l,closeOnItemClick:u,loop:d,closeOnEscape:f,trigger:p,openDelay:m,closeDelay:h,classNames:g,styles:_,unstyled:b,variant:x,vars:S,menuItemTabIndex:C,keepMounted:w,withInitialFocusPlaceholder:T,attributes:E,onExitTransitionEnd:D,alignItemsLabels:O,checkIcon:k,...ee}=n,te=y({name:`Menu`,classes:Z,props:n,classNames:g,styles:_,unstyled:b,attributes:E}),[j,ne]=A({value:o,defaultValue:s,finalValue:!1,onChange:l}),[re,ie]=(0,G.useState)(!1),ae=()=>{ne(!1),ie(!1),j&&a?.()},oe=()=>{ne(!0),!j&&i?.()},se=()=>{j?ae():oe()},{openDropdown:ce,closeDropdown:M}=zn({open:oe,close:ae,closeDelay:h,openDelay:m}),N=(0,G.useRef)(null),le=(0,G.useCallback)(e=>{let t=N.current;return t&&t!==e&&t(),N.current=e,()=>{N.current===e&&(N.current=null)}},[]),P=(0,G.useRef)(0),[F,ue]=(0,G.useState)(!1),de=(0,G.useCallback)(()=>(P.current+=1,P.current===1&&ue(!0),()=>{--P.current,P.current===0&&ue(!1)}),[]),I=(0,G.useRef)(null),L=()=>{I.current?.(),D?.()},R=e=>Dn(`[data-menu-item]`,`[data-menu-dropdown]`,e),{resolvedClassNames:z,resolvedStyles:fe}=t({classNames:g,styles:_,props:n});return(0,K.jsx)(ir,{value:{getStyles:te,opened:j,toggleDropdown:se,getItemIndex:R,openedViaClick:re,setOpenedViaClick:ie,closeOnItemClick:u,closeDropdown:p===`click`?ae:M,openDropdown:p===`click`?oe:ce,closeDropdownImmediately:ae,loop:d,trigger:p,unstyled:b,menuItemTabIndex:C,withInitialFocusPlaceholder:T,registerOpenSub:le,hasSearch:F,registerSearch:de,searchExitClearRef:I,alignItemsLabels:O,checkIcon:k},children:(0,K.jsx)(Y,{returnFocus:!0,...ee,opened:j,onChange:se,defaultOpened:s,trapFocus:!w&&c,closeOnEscape:f,__staticSelector:`Menu`,classNames:z,styles:fe,unstyled:b,variant:x,keepMounted:w,onExitTransitionEnd:L,children:r})})});Q.displayName=`@mantine/core/Menu`,Q.classes=Z,Q.Item=_r,Q.Label=vr,Q.Dropdown=gr,Q.Target=Rr,Q.Divider=dr,Q.Search=jr,Q.Sub=Ir,Q.CheckboxItem=lr,Q.CheckboxGroup=or,Q.RadioItem=Sr,Q.RadioGroup=br,Q.ContextMenu=ur;var Br=new Map([[`bold`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z`}))],[`duotone`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z`,opacity:`0.2`}),G.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`fill`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z`}))],[`light`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z`}))],[`regular`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`thin`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z`}))]]),Vr=new Map([[`bold`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),G.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),Hr=new Map([[`bold`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),G.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),Ur=new Map([[`bold`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),G.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),Wr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Br}));Wr.displayName=`DotsThreeIcon`;var Gr=Wr,Kr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Vr}));Kr.displayName=`PlusIcon`;var qr=Kr,Jr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Hr}));Jr.displayName=`SparkleIcon`;var Yr=Jr,Xr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Ur}));Xr.displayName=`TrashIcon`;var Zr=Xr,$=[];for(let e=0;e<256;++e)$.push((e+256).toString(16).slice(1));function Qr(e,t=0){return($[e[t+0]]+$[e[t+1]]+$[e[t+2]]+$[e[t+3]]+`-`+$[e[t+4]]+$[e[t+5]]+`-`+$[e[t+6]]+$[e[t+7]]+`-`+$[e[t+8]]+$[e[t+9]]+`-`+$[e[t+10]]+$[e[t+11]]+$[e[t+12]]+$[e[t+13]]+$[e[t+14]]+$[e[t+15]]).toLowerCase()}var $r=new Uint8Array(16);function ei(){return crypto.getRandomValues($r)}var ti={};function ni(e,t,n){let r;if(e)r=ii(e.random??e.rng?.()??ei(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=ei();ri(ti,e,i),r=ii(i,ti.msecs,ti.seq,t,n)}return t??Qr(r)}function ri(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=ai(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function ii(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=ai(e),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}function ai(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function oi(){return ni()}var si=[{value:`15m`,label:`15 minutes`},{value:`1h`,label:`1 hour`},{value:`6h`,label:`6 hours`},{value:`24h`,label:`24 hours`},{value:`168h`,label:`7 days`},{value:`720h`,label:`30 days`}];function ci(e){return si.find(t=>t.value===e)?.label??e}function li(e,t){let n=e?.[t];return typeof n==`string`?n:``}function ui(e,t,n=[]){let r=new URLSearchParams({window:e.window,limit:`40`});e.namespace&&r.set(`namespace`,e.namespace);for(let e of n){let n=li(t,e);n&&r.set(e,n)}return r}function di(e,t){return[`observability`,e,t.toString()]}var fi=e=>e.state.status===`error`?15e3:3e4;function pi(e,t,n=!0){return be({queryKey:di(e,t),queryFn:()=>xe(`/api/observability/${e}?${t}`),enabled:n,refetchInterval:fi})}function mi(e){return e.getQueryCache().findAll({queryKey:[`observability`]}).reduce((e,t)=>Math.max(e,t.state.dataUpdatedAt),0)||null}function hi(){let e=ve(),[t,n]=(0,G.useState)(()=>mi(e));return(0,G.useEffect)(()=>e.getQueryCache().subscribe(()=>n(mi(e))),[e]),t}function gi(e){let t={};return typeof e.window==`string`&&si.some(t=>t.value===e.window)&&(t.window=e.window),typeof e.namespace==`string`&&e.namespace.trim()&&(t.namespace=e.namespace.trim()),t}var _i=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],vi=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],yi=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],bi=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],xi=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],Si=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],Ci={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#565b69`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#a4abb4`}},wi={dark:[`#66d0ee`,`#a97ce0`,`#5fe8ce`,`#cb55e8`,`#41b6f8`,`#d2a6ff`],light:[`#2b93b5`,`#7c4dcc`,`#1a9c86`,`#a12fbf`,`#2f7fd4`,`#9163d6`]},Ti={micro:11,small:12,body:14,title:16,section:22,page:32},Ei={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`};export{Qe as $,En as A,jt as B,Q as C,In as D,Y as E,mn as F,pt as G,Tt as H,Kt as I,gt as J,bt as K,Ut as L,vn as M,gn as N,Rn as O,hn as P,et as Q,Vt as R,Gr as S,er as T,xt as U,Dt as V,Ct as W,$e as X,ot as Y,tt as Z,ci as _,Ei as a,Pe as at,Yr as b,wi as c,U as ct,gi as d,Oe as dt,rt as et,li as f,ke as ft,ui as g,pi as h,Ci as i,Ve as it,Tn as j,Ln as k,Ti as l,Be as lt,hi as m,xi as n,ze as nt,Si as o,He as ot,si as p,_t as q,vi as r,Ue as rt,yi as s,we as st,_i as t,Ge as tt,bi as u,Ce as ut,oi as v,rr as w,qr as x,Zr as y,Pt as z}; \ No newline at end of file diff --git a/internal/ui/dist/index.html b/internal/ui/dist/index.html index fe5b808e4..4327966b9 100644 --- a/internal/ui/dist/index.html +++ b/internal/ui/dist/index.html @@ -21,12 +21,14 @@ document.documentElement.setAttribute("data-mantine-color-scheme", computed); } catch (e) {} - + - - + + - + + + diff --git a/ui/host/src/routeTree.gen.ts b/ui/host/src/routeTree.gen.ts index 98585ec2f..b275882e4 100644 --- a/ui/host/src/routeTree.gen.ts +++ b/ui/host/src/routeTree.gen.ts @@ -10,6 +10,7 @@ import { Route as rootRouteImport } from './routes/__root' import { Route as IndexRouteImport } from './routes/index' +import { Route as SettingsRouteImport } from './routes/settings' import { Route as ChatIndexRouteImport } from './routes/chat.index' import { Route as ChatThreadIdRouteImport } from './routes/chat.$threadId' import { Route as DashboardsIndexRouteImport } from './routes/dashboards.index' @@ -20,6 +21,11 @@ const IndexRoute = IndexRouteImport.update({ path: '/', getParentRoute: () => rootRouteImport, } as any) +const SettingsRoute = SettingsRouteImport.update({ + id: '/settings', + path: '/settings', + getParentRoute: () => rootRouteImport, +} as any) const ChatIndexRoute = ChatIndexRouteImport.update({ id: '/chat/', path: '/chat/', @@ -43,6 +49,7 @@ const DashboardsDashboardIdRoute = DashboardsDashboardIdRouteImport.update({ export interface FileRoutesByFullPath { '/': typeof IndexRoute + '/settings': typeof SettingsRoute '/chat/$threadId': typeof ChatThreadIdRoute '/dashboards/$dashboardId': typeof DashboardsDashboardIdRoute '/chat/': typeof ChatIndexRoute @@ -50,6 +57,7 @@ export interface FileRoutesByFullPath { } export interface FileRoutesByTo { '/': typeof IndexRoute + '/settings': typeof SettingsRoute '/chat/$threadId': typeof ChatThreadIdRoute '/dashboards/$dashboardId': typeof DashboardsDashboardIdRoute '/chat': typeof ChatIndexRoute @@ -58,6 +66,7 @@ export interface FileRoutesByTo { export interface FileRoutesById { __root__: typeof rootRouteImport '/': typeof IndexRoute + '/settings': typeof SettingsRoute '/chat/$threadId': typeof ChatThreadIdRoute '/dashboards/$dashboardId': typeof DashboardsDashboardIdRoute '/chat/': typeof ChatIndexRoute @@ -67,6 +76,7 @@ export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath fullPaths: | '/' + | '/settings' | '/chat/$threadId' | '/dashboards/$dashboardId' | '/chat/' @@ -74,6 +84,7 @@ export interface FileRouteTypes { fileRoutesByTo: FileRoutesByTo to: | '/' + | '/settings' | '/chat/$threadId' | '/dashboards/$dashboardId' | '/chat' @@ -81,6 +92,7 @@ export interface FileRouteTypes { id: | '__root__' | '/' + | '/settings' | '/chat/$threadId' | '/dashboards/$dashboardId' | '/chat/' @@ -89,6 +101,7 @@ export interface FileRouteTypes { } export interface RootRouteChildren { IndexRoute: typeof IndexRoute + SettingsRoute: typeof SettingsRoute ChatThreadIdRoute: typeof ChatThreadIdRoute DashboardsDashboardIdRoute: typeof DashboardsDashboardIdRoute ChatIndexRoute: typeof ChatIndexRoute @@ -104,6 +117,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof IndexRouteImport parentRoute: typeof rootRouteImport } + '/settings': { + id: '/settings' + path: '/settings' + fullPath: '/settings' + preLoaderRoute: typeof SettingsRouteImport + parentRoute: typeof rootRouteImport + } '/chat/': { id: '/chat/' path: '/chat' @@ -137,6 +157,7 @@ declare module '@tanstack/react-router' { const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, + SettingsRoute: SettingsRoute, ChatThreadIdRoute: ChatThreadIdRoute, DashboardsDashboardIdRoute: DashboardsDashboardIdRoute, ChatIndexRoute: ChatIndexRoute, diff --git a/ui/host/src/routes/settings.tsx b/ui/host/src/routes/settings.tsx new file mode 100644 index 000000000..7e696bdfd --- /dev/null +++ b/ui/host/src/routes/settings.tsx @@ -0,0 +1,6 @@ +import { createFileRoute } from "@tanstack/react-router"; +import Settings from "../settings"; + +export const Route = createFileRoute("/settings")({ + component: Settings, +}); diff --git a/ui/host/src/settings.test.tsx b/ui/host/src/settings.test.tsx new file mode 100644 index 000000000..e8f7c40fe --- /dev/null +++ b/ui/host/src/settings.test.tsx @@ -0,0 +1,96 @@ +import { MantineProvider } from "@mantine/core"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { act } from "react"; +import { createRoot } from "react-dom/client"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import Settings from "./settings"; + +const fetchMock = vi.fn(); +let role = "admin"; + +vi.mock("./auth", () => ({ + useViewer: () => ({ id: "u1", email: "v@labstack.com", name: "V", role }), + authorizedFetch: (url: string, init?: RequestInit) => fetchMock(url, init), +})); + +function json(body: unknown, status = 200) { + return new Response(JSON.stringify(body), { status, headers: { "content-type": "application/json" } }); +} + +const connection = { token_required: true, suggested_endpoint: "ingest.example.com:4317", tls_configured: false, header_name: "Authorization" }; + +async function mount() { + const container = document.createElement("div"); + document.body.append(container); + const root = createRoot(container); + const client = new QueryClient({ defaultOptions: { queries: { retry: false } } }); + await act(async () => root.render( + , + )); + return root; +} + +describe("connect telemetry", () => { + beforeEach(() => { + role = "admin"; + vi.stubGlobal("fetch", fetchMock); + fetchMock.mockReset(); + fetchMock.mockImplementation(async () => json(connection)); + }); + afterEach(() => { vi.unstubAllGlobals(); document.body.innerHTML = ""; }); + + it("gives the collector its own endpoint and leaves the token an environment variable", async () => { + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Collector configuration")); + const config = document.body.textContent ?? ""; + expect(config).toContain("endpoint: ingest.example.com:4317"); + // A secret pasted into a config file is a secret in version control. + expect(config).toContain("${FANOUT_INGEST_TOKEN}"); + // This instance serves plaintext, so the exporter has to be told. + expect(config).toContain("insecure: true"); + await act(async () => root.unmount()); + }); + + it("asks before rotating, because the current token stops working at once", async () => { + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Rotate token")); + const rotate = [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Rotate token"); + await act(async () => rotate?.click()); + await vi.waitFor(() => expect(document.querySelector('[role="dialog"]')).not.toBeNull()); + expect(document.querySelector('[role="dialog"]')?.textContent).toContain("rejected until you update it"); + // Opening the dialog must not have rotated anything. + expect(fetchMock.mock.calls.some(([, init]) => (init as RequestInit | undefined)?.method === "POST")).toBe(false); + await act(async () => root.unmount()); + }); + + it("shows the new token once after rotating", async () => { + fetchMock.mockImplementation(async (_url, init) => json((init as RequestInit | undefined)?.method === "POST" ? { ...connection, ingest_token: "fo_newtoken" } : connection)); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Rotate token")); + const open = [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Rotate token"); + await act(async () => open?.click()); + await vi.waitFor(() => expect(document.querySelector('[role="dialog"]')).not.toBeNull()); + const confirm = [...document.querySelectorAll('[role="dialog"] button')].find((button) => button.textContent?.trim() === "Rotate token"); + await act(async () => confirm?.click()); + await vi.waitFor(() => expect(document.body.textContent).toContain("fo_newtoken")); + expect(document.body.textContent).toContain("Fanout shows this once"); + await act(async () => root.unmount()); + }); + + it("gives a viewer the connection details without a rotate button", async () => { + role = "viewer"; + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Collector configuration")); + expect(document.body.textContent).toContain("An administrator issues and rotates the ingest token"); + expect([...document.querySelectorAll("button")].some((button) => button.textContent?.includes("Rotate token"))).toBe(false); + await act(async () => root.unmount()); + }); + + it("says the workspace is rejecting telemetry when no token exists", async () => { + fetchMock.mockImplementation(async () => json({ ...connection, token_required: false })); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("rejecting telemetry")); + expect([...document.querySelectorAll("button")].some((button) => button.textContent?.trim() === "Issue token")).toBe(true); + await act(async () => root.unmount()); + }); +}); diff --git a/ui/host/src/settings.tsx b/ui/host/src/settings.tsx new file mode 100644 index 000000000..83d306773 --- /dev/null +++ b/ui/host/src/settings.tsx @@ -0,0 +1,173 @@ +import { Alert, Anchor, Box, Button, Code, CopyButton, Group, Loader, Modal, Paper, Stack, Text, Title, Tooltip } from "@mantine/core"; +import { ArrowsClockwise, Check, Copy, WarningCircle } from "@phosphor-icons/react"; +import { useMutation, useQuery } from "@tanstack/react-query"; +import { useState } from "react"; +import { getJSON } from "./api"; +import { authorizedFetch, useViewer } from "./auth"; +import { docs } from "../../links"; + +type IngestSettings = { + token_required: boolean; + suggested_endpoint: string; + tls_configured: boolean; + header_name: string; +}; + +const ingestQueryKey = ["settings", "ingest"] as const; + +/** The collector block an engineer actually pastes, with this instance's own + * endpoint already in it. Everything else on the page is a fact about the + * connection; this is the thing that makes telemetry arrive. */ +function collectorConfig(endpoint: string, header: string, tls: boolean) { + return `exporters: + otlp/fanout: + endpoint: ${endpoint} + headers: + ${header.toLowerCase()}: "Bearer $\{FANOUT_INGEST_TOKEN}"${tls ? "" : "\n tls:\n insecure: true"} + +service: + pipelines: + traces: + exporters: [otlp/fanout] + logs: + exporters: [otlp/fanout] + metrics: + exporters: [otlp/fanout]`; +} + +function Field({ label, value, hint }: { label: string; value: string; hint?: string }) { + return + {label} + + {value} + + {({ copied, copy }) => + + } + + + {hint && {hint}} + ; +} + +export default function Settings() { + const viewer = useViewer(); + const settings = useQuery({ queryKey: ingestQueryKey, queryFn: () => getJSON("/api/settings/ingest") }); + const [confirming, setConfirming] = useState(false); + const [issued, setIssued] = useState(null); + + const rotate = useMutation({ + mutationFn: async () => { + const response = await authorizedFetch("/api/settings/ingest/rotate-token", { method: "POST" }); + if (!response.ok) throw new Error("Fanout could not issue a new token. Try again."); + // The plaintext comes back once, under the same key the setup response + // uses; the rest of the payload is the refreshed settings. + return response.json() as Promise; + }, + onSuccess: (data) => { + setConfirming(false); + setIssued(data.ingest_token ?? null); + }, + }); + + if (settings.isLoading) return
; + if (settings.isError || !settings.data) return
; + + const { suggested_endpoint: endpoint, header_name: header, tls_configured: tls, token_required: hasToken } = settings.data; + const canRotate = viewer.role === "admin"; + const authorization = `${header}: Bearer `; + + return + + + Connect telemetry + Point an OpenTelemetry collector or SDK at this workspace. + + + + + + + + + + + + Collector configuration + Paste this into your collector and set FANOUT_INGEST_TOKEN in its environment. + + + + {collectorConfig(endpoint, header, tls)} + + + {({ copied, copy }) => } + + + + + + + + + Ingest token + + {hasToken + ? "This workspace has a token. Rotating issues a new one and stops the current one working immediately." + : "This workspace has no token yet, so it is rejecting telemetry. Issue one to start accepting data."} + + + + {issued + ? + Your new token + {`${header}: Bearer ${issued}`} + Fanout shows this once. Store it with your collector secrets, then update any collector still using the old token. + + + {({ copied, copy }) => } + + + + + : canRotate + ? + {hasToken ? "Rotate when a token may have been exposed." : "No token issued yet."} + + + : An administrator issues and rotates the ingest token.} + + + + Ingest documentation covers SDK setup, batching and the OTLP/HTTP endpoint. + + + + !rotate.isPending && setConfirming(false)} title={hasToken ? "Rotate the ingest token?" : "Issue an ingest token?"} centered radius="md"> + + + {hasToken + ? "The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it." + : "Fanout will show the new token once, and store only its hash."} + + {rotate.isError && }>{rotate.error instanceof Error ? rotate.error.message : "Fanout could not issue a new token."}} + + + + + + + ; +} + +function Center({ label }: { label: string }) { + return {label}; +} diff --git a/ui/host/src/shell.tsx b/ui/host/src/shell.tsx index 06d4abe2b..8e9805b85 100644 --- a/ui/host/src/shell.tsx +++ b/ui/host/src/shell.tsx @@ -1,11 +1,12 @@ import { ActionIcon, Alert, AppShell, Avatar, Burger, Drawer, Group, Menu, Tooltip, useComputedColorScheme, useMantineColorScheme } from "@mantine/core"; import { useDisclosure, useMediaQuery } from "@mantine/hooks"; -import { GithubLogo, GlobeHemisphereWest, Moon, SignOut, Sun } from "@phosphor-icons/react"; +import { BookOpen, Moon, PlugsConnected, SignOut, Sun } from "@phosphor-icons/react"; import { useNavigate, useParams, useRouterState } from "@tanstack/react-router"; import { useEffect, useRef, useState, type ReactNode } from "react"; import { createDashboardPrompt, useFanoutApp } from "./app-context"; import { logout, useViewer } from "./auth"; import { BrandLockup } from "./brand"; +import { docs } from "../../links"; import Rail, { type RailHandle, type RailProps } from "./rail"; export default function Shell({ children }: { children: ReactNode }) { @@ -61,6 +62,14 @@ export default function Shell({ children }: { children: ReactNode }) { + {/* Documentation sits in the chrome, not in the account menu: it is + a question someone has while working, on any page, and the menu is + for acting on your own account. */} + + + + + @@ -91,6 +100,7 @@ function ColorSchemeToggle() { } function AccountMenu({ onError }: { onError: (message: string) => void }) { + const navigate = useNavigate(); const viewer = useViewer(); const label = viewer.name.trim() || viewer.email.trim() || "?"; const initial = label.charAt(0).toUpperCase(); @@ -102,8 +112,10 @@ function AccountMenu({ onError }: { onError: (message: string) => void }) { {viewer.email || "Signed in"} - }>Fanout on GitHub - }>LabStack + {/* Account actions only. This menu carried two outbound marketing links + and no way to reach the workspace's own settings, so the one thing an + operator came here for was the one thing missing. */} + } onClick={() => void navigate({ to: "/settings" })}>Connect telemetry } onClick={() => void logout().catch((cause) => onError(cause instanceof Error ? cause.message : "Sign-out failed — your session is still active."))}>Sign out diff --git a/ui/links.ts b/ui/links.ts new file mode 100644 index 000000000..7e4210945 --- /dev/null +++ b/ui/links.ts @@ -0,0 +1,13 @@ +/* Outbound destinations, in one place because they are the only URLs the + * product hard-codes and the documentation site is not served from this + * repository. Change them here. + * + * There is deliberately no link to the source repository or the vendor site in + * the application. Both sat in the account menu — where someone goes to act on + * their own account — and neither answers a question an operator has while + * using the product. They belong on the marketing site. */ +export const docs = { + home: "https://fanout.run/docs", + /** Sending telemetry: endpoint, authentication, collector and SDK setup. */ + ingest: "https://fanout.run/docs/ingest", +} as const; From fc06355cfcda8fb610f7bcc854dbfbeb8cd37ebc Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Mon, 7 Sep 2026 07:30:54 -0700 Subject: [PATCH 2/3] fix(ui): the connect screen tells the truth about the token and the docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review findings on the connect-telemetry screen, all of them cases where the page stated something that was not so. Rotating did not refresh the settings it had just changed. On a workspace with no token, issuing one left the paragraph above still reading "this workspace has no token yet, so it is rejecting telemetry", and Done returned the admin to a filled "Issue token" button — one press away from destroying the token they had just pasted into a collector. The response already carries the refreshed settings; they are written back to the cache, without the plaintext, which belongs in no cache. Both documentation links were 404s. The docs site is in this repository under site/, and Starlight serves that collection from the site root, so there is no /docs prefix: the header goes to fanout.run and the ingest link to fanout.run/start/send-telemetry, the page that carries the same collector snippet this screen generates. The collector block could be invalid YAML and disagreed with the documentation. An advertised IPv6 endpoint arrives as "[2001:db8::1]:4317", which unquoted is a flow sequence, so the endpoint is quoted. The token is referenced as ${env:FANOUT_INGEST_TOKEN}, the form the docs use and the only one that is unambiguous when a distribution sets its own default config scheme, and the header keeps the capitalization the field above shows. The TLS hint was backwards. tls_configured means Fanout holds the certificate itself, not that TLS is terminated at the edge; an advertised https endpoint also means TLS. The exporter now gets tls.insecure only when neither is true, and the hint says a proxy in front of Fanout may still be terminating TLS rather than asserting plaintext. A failed load showed a spinner beside the words "unavailable", which reads as still working. It is an alert with a retry now. A rotation that fails leaves its error standing over the dialog until it is reopened; Cancel and Done clear it, and Done also drops the plaintext from the mutation cache, which otherwise held it for the life of the tab. A rotation whose response never arrives says so, and says the token may have been issued anyway, instead of showing the browser's "Failed to fetch". Four new tests: issuing stops the page offering to issue again, an https endpoint omits tls.insecure, a failed rotation is explained and forgotten on reopen, and a failed load offers a retry. Claude-Session: https://claude.ai/code/session_017ovmTezqzvxVP8P9MGDQNk --- ...js => dashboards._dashboardId-CFltSAMM.js} | 2 +- ..._9_kmf.js => dashboards.index-7ogkHLEj.js} | 2 +- .../{index-DGL83-Oj.js => index-6GqvJDXC.js} | 4 +- internal/ui/dist/assets/settings-Br2qbsAf.js | 16 ++++ internal/ui/dist/assets/settings-D0Y7fLFc.js | 16 ---- internal/ui/dist/index.html | 2 +- ui/host/src/settings.test.tsx | 60 +++++++++++- ui/host/src/settings.tsx | 92 ++++++++++++++----- ui/links.ts | 9 +- 9 files changed, 155 insertions(+), 48 deletions(-) rename internal/ui/dist/assets/{dashboards._dashboardId-DT7kwfWv.js => dashboards._dashboardId-CFltSAMM.js} (90%) rename internal/ui/dist/assets/{dashboards.index-Ds_9_kmf.js => dashboards.index-7ogkHLEj.js} (86%) rename internal/ui/dist/assets/{index-DGL83-Oj.js => index-6GqvJDXC.js} (96%) create mode 100644 internal/ui/dist/assets/settings-Br2qbsAf.js delete mode 100644 internal/ui/dist/assets/settings-D0Y7fLFc.js diff --git a/internal/ui/dist/assets/dashboards._dashboardId-DT7kwfWv.js b/internal/ui/dist/assets/dashboards._dashboardId-CFltSAMM.js similarity index 90% rename from internal/ui/dist/assets/dashboards._dashboardId-DT7kwfWv.js rename to internal/ui/dist/assets/dashboards._dashboardId-CFltSAMM.js index 1ddea1059..f87aceac7 100644 --- a/internal/ui/dist/assets/dashboards._dashboardId-DT7kwfWv.js +++ b/internal/ui/dist/assets/dashboards._dashboardId-CFltSAMM.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-DGL83-Oj.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-6GqvJDXC.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-Ds_9_kmf.js b/internal/ui/dist/assets/dashboards.index-7ogkHLEj.js similarity index 86% rename from internal/ui/dist/assets/dashboards.index-Ds_9_kmf.js rename to internal/ui/dist/assets/dashboards.index-7ogkHLEj.js index a6bcd1471..0f0236e42 100644 --- a/internal/ui/dist/assets/dashboards.index-Ds_9_kmf.js +++ b/internal/ui/dist/assets/dashboards.index-7ogkHLEj.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-DGL83-Oj.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-6GqvJDXC.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-DGL83-Oj.js b/internal/ui/dist/assets/index-6GqvJDXC.js similarity index 96% rename from internal/ui/dist/assets/index-DGL83-Oj.js rename to internal/ui/dist/assets/index-6GqvJDXC.js index 8edf69096..d0e24001d 100644 --- a/internal/ui/dist/assets/index-DGL83-Oj.js +++ b/internal/ui/dist/assets/index-6GqvJDXC.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D1xQhcK4.js","assets/brand-MzZ03bSa.js","assets/auth-BeUORN-q.js","assets/settings-D0Y7fLFc.js","assets/Tooltip-BJiO7C_G.js","assets/api-Be5Lq4YA.js","assets/WarningCircle.es-DDq2AFnK.js","assets/chat.index-DvqxaiRx.js","assets/chat-DuN0TFYv.js","assets/preload-helper-BL3qEkUh.js","assets/copy-Bzg2uCpz.js","assets/chat._threadId-DvqxaiRx.js","assets/dashboards.index-Ds_9_kmf.js","assets/dashboard-7dM548yK.js","assets/tokens-CvbGYJRX.js","assets/use-computed-color-scheme-6JIsge00.js","assets/dashboards._dashboardId-DT7kwfWv.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D1xQhcK4.js","assets/brand-MzZ03bSa.js","assets/auth-BeUORN-q.js","assets/settings-Br2qbsAf.js","assets/Tooltip-BJiO7C_G.js","assets/api-Be5Lq4YA.js","assets/WarningCircle.es-DDq2AFnK.js","assets/chat.index-DvqxaiRx.js","assets/chat-DuN0TFYv.js","assets/preload-helper-BL3qEkUh.js","assets/copy-Bzg2uCpz.js","assets/chat._threadId-DvqxaiRx.js","assets/dashboards.index-7ogkHLEj.js","assets/dashboard-7dM548yK.js","assets/tokens-CvbGYJRX.js","assets/use-computed-color-scheme-6JIsge00.js","assets/dashboards._dashboardId-CFltSAMM.js"])))=>i.map(i=>d[i]); import{B as e,C as t,F as n,G as r,H as i,I as a,J as o,K as s,L as c,M as l,N as u,O as d,P as f,S as p,St as m,V as h,W as g,X as _,Y as v,_ as y,_t as b,a as x,at as ee,b as te,ct as ne,d as re,dt as S,et as ie,f as ae,ft as oe,gt as se,h as ce,ht as le,j as ue,k as de,l as C,mt as fe,nt as pe,pt as me,rt as he,s as ge,st as _e,t as ve,u as ye,ut as be,x as xe,yt as Se}from"./brand-MzZ03bSa.js";import{a as Ce,d as we,f as Te,g as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./auth-BeUORN-q.js";import{$ as Pe,A as Fe,B as Ie,C as Le,F as Re,G as ze,H as Be,I as Ve,J as He,K as Ue,L as We,M as Ge,N as Ke,O as qe,P as Je,Q as Ye,R as Xe,S as Ze,U as Qe,V as $e,W as et,X as tt,Y as nt,Z as rt,a as it,at,b as ot,ct as st,d as ct,dt as lt,et as ut,ft as dt,g as ft,h as pt,i as mt,it as ht,j as gt,k as _t,l as vt,lt as yt,n as bt,nt as xt,o as St,ot as Ct,q as wt,r as Tt,rt as Et,s as Dt,st as Ot,t as kt,tt as At,u as jt,ut as Mt,v as Nt,w as Pt,x as Ft,y as It,z as Lt}from"./tokens-CvbGYJRX.js";import{C as Rt,b as zt,o as Bt,t as Vt,w as Ht}from"./Tooltip-BJiO7C_G.js";import{n as Ut,t as Wt}from"./use-computed-color-scheme-6JIsge00.js";import{A as Gt,C as Kt,D as qt,E as Jt,F as Yt,H as Xt,I as Zt,L as Qt,M as $t,N as en,O as tn,P as nn,R as rn,S as an,_ as on,a as sn,b as cn,c as ln,d as un,f as dn,g as fn,h as pn,i as mn,j as hn,k as gn,l as _n,m as vn,n as yn,o as bn,p as xn,r as Sn,t as Cn,u as wn,v as Tn,x as En,y as Dn}from"./api-Be5Lq4YA.js";import{a as On,i as kn,n as An,o as jn,r as Mn,t as Nn}from"./preload-helper-BL3qEkUh.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Pn=b((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,re=-1;function S(){return g?!0:!(e.unstable_now()-ret&&S());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=S,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Fn=b(((e,t)=>{t.exports=Pn()})),In=b((e=>{var t=Fn(),n=se(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){e.memoizedState!==null&&ve(Se,e);var t=ye.current,n=ef(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sp._currentValue=pe)}var De,Oe;function ke(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1)`:-1=0}function jf(e){for(var t=[`topLevel`],n=0,r,i,a,o=function(e){return t.push(e)},s=function(e){return t[t.length-1]=e},c=function(e){r??(r=n,i=t.length,a=e)},l=function(e){e===a&&(r=void 0,i=void 0,a=void 0)},u=function(){return t.pop()},d=function(){return n--},f=function(e){if(`0`<=e&&e<=`9`){o(`number`);return}switch(e){case`"`:o(`string`);return;case`-`:o(`numberNeedsDigit`);return;case`t`:o(`true`);return;case`f`:o(`false`);return;case`n`:o(`null`);return;case`[`:o(`arrayNeedsValue`);return;case`{`:o(`objectNeedsKey`);return}},p=e.length;n`9`)&&(d(),u());break;case`numberNeedsDigit`:s(`number`);break;case`numberNeedsExponent`:s(m===`+`||m===`-`?`numberNeedsDigit`:`number`);break;case`true`:case`false`:case`null`:(m<`a`||m>`z`)&&(d(),u());break;case`arrayNeedsValue`:m===`]`?u():Af(m)||(l(`collectionItem`),s(`arrayNeedsComma`),f(m));break;case`arrayNeedsComma`:m===`]`?u():m===`,`&&(c(`collectionItem`),s(`arrayNeedsValue`));break;case`objectNeedsKey`:m===`}`?u():m===`"`&&(c(`collectionItem`),s(`objectNeedsColon`),o(`string`));break;case`objectNeedsColon`:m===`:`&&s(`objectNeedsValue`);break;case`objectNeedsValue`:Af(m)||(l(`collectionItem`),s(`objectNeedsComma`),f(m));break;case`objectNeedsComma`:m===`}`?u():m===`,`&&(c(`collectionItem`),s(`objectNeedsKey`))}}i!=null&&(t.length=i);for(var h=[r==null?e:e.slice(0,r)],g=function(t){return h.push(t.slice(e.length-e.lastIndexOf(t[0])))},_=t.length-1;_>=0;_--)switch(t[_]){case`string`:h.push(`"`);break;case`numberNeedsDigit`:case`numberNeedsExponent`:h.push(`0`);break;case`true`:g(`true`);break;case`false`:g(`false`);break;case`null`:g(`null`);break;case`arrayNeedsValue`:case`arrayNeedsComma`:h.push(`]`);break;case`objectNeedsKey`:case`objectNeedsColon`:case`objectNeedsValue`:case`objectNeedsComma`:h.push(`}`)}return h.join(``)}function Mf(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let a=e[t++];if(n|=(a&127)<>4,!(i&128)){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(r|=(a&127)<=Nf&&(i+=r/Nf|0,r%=Nf)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?zf(r,i):Rf(r,i)}function Ff(e,t){let n=Rf(e,t),r=n.hi&2147483648;r&&(n=zf(n.lo,n.hi));let i=If(n.lo,n.hi);return r?`-`+i:i}function If(e,t){if({lo:e,hi:t}=Lf(e,t),t<=2097151)return String(Nf*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+Bf(o)+Bf(a)}function Lf(e,t){return{lo:e>>>0,hi:t>>>0}}function Rf(e,t){return{lo:e|0,hi:t|0}}function zf(e,t){return t=~t,e?e=~e+1:t+=1,Rf(e,t)}var Bf=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function Vf(){let e=this.buf[this.pos++];if(!(e&128))return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}var Hf=Uf();function Uf(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||globalThis.Bun||typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||ri||ta.call(e)),qf(i)}return Kf}function Yf(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var Xf;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(Xf||={});var U=class{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?Yf(e):Jf().encodeUtf8Into,this.buffer=$f,this.viewCache=ep,this.pos=0}ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||Zf;for(;e0&&n.set(this.buffer),this.buffer=n}}view(){let e=this.buffer,t=this.viewCache;if(t.byteLength===e.byteLength)return t;let n=new DataView(e.buffer);return this.viewCache=n,n}finish(){let e=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],e}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Qf),this.buffer[this.pos++]=0,this}join(){let e=this.stackPos.pop();if(e===void 0)throw Error(`invalid state, fork stack empty`);let t=this.pos-e-Qf,n=np(t);return n>Qf&&(this.ensureCapacity(n-Qf),this.buffer.copyWithin(e+n,e+Qf,this.pos)),this.pos=e,this.uint32(t),this.pos+=t,this}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.ensureCapacity(e.length),this.buffer.set(e,this.pos),this.pos+=e.length,this}uint32(e){if(ip(e),this.ensureCapacity(5),e<128)return this.buffer[this.pos++]=e,this;for(;e>127;)this.buffer[this.pos++]=e&127|128,e>>>=7;return this.buffer[this.pos++]=e,this}int32(e){if(rp(e),e>=0)return this.uint32(e);this.ensureCapacity(10);for(let t=0;t<9;t++)this.buffer[this.pos++]=e&127|128,e>>=7;return this.buffer[this.pos++]=1,this}bool(e){return this.ensureCapacity(1),this.buffer[this.pos++]=+!!e,this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){typeof e!=`string`&&(e=String(e));let t=e.length;if(t<=tp){this.ensureCapacity(t+1);let n=this.buffer,r=this.pos;n[r++]=t;let i=0;for(;i127)break;n[r++]=t}if(i==t)return this.pos=r,this}this.ensureCapacity(t*3+5);let n=np(t),r=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(e,r.subarray(i+n)),o=np(a);return o!=n&&r.copyWithin(i+o,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(e){return ap(e),this.ensureCapacity(4),this.view().setFloat32(this.pos,e,!0),this.pos+=4,this}double(e){return this.ensureCapacity(8),this.view().setFloat64(this.pos,e,!0),this.pos+=8,this}fixed32(e){return ip(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return rp(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return rp(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=Hf.enc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}fixed64(e){let t=Hf.uEnc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}int64(e){let t=Hf.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=Hf.enc(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return this.writeVarint64(r,i)}uint64(e){let t=Hf.uEnc(e);return this.writeVarint64(t.lo,t.hi)}writeVarint64(e,t){this.ensureCapacity(10);let n=this.buffer,r=this.pos;for(let i=0;i<28;i+=7){let a=e>>>i,o=!(!(a>>>7)&&t==0);if(n[r++]=(o?a|128:a)&255,!o)return this.pos=r,this}let i=e>>>28&15|(t&7)<<4,a=!!(t>>3);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this;for(let e=3;e<31;e+=7){let i=t>>>e,a=!!(i>>>7);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this}return n[r++]=t>>>31&1,this.pos=r,this}},Zf=128,Qf=1,$f=new Uint8Array,ep=new DataView($f.buffer),tp=32;function np(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var W=class{constructor(e,t=Jf().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=Mf,this.uint32=Vf,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.pos,t=this.uint32(),n=this.pos-e;if(n>5||n==5&&this.buf[this.pos-1]>15)throw Error(`illegal tag: varint overflows uint32`);let r=t>>>3,i=t&7;if(r<=0||i>5)throw Error(`illegal tag: field no `+r+` wire type `+i);return[r,i]}skip(e,t,n=100){let r=this.pos;switch(e){case Xf.Varint:for(;this.buf[this.pos++]&128;);break;case Xf.Bit64:this.pos+=4;case Xf.Bit32:this.pos+=4;break;case Xf.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Xf.StartGroup:if(n<=0)throw Error(`maximum recursion depth reached`);for(;;){let[e,r]=this.tag();if(r===Xf.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(r,e,n-1)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return this.varint64(),Hf.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Hf.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let e=this.varint64Lo,t=this.varint64Hi,n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,Hf.dec(e,t)}bool(){let e=this.buf[this.pos];return e<128?(this.pos++,e!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Hf.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Hf.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(e){let t=this.bytes(),n=t.length;if(n<=tp){let r=Array(n);for(let i=0;i127)return this.decodeUtf8(t,e);r[i]=n}return String.fromCharCode.apply(String,r)}return this.decodeUtf8(t,e)}};function rp(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid int32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int32: `+e)}function ip(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid uint32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint32: `+e)}function ap(e){if(typeof e==`string`){let t=e;if(e=Number(e),Number.isNaN(e)&&t!==`NaN`)throw Error(`invalid float32: `+t)}else if(typeof e!=`number`)throw Error(`invalid float32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float32: `+e)}var op=function(e){return e[e.NULL_VALUE=0]=`NULL_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function sp(){return{fields:{}}}var cp={encode(e,t=new U){return Object.entries(e.fields).forEach(([e,n])=>{n!==void 0&&up.encode({key:e,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=sp();for(;n.pos>>3){case 1:{if(e!==10)break;let t=up.decode(n,n.uint32());t.value!==void 0&&(i.fields[t.key]=t.value);continue}}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cp.fromPartial(e??{})},fromPartial(e){let t=sp();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(n!==void 0&&(e[t]=n),e),{}),t},wrap(e){let t=sp();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function lp(){return{key:``,value:void 0}}var up={encode(e,t=new U){return e.key!==``&&t.uint32(10).string(e.key),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=lp();for(;n.pos>>3){case 1:if(e!==10)break;i.key=n.string();continue;case 2:if(e!==18)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return up.fromPartial(e??{})},fromPartial(e){let t=lp();return t.key=e.key??``,t.value=e.value??void 0,t}};function dp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var G={encode(e,t=new U){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&cp.encode(cp.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&pp.encode(pp.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=dp();for(;n.pos>>3){case 1:if(e!==8)break;i.nullValue=n.int32();continue;case 2:if(e!==17)break;i.numberValue=n.double();continue;case 3:if(e!==26)break;i.stringValue=n.string();continue;case 4:if(e!==32)break;i.boolValue=n.bool();continue;case 5:if(e!==42)break;i.structValue=cp.unwrap(cp.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.listValue=pp.unwrap(pp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=dp();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=dp();if(e===null)t.nullValue=op.NULL_VALUE;else if(typeof e==`boolean`)t.boolValue=e;else if(typeof e==`number`)t.numberValue=e;else if(typeof e==`string`)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e==`object`)t.structValue=e;else if(e!==void 0)throw new globalThis.Error(`Unsupported any value type: `+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function fp(){return{values:[]}}var pp={encode(e,t=new U){for(let n of e.values)G.encode(G.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=fp();for(;n.pos>>3){case 1:if(e!==10)break;i.values.push(G.unwrap(G.decode(n,n.uint32())));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return pp.fromPartial(e??{})},fromPartial(e){let t=fp();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=fp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty(`values`)&&globalThis.Array.isArray(e.values)?e.values:e}},mp=function(e){return e[e.ADD=0]=`ADD`,e[e.REMOVE=1]=`REMOVE`,e[e.REPLACE=2]=`REPLACE`,e[e.MOVE=3]=`MOVE`,e[e.COPY=4]=`COPY`,e[e.TEST=5]=`TEST`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function hp(){return{op:0,path:``,from:void 0,value:void 0}}var gp={encode(e,t=new U){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==``&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=hp();for(;n.pos>>3){case 1:if(e!==8)break;i.op=n.int32();continue;case 2:if(e!==18)break;i.path=n.string();continue;case 3:if(e!==26)break;i.from=n.string();continue;case 4:if(e!==34)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gp.fromPartial(e??{})},fromPartial(e){let t=hp();return t.op=e.op??0,t.path=e.path??``,t.from=e.from??void 0,t.value=e.value??void 0,t}};function _p(){return{id:``,type:``,function:void 0,metadata:void 0}}var vp={encode(e,t=new U){return e.id!==``&&t.uint32(10).string(e.id),e.type!==``&&t.uint32(18).string(e.type),e.function!==void 0&&bp.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=_p();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.type=n.string();continue;case 3:if(e!==26)break;i.function=bp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vp.fromPartial(e??{})},fromPartial(e){let t=_p();return t.id=e.id??``,t.type=e.type??``,t.function=e.function!==void 0&&e.function!==null?bp.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function yp(){return{name:``,arguments:``}}var bp={encode(e,t=new U){return e.name!==``&&t.uint32(10).string(e.name),e.arguments!==``&&t.uint32(18).string(e.arguments),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=yp();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.arguments=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bp.fromPartial(e??{})},fromPartial(e){let t=yp();return t.name=e.name??``,t.arguments=e.arguments??``,t}};function xp(){return{value:``,mimeType:``}}var Sp={encode(e,t=new U){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==``&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=xp();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sp.fromPartial(e??{})},fromPartial(e){let t=xp();return t.value=e.value??``,t.mimeType=e.mimeType??``,t}};function Cp(){return{value:``,mimeType:void 0}}var wp={encode(e,t=new U){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Cp();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wp.fromPartial(e??{})},fromPartial(e){let t=Cp();return t.value=e.value??``,t.mimeType=e.mimeType??void 0,t}};function Tp(){return{data:void 0,url:void 0}}var Ep={encode(e,t=new U){return e.data!==void 0&&Sp.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&wp.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Tp();for(;n.pos>>3){case 1:if(e!==10)break;i.data=Sp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.url=wp.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ep.fromPartial(e??{})},fromPartial(e){let t=Tp();return t.data=e.data!==void 0&&e.data!==null?Sp.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?wp.fromPartial(e.url):void 0,t}};function Dp(){return{text:``}}var Op={encode(e,t=new U){return e.text!==``&&t.uint32(10).string(e.text),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Dp();for(;n.pos>>3){case 1:if(e!==10)break;i.text=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Op.fromPartial(e??{})},fromPartial(e){let t=Dp();return t.text=e.text??``,t}};function kp(){return{source:void 0,metadata:void 0}}var Ap={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=kp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ap.fromPartial(e??{})},fromPartial(e){let t=kp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function jp(){return{source:void 0,metadata:void 0}}var Mp={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=jp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Mp.fromPartial(e??{})},fromPartial(e){let t=jp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Np(){return{source:void 0,metadata:void 0}}var Pp={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Np();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Pp.fromPartial(e??{})},fromPartial(e){let t=Np();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Fp(){return{source:void 0,metadata:void 0}}var Ip={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Fp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ip.fromPartial(e??{})},fromPartial(e){let t=Fp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Lp(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Rp={encode(e,t=new U){return e.text!==void 0&&Op.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Ap.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Mp.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Pp.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Ip.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Lp();for(;n.pos>>3){case 1:if(e!==10)break;i.text=Op.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.image=Ap.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.audio=Mp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.video=Pp.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.document=Ip.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Rp.fromPartial(e??{})},fromPartial(e){let t=Lp();return t.text=e.text!==void 0&&e.text!==null?Op.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Ap.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Mp.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Pp.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Ip.fromPartial(e.document):void 0,t}};function zp(){return{id:``,role:``,content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Bp={encode(e,t=new U){e.id!==``&&t.uint32(10).string(e.id),e.role!==``&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let n of e.toolCalls)vp.encode(n,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let n of e.contentParts)Rp.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=zp();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.role=n.string();continue;case 3:if(e!==26)break;i.content=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.toolCalls.push(vp.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.toolCallId=n.string();continue;case 7:if(e!==58)break;i.error=n.string();continue;case 8:if(e!==66)break;i.contentParts.push(Rp.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Bp.fromPartial(e??{})},fromPartial(e){let t=zp();return t.id=e.id??``,t.role=e.role??``,t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(e=>vp.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>Rp.fromPartial(e))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Vp(){return{id:``,reason:``,message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Hp={encode(e,t=new U){return e.id!==``&&t.uint32(10).string(e.id),e.reason!==``&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&G.encode(G.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Vp();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.reason=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.responseSchema=G.unwrap(G.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.expiresAt=n.string();continue;case 7:if(e!==58)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Hp.fromPartial(e??{})},fromPartial(e){let t=Vp();return t.id=e.id??``,t.reason=e.reason??``,t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},Up=function(e){return e[e.TEXT_MESSAGE_START=0]=`TEXT_MESSAGE_START`,e[e.TEXT_MESSAGE_CONTENT=1]=`TEXT_MESSAGE_CONTENT`,e[e.TEXT_MESSAGE_END=2]=`TEXT_MESSAGE_END`,e[e.TOOL_CALL_START=3]=`TOOL_CALL_START`,e[e.TOOL_CALL_ARGS=4]=`TOOL_CALL_ARGS`,e[e.TOOL_CALL_END=5]=`TOOL_CALL_END`,e[e.STATE_SNAPSHOT=6]=`STATE_SNAPSHOT`,e[e.STATE_DELTA=7]=`STATE_DELTA`,e[e.MESSAGES_SNAPSHOT=8]=`MESSAGES_SNAPSHOT`,e[e.RAW=9]=`RAW`,e[e.CUSTOM=10]=`CUSTOM`,e[e.RUN_STARTED=11]=`RUN_STARTED`,e[e.RUN_FINISHED=12]=`RUN_FINISHED`,e[e.RUN_ERROR=13]=`RUN_ERROR`,e[e.STEP_STARTED=14]=`STEP_STARTED`,e[e.STEP_FINISHED=15]=`STEP_FINISHED`,e[e.SUBAGENT_STARTED=16]=`SUBAGENT_STARTED`,e[e.SUBAGENT_FINISHED=17]=`SUBAGENT_FINISHED`,e[e.SUBAGENT_ERROR=18]=`SUBAGENT_ERROR`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function Wp(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var K={encode(e,t=new U){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&G.encode(G.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Wp();for(;n.pos>>3){case 1:if(e!==8)break;i.type=n.int32();continue;case 2:if(e!==16)break;i.timestamp=Lm(n.int64());continue;case 3:if(e!==26)break;i.rawEvent=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return K.fromPartial(e??{})},fromPartial(e){let t=Wp();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function Gp(){return{baseEvent:void 0,messageId:``,role:void 0,name:void 0,subagentRunId:void 0}}var Kp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Gp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Kp.fromPartial(e??{})},fromPartial(e){let t=Gp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function qp(){return{baseEvent:void 0,messageId:``,delta:``,subagentRunId:void 0}}var Jp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=qp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Jp.fromPartial(e??{})},fromPartial(e){let t=qp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Yp(){return{baseEvent:void 0,messageId:``,subagentRunId:void 0}}var Xp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Yp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Xp.fromPartial(e??{})},fromPartial(e){let t=Yp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Zp(){return{baseEvent:void 0,toolCallId:``,toolCallName:``,parentMessageId:void 0,subagentRunId:void 0}}var Qp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.toolCallName!==``&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Zp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Qp.fromPartial(e??{})},fromPartial(e){let t=Zp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.toolCallName=e.toolCallName??``,t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function $p(){return{baseEvent:void 0,toolCallId:``,delta:``,subagentRunId:void 0}}var em={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=$p();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return em.fromPartial(e??{})},fromPartial(e){let t=$p();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function tm(){return{baseEvent:void 0,toolCallId:``,subagentRunId:void 0}}var nm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=tm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return nm.fromPartial(e??{})},fromPartial(e){let t=tm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function rm(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var im={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&G.encode(G.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=rm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.snapshot=G.unwrap(G.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return im.fromPartial(e??{})},fromPartial(e){let t=rm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function am(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var om={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)gp.encode(n,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=am();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.delta.push(gp.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return om.fromPartial(e??{})},fromPartial(e){let t=am();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>gp.fromPartial(e))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function sm(){return{baseEvent:void 0,messages:[]}}var cm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)Bp.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=sm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messages.push(Bp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cm.fromPartial(e??{})},fromPartial(e){let t=sm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>Bp.fromPartial(e))||[],t}};function lm(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var um={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&G.encode(G.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=lm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.event=G.unwrap(G.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.source=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return um.fromPartial(e??{})},fromPartial(e){let t=lm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function dm(){return{baseEvent:void 0,name:``,value:void 0,subagentRunId:void 0}}var fm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==``&&t.uint32(18).string(e.name),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=dm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.name=n.string();continue;case 3:if(e!==26)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return fm.fromPartial(e??{})},fromPartial(e){let t=dm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.name=e.name??``,t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function pm(){return{baseEvent:void 0,threadId:``,runId:``}}var mm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=pm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mm.fromPartial(e??{})},fromPartial(e){let t=pm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t}};function hm(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var gm={encode(e,t=new U){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=hm();for(;n.pos>>3){case 1:if(e!==10)break;i.provider=n.string();continue;case 2:if(e!==18)break;i.model=n.string();continue;case 3:if(e!==24)break;i.inputTokens=Lm(n.int64());continue;case 4:if(e!==32)break;i.outputTokens=Lm(n.int64());continue;case 5:if(e!==40)break;i.totalTokens=Lm(n.int64());continue;case 6:if(e!==48)break;i.reasoningTokens=Lm(n.int64());continue;case 7:if(e!==56)break;i.cachedInputTokens=Lm(n.int64());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gm.fromPartial(e??{})},fromPartial(e){let t=hm();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function _m(){return{baseEvent:void 0,threadId:``,runId:``,result:void 0,outcome:``,interrupts:[],usage:[]}}var vm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.result!==void 0&&G.encode(G.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==``&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)Hp.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)gm.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=_m();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.result=G.unwrap(G.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.outcome=n.string();continue;case 6:if(e!==50)break;i.interrupts.push(Hp.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.usage.push(gm.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vm.fromPartial(e??{})},fromPartial(e){let t=_m();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interrupts=e.interrupts?.map(e=>Hp.fromPartial(e))||[],t.usage=e.usage?.map(e=>gm.fromPartial(e))||[],t}};function ym(){return{baseEvent:void 0,code:void 0,message:``,usage:[]}}var bm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==``&&t.uint32(26).string(e.message);for(let n of e.usage)gm.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=ym();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.code=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.usage.push(gm.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bm.fromPartial(e??{})},fromPartial(e){let t=ym();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??``,t.usage=e.usage?.map(e=>gm.fromPartial(e))||[],t}};function xm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Sm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=xm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sm.fromPartial(e??{})},fromPartial(e){let t=xm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Cm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var wm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Cm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wm.fromPartial(e??{})},fromPartial(e){let t=Cm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Tm(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Em={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Tm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue;case 5:if(e!==42)break;i.name=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Em.fromPartial(e??{})},fromPartial(e){let t=Tm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Dm(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Om={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Dm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.delta=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Om.fromPartial(e??{})},fromPartial(e){let t=Dm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function km(){return{baseEvent:void 0,subagentRunId:``,name:``,description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Am={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.name!==``&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=km();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.name=n.string();continue;case 4:if(e!==34)break;i.description=n.string();continue;case 5:if(e!==42)break;i.parentSubagentRunId=n.string();continue;case 6:if(e!==50)break;i.parentToolCallId=n.string();continue;case 7:if(e!==58)break;i.parentMessageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Am.fromPartial(e??{})},fromPartial(e){let t=km();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.name=e.name??``,t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function jm(){return{baseEvent:void 0,subagentRunId:``,result:void 0,outcome:``,interruptIds:[]}}var Mm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&G.encode(G.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==``&&t.uint32(34).string(e.outcome);for(let n of e.interruptIds)t.uint32(42).string(n);return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=jm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.result=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.outcome=n.string();continue;case 5:if(e!==42)break;i.interruptIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Mm.fromPartial(e??{})},fromPartial(e){let t=jm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interruptIds=e.interruptIds?.map(e=>e)||[],t}};function Nm(){return{baseEvent:void 0,subagentRunId:``,message:``,code:void 0}}var Pm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.message!==``&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Nm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.code=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Pm.fromPartial(e??{})},fromPartial(e){let t=Nm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.message=e.message??``,t.code=e.code??void 0,t}};function Fm(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var Im={encode(e,t=new U){return e.textMessageStart!==void 0&&Kp.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Jp.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Xp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Qp.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&em.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&nm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&im.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&om.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&cm.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&um.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&fm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&mm.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&vm.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&bm.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Sm.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&wm.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Em.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Om.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Am.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Mm.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Pm.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Fm();for(;n.pos>>3){case 1:if(e!==10)break;i.textMessageStart=Kp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.textMessageContent=Jp.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.textMessageEnd=Xp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.toolCallStart=Qp.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.toolCallArgs=em.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.toolCallEnd=nm.decode(n,n.uint32());continue;case 7:if(e!==58)break;i.stateSnapshot=im.decode(n,n.uint32());continue;case 8:if(e!==66)break;i.stateDelta=om.decode(n,n.uint32());continue;case 9:if(e!==74)break;i.messagesSnapshot=cm.decode(n,n.uint32());continue;case 10:if(e!==82)break;i.raw=um.decode(n,n.uint32());continue;case 11:if(e!==90)break;i.custom=fm.decode(n,n.uint32());continue;case 12:if(e!==98)break;i.runStarted=mm.decode(n,n.uint32());continue;case 13:if(e!==106)break;i.runFinished=vm.decode(n,n.uint32());continue;case 14:if(e!==114)break;i.runError=bm.decode(n,n.uint32());continue;case 15:if(e!==122)break;i.stepStarted=Sm.decode(n,n.uint32());continue;case 16:if(e!==130)break;i.stepFinished=wm.decode(n,n.uint32());continue;case 17:if(e!==138)break;i.textMessageChunk=Em.decode(n,n.uint32());continue;case 18:if(e!==146)break;i.toolCallChunk=Om.decode(n,n.uint32());continue;case 19:if(e!==154)break;i.subagentStarted=Am.decode(n,n.uint32());continue;case 20:if(e!==162)break;i.subagentFinished=Mm.decode(n,n.uint32());continue;case 21:if(e!==170)break;i.subagentError=Pm.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Im.fromPartial(e??{})},fromPartial(e){let t=Fm();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Kp.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Jp.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Xp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Qp.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?em.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?nm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?im.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?om.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?cm.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?um.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?fm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?mm.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?vm.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?bm.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Sm.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?wm.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Em.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Om.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Am.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Mm.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Pm.fromPartial(e.subagentError):void 0,t}};function Lm(e){let t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error(`Value is larger than Number.MAX_SAFE_INTEGER`);if(te&&typeof e==`object`?e:void 0,zm=e=>{let t=Rm(e);if(t){if(t.data){let e=t.data;return{type:`data`,value:e.value,mimeType:e.mimeType}}if(t.url){let e=t.url;return{type:`url`,value:e.value,mimeType:e.mimeType}}}},Bm=e=>{let t=Rm(e);if(t){if(t.text)return{type:`text`,text:t.text.text};if(t.image){let e=t.image;return{type:`image`,source:zm(e.source),metadata:e.metadata}}if(t.audio){let e=t.audio;return{type:`audio`,source:zm(e.source),metadata:e.metadata}}if(t.video){let e=t.video;return{type:`video`,source:zm(e.source),metadata:e.metadata}}if(t.document){let e=t.document;return{type:`document`,source:zm(e.source),metadata:e.metadata}}}};function Vm(e){let t=Im.decode(e),n=Object.values(t).find(e=>e!==void 0);if(!n)throw Error(`Invalid event`);if(n.type=Up[n.baseEvent.type],n.timestamp=n.baseEvent.timestamp,n.rawEvent=n.baseEvent.rawEvent,n.baseEvent.metadata!==void 0&&(n.metadata=n.baseEvent.metadata),delete n.baseEvent,n.type===z.MESSAGES_SNAPSHOT)for(let e of n.messages){let t=e;if(t.role===`user`&&Array.isArray(t.contentParts)){let e=t.contentParts.map(e=>Bm(e)).filter(e=>e!==void 0);e.length>0&&(t.content=e)}Array.isArray(t.contentParts)&&t.contentParts.length===0&&(t.contentParts=void 0),t.toolCalls?.length===0&&(t.toolCalls=void 0)}if(n.type===z.RUN_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interrupts)?e.interrupts:[];delete e.interrupts,t===`interrupt`?e.outcome={type:`interrupt`,interrupts:r}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if(n.type===z.SUBAGENT_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interruptIds)?e.interruptIds:[];delete e.interruptIds,t===`suspended`?e.outcome={type:`suspended`,...r.length>0&&{interruptIds:r}}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if((n.type===z.RUN_FINISHED||n.type===z.RUN_ERROR)&&Array.isArray(n.usage)&&n.usage.length===0&&delete n.usage,n.type===z.STATE_DELTA)for(let e of n.delta)e.op=mp[e.op].toLowerCase(),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]});return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),Zl.parse(n)}var Hm;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Hm||={});var Um;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Um||={});var q=Hm.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Wm=e=>{switch(typeof e){case`undefined`:return q.undefined;case`string`:return q.string;case`number`:return Number.isNaN(e)?q.nan:q.number;case`boolean`:return q.boolean;case`function`:return q.function;case`bigint`:return q.bigint;case`symbol`:return q.symbol;case`object`:return Array.isArray(e)?q.array:e===null?q.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?q.promise:typeof Map<`u`&&e instanceof Map?q.map:typeof Set<`u`&&e instanceof Set?q.set:typeof Date<`u`&&e instanceof Date?q.date:q.object;default:return q.unknown}},J=Hm.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Gm=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Gm.create=e=>new Gm(e);var Km=(e,t)=>{let n;switch(e.code){case J.invalid_type:n=e.received===q.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case J.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Hm.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:n=`Unrecognized key(s) in object: ${Hm.joinValues(e.keys,`, `)}`;break;case J.invalid_union:n=`Invalid input`;break;case J.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Hm.joinValues(e.options)}`;break;case J.invalid_enum_value:n=`Invalid enum value. Expected ${Hm.joinValues(e.options)}, received '${e.received}'`;break;case J.invalid_arguments:n=`Invalid function arguments`;break;case J.invalid_return_type:n=`Invalid function return type`;break;case J.invalid_date:n=`Invalid date`;break;case J.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Hm.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case J.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case J.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case J.custom:n=`Invalid input`;break;case J.invalid_intersection_types:n=`Intersection results could not be merged`;break;case J.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case J.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Hm.assertNever(e)}return{message:n}},qm=Km;function Jm(){return qm}var Ym=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Y(e,t){let n=Jm(),r=Ym({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Km?void 0:Km].filter(e=>!!e)});e.common.issues.push(r)}var Xm=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return X;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return X;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},X=Object.freeze({status:`aborted`}),Zm=e=>({status:`dirty`,value:e}),Qm=e=>({status:`valid`,value:e}),$m=e=>e.status===`aborted`,eh=e=>e.status===`dirty`,th=e=>e.status===`valid`,nh=e=>typeof Promise<`u`&&e instanceof Promise,Z;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(Z||={});var rh=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ih=(e,t)=>{if(th(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Gm(e.common.issues);return this._error=t,this._error}}};function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var ah=class{get description(){return this._def.description}_getType(e){return Wm(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Wm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Xm,ctx:{common:e.parent.common,data:e.data,parsedType:Wm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nh(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)};return ih(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return th(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>th(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)},r=this._parse({data:e,path:n.path,parent:n});return ih(n,await(nh(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:J.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new cg({schema:this,typeName:$.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return lg.create(this,this._def)}nullable(){return ug.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Uh.create(this)}promise(){return sg.create(this,this._def)}or(e){return Kh.create([this,e],this._def)}and(e){return Xh.create(this,e,this._def)}transform(e){return new cg({...Q(this._def),schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new dg({...Q(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new mg({typeName:$.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new fg({...Q(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hg.create(this,e)}readonly(){return gg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},oh=/^c[^\s-]{8,}$/i,sh=/^[0-9a-z]+$/,ch=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lh=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,uh=/^[a-z0-9_-]{21}$/i,dh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fh=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ph=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mh=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,hh,gh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_h=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,vh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,yh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sh=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,Ch=RegExp(`^${Sh}$`);function wh(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Th(e){return RegExp(`^${wh(e)}$`)}function Eh(e){let t=`${Sh}T${wh(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Dh(e,t){return!((t!==`v4`&&t||!gh.test(e))&&(t!==`v6`&&t||!vh.test(e)))}function Oh(e,t){if(!dh.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function kh(e,t){return!((t!==`v4`&&t||!_h.test(e))&&(t!==`v6`&&t||!yh.test(e)))}var Ah=class e extends ah{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.string,received:t.parsedType}),X}let t=new Xm,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:J.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...Z.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...Z.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...Z.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...Z.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...Z.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...Z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ah({checks:[],typeName:$.ZodString,coerce:e?.coerce??!1,...Q(e)});function jh(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Mh=class e extends ah{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==q.number){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.number,received:t.parsedType}),X}let t,n=new Xm;for(let r of this._def.checks)r.kind===`int`?Hm.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?jh(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_finite,message:r.message}),n.dirty()):Hm.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:Z.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Z.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Z.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&Hm.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew Mh({checks:[],typeName:$.ZodNumber,coerce:e?.coerce||!1,...Q(e)});var Nh=class e extends ah{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==q.bigint)return this._getInvalidInput(e);let t,n=new Xm;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Hm.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.bigint,received:t.parsedType}),X}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Nh({checks:[],typeName:$.ZodBigInt,coerce:e?.coerce??!1,...Q(e)});var Ph=class extends ah{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.boolean,received:t.parsedType}),X}return Qm(e.data)}};Ph.create=e=>new Ph({typeName:$.ZodBoolean,coerce:e?.coerce||!1,...Q(e)});var Fh=class e extends ah{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.date,received:t.parsedType}),X}if(Number.isNaN(e.data.getTime()))return Y(this._getOrReturnCtx(e),{code:J.invalid_date}),X;let t=new Xm,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Hm.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Fh({checks:[],coerce:e?.coerce||!1,typeName:$.ZodDate,...Q(e)});var Ih=class extends ah{_parse(e){if(this._getType(e)!==q.symbol){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.symbol,received:t.parsedType}),X}return Qm(e.data)}};Ih.create=e=>new Ih({typeName:$.ZodSymbol,...Q(e)});var Lh=class extends ah{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.undefined,received:t.parsedType}),X}return Qm(e.data)}};Lh.create=e=>new Lh({typeName:$.ZodUndefined,...Q(e)});var Rh=class extends ah{_parse(e){if(this._getType(e)!==q.null){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.null,received:t.parsedType}),X}return Qm(e.data)}};Rh.create=e=>new Rh({typeName:$.ZodNull,...Q(e)});var zh=class extends ah{constructor(){super(...arguments),this._any=!0}_parse(e){return Qm(e.data)}};zh.create=e=>new zh({typeName:$.ZodAny,...Q(e)});var Bh=class extends ah{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Qm(e.data)}};Bh.create=e=>new Bh({typeName:$.ZodUnknown,...Q(e)});var Vh=class extends ah{_parse(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.never,received:t.parsedType}),X}};Vh.create=e=>new Vh({typeName:$.ZodNever,...Q(e)});var Hh=class extends ah{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.void,received:t.parsedType}),X}return Qm(e.data)}};Hh.create=e=>new Hh({typeName:$.ZodVoid,...Q(e)});var Uh=class e extends ah{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==q.array)return Y(t,{code:J.invalid_type,expected:q.array,received:t.parsedType}),X;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(Y(t,{code:J.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new rh(t,e,t.path,n)))).then(e=>Xm.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new rh(t,e,t.path,n)));return Xm.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Z.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Z.toString(n)}})}nonempty(e){return this.min(1,e)}};Uh.create=(e,t)=>new Uh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...Q(t)});function Wh(e){if(e instanceof Gh){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=lg.create(Wh(r))}return new Gh({...e._def,shape:()=>t})}return e instanceof Uh?new Uh({...e._def,type:Wh(e.element)}):e instanceof lg?lg.create(Wh(e.unwrap())):e instanceof ug?ug.create(Wh(e.unwrap())):e instanceof Zh?Zh.create(e.items.map(e=>Wh(e))):e}var Gh=class e extends ah{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Hm.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Vh&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new rh(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Vh){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Y(n,{code:J.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new rh(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Xm.mergeObjectSync(t,e)):Xm.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:Z.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of Hm.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of Hm.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Wh(this)}partial(t){let n={};for(let e of Hm.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of Hm.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof lg;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return ig(Hm.objectKeys(this.shape))}};Gh.create=(e,t)=>new Gh({shape:()=>e,unknownKeys:`strip`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)}),Gh.strictCreate=(e,t)=>new Gh({shape:()=>e,unknownKeys:`strict`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)}),Gh.lazycreate=(e,t)=>new Gh({shape:e,unknownKeys:`strip`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)});var Kh=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Gm(e.ctx.common.issues));return Y(t,{code:J.invalid_union,unionErrors:n}),X}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Gm(e));return Y(t,{code:J.invalid_union,unionErrors:i}),X}}get options(){return this._def.options}};Kh.create=(e,t)=>new Kh({options:e,typeName:$.ZodUnion,...Q(t)});var qh=e=>e instanceof ng?qh(e.schema):e instanceof cg?qh(e.innerType()):e instanceof rg?[e.value]:e instanceof ag?e.options:e instanceof og?Hm.objectValues(e.enum):e instanceof dg?qh(e._def.innerType):e instanceof Lh?[void 0]:e instanceof Rh?[null]:e instanceof lg?[void 0,...qh(e.unwrap())]:e instanceof ug?[null,...qh(e.unwrap())]:e instanceof mg||e instanceof gg?qh(e.unwrap()):e instanceof fg?qh(e._def.innerType):[],Jh=class e extends ah{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Y(t,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=qh(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Q(r)})}};function Yh(e,t){let n=Wm(e),r=Wm(t);if(e===t)return{valid:!0,data:e};if(n===q.object&&r===q.object){let n=Hm.objectKeys(t),r=Hm.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Yh(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===q.array&&r===q.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if($m(e)||$m(r))return X;let i=Yh(e.value,r.value);return i.valid?((eh(e)||eh(r))&&t.dirty(),{status:t.value,value:i.data}):(Y(n,{code:J.invalid_intersection_types}),X)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Xh.create=(e,t,n)=>new Xh({left:e,right:t,typeName:$.ZodIntersection,...Q(n)});var Zh=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.array)return Y(n,{code:J.invalid_type,expected:q.array,received:n.parsedType}),X;if(n.data.lengththis._def.items.length&&(Y(n,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new rh(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Xm.mergeArray(t,e)):Xm.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Zh.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Zh({items:e,typeName:$.ZodTuple,rest:null,...Q(t)})};var Qh=class e extends ah{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return Y(n,{code:J.invalid_type,expected:q.object,received:n.parsedType}),X;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new rh(n,e,n.path,e)),value:a._parse(new rh(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Xm.mergeObjectAsync(t,r):Xm.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ah?new e({keyType:t,valueType:n,typeName:$.ZodRecord,...Q(r)}):new e({keyType:Ah.create(),valueType:t,typeName:$.ZodRecord,...Q(n)})}},$h=class extends ah{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.map)return Y(n,{code:J.invalid_type,expected:q.map,received:n.parsedType}),X;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new rh(n,e,n.path,[a,`key`])),value:i._parse(new rh(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};$h.create=(e,t,n)=>new $h({valueType:t,keyType:e,typeName:$.ZodMap,...Q(n)});var eg=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.set)return Y(n,{code:J.invalid_type,expected:q.set,received:n.parsedType}),X;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(Y(n,{code:J.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return X;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new rh(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Z.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};eg.create=(e,t)=>new eg({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet,...Q(t)});var tg=class e extends ah{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return Y(t,{code:J.invalid_type,expected:q.function,received:t.parsedType}),X;function n(e,n){return Ym({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jm(),Km].filter(e=>!!e),issueData:{code:J.invalid_arguments,argumentsError:n}})}function r(e,n){return Ym({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jm(),Km].filter(e=>!!e),issueData:{code:J.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof sg){let e=this;return Qm(async function(...t){let o=new Gm([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return Qm(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Gm([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Gm([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Zh.create(t).rest(Bh.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Zh.create([]).rest(Bh.create()),returns:n||Bh.create(),typeName:$.ZodFunction,...Q(r)})}},ng=class extends ah{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ng.create=(e,t)=>new ng({getter:e,typeName:$.ZodLazy,...Q(t)});var rg=class extends ah{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:J.invalid_literal,expected:this._def.value}),X}return{status:`valid`,value:e.data}}get value(){return this._def.value}};rg.create=(e,t)=>new rg({value:e,typeName:$.ZodLiteral,...Q(t)});function ig(e,t){return new ag({values:e,typeName:$.ZodEnum,...Q(t)})}var ag=class e extends ah{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:Hm.joinValues(n),received:t.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{received:t.data,code:J.invalid_enum_value,options:n}),X}return Qm(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};ag.create=ig;var og=class extends ah{_parse(e){let t=Hm.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){let e=Hm.objectValues(t);return Y(n,{expected:Hm.joinValues(e),received:n.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(Hm.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=Hm.objectValues(t);return Y(n,{received:n.data,code:J.invalid_enum_value,options:e}),X}return Qm(e.data)}get enum(){return this._def.values}};og.create=(e,t)=>new og({values:e,typeName:$.ZodNativeEnum,...Q(t)});var sg=class extends ah{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==q.promise&&t.common.async===!1?(Y(t,{code:J.invalid_type,expected:q.promise,received:t.parsedType}),X):Qm((t.parsedType===q.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};sg.create=(e,t)=>new sg({type:e,typeName:$.ZodPromise,...Q(t)});var cg=class extends ah{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Y(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return X;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Zm(r.value):r});{if(t.value===`aborted`)return X;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Zm(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?X:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?X:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!th(e))return X;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>th(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):X)}Hm.assertNever(r)}};cg.create=(e,t,n)=>new cg({schema:e,typeName:$.ZodEffects,effect:t,...Q(n)}),cg.createWithPreprocess=(e,t,n)=>new cg({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects,...Q(n)});var lg=class extends ah{_parse(e){return this._getType(e)===q.undefined?Qm(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lg.create=(e,t)=>new lg({innerType:e,typeName:$.ZodOptional,...Q(t)});var ug=class extends ah{_parse(e){return this._getType(e)===q.null?Qm(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ug.create=(e,t)=>new ug({innerType:e,typeName:$.ZodNullable,...Q(t)});var dg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};dg.create=(e,t)=>new dg({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Q(t)});var fg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return nh(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Gm(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Gm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fg.create=(e,t)=>new fg({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Q(t)});var pg=class extends ah{_parse(e){if(this._getType(e)!==q.nan){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.nan,received:t.parsedType}),X}return{status:`valid`,value:e.data}}};pg.create=e=>new pg({typeName:$.ZodNaN,...Q(e)});var mg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},hg=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),Zm(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},gg=class extends ah{_parse(e){let t=this._def.innerType._parse(e),n=e=>(th(e)&&(e.value=Object.freeze(e.value)),e);return nh(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};gg.create=(e,t)=>new gg({innerType:e,typeName:$.ZodReadonly,...Q(t)}),Gh.lazycreate;var $;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})($||={});var _g=Ah.create;Mh.create,pg.create,Nh.create;var vg=Ph.create;Fh.create,Ih.create,Lh.create,Rh.create;var yg=zh.create;Bh.create,Vh.create,Hh.create,Uh.create;var bg=Gh.create;Gh.strictCreate,Kh.create;var xg=Jh.create;Xh.create,Zh.create,Qh.create,$h.create,eg.create,tg.create,ng.create;var Sg=rg.create,Cg=ag.create;og.create,sg.create,cg.create,lg.create,ug.create,cg.createWithPreprocess,hg.create;var wg=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Tg=e=>{if(typeof e!=`string`)throw TypeError(`Invalid argument expected string`);let t=e.match(wg);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Eg=e=>e===`*`||e===`x`||e===`X`,Dg=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},Og=(e,t)=>typeof e==typeof t?[e,t]:[String(e),String(t)],kg=(e,t)=>{if(Eg(e)||Eg(t))return 0;let[n,r]=Og(Dg(e),Dg(t));return n>r?1:n{for(let n=0;n{let n=Tg(e),r=Tg(t),i=n.pop(),a=r.pop(),o=Ag(n,r);return o===0?i&&a?Ag(i.split(`.`),a.split(`.`)):i||a?i?-1:1:0:o},Mg=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Ng(){return Go()}function Pg(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&Pg(t);return e}var Fg=524288;function Ig(e,t,n){let r=0,i=[e,t],a=new WeakSet;for(;i.length>0;){let e=i.pop();if(typeof e==`string`){if(r+=e.length,r>n)return!0}else if(typeof e==`object`&&e){if(a.has(e))continue;if(a.add(e),Array.isArray(e))for(let t=0;tn)return!0;i.push(e[o])}}}}return!1}async function Lg(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!Ig(t,n,Fg),c=s?Mg(t):t,l=s?Mg(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(Pg(c),Pg(l));let e=await r(t,c,l);if(e===void 0)continue;let n=!1;if(e.messages!==void 0&&e.messages!==c&&(c=Mg(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=Mg(e.state),d=!0,n=!0),s&&n&&Ig(c,l,Fg)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(o&&e instanceof TypeError){if(a)throw e;console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e)}else a||console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?Mg(c):c}:{},...d?{state:Object.isFrozen(l)?Mg(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function Rg(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function zg(e){if(e instanceof Bg)return e;if(e===!0)return new Bg(Rg(!0))}var Bg=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n==`string`?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function Vg(e){return e.enabled?new Bg(e):void 0}function Hg(e,t,n){if(t){let r=e.find(e=>e.id===t);if(r?.role===`assistant`)return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant — falling back to toolCallId`);let i={id:r?n:t,role:`assistant`,toolCalls:[]};return e.push(i),i}let r={id:n,role:`assistant`,toolCalls:[]};return e.push(r),r}function Ug(e,t){return!e||t.metadata===void 0?!1:(e.metadata=Mc(e.metadata,Mg(t.metadata)),!0)}var Wg=(e,t,n,r,i)=>{let a=zg(i),o=Mg(n.messages),s=Mg(e.state),c={},l=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},u=()=>{let e=Mg(c);return c={},e.messages!==void 0||e.state!==void 0?mf(e):Pd};return t.pipe(wf(async t=>{let i=await Lg(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(l(i),i.stopPropagation===!0?a?.event(`APPLY`,`Event dropped:`,t,{type:t.type,reason:`stopPropagation by subscriber`}):a?.event(`APPLY`,`Event applied:`,t,{type:t.type,subscribers:r.length}),i.stopPropagation===!0)return u();switch(t.type){case z.TEXT_MESSAGE_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:e,role:n=`assistant`,name:r,subagentRunId:i}=t,a=o.find(t=>t.id===e);if(a?.role===`activity`)return console.warn(`TEXT_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and text messages`),u();let s=a;if(!s){let t={id:e,role:n,content:``,...r!==void 0&&{name:r},...i!=null&&{subagentRunId:i}};o.push(t),s=t}let c=Ug(s,t);(!a||c)&&l({messages:o})}return u()}case z.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),u();if(c.role===`activity`)return console.warn(`TEXT_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),u();let d=await Lg(r,o,s,(r,i,a)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,textMessageBuffer:typeof c.content==`string`?c.content:``}));return l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Ug(c,t),l({messages:o})),u()}case z.TEXT_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),u();if(a.role===`activity`)return console.warn(`TEXT_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),u();let c=await Lg(r,o,s,(r,i,o)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,textMessageBuffer:typeof a.content==`string`?a.content:``}));return l(c),c.stopPropagation!==!0&&Ug(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case z.TOOL_CALL_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t,a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(Ug(a,t)||r)&&l({messages:o}),u()}let s=new Set(o.map(e=>e.id)),c=Hg(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let d={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(d),Ug(d,t),l({messages:o})}return u()}case z.TOOL_CALL_ARGS:{let{toolCallId:i,delta:a}=t,c=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!c)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),u();let d=c.toolCalls?.find(e=>e.id===i);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),u();let f=await Lg(r,o,s,(r,i,a)=>{let o=d.function.arguments,s=d.function.name,c={};try{c=jf(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return l(f),f.stopPropagation!==!0&&(d.function.arguments+=a,Ug(d,t),l({messages:o})),u()}case z.TOOL_CALL_END:{let{toolCallId:i}=t,a=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!a)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),u();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),u();let d=await Lg(r,o,s,(r,i,a)=>{let o=c.function.arguments,s=c.function.name,l={};try{l=JSON.parse(o)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallName:s,toolCallArgs:l})});return l(d),d.stopPropagation!==!0&&Ug(c,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),u()}case z.TOOL_CALL_RESULT:{let i=await Lg(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:u,subagentRunId:d}=t,f={id:i,toolCallId:a,role:u||`tool`,content:c,...d!=null&&{subagentRunId:d}};Ug(f,t);let p=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(p===-1)o.push(f);else{let e=p+1;for(;e{t.onNewMessage?.({message:f,messages:o,state:s,agent:n,input:e})})),l({messages:o})}return u()}case z.STATE_SNAPSHOT:{let i=await Lg(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,l({state:s})}return u()}case z.STATE_DELTA:{let i=await Lg(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Nu.applyPatch(s,e,!0,!1).newDocument,l({state:s})}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Failed to apply state patch:\nCurrent state: ${JSON.stringify(s,null,2)}\nPatch operations: ${JSON.stringify(e,null,2)}\nError: ${n}`)}}return u()}case z.MESSAGES_SNAPSHOT:{let i=await Lg(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=n.some(e=>e.role===`activity`),a=n.some(e=>e.role===`reasoning`),s=e=>e.role===`activity`&&!i||e.role===`reasoning`&&!a;o=o.filter(e=>s(e)||r.has(e.id)).map(e=>s(e)?e:r.get(e.id));let c=new Set(o.map(e=>e.id));for(let e of n)c.has(e.id)||o.push(e);l({messages:o})}return u()}case z.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,d=c?.role===`activity`?c:void 0,f=i.replace??!0,p=await Lg(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d,existingMessage:c}));if(l(p),p.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:Mg(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,u;a===-1?(o.push(t),c=t,u=t):d?(f&&(o[a]={...d,activityType:i.activityType,content:Mg(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),u=o[a]):f&&(o[a]=t,c=t,u=t),Ug(u,i),l({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return u()}case z.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return u();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),u();let d=c,f=await Lg(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d}));if(l(f),f.stopPropagation!==!0)try{Ug(d,i)&&l({messages:o});let e=Mg(d.content??{}),t=Nu.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...d,content:Mg(t),activityType:i.activityType},l({messages:o})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`Failed to apply activity patch for '${i.messageId}': ${t}`)}return u()}case z.RAW:return l(await Lg(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.CUSTOM:return l(await Lg(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.RUN_STARTED:{let i=await Lg(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}l({messages:o})}}return u()}case z.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:{event:i,outcome:`success`,result:i.result},c=await Lg(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return l(c),c.stopPropagation!==!0&&(n.pendingInterrupts=a.outcome===`interrupt`?a.interrupts.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}):[]),u()}case z.RUN_ERROR:return l(await Lg(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.STEP_STARTED:return l(await Lg(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.STEP_FINISHED:return l(await Lg(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case z.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case z.THINKING_START:return u();case z.THINKING_END:return u();case z.THINKING_TEXT_MESSAGE_START:return u();case z.THINKING_TEXT_MESSAGE_CONTENT:return u();case z.THINKING_TEXT_MESSAGE_END:return u();case z.REASONING_START:return l(await Lg(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.REASONING_MESSAGE_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e),i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=Ug(i,t);(!r||a)&&l({messages:o})}return u()}case z.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),u();let d=await Lg(r,o,s,(r,i,a)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,reasoningMessageBuffer:typeof c.content==`string`?c.content:``}));return l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Ug(c,t),l({messages:o})),u()}case z.REASONING_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),u();let c=await Lg(r,o,s,(r,i,o)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,reasoningMessageBuffer:typeof a.content==`string`?a.content:``}));return l(c),c.stopPropagation!==!0&&Ug(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case z.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case z.REASONING_END:return l(await Lg(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:d}=t,f=await Lg(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(f),f.stopPropagation!==!0){let e=!1;if(i===`tool-call`){for(let t of o)if(t.role===`assistant`&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===a);if(n){n.encryptedValue=d,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=d,e=!0)}e&&(c.messages=o)}return u()}case z.SUBAGENT_STARTED:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.SUBAGENT_FINISHED:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.SUBAGENT_ERROR:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u()}return t.type,u()}),bf(),r.length>0?Tf({}):e=>e)},Gg=e=>t=>{let n=zg(e),r=new Set,i=new Set,a=new Set,o={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,c=!1,l=!1,u=new Map,d=e=>{let t=u.get(e);return t||(t=new Map,u.set(e,t)),t},f=()=>{for(let e of u.values())if(e.size>0)return!0;return!1},p=new Map,m=new Set,h=!1,g=!1,_=!1,v=()=>{r.clear(),i.clear(),a.clear(),o.message.clear(),o.toolCall.clear(),o.activity.clear(),o.reasoning.clear(),u.clear(),p.clear(),m.clear(),h=!1,g=!1,s=!1,c=!1,_=!0},y=(e,t)=>{let n=e??[];if(Array.isArray(n))for(let e of n){if(!e||typeof e.id!=`string`)continue;if(e.subagentRunId===null)return new R(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?o.reasoning:e.role===`activity`?o.activity:o.message;(t||!n.has(e.id))&&n.set(e.id,{subagentRunId:e.subagentRunId});for(let n of e.toolCalls??[])n&&typeof n.id==`string`&&(t||!o.toolCall.has(n.id))&&o.toolCall.set(n.id,{subagentRunId:e.subagentRunId??void 0})}},b=(e,t,n,r,i)=>{if(t!==void 0&&n&&n.subagentRunId!==t)return new R(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(yf(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),c&&t!==z.RUN_STARTED)return H(()=>new R(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&t!==z.RUN_ERROR&&t!==z.RUN_STARTED)return H(()=>new R(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!l){if(l=!0,t!==z.RUN_STARTED&&t!==z.RUN_ERROR)return H(()=>new R(`First event must be 'RUN_STARTED'`))}else if(t===z.RUN_STARTED){if(_&&!s&&!c)return H(()=>new R(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(s||c)&&v()}if(e.subagentRunId===null)return H(()=>new R(`Cannot send '${t}' with 'subagentRunId: null'. The field is optional — omit it entirely.`));if(t===z.SUBAGENT_STARTED||t===z.SUBAGENT_FINISHED||t===z.SUBAGENT_ERROR){let n=t===z.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===z.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return H(()=>new R(`Cannot send '${t}' with '${r}: null'. The field is optional — omit it entirely.`));let r=e.outcome;if(r!=null&&r.type!==`success`&&r.type!==`suspended`)return H(()=>new R(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return H(()=>new R(`Cannot send '${t}' with 'outcome.interruptIds: null'. The field is optional — omit it entirely.`));if(r&&Array.isArray(r.interruptIds)&&r.interruptIds.some(e=>typeof e!=`string`))return H(()=>new R(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===z.RUN_FINISHED){let t=e.outcome;if(t?.type===`interrupt`&&Array.isArray(t.interrupts)){for(let e of t.interrupts)if(e&&e.subagentRunId===null)return H(()=>new R(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case z.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${n}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let i=o.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return H(()=>r)}return r.add(n),i||o.message.set(n,{subagentRunId:e.subagentRunId}),mf(e)}case z.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${n}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let i=b(t,e.subagentRunId,o.message.get(n),`message`,n);return i?H(()=>i):mf(e)}case z.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${n}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let i=b(t,e.subagentRunId,o.message.get(n),`message`,n);return i?H(()=>i):(r.delete(n),mf(e))}case z.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${n}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let r=e.parentMessageId,a=e.subagentRunId,s;if(r!==void 0){let e=o.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return H(()=>new R(`Cannot send 'TOOL_CALL_START': subagentRunId '${a}' does not match its parent message '${r}' owner '${e.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`));s=e}}let c=o.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return H(()=>e);if(a===void 0&&s&&s.subagentRunId!==c.subagentRunId)return H(()=>new R(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${s.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||o.toolCall.set(n,a===void 0?s??{subagentRunId:void 0}:{subagentRunId:a}),mf(e)}case z.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${n}'. Start a tool call with 'TOOL_CALL_START' first.`));let r=b(t,e.subagentRunId,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):mf(e)}case z.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${n}'. A 'TOOL_CALL_START' event must be sent first.`));let r=b(t,e.subagentRunId,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):(i.delete(n),mf(e))}case z.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return d(n).has(t)?H(()=>new R(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(d(n).set(t,!0),mf(e))}case z.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!d(n).has(t)){let e,r=!1;for(let[i,a]of u)if(i!==n&&a.has(t)){e=i,r=!0;break}return H(r?()=>new R(`Cannot send 'STEP_FINISHED' for step "${t}" attributed to ${n===void 0?`the parent agent`:`subagent '${n}'`}: that step is open under ${e===void 0?`the parent agent`:`subagent '${e}'`}. A step must be finished by whoever started it.`):()=>new R(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return d(n).delete(t),mf(e)}case z.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!o.activity.has(t)||e.replace!==!1)&&o.activity.set(t,{subagentRunId:e.subagentRunId}),mf(e)}case z.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&o.message.set(t,{subagentRunId:e.subagentRunId}),mf(e)}case z.REASONING_START:case z.REASONING_MESSAGE_START:{let n=e.messageId,r=o.reasoning.get(n);if(r){let i=b(t,e.subagentRunId,r,`reasoning message`,n);if(i)return H(()=>i)}return a.add(n),r||o.reasoning.set(n,{subagentRunId:e.subagentRunId}),mf(e)}case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:{let n=e.messageId,r=b(t,e.subagentRunId,o.reasoning.get(n),`reasoning message`,n);return r?H(()=>r):(t===z.REASONING_END&&a.delete(n),mf(e))}case z.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?o.toolCall.get(n):r===`message`?o.message.get(n)??o.reasoning.get(n):o.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,s=b(t,e.subagentRunId,i,a,n);return s?H(()=>s):mf(e)}case z.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,o.activity.get(n),`activity`,n);return r?H(()=>r):mf(e)}case z.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return p.has(t)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):m.has(t)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!p.has(n)&&!m.has(n)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(p.set(t,!0),mf(e))}case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return H(()=>new R(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===z.SUBAGENT_ERROR&&typeof e.message!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return p.has(n)?(p.delete(n),m.add(n),mf(e)):H(()=>new R(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case z.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return H(()=>t)}return mf(e);case z.RUN_STARTED:_=!0;{let t=y((e.input??{}).messages,!1);if(t)return H(()=>t)}return mf(e);case z.RUN_FINISHED:if(f()){let e=[];for(let[t,n]of u)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(p.size>0){let e=Array.from(p.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return s=!0,mf(e);case z.RUN_ERROR:return c=!0,mf(e);case z.CUSTOM:return mf(e);case z.THINKING_TEXT_MESSAGE_START:return h?g?H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.`)):(g=!0,mf(e)):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first.`));case z.THINKING_TEXT_MESSAGE_CONTENT:return g?mf(e):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first.`));case z.THINKING_TEXT_MESSAGE_END:return g?(g=!1,mf(e)):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first.`));case z.THINKING_START:return h?H(()=>new R(`Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.`)):(h=!0,mf(e));case z.THINKING_END:return h?(h=!1,mf(e)):H(()=>new R(`Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first.`));default:return mf(e)}}))},Kg=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),qg=e=>xf(()=>pf(e())).pipe(Df(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return pf(e.text()).pipe(yf(n=>{let r=n;if(t.includes(`application/json`))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${typeof r==`string`?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,H(()=>i)}))}let t={type:Kg.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Sd(e=>(e.next(t),(async()=>{try{for(;;){let{done:t,value:r}=await n.read();if(t)break;let i={type:Kg.DATA,data:r};e.next(i)}e.complete()}catch(t){e.error(t)}})(),()=>{n.cancel().catch(e=>{if(e?.name!==`AbortError`)throw e})})):H(()=>Error(`Failed to getReader() from response`))})),Jg=(e,t)=>{let n=zg(t),r=new V,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==Kg.HEADERS&&e.type===Kg.DATA&&e.data){let t=i.decode(e.data,{stream:!0});a+=t;let n=a.split(/\n\n/);a=n.pop()||``;for(let e of n)o(e)}},error:e=>r.error(e),complete:()=>{a&&(a+=i.decode(),o(a)),r.complete()}});function o(e){let t=e.split(` `),i=[];for(let e of t)e.startsWith(`data:`)&&i.push(e.slice(5).replace(/^ /,``));if(i.length>0)try{let e=i.join(` `),t=JSON.parse(e);n?.event(`SSE`,`Event received:`,t,{type:t.type}),r.next(t)}catch(e){r.error(e)}}return r.asObservable()},Yg=e=>{let t=new V,n=new Uint8Array;e.subscribe({next:e=>{if(e.type!==Kg.HEADERS&&e.type===Kg.DATA&&e.data){let t=new Uint8Array(n.length+e.data.length);t.set(n,0),t.set(e.data,n.length),n=t,r()}},error:e=>t.error(e),complete:()=>{if(n.length>0)try{r()}catch{console.warn(`Incomplete or invalid protocol buffer data at stream end`)}t.complete()}});function r(){for(;n.length>=4;){let e=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length{let n=zg(t),r=new V,i=new Nd,a=!1;return e.subscribe({next:e=>{if(i.next(e),e.type===Kg.HEADERS&&!a){a=!0;let t=e.headers.get(`content-type`);n?.lifecycle(`HTTP`,`Stream format detected:`,{contentType:t,parser:t===`application/vnd.ag-ui.event+proto`?`protobuf`:`sse`}),t===`application/vnd.ag-ui.event+proto`?Yg(i).subscribe({next:e=>r.next(e),error:e=>r.error(e),complete:()=>r.complete()}):Jg(i,n).subscribe({next:e=>{try{let t=Zl.parse(e);n?.event(`HTTP`,`Event validated:`,t,{type:t.type,valid:!0}),r.next(t)}catch(t){n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),r.error(t)}},error:e=>{if(e?.name===`AbortError`){r.next({type:z.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),r.complete();return}return r.error(e)},complete:()=>r.complete()})}else a||r.error(Error(`No headers event received before data events`))},error:e=>{i.error(e),r.error(e)},complete:()=>{i.complete()}}),r.asObservable()},Zg=Cg([`TextMessageStart`,`TextMessageContent`,`TextMessageEnd`,`ActionExecutionStart`,`ActionExecutionArgs`,`ActionExecutionEnd`,`ActionExecutionResult`,`AgentStateMessage`,`MetaEvent`,`RunStarted`,`RunFinished`,`RunError`,`NodeStarted`,`NodeFinished`]),Qg=Cg([`LangGraphInterruptEvent`,`PredictState`,`Exit`]);xg(`type`,[bg({type:Sg(Zg.enum.TextMessageStart),messageId:_g(),parentMessageId:_g().optional(),role:_g().optional()}),bg({type:Sg(Zg.enum.TextMessageContent),messageId:_g(),content:_g()}),bg({type:Sg(Zg.enum.TextMessageEnd),messageId:_g()}),bg({type:Sg(Zg.enum.ActionExecutionStart),actionExecutionId:_g(),actionName:_g(),parentMessageId:_g().optional()}),bg({type:Sg(Zg.enum.ActionExecutionArgs),actionExecutionId:_g(),args:_g()}),bg({type:Sg(Zg.enum.ActionExecutionEnd),actionExecutionId:_g()}),bg({type:Sg(Zg.enum.ActionExecutionResult),actionName:_g(),actionExecutionId:_g(),result:_g()}),bg({type:Sg(Zg.enum.AgentStateMessage),threadId:_g(),agentName:_g(),nodeName:_g(),runId:_g(),active:vg(),role:_g(),state:_g(),running:vg()}),bg({type:Sg(Zg.enum.MetaEvent),name:Qg,value:yg()}),bg({type:Sg(Zg.enum.RunError),message:_g(),code:_g().optional()})]),bg({id:_g(),role:_g(),content:_g(),parentMessageId:_g().optional()}),bg({id:_g(),name:_g(),arguments:yg(),parentMessageId:_g().optional()}),bg({id:_g(),result:yg(),actionExecutionId:_g(),actionName:_g()});var $g=e=>{if(typeof e==`string`)return e;if(!Array.isArray(e))return;let t=e.filter(e=>e.type===`text`).map(e=>e.text).filter(e=>e.length>0);if(t.length!==0)return t.join(` -`)},e_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(yf(r=>{switch(r.type){case z.TEXT_MESSAGE_START:{let e=r;return[{type:Zg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case z.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Zg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case z.TEXT_MESSAGE_END:{let e=r;return[{type:Zg.enum.TextMessageEnd,messageId:e.messageId}]}case z.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:Zg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case z.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(jf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Zg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case z.TOOL_CALL_END:{let e=r;return[{type:Zg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case z.TOOL_CALL_RESULT:{let e=r;return[{type:Zg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case z.RAW:return[];case z.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Zg.enum.MetaEvent,name:e.name,value:e.value}]}case z.STATE_SNAPSHOT:return f(r.snapshot),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case z.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case z.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case z.RUN_STARTED:return[];case z.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:t_(c)}:{}}),active:!1}];case z.RUN_ERROR:{let e=r;return[{type:Zg.enum.RunError,message:e.message,code:e.code}]}case z.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case z.STEP_FINISHED:return u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function t_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=$g(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var n_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,r_=e=>e===`tool`?`toolCallId`:`messageId`,i_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},a_=e=>t=>{let n=zg(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:z.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:z.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:z.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&n_(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${r_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(yf(e=>{switch(e.type){case z.TEXT_MESSAGE_START:case z.TEXT_MESSAGE_CONTENT:case z.TEXT_MESSAGE_END:case z.TOOL_CALL_START:case z.TOOL_CALL_ARGS:case z.TOOL_CALL_END:case z.TOOL_CALL_RESULT:case z.STATE_SNAPSHOT:case z.STATE_DELTA:case z.CUSTOM:case z.STEP_STARTED:case z.STEP_FINISHED:case z.THINKING_START:case z.THINKING_END:case z.THINKING_TEXT_MESSAGE_START:case z.THINKING_TEXT_MESSAGE_CONTENT:case z.THINKING_TEXT_MESSAGE_END:case z.REASONING_START:case z.REASONING_MESSAGE_START:case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:return[...i(e.subagentRunId??void 0),e];case z.RUN_STARTED:case z.RUN_FINISHED:case z.RUN_ERROR:case z.MESSAGES_SNAPSHOT:return[...a(),e];case z.RAW:case z.ACTIVITY_SNAPSHOT:case z.ACTIVITY_DELTA:case z.REASONING_ENCRYPTED_VALUE:case z.SUBAGENT_STARTED:return[e];case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case z.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=i_({type:z.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=i_({type:z.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=i_({type:z.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Ef(()=>{a()}))};function o_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var s_=class{runNext(e,t){return t.run(e).pipe(a_(!1))}runNextWithState(e,t){let n=Mg(e.messages||[]),r=Mg(e.state||{}),i=new Nd;return Wg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(wf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Mg(n),state:Mg(r)})))}},c_=class extends s_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function l_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var u_=class extends s_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(l_)};return this.runNext(i,t)}},d_=`THINKING_START`,f_=`THINKING_END`,p_=`THINKING_TEXT_MESSAGE_START`,m_=`THINKING_TEXT_MESSAGE_CONTENT`,h_=`THINKING_TEXT_MESSAGE_END`,g_=class extends s_{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(_f(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case d_:{this.currentReasoningId=Ng();let{title:t,...n}=e;return this.warnAboutTransformation(d_,z.REASONING_START),{...n,type:z.REASONING_START,messageId:this.currentReasoningId}}case p_:return this.currentMessageId=Ng(),this.warnAboutTransformation(p_,z.REASONING_MESSAGE_START),{...e,type:z.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case m_:{let{delta:t,...n}=e;return this.warnAboutTransformation(m_,z.REASONING_MESSAGE_CONTENT),{...n,type:z.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ng(),delta:t}}case h_:{let t=this.currentMessageId??Ng();return this.warnAboutTransformation(h_,z.REASONING_MESSAGE_END),{...e,type:z.REASONING_MESSAGE_END,messageId:t}}case f_:{let t=this.currentReasoningId??Ng();return this.warnAboutTransformation(f_,z.REASONING_END),{...e,type:z.REASONING_END,messageId:t}}default:return e}}};function __(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function v_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function y_(e){let t=__(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e}function b_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>v_(e)?y_(e):e);return{...e,content:n}}var x_=class extends s_{run(e,t){let n={...e,messages:e.messages.map(b_)};return this.runNext(n,t)}},S_=`SUBAGENT_STARTED`,C_=`SUBAGENT_FINISHED`,w_=`SUBAGENT_ERROR`;function T_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function E_(e){return e.map(e=>T_(e))}var D_=class extends s_{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>T_(e))};return this.runNext(n,t).pipe(kf(e=>{let t=e.type;(t===S_||t===C_||t===w_)&&this.warnDroppedLifecycleEvent(t)}),Sf(e=>{let t=e.type;return t!==S_&&t!==C_&&t!==w_}),_f(e=>{let t=T_(e);if(t.type===z.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:E_(e.messages)}}if(t.type===z.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>T_(e))}}}if(t.type===z.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:E_(e.input.messages)}}}return t}))}},O_=`0.0.59`,k_=class{get maxVersion(){return O_}get debug(){return this._debug}set debug(e){this._debug=Rg(e),this._debugLogger=Vg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Vg(Rg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Mg(r??[]),this.state=Mg(i??{}),this._debug=Rg(a),this._debugLogger=Vg(this._debug),jg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new u_),jg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new g_),jg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new x_),jg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new D_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new c_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ef(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)));let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>xf(()=>this.connect(n)),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.isRunning=!1,e instanceof Qc?Pd:this.onError(n,e,a))),Ef(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)),{defaultValue:void 0});let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,n){return Wg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(kf(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Mg(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Mg(e?.tools??[]),context:Mg(e?.context??[]),forwardedProps:Mg(e?.forwardedProps??{}),state:Mg(this.state),messages:n,...e?.resume===void 0?{}:{resume:Mg(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new R(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(o_(e))throw new R(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return pf(Lg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(_f(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Mg(this.messages),e.state=Mg(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Mg(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=Mg(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Mg(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(a_(this.debugLogger),Gg(this.debugLogger),e_(this.threadId,t.runId,this.agentId),e=>e.pipe(_f(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function A_(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var j_=class extends k_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(A_(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=Mg(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Xg(qg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Mg(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},M_=class extends ln{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:wn(t,n.data),hasPreviousPage:un(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},N_=class extends pn{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new bn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=P_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){xn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Dn(t,e))}findAll(e={}){return this.getAll().filter(t=>Dn(e,t))}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return xn.batch(()=>Promise.all(e.map(e=>e.continue().catch(En))))}};function P_(e){return e.options.scope?.id}var F_=class extends pn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Tn(r,t),a=this.get(i);return a||(a=new _n({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){xn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>cn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>cn(e,t)):t}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},I_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new F_,this.#t=e.mutationCache||new N_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=vn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Kt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return xn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;xn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return xn.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=xn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(En).catch(En)}invalidateQueries(e,t={}){return xn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=xn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(En)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(En)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Kt(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Kt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(En).catch(En)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(En).catch(En)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return dn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(on(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{an(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(on(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{an(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Tn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Jt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function L_(e,t){return sn(e,M_,t)}var R_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),G_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:R_}));G_.displayName=`BookOpenIcon`;var K_=G_,q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));q_.displayName=`MagnifyingGlassIcon`;var J_=q_,Y_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));Y_.displayName=`MoonIcon`;var X_=Y_,Z_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));Z_.displayName=`PencilSimpleIcon`;var Q_=Z_,$_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));$_.displayName=`PlugsConnectedIcon`;var ev=$_,tv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));tv.displayName=`SignOutIcon`;var nv=tv,rv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));rv.displayName=`SunIcon`;var iv=rv,av={home:`https://fanout.run/docs`,ingest:`https://fanout.run/docs/ingest`};async function ov(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function sv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=tn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=L_({queryKey:[...Sn,m],queryFn:({pageParam:e})=>ov(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=mn({queryKey:Cn,queryFn:()=>yn(`/api/dashboards`),refetchInterval:3e4}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>pv(ue),[ue]),fe=pt(`overview`,ft({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Sn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Sn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Ft,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Bt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(lv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Pt,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(ot,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(J_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(gn,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(gn,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function cv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function lv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:mv(e.updatedAt)})]})}),(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Ze,{size:18,weight:`bold`})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(Q_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Le.Item,{color:`bad`,leftSection:(0,T.jsx)(It,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function uv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function dv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var fv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function pv(e){let t=dv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-dv(uv(r.updatedAt)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return fv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function mv(e){let t=uv(e),n=dv(new Date);return Math.floor((n-dv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function hv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=On(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=Ve({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(kn),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Vt,{label:`Documentation`,children:(0,T.jsx)(jn,{component:`a`,href:av.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(K_,{size:17,weight:`bold`})})}),(0,T.jsx)(gv,{}),(0,T.jsx)(_v,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(sv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(sv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function gv(){let{setColorScheme:e}=Ut(),t=Wt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`;return(0,T.jsx)(Vt,{label:`Switch to ${n} theme`,children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onClick:()=>e(n),children:t===`dark`?(0,T.jsx)(iv,{size:17,weight:`bold`}):(0,T.jsx)(X_,{size:17,weight:`bold`})})})}function _v({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(ev,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Le.Divider,{}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(nv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function vv(){let{agent_available:e}=ke(),t=Ne(),n=tn(),{threadId:r}=Ve({strict:!1}),[i,a]=(0,w.useState)(Nt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(null),oe=(0,w.useRef)(0),se=(0,w.useMemo)(()=>new j_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),ce=!e||f===s;function le(){oe.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),le(),te(``),!e){p(s);return}!r||o.current.has(s)?(se.setMessages([]),p(s)):De(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}se.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=se.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{oe.current+=1,y(Mn(e.toolCallName))},onToolCallEndEvent:()=>{oe.current=Math.max(0,oe.current-1),oe.current===0&&y(``)},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})}});return()=>{t=!1,i.unsubscribe(),se.abortRun()}},[se,e,n,ne,s]),(0,w.useEffect)(()=>{ie.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[c,g]),(0,w.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ae.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ae.current?.focus()))),e.key===`Escape`&&n===ae.current&&(x(``),ae.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function ue(){_(!0),te(``);try{await se.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s)}}async function de(n){let i=n.trim();if(!e||!i||g||!ce||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Nt(),role:`user`,content:i};se.addMessage(a),l([...se.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await ue()}(0,w.useEffect)(()=>{let e=S.current;ce&&r&&e&&(S.current=``,de(e))},[ce,r,s]);function C(e){e.preventDefault(),de(b)}function fe(){se.abortRun(),_(!1),le(),o.current.delete(s)}function pe(){!g&&se.messages.some(e=>e.role===`user`)&&ue()}function me(n){if(!e)return;let r=Nt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function he(){se.abortRun(),S.current=``,a(Nt()),t({to:`/chat`})}function ge(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function _e(){re(e=>e+1)}return(0,T.jsx)(An.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ce,running:g,activity:v,input:b,setInput:x,error:ee,bottomRef:ie,inputRef:ae,send:de,submit:C,stop:fe,retry:pe,reloadThread:_e,openChat:me,newThread:he,selectThread:ge},children:(0,T.jsx)(hv,{children:(0,T.jsx)(ta,{})})})}function yv(){let e=(0,w.useMemo)(()=>new I_,[]);return(0,T.jsx)(qt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(vv,{})})})}var bv=Re({component:yv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),xv=Je(`/`)({component:Ke(()=>Nn(()=>import(`./routes-D1xQhcK4.js`),__vite__mapDeps([0,1,2])),`component`)}),Sv=Je(`/settings`)({component:Ke(()=>Nn(()=>import(`./settings-D0Y7fLFc.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),Cv=Je(`/chat/`)({component:Ke(()=>Nn(()=>import(`./chat.index-DvqxaiRx.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),wv=Je(`/chat/$threadId`)({component:Ke(()=>Nn(()=>import(`./chat._threadId-DvqxaiRx.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Tv=Je(`/dashboards/`)({component:Ke(()=>Nn(()=>import(`./dashboards.index-Ds_9_kmf.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Ev=Je(`/dashboards/$dashboardId`)({component:Ke(()=>Nn(()=>import(`./dashboards._dashboardId-DT7kwfWv.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Dv=xv.update({id:`/`,path:`/`,getParentRoute:()=>bv}),Ov=Sv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>bv}),kv=Cv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>bv}),Av=wv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>bv}),jv=Tv.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>bv}),Mv={IndexRoute:Dv,SettingsRoute:Ov,ChatThreadIdRoute:Av,DashboardsDashboardIdRoute:Ev.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>bv}),ChatIndexRoute:kv,DashboardsIndexRoute:jv},Nv=sa({routeTree:bv._addFileChildren(Mv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Pv={brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},Fv={light:7,dark:5};function Iv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Lv(e){let t=Iv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Rv(e){return Object.fromEntries(Object.entries(Pv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Lv(n[Fv[e]])]))}function zv(e){return t=>{let n=t.color??Hv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Pv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Bv=.25,Vv={xs:9,sm:10,md:11,lg:13,xl:16},Hv={primaryColor:`brand`,primaryShade:Fv,autoContrast:!0,luminanceThreshold:Bv,colors:{dark:kt,brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},defaultRadius:`md`,fontFamily:it.body,fontFamilyMonospace:it.display,headings:{fontFamily:it.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Gv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Gv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Wv(t.size)})}}},Uv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...Rv(`light`)},dark:Rv(`dark`)});function Wv(e){let t=Vv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Gv(e,t){return!e||e===Hv.primaryColor?{[t]:`var(--fanout-color-${Hv.primaryColor}-contrast)`}:{}}var Kv=zv(h),qv=ja({...Hv,variantColorResolver:Kv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:qv,defaultColorScheme:`auto`,cssVariablesResolver:Uv,children:(0,T.jsx)(ua,{router:Nv})})}));export{Tv as n,av as r,Ev as t}; \ No newline at end of file +`)},e_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(yf(r=>{switch(r.type){case z.TEXT_MESSAGE_START:{let e=r;return[{type:Zg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case z.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Zg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case z.TEXT_MESSAGE_END:{let e=r;return[{type:Zg.enum.TextMessageEnd,messageId:e.messageId}]}case z.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:Zg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case z.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(jf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Zg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case z.TOOL_CALL_END:{let e=r;return[{type:Zg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case z.TOOL_CALL_RESULT:{let e=r;return[{type:Zg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case z.RAW:return[];case z.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Zg.enum.MetaEvent,name:e.name,value:e.value}]}case z.STATE_SNAPSHOT:return f(r.snapshot),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case z.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case z.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case z.RUN_STARTED:return[];case z.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:t_(c)}:{}}),active:!1}];case z.RUN_ERROR:{let e=r;return[{type:Zg.enum.RunError,message:e.message,code:e.code}]}case z.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case z.STEP_FINISHED:return u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function t_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=$g(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var n_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,r_=e=>e===`tool`?`toolCallId`:`messageId`,i_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},a_=e=>t=>{let n=zg(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:z.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:z.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:z.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&n_(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${r_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(yf(e=>{switch(e.type){case z.TEXT_MESSAGE_START:case z.TEXT_MESSAGE_CONTENT:case z.TEXT_MESSAGE_END:case z.TOOL_CALL_START:case z.TOOL_CALL_ARGS:case z.TOOL_CALL_END:case z.TOOL_CALL_RESULT:case z.STATE_SNAPSHOT:case z.STATE_DELTA:case z.CUSTOM:case z.STEP_STARTED:case z.STEP_FINISHED:case z.THINKING_START:case z.THINKING_END:case z.THINKING_TEXT_MESSAGE_START:case z.THINKING_TEXT_MESSAGE_CONTENT:case z.THINKING_TEXT_MESSAGE_END:case z.REASONING_START:case z.REASONING_MESSAGE_START:case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:return[...i(e.subagentRunId??void 0),e];case z.RUN_STARTED:case z.RUN_FINISHED:case z.RUN_ERROR:case z.MESSAGES_SNAPSHOT:return[...a(),e];case z.RAW:case z.ACTIVITY_SNAPSHOT:case z.ACTIVITY_DELTA:case z.REASONING_ENCRYPTED_VALUE:case z.SUBAGENT_STARTED:return[e];case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case z.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=i_({type:z.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=i_({type:z.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=i_({type:z.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Ef(()=>{a()}))};function o_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var s_=class{runNext(e,t){return t.run(e).pipe(a_(!1))}runNextWithState(e,t){let n=Mg(e.messages||[]),r=Mg(e.state||{}),i=new Nd;return Wg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(wf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Mg(n),state:Mg(r)})))}},c_=class extends s_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function l_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var u_=class extends s_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(l_)};return this.runNext(i,t)}},d_=`THINKING_START`,f_=`THINKING_END`,p_=`THINKING_TEXT_MESSAGE_START`,m_=`THINKING_TEXT_MESSAGE_CONTENT`,h_=`THINKING_TEXT_MESSAGE_END`,g_=class extends s_{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(_f(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case d_:{this.currentReasoningId=Ng();let{title:t,...n}=e;return this.warnAboutTransformation(d_,z.REASONING_START),{...n,type:z.REASONING_START,messageId:this.currentReasoningId}}case p_:return this.currentMessageId=Ng(),this.warnAboutTransformation(p_,z.REASONING_MESSAGE_START),{...e,type:z.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case m_:{let{delta:t,...n}=e;return this.warnAboutTransformation(m_,z.REASONING_MESSAGE_CONTENT),{...n,type:z.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ng(),delta:t}}case h_:{let t=this.currentMessageId??Ng();return this.warnAboutTransformation(h_,z.REASONING_MESSAGE_END),{...e,type:z.REASONING_MESSAGE_END,messageId:t}}case f_:{let t=this.currentReasoningId??Ng();return this.warnAboutTransformation(f_,z.REASONING_END),{...e,type:z.REASONING_END,messageId:t}}default:return e}}};function __(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function v_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function y_(e){let t=__(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e}function b_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>v_(e)?y_(e):e);return{...e,content:n}}var x_=class extends s_{run(e,t){let n={...e,messages:e.messages.map(b_)};return this.runNext(n,t)}},S_=`SUBAGENT_STARTED`,C_=`SUBAGENT_FINISHED`,w_=`SUBAGENT_ERROR`;function T_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function E_(e){return e.map(e=>T_(e))}var D_=class extends s_{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>T_(e))};return this.runNext(n,t).pipe(kf(e=>{let t=e.type;(t===S_||t===C_||t===w_)&&this.warnDroppedLifecycleEvent(t)}),Sf(e=>{let t=e.type;return t!==S_&&t!==C_&&t!==w_}),_f(e=>{let t=T_(e);if(t.type===z.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:E_(e.messages)}}if(t.type===z.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>T_(e))}}}if(t.type===z.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:E_(e.input.messages)}}}return t}))}},O_=`0.0.59`,k_=class{get maxVersion(){return O_}get debug(){return this._debug}set debug(e){this._debug=Rg(e),this._debugLogger=Vg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Vg(Rg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Mg(r??[]),this.state=Mg(i??{}),this._debug=Rg(a),this._debugLogger=Vg(this._debug),jg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new u_),jg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new g_),jg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new x_),jg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new D_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new c_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ef(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)));let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>xf(()=>this.connect(n)),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.isRunning=!1,e instanceof Qc?Pd:this.onError(n,e,a))),Ef(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)),{defaultValue:void 0});let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,n){return Wg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(kf(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Mg(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Mg(e?.tools??[]),context:Mg(e?.context??[]),forwardedProps:Mg(e?.forwardedProps??{}),state:Mg(this.state),messages:n,...e?.resume===void 0?{}:{resume:Mg(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new R(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(o_(e))throw new R(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return pf(Lg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(_f(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Mg(this.messages),e.state=Mg(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Mg(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=Mg(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Mg(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(a_(this.debugLogger),Gg(this.debugLogger),e_(this.threadId,t.runId,this.agentId),e=>e.pipe(_f(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function A_(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var j_=class extends k_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(A_(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=Mg(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Xg(qg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Mg(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},M_=class extends ln{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:wn(t,n.data),hasPreviousPage:un(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},N_=class extends pn{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new bn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=P_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){xn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Dn(t,e))}findAll(e={}){return this.getAll().filter(t=>Dn(e,t))}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return xn.batch(()=>Promise.all(e.map(e=>e.continue().catch(En))))}};function P_(e){return e.options.scope?.id}var F_=class extends pn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Tn(r,t),a=this.get(i);return a||(a=new _n({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){xn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>cn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>cn(e,t)):t}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},I_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new F_,this.#t=e.mutationCache||new N_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=vn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Kt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return xn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;xn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return xn.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=xn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(En).catch(En)}invalidateQueries(e,t={}){return xn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=xn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(En)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(En)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Kt(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Kt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(En).catch(En)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(En).catch(En)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return dn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(on(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{an(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(on(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{an(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Tn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Jt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function L_(e,t){return sn(e,M_,t)}var R_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),G_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:R_}));G_.displayName=`BookOpenIcon`;var K_=G_,q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));q_.displayName=`MagnifyingGlassIcon`;var J_=q_,Y_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));Y_.displayName=`MoonIcon`;var X_=Y_,Z_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));Z_.displayName=`PencilSimpleIcon`;var Q_=Z_,$_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));$_.displayName=`PlugsConnectedIcon`;var ev=$_,tv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));tv.displayName=`SignOutIcon`;var nv=tv,rv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));rv.displayName=`SunIcon`;var iv=rv,av={home:`https://fanout.run/`,ingest:`https://fanout.run/start/send-telemetry`};async function ov(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function sv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=tn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=L_({queryKey:[...Sn,m],queryFn:({pageParam:e})=>ov(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=mn({queryKey:Cn,queryFn:()=>yn(`/api/dashboards`),refetchInterval:3e4}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>pv(ue),[ue]),fe=pt(`overview`,ft({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Sn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Sn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Ft,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Bt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(lv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Pt,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(ot,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(J_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(gn,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(gn,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function cv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function lv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:mv(e.updatedAt)})]})}),(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Ze,{size:18,weight:`bold`})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(Q_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Le.Item,{color:`bad`,leftSection:(0,T.jsx)(It,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function uv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function dv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var fv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function pv(e){let t=dv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-dv(uv(r.updatedAt)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return fv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function mv(e){let t=uv(e),n=dv(new Date);return Math.floor((n-dv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function hv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=On(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=Ve({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(kn),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Vt,{label:`Documentation`,children:(0,T.jsx)(jn,{component:`a`,href:av.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(K_,{size:17,weight:`bold`})})}),(0,T.jsx)(gv,{}),(0,T.jsx)(_v,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(sv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(sv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function gv(){let{setColorScheme:e}=Ut(),t=Wt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`;return(0,T.jsx)(Vt,{label:`Switch to ${n} theme`,children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onClick:()=>e(n),children:t===`dark`?(0,T.jsx)(iv,{size:17,weight:`bold`}):(0,T.jsx)(X_,{size:17,weight:`bold`})})})}function _v({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(ev,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Le.Divider,{}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(nv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function vv(){let{agent_available:e}=ke(),t=Ne(),n=tn(),{threadId:r}=Ve({strict:!1}),[i,a]=(0,w.useState)(Nt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(null),oe=(0,w.useRef)(0),se=(0,w.useMemo)(()=>new j_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),ce=!e||f===s;function le(){oe.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),le(),te(``),!e){p(s);return}!r||o.current.has(s)?(se.setMessages([]),p(s)):De(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}se.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=se.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{oe.current+=1,y(Mn(e.toolCallName))},onToolCallEndEvent:()=>{oe.current=Math.max(0,oe.current-1),oe.current===0&&y(``)},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})}});return()=>{t=!1,i.unsubscribe(),se.abortRun()}},[se,e,n,ne,s]),(0,w.useEffect)(()=>{ie.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[c,g]),(0,w.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ae.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ae.current?.focus()))),e.key===`Escape`&&n===ae.current&&(x(``),ae.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function ue(){_(!0),te(``);try{await se.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s)}}async function de(n){let i=n.trim();if(!e||!i||g||!ce||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Nt(),role:`user`,content:i};se.addMessage(a),l([...se.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await ue()}(0,w.useEffect)(()=>{let e=S.current;ce&&r&&e&&(S.current=``,de(e))},[ce,r,s]);function C(e){e.preventDefault(),de(b)}function fe(){se.abortRun(),_(!1),le(),o.current.delete(s)}function pe(){!g&&se.messages.some(e=>e.role===`user`)&&ue()}function me(n){if(!e)return;let r=Nt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function he(){se.abortRun(),S.current=``,a(Nt()),t({to:`/chat`})}function ge(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function _e(){re(e=>e+1)}return(0,T.jsx)(An.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ce,running:g,activity:v,input:b,setInput:x,error:ee,bottomRef:ie,inputRef:ae,send:de,submit:C,stop:fe,retry:pe,reloadThread:_e,openChat:me,newThread:he,selectThread:ge},children:(0,T.jsx)(hv,{children:(0,T.jsx)(ta,{})})})}function yv(){let e=(0,w.useMemo)(()=>new I_,[]);return(0,T.jsx)(qt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(vv,{})})})}var bv=Re({component:yv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),xv=Je(`/`)({component:Ke(()=>Nn(()=>import(`./routes-D1xQhcK4.js`),__vite__mapDeps([0,1,2])),`component`)}),Sv=Je(`/settings`)({component:Ke(()=>Nn(()=>import(`./settings-Br2qbsAf.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),Cv=Je(`/chat/`)({component:Ke(()=>Nn(()=>import(`./chat.index-DvqxaiRx.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),wv=Je(`/chat/$threadId`)({component:Ke(()=>Nn(()=>import(`./chat._threadId-DvqxaiRx.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Tv=Je(`/dashboards/`)({component:Ke(()=>Nn(()=>import(`./dashboards.index-7ogkHLEj.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Ev=Je(`/dashboards/$dashboardId`)({component:Ke(()=>Nn(()=>import(`./dashboards._dashboardId-CFltSAMM.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Dv=xv.update({id:`/`,path:`/`,getParentRoute:()=>bv}),Ov=Sv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>bv}),kv=Cv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>bv}),Av=wv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>bv}),jv=Tv.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>bv}),Mv={IndexRoute:Dv,SettingsRoute:Ov,ChatThreadIdRoute:Av,DashboardsDashboardIdRoute:Ev.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>bv}),ChatIndexRoute:kv,DashboardsIndexRoute:jv},Nv=sa({routeTree:bv._addFileChildren(Mv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Pv={brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},Fv={light:7,dark:5};function Iv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Lv(e){let t=Iv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Rv(e){return Object.fromEntries(Object.entries(Pv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Lv(n[Fv[e]])]))}function zv(e){return t=>{let n=t.color??Hv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Pv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Bv=.25,Vv={xs:9,sm:10,md:11,lg:13,xl:16},Hv={primaryColor:`brand`,primaryShade:Fv,autoContrast:!0,luminanceThreshold:Bv,colors:{dark:kt,brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},defaultRadius:`md`,fontFamily:it.body,fontFamilyMonospace:it.display,headings:{fontFamily:it.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Gv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Gv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Wv(t.size)})}}},Uv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...Rv(`light`)},dark:Rv(`dark`)});function Wv(e){let t=Vv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Gv(e,t){return!e||e===Hv.primaryColor?{[t]:`var(--fanout-color-${Hv.primaryColor}-contrast)`}:{}}var Kv=zv(h),qv=ja({...Hv,variantColorResolver:Kv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:qv,defaultColorScheme:`auto`,cssVariablesResolver:Uv,children:(0,T.jsx)(ua,{router:Nv})})}));export{Tv as n,av as r,Ev as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-Br2qbsAf.js b/internal/ui/dist/assets/settings-Br2qbsAf.js new file mode 100644 index 000000000..af540ca91 --- /dev/null +++ b/internal/ui/dist/assets/settings-Br2qbsAf.js @@ -0,0 +1,16 @@ +import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-BeUORN-q.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{O as S,i as C,k as w,n as T}from"./api-Be5Lq4YA.js";import{n as E,t as D}from"./WarningCircle.es-DDq2AFnK.js";import{r as O}from"./index-6GqvJDXC.js";var k=t(s(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j={root:`m_849cf0da`},M=d(),N={underline:`hover`},P=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,N,e);return(0,M.jsx)(a,{component:`a`,className:n({[j.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});P.classes=j,P.displayName=`@mantine/core/Anchor`;var F={timeout:1e3};function I(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,F,e),a=A({timeout:n});return(0,M.jsx)(M.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}I.displayName=`@mantine/core/CopyButton`;var L=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),R=k.forwardRef((e,t)=>k.createElement(i,{ref:t,...e,weights:L}));R.displayName=`ArrowsClockwiseIcon`;var z=R,B=[`settings`,`ingest`];function V(e,t){return t||/^https:\/\//i.test(e.trim())}function H(e,t,n){return`exporters: + otlp/fanout: + endpoint: "${e}" + headers: + ${t}: "Bearer \${env:FANOUT_INGEST_TOKEN}"${V(e,n)?``:` + tls: + insecure: true`} + +service: + pipelines: + traces: + exporters: [otlp/fanout] + logs: + exporters: [otlp/fanout] + metrics: + exporters: [otlp/fanout]`}function U({label:e,value:t,hint:n}){return(0,M.jsxs)(m,{gap:4,children:[(0,M.jsx)(a,{size:`sm`,fw:600,children:e}),(0,M.jsxs)(c,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,M.jsx)(b,{style:{flex:1,overflowX:`auto`},children:t}),(0,M.jsx)(I,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,M.jsx)(x,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,M.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15})})})})]}),n&&(0,M.jsx)(a,{c:`dimmed`,size:`xs`,children:n})]})}function W(){let e=y(),t=S(),n=C({queryKey:B,queryFn:()=>T(`/api/settings/ingest`)}),[r,i]=(0,k.useState)(!1),[s,u]=(0,k.useState)(null),d=E({mutationFn:async()=>{let e=await v(`/api/settings/ingest/rotate-token`,{method:`POST`}).catch(()=>{throw Error(`Fanout could not be reached. A token may still have been issued — reload this page before trying again.`)});if(!e.ok)throw Error(`Fanout could not issue a new token. Try again.`);return e.json()},onSuccess:e=>{i(!1),u(e.ingest_token??null),t.setQueryData(B,{token_required:e.token_required,suggested_endpoint:e.suggested_endpoint,tls_configured:e.tls_configured,header_name:e.header_name})}});function x(){u(null),d.reset()}if(n.isLoading)return(0,M.jsx)(G,{});if(n.isError||!n.data)return(0,M.jsx)(K,{onRetry:()=>void n.refetch()});let{suggested_endpoint:A,header_name:j,tls_configured:N,token_required:F}=n.data,L=e.role===`admin`,R=`${j}: Bearer `;return(0,M.jsxs)(g,{component:`main`,maw:760,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,M.jsxs)(m,{gap:`xl`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:1,fz:32,lts:`-0.03em`,children:`Connect telemetry`}),(0,M.jsx)(a,{c:`dimmed`,mt:2,children:`Point an OpenTelemetry collector or SDK at this workspace.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,M.jsxs)(m,{gap:`lg`,children:[(0,M.jsx)(U,{label:`Endpoint`,value:A,hint:V(A,N)?`OTLP over gRPC, secured with TLS.`:`OTLP over gRPC. Fanout serves this endpoint in plaintext, so an exporter needs tls.insecure unless a proxy in front of it terminates TLS.`}),(0,M.jsx)(U,{label:`Authorization`,value:R,hint:`Send the token your workspace issued. Fanout stores only its hash, so it cannot show you an existing one.`})]})}),(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:`Merge these blocks into your collector configuration, alongside the receivers it already has, and set FANOUT_INGEST_TOKEN in its environment.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`md`,children:(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsx)(b,{block:!0,style:{fontSize:12},children:H(A,j,N)}),(0,M.jsx)(c,{justify:`flex-end`,children:(0,M.jsx)(I,{value:H(A,j,N),timeout:1500,children:({copied:e,copy:t})=>(0,M.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Ingest token`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:F?`This workspace has a token. Rotating issues a new one and stops the current one working immediately.`:`This workspace has no token yet, so it is rejecting telemetry. Issue one to start accepting data.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:s?(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsx)(a,{size:`sm`,fw:600,children:`Your new token`}),(0,M.jsx)(b,{block:!0,children:`${j}: Bearer ${s}`}),(0,M.jsx)(a,{c:`dimmed`,size:`xs`,children:`Fanout shows this once and keeps only its hash. Store it with your collector secrets before closing this, then update any collector still using the old token. Lose it and the only way back is another rotation.`}),(0,M.jsxs)(c,{children:[(0,M.jsx)(I,{value:`${j}: Bearer ${s}`,timeout:1500,children:({copied:e,copy:t})=>(0,M.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy header`})}),(0,M.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:x,children:`Done`})]})]}):L?(0,M.jsxs)(c,{justify:`space-between`,align:`center`,children:[(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:F?`Rotate when a token may have been exposed.`:`No token issued yet.`}),(0,M.jsx)(h,{variant:F?`default`:`filled`,leftSection:(0,M.jsx)(z,{size:15,weight:`bold`}),onClick:()=>{d.reset(),i(!0)},children:F?`Rotate token`:`Issue token`})]}):(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:`An administrator issues and rotates the ingest token.`})})]}),(0,M.jsxs)(a,{c:`dimmed`,size:`xs`,children:[(0,M.jsx)(P,{href:O.ingest,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Sending telemetry`}),` covers SDK setup, the collector, and the OTLP/HTTP endpoint.`]})]}),(0,M.jsx)(w,{opened:r,onClose:()=>!d.isPending&&i(!1),title:F?`Rotate the ingest token?`:`Issue an ingest token?`,centered:!0,radius:`md`,children:(0,M.jsxs)(m,{gap:`md`,children:[(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:F?`The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it. Fanout shows the new token once and stores only its hash.`:`Fanout will show the new token once, and store only its hash.`}),d.isError&&(0,M.jsx)(o,{color:`bad`,radius:`md`,icon:(0,M.jsx)(D,{size:18,weight:`fill`}),children:d.error instanceof Error?d.error.message:`Fanout could not issue a new token.`}),(0,M.jsxs)(c,{justify:`flex-end`,gap:`sm`,children:[(0,M.jsx)(h,{variant:`default`,size:`sm`,onClick:()=>{d.reset(),i(!1)},disabled:d.isPending,children:`Cancel`}),(0,M.jsx)(h,{color:F?`bad`:void 0,size:`sm`,loading:d.isPending,onClick:()=>d.mutate(),children:F?`Rotate token`:`Issue token`})]})]})})]})}function G(){return(0,M.jsxs)(c,{justify:`center`,mih:`50vh`,gap:`sm`,children:[(0,M.jsx)(r,{size:`sm`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,children:`Loading connection details…`})]})}function K({onRetry:e}){return(0,M.jsx)(c,{justify:`center`,mih:`50vh`,children:(0,M.jsx)(o,{color:`bad`,radius:`md`,icon:(0,M.jsx)(D,{size:18,weight:`fill`}),maw:420,children:(0,M.jsxs)(m,{gap:`sm`,align:`flex-start`,children:[(0,M.jsx)(a,{size:`sm`,children:`Fanout could not load this workspace's connection details.`}),(0,M.jsx)(h,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:e,children:`Try again`})]})})})}var q=W;export{q as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-D0Y7fLFc.js b/internal/ui/dist/assets/settings-D0Y7fLFc.js deleted file mode 100644 index 6876107c8..000000000 --- a/internal/ui/dist/assets/settings-D0Y7fLFc.js +++ /dev/null @@ -1,16 +0,0 @@ -import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-BeUORN-q.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{i as S,k as C,n as w}from"./api-Be5Lq4YA.js";import{n as T,t as E}from"./WarningCircle.es-DDq2AFnK.js";import{r as D}from"./index-DGL83-Oj.js";var O=t(s(),1);function k(e={}){let t=e.timeout??2e3,[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(!1),o=(0,O.useRef)(null);(0,O.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var A={root:`m_849cf0da`},j=d(),M={underline:`hover`},N=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,M,e);return(0,j.jsx)(a,{component:`a`,className:n({[A.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});N.classes=A,N.displayName=`@mantine/core/Anchor`;var P={timeout:1e3};function F(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,P,e),a=k({timeout:n});return(0,j.jsx)(j.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}F.displayName=`@mantine/core/CopyButton`;var I=new Map([[`bold`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),O.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),L=O.forwardRef((e,t)=>O.createElement(i,{ref:t,...e,weights:I}));L.displayName=`ArrowsClockwiseIcon`;var R=L,z=[`settings`,`ingest`];function B(e,t,n){return`exporters: - otlp/fanout: - endpoint: ${e} - headers: - ${t.toLowerCase()}: "Bearer $\{FANOUT_INGEST_TOKEN}"${n?``:` - tls: - insecure: true`} - -service: - pipelines: - traces: - exporters: [otlp/fanout] - logs: - exporters: [otlp/fanout] - metrics: - exporters: [otlp/fanout]`}function V({label:e,value:t,hint:n}){return(0,j.jsxs)(m,{gap:4,children:[(0,j.jsx)(a,{size:`sm`,fw:600,children:e}),(0,j.jsxs)(c,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,j.jsx)(b,{style:{flex:1,overflowX:`auto`},children:t}),(0,j.jsx)(F,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,j.jsx)(x,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,j.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,j.jsx)(l,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15})})})})]}),n&&(0,j.jsx)(a,{c:`dimmed`,size:`xs`,children:n})]})}function H(){let e=y(),t=S({queryKey:z,queryFn:()=>w(`/api/settings/ingest`)}),[n,r]=(0,O.useState)(!1),[i,s]=(0,O.useState)(null),u=T({mutationFn:async()=>{let e=await v(`/api/settings/ingest/rotate-token`,{method:`POST`});if(!e.ok)throw Error(`Fanout could not issue a new token. Try again.`);return e.json()},onSuccess:e=>{r(!1),s(e.ingest_token??null)}});if(t.isLoading)return(0,j.jsx)(U,{label:`Loading connection details…`});if(t.isError||!t.data)return(0,j.jsx)(U,{label:`Connection details are unavailable. Try refreshing.`});let{suggested_endpoint:d,header_name:x,tls_configured:k,token_required:A}=t.data,M=e.role===`admin`,P=`${x}: Bearer `;return(0,j.jsxs)(g,{component:`main`,maw:760,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,j.jsxs)(m,{gap:`xl`,children:[(0,j.jsxs)(g,{children:[(0,j.jsx)(f,{order:1,fz:32,lts:`-0.03em`,children:`Connect telemetry`}),(0,j.jsx)(a,{c:`dimmed`,mt:2,children:`Point an OpenTelemetry collector or SDK at this workspace.`})]}),(0,j.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,j.jsxs)(m,{gap:`lg`,children:[(0,j.jsx)(V,{label:`Endpoint`,value:d,hint:k?`OTLP over gRPC, TLS terminated at the edge.`:`OTLP over gRPC. This instance serves plaintext, so the exporter needs tls.insecure.`}),(0,j.jsx)(V,{label:`Authorization`,value:P,hint:`Send the token your workspace issued. Fanout stores only its hash, so it cannot show you an existing one.`})]})}),(0,j.jsxs)(m,{gap:`sm`,children:[(0,j.jsxs)(g,{children:[(0,j.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,j.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:`Paste this into your collector and set FANOUT_INGEST_TOKEN in its environment.`})]}),(0,j.jsx)(_,{withBorder:!0,radius:`lg`,p:`md`,children:(0,j.jsxs)(m,{gap:`sm`,children:[(0,j.jsx)(b,{block:!0,style:{fontSize:12},children:B(d,x,k)}),(0,j.jsx)(c,{justify:`flex-end`,children:(0,j.jsx)(F,{value:B(d,x,k),timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,j.jsx)(l,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,j.jsxs)(m,{gap:`sm`,children:[(0,j.jsxs)(g,{children:[(0,j.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Ingest token`}),(0,j.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:A?`This workspace has a token. Rotating issues a new one and stops the current one working immediately.`:`This workspace has no token yet, so it is rejecting telemetry. Issue one to start accepting data.`})]}),(0,j.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:i?(0,j.jsxs)(m,{gap:`sm`,children:[(0,j.jsx)(a,{size:`sm`,fw:600,children:`Your new token`}),(0,j.jsx)(b,{block:!0,children:`${x}: Bearer ${i}`}),(0,j.jsx)(a,{c:`dimmed`,size:`xs`,children:`Fanout shows this once. Store it with your collector secrets, then update any collector still using the old token.`}),(0,j.jsxs)(c,{children:[(0,j.jsx)(F,{value:`${x}: Bearer ${i}`,timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,j.jsx)(l,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy header`})}),(0,j.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:()=>s(null),children:`Done`})]})]}):M?(0,j.jsxs)(c,{justify:`space-between`,align:`center`,children:[(0,j.jsx)(a,{size:`sm`,c:`dimmed`,children:A?`Rotate when a token may have been exposed.`:`No token issued yet.`}),(0,j.jsx)(h,{variant:A?`default`:`filled`,leftSection:(0,j.jsx)(R,{size:15,weight:`bold`}),onClick:()=>r(!0),children:A?`Rotate token`:`Issue token`})]}):(0,j.jsx)(a,{size:`sm`,c:`dimmed`,children:`An administrator issues and rotates the ingest token.`})})]}),(0,j.jsxs)(a,{c:`dimmed`,size:`xs`,children:[(0,j.jsx)(N,{href:D.ingest,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Ingest documentation`}),` covers SDK setup, batching and the OTLP/HTTP endpoint.`]})]}),(0,j.jsx)(C,{opened:n,onClose:()=>!u.isPending&&r(!1),title:A?`Rotate the ingest token?`:`Issue an ingest token?`,centered:!0,radius:`md`,children:(0,j.jsxs)(m,{gap:`md`,children:[(0,j.jsx)(a,{size:`sm`,c:`dimmed`,children:A?`The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it.`:`Fanout will show the new token once, and store only its hash.`}),u.isError&&(0,j.jsx)(o,{color:`bad`,radius:`md`,icon:(0,j.jsx)(E,{size:18,weight:`fill`}),children:u.error instanceof Error?u.error.message:`Fanout could not issue a new token.`}),(0,j.jsxs)(c,{justify:`flex-end`,gap:`sm`,children:[(0,j.jsx)(h,{variant:`default`,size:`sm`,onClick:()=>r(!1),disabled:u.isPending,children:`Cancel`}),(0,j.jsx)(h,{color:A?`bad`:void 0,size:`sm`,loading:u.isPending,onClick:()=>u.mutate(),children:A?`Rotate token`:`Issue token`})]})]})})]})}function U({label:e}){return(0,j.jsxs)(c,{justify:`center`,mih:`50vh`,gap:`sm`,children:[(0,j.jsx)(r,{size:`sm`}),(0,j.jsx)(a,{c:`dimmed`,size:`sm`,children:e})]})}var W=H;export{W as component}; \ No newline at end of file diff --git a/internal/ui/dist/index.html b/internal/ui/dist/index.html index 4327966b9..39d5da630 100644 --- a/internal/ui/dist/index.html +++ b/internal/ui/dist/index.html @@ -21,7 +21,7 @@ document.documentElement.setAttribute("data-mantine-color-scheme", computed); } catch (e) {} - + diff --git a/ui/host/src/settings.test.tsx b/ui/host/src/settings.test.tsx index e8f7c40fe..054ddf9d4 100644 --- a/ui/host/src/settings.test.tsx +++ b/ui/host/src/settings.test.tsx @@ -43,9 +43,10 @@ describe("connect telemetry", () => { const root = await mount(); await vi.waitFor(() => expect(document.body.textContent).toContain("Collector configuration")); const config = document.body.textContent ?? ""; - expect(config).toContain("endpoint: ingest.example.com:4317"); + // Quoted, because an advertised IPv6 endpoint is a YAML flow sequence bare. + expect(config).toContain('endpoint: "ingest.example.com:4317"'); // A secret pasted into a config file is a secret in version control. - expect(config).toContain("${FANOUT_INGEST_TOKEN}"); + expect(config).toContain("${env:FANOUT_INGEST_TOKEN}"); // This instance serves plaintext, so the exporter has to be told. expect(config).toContain("insecure: true"); await act(async () => root.unmount()); @@ -77,6 +78,61 @@ describe("connect telemetry", () => { await act(async () => root.unmount()); }); + it("omits tls.insecure when the advertised endpoint is already https", async () => { + fetchMock.mockImplementation(async () => json({ ...connection, suggested_endpoint: "https://ingest.example.com" })); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Collector configuration")); + expect(document.body.textContent).not.toContain("insecure: true"); + expect(document.body.textContent).toContain("secured with TLS"); + await act(async () => root.unmount()); + }); + + it("stops offering to issue a token once one has been issued", async () => { + fetchMock.mockImplementation(async (_url, init) => json((init as RequestInit | undefined)?.method === "POST" + ? { ...connection, token_required: true, ingest_token: "fo_firsttoken" } + : { ...connection, token_required: false })); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("rejecting telemetry")); + const open = [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Issue token"); + await act(async () => open?.click()); + const confirm = [...document.querySelectorAll('[role="dialog"] button')].find((button) => button.textContent?.trim() === "Issue token"); + await act(async () => confirm?.click()); + await vi.waitFor(() => expect(document.body.textContent).toContain("fo_firsttoken")); + // The page has changed the fact it describes: leaving the old copy up + // invites the admin to rotate away the token they were just handed. + expect(document.body.textContent).not.toContain("rejecting telemetry"); + const done = [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Done"); + await act(async () => done?.click()); + expect(document.body.textContent).not.toContain("fo_firsttoken"); + expect(document.body.textContent).toContain("Rotate when a token may have been exposed"); + await act(async () => root.unmount()); + }); + + it("explains a rotation that failed, and forgets it when the dialog is reopened", async () => { + fetchMock.mockImplementation(async (_url, init) => ((init as RequestInit | undefined)?.method === "POST" ? json({ message: "nope" }, 500) : json(connection))); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Rotate token")); + const open = () => [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Rotate token" && !button.closest('[role="dialog"]')); + await act(async () => open()?.click()); + const confirm = [...document.querySelectorAll('[role="dialog"] button')].find((button) => button.textContent?.trim() === "Rotate token"); + await act(async () => confirm?.click()); + await vi.waitFor(() => expect(document.body.textContent).toContain("could not issue a new token")); + const cancel = [...document.querySelectorAll('[role="dialog"] button')].find((button) => button.textContent?.trim() === "Cancel"); + await act(async () => cancel?.click()); + await act(async () => open()?.click()); + // A stale failure standing over an untouched dialog reads as a new one. + expect(document.querySelector('[role="dialog"]')?.textContent).not.toContain("could not issue a new token"); + await act(async () => root.unmount()); + }); + + it("offers a retry instead of a spinner when the details cannot be loaded", async () => { + fetchMock.mockImplementation(async () => json({ message: "boom" }, 500)); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("could not load")); + expect([...document.querySelectorAll("button")].some((button) => button.textContent?.trim() === "Try again")).toBe(true); + await act(async () => root.unmount()); + }); + it("gives a viewer the connection details without a rotate button", async () => { role = "viewer"; const root = await mount(); diff --git a/ui/host/src/settings.tsx b/ui/host/src/settings.tsx index 83d306773..ecf2b28eb 100644 --- a/ui/host/src/settings.tsx +++ b/ui/host/src/settings.tsx @@ -1,6 +1,6 @@ import { Alert, Anchor, Box, Button, Code, CopyButton, Group, Loader, Modal, Paper, Stack, Text, Title, Tooltip } from "@mantine/core"; import { ArrowsClockwise, Check, Copy, WarningCircle } from "@phosphor-icons/react"; -import { useMutation, useQuery } from "@tanstack/react-query"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { useState } from "react"; import { getJSON } from "./api"; import { authorizedFetch, useViewer } from "./auth"; @@ -15,15 +15,31 @@ type IngestSettings = { const ingestQueryKey = ["settings", "ingest"] as const; +/** Whether the exporter reaches this instance over TLS. The endpoint may be an + * advertised URL, in which case its scheme is the answer; otherwise it is + * plaintext unless this process holds the certificate itself. A proxy that + * terminates TLS without an https endpoint being advertised is invisible from + * here, which is why the hint says so rather than asserting plaintext. */ +function overTLS(endpoint: string, tlsConfigured: boolean) { + return tlsConfigured || /^https:\/\//i.test(endpoint.trim()); +} + /** The collector block an engineer actually pastes, with this instance's own * endpoint already in it. Everything else on the page is a fact about the - * connection; this is the thing that makes telemetry arrive. */ -function collectorConfig(endpoint: string, header: string, tls: boolean) { + * connection; this is the thing that makes telemetry arrive. + * + * The endpoint is quoted because an advertised IPv6 address arrives as + * "[2001:db8::1]:4317", which unquoted YAML reads as a flow sequence. The + * token is referenced as ${env:...}, the form the documentation uses and the + * only one that is unambiguous when a distribution sets its own default + * config scheme. */ +function collectorConfig(endpoint: string, header: string, tlsConfigured: boolean) { + const insecure = overTLS(endpoint, tlsConfigured) ? "" : "\n tls:\n insecure: true"; return `exporters: otlp/fanout: - endpoint: ${endpoint} + endpoint: "${endpoint}" headers: - ${header.toLowerCase()}: "Bearer $\{FANOUT_INGEST_TOKEN}"${tls ? "" : "\n tls:\n insecure: true"} + ${header}: "Bearer \${env:FANOUT_INGEST_TOKEN}"${insecure} service: pipelines: @@ -54,13 +70,18 @@ function Field({ label, value, hint }: { label: string; value: string; hint?: st export default function Settings() { const viewer = useViewer(); + const queryClient = useQueryClient(); const settings = useQuery({ queryKey: ingestQueryKey, queryFn: () => getJSON("/api/settings/ingest") }); const [confirming, setConfirming] = useState(false); const [issued, setIssued] = useState(null); const rotate = useMutation({ mutationFn: async () => { - const response = await authorizedFetch("/api/settings/ingest/rotate-token", { method: "POST" }); + // A failure between the write and the response leaves the old token dead + // and the new one unrecoverable, so this case gets its own instruction + // rather than the browser's "Failed to fetch". + const response = await authorizedFetch("/api/settings/ingest/rotate-token", { method: "POST" }) + .catch(() => { throw new Error("Fanout could not be reached. A token may still have been issued — reload this page before trying again."); }); if (!response.ok) throw new Error("Fanout could not issue a new token. Try again."); // The plaintext comes back once, under the same key the setup response // uses; the rest of the payload is the refreshed settings. @@ -69,13 +90,30 @@ export default function Settings() { onSuccess: (data) => { setConfirming(false); setIssued(data.ingest_token ?? null); + // The page has just changed the fact it is describing. Writing the + // refreshed settings back — without the plaintext, which belongs in no + // cache — stops the copy below still saying this workspace has no token + // and offering to issue one, which would destroy the token just issued. + queryClient.setQueryData(ingestQueryKey, { + token_required: data.token_required, + suggested_endpoint: data.suggested_endpoint, + tls_configured: data.tls_configured, + header_name: data.header_name, + }); }, }); - if (settings.isLoading) return
; - if (settings.isError || !settings.data) return
; + function dismissToken() { + setIssued(null); + // Drops the plaintext from the mutation cache, which otherwise holds it + // for the life of the tab. + rotate.reset(); + } + + if (settings.isLoading) return ; + if (settings.isError || !settings.data) return void settings.refetch()} />; - const { suggested_endpoint: endpoint, header_name: header, tls_configured: tls, token_required: hasToken } = settings.data; + const { suggested_endpoint: endpoint, header_name: header, tls_configured: tlsConfigured, token_required: hasToken } = settings.data; const canRotate = viewer.role === "admin"; const authorization = `${header}: Bearer `; @@ -88,7 +126,7 @@ export default function Settings() { - + @@ -96,13 +134,13 @@ export default function Settings() { Collector configuration - Paste this into your collector and set FANOUT_INGEST_TOKEN in its environment. + Merge these blocks into your collector configuration, alongside the receivers it already has, and set FANOUT_INGEST_TOKEN in its environment. - {collectorConfig(endpoint, header, tls)} + {collectorConfig(endpoint, header, tlsConfigured)} - + {({ copied, copy }) => } @@ -126,18 +164,18 @@ export default function Settings() { ? Your new token {`${header}: Bearer ${issued}`} - Fanout shows this once. Store it with your collector secrets, then update any collector still using the old token. + Fanout shows this once and keeps only its hash. Store it with your collector secrets before closing this, then update any collector still using the old token. Lose it and the only way back is another rotation. {({ copied, copy }) => } - + : canRotate ? {hasToken ? "Rotate when a token may have been exposed." : "No token issued yet."} - @@ -145,7 +183,7 @@ export default function Settings() { - Ingest documentation covers SDK setup, batching and the OTLP/HTTP endpoint. + Sending telemetry covers SDK setup, the collector, and the OTLP/HTTP endpoint. @@ -153,12 +191,12 @@ export default function Settings() { {hasToken - ? "The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it." + ? "The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it. Fanout shows the new token once and stores only its hash." : "Fanout will show the new token once, and store only its hash."} {rotate.isError && }>{rotate.error instanceof Error ? rotate.error.message : "Fanout could not issue a new token."}} - + @@ -168,6 +206,18 @@ export default function Settings() { ; } -function Center({ label }: { label: string }) { - return {label}; +function Loading() { + return Loading connection details…; +} + +/* A failed load is not a slow one: a spinner here reads as still working. */ +function Unavailable({ onRetry }: { onRetry: () => void }) { + return + } maw={420}> + + Fanout could not load this workspace's connection details. + + + + ; } diff --git a/ui/links.ts b/ui/links.ts index 7e4210945..93dce88bc 100644 --- a/ui/links.ts +++ b/ui/links.ts @@ -1,13 +1,14 @@ /* Outbound destinations, in one place because they are the only URLs the - * product hard-codes and the documentation site is not served from this - * repository. Change them here. + * product hard-codes. The pages live in this repository under site/, published + * to https://fanout.run by Cloudflare Pages, and Starlight serves that content + * collection from the site root — so the paths carry no /docs prefix. * * There is deliberately no link to the source repository or the vendor site in * the application. Both sat in the account menu — where someone goes to act on * their own account — and neither answers a question an operator has while * using the product. They belong on the marketing site. */ export const docs = { - home: "https://fanout.run/docs", + home: "https://fanout.run/", /** Sending telemetry: endpoint, authentication, collector and SDK setup. */ - ingest: "https://fanout.run/docs/ingest", + ingest: "https://fanout.run/start/send-telemetry", } as const; From 164022d5df212bfc344de2e8f7449ff22a55f9fa Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Mon, 7 Sep 2026 08:17:53 -0700 Subject: [PATCH 3/3] fix(ui): one token name, one clock, and a page that stays loaded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second round of review findings on the connect-telemetry screen. The environment variable in the generated block was FANOUT_INGEST_TOKEN while the documentation and the README both say INGEST_TOKEN. Following the docs and then pasting this block gave the collector an empty bearer and a 401. One name now: INGEST_TOKEN. The documentation's own collector block has the opposite problem — the otlp exporter uses TLS by default and the snippet never says so, which fails against any instance that is not behind a TLS terminator. It says so now, and points at this screen for a block with the reader's own endpoint in it. An endpoint on port 443 is treated as TLS. An operator pointing at a terminating proxy usually writes the port and not the scheme, and the page was handing them tls.insecure against a TLS port — a gRPC error that explains nothing. The plaintext token really does leave the tab now. Resetting the mutation dropped its observer but left the result in the mutation cache for another five minutes, reachable from the devtools in one step; gcTime zero takes it with the reset. A test asserts the cache no longer contains it, and fails without that option. A rotation cancels an in-flight settings load before it writes. A GET that was already on its way resolves after the POST and can write the pre-rotation answer over the refreshed one — the failure this page was just fixed for. The documentation link went to the marketing page rather than where an operator starts reading. A failed background refetch no longer replaces a page that has already loaded with a full-screen alert. Claude-Session: https://claude.ai/code/session_017ovmTezqzvxVP8P9MGDQNk --- ...js => dashboards._dashboardId-BS6OaA2t.js} | 2 +- ...gkHLEj.js => dashboards.index-C3Dkh40b.js} | 2 +- .../{index-6GqvJDXC.js => index-BLac8tJW.js} | 4 +- internal/ui/dist/assets/settings-Br2qbsAf.js | 16 ------- internal/ui/dist/assets/settings-D_2lRZJm.js | 16 +++++++ internal/ui/dist/index.html | 2 +- .../src/content/docs/start/send-telemetry.mdx | 6 +++ ui/host/src/settings.test.tsx | 19 +++++++- ui/host/src/settings.tsx | 44 ++++++++++++------- ui/links.ts | 3 +- 10 files changed, 75 insertions(+), 39 deletions(-) rename internal/ui/dist/assets/{dashboards._dashboardId-CFltSAMM.js => dashboards._dashboardId-BS6OaA2t.js} (90%) rename internal/ui/dist/assets/{dashboards.index-7ogkHLEj.js => dashboards.index-C3Dkh40b.js} (86%) rename internal/ui/dist/assets/{index-6GqvJDXC.js => index-BLac8tJW.js} (96%) delete mode 100644 internal/ui/dist/assets/settings-Br2qbsAf.js create mode 100644 internal/ui/dist/assets/settings-D_2lRZJm.js diff --git a/internal/ui/dist/assets/dashboards._dashboardId-CFltSAMM.js b/internal/ui/dist/assets/dashboards._dashboardId-BS6OaA2t.js similarity index 90% rename from internal/ui/dist/assets/dashboards._dashboardId-CFltSAMM.js rename to internal/ui/dist/assets/dashboards._dashboardId-BS6OaA2t.js index f87aceac7..fd56079f3 100644 --- a/internal/ui/dist/assets/dashboards._dashboardId-CFltSAMM.js +++ b/internal/ui/dist/assets/dashboards._dashboardId-BS6OaA2t.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-6GqvJDXC.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-BLac8tJW.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-7ogkHLEj.js b/internal/ui/dist/assets/dashboards.index-C3Dkh40b.js similarity index 86% rename from internal/ui/dist/assets/dashboards.index-7ogkHLEj.js rename to internal/ui/dist/assets/dashboards.index-C3Dkh40b.js index 0f0236e42..59f51a403 100644 --- a/internal/ui/dist/assets/dashboards.index-7ogkHLEj.js +++ b/internal/ui/dist/assets/dashboards.index-C3Dkh40b.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-6GqvJDXC.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-7dM548yK.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-BLac8tJW.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-6GqvJDXC.js b/internal/ui/dist/assets/index-BLac8tJW.js similarity index 96% rename from internal/ui/dist/assets/index-6GqvJDXC.js rename to internal/ui/dist/assets/index-BLac8tJW.js index d0e24001d..6d53112bd 100644 --- a/internal/ui/dist/assets/index-6GqvJDXC.js +++ b/internal/ui/dist/assets/index-BLac8tJW.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D1xQhcK4.js","assets/brand-MzZ03bSa.js","assets/auth-BeUORN-q.js","assets/settings-Br2qbsAf.js","assets/Tooltip-BJiO7C_G.js","assets/api-Be5Lq4YA.js","assets/WarningCircle.es-DDq2AFnK.js","assets/chat.index-DvqxaiRx.js","assets/chat-DuN0TFYv.js","assets/preload-helper-BL3qEkUh.js","assets/copy-Bzg2uCpz.js","assets/chat._threadId-DvqxaiRx.js","assets/dashboards.index-7ogkHLEj.js","assets/dashboard-7dM548yK.js","assets/tokens-CvbGYJRX.js","assets/use-computed-color-scheme-6JIsge00.js","assets/dashboards._dashboardId-CFltSAMM.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D1xQhcK4.js","assets/brand-MzZ03bSa.js","assets/auth-BeUORN-q.js","assets/settings-D_2lRZJm.js","assets/Tooltip-BJiO7C_G.js","assets/api-Be5Lq4YA.js","assets/WarningCircle.es-DDq2AFnK.js","assets/chat.index-DvqxaiRx.js","assets/chat-DuN0TFYv.js","assets/preload-helper-BL3qEkUh.js","assets/copy-Bzg2uCpz.js","assets/chat._threadId-DvqxaiRx.js","assets/dashboards.index-C3Dkh40b.js","assets/dashboard-7dM548yK.js","assets/tokens-CvbGYJRX.js","assets/use-computed-color-scheme-6JIsge00.js","assets/dashboards._dashboardId-BS6OaA2t.js"])))=>i.map(i=>d[i]); import{B as e,C as t,F as n,G as r,H as i,I as a,J as o,K as s,L as c,M as l,N as u,O as d,P as f,S as p,St as m,V as h,W as g,X as _,Y as v,_ as y,_t as b,a as x,at as ee,b as te,ct as ne,d as re,dt as S,et as ie,f as ae,ft as oe,gt as se,h as ce,ht as le,j as ue,k as de,l as C,mt as fe,nt as pe,pt as me,rt as he,s as ge,st as _e,t as ve,u as ye,ut as be,x as xe,yt as Se}from"./brand-MzZ03bSa.js";import{a as Ce,d as we,f as Te,g as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./auth-BeUORN-q.js";import{$ as Pe,A as Fe,B as Ie,C as Le,F as Re,G as ze,H as Be,I as Ve,J as He,K as Ue,L as We,M as Ge,N as Ke,O as qe,P as Je,Q as Ye,R as Xe,S as Ze,U as Qe,V as $e,W as et,X as tt,Y as nt,Z as rt,a as it,at,b as ot,ct as st,d as ct,dt as lt,et as ut,ft as dt,g as ft,h as pt,i as mt,it as ht,j as gt,k as _t,l as vt,lt as yt,n as bt,nt as xt,o as St,ot as Ct,q as wt,r as Tt,rt as Et,s as Dt,st as Ot,t as kt,tt as At,u as jt,ut as Mt,v as Nt,w as Pt,x as Ft,y as It,z as Lt}from"./tokens-CvbGYJRX.js";import{C as Rt,b as zt,o as Bt,t as Vt,w as Ht}from"./Tooltip-BJiO7C_G.js";import{n as Ut,t as Wt}from"./use-computed-color-scheme-6JIsge00.js";import{A as Gt,C as Kt,D as qt,E as Jt,F as Yt,H as Xt,I as Zt,L as Qt,M as $t,N as en,O as tn,P as nn,R as rn,S as an,_ as on,a as sn,b as cn,c as ln,d as un,f as dn,g as fn,h as pn,i as mn,j as hn,k as gn,l as _n,m as vn,n as yn,o as bn,p as xn,r as Sn,t as Cn,u as wn,v as Tn,x as En,y as Dn}from"./api-Be5Lq4YA.js";import{a as On,i as kn,n as An,o as jn,r as Mn,t as Nn}from"./preload-helper-BL3qEkUh.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Pn=b((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,re=-1;function S(){return g?!0:!(e.unstable_now()-ret&&S());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=S,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Fn=b(((e,t)=>{t.exports=Pn()})),In=b((e=>{var t=Fn(),n=se(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){e.memoizedState!==null&&ve(Se,e);var t=ye.current,n=ef(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sp._currentValue=pe)}var De,Oe;function ke(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1)`:-1=0}function jf(e){for(var t=[`topLevel`],n=0,r,i,a,o=function(e){return t.push(e)},s=function(e){return t[t.length-1]=e},c=function(e){r??(r=n,i=t.length,a=e)},l=function(e){e===a&&(r=void 0,i=void 0,a=void 0)},u=function(){return t.pop()},d=function(){return n--},f=function(e){if(`0`<=e&&e<=`9`){o(`number`);return}switch(e){case`"`:o(`string`);return;case`-`:o(`numberNeedsDigit`);return;case`t`:o(`true`);return;case`f`:o(`false`);return;case`n`:o(`null`);return;case`[`:o(`arrayNeedsValue`);return;case`{`:o(`objectNeedsKey`);return}},p=e.length;n`9`)&&(d(),u());break;case`numberNeedsDigit`:s(`number`);break;case`numberNeedsExponent`:s(m===`+`||m===`-`?`numberNeedsDigit`:`number`);break;case`true`:case`false`:case`null`:(m<`a`||m>`z`)&&(d(),u());break;case`arrayNeedsValue`:m===`]`?u():Af(m)||(l(`collectionItem`),s(`arrayNeedsComma`),f(m));break;case`arrayNeedsComma`:m===`]`?u():m===`,`&&(c(`collectionItem`),s(`arrayNeedsValue`));break;case`objectNeedsKey`:m===`}`?u():m===`"`&&(c(`collectionItem`),s(`objectNeedsColon`),o(`string`));break;case`objectNeedsColon`:m===`:`&&s(`objectNeedsValue`);break;case`objectNeedsValue`:Af(m)||(l(`collectionItem`),s(`objectNeedsComma`),f(m));break;case`objectNeedsComma`:m===`}`?u():m===`,`&&(c(`collectionItem`),s(`objectNeedsKey`))}}i!=null&&(t.length=i);for(var h=[r==null?e:e.slice(0,r)],g=function(t){return h.push(t.slice(e.length-e.lastIndexOf(t[0])))},_=t.length-1;_>=0;_--)switch(t[_]){case`string`:h.push(`"`);break;case`numberNeedsDigit`:case`numberNeedsExponent`:h.push(`0`);break;case`true`:g(`true`);break;case`false`:g(`false`);break;case`null`:g(`null`);break;case`arrayNeedsValue`:case`arrayNeedsComma`:h.push(`]`);break;case`objectNeedsKey`:case`objectNeedsColon`:case`objectNeedsValue`:case`objectNeedsComma`:h.push(`}`)}return h.join(``)}function Mf(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let a=e[t++];if(n|=(a&127)<>4,!(i&128)){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(r|=(a&127)<=Nf&&(i+=r/Nf|0,r%=Nf)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?zf(r,i):Rf(r,i)}function Ff(e,t){let n=Rf(e,t),r=n.hi&2147483648;r&&(n=zf(n.lo,n.hi));let i=If(n.lo,n.hi);return r?`-`+i:i}function If(e,t){if({lo:e,hi:t}=Lf(e,t),t<=2097151)return String(Nf*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+Bf(o)+Bf(a)}function Lf(e,t){return{lo:e>>>0,hi:t>>>0}}function Rf(e,t){return{lo:e|0,hi:t|0}}function zf(e,t){return t=~t,e?e=~e+1:t+=1,Rf(e,t)}var Bf=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function Vf(){let e=this.buf[this.pos++];if(!(e&128))return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}var Hf=Uf();function Uf(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||globalThis.Bun||typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||ri||ta.call(e)),qf(i)}return Kf}function Yf(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var Xf;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(Xf||={});var U=class{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?Yf(e):Jf().encodeUtf8Into,this.buffer=$f,this.viewCache=ep,this.pos=0}ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||Zf;for(;e0&&n.set(this.buffer),this.buffer=n}}view(){let e=this.buffer,t=this.viewCache;if(t.byteLength===e.byteLength)return t;let n=new DataView(e.buffer);return this.viewCache=n,n}finish(){let e=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],e}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Qf),this.buffer[this.pos++]=0,this}join(){let e=this.stackPos.pop();if(e===void 0)throw Error(`invalid state, fork stack empty`);let t=this.pos-e-Qf,n=np(t);return n>Qf&&(this.ensureCapacity(n-Qf),this.buffer.copyWithin(e+n,e+Qf,this.pos)),this.pos=e,this.uint32(t),this.pos+=t,this}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.ensureCapacity(e.length),this.buffer.set(e,this.pos),this.pos+=e.length,this}uint32(e){if(ip(e),this.ensureCapacity(5),e<128)return this.buffer[this.pos++]=e,this;for(;e>127;)this.buffer[this.pos++]=e&127|128,e>>>=7;return this.buffer[this.pos++]=e,this}int32(e){if(rp(e),e>=0)return this.uint32(e);this.ensureCapacity(10);for(let t=0;t<9;t++)this.buffer[this.pos++]=e&127|128,e>>=7;return this.buffer[this.pos++]=1,this}bool(e){return this.ensureCapacity(1),this.buffer[this.pos++]=+!!e,this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){typeof e!=`string`&&(e=String(e));let t=e.length;if(t<=tp){this.ensureCapacity(t+1);let n=this.buffer,r=this.pos;n[r++]=t;let i=0;for(;i127)break;n[r++]=t}if(i==t)return this.pos=r,this}this.ensureCapacity(t*3+5);let n=np(t),r=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(e,r.subarray(i+n)),o=np(a);return o!=n&&r.copyWithin(i+o,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(e){return ap(e),this.ensureCapacity(4),this.view().setFloat32(this.pos,e,!0),this.pos+=4,this}double(e){return this.ensureCapacity(8),this.view().setFloat64(this.pos,e,!0),this.pos+=8,this}fixed32(e){return ip(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return rp(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return rp(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=Hf.enc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}fixed64(e){let t=Hf.uEnc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}int64(e){let t=Hf.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=Hf.enc(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return this.writeVarint64(r,i)}uint64(e){let t=Hf.uEnc(e);return this.writeVarint64(t.lo,t.hi)}writeVarint64(e,t){this.ensureCapacity(10);let n=this.buffer,r=this.pos;for(let i=0;i<28;i+=7){let a=e>>>i,o=!(!(a>>>7)&&t==0);if(n[r++]=(o?a|128:a)&255,!o)return this.pos=r,this}let i=e>>>28&15|(t&7)<<4,a=!!(t>>3);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this;for(let e=3;e<31;e+=7){let i=t>>>e,a=!!(i>>>7);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this}return n[r++]=t>>>31&1,this.pos=r,this}},Zf=128,Qf=1,$f=new Uint8Array,ep=new DataView($f.buffer),tp=32;function np(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var W=class{constructor(e,t=Jf().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=Mf,this.uint32=Vf,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.pos,t=this.uint32(),n=this.pos-e;if(n>5||n==5&&this.buf[this.pos-1]>15)throw Error(`illegal tag: varint overflows uint32`);let r=t>>>3,i=t&7;if(r<=0||i>5)throw Error(`illegal tag: field no `+r+` wire type `+i);return[r,i]}skip(e,t,n=100){let r=this.pos;switch(e){case Xf.Varint:for(;this.buf[this.pos++]&128;);break;case Xf.Bit64:this.pos+=4;case Xf.Bit32:this.pos+=4;break;case Xf.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Xf.StartGroup:if(n<=0)throw Error(`maximum recursion depth reached`);for(;;){let[e,r]=this.tag();if(r===Xf.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(r,e,n-1)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return this.varint64(),Hf.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Hf.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let e=this.varint64Lo,t=this.varint64Hi,n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,Hf.dec(e,t)}bool(){let e=this.buf[this.pos];return e<128?(this.pos++,e!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Hf.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Hf.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(e){let t=this.bytes(),n=t.length;if(n<=tp){let r=Array(n);for(let i=0;i127)return this.decodeUtf8(t,e);r[i]=n}return String.fromCharCode.apply(String,r)}return this.decodeUtf8(t,e)}};function rp(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid int32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int32: `+e)}function ip(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid uint32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint32: `+e)}function ap(e){if(typeof e==`string`){let t=e;if(e=Number(e),Number.isNaN(e)&&t!==`NaN`)throw Error(`invalid float32: `+t)}else if(typeof e!=`number`)throw Error(`invalid float32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float32: `+e)}var op=function(e){return e[e.NULL_VALUE=0]=`NULL_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function sp(){return{fields:{}}}var cp={encode(e,t=new U){return Object.entries(e.fields).forEach(([e,n])=>{n!==void 0&&up.encode({key:e,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=sp();for(;n.pos>>3){case 1:{if(e!==10)break;let t=up.decode(n,n.uint32());t.value!==void 0&&(i.fields[t.key]=t.value);continue}}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cp.fromPartial(e??{})},fromPartial(e){let t=sp();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(n!==void 0&&(e[t]=n),e),{}),t},wrap(e){let t=sp();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function lp(){return{key:``,value:void 0}}var up={encode(e,t=new U){return e.key!==``&&t.uint32(10).string(e.key),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=lp();for(;n.pos>>3){case 1:if(e!==10)break;i.key=n.string();continue;case 2:if(e!==18)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return up.fromPartial(e??{})},fromPartial(e){let t=lp();return t.key=e.key??``,t.value=e.value??void 0,t}};function dp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var G={encode(e,t=new U){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&cp.encode(cp.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&pp.encode(pp.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=dp();for(;n.pos>>3){case 1:if(e!==8)break;i.nullValue=n.int32();continue;case 2:if(e!==17)break;i.numberValue=n.double();continue;case 3:if(e!==26)break;i.stringValue=n.string();continue;case 4:if(e!==32)break;i.boolValue=n.bool();continue;case 5:if(e!==42)break;i.structValue=cp.unwrap(cp.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.listValue=pp.unwrap(pp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=dp();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=dp();if(e===null)t.nullValue=op.NULL_VALUE;else if(typeof e==`boolean`)t.boolValue=e;else if(typeof e==`number`)t.numberValue=e;else if(typeof e==`string`)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e==`object`)t.structValue=e;else if(e!==void 0)throw new globalThis.Error(`Unsupported any value type: `+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function fp(){return{values:[]}}var pp={encode(e,t=new U){for(let n of e.values)G.encode(G.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=fp();for(;n.pos>>3){case 1:if(e!==10)break;i.values.push(G.unwrap(G.decode(n,n.uint32())));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return pp.fromPartial(e??{})},fromPartial(e){let t=fp();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=fp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty(`values`)&&globalThis.Array.isArray(e.values)?e.values:e}},mp=function(e){return e[e.ADD=0]=`ADD`,e[e.REMOVE=1]=`REMOVE`,e[e.REPLACE=2]=`REPLACE`,e[e.MOVE=3]=`MOVE`,e[e.COPY=4]=`COPY`,e[e.TEST=5]=`TEST`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function hp(){return{op:0,path:``,from:void 0,value:void 0}}var gp={encode(e,t=new U){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==``&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=hp();for(;n.pos>>3){case 1:if(e!==8)break;i.op=n.int32();continue;case 2:if(e!==18)break;i.path=n.string();continue;case 3:if(e!==26)break;i.from=n.string();continue;case 4:if(e!==34)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gp.fromPartial(e??{})},fromPartial(e){let t=hp();return t.op=e.op??0,t.path=e.path??``,t.from=e.from??void 0,t.value=e.value??void 0,t}};function _p(){return{id:``,type:``,function:void 0,metadata:void 0}}var vp={encode(e,t=new U){return e.id!==``&&t.uint32(10).string(e.id),e.type!==``&&t.uint32(18).string(e.type),e.function!==void 0&&bp.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=_p();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.type=n.string();continue;case 3:if(e!==26)break;i.function=bp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vp.fromPartial(e??{})},fromPartial(e){let t=_p();return t.id=e.id??``,t.type=e.type??``,t.function=e.function!==void 0&&e.function!==null?bp.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function yp(){return{name:``,arguments:``}}var bp={encode(e,t=new U){return e.name!==``&&t.uint32(10).string(e.name),e.arguments!==``&&t.uint32(18).string(e.arguments),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=yp();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.arguments=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bp.fromPartial(e??{})},fromPartial(e){let t=yp();return t.name=e.name??``,t.arguments=e.arguments??``,t}};function xp(){return{value:``,mimeType:``}}var Sp={encode(e,t=new U){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==``&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=xp();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sp.fromPartial(e??{})},fromPartial(e){let t=xp();return t.value=e.value??``,t.mimeType=e.mimeType??``,t}};function Cp(){return{value:``,mimeType:void 0}}var wp={encode(e,t=new U){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Cp();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wp.fromPartial(e??{})},fromPartial(e){let t=Cp();return t.value=e.value??``,t.mimeType=e.mimeType??void 0,t}};function Tp(){return{data:void 0,url:void 0}}var Ep={encode(e,t=new U){return e.data!==void 0&&Sp.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&wp.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Tp();for(;n.pos>>3){case 1:if(e!==10)break;i.data=Sp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.url=wp.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ep.fromPartial(e??{})},fromPartial(e){let t=Tp();return t.data=e.data!==void 0&&e.data!==null?Sp.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?wp.fromPartial(e.url):void 0,t}};function Dp(){return{text:``}}var Op={encode(e,t=new U){return e.text!==``&&t.uint32(10).string(e.text),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Dp();for(;n.pos>>3){case 1:if(e!==10)break;i.text=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Op.fromPartial(e??{})},fromPartial(e){let t=Dp();return t.text=e.text??``,t}};function kp(){return{source:void 0,metadata:void 0}}var Ap={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=kp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ap.fromPartial(e??{})},fromPartial(e){let t=kp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function jp(){return{source:void 0,metadata:void 0}}var Mp={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=jp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Mp.fromPartial(e??{})},fromPartial(e){let t=jp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Np(){return{source:void 0,metadata:void 0}}var Pp={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Np();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Pp.fromPartial(e??{})},fromPartial(e){let t=Np();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Fp(){return{source:void 0,metadata:void 0}}var Ip={encode(e,t=new U){return e.source!==void 0&&Ep.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Fp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Ep.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ip.fromPartial(e??{})},fromPartial(e){let t=Fp();return t.source=e.source!==void 0&&e.source!==null?Ep.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Lp(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Rp={encode(e,t=new U){return e.text!==void 0&&Op.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Ap.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Mp.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Pp.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Ip.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Lp();for(;n.pos>>3){case 1:if(e!==10)break;i.text=Op.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.image=Ap.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.audio=Mp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.video=Pp.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.document=Ip.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Rp.fromPartial(e??{})},fromPartial(e){let t=Lp();return t.text=e.text!==void 0&&e.text!==null?Op.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Ap.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Mp.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Pp.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Ip.fromPartial(e.document):void 0,t}};function zp(){return{id:``,role:``,content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Bp={encode(e,t=new U){e.id!==``&&t.uint32(10).string(e.id),e.role!==``&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let n of e.toolCalls)vp.encode(n,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let n of e.contentParts)Rp.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=zp();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.role=n.string();continue;case 3:if(e!==26)break;i.content=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.toolCalls.push(vp.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.toolCallId=n.string();continue;case 7:if(e!==58)break;i.error=n.string();continue;case 8:if(e!==66)break;i.contentParts.push(Rp.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Bp.fromPartial(e??{})},fromPartial(e){let t=zp();return t.id=e.id??``,t.role=e.role??``,t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(e=>vp.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>Rp.fromPartial(e))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Vp(){return{id:``,reason:``,message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Hp={encode(e,t=new U){return e.id!==``&&t.uint32(10).string(e.id),e.reason!==``&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&G.encode(G.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Vp();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.reason=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.responseSchema=G.unwrap(G.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.expiresAt=n.string();continue;case 7:if(e!==58)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Hp.fromPartial(e??{})},fromPartial(e){let t=Vp();return t.id=e.id??``,t.reason=e.reason??``,t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},Up=function(e){return e[e.TEXT_MESSAGE_START=0]=`TEXT_MESSAGE_START`,e[e.TEXT_MESSAGE_CONTENT=1]=`TEXT_MESSAGE_CONTENT`,e[e.TEXT_MESSAGE_END=2]=`TEXT_MESSAGE_END`,e[e.TOOL_CALL_START=3]=`TOOL_CALL_START`,e[e.TOOL_CALL_ARGS=4]=`TOOL_CALL_ARGS`,e[e.TOOL_CALL_END=5]=`TOOL_CALL_END`,e[e.STATE_SNAPSHOT=6]=`STATE_SNAPSHOT`,e[e.STATE_DELTA=7]=`STATE_DELTA`,e[e.MESSAGES_SNAPSHOT=8]=`MESSAGES_SNAPSHOT`,e[e.RAW=9]=`RAW`,e[e.CUSTOM=10]=`CUSTOM`,e[e.RUN_STARTED=11]=`RUN_STARTED`,e[e.RUN_FINISHED=12]=`RUN_FINISHED`,e[e.RUN_ERROR=13]=`RUN_ERROR`,e[e.STEP_STARTED=14]=`STEP_STARTED`,e[e.STEP_FINISHED=15]=`STEP_FINISHED`,e[e.SUBAGENT_STARTED=16]=`SUBAGENT_STARTED`,e[e.SUBAGENT_FINISHED=17]=`SUBAGENT_FINISHED`,e[e.SUBAGENT_ERROR=18]=`SUBAGENT_ERROR`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function Wp(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var K={encode(e,t=new U){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&G.encode(G.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&cp.encode(cp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Wp();for(;n.pos>>3){case 1:if(e!==8)break;i.type=n.int32();continue;case 2:if(e!==16)break;i.timestamp=Lm(n.int64());continue;case 3:if(e!==26)break;i.rawEvent=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=cp.unwrap(cp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return K.fromPartial(e??{})},fromPartial(e){let t=Wp();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function Gp(){return{baseEvent:void 0,messageId:``,role:void 0,name:void 0,subagentRunId:void 0}}var Kp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Gp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Kp.fromPartial(e??{})},fromPartial(e){let t=Gp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function qp(){return{baseEvent:void 0,messageId:``,delta:``,subagentRunId:void 0}}var Jp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=qp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Jp.fromPartial(e??{})},fromPartial(e){let t=qp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Yp(){return{baseEvent:void 0,messageId:``,subagentRunId:void 0}}var Xp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Yp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Xp.fromPartial(e??{})},fromPartial(e){let t=Yp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Zp(){return{baseEvent:void 0,toolCallId:``,toolCallName:``,parentMessageId:void 0,subagentRunId:void 0}}var Qp={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.toolCallName!==``&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Zp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Qp.fromPartial(e??{})},fromPartial(e){let t=Zp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.toolCallName=e.toolCallName??``,t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function $p(){return{baseEvent:void 0,toolCallId:``,delta:``,subagentRunId:void 0}}var em={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=$p();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return em.fromPartial(e??{})},fromPartial(e){let t=$p();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function tm(){return{baseEvent:void 0,toolCallId:``,subagentRunId:void 0}}var nm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=tm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return nm.fromPartial(e??{})},fromPartial(e){let t=tm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function rm(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var im={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&G.encode(G.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=rm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.snapshot=G.unwrap(G.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return im.fromPartial(e??{})},fromPartial(e){let t=rm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function am(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var om={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)gp.encode(n,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=am();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.delta.push(gp.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return om.fromPartial(e??{})},fromPartial(e){let t=am();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>gp.fromPartial(e))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function sm(){return{baseEvent:void 0,messages:[]}}var cm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)Bp.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=sm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messages.push(Bp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cm.fromPartial(e??{})},fromPartial(e){let t=sm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>Bp.fromPartial(e))||[],t}};function lm(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var um={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&G.encode(G.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=lm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.event=G.unwrap(G.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.source=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return um.fromPartial(e??{})},fromPartial(e){let t=lm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function dm(){return{baseEvent:void 0,name:``,value:void 0,subagentRunId:void 0}}var fm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==``&&t.uint32(18).string(e.name),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=dm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.name=n.string();continue;case 3:if(e!==26)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return fm.fromPartial(e??{})},fromPartial(e){let t=dm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.name=e.name??``,t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function pm(){return{baseEvent:void 0,threadId:``,runId:``}}var mm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=pm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mm.fromPartial(e??{})},fromPartial(e){let t=pm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t}};function hm(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var gm={encode(e,t=new U){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=hm();for(;n.pos>>3){case 1:if(e!==10)break;i.provider=n.string();continue;case 2:if(e!==18)break;i.model=n.string();continue;case 3:if(e!==24)break;i.inputTokens=Lm(n.int64());continue;case 4:if(e!==32)break;i.outputTokens=Lm(n.int64());continue;case 5:if(e!==40)break;i.totalTokens=Lm(n.int64());continue;case 6:if(e!==48)break;i.reasoningTokens=Lm(n.int64());continue;case 7:if(e!==56)break;i.cachedInputTokens=Lm(n.int64());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gm.fromPartial(e??{})},fromPartial(e){let t=hm();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function _m(){return{baseEvent:void 0,threadId:``,runId:``,result:void 0,outcome:``,interrupts:[],usage:[]}}var vm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.result!==void 0&&G.encode(G.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==``&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)Hp.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)gm.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=_m();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.result=G.unwrap(G.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.outcome=n.string();continue;case 6:if(e!==50)break;i.interrupts.push(Hp.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.usage.push(gm.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vm.fromPartial(e??{})},fromPartial(e){let t=_m();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interrupts=e.interrupts?.map(e=>Hp.fromPartial(e))||[],t.usage=e.usage?.map(e=>gm.fromPartial(e))||[],t}};function ym(){return{baseEvent:void 0,code:void 0,message:``,usage:[]}}var bm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==``&&t.uint32(26).string(e.message);for(let n of e.usage)gm.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=ym();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.code=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.usage.push(gm.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bm.fromPartial(e??{})},fromPartial(e){let t=ym();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??``,t.usage=e.usage?.map(e=>gm.fromPartial(e))||[],t}};function xm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Sm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=xm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sm.fromPartial(e??{})},fromPartial(e){let t=xm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Cm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var wm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Cm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wm.fromPartial(e??{})},fromPartial(e){let t=Cm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Tm(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Em={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Tm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue;case 5:if(e!==42)break;i.name=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Em.fromPartial(e??{})},fromPartial(e){let t=Tm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Dm(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Om={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Dm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.delta=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Om.fromPartial(e??{})},fromPartial(e){let t=Dm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function km(){return{baseEvent:void 0,subagentRunId:``,name:``,description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Am={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.name!==``&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=km();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.name=n.string();continue;case 4:if(e!==34)break;i.description=n.string();continue;case 5:if(e!==42)break;i.parentSubagentRunId=n.string();continue;case 6:if(e!==50)break;i.parentToolCallId=n.string();continue;case 7:if(e!==58)break;i.parentMessageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Am.fromPartial(e??{})},fromPartial(e){let t=km();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.name=e.name??``,t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function jm(){return{baseEvent:void 0,subagentRunId:``,result:void 0,outcome:``,interruptIds:[]}}var Mm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&G.encode(G.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==``&&t.uint32(34).string(e.outcome);for(let n of e.interruptIds)t.uint32(42).string(n);return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=jm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.result=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.outcome=n.string();continue;case 5:if(e!==42)break;i.interruptIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Mm.fromPartial(e??{})},fromPartial(e){let t=jm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interruptIds=e.interruptIds?.map(e=>e)||[],t}};function Nm(){return{baseEvent:void 0,subagentRunId:``,message:``,code:void 0}}var Pm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.message!==``&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Nm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.code=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Pm.fromPartial(e??{})},fromPartial(e){let t=Nm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.message=e.message??``,t.code=e.code??void 0,t}};function Fm(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var Im={encode(e,t=new U){return e.textMessageStart!==void 0&&Kp.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Jp.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Xp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Qp.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&em.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&nm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&im.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&om.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&cm.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&um.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&fm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&mm.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&vm.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&bm.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Sm.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&wm.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Em.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Om.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Am.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Mm.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Pm.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Fm();for(;n.pos>>3){case 1:if(e!==10)break;i.textMessageStart=Kp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.textMessageContent=Jp.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.textMessageEnd=Xp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.toolCallStart=Qp.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.toolCallArgs=em.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.toolCallEnd=nm.decode(n,n.uint32());continue;case 7:if(e!==58)break;i.stateSnapshot=im.decode(n,n.uint32());continue;case 8:if(e!==66)break;i.stateDelta=om.decode(n,n.uint32());continue;case 9:if(e!==74)break;i.messagesSnapshot=cm.decode(n,n.uint32());continue;case 10:if(e!==82)break;i.raw=um.decode(n,n.uint32());continue;case 11:if(e!==90)break;i.custom=fm.decode(n,n.uint32());continue;case 12:if(e!==98)break;i.runStarted=mm.decode(n,n.uint32());continue;case 13:if(e!==106)break;i.runFinished=vm.decode(n,n.uint32());continue;case 14:if(e!==114)break;i.runError=bm.decode(n,n.uint32());continue;case 15:if(e!==122)break;i.stepStarted=Sm.decode(n,n.uint32());continue;case 16:if(e!==130)break;i.stepFinished=wm.decode(n,n.uint32());continue;case 17:if(e!==138)break;i.textMessageChunk=Em.decode(n,n.uint32());continue;case 18:if(e!==146)break;i.toolCallChunk=Om.decode(n,n.uint32());continue;case 19:if(e!==154)break;i.subagentStarted=Am.decode(n,n.uint32());continue;case 20:if(e!==162)break;i.subagentFinished=Mm.decode(n,n.uint32());continue;case 21:if(e!==170)break;i.subagentError=Pm.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Im.fromPartial(e??{})},fromPartial(e){let t=Fm();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Kp.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Jp.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Xp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Qp.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?em.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?nm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?im.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?om.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?cm.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?um.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?fm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?mm.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?vm.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?bm.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Sm.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?wm.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Em.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Om.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Am.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Mm.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Pm.fromPartial(e.subagentError):void 0,t}};function Lm(e){let t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error(`Value is larger than Number.MAX_SAFE_INTEGER`);if(te&&typeof e==`object`?e:void 0,zm=e=>{let t=Rm(e);if(t){if(t.data){let e=t.data;return{type:`data`,value:e.value,mimeType:e.mimeType}}if(t.url){let e=t.url;return{type:`url`,value:e.value,mimeType:e.mimeType}}}},Bm=e=>{let t=Rm(e);if(t){if(t.text)return{type:`text`,text:t.text.text};if(t.image){let e=t.image;return{type:`image`,source:zm(e.source),metadata:e.metadata}}if(t.audio){let e=t.audio;return{type:`audio`,source:zm(e.source),metadata:e.metadata}}if(t.video){let e=t.video;return{type:`video`,source:zm(e.source),metadata:e.metadata}}if(t.document){let e=t.document;return{type:`document`,source:zm(e.source),metadata:e.metadata}}}};function Vm(e){let t=Im.decode(e),n=Object.values(t).find(e=>e!==void 0);if(!n)throw Error(`Invalid event`);if(n.type=Up[n.baseEvent.type],n.timestamp=n.baseEvent.timestamp,n.rawEvent=n.baseEvent.rawEvent,n.baseEvent.metadata!==void 0&&(n.metadata=n.baseEvent.metadata),delete n.baseEvent,n.type===z.MESSAGES_SNAPSHOT)for(let e of n.messages){let t=e;if(t.role===`user`&&Array.isArray(t.contentParts)){let e=t.contentParts.map(e=>Bm(e)).filter(e=>e!==void 0);e.length>0&&(t.content=e)}Array.isArray(t.contentParts)&&t.contentParts.length===0&&(t.contentParts=void 0),t.toolCalls?.length===0&&(t.toolCalls=void 0)}if(n.type===z.RUN_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interrupts)?e.interrupts:[];delete e.interrupts,t===`interrupt`?e.outcome={type:`interrupt`,interrupts:r}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if(n.type===z.SUBAGENT_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interruptIds)?e.interruptIds:[];delete e.interruptIds,t===`suspended`?e.outcome={type:`suspended`,...r.length>0&&{interruptIds:r}}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if((n.type===z.RUN_FINISHED||n.type===z.RUN_ERROR)&&Array.isArray(n.usage)&&n.usage.length===0&&delete n.usage,n.type===z.STATE_DELTA)for(let e of n.delta)e.op=mp[e.op].toLowerCase(),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]});return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),Zl.parse(n)}var Hm;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Hm||={});var Um;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Um||={});var q=Hm.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Wm=e=>{switch(typeof e){case`undefined`:return q.undefined;case`string`:return q.string;case`number`:return Number.isNaN(e)?q.nan:q.number;case`boolean`:return q.boolean;case`function`:return q.function;case`bigint`:return q.bigint;case`symbol`:return q.symbol;case`object`:return Array.isArray(e)?q.array:e===null?q.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?q.promise:typeof Map<`u`&&e instanceof Map?q.map:typeof Set<`u`&&e instanceof Set?q.set:typeof Date<`u`&&e instanceof Date?q.date:q.object;default:return q.unknown}},J=Hm.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Gm=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Gm.create=e=>new Gm(e);var Km=(e,t)=>{let n;switch(e.code){case J.invalid_type:n=e.received===q.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case J.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Hm.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:n=`Unrecognized key(s) in object: ${Hm.joinValues(e.keys,`, `)}`;break;case J.invalid_union:n=`Invalid input`;break;case J.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Hm.joinValues(e.options)}`;break;case J.invalid_enum_value:n=`Invalid enum value. Expected ${Hm.joinValues(e.options)}, received '${e.received}'`;break;case J.invalid_arguments:n=`Invalid function arguments`;break;case J.invalid_return_type:n=`Invalid function return type`;break;case J.invalid_date:n=`Invalid date`;break;case J.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Hm.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case J.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case J.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case J.custom:n=`Invalid input`;break;case J.invalid_intersection_types:n=`Intersection results could not be merged`;break;case J.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case J.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Hm.assertNever(e)}return{message:n}},qm=Km;function Jm(){return qm}var Ym=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Y(e,t){let n=Jm(),r=Ym({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Km?void 0:Km].filter(e=>!!e)});e.common.issues.push(r)}var Xm=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return X;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return X;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},X=Object.freeze({status:`aborted`}),Zm=e=>({status:`dirty`,value:e}),Qm=e=>({status:`valid`,value:e}),$m=e=>e.status===`aborted`,eh=e=>e.status===`dirty`,th=e=>e.status===`valid`,nh=e=>typeof Promise<`u`&&e instanceof Promise,Z;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(Z||={});var rh=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ih=(e,t)=>{if(th(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Gm(e.common.issues);return this._error=t,this._error}}};function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var ah=class{get description(){return this._def.description}_getType(e){return Wm(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Wm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Xm,ctx:{common:e.parent.common,data:e.data,parsedType:Wm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nh(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)};return ih(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return th(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>th(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wm(e)},r=this._parse({data:e,path:n.path,parent:n});return ih(n,await(nh(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:J.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new cg({schema:this,typeName:$.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return lg.create(this,this._def)}nullable(){return ug.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Uh.create(this)}promise(){return sg.create(this,this._def)}or(e){return Kh.create([this,e],this._def)}and(e){return Xh.create(this,e,this._def)}transform(e){return new cg({...Q(this._def),schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new dg({...Q(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new mg({typeName:$.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new fg({...Q(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hg.create(this,e)}readonly(){return gg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},oh=/^c[^\s-]{8,}$/i,sh=/^[0-9a-z]+$/,ch=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lh=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,uh=/^[a-z0-9_-]{21}$/i,dh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fh=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ph=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mh=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,hh,gh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_h=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,vh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,yh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sh=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,Ch=RegExp(`^${Sh}$`);function wh(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Th(e){return RegExp(`^${wh(e)}$`)}function Eh(e){let t=`${Sh}T${wh(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Dh(e,t){return!((t!==`v4`&&t||!gh.test(e))&&(t!==`v6`&&t||!vh.test(e)))}function Oh(e,t){if(!dh.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function kh(e,t){return!((t!==`v4`&&t||!_h.test(e))&&(t!==`v6`&&t||!yh.test(e)))}var Ah=class e extends ah{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.string,received:t.parsedType}),X}let t=new Xm,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:J.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...Z.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...Z.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...Z.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...Z.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...Z.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...Z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ah({checks:[],typeName:$.ZodString,coerce:e?.coerce??!1,...Q(e)});function jh(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Mh=class e extends ah{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==q.number){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.number,received:t.parsedType}),X}let t,n=new Xm;for(let r of this._def.checks)r.kind===`int`?Hm.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?jh(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_finite,message:r.message}),n.dirty()):Hm.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:Z.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Z.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Z.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&Hm.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew Mh({checks:[],typeName:$.ZodNumber,coerce:e?.coerce||!1,...Q(e)});var Nh=class e extends ah{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==q.bigint)return this._getInvalidInput(e);let t,n=new Xm;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Hm.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.bigint,received:t.parsedType}),X}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Nh({checks:[],typeName:$.ZodBigInt,coerce:e?.coerce??!1,...Q(e)});var Ph=class extends ah{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.boolean,received:t.parsedType}),X}return Qm(e.data)}};Ph.create=e=>new Ph({typeName:$.ZodBoolean,coerce:e?.coerce||!1,...Q(e)});var Fh=class e extends ah{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.date,received:t.parsedType}),X}if(Number.isNaN(e.data.getTime()))return Y(this._getOrReturnCtx(e),{code:J.invalid_date}),X;let t=new Xm,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Hm.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Fh({checks:[],coerce:e?.coerce||!1,typeName:$.ZodDate,...Q(e)});var Ih=class extends ah{_parse(e){if(this._getType(e)!==q.symbol){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.symbol,received:t.parsedType}),X}return Qm(e.data)}};Ih.create=e=>new Ih({typeName:$.ZodSymbol,...Q(e)});var Lh=class extends ah{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.undefined,received:t.parsedType}),X}return Qm(e.data)}};Lh.create=e=>new Lh({typeName:$.ZodUndefined,...Q(e)});var Rh=class extends ah{_parse(e){if(this._getType(e)!==q.null){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.null,received:t.parsedType}),X}return Qm(e.data)}};Rh.create=e=>new Rh({typeName:$.ZodNull,...Q(e)});var zh=class extends ah{constructor(){super(...arguments),this._any=!0}_parse(e){return Qm(e.data)}};zh.create=e=>new zh({typeName:$.ZodAny,...Q(e)});var Bh=class extends ah{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Qm(e.data)}};Bh.create=e=>new Bh({typeName:$.ZodUnknown,...Q(e)});var Vh=class extends ah{_parse(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.never,received:t.parsedType}),X}};Vh.create=e=>new Vh({typeName:$.ZodNever,...Q(e)});var Hh=class extends ah{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.void,received:t.parsedType}),X}return Qm(e.data)}};Hh.create=e=>new Hh({typeName:$.ZodVoid,...Q(e)});var Uh=class e extends ah{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==q.array)return Y(t,{code:J.invalid_type,expected:q.array,received:t.parsedType}),X;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(Y(t,{code:J.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new rh(t,e,t.path,n)))).then(e=>Xm.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new rh(t,e,t.path,n)));return Xm.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Z.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Z.toString(n)}})}nonempty(e){return this.min(1,e)}};Uh.create=(e,t)=>new Uh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...Q(t)});function Wh(e){if(e instanceof Gh){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=lg.create(Wh(r))}return new Gh({...e._def,shape:()=>t})}return e instanceof Uh?new Uh({...e._def,type:Wh(e.element)}):e instanceof lg?lg.create(Wh(e.unwrap())):e instanceof ug?ug.create(Wh(e.unwrap())):e instanceof Zh?Zh.create(e.items.map(e=>Wh(e))):e}var Gh=class e extends ah{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Hm.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Vh&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new rh(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Vh){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Y(n,{code:J.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new rh(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Xm.mergeObjectSync(t,e)):Xm.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:Z.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of Hm.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of Hm.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Wh(this)}partial(t){let n={};for(let e of Hm.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of Hm.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof lg;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return ig(Hm.objectKeys(this.shape))}};Gh.create=(e,t)=>new Gh({shape:()=>e,unknownKeys:`strip`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)}),Gh.strictCreate=(e,t)=>new Gh({shape:()=>e,unknownKeys:`strict`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)}),Gh.lazycreate=(e,t)=>new Gh({shape:e,unknownKeys:`strip`,catchall:Vh.create(),typeName:$.ZodObject,...Q(t)});var Kh=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Gm(e.ctx.common.issues));return Y(t,{code:J.invalid_union,unionErrors:n}),X}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Gm(e));return Y(t,{code:J.invalid_union,unionErrors:i}),X}}get options(){return this._def.options}};Kh.create=(e,t)=>new Kh({options:e,typeName:$.ZodUnion,...Q(t)});var qh=e=>e instanceof ng?qh(e.schema):e instanceof cg?qh(e.innerType()):e instanceof rg?[e.value]:e instanceof ag?e.options:e instanceof og?Hm.objectValues(e.enum):e instanceof dg?qh(e._def.innerType):e instanceof Lh?[void 0]:e instanceof Rh?[null]:e instanceof lg?[void 0,...qh(e.unwrap())]:e instanceof ug?[null,...qh(e.unwrap())]:e instanceof mg||e instanceof gg?qh(e.unwrap()):e instanceof fg?qh(e._def.innerType):[],Jh=class e extends ah{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Y(t,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=qh(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Q(r)})}};function Yh(e,t){let n=Wm(e),r=Wm(t);if(e===t)return{valid:!0,data:e};if(n===q.object&&r===q.object){let n=Hm.objectKeys(t),r=Hm.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Yh(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===q.array&&r===q.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if($m(e)||$m(r))return X;let i=Yh(e.value,r.value);return i.valid?((eh(e)||eh(r))&&t.dirty(),{status:t.value,value:i.data}):(Y(n,{code:J.invalid_intersection_types}),X)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Xh.create=(e,t,n)=>new Xh({left:e,right:t,typeName:$.ZodIntersection,...Q(n)});var Zh=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.array)return Y(n,{code:J.invalid_type,expected:q.array,received:n.parsedType}),X;if(n.data.lengththis._def.items.length&&(Y(n,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new rh(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Xm.mergeArray(t,e)):Xm.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Zh.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Zh({items:e,typeName:$.ZodTuple,rest:null,...Q(t)})};var Qh=class e extends ah{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return Y(n,{code:J.invalid_type,expected:q.object,received:n.parsedType}),X;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new rh(n,e,n.path,e)),value:a._parse(new rh(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Xm.mergeObjectAsync(t,r):Xm.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ah?new e({keyType:t,valueType:n,typeName:$.ZodRecord,...Q(r)}):new e({keyType:Ah.create(),valueType:t,typeName:$.ZodRecord,...Q(n)})}},$h=class extends ah{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.map)return Y(n,{code:J.invalid_type,expected:q.map,received:n.parsedType}),X;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new rh(n,e,n.path,[a,`key`])),value:i._parse(new rh(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};$h.create=(e,t,n)=>new $h({valueType:t,keyType:e,typeName:$.ZodMap,...Q(n)});var eg=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.set)return Y(n,{code:J.invalid_type,expected:q.set,received:n.parsedType}),X;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(Y(n,{code:J.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return X;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new rh(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Z.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};eg.create=(e,t)=>new eg({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet,...Q(t)});var tg=class e extends ah{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return Y(t,{code:J.invalid_type,expected:q.function,received:t.parsedType}),X;function n(e,n){return Ym({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jm(),Km].filter(e=>!!e),issueData:{code:J.invalid_arguments,argumentsError:n}})}function r(e,n){return Ym({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jm(),Km].filter(e=>!!e),issueData:{code:J.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof sg){let e=this;return Qm(async function(...t){let o=new Gm([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return Qm(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Gm([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Gm([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Zh.create(t).rest(Bh.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Zh.create([]).rest(Bh.create()),returns:n||Bh.create(),typeName:$.ZodFunction,...Q(r)})}},ng=class extends ah{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ng.create=(e,t)=>new ng({getter:e,typeName:$.ZodLazy,...Q(t)});var rg=class extends ah{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:J.invalid_literal,expected:this._def.value}),X}return{status:`valid`,value:e.data}}get value(){return this._def.value}};rg.create=(e,t)=>new rg({value:e,typeName:$.ZodLiteral,...Q(t)});function ig(e,t){return new ag({values:e,typeName:$.ZodEnum,...Q(t)})}var ag=class e extends ah{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:Hm.joinValues(n),received:t.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{received:t.data,code:J.invalid_enum_value,options:n}),X}return Qm(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};ag.create=ig;var og=class extends ah{_parse(e){let t=Hm.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){let e=Hm.objectValues(t);return Y(n,{expected:Hm.joinValues(e),received:n.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(Hm.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=Hm.objectValues(t);return Y(n,{received:n.data,code:J.invalid_enum_value,options:e}),X}return Qm(e.data)}get enum(){return this._def.values}};og.create=(e,t)=>new og({values:e,typeName:$.ZodNativeEnum,...Q(t)});var sg=class extends ah{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==q.promise&&t.common.async===!1?(Y(t,{code:J.invalid_type,expected:q.promise,received:t.parsedType}),X):Qm((t.parsedType===q.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};sg.create=(e,t)=>new sg({type:e,typeName:$.ZodPromise,...Q(t)});var cg=class extends ah{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Y(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return X;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Zm(r.value):r});{if(t.value===`aborted`)return X;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Zm(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?X:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?X:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!th(e))return X;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>th(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):X)}Hm.assertNever(r)}};cg.create=(e,t,n)=>new cg({schema:e,typeName:$.ZodEffects,effect:t,...Q(n)}),cg.createWithPreprocess=(e,t,n)=>new cg({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects,...Q(n)});var lg=class extends ah{_parse(e){return this._getType(e)===q.undefined?Qm(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lg.create=(e,t)=>new lg({innerType:e,typeName:$.ZodOptional,...Q(t)});var ug=class extends ah{_parse(e){return this._getType(e)===q.null?Qm(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ug.create=(e,t)=>new ug({innerType:e,typeName:$.ZodNullable,...Q(t)});var dg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};dg.create=(e,t)=>new dg({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Q(t)});var fg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return nh(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Gm(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Gm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fg.create=(e,t)=>new fg({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Q(t)});var pg=class extends ah{_parse(e){if(this._getType(e)!==q.nan){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.nan,received:t.parsedType}),X}return{status:`valid`,value:e.data}}};pg.create=e=>new pg({typeName:$.ZodNaN,...Q(e)});var mg=class extends ah{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},hg=class e extends ah{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),Zm(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},gg=class extends ah{_parse(e){let t=this._def.innerType._parse(e),n=e=>(th(e)&&(e.value=Object.freeze(e.value)),e);return nh(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};gg.create=(e,t)=>new gg({innerType:e,typeName:$.ZodReadonly,...Q(t)}),Gh.lazycreate;var $;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})($||={});var _g=Ah.create;Mh.create,pg.create,Nh.create;var vg=Ph.create;Fh.create,Ih.create,Lh.create,Rh.create;var yg=zh.create;Bh.create,Vh.create,Hh.create,Uh.create;var bg=Gh.create;Gh.strictCreate,Kh.create;var xg=Jh.create;Xh.create,Zh.create,Qh.create,$h.create,eg.create,tg.create,ng.create;var Sg=rg.create,Cg=ag.create;og.create,sg.create,cg.create,lg.create,ug.create,cg.createWithPreprocess,hg.create;var wg=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Tg=e=>{if(typeof e!=`string`)throw TypeError(`Invalid argument expected string`);let t=e.match(wg);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Eg=e=>e===`*`||e===`x`||e===`X`,Dg=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},Og=(e,t)=>typeof e==typeof t?[e,t]:[String(e),String(t)],kg=(e,t)=>{if(Eg(e)||Eg(t))return 0;let[n,r]=Og(Dg(e),Dg(t));return n>r?1:n{for(let n=0;n{let n=Tg(e),r=Tg(t),i=n.pop(),a=r.pop(),o=Ag(n,r);return o===0?i&&a?Ag(i.split(`.`),a.split(`.`)):i||a?i?-1:1:0:o},Mg=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Ng(){return Go()}function Pg(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&Pg(t);return e}var Fg=524288;function Ig(e,t,n){let r=0,i=[e,t],a=new WeakSet;for(;i.length>0;){let e=i.pop();if(typeof e==`string`){if(r+=e.length,r>n)return!0}else if(typeof e==`object`&&e){if(a.has(e))continue;if(a.add(e),Array.isArray(e))for(let t=0;tn)return!0;i.push(e[o])}}}}return!1}async function Lg(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!Ig(t,n,Fg),c=s?Mg(t):t,l=s?Mg(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(Pg(c),Pg(l));let e=await r(t,c,l);if(e===void 0)continue;let n=!1;if(e.messages!==void 0&&e.messages!==c&&(c=Mg(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=Mg(e.state),d=!0,n=!0),s&&n&&Ig(c,l,Fg)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(o&&e instanceof TypeError){if(a)throw e;console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e)}else a||console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?Mg(c):c}:{},...d?{state:Object.isFrozen(l)?Mg(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function Rg(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function zg(e){if(e instanceof Bg)return e;if(e===!0)return new Bg(Rg(!0))}var Bg=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n==`string`?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function Vg(e){return e.enabled?new Bg(e):void 0}function Hg(e,t,n){if(t){let r=e.find(e=>e.id===t);if(r?.role===`assistant`)return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant — falling back to toolCallId`);let i={id:r?n:t,role:`assistant`,toolCalls:[]};return e.push(i),i}let r={id:n,role:`assistant`,toolCalls:[]};return e.push(r),r}function Ug(e,t){return!e||t.metadata===void 0?!1:(e.metadata=Mc(e.metadata,Mg(t.metadata)),!0)}var Wg=(e,t,n,r,i)=>{let a=zg(i),o=Mg(n.messages),s=Mg(e.state),c={},l=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},u=()=>{let e=Mg(c);return c={},e.messages!==void 0||e.state!==void 0?mf(e):Pd};return t.pipe(wf(async t=>{let i=await Lg(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(l(i),i.stopPropagation===!0?a?.event(`APPLY`,`Event dropped:`,t,{type:t.type,reason:`stopPropagation by subscriber`}):a?.event(`APPLY`,`Event applied:`,t,{type:t.type,subscribers:r.length}),i.stopPropagation===!0)return u();switch(t.type){case z.TEXT_MESSAGE_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:e,role:n=`assistant`,name:r,subagentRunId:i}=t,a=o.find(t=>t.id===e);if(a?.role===`activity`)return console.warn(`TEXT_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and text messages`),u();let s=a;if(!s){let t={id:e,role:n,content:``,...r!==void 0&&{name:r},...i!=null&&{subagentRunId:i}};o.push(t),s=t}let c=Ug(s,t);(!a||c)&&l({messages:o})}return u()}case z.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),u();if(c.role===`activity`)return console.warn(`TEXT_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),u();let d=await Lg(r,o,s,(r,i,a)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,textMessageBuffer:typeof c.content==`string`?c.content:``}));return l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Ug(c,t),l({messages:o})),u()}case z.TEXT_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),u();if(a.role===`activity`)return console.warn(`TEXT_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),u();let c=await Lg(r,o,s,(r,i,o)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,textMessageBuffer:typeof a.content==`string`?a.content:``}));return l(c),c.stopPropagation!==!0&&Ug(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case z.TOOL_CALL_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t,a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(Ug(a,t)||r)&&l({messages:o}),u()}let s=new Set(o.map(e=>e.id)),c=Hg(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let d={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(d),Ug(d,t),l({messages:o})}return u()}case z.TOOL_CALL_ARGS:{let{toolCallId:i,delta:a}=t,c=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!c)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),u();let d=c.toolCalls?.find(e=>e.id===i);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),u();let f=await Lg(r,o,s,(r,i,a)=>{let o=d.function.arguments,s=d.function.name,c={};try{c=jf(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return l(f),f.stopPropagation!==!0&&(d.function.arguments+=a,Ug(d,t),l({messages:o})),u()}case z.TOOL_CALL_END:{let{toolCallId:i}=t,a=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!a)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),u();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),u();let d=await Lg(r,o,s,(r,i,a)=>{let o=c.function.arguments,s=c.function.name,l={};try{l=JSON.parse(o)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallName:s,toolCallArgs:l})});return l(d),d.stopPropagation!==!0&&Ug(c,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),u()}case z.TOOL_CALL_RESULT:{let i=await Lg(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:u,subagentRunId:d}=t,f={id:i,toolCallId:a,role:u||`tool`,content:c,...d!=null&&{subagentRunId:d}};Ug(f,t);let p=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(p===-1)o.push(f);else{let e=p+1;for(;e{t.onNewMessage?.({message:f,messages:o,state:s,agent:n,input:e})})),l({messages:o})}return u()}case z.STATE_SNAPSHOT:{let i=await Lg(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,l({state:s})}return u()}case z.STATE_DELTA:{let i=await Lg(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Nu.applyPatch(s,e,!0,!1).newDocument,l({state:s})}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Failed to apply state patch:\nCurrent state: ${JSON.stringify(s,null,2)}\nPatch operations: ${JSON.stringify(e,null,2)}\nError: ${n}`)}}return u()}case z.MESSAGES_SNAPSHOT:{let i=await Lg(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=n.some(e=>e.role===`activity`),a=n.some(e=>e.role===`reasoning`),s=e=>e.role===`activity`&&!i||e.role===`reasoning`&&!a;o=o.filter(e=>s(e)||r.has(e.id)).map(e=>s(e)?e:r.get(e.id));let c=new Set(o.map(e=>e.id));for(let e of n)c.has(e.id)||o.push(e);l({messages:o})}return u()}case z.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,d=c?.role===`activity`?c:void 0,f=i.replace??!0,p=await Lg(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d,existingMessage:c}));if(l(p),p.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:Mg(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,u;a===-1?(o.push(t),c=t,u=t):d?(f&&(o[a]={...d,activityType:i.activityType,content:Mg(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),u=o[a]):f&&(o[a]=t,c=t,u=t),Ug(u,i),l({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return u()}case z.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return u();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),u();let d=c,f=await Lg(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d}));if(l(f),f.stopPropagation!==!0)try{Ug(d,i)&&l({messages:o});let e=Mg(d.content??{}),t=Nu.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...d,content:Mg(t),activityType:i.activityType},l({messages:o})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`Failed to apply activity patch for '${i.messageId}': ${t}`)}return u()}case z.RAW:return l(await Lg(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.CUSTOM:return l(await Lg(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.RUN_STARTED:{let i=await Lg(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}l({messages:o})}}return u()}case z.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:{event:i,outcome:`success`,result:i.result},c=await Lg(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return l(c),c.stopPropagation!==!0&&(n.pendingInterrupts=a.outcome===`interrupt`?a.interrupts.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}):[]),u()}case z.RUN_ERROR:return l(await Lg(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.STEP_STARTED:return l(await Lg(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.STEP_FINISHED:return l(await Lg(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case z.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case z.THINKING_START:return u();case z.THINKING_END:return u();case z.THINKING_TEXT_MESSAGE_START:return u();case z.THINKING_TEXT_MESSAGE_CONTENT:return u();case z.THINKING_TEXT_MESSAGE_END:return u();case z.REASONING_START:return l(await Lg(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.REASONING_MESSAGE_START:{let i=await Lg(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e),i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=Ug(i,t);(!r||a)&&l({messages:o})}return u()}case z.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),u();let d=await Lg(r,o,s,(r,i,a)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,reasoningMessageBuffer:typeof c.content==`string`?c.content:``}));return l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Ug(c,t),l({messages:o})),u()}case z.REASONING_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),u();let c=await Lg(r,o,s,(r,i,o)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,reasoningMessageBuffer:typeof a.content==`string`?a.content:``}));return l(c),c.stopPropagation!==!0&&Ug(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case z.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case z.REASONING_END:return l(await Lg(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:d}=t,f=await Lg(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(f),f.stopPropagation!==!0){let e=!1;if(i===`tool-call`){for(let t of o)if(t.role===`assistant`&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===a);if(n){n.encryptedValue=d,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=d,e=!0)}e&&(c.messages=o)}return u()}case z.SUBAGENT_STARTED:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.SUBAGENT_FINISHED:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case z.SUBAGENT_ERROR:return l(await Lg(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u()}return t.type,u()}),bf(),r.length>0?Tf({}):e=>e)},Gg=e=>t=>{let n=zg(e),r=new Set,i=new Set,a=new Set,o={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,c=!1,l=!1,u=new Map,d=e=>{let t=u.get(e);return t||(t=new Map,u.set(e,t)),t},f=()=>{for(let e of u.values())if(e.size>0)return!0;return!1},p=new Map,m=new Set,h=!1,g=!1,_=!1,v=()=>{r.clear(),i.clear(),a.clear(),o.message.clear(),o.toolCall.clear(),o.activity.clear(),o.reasoning.clear(),u.clear(),p.clear(),m.clear(),h=!1,g=!1,s=!1,c=!1,_=!0},y=(e,t)=>{let n=e??[];if(Array.isArray(n))for(let e of n){if(!e||typeof e.id!=`string`)continue;if(e.subagentRunId===null)return new R(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?o.reasoning:e.role===`activity`?o.activity:o.message;(t||!n.has(e.id))&&n.set(e.id,{subagentRunId:e.subagentRunId});for(let n of e.toolCalls??[])n&&typeof n.id==`string`&&(t||!o.toolCall.has(n.id))&&o.toolCall.set(n.id,{subagentRunId:e.subagentRunId??void 0})}},b=(e,t,n,r,i)=>{if(t!==void 0&&n&&n.subagentRunId!==t)return new R(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(yf(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),c&&t!==z.RUN_STARTED)return H(()=>new R(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&t!==z.RUN_ERROR&&t!==z.RUN_STARTED)return H(()=>new R(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!l){if(l=!0,t!==z.RUN_STARTED&&t!==z.RUN_ERROR)return H(()=>new R(`First event must be 'RUN_STARTED'`))}else if(t===z.RUN_STARTED){if(_&&!s&&!c)return H(()=>new R(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(s||c)&&v()}if(e.subagentRunId===null)return H(()=>new R(`Cannot send '${t}' with 'subagentRunId: null'. The field is optional — omit it entirely.`));if(t===z.SUBAGENT_STARTED||t===z.SUBAGENT_FINISHED||t===z.SUBAGENT_ERROR){let n=t===z.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===z.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return H(()=>new R(`Cannot send '${t}' with '${r}: null'. The field is optional — omit it entirely.`));let r=e.outcome;if(r!=null&&r.type!==`success`&&r.type!==`suspended`)return H(()=>new R(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return H(()=>new R(`Cannot send '${t}' with 'outcome.interruptIds: null'. The field is optional — omit it entirely.`));if(r&&Array.isArray(r.interruptIds)&&r.interruptIds.some(e=>typeof e!=`string`))return H(()=>new R(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===z.RUN_FINISHED){let t=e.outcome;if(t?.type===`interrupt`&&Array.isArray(t.interrupts)){for(let e of t.interrupts)if(e&&e.subagentRunId===null)return H(()=>new R(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case z.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${n}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let i=o.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return H(()=>r)}return r.add(n),i||o.message.set(n,{subagentRunId:e.subagentRunId}),mf(e)}case z.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${n}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let i=b(t,e.subagentRunId,o.message.get(n),`message`,n);return i?H(()=>i):mf(e)}case z.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return H(()=>new R(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${n}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let i=b(t,e.subagentRunId,o.message.get(n),`message`,n);return i?H(()=>i):(r.delete(n),mf(e))}case z.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${n}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let r=e.parentMessageId,a=e.subagentRunId,s;if(r!==void 0){let e=o.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return H(()=>new R(`Cannot send 'TOOL_CALL_START': subagentRunId '${a}' does not match its parent message '${r}' owner '${e.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`));s=e}}let c=o.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return H(()=>e);if(a===void 0&&s&&s.subagentRunId!==c.subagentRunId)return H(()=>new R(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${s.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||o.toolCall.set(n,a===void 0?s??{subagentRunId:void 0}:{subagentRunId:a}),mf(e)}case z.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${n}'. Start a tool call with 'TOOL_CALL_START' first.`));let r=b(t,e.subagentRunId,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):mf(e)}case z.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return H(()=>new R(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${n}'. A 'TOOL_CALL_START' event must be sent first.`));let r=b(t,e.subagentRunId,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):(i.delete(n),mf(e))}case z.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return d(n).has(t)?H(()=>new R(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(d(n).set(t,!0),mf(e))}case z.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!d(n).has(t)){let e,r=!1;for(let[i,a]of u)if(i!==n&&a.has(t)){e=i,r=!0;break}return H(r?()=>new R(`Cannot send 'STEP_FINISHED' for step "${t}" attributed to ${n===void 0?`the parent agent`:`subagent '${n}'`}: that step is open under ${e===void 0?`the parent agent`:`subagent '${e}'`}. A step must be finished by whoever started it.`):()=>new R(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return d(n).delete(t),mf(e)}case z.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!o.activity.has(t)||e.replace!==!1)&&o.activity.set(t,{subagentRunId:e.subagentRunId}),mf(e)}case z.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&o.message.set(t,{subagentRunId:e.subagentRunId}),mf(e)}case z.REASONING_START:case z.REASONING_MESSAGE_START:{let n=e.messageId,r=o.reasoning.get(n);if(r){let i=b(t,e.subagentRunId,r,`reasoning message`,n);if(i)return H(()=>i)}return a.add(n),r||o.reasoning.set(n,{subagentRunId:e.subagentRunId}),mf(e)}case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:{let n=e.messageId,r=b(t,e.subagentRunId,o.reasoning.get(n),`reasoning message`,n);return r?H(()=>r):(t===z.REASONING_END&&a.delete(n),mf(e))}case z.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?o.toolCall.get(n):r===`message`?o.message.get(n)??o.reasoning.get(n):o.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,s=b(t,e.subagentRunId,i,a,n);return s?H(()=>s):mf(e)}case z.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,o.activity.get(n),`activity`,n);return r?H(()=>r):mf(e)}case z.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return p.has(t)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):m.has(t)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!p.has(n)&&!m.has(n)?H(()=>new R(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(p.set(t,!0),mf(e))}case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return H(()=>new R(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===z.SUBAGENT_ERROR&&typeof e.message!=`string`)return H(()=>new R(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return p.has(n)?(p.delete(n),m.add(n),mf(e)):H(()=>new R(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case z.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return H(()=>t)}return mf(e);case z.RUN_STARTED:_=!0;{let t=y((e.input??{}).messages,!1);if(t)return H(()=>t)}return mf(e);case z.RUN_FINISHED:if(f()){let e=[];for(let[t,n]of u)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(p.size>0){let e=Array.from(p.keys()).join(`, `);return H(()=>new R(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return s=!0,mf(e);case z.RUN_ERROR:return c=!0,mf(e);case z.CUSTOM:return mf(e);case z.THINKING_TEXT_MESSAGE_START:return h?g?H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.`)):(g=!0,mf(e)):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first.`));case z.THINKING_TEXT_MESSAGE_CONTENT:return g?mf(e):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first.`));case z.THINKING_TEXT_MESSAGE_END:return g?(g=!1,mf(e)):H(()=>new R(`Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first.`));case z.THINKING_START:return h?H(()=>new R(`Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.`)):(h=!0,mf(e));case z.THINKING_END:return h?(h=!1,mf(e)):H(()=>new R(`Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first.`));default:return mf(e)}}))},Kg=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),qg=e=>xf(()=>pf(e())).pipe(Df(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return pf(e.text()).pipe(yf(n=>{let r=n;if(t.includes(`application/json`))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${typeof r==`string`?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,H(()=>i)}))}let t={type:Kg.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Sd(e=>(e.next(t),(async()=>{try{for(;;){let{done:t,value:r}=await n.read();if(t)break;let i={type:Kg.DATA,data:r};e.next(i)}e.complete()}catch(t){e.error(t)}})(),()=>{n.cancel().catch(e=>{if(e?.name!==`AbortError`)throw e})})):H(()=>Error(`Failed to getReader() from response`))})),Jg=(e,t)=>{let n=zg(t),r=new V,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==Kg.HEADERS&&e.type===Kg.DATA&&e.data){let t=i.decode(e.data,{stream:!0});a+=t;let n=a.split(/\n\n/);a=n.pop()||``;for(let e of n)o(e)}},error:e=>r.error(e),complete:()=>{a&&(a+=i.decode(),o(a)),r.complete()}});function o(e){let t=e.split(` `),i=[];for(let e of t)e.startsWith(`data:`)&&i.push(e.slice(5).replace(/^ /,``));if(i.length>0)try{let e=i.join(` `),t=JSON.parse(e);n?.event(`SSE`,`Event received:`,t,{type:t.type}),r.next(t)}catch(e){r.error(e)}}return r.asObservable()},Yg=e=>{let t=new V,n=new Uint8Array;e.subscribe({next:e=>{if(e.type!==Kg.HEADERS&&e.type===Kg.DATA&&e.data){let t=new Uint8Array(n.length+e.data.length);t.set(n,0),t.set(e.data,n.length),n=t,r()}},error:e=>t.error(e),complete:()=>{if(n.length>0)try{r()}catch{console.warn(`Incomplete or invalid protocol buffer data at stream end`)}t.complete()}});function r(){for(;n.length>=4;){let e=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length{let n=zg(t),r=new V,i=new Nd,a=!1;return e.subscribe({next:e=>{if(i.next(e),e.type===Kg.HEADERS&&!a){a=!0;let t=e.headers.get(`content-type`);n?.lifecycle(`HTTP`,`Stream format detected:`,{contentType:t,parser:t===`application/vnd.ag-ui.event+proto`?`protobuf`:`sse`}),t===`application/vnd.ag-ui.event+proto`?Yg(i).subscribe({next:e=>r.next(e),error:e=>r.error(e),complete:()=>r.complete()}):Jg(i,n).subscribe({next:e=>{try{let t=Zl.parse(e);n?.event(`HTTP`,`Event validated:`,t,{type:t.type,valid:!0}),r.next(t)}catch(t){n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),r.error(t)}},error:e=>{if(e?.name===`AbortError`){r.next({type:z.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),r.complete();return}return r.error(e)},complete:()=>r.complete()})}else a||r.error(Error(`No headers event received before data events`))},error:e=>{i.error(e),r.error(e)},complete:()=>{i.complete()}}),r.asObservable()},Zg=Cg([`TextMessageStart`,`TextMessageContent`,`TextMessageEnd`,`ActionExecutionStart`,`ActionExecutionArgs`,`ActionExecutionEnd`,`ActionExecutionResult`,`AgentStateMessage`,`MetaEvent`,`RunStarted`,`RunFinished`,`RunError`,`NodeStarted`,`NodeFinished`]),Qg=Cg([`LangGraphInterruptEvent`,`PredictState`,`Exit`]);xg(`type`,[bg({type:Sg(Zg.enum.TextMessageStart),messageId:_g(),parentMessageId:_g().optional(),role:_g().optional()}),bg({type:Sg(Zg.enum.TextMessageContent),messageId:_g(),content:_g()}),bg({type:Sg(Zg.enum.TextMessageEnd),messageId:_g()}),bg({type:Sg(Zg.enum.ActionExecutionStart),actionExecutionId:_g(),actionName:_g(),parentMessageId:_g().optional()}),bg({type:Sg(Zg.enum.ActionExecutionArgs),actionExecutionId:_g(),args:_g()}),bg({type:Sg(Zg.enum.ActionExecutionEnd),actionExecutionId:_g()}),bg({type:Sg(Zg.enum.ActionExecutionResult),actionName:_g(),actionExecutionId:_g(),result:_g()}),bg({type:Sg(Zg.enum.AgentStateMessage),threadId:_g(),agentName:_g(),nodeName:_g(),runId:_g(),active:vg(),role:_g(),state:_g(),running:vg()}),bg({type:Sg(Zg.enum.MetaEvent),name:Qg,value:yg()}),bg({type:Sg(Zg.enum.RunError),message:_g(),code:_g().optional()})]),bg({id:_g(),role:_g(),content:_g(),parentMessageId:_g().optional()}),bg({id:_g(),name:_g(),arguments:yg(),parentMessageId:_g().optional()}),bg({id:_g(),result:yg(),actionExecutionId:_g(),actionName:_g()});var $g=e=>{if(typeof e==`string`)return e;if(!Array.isArray(e))return;let t=e.filter(e=>e.type===`text`).map(e=>e.text).filter(e=>e.length>0);if(t.length!==0)return t.join(` -`)},e_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(yf(r=>{switch(r.type){case z.TEXT_MESSAGE_START:{let e=r;return[{type:Zg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case z.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Zg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case z.TEXT_MESSAGE_END:{let e=r;return[{type:Zg.enum.TextMessageEnd,messageId:e.messageId}]}case z.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:Zg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case z.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(jf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Zg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case z.TOOL_CALL_END:{let e=r;return[{type:Zg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case z.TOOL_CALL_RESULT:{let e=r;return[{type:Zg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case z.RAW:return[];case z.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Zg.enum.MetaEvent,name:e.name,value:e.value}]}case z.STATE_SNAPSHOT:return f(r.snapshot),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case z.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case z.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case z.RUN_STARTED:return[];case z.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:t_(c)}:{}}),active:!1}];case z.RUN_ERROR:{let e=r;return[{type:Zg.enum.RunError,message:e.message,code:e.code}]}case z.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case z.STEP_FINISHED:return u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function t_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=$g(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var n_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,r_=e=>e===`tool`?`toolCallId`:`messageId`,i_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},a_=e=>t=>{let n=zg(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:z.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:z.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:z.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&n_(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${r_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(yf(e=>{switch(e.type){case z.TEXT_MESSAGE_START:case z.TEXT_MESSAGE_CONTENT:case z.TEXT_MESSAGE_END:case z.TOOL_CALL_START:case z.TOOL_CALL_ARGS:case z.TOOL_CALL_END:case z.TOOL_CALL_RESULT:case z.STATE_SNAPSHOT:case z.STATE_DELTA:case z.CUSTOM:case z.STEP_STARTED:case z.STEP_FINISHED:case z.THINKING_START:case z.THINKING_END:case z.THINKING_TEXT_MESSAGE_START:case z.THINKING_TEXT_MESSAGE_CONTENT:case z.THINKING_TEXT_MESSAGE_END:case z.REASONING_START:case z.REASONING_MESSAGE_START:case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:return[...i(e.subagentRunId??void 0),e];case z.RUN_STARTED:case z.RUN_FINISHED:case z.RUN_ERROR:case z.MESSAGES_SNAPSHOT:return[...a(),e];case z.RAW:case z.ACTIVITY_SNAPSHOT:case z.ACTIVITY_DELTA:case z.REASONING_ENCRYPTED_VALUE:case z.SUBAGENT_STARTED:return[e];case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case z.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=i_({type:z.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=i_({type:z.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=i_({type:z.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Ef(()=>{a()}))};function o_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var s_=class{runNext(e,t){return t.run(e).pipe(a_(!1))}runNextWithState(e,t){let n=Mg(e.messages||[]),r=Mg(e.state||{}),i=new Nd;return Wg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(wf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Mg(n),state:Mg(r)})))}},c_=class extends s_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function l_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var u_=class extends s_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(l_)};return this.runNext(i,t)}},d_=`THINKING_START`,f_=`THINKING_END`,p_=`THINKING_TEXT_MESSAGE_START`,m_=`THINKING_TEXT_MESSAGE_CONTENT`,h_=`THINKING_TEXT_MESSAGE_END`,g_=class extends s_{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(_f(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case d_:{this.currentReasoningId=Ng();let{title:t,...n}=e;return this.warnAboutTransformation(d_,z.REASONING_START),{...n,type:z.REASONING_START,messageId:this.currentReasoningId}}case p_:return this.currentMessageId=Ng(),this.warnAboutTransformation(p_,z.REASONING_MESSAGE_START),{...e,type:z.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case m_:{let{delta:t,...n}=e;return this.warnAboutTransformation(m_,z.REASONING_MESSAGE_CONTENT),{...n,type:z.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ng(),delta:t}}case h_:{let t=this.currentMessageId??Ng();return this.warnAboutTransformation(h_,z.REASONING_MESSAGE_END),{...e,type:z.REASONING_MESSAGE_END,messageId:t}}case f_:{let t=this.currentReasoningId??Ng();return this.warnAboutTransformation(f_,z.REASONING_END),{...e,type:z.REASONING_END,messageId:t}}default:return e}}};function __(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function v_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function y_(e){let t=__(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e}function b_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>v_(e)?y_(e):e);return{...e,content:n}}var x_=class extends s_{run(e,t){let n={...e,messages:e.messages.map(b_)};return this.runNext(n,t)}},S_=`SUBAGENT_STARTED`,C_=`SUBAGENT_FINISHED`,w_=`SUBAGENT_ERROR`;function T_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function E_(e){return e.map(e=>T_(e))}var D_=class extends s_{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>T_(e))};return this.runNext(n,t).pipe(kf(e=>{let t=e.type;(t===S_||t===C_||t===w_)&&this.warnDroppedLifecycleEvent(t)}),Sf(e=>{let t=e.type;return t!==S_&&t!==C_&&t!==w_}),_f(e=>{let t=T_(e);if(t.type===z.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:E_(e.messages)}}if(t.type===z.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>T_(e))}}}if(t.type===z.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:E_(e.input.messages)}}}return t}))}},O_=`0.0.59`,k_=class{get maxVersion(){return O_}get debug(){return this._debug}set debug(e){this._debug=Rg(e),this._debugLogger=Vg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Vg(Rg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Mg(r??[]),this.state=Mg(i??{}),this._debug=Rg(a),this._debugLogger=Vg(this._debug),jg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new u_),jg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new g_),jg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new x_),jg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new D_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new c_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ef(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)));let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>xf(()=>this.connect(n)),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.isRunning=!1,e instanceof Qc?Pd:this.onError(n,e,a))),Ef(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)),{defaultValue:void 0});let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,n){return Wg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(kf(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Mg(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Mg(e?.tools??[]),context:Mg(e?.context??[]),forwardedProps:Mg(e?.forwardedProps??{}),state:Mg(this.state),messages:n,...e?.resume===void 0?{}:{resume:Mg(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new R(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(o_(e))throw new R(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return pf(Lg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(_f(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Mg(this.messages),e.state=Mg(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Mg(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=Mg(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Mg(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(a_(this.debugLogger),Gg(this.debugLogger),e_(this.threadId,t.runId,this.agentId),e=>e.pipe(_f(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function A_(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var j_=class extends k_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(A_(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=Mg(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Xg(qg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Mg(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},M_=class extends ln{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:wn(t,n.data),hasPreviousPage:un(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},N_=class extends pn{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new bn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=P_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){xn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Dn(t,e))}findAll(e={}){return this.getAll().filter(t=>Dn(e,t))}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return xn.batch(()=>Promise.all(e.map(e=>e.continue().catch(En))))}};function P_(e){return e.options.scope?.id}var F_=class extends pn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Tn(r,t),a=this.get(i);return a||(a=new _n({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){xn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>cn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>cn(e,t)):t}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},I_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new F_,this.#t=e.mutationCache||new N_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=vn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Kt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return xn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;xn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return xn.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=xn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(En).catch(En)}invalidateQueries(e,t={}){return xn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=xn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(En)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(En)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Kt(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Kt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(En).catch(En)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(En).catch(En)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return dn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(on(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{an(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(on(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{an(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Tn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Jt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function L_(e,t){return sn(e,M_,t)}var R_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),G_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:R_}));G_.displayName=`BookOpenIcon`;var K_=G_,q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));q_.displayName=`MagnifyingGlassIcon`;var J_=q_,Y_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));Y_.displayName=`MoonIcon`;var X_=Y_,Z_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));Z_.displayName=`PencilSimpleIcon`;var Q_=Z_,$_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));$_.displayName=`PlugsConnectedIcon`;var ev=$_,tv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));tv.displayName=`SignOutIcon`;var nv=tv,rv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));rv.displayName=`SunIcon`;var iv=rv,av={home:`https://fanout.run/`,ingest:`https://fanout.run/start/send-telemetry`};async function ov(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function sv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=tn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=L_({queryKey:[...Sn,m],queryFn:({pageParam:e})=>ov(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=mn({queryKey:Cn,queryFn:()=>yn(`/api/dashboards`),refetchInterval:3e4}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>pv(ue),[ue]),fe=pt(`overview`,ft({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Sn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Sn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Ft,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Bt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(lv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Pt,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(ot,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(J_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(gn,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(gn,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function cv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function lv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:mv(e.updatedAt)})]})}),(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Ze,{size:18,weight:`bold`})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(Q_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Le.Item,{color:`bad`,leftSection:(0,T.jsx)(It,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function uv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function dv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var fv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function pv(e){let t=dv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-dv(uv(r.updatedAt)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return fv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function mv(e){let t=uv(e),n=dv(new Date);return Math.floor((n-dv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function hv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=On(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=Ve({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(kn),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Vt,{label:`Documentation`,children:(0,T.jsx)(jn,{component:`a`,href:av.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(K_,{size:17,weight:`bold`})})}),(0,T.jsx)(gv,{}),(0,T.jsx)(_v,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(sv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(sv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function gv(){let{setColorScheme:e}=Ut(),t=Wt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`;return(0,T.jsx)(Vt,{label:`Switch to ${n} theme`,children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onClick:()=>e(n),children:t===`dark`?(0,T.jsx)(iv,{size:17,weight:`bold`}):(0,T.jsx)(X_,{size:17,weight:`bold`})})})}function _v({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(ev,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Le.Divider,{}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(nv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function vv(){let{agent_available:e}=ke(),t=Ne(),n=tn(),{threadId:r}=Ve({strict:!1}),[i,a]=(0,w.useState)(Nt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(null),oe=(0,w.useRef)(0),se=(0,w.useMemo)(()=>new j_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),ce=!e||f===s;function le(){oe.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),le(),te(``),!e){p(s);return}!r||o.current.has(s)?(se.setMessages([]),p(s)):De(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}se.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=se.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{oe.current+=1,y(Mn(e.toolCallName))},onToolCallEndEvent:()=>{oe.current=Math.max(0,oe.current-1),oe.current===0&&y(``)},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})}});return()=>{t=!1,i.unsubscribe(),se.abortRun()}},[se,e,n,ne,s]),(0,w.useEffect)(()=>{ie.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[c,g]),(0,w.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ae.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ae.current?.focus()))),e.key===`Escape`&&n===ae.current&&(x(``),ae.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function ue(){_(!0),te(``);try{await se.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s)}}async function de(n){let i=n.trim();if(!e||!i||g||!ce||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Nt(),role:`user`,content:i};se.addMessage(a),l([...se.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await ue()}(0,w.useEffect)(()=>{let e=S.current;ce&&r&&e&&(S.current=``,de(e))},[ce,r,s]);function C(e){e.preventDefault(),de(b)}function fe(){se.abortRun(),_(!1),le(),o.current.delete(s)}function pe(){!g&&se.messages.some(e=>e.role===`user`)&&ue()}function me(n){if(!e)return;let r=Nt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function he(){se.abortRun(),S.current=``,a(Nt()),t({to:`/chat`})}function ge(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function _e(){re(e=>e+1)}return(0,T.jsx)(An.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ce,running:g,activity:v,input:b,setInput:x,error:ee,bottomRef:ie,inputRef:ae,send:de,submit:C,stop:fe,retry:pe,reloadThread:_e,openChat:me,newThread:he,selectThread:ge},children:(0,T.jsx)(hv,{children:(0,T.jsx)(ta,{})})})}function yv(){let e=(0,w.useMemo)(()=>new I_,[]);return(0,T.jsx)(qt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(vv,{})})})}var bv=Re({component:yv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),xv=Je(`/`)({component:Ke(()=>Nn(()=>import(`./routes-D1xQhcK4.js`),__vite__mapDeps([0,1,2])),`component`)}),Sv=Je(`/settings`)({component:Ke(()=>Nn(()=>import(`./settings-Br2qbsAf.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),Cv=Je(`/chat/`)({component:Ke(()=>Nn(()=>import(`./chat.index-DvqxaiRx.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),wv=Je(`/chat/$threadId`)({component:Ke(()=>Nn(()=>import(`./chat._threadId-DvqxaiRx.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Tv=Je(`/dashboards/`)({component:Ke(()=>Nn(()=>import(`./dashboards.index-7ogkHLEj.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Ev=Je(`/dashboards/$dashboardId`)({component:Ke(()=>Nn(()=>import(`./dashboards._dashboardId-CFltSAMM.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Dv=xv.update({id:`/`,path:`/`,getParentRoute:()=>bv}),Ov=Sv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>bv}),kv=Cv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>bv}),Av=wv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>bv}),jv=Tv.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>bv}),Mv={IndexRoute:Dv,SettingsRoute:Ov,ChatThreadIdRoute:Av,DashboardsDashboardIdRoute:Ev.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>bv}),ChatIndexRoute:kv,DashboardsIndexRoute:jv},Nv=sa({routeTree:bv._addFileChildren(Mv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Pv={brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},Fv={light:7,dark:5};function Iv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Lv(e){let t=Iv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Rv(e){return Object.fromEntries(Object.entries(Pv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Lv(n[Fv[e]])]))}function zv(e){return t=>{let n=t.color??Hv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Pv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Bv=.25,Vv={xs:9,sm:10,md:11,lg:13,xl:16},Hv={primaryColor:`brand`,primaryShade:Fv,autoContrast:!0,luminanceThreshold:Bv,colors:{dark:kt,brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},defaultRadius:`md`,fontFamily:it.body,fontFamilyMonospace:it.display,headings:{fontFamily:it.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Gv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Gv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Wv(t.size)})}}},Uv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...Rv(`light`)},dark:Rv(`dark`)});function Wv(e){let t=Vv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Gv(e,t){return!e||e===Hv.primaryColor?{[t]:`var(--fanout-color-${Hv.primaryColor}-contrast)`}:{}}var Kv=zv(h),qv=ja({...Hv,variantColorResolver:Kv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:qv,defaultColorScheme:`auto`,cssVariablesResolver:Uv,children:(0,T.jsx)(ua,{router:Nv})})}));export{Tv as n,av as r,Ev as t}; \ No newline at end of file +`)},e_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(yf(r=>{switch(r.type){case z.TEXT_MESSAGE_START:{let e=r;return[{type:Zg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case z.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Zg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case z.TEXT_MESSAGE_END:{let e=r;return[{type:Zg.enum.TextMessageEnd,messageId:e.messageId}]}case z.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:Zg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case z.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(jf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Zg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case z.TOOL_CALL_END:{let e=r;return[{type:Zg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case z.TOOL_CALL_RESULT:{let e=r;return[{type:Zg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case z.RAW:return[];case z.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Zg.enum.MetaEvent,name:e.name,value:e.value}]}case z.STATE_SNAPSHOT:return f(r.snapshot),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case z.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case z.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case z.RUN_STARTED:return[];case z.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:t_(c)}:{}}),active:!1}];case z.RUN_ERROR:{let e=r;return[{type:Zg.enum.RunError,message:e.message,code:e.code}]}case z.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case z.STEP_FINISHED:return u=[],l=null,[{type:Zg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function t_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=$g(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var n_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,r_=e=>e===`tool`?`toolCallId`:`messageId`,i_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},a_=e=>t=>{let n=zg(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:z.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:z.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:z.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&n_(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${r_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(yf(e=>{switch(e.type){case z.TEXT_MESSAGE_START:case z.TEXT_MESSAGE_CONTENT:case z.TEXT_MESSAGE_END:case z.TOOL_CALL_START:case z.TOOL_CALL_ARGS:case z.TOOL_CALL_END:case z.TOOL_CALL_RESULT:case z.STATE_SNAPSHOT:case z.STATE_DELTA:case z.CUSTOM:case z.STEP_STARTED:case z.STEP_FINISHED:case z.THINKING_START:case z.THINKING_END:case z.THINKING_TEXT_MESSAGE_START:case z.THINKING_TEXT_MESSAGE_CONTENT:case z.THINKING_TEXT_MESSAGE_END:case z.REASONING_START:case z.REASONING_MESSAGE_START:case z.REASONING_MESSAGE_CONTENT:case z.REASONING_MESSAGE_END:case z.REASONING_END:return[...i(e.subagentRunId??void 0),e];case z.RUN_STARTED:case z.RUN_FINISHED:case z.RUN_ERROR:case z.MESSAGES_SNAPSHOT:return[...a(),e];case z.RAW:case z.ACTIVITY_SNAPSHOT:case z.ACTIVITY_DELTA:case z.REASONING_ENCRYPTED_VALUE:case z.SUBAGENT_STARTED:return[e];case z.SUBAGENT_FINISHED:case z.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case z.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=i_({type:z.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=i_({type:z.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case z.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=i_({type:z.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=i_({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:z.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Ef(()=>{a()}))};function o_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var s_=class{runNext(e,t){return t.run(e).pipe(a_(!1))}runNextWithState(e,t){let n=Mg(e.messages||[]),r=Mg(e.state||{}),i=new Nd;return Wg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(wf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Mg(n),state:Mg(r)})))}},c_=class extends s_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function l_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var u_=class extends s_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(l_)};return this.runNext(i,t)}},d_=`THINKING_START`,f_=`THINKING_END`,p_=`THINKING_TEXT_MESSAGE_START`,m_=`THINKING_TEXT_MESSAGE_CONTENT`,h_=`THINKING_TEXT_MESSAGE_END`,g_=class extends s_{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(_f(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case d_:{this.currentReasoningId=Ng();let{title:t,...n}=e;return this.warnAboutTransformation(d_,z.REASONING_START),{...n,type:z.REASONING_START,messageId:this.currentReasoningId}}case p_:return this.currentMessageId=Ng(),this.warnAboutTransformation(p_,z.REASONING_MESSAGE_START),{...e,type:z.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case m_:{let{delta:t,...n}=e;return this.warnAboutTransformation(m_,z.REASONING_MESSAGE_CONTENT),{...n,type:z.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ng(),delta:t}}case h_:{let t=this.currentMessageId??Ng();return this.warnAboutTransformation(h_,z.REASONING_MESSAGE_END),{...e,type:z.REASONING_MESSAGE_END,messageId:t}}case f_:{let t=this.currentReasoningId??Ng();return this.warnAboutTransformation(f_,z.REASONING_END),{...e,type:z.REASONING_END,messageId:t}}default:return e}}};function __(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function v_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function y_(e){let t=__(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e}function b_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>v_(e)?y_(e):e);return{...e,content:n}}var x_=class extends s_{run(e,t){let n={...e,messages:e.messages.map(b_)};return this.runNext(n,t)}},S_=`SUBAGENT_STARTED`,C_=`SUBAGENT_FINISHED`,w_=`SUBAGENT_ERROR`;function T_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function E_(e){return e.map(e=>T_(e))}var D_=class extends s_{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>T_(e))};return this.runNext(n,t).pipe(kf(e=>{let t=e.type;(t===S_||t===C_||t===w_)&&this.warnDroppedLifecycleEvent(t)}),Sf(e=>{let t=e.type;return t!==S_&&t!==C_&&t!==w_}),_f(e=>{let t=T_(e);if(t.type===z.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:E_(e.messages)}}if(t.type===z.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>T_(e))}}}if(t.type===z.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:E_(e.input.messages)}}}return t}))}},O_=`0.0.59`,k_=class{get maxVersion(){return O_}get debug(){return this._debug}set debug(e){this._debug=Rg(e),this._debugLogger=Vg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Vg(Rg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Mg(r??[]),this.state=Mg(i??{}),this._debug=Rg(a),this._debugLogger=Vg(this._debug),jg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new u_),jg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new g_),jg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new x_),jg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new D_)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new c_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ef(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)));let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new V;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await gf(bd(()=>xf(()=>this.connect(n)),a_(this.debugLogger),Gg(this.debugLogger),e=>e.pipe(Of(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),Cf(e=>(this.isRunning=!1,e instanceof Qc?Pd:this.onError(n,e,a))),Ef(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(mf(null)),{defaultValue:void 0});let s=Mg(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,n){return Wg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(kf(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Mg(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Mg(e?.tools??[]),context:Mg(e?.context??[]),forwardedProps:Mg(e?.forwardedProps??{}),state:Mg(this.state),messages:n,...e?.resume===void 0?{}:{resume:Mg(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new R(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(o_(e))throw new R(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return pf(Lg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(_f(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await Lg(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Mg(this.messages),e.state=Mg(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Mg(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=Mg(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Mg(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(a_(this.debugLogger),Gg(this.debugLogger),e_(this.threadId,t.runId,this.agentId),e=>e.pipe(_f(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function A_(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var j_=class extends k_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(A_(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=Mg(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Xg(qg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Mg(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},M_=class extends ln{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:wn(t,n.data),hasPreviousPage:un(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},N_=class extends pn{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new bn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=P_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=P_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){xn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Dn(t,e))}findAll(e={}){return this.getAll().filter(t=>Dn(e,t))}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return xn.batch(()=>Promise.all(e.map(e=>e.continue().catch(En))))}};function P_(e){return e.options.scope?.id}var F_=class extends pn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Tn(r,t),a=this.get(i);return a||(a=new _n({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){xn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>cn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>cn(e,t)):t}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},I_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new F_,this.#t=e.mutationCache||new N_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=vn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Kt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return xn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;xn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return xn.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=xn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(En).catch(En)}invalidateQueries(e,t={}){return xn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=xn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(En)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(En)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Kt(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Kt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(En).catch(En)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(En).catch(En)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return dn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(on(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{an(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(on(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{an(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Tn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Jt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function L_(e,t){return sn(e,M_,t)}var R_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),G_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:R_}));G_.displayName=`BookOpenIcon`;var K_=G_,q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));q_.displayName=`MagnifyingGlassIcon`;var J_=q_,Y_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));Y_.displayName=`MoonIcon`;var X_=Y_,Z_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));Z_.displayName=`PencilSimpleIcon`;var Q_=Z_,$_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));$_.displayName=`PlugsConnectedIcon`;var ev=$_,tv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));tv.displayName=`SignOutIcon`;var nv=tv,rv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));rv.displayName=`SunIcon`;var iv=rv,av={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`};async function ov(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function sv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=tn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=L_({queryKey:[...Sn,m],queryFn:({pageParam:e})=>ov(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=mn({queryKey:Cn,queryFn:()=>yn(`/api/dashboards`),refetchInterval:3e4}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>pv(ue),[ue]),fe=pt(`overview`,ft({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Sn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Sn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Ft,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Bt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(lv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(cv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Pt,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(ot,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(J_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(gn,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(gn,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function cv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function lv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:mv(e.updatedAt)})]})}),(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Ze,{size:18,weight:`bold`})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(Q_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Le.Item,{color:`bad`,leftSection:(0,T.jsx)(It,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function uv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function dv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var fv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function pv(e){let t=dv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-dv(uv(r.updatedAt)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return fv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function mv(e){let t=uv(e),n=dv(new Date);return Math.floor((n-dv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function hv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=On(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=Ve({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(kn),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Vt,{label:`Documentation`,children:(0,T.jsx)(jn,{component:`a`,href:av.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(K_,{size:17,weight:`bold`})})}),(0,T.jsx)(gv,{}),(0,T.jsx)(_v,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(sv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(sv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function gv(){let{setColorScheme:e}=Ut(),t=Wt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`;return(0,T.jsx)(Vt,{label:`Switch to ${n} theme`,children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onClick:()=>e(n),children:t===`dark`?(0,T.jsx)(iv,{size:17,weight:`bold`}):(0,T.jsx)(X_,{size:17,weight:`bold`})})})}function _v({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Le,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Le.Target,{children:(0,T.jsx)(jn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Le.Dropdown,{children:[(0,T.jsx)(Le.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(ev,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Le.Divider,{}),(0,T.jsx)(Le.Item,{leftSection:(0,T.jsx)(nv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function vv(){let{agent_available:e}=ke(),t=Ne(),n=tn(),{threadId:r}=Ve({strict:!1}),[i,a]=(0,w.useState)(Nt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(null),oe=(0,w.useRef)(0),se=(0,w.useMemo)(()=>new j_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),ce=!e||f===s;function le(){oe.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),le(),te(``),!e){p(s);return}!r||o.current.has(s)?(se.setMessages([]),p(s)):De(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}se.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=se.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{oe.current+=1,y(Mn(e.toolCallName))},onToolCallEndEvent:()=>{oe.current=Math.max(0,oe.current-1),oe.current===0&&y(``)},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s),n.invalidateQueries({queryKey:Sn})}});return()=>{t=!1,i.unsubscribe(),se.abortRun()}},[se,e,n,ne,s]),(0,w.useEffect)(()=>{ie.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[c,g]),(0,w.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ae.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ae.current?.focus()))),e.key===`Escape`&&n===ae.current&&(x(``),ae.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function ue(){_(!0),te(``);try{await se.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),le(),o.current.delete(s)}}async function de(n){let i=n.trim();if(!e||!i||g||!ce||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Nt(),role:`user`,content:i};se.addMessage(a),l([...se.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await ue()}(0,w.useEffect)(()=>{let e=S.current;ce&&r&&e&&(S.current=``,de(e))},[ce,r,s]);function C(e){e.preventDefault(),de(b)}function fe(){se.abortRun(),_(!1),le(),o.current.delete(s)}function pe(){!g&&se.messages.some(e=>e.role===`user`)&&ue()}function me(n){if(!e)return;let r=Nt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function he(){se.abortRun(),S.current=``,a(Nt()),t({to:`/chat`})}function ge(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function _e(){re(e=>e+1)}return(0,T.jsx)(An.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ce,running:g,activity:v,input:b,setInput:x,error:ee,bottomRef:ie,inputRef:ae,send:de,submit:C,stop:fe,retry:pe,reloadThread:_e,openChat:me,newThread:he,selectThread:ge},children:(0,T.jsx)(hv,{children:(0,T.jsx)(ta,{})})})}function yv(){let e=(0,w.useMemo)(()=>new I_,[]);return(0,T.jsx)(qt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(vv,{})})})}var bv=Re({component:yv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),xv=Je(`/`)({component:Ke(()=>Nn(()=>import(`./routes-D1xQhcK4.js`),__vite__mapDeps([0,1,2])),`component`)}),Sv=Je(`/settings`)({component:Ke(()=>Nn(()=>import(`./settings-D_2lRZJm.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),Cv=Je(`/chat/`)({component:Ke(()=>Nn(()=>import(`./chat.index-DvqxaiRx.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),wv=Je(`/chat/$threadId`)({component:Ke(()=>Nn(()=>import(`./chat._threadId-DvqxaiRx.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Tv=Je(`/dashboards/`)({component:Ke(()=>Nn(()=>import(`./dashboards.index-C3Dkh40b.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Ev=Je(`/dashboards/$dashboardId`)({component:Ke(()=>Nn(()=>import(`./dashboards._dashboardId-BS6OaA2t.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:ct}),Dv=xv.update({id:`/`,path:`/`,getParentRoute:()=>bv}),Ov=Sv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>bv}),kv=Cv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>bv}),Av=wv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>bv}),jv=Tv.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>bv}),Mv={IndexRoute:Dv,SettingsRoute:Ov,ChatThreadIdRoute:Av,DashboardsDashboardIdRoute:Ev.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>bv}),ChatIndexRoute:kv,DashboardsIndexRoute:jv},Nv=sa({routeTree:bv._addFileChildren(Mv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Pv={brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},Fv={light:7,dark:5};function Iv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Lv(e){let t=Iv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Rv(e){return Object.fromEntries(Object.entries(Pv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Lv(n[Fv[e]])]))}function zv(e){return t=>{let n=t.color??Hv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Pv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Bv=.25,Vv={xs:9,sm:10,md:11,lg:13,xl:16},Hv={primaryColor:`brand`,primaryShade:Fv,autoContrast:!0,luminanceThreshold:Bv,colors:{dark:kt,brand:Tt,ok:Dt,warn:jt,bad:bt,info:St},defaultRadius:`md`,fontFamily:it.body,fontFamilyMonospace:it.display,headings:{fontFamily:it.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Gv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Gv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Wv(t.size)})}}},Uv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...Rv(`light`)},dark:Rv(`dark`)});function Wv(e){let t=Vv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Gv(e,t){return!e||e===Hv.primaryColor?{[t]:`var(--fanout-color-${Hv.primaryColor}-contrast)`}:{}}var Kv=zv(h),qv=ja({...Hv,variantColorResolver:Kv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:qv,defaultColorScheme:`auto`,cssVariablesResolver:Uv,children:(0,T.jsx)(ua,{router:Nv})})}));export{Tv as n,av as r,Ev as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-Br2qbsAf.js b/internal/ui/dist/assets/settings-Br2qbsAf.js deleted file mode 100644 index af540ca91..000000000 --- a/internal/ui/dist/assets/settings-Br2qbsAf.js +++ /dev/null @@ -1,16 +0,0 @@ -import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-BeUORN-q.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{O as S,i as C,k as w,n as T}from"./api-Be5Lq4YA.js";import{n as E,t as D}from"./WarningCircle.es-DDq2AFnK.js";import{r as O}from"./index-6GqvJDXC.js";var k=t(s(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j={root:`m_849cf0da`},M=d(),N={underline:`hover`},P=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,N,e);return(0,M.jsx)(a,{component:`a`,className:n({[j.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});P.classes=j,P.displayName=`@mantine/core/Anchor`;var F={timeout:1e3};function I(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,F,e),a=A({timeout:n});return(0,M.jsx)(M.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}I.displayName=`@mantine/core/CopyButton`;var L=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),R=k.forwardRef((e,t)=>k.createElement(i,{ref:t,...e,weights:L}));R.displayName=`ArrowsClockwiseIcon`;var z=R,B=[`settings`,`ingest`];function V(e,t){return t||/^https:\/\//i.test(e.trim())}function H(e,t,n){return`exporters: - otlp/fanout: - endpoint: "${e}" - headers: - ${t}: "Bearer \${env:FANOUT_INGEST_TOKEN}"${V(e,n)?``:` - tls: - insecure: true`} - -service: - pipelines: - traces: - exporters: [otlp/fanout] - logs: - exporters: [otlp/fanout] - metrics: - exporters: [otlp/fanout]`}function U({label:e,value:t,hint:n}){return(0,M.jsxs)(m,{gap:4,children:[(0,M.jsx)(a,{size:`sm`,fw:600,children:e}),(0,M.jsxs)(c,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,M.jsx)(b,{style:{flex:1,overflowX:`auto`},children:t}),(0,M.jsx)(I,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,M.jsx)(x,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,M.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15})})})})]}),n&&(0,M.jsx)(a,{c:`dimmed`,size:`xs`,children:n})]})}function W(){let e=y(),t=S(),n=C({queryKey:B,queryFn:()=>T(`/api/settings/ingest`)}),[r,i]=(0,k.useState)(!1),[s,u]=(0,k.useState)(null),d=E({mutationFn:async()=>{let e=await v(`/api/settings/ingest/rotate-token`,{method:`POST`}).catch(()=>{throw Error(`Fanout could not be reached. A token may still have been issued — reload this page before trying again.`)});if(!e.ok)throw Error(`Fanout could not issue a new token. Try again.`);return e.json()},onSuccess:e=>{i(!1),u(e.ingest_token??null),t.setQueryData(B,{token_required:e.token_required,suggested_endpoint:e.suggested_endpoint,tls_configured:e.tls_configured,header_name:e.header_name})}});function x(){u(null),d.reset()}if(n.isLoading)return(0,M.jsx)(G,{});if(n.isError||!n.data)return(0,M.jsx)(K,{onRetry:()=>void n.refetch()});let{suggested_endpoint:A,header_name:j,tls_configured:N,token_required:F}=n.data,L=e.role===`admin`,R=`${j}: Bearer `;return(0,M.jsxs)(g,{component:`main`,maw:760,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,M.jsxs)(m,{gap:`xl`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:1,fz:32,lts:`-0.03em`,children:`Connect telemetry`}),(0,M.jsx)(a,{c:`dimmed`,mt:2,children:`Point an OpenTelemetry collector or SDK at this workspace.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,M.jsxs)(m,{gap:`lg`,children:[(0,M.jsx)(U,{label:`Endpoint`,value:A,hint:V(A,N)?`OTLP over gRPC, secured with TLS.`:`OTLP over gRPC. Fanout serves this endpoint in plaintext, so an exporter needs tls.insecure unless a proxy in front of it terminates TLS.`}),(0,M.jsx)(U,{label:`Authorization`,value:R,hint:`Send the token your workspace issued. Fanout stores only its hash, so it cannot show you an existing one.`})]})}),(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:`Merge these blocks into your collector configuration, alongside the receivers it already has, and set FANOUT_INGEST_TOKEN in its environment.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`md`,children:(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsx)(b,{block:!0,style:{fontSize:12},children:H(A,j,N)}),(0,M.jsx)(c,{justify:`flex-end`,children:(0,M.jsx)(I,{value:H(A,j,N),timeout:1500,children:({copied:e,copy:t})=>(0,M.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Ingest token`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:F?`This workspace has a token. Rotating issues a new one and stops the current one working immediately.`:`This workspace has no token yet, so it is rejecting telemetry. Issue one to start accepting data.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:s?(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsx)(a,{size:`sm`,fw:600,children:`Your new token`}),(0,M.jsx)(b,{block:!0,children:`${j}: Bearer ${s}`}),(0,M.jsx)(a,{c:`dimmed`,size:`xs`,children:`Fanout shows this once and keeps only its hash. Store it with your collector secrets before closing this, then update any collector still using the old token. Lose it and the only way back is another rotation.`}),(0,M.jsxs)(c,{children:[(0,M.jsx)(I,{value:`${j}: Bearer ${s}`,timeout:1500,children:({copied:e,copy:t})=>(0,M.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy header`})}),(0,M.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:x,children:`Done`})]})]}):L?(0,M.jsxs)(c,{justify:`space-between`,align:`center`,children:[(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:F?`Rotate when a token may have been exposed.`:`No token issued yet.`}),(0,M.jsx)(h,{variant:F?`default`:`filled`,leftSection:(0,M.jsx)(z,{size:15,weight:`bold`}),onClick:()=>{d.reset(),i(!0)},children:F?`Rotate token`:`Issue token`})]}):(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:`An administrator issues and rotates the ingest token.`})})]}),(0,M.jsxs)(a,{c:`dimmed`,size:`xs`,children:[(0,M.jsx)(P,{href:O.ingest,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Sending telemetry`}),` covers SDK setup, the collector, and the OTLP/HTTP endpoint.`]})]}),(0,M.jsx)(w,{opened:r,onClose:()=>!d.isPending&&i(!1),title:F?`Rotate the ingest token?`:`Issue an ingest token?`,centered:!0,radius:`md`,children:(0,M.jsxs)(m,{gap:`md`,children:[(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:F?`The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it. Fanout shows the new token once and stores only its hash.`:`Fanout will show the new token once, and store only its hash.`}),d.isError&&(0,M.jsx)(o,{color:`bad`,radius:`md`,icon:(0,M.jsx)(D,{size:18,weight:`fill`}),children:d.error instanceof Error?d.error.message:`Fanout could not issue a new token.`}),(0,M.jsxs)(c,{justify:`flex-end`,gap:`sm`,children:[(0,M.jsx)(h,{variant:`default`,size:`sm`,onClick:()=>{d.reset(),i(!1)},disabled:d.isPending,children:`Cancel`}),(0,M.jsx)(h,{color:F?`bad`:void 0,size:`sm`,loading:d.isPending,onClick:()=>d.mutate(),children:F?`Rotate token`:`Issue token`})]})]})})]})}function G(){return(0,M.jsxs)(c,{justify:`center`,mih:`50vh`,gap:`sm`,children:[(0,M.jsx)(r,{size:`sm`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,children:`Loading connection details…`})]})}function K({onRetry:e}){return(0,M.jsx)(c,{justify:`center`,mih:`50vh`,children:(0,M.jsx)(o,{color:`bad`,radius:`md`,icon:(0,M.jsx)(D,{size:18,weight:`fill`}),maw:420,children:(0,M.jsxs)(m,{gap:`sm`,align:`flex-start`,children:[(0,M.jsx)(a,{size:`sm`,children:`Fanout could not load this workspace's connection details.`}),(0,M.jsx)(h,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:e,children:`Try again`})]})})})}var q=W;export{q as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-D_2lRZJm.js b/internal/ui/dist/assets/settings-D_2lRZJm.js new file mode 100644 index 000000000..4a361bf86 --- /dev/null +++ b/internal/ui/dist/assets/settings-D_2lRZJm.js @@ -0,0 +1,16 @@ +import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-BeUORN-q.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{O as S,i as C,k as w,n as T}from"./api-Be5Lq4YA.js";import{n as E,t as D}from"./WarningCircle.es-DDq2AFnK.js";import{r as O}from"./index-BLac8tJW.js";var k=t(s(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j={root:`m_849cf0da`},M=d(),N={underline:`hover`},P=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,N,e);return(0,M.jsx)(a,{component:`a`,className:n({[j.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});P.classes=j,P.displayName=`@mantine/core/Anchor`;var F={timeout:1e3};function I(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,F,e),a=A({timeout:n});return(0,M.jsx)(M.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}I.displayName=`@mantine/core/CopyButton`;var L=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),R=k.forwardRef((e,t)=>k.createElement(i,{ref:t,...e,weights:L}));R.displayName=`ArrowsClockwiseIcon`;var z=R,B=[`settings`,`ingest`];function V(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function H(e,t,n){return`exporters: + otlp/fanout: + endpoint: "${e}" + headers: + ${t}: "Bearer \${env:INGEST_TOKEN}"${V(e,n)?``:` + tls: + insecure: true`} + +service: + pipelines: + traces: + exporters: [otlp/fanout] + logs: + exporters: [otlp/fanout] + metrics: + exporters: [otlp/fanout]`}function U({label:e,value:t,hint:n}){return(0,M.jsxs)(m,{gap:4,children:[(0,M.jsx)(a,{size:`sm`,fw:600,children:e}),(0,M.jsxs)(c,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,M.jsx)(b,{style:{flex:1,overflowX:`auto`},children:t}),(0,M.jsx)(I,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,M.jsx)(x,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,M.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15})})})})]}),n&&(0,M.jsx)(a,{c:`dimmed`,size:`xs`,children:n})]})}function W(){let e=y(),t=S(),n=C({queryKey:B,queryFn:()=>T(`/api/settings/ingest`)}),[r,i]=(0,k.useState)(!1),[s,u]=(0,k.useState)(null),d=E({gcTime:0,onMutate:()=>t.cancelQueries({queryKey:B}),mutationFn:async()=>{let e=await v(`/api/settings/ingest/rotate-token`,{method:`POST`}).catch(()=>{throw Error(`Fanout could not be reached. A token may still have been issued — reload this page before trying again.`)});if(!e.ok)throw Error(`Fanout could not issue a new token. Try again.`);return e.json()},onSuccess:e=>{i(!1),u(e.ingest_token??null),t.setQueryData(B,{token_required:e.token_required,suggested_endpoint:e.suggested_endpoint,tls_configured:e.tls_configured,header_name:e.header_name})}});function x(){u(null),d.reset()}if(!n.data)return n.isLoading?(0,M.jsx)(G,{}):(0,M.jsx)(K,{onRetry:()=>void n.refetch()});let{suggested_endpoint:A,header_name:j,tls_configured:N,token_required:F}=n.data,L=e.role===`admin`,R=`${j}: Bearer `;return(0,M.jsxs)(g,{component:`main`,maw:760,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,M.jsxs)(m,{gap:`xl`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:1,fz:32,lts:`-0.03em`,children:`Connect telemetry`}),(0,M.jsx)(a,{c:`dimmed`,mt:2,children:`Point an OpenTelemetry collector or SDK at this workspace.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,M.jsxs)(m,{gap:`lg`,children:[(0,M.jsx)(U,{label:`Endpoint`,value:A,hint:V(A,N)?`OTLP over gRPC, secured with TLS.`:`OTLP over gRPC. Fanout serves this endpoint in plaintext, so an exporter needs tls.insecure unless a proxy in front of it terminates TLS.`}),(0,M.jsx)(U,{label:`Authorization`,value:R,hint:`Send the token your workspace issued. Fanout stores only its hash, so it cannot show you an existing one.`})]})}),(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:`Merge these blocks into your collector configuration, alongside the receivers it already has, and set INGEST_TOKEN in its environment.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`md`,children:(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsx)(b,{block:!0,style:{fontSize:12},children:H(A,j,N)}),(0,M.jsx)(c,{justify:`flex-end`,children:(0,M.jsx)(I,{value:H(A,j,N),timeout:1500,children:({copied:e,copy:t})=>(0,M.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsxs)(g,{children:[(0,M.jsx)(f,{order:2,fz:22,lts:`-0.02em`,children:`Ingest token`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,mt:2,children:F?`This workspace has a token. Rotating issues a new one and stops the current one working immediately.`:`This workspace has no token yet, so it is rejecting telemetry. Issue one to start accepting data.`})]}),(0,M.jsx)(_,{withBorder:!0,radius:`lg`,p:`lg`,children:s?(0,M.jsxs)(m,{gap:`sm`,children:[(0,M.jsx)(a,{size:`sm`,fw:600,children:`Your new token`}),(0,M.jsx)(b,{block:!0,children:`${j}: Bearer ${s}`}),(0,M.jsx)(a,{c:`dimmed`,size:`xs`,children:`Fanout shows this once and keeps only its hash. Store it with your collector secrets before closing this, then update any collector still using the old token. Lose it and the only way back is another rotation.`}),(0,M.jsxs)(c,{children:[(0,M.jsx)(I,{value:`${j}: Bearer ${s}`,timeout:1500,children:({copied:e,copy:t})=>(0,M.jsx)(h,{variant:`light`,size:`compact-sm`,leftSection:e?(0,M.jsx)(l,{size:15,weight:`bold`}):(0,M.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy header`})}),(0,M.jsx)(h,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:x,children:`Done`})]})]}):L?(0,M.jsxs)(c,{justify:`space-between`,align:`center`,children:[(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:F?`Rotate when a token may have been exposed.`:`No token issued yet.`}),(0,M.jsx)(h,{variant:F?`default`:`filled`,leftSection:(0,M.jsx)(z,{size:15,weight:`bold`}),onClick:()=>{d.reset(),i(!0)},children:F?`Rotate token`:`Issue token`})]}):(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:`An administrator issues and rotates the ingest token.`})})]}),(0,M.jsxs)(a,{c:`dimmed`,size:`xs`,children:[(0,M.jsx)(P,{href:O.ingest,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Sending telemetry`}),` covers SDK setup, the collector, and the OTLP/HTTP endpoint.`]})]}),(0,M.jsx)(w,{opened:r,onClose:()=>!d.isPending&&i(!1),title:F?`Rotate the ingest token?`:`Issue an ingest token?`,centered:!0,radius:`md`,children:(0,M.jsxs)(m,{gap:`md`,children:[(0,M.jsx)(a,{size:`sm`,c:`dimmed`,children:F?`The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it. Fanout shows the new token once and stores only its hash.`:`Fanout will show the new token once, and store only its hash.`}),d.isError&&(0,M.jsx)(o,{color:`bad`,radius:`md`,icon:(0,M.jsx)(D,{size:18,weight:`fill`}),children:d.error instanceof Error?d.error.message:`Fanout could not issue a new token.`}),(0,M.jsxs)(c,{justify:`flex-end`,gap:`sm`,children:[(0,M.jsx)(h,{variant:`default`,size:`sm`,onClick:()=>{d.reset(),i(!1)},disabled:d.isPending,children:`Cancel`}),(0,M.jsx)(h,{color:F?`bad`:void 0,size:`sm`,loading:d.isPending,onClick:()=>d.mutate(),children:F?`Rotate token`:`Issue token`})]})]})})]})}function G(){return(0,M.jsxs)(c,{justify:`center`,mih:`50vh`,gap:`sm`,children:[(0,M.jsx)(r,{size:`sm`}),(0,M.jsx)(a,{c:`dimmed`,size:`sm`,children:`Loading connection details…`})]})}function K({onRetry:e}){return(0,M.jsx)(c,{justify:`center`,mih:`50vh`,children:(0,M.jsx)(o,{color:`bad`,radius:`md`,icon:(0,M.jsx)(D,{size:18,weight:`fill`}),maw:420,children:(0,M.jsxs)(m,{gap:`sm`,align:`flex-start`,children:[(0,M.jsx)(a,{size:`sm`,children:`Fanout could not load this workspace's connection details.`}),(0,M.jsx)(h,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:e,children:`Try again`})]})})})}var q=W;export{q as component}; \ No newline at end of file diff --git a/internal/ui/dist/index.html b/internal/ui/dist/index.html index 39d5da630..f53ffa2c0 100644 --- a/internal/ui/dist/index.html +++ b/internal/ui/dist/index.html @@ -21,7 +21,7 @@ document.documentElement.setAttribute("data-mantine-color-scheme", computed); } catch (e) {} - + diff --git a/site/src/content/docs/start/send-telemetry.mdx b/site/src/content/docs/start/send-telemetry.mdx index 04ff2dc8c..7fa2d58a5 100644 --- a/site/src/content/docs/start/send-telemetry.mdx +++ b/site/src/content/docs/start/send-telemetry.mdx @@ -67,6 +67,12 @@ service: exporters: [otlp/fanout] ``` +The `otlp` exporter uses TLS by default. If nothing in front of Fanout +terminates TLS — a local instance, or one on a private network — the exporter +needs `tls: { insecure: true }` under `otlp/fanout`, or it will fail to +connect. **Connect telemetry** in the application generates this block with +your own endpoint already in it, and includes that line when it applies. + A Collector is optional. Fanout speaks the same protocol your SDKs already export, so it can sit directly behind them — but if you already run a Collector for sampling, enrichment or fan-out to a second backend, Fanout is just another diff --git a/ui/host/src/settings.test.tsx b/ui/host/src/settings.test.tsx index 054ddf9d4..06db18fa4 100644 --- a/ui/host/src/settings.test.tsx +++ b/ui/host/src/settings.test.tsx @@ -19,11 +19,13 @@ function json(body: unknown, status = 200) { const connection = { token_required: true, suggested_endpoint: "ingest.example.com:4317", tls_configured: false, header_name: "Authorization" }; +let client: QueryClient; + async function mount() { const container = document.createElement("div"); document.body.append(container); const root = createRoot(container); - const client = new QueryClient({ defaultOptions: { queries: { retry: false } } }); + client = new QueryClient({ defaultOptions: { queries: { retry: false } } }); await act(async () => root.render( , )); @@ -46,7 +48,7 @@ describe("connect telemetry", () => { // Quoted, because an advertised IPv6 endpoint is a YAML flow sequence bare. expect(config).toContain('endpoint: "ingest.example.com:4317"'); // A secret pasted into a config file is a secret in version control. - expect(config).toContain("${env:FANOUT_INGEST_TOKEN}"); + expect(config).toContain("${env:INGEST_TOKEN}"); // This instance serves plaintext, so the exporter has to be told. expect(config).toContain("insecure: true"); await act(async () => root.unmount()); @@ -87,6 +89,17 @@ describe("connect telemetry", () => { await act(async () => root.unmount()); }); + it("treats an endpoint on port 443 as TLS even without a scheme", async () => { + // An operator naming a TLS-terminating proxy usually writes the port and + // not the scheme, and tls.insecure against it fails with a gRPC error that + // explains nothing. + fetchMock.mockImplementation(async () => json({ ...connection, suggested_endpoint: "ingest.example.com:443" })); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Collector configuration")); + expect(document.body.textContent).not.toContain("insecure: true"); + await act(async () => root.unmount()); + }); + it("stops offering to issue a token once one has been issued", async () => { fetchMock.mockImplementation(async (_url, init) => json((init as RequestInit | undefined)?.method === "POST" ? { ...connection, token_required: true, ingest_token: "fo_firsttoken" } @@ -104,6 +117,8 @@ describe("connect telemetry", () => { const done = [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Done"); await act(async () => done?.click()); expect(document.body.textContent).not.toContain("fo_firsttoken"); + // "Shown once" has to be true of the cache as well as the screen. + expect(JSON.stringify(client.getMutationCache().getAll().map((mutation) => mutation.state.data))).not.toContain("fo_firsttoken"); expect(document.body.textContent).toContain("Rotate when a token may have been exposed"); await act(async () => root.unmount()); }); diff --git a/ui/host/src/settings.tsx b/ui/host/src/settings.tsx index ecf2b28eb..c9c6b6409 100644 --- a/ui/host/src/settings.tsx +++ b/ui/host/src/settings.tsx @@ -15,13 +15,17 @@ type IngestSettings = { const ingestQueryKey = ["settings", "ingest"] as const; -/** Whether the exporter reaches this instance over TLS. The endpoint may be an - * advertised URL, in which case its scheme is the answer; otherwise it is - * plaintext unless this process holds the certificate itself. A proxy that - * terminates TLS without an https endpoint being advertised is invisible from - * here, which is why the hint says so rather than asserting plaintext. */ +/** Whether the exporter reaches this instance over TLS. + * + * Three things can say so: the process holds the certificate itself, the + * advertised endpoint carries an https scheme, or it names port 443 — an + * operator pointing at a TLS-terminating proxy usually writes the port and + * not the scheme, and telling that collector to send plaintext produces a + * gRPC error that explains nothing. Anything else is treated as plaintext, + * which is what an unproxied instance serves. */ function overTLS(endpoint: string, tlsConfigured: boolean) { - return tlsConfigured || /^https:\/\//i.test(endpoint.trim()); + const value = endpoint.trim(); + return tlsConfigured || /^https:\/\//i.test(value) || /:443$/.test(value); } /** The collector block an engineer actually pastes, with this instance's own @@ -30,16 +34,16 @@ function overTLS(endpoint: string, tlsConfigured: boolean) { * * The endpoint is quoted because an advertised IPv6 address arrives as * "[2001:db8::1]:4317", which unquoted YAML reads as a flow sequence. The - * token is referenced as ${env:...}, the form the documentation uses and the - * only one that is unambiguous when a distribution sets its own default - * config scheme. */ + * token is referenced as ${env:INGEST_TOKEN}, the name and the form the + * documentation and the README both use — the braced form alone is ambiguous + * where a distribution sets its own default config scheme. */ function collectorConfig(endpoint: string, header: string, tlsConfigured: boolean) { const insecure = overTLS(endpoint, tlsConfigured) ? "" : "\n tls:\n insecure: true"; return `exporters: otlp/fanout: endpoint: "${endpoint}" headers: - ${header}: "Bearer \${env:FANOUT_INGEST_TOKEN}"${insecure} + ${header}: "Bearer \${env:INGEST_TOKEN}"${insecure} service: pipelines: @@ -76,6 +80,15 @@ export default function Settings() { const [issued, setIssued] = useState(null); const rotate = useMutation({ + // The plaintext lives in this mutation's result, and the cache keeps a + // result for five minutes after its last observer lets go. Zero means + // "shown once" is true of the tab as well as the screen. + gcTime: 0, + // A GET already in flight resolves after the POST and writes the + // pre-rotation answer over the refreshed one — the page then says the + // workspace is rejecting telemetry and offers to issue the token it has + // just issued. Cancelling first is what makes the write below hold. + onMutate: () => queryClient.cancelQueries({ queryKey: ingestQueryKey }), mutationFn: async () => { // A failure between the write and the response leaves the old token dead // and the new one unrecoverable, so this case gets its own instruction @@ -105,13 +118,14 @@ export default function Settings() { function dismissToken() { setIssued(null); - // Drops the plaintext from the mutation cache, which otherwise holds it - // for the life of the tab. + // Drops the mutation's result, and with gcTime: 0 the cache entry goes + // with it rather than lingering. rotate.reset(); } - if (settings.isLoading) return ; - if (settings.isError || !settings.data) return void settings.refetch()} />; + // A page that has loaded stays loaded: one failed background refetch is not + // a reason to replace a working screen with an alert. + if (!settings.data) return settings.isLoading ? : void settings.refetch()} />; const { suggested_endpoint: endpoint, header_name: header, tls_configured: tlsConfigured, token_required: hasToken } = settings.data; const canRotate = viewer.role === "admin"; @@ -134,7 +148,7 @@ export default function Settings() { Collector configuration - Merge these blocks into your collector configuration, alongside the receivers it already has, and set FANOUT_INGEST_TOKEN in its environment. + Merge these blocks into your collector configuration, alongside the receivers it already has, and set INGEST_TOKEN in its environment. diff --git a/ui/links.ts b/ui/links.ts index 93dce88bc..7a0d483ad 100644 --- a/ui/links.ts +++ b/ui/links.ts @@ -8,7 +8,8 @@ * their own account — and neither answers a question an operator has while * using the product. They belong on the marketing site. */ export const docs = { - home: "https://fanout.run/", + /** Where an operator starts reading, not the marketing page above it. */ + home: "https://fanout.run/start/what-fanout-is", /** Sending telemetry: endpoint, authentication, collector and SDK setup. */ ingest: "https://fanout.run/start/send-telemetry", } as const;