onepipeline-ui 0.83.4 → 0.83.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-BRPgV32N.js +10 -0
- package/dist/assets/index-C4M1c3rI.css +2 -0
- package/dist/assets/mount-CY1XHbUx.js +105 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/index-BIGPnn7C.js +0 -10
- package/dist/assets/index-BpkmBBli.css +0 -2
- package/dist/assets/mount-C0USJQOd.js +0 -106
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,at as k,b as A,c as j,ct as M,d as N,dt as P,et as F,f as I,ft as L,g as ee,h as te,i as ne,it as re,j as ie,k as ae,l as oe,lt as se,n as ce,nt as le,o as ue,ot as de,p as fe,pt as pe,q as me,r as he,rt as ge,s as _e,st as ve,t as ye,tt as be,u as xe,ut as Se,v as Ce,w as we,x as Te,y as Ee,z as De}from"./index-BIGPnn7C.js";var Oe=E(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ke=E(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Ae=E(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),je=E(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Me=E(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ne=E(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Pe=E(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Fe=E(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ie=E(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Le=E(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Re=E(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),ze=E(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Be=E(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Ve=E(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),He=E(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Ue=E(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),We=E(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Ge=E(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ke=E(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),qe=E(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Je=E(`message-square-off`,[[`path`,{d:`M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826`,key:`1wyg69`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v11.344`,key:`mhl4k6`}]]),Ye=E(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),Xe=E(`message-square-reply`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`m10 8-3 3 3 3`,key:`fp6dz7`}],[`path`,{d:`M17 14v-1a2 2 0 0 0-2-2H7`,key:`1tkjnz`}]]),Ze=E(`octagon-pause`,[[`path`,{d:`M10 15V9`,key:`1lckn7`}],[`path`,{d:`M14 15V9`,key:`1muqhk`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}]]),Qe=E(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),$e=E(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),et=E(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),tt=E(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),nt=E(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),rt=E(`satellite`,[[`path`,{d:`m13.5 6.5-3.148-3.148a1.205 1.205 0 0 0-1.704 0L6.352 5.648a1.205 1.205 0 0 0 0 1.704L9.5 10.5`,key:`dzhfyz`}],[`path`,{d:`M16.5 7.5 19 5`,key:`1ltcjm`}],[`path`,{d:`m17.5 10.5 3.148 3.148a1.205 1.205 0 0 1 0 1.704l-2.296 2.296a1.205 1.205 0 0 1-1.704 0L13.5 14.5`,key:`nfoymv`}],[`path`,{d:`M9 21a6 6 0 0 0-6-6`,key:`1iajcf`}],[`path`,{d:`M9.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l4.296-4.296a1.205 1.205 0 0 0 0-1.704l-2.296-2.296a1.205 1.205 0 0 0-1.704 0z`,key:`nv9zqy`}]]),it=E(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),at=E(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),ot=E(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),st=E(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),ct=E(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),lt=E(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),ut=E(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),R=pe(M(),1),z=d(),dt=[`bg-spectrum-blue`,`bg-spectrum-green`,`bg-spectrum-orange`,`bg-spectrum-violet`,`bg-spectrum-red`,`bg-spectrum-indigo`,`bg-spectrum-yellow`],ft=`__timeline_implicit_lane__`;function pt(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return dt[(t>>>0)%dt.length]??dt[0]}function mt(e){return e.laneId??ft}function ht(e){return typeof e.end==`number`&&Number.isFinite(e.end)?e.end:typeof e.duration==`number`&&Number.isFinite(e.duration)?e.start+e.duration:e.start}function gt(e){return e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function _t(e){return`+${gt(e)}`}function vt(e){let t=new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toISOString()}function yt(e,t){let n=new Date(e);return`${Number.isNaN(n.valueOf())?String(e):n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})} ${_t(e-t)}`}function bt(e,t){let n=ht(e),r=[e.label,`Lane: ${mt(e)}`,`Status: ${e.status??`unknown`}`,`Start: ${vt(e.start)}`];return n>e.start?r.push(`End: ${vt(n)}`,`Duration: ${gt(n-e.start)}`):r.push(`Duration: not recorded`),e.status===`failed`&&t?.trim()&&r.push(`Failure: ${t.trim().slice(0,160)}`),r.join(` · `)}function xt(e,t,n){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),s=(0,R.useRef)(null),c=(t&&t[1]>t[0]?{end:t[1],start:t[0]}:null)??r??e,l=Math.max(1,c.end-c.start),u=e=>{n?.([e.start,e.end]),t||i(e)},d=e=>{let t=s.current?.getBoundingClientRect(),n=t?.width||1e3;return c.start+Math.min(1,Math.max(0,(e-(t?.left??0))/n))*l};return{axis:s,brushStart:e=>o(d(e)),finishBrush:e=>{if(a===null)return;let t=d(e);Math.abs(t-a)>=l*.02&&u({end:Math.max(t,a),start:Math.min(t,a)}),o(null)},range:c,reset:()=>{n?.([e.start,e.end]),t||i(null)},viewChanged:c.start!==e.start||c.end!==e.end,zoom:(t,n)=>{let r=d(t),i=n<0?.75:1.25,a=Math.max(1,e.end-e.start),o=Math.min(a,Math.max(a/100,l*i)),s=r-o*((r-c.start)/l);s=Math.max(e.start,Math.min(s,e.end-o)),u({end:s+o,start:s})}}}function St({axis:e,cursor:t,crosshair:n=!0,ticks:r,expanded:i=!1,getFailureExcerpt:a,items:o,label:s=`Timeline`,lanes:c,markers:l=[],onExpandedChange:u,onRangeChange:d,onSelect:f,range:p,selectedId:m}){let h=(0,R.useId)(),[g,_]=(0,R.useState)(1e3),[v,y]=(0,R.useState)(null),[b,x]=(0,R.useState)(null),S=(0,R.useMemo)(()=>o.filter(e=>Number.isFinite(e.start)),[o]),E=(0,R.useMemo)(()=>l.filter(e=>Number.isFinite(e.at)),[l]),D=(0,R.useMemo)(()=>c?[...c]:[...new Set(S.map(mt))].map(e=>({id:e,label:e===ft?`Events`:e})),[c,S]),O=(0,R.useMemo)(()=>{let e=[...S.flatMap(e=>[e.start,ht(e)]),...E.map(e=>e.at)];if(e.length===0)return{end:1,start:0};let t=Math.min(...e),n=Math.max(...e);return{end:n>t?n:t+1,start:t}},[S,E]),k=xt(O,p,d),{axis:A,range:j}=k,M=S.length>0||E.length>0;(0,R.useEffect)(()=>{if(!M)return;let e=A.current;if(!e)return;let t=()=>_(e.getBoundingClientRect().width||1e3);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[A,M]),(0,R.useEffect)(()=>{m&&A.current?.querySelector(`[data-selected="true"]`)?.scrollIntoView?.({block:`nearest`})},[A,m]);let N=Math.max(1,j.end-j.start),P=e=>(e-j.start)/N*100,F=i?D:[{id:`overlay`,label:`All events`}],I=e?.origin??O.start,L=r?.minSpacingPx,ee=N*(L!==void 0&&Number.isFinite(L)&&L>0?L:80)/g,te=[1e3,2e3,5e3,1e4,15e3,3e4,6e4,12e4,3e5,6e5,9e5,18e5,36e5].find(e=>e>=ee)??Math.ceil(ee/36e5)*36e5,ne=[];for(let e=Math.ceil(j.start/te)*te;e<=j.end;e+=te)ne.push(e);let re=v===null?null:j.start+v*N,ie=e=>{let t=ht(e);if(t<j.start||e.start>j.end)return null;let n=Math.max(0,P(Math.max(e.start,j.start))),r=Math.max(.8,P(Math.min(t,j.end))-n),i=t<=e.start,o=`timeline-detail-${h}-${e.id.replace(/[^a-zA-Z0-9_-]/g,`-`)}`,s=pt(mt(e));return(0,z.jsxs)(`div`,{className:`absolute inset-y-0`,style:{left:`${n}%`},children:[(0,z.jsx)(`button`,{"aria-describedby":o,"aria-label":`${e.label}, ${i?`point event`:`span`}`,"aria-pressed":m===e.id,"aria-current":m===e.id?`true`:void 0,"data-turn-id":e.turnId,"data-tool-call-id":e.toolCallId,"data-event-index":e.eventIndex,className:C(`absolute top-0 h-5 border-2 border-card shadow-sm hover:opacity-80 focus-visible:z-20`,i?`w-5 -translate-x-1/2 rounded-full`:`min-w-1 rounded-md`,m===e.id&&`ring-2 ring-foreground ring-offset-1`,s),"data-lane-color":s,"data-selected":m===e.id?`true`:`false`,"data-timeline-shape":i?`point`:`span`,onBlur:()=>x(null),onClick:t=>{t.stopPropagation(),x(e.id),f?.(e)},onFocus:()=>x(e.id),onMouseEnter:()=>x(e.id),onMouseLeave:()=>x(null),style:{width:i?void 0:`${r}cqw`},type:`button`,children:i?(0,z.jsx)(w,{"aria-hidden":`true`,className:`m-auto size-2 fill-current text-white`}):null}),(0,z.jsx)(`span`,{className:C(`pointer-events-none absolute z-30 w-80 rounded-md bg-popover px-2.5 py-2 text-[10px] text-popover-foreground shadow-lg`,b===e.id?`block`:`sr-only`),id:o,role:b===e.id?`tooltip`:void 0,style:{top:`1.4rem`},children:bt(e,a?.(e))})]},e.id)};return(0,z.jsxs)(`section`,{"aria-label":s,className:`timeline rounded-xl border bg-card p-4`,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`div`,{"aria-label":`Timeline legend`,className:`flex flex-wrap gap-3`,role:`list`,children:D.map(e=>(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground`,role:`listitem`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:C(`size-2 rounded-full`,pt(e.id))}),e.label]},e.id))}),(0,z.jsxs)(`div`,{className:`flex gap-1`,children:[(0,z.jsxs)(`button`,{"aria-label":i?`Collapse timeline`:`Expand timeline`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,onClick:()=>u?.(!i),type:`button`,children:[i?(0,z.jsx)(Ie,{"aria-hidden":`true`,className:`size-3`}):(0,z.jsx)(Pe,{"aria-hidden":`true`,className:`size-3`}),i?`Collapse`:`Expand`]}),(0,z.jsxs)(`button`,{"aria-label":`Reset timeline zoom`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted disabled:opacity-40`,disabled:!k.viewChanged,onClick:k.reset,type:`button`,children:[(0,z.jsx)(T,{"aria-hidden":`true`,className:`size-3`}),` Reset zoom`]})]})]}),S.length===0&&E.length===0?(0,z.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:`No timeline events recorded.`}):(0,z.jsxs)(`div`,{"aria-label":`Timeline plot. Scroll to zoom or drag to select a range.`,className:`relative touch-none select-none overflow-hidden rounded-lg border bg-muted/40 pb-3 pt-7`,onPointerMove:e=>{let t=e.currentTarget.getBoundingClientRect();y(Math.min(1,Math.max(0,(e.clientX-t.left)/(t.width||1e3))))},onPointerLeave:()=>y(null),onPointerDown:e=>k.brushStart(e.clientX),onPointerUp:e=>k.finishBrush(e.clientX),onWheel:e=>{e.preventDefault(),k.zoom(e.clientX,e.deltaY)},ref:A,children:[n&&re!==null?(0,z.jsx)(`div`,{"aria-label":`Timeline crosshair`,className:`pointer-events-none absolute inset-y-0 z-30 border-l border-foreground`,style:{left:`${(v??0)*100}%`},children:(0,z.jsxs)(`span`,{className:`absolute top-0 whitespace-nowrap bg-popover text-[10px] text-popover-foreground`,style:{transform:(v??0)>.5?`translateX(-100%)`:void 0},children:[vt(re),` `,_t(re-I)]})}):null,(0,z.jsxs)(`div`,{className:`relative grid gap-2`,style:{containerType:`inline-size`},children:[F.map(e=>(0,z.jsxs)(`div`,{className:`relative h-6 border-b border-border/60`,"data-lane-id":e.id,"data-testid":`timeline-lane`,children:[i?(0,z.jsx)(`span`,{className:`sr-only`,children:e.label}):null,(i?S.filter(t=>mt(t)===e.id):S).map(ie)]},e.id)),E.map(e=>e.at<j.start||e.at>j.end?null:(0,z.jsxs)(`div`,{className:`pointer-events-none absolute inset-y-0 z-20`,style:{left:`${P(e.at)}%`},children:[(0,z.jsx)(`span`,{className:`absolute inset-y-0 w-px bg-foreground/60`,"data-testid":`timeline-marker-line`}),(0,z.jsx)(`button`,{"aria-label":`${e.label}, marker`,"aria-pressed":m===e.id,className:C(`pointer-events-auto absolute bottom-full left-1/2 mb-1 flex size-5 -translate-x-1/2 items-center justify-center rounded-full bg-card text-foreground shadow`,m===e.id&&`ring-2 ring-foreground`),"data-selected":m===e.id?`true`:`false`,onClick:t=>{t.stopPropagation(),f?.(e)},type:`button`,children:e.icon??(0,z.jsx)(Ke,{"aria-hidden":`true`,className:`size-3`})})]},e.id)),typeof t==`number`&&Number.isFinite(t)&&t>=j.start&&t<=j.end?(0,z.jsx)(`span`,{"aria-label":`Timeline cursor`,className:`pointer-events-none absolute inset-y-0 z-10 w-px bg-primary`,"data-testid":`timeline-cursor`,style:{left:`${P(t)}%`}}):null]}),(0,z.jsx)(`div`,{className:`relative mt-2 h-4 font-mono text-[9px] text-subtle`,"data-testid":`timeline-axis`,"data-timeline-axis":!0,children:ne.map(e=>(0,z.jsx)(`span`,{"data-tick-time":e,className:`absolute`,style:{left:`${P(e)}%`,transform:e===j.end?`translateX(-100%)`:void 0},children:yt(e,I)},e))})]})]})}var Ct=Object.defineProperty,wt=(e,t)=>Ct(e,`name`,{value:t,configurable:!0});function Tt(e,t){let n=R.createContext(t);n.displayName=e+`Context`;let r=wt(e=>{let{children:t,...r}=e,i=R.useMemo(()=>r,Object.values(r));return(0,z.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=R.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return wt(i,`useContext`),[r,i]}wt(Tt,`createContext`);function Et(e,t=[]){let n=[];function r(t,r){let i=R.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=wt(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=R.useMemo(()=>o,Object.values(o));return(0,z.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=R.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return wt(s,`useContext`),[o,s]}wt(r,`createContext`);let i=wt(()=>{let t=n.map(e=>R.createContext(e));return wt(function(n){let r=n?.[e]||t;return R.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Dt(i,...t)]}wt(Et,`createContextScope`);function Dt(...e){let t=e[0];if(e.length===1)return t;let n=wt(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return wt(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return R.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}wt(Dt,`composeContextScopes`);var Ot=Object.defineProperty,kt=(e,t)=>Ot(e,`name`,{value:t,configurable:!0});function At(e){let t=e+`CollectionProvider`,[n,r]=Et(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=kt(e=>{let{scope:t,children:n}=e,r=R.useRef(null),a=R.useRef(new Map).current;return(0,z.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=S(s),l=R.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=x(t,a(s,n).collectionRef);return(0,z.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=S(u),p=R.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=R.useRef(null),s=x(t,o),c=a(u,n);return R.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,z.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return R.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return kt(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}kt(At,`createCollection`);var jt=new WeakMap,Mt=class e extends Map{static{kt(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],jt.set(this,!0)}set(e,t){return jt.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=Ft(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=Nt(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=Nt(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Nt(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function Nt(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=Pt(e,t);return n===-1?void 0:e[n]}kt(Nt,`at`);function Pt(e,t){let n=e.length,r=Ft(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}kt(Pt,`toSafeIndex`);function Ft(e){return e!==e||e===0?0:Math.trunc(e)}kt(Ft,`toSafeInteger`);function It(e){let t=e+`CollectionProvider`,[n,r]=Et(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Mt,setItemMap:kt(()=>void 0,`setItemMap`)}),o=kt(({state:e,...t})=>e?(0,z.jsx)(c,{...t,state:e}):(0,z.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=kt(e=>{let t=h();return(0,z.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=kt(e=>{let{scope:t,children:n,state:r}=e,a=R.useRef(null),[o,s]=R.useState(null),c=x(a,s),[l,u]=r;return R.useEffect(()=>{if(!o)return;let e=Bt(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,z.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=S(l),d=R.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=x(t,a(l,n).collectionRef);return(0,z.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=S(f),m=R.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=R.useRef(null),[s,c]=R.useState(null),l=x(t,o,c),{setItemMap:u}=a(f,n),d=R.useRef(i);Lt(d.current,i)||(d.current=i);let m=d.current;return R.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(zt):(t.set(s,{...e,element:s}),t.toSorted(zt)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new Mt(e)))}},[s,m,u]),(0,z.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return R.useState(new Mt)}kt(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return kt(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}kt(It,`createCollection`);function Lt(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}kt(Lt,`shallowEqual`);function Rt(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}kt(Rt,`isElementPreceding`);function zt(e,t){return!e[1].element||!t[1].element?0:Rt(e[1].element,t[1].element)?-1:1}kt(zt,`sortByDocumentPosition`);function Bt(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}kt(Bt,`getChildListObserver`);var Vt=Object.defineProperty,Ht=(e,t)=>Vt(e,`name`,{value:t,configurable:!0}),Ut=!!(typeof window<`u`&&window.document&&window.document.createElement);function Wt(e,t,{checkForDefaultPrevented:n=!0}={}){return Ht(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Ht(Wt,`composeEventHandlers`);function Gt(e){if(!Ut)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Ht(Gt,`getOwnerWindow`);function Kt(e){if(!Ut)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Ht(Kt,`getOwnerDocument`);function qt(e,t=!1){let{activeElement:n}=Kt(e);if(!n?.nodeName)return null;if(Jt(n)&&n.contentDocument)return qt(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=Kt(n).getElementById(e);if(t)return t}}return n}Ht(qt,`getActiveElement`);function Jt(e){return e.tagName===`IFRAME`}Ht(Jt,`isFrame`);var Yt=globalThis?.document?R.useLayoutEffect:()=>{},Xt=Object.defineProperty,Zt=(e,t)=>Xt(e,`name`,{value:t,configurable:!0}),Qt=R.useEffectEvent,$t=R.useInsertionEffect;function en(e){if(typeof Qt==`function`)return Qt(e);let t=R.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof $t==`function`?$t(()=>{t.current=e}):Yt(()=>{t.current=e}),R.useMemo(()=>((...e)=>t.current?.(...e)),[])}Zt(en,`useEffectEvent`);var tn=Object.defineProperty,nn=(e,t)=>tn(e,`name`,{value:t,configurable:!0}),rn=R.useInsertionEffect||Yt;function an({prop:e,defaultProp:t,onChange:n=nn(()=>{},`onChange`),caller:r}){let[i,a,o]=on({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,R.useCallback(t=>{if(s){let n=sn(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}nn(an,`useControllableState`);function on({defaultProp:e,onChange:t}){let[n,r]=R.useState(e),i=R.useRef(n),a=R.useRef(t);return rn(()=>{a.current=t},[t]),R.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}nn(on,`useUncontrolledState`);function sn(e){return typeof e==`function`}nn(sn,`isFunction`);var cn=Symbol(`RADIX:SYNC_STATE`);function ln(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=en(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=R.useReducer((t,n)=>{if(n.type===cn)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=R.useRef(p);R.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=R.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return R.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:cn,state:i})},[i,d.state,c]),[h,f]}nn(ln,`useControllableStateReducer`);var un=pe(ve(),1),dn=Object.defineProperty,fn=(e,t)=>dn(e,`name`,{value:t,configurable:!0}),pn=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=S(`Primitive.${t}`),r=R.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,z.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function mn(e,t){e&&un.flushSync(()=>e.dispatchEvent(t))}fn(mn,`dispatchDiscreteCustomEvent`);var hn=Object.defineProperty,gn=(e,t)=>hn(e,`name`,{value:t,configurable:!0});function _n(e,t){return R.useReducer((e,n)=>t[e][n]??e,e)}gn(_n,`useStateMachine`);var vn=gn(e=>{let{present:t,children:n}=e,r=yn(t),i=typeof n==`function`?n({present:r.isPresent}):R.Children.only(n),a=xn(r.ref,Cn(i));return typeof n==`function`||r.isPresent?R.cloneElement(i,{ref:a}):null},`Presence`);function yn(e){let[t,n]=R.useState(),r=R.useRef(null),i=R.useRef(e),a=R.useRef(`none`),o=R.useRef(void 0),[s,c]=_n(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return R.useEffect(()=>{s===`mounted`?(a.current=o.current??Sn(r.current),o.current=void 0):a.current=`none`},[s]),Yt(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Sn(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Yt(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=gn(a=>{let o=Sn(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=gn(e=>{e.target===t&&(a.current=Sn(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:R.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Sn(t)}else r.current=null;n(e)},[])}}gn(yn,`usePresence`);function bn(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}gn(bn,`setRef`);function xn(...e){let t=R.useRef(e);return t.current=e,R.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=bn(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():bn(n[e],null)}}},[])}gn(xn,`useStableComposedRefs`);function Sn(e){return e?.animationName||`none`}gn(Sn,`getAnimationName`);function Cn(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}gn(Cn,`getElementRef`);var wn=Object.defineProperty,Tn=(e,t)=>wn(e,`name`,{value:t,configurable:!0}),En=R.useId||(()=>void 0),Dn=0;function On(e){let[t,n]=R.useState(En());return Yt(()=>{e||n(e=>e??String(Dn++))},[e]),e||(t?`radix-${t}`:``)}Tn(On,`useId`);var kn=Object.defineProperty,An=(e,t)=>kn(e,`name`,{value:t,configurable:!0}),jn=`Collapsible`,[Mn,Nn]=Et(jn),[Pn,Fn]=Mn(jn),In=R.forwardRef(An(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=an({prop:r,defaultProp:i??!1,onChange:o,caller:jn});return(0,z.jsx)(Pn,{scope:n,disabled:a,contentId:On(),open:c,onOpenToggle:R.useCallback(()=>l(e=>!e),[l]),children:(0,z.jsx)(pn.div,{"data-state":Hn(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),Ln=`CollapsibleTrigger`,Rn=R.forwardRef(An(function(e,t){let{__scopeCollapsible:n,...r}=e,i=Fn(Ln,n);return(0,z.jsx)(pn.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Hn(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:Wt(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),zn=`CollapsibleContent`,Bn=R.forwardRef(An(function(e,t){let{forceMount:n,...r}=e,i=Fn(zn,e.__scopeCollapsible);return(0,z.jsx)(vn,{present:n||i.open,children:({present:e})=>(0,z.jsx)(Vn,{...r,ref:t,present:e})})},`CollapsibleContent`)),Vn=R.forwardRef(An(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Fn(zn,n),[s,c]=R.useState(r),l=R.useRef(null),u=x(t,l),d=R.useRef(0),f=d.current,p=R.useRef(0),m=p.current,h=o.open||s,g=R.useRef(h),_=R.useRef(void 0);return R.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),Yt(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,z.jsx)(pn.div,{"data-state":Hn(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})},`CollapsibleContentImpl`));function Hn(e){return e?`open`:`closed`}An(Hn,`getState`);var Un=In,Wn=Rn,Gn=Bn,Kn=Object.defineProperty,qn=(e,t)=>Kn(e,`name`,{value:t,configurable:!0}),Jn=R.createContext(void 0);function Yn(e){let t=R.useContext(Jn);return e||t||`ltr`}qn(Yn,`useDirection`);var Xn=Object.defineProperty,Zn=(e,t)=>Xn(e,`name`,{value:t,configurable:!0}),Qn=`Accordion`,$n=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[er,tr,nr]=At(Qn),[rr,ir]=Et(Qn,[nr,Nn]),ar=Nn(),or=R.forwardRef(Zn(function(e,t){let{type:n,...r}=e,i=r,a=r;return(0,z.jsx)(er.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,z.jsx)(fr,{...a,ref:t}):(0,z.jsx)(dr,{...i,ref:t})})},`Accordion`)),[sr,cr]=rr(Qn),[lr,ur]=rr(Qn,{collapsible:!1}),dr=R.forwardRef(Zn(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Zn(()=>{},`onValueChange`),collapsible:a=!1,...o}=e,[s,c]=an({prop:n,defaultProp:r??``,onChange:i,caller:Qn});return(0,z.jsx)(sr,{scope:e.__scopeAccordion,value:R.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:R.useCallback(()=>a&&c(``),[a,c]),children:(0,z.jsx)(lr,{scope:e.__scopeAccordion,collapsible:a,children:(0,z.jsx)(hr,{...o,ref:t})})})},`AccordionImplSingle`)),fr=R.forwardRef(Zn(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Zn(()=>{},`onValueChange`),...a}=e,[o,s]=an({prop:n,defaultProp:r??[],onChange:i,caller:Qn}),c=R.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=R.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,z.jsx)(sr,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,z.jsx)(lr,{scope:e.__scopeAccordion,collapsible:!0,children:(0,z.jsx)(hr,{...a,ref:t})})})},`AccordionImplMultiple`)),[pr,mr]=rr(Qn),hr=R.forwardRef(Zn(function(e,t){let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=x(R.useRef(null),t),c=tr(n),l=Yn(i)===`ltr`,u=Wt(e.onKeyDown,e=>{if(!$n.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=Zn(()=>{o=r+1,o>s&&(o=0)},`moveNext`),d=Zn(()=>{o=r-1,o<0&&(o=s)},`movePrev`);switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,z.jsx)(pr,{scope:n,disabled:r,direction:i,orientation:a,children:(0,z.jsx)(er.Slot,{scope:n,children:(0,z.jsx)(pn.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})},`AccordionImpl`)),gr=`AccordionItem`,[_r,vr]=rr(gr),yr=R.forwardRef(Zn(function(e,t){let{__scopeAccordion:n,value:r,...i}=e,a=mr(gr,n),o=cr(gr,n),s=ar(n),c=On(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,z.jsx)(_r,{scope:n,open:l,disabled:u,triggerId:c,children:(0,z.jsx)(Un,{"data-orientation":a.orientation,"data-state":Er(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})},`AccordionItem`)),br=`AccordionHeader`,xr=R.forwardRef(Zn(function(e,t){let{__scopeAccordion:n,...r}=e,i=mr(Qn,n),a=vr(br,n);return(0,z.jsx)(pn.h3,{"data-orientation":i.orientation,"data-state":Er(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`AccordionHeader`)),Sr=`AccordionTrigger`,Cr=R.forwardRef(Zn(function(e,t){let{__scopeAccordion:n,...r}=e,i=mr(Qn,n),a=vr(Sr,n),o=ur(Sr,n),s=ar(n);return(0,z.jsx)(er.ItemSlot,{scope:n,children:(0,z.jsx)(Wn,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})},`AccordionTrigger`)),wr=`AccordionContent`,Tr=R.forwardRef(Zn(function(e,t){let{__scopeAccordion:n,...r}=e,i=mr(Qn,n),a=vr(wr,n),o=ar(n);return(0,z.jsx)(Gn,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})},`AccordionContent`));function Er(e){return e?`open`:`closed`}Zn(Er,`getState`);var Dr=or,Or=yr,kr=xr,Ar=Cr,jr=Tr;function Mr({...e}){return(0,z.jsx)(Dr,{"data-slot":`accordion`,...e})}function Nr({className:e,...t}){return(0,z.jsx)(Or,{"data-slot":`accordion-item`,className:C(`border-b last:border-b-0`,e),...t})}function Pr({className:e,children:t,...n}){return(0,z.jsx)(kr,{className:`flex`,children:(0,z.jsxs)(Ar,{"data-slot":`accordion-trigger`,className:C(`flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180`,e),...n,children:[t,(0,z.jsx)(Pe,{className:`pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200`})]})})}function Fr({className:e,children:t,...n}){return(0,z.jsx)(jr,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,z.jsx)(`div`,{className:C(`pt-0 pb-4`,e),children:t})})}var Ir=De(`relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`border-destructive bg-destructive-surface text-destructive *:data-[slot=alert-description]:text-destructive [&>svg]:text-current`}},defaultVariants:{variant:`default`}});function Lr({className:e,variant:t,...n}){return(0,z.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:C(Ir({variant:t}),e),...n})}function Rr({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`alert-title`,className:C(`col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight`,e),...t})}function zr({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`alert-description`,className:C(`col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed`,e),...t})}var Br=Object.defineProperty,Vr=(e,t)=>Br(e,`name`,{value:t,configurable:!0});function Hr(e){let t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>((...e)=>t.current?.(...e)),[])}Vr(Hr,`useCallbackRef`);var Ur=Object.defineProperty,Wr=(e,t)=>Ur(e,`name`,{value:t,configurable:!0}),Gr=`Avatar`,[Kr,qr]=Et(Gr),Jr=[0,()=>void 0],[Yr,Xr]=Kr(Gr),Zr=R.forwardRef(Wr(function(e,t){let{__scopeAvatar:n,...r}=e,[i,a]=R.useState(`idle`),[o,s]=ni();return(0,z.jsx)(Yr,{scope:n,imageLoadingStatus:i,setImageLoadingStatus:a,imageCount:o,setImageCount:s,children:(0,z.jsx)(pn.span,{...r,ref:t})})},`Avatar`)),Qr=`AvatarFallback`,$r=R.forwardRef(Wr(function(e,t){let{__scopeAvatar:n,delayMs:r,...i}=e,a=Xr(Qr,n),[o,s]=R.useState(r===void 0);return R.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,z.jsx)(pn.span,{...i,ref:t}):null},`AvatarFallback`));function ei(e,{loadingStatus:t,setLoadingStatus:n,referrerPolicy:r,crossOrigin:i}){return Yt(()=>{if(!e){n(`error`);return}let t=new window.Image,a=Wr(e=>{let t=e.currentTarget;n(ti(t))},`handleLoad`),o=Wr(()=>n(`error`),`handleError`);return t.addEventListener(`load`,a),t.addEventListener(`error`,o),r&&(t.referrerPolicy=r),t.crossOrigin=i??null,t.src=e,n(ti(t)),()=>{t.removeEventListener(`load`,a),t.removeEventListener(`error`,o),n(`idle`)}},[e,i,r,n]),t}Wr(ei,`useImageLoadingStatus`);function ti(e){return e.complete?e.naturalWidth>0?`loaded`:`error`:`loading`}Wr(ti,`getImageLoadingStatus`);function ni(){return Jr}Wr(ni,`useImageCount`);function ri(e){}Wr(ri,`useUpdateImageCount`);function ii({className:e,size:t=`default`,...n}){return(0,z.jsx)(Zr,{"data-slot":`avatar`,"data-size":t,className:C(`group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6`,e),...n})}function ai({className:e,...t}){return(0,z.jsx)($r,{"data-slot":`avatar-fallback`,className:C(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function oi({className:e,...t}){return(0,z.jsx)(`img`,{className:C(`aspect-square size-full object-cover`,e),"data-slot":`avatar-image`,...t})}var si=De(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`border border-destructive bg-destructive-surface text-destructive hover:bg-destructive-surface/80 focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function ci({className:e,variant:t=`default`,size:r=`default`,asChild:i=!1,...a}){return(0,z.jsx)(i?n:`button`,{"data-slot":`button`,"data-variant":t,"data-size":r,className:C(si({variant:t,size:r,className:e})),...a})}function li({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`card`,className:C(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function ui({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`card-content`,className:C(`px-6`,e),...t})}var di=Object.defineProperty,fi=(e,t)=>di(e,`name`,{value:t,configurable:!0}),pi=`dismissableLayer.update`,mi=`dismissableLayer.pointerDownOutside`,hi=`dismissableLayer.focusOutside`,gi,_i=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),vi=R.forwardRef(fi(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=R.useContext(_i),[d,f]=R.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=R.useState({}),h=x(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,S=y>=v,C=R.useRef(!1),w=xi(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:R.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),T=Si(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),E=d?y===g.length-1:!1,D=Hr(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return R.useEffect(()=>{if(E)return p.addEventListener(`keydown`,D,{capture:!0}),()=>p.removeEventListener(`keydown`,D,{capture:!0})},[p,E,D]),R.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(gi=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ci(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=gi))}},[d,p,n,u]),R.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ci())},[d,u]),R.useEffect(()=>{let e=fi(()=>m({}),`handleUpdate`);return document.addEventListener(pi,e),()=>document.removeEventListener(pi,e)},[]),(0,z.jsx)(pn.div,{...l,ref:h,style:{pointerEvents:b?S?`auto`:`none`:void 0,...e.style},onFocusCapture:Wt(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Wt(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Wt(e.onPointerDownCapture,w.onPointerDownCapture)})},`DismissableLayer`));function yi(){let e=R.useContext(_i),[t,n]=R.useState(null);return R.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}fi(yi,`useDismissableLayerSurface`);var bi=fi(()=>!0,`IS_TRUE`);function xi(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=bi}=t,s=Hr(e),c=R.useRef(!1),l=R.useRef(!1),u=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}fi(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}fi(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}fi(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}fi(p,`handleInteractionBubble`);let m=fi(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||wi(mi,s,p,{discrete:!0})};if(fi(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:fi(()=>c.current=!0,`onPointerDownCapture`)}}fi(xi,`usePointerDownOutside`);function Si(e,t=globalThis?.document){let n=Hr(e),r=R.useRef(!1);return R.useEffect(()=>{let e=fi(e=>{e.target&&!r.current&&wi(hi,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:fi(()=>r.current=!0,`onFocusCapture`),onBlurCapture:fi(()=>r.current=!1,`onBlurCapture`)}}fi(Si,`useFocusOutside`);function Ci(){let e=new CustomEvent(pi);document.dispatchEvent(e)}fi(Ci,`dispatchUpdate`);function wi(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?mn(i,a):i.dispatchEvent(a)}fi(wi,`handleAndDispatchCustomEvent`);var Ti=Object.defineProperty,Ei=(e,t)=>Ti(e,`name`,{value:t,configurable:!0}),Di=`focusScope.autoFocusOnMount`,Oi=`focusScope.autoFocusOnUnmount`,ki={bubbles:!1,cancelable:!0},Ai=R.forwardRef(Ei(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=R.useState(null),l=Hr(i),u=Hr(a),d=R.useRef(null),f=x(t,c),p=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Li(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Li(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Li(s)};Ei(e,`handleFocusIn`),Ei(t,`handleFocusOut`),Ei(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),R.useEffect(()=>{if(s){Ri.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Di,ki);s.addEventListener(Di,l),s.dispatchEvent(t),t.defaultPrevented||(ji(Vi(Ni(s)),{select:!0}),document.activeElement===e&&Li(s))}return()=>{s.removeEventListener(Di,l),setTimeout(()=>{let t=new CustomEvent(Oi,ki);s.addEventListener(Oi,u),s.dispatchEvent(t),t.defaultPrevented||Li(e??document.body,{select:!0}),s.removeEventListener(Oi,u),Ri.remove(p)},0)}}},[s,l,u,p]);let m=R.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Mi(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Li(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Li(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,z.jsx)(pn.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function ji(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Li(r,{select:t}),document.activeElement!==n)return}Ei(ji,`focusFirst`);function Mi(e){let t=Ni(e);return[Pi(t,e),Pi(t.reverse(),e)]}Ei(Mi,`getTabbableEdges`);function Ni(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Ei(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Ei(Ni,`getTabbableCandidates`);function Pi(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Fi(r,{upTo:t})))return r}Ei(Pi,`findVisible`);function Fi(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Ei(Fi,`isHidden`);function Ii(e){return e instanceof HTMLInputElement&&`select`in e}Ei(Ii,`isSelectableInput`);function Li(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ii(e)&&t&&e.select()}}Ei(Li,`focus`);var Ri=zi();function zi(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Bi(e,t),e.unshift(t)},remove(t){e=Bi(e,t),e[0]?.resume()}}}Ei(zi,`createFocusScopesStack`);function Bi(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Ei(Bi,`arrayRemove`);function Vi(e){return e.filter(e=>e.tagName!==`A`)}Ei(Vi,`removeLinks`);var Hi=Object.defineProperty,Ui=R.forwardRef(((e,t)=>Hi(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=R.useState(!1);Yt(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?un.createPortal((0,z.jsx)(pn.div,{...r,ref:t}),o):null},`Portal`)),Wi=Object.defineProperty,Gi=(e,t)=>Wi(e,`name`,{value:t,configurable:!0}),Ki=0,qi=null;function Ji(e){return Yi(),e.children}Gi(Ji,`FocusGuards`);function Yi(){R.useEffect(()=>{qi||={start:Xi(),end:Xi()};let{start:e,end:t}=qi;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Ki++,()=>{Ki===1&&(qi?.start.remove(),qi?.end.remove(),qi=null),Ki=Math.max(0,Ki-1)}},[])}Gi(Yi,`useFocusGuards`);function Xi(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}Gi(Xi,`createFocusGuard`);var Zi=function(){return Zi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Zi.apply(this,arguments)};function Qi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function $i(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ea=`right-scroll-bar-position`,ta=`width-before-scroll-bar`,na=`with-scroll-bars-hidden`,ra=`--removed-body-scroll-bar-size`;function ia(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function aa(e,t){var n=(0,R.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var oa=typeof window<`u`?R.useLayoutEffect:R.useEffect,sa=new WeakMap;function ca(e,t){var n=aa(t||null,function(t){return e.forEach(function(e){return ia(e,t)})});return oa(function(){var t=sa.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||ia(e,null)}),i.forEach(function(e){r.has(e)||ia(e,a)})}sa.set(n,e)},[e]),n}function la(e){return e}function ua(e,t){t===void 0&&(t=la);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function da(e){e===void 0&&(e={});var t=ua(null);return t.options=Zi({async:!0,ssr:!1},e),t}var fa=function(e){var t=e.sideCar,n=Qi(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return R.createElement(r,Zi({},n))};fa.isSideCarExport=!0;function pa(e,t){return e.useMedium(t),fa}var ma=da(),ha=function(){},ga=R.forwardRef(function(e,t){var n=R.useRef(null),r=R.useState({onScrollCapture:ha,onWheelCapture:ha,onTouchMoveCapture:ha}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Qi(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=ca([n,t]),C=Zi(Zi({},b),i);return R.createElement(R.Fragment,null,u&&R.createElement(x,{sideCar:ma,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?R.cloneElement(R.Children.only(s),Zi(Zi({},C),{ref:S})):R.createElement(v,Zi({},C,{className:c,ref:S}),s))});ga.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},ga.classNames={fullWidth:ta,zeroRight:ea};var _a,va=function(){if(_a)return _a;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ya(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=va();return t&&e.setAttribute(`nonce`,t),e}function ba(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xa(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Sa=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ya())&&(ba(t,n),xa(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ca=function(){var e=Sa();return function(t,n){R.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},wa=function(){var e=Ca();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Ta={left:0,top:0,right:0,gap:0},Ea=function(e){return parseInt(e||``,10)||0},Da=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Ea(n),Ea(r),Ea(i)]},Oa=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Ta;var t=Da(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])}},ka=wa(),Aa=`data-scroll-locked`,ja=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
|
-
.${na} {
|
|
3
|
-
overflow: hidden ${r};
|
|
4
|
-
padding-right: ${s}px ${r};
|
|
5
|
-
}
|
|
6
|
-
body[${Aa}] {
|
|
7
|
-
overflow: hidden ${r};
|
|
8
|
-
overscroll-behavior: contain;
|
|
9
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
10
|
-
padding-left: ${i}px;
|
|
11
|
-
padding-top: ${a}px;
|
|
12
|
-
padding-right: ${o}px;
|
|
13
|
-
margin-left:0;
|
|
14
|
-
margin-top:0;
|
|
15
|
-
margin-right: ${s}px ${r};
|
|
16
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.${ea} {
|
|
20
|
-
right: ${s}px ${r};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.${ta} {
|
|
24
|
-
margin-right: ${s}px ${r};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.${ea} .${ea} {
|
|
28
|
-
right: 0 ${r};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.${ta} .${ta} {
|
|
32
|
-
margin-right: 0 ${r};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body[${Aa}] {
|
|
36
|
-
${ra}: ${s}px;
|
|
37
|
-
}
|
|
38
|
-
`},Ma=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Na=function(){R.useEffect(function(){return document.body.setAttribute(Aa,(Ma()+1).toString()),function(){var e=Ma()-1;e<=0?document.body.removeAttribute(Aa):document.body.setAttribute(Aa,e.toString())}},[])},Pa=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Na();var a=R.useMemo(function(){return Oa(i)},[i]);return R.createElement(ka,{styles:ja(a,!t,i,n?``:`!important`)})},Fa=!1;if(typeof window<`u`)try{var Ia=Object.defineProperty({},"passive",{get:function(){return Fa=!0,!0}});window.addEventListener(`test`,Ia,Ia),window.removeEventListener(`test`,Ia,Ia)}catch{Fa=!1}var La=Fa?{passive:!1}:!1,Ra=function(e){return e.tagName===`TEXTAREA`},za=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ra(e)&&n[t]===`visible`)},Ba=function(e){return za(e,`overflowY`)},Va=function(e){return za(e,`overflowX`)},Ha=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Ga(e,r)){var i=Ka(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ua=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Wa=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Ga=function(e,t){return e===`v`?Ba(t):Va(t)},Ka=function(e,t){return e===`v`?Ua(t):Wa(t)},qa=function(e,t){return e===`h`&&t===`rtl`?-1:1},Ja=function(e,t,n,r,i){var a=qa(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=Ka(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Ga(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},Ya=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Xa=function(e){return[e.deltaX,e.deltaY]},Za=function(e){return e&&`current`in e?e.current:e},Qa=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$a=function(e){return`
|
|
39
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
40
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
41
|
-
`},eo=0,to=[];function no(e){var t=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(eo++)[0],a=R.useState(wa)[0],o=R.useRef(e);R.useEffect(function(){o.current=e},[e]),R.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=$i([e.lockRef.current],(e.shards||[]).map(Za),!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=R.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ya(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=Ha(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ha(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 Ja(h,t,e,h===`h`?s:c,!0)},[]),c=R.useCallback(function(e){var n=e;if(!(!to.length||to[to.length-1]!==a)){var r=`deltaY`in n?Xa(n):Ya(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Qa(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Za).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=R.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ro(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=R.useCallback(function(e){n.current=Ya(e),r.current=void 0},[]),d=R.useCallback(function(t){l(t.type,Xa(t),t.target,s(t,e.lockRef.current))},[]),f=R.useCallback(function(t){l(t.type,Ya(t),t.target,s(t,e.lockRef.current))},[]);R.useEffect(function(){return to.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,La),document.addEventListener(`touchmove`,c,La),document.addEventListener(`touchstart`,u,La),function(){to=to.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,La),document.removeEventListener(`touchmove`,c,La),document.removeEventListener(`touchstart`,u,La)}},[]);var p=e.removeScrollBar,m=e.inert;return R.createElement(R.Fragment,null,m?R.createElement(a,{styles:$a(i)}):null,p?R.createElement(Pa,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ro(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var io=pa(ma,no),ao=R.forwardRef(function(e,t){return R.createElement(ga,Zi({},e,{ref:t,sideCar:io}))});ao.classNames=ga.classNames;var oo=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},so=new WeakMap,co=new WeakMap,lo={},uo=0,fo=function(e){return e&&(e.host||fo(e.parentNode))},po=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=fo(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},mo=function(e,t,n,r){var i=po(t,Array.isArray(e)?e:[e]);lo[n]||(lo[n]=new WeakMap);var a=lo[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(so.get(e)||0)+1,l=(a.get(e)||0)+1;so.set(e,c),a.set(e,l),o.push(e),c===1&&i&&co.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),uo++,function(){o.forEach(function(e){var t=so.get(e)-1,i=a.get(e)-1;so.set(e,t),a.set(e,i),t||(co.has(e)||e.removeAttribute(r),co.delete(e)),i||e.removeAttribute(n)}),uo--,uo||(so=new WeakMap,so=new WeakMap,co=new WeakMap,lo={})}},ho=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||oo(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),mo(r,i,n,`aria-hidden`)):function(){return null}},go=Object.defineProperty,_o=(e,t)=>go(e,`name`,{value:t,configurable:!0}),vo=`Dialog`,[yo,bo]=Et(vo),[xo,So]=yo(vo),Co=_o(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=R.useRef(null),c=R.useRef(null),[l,u]=an({prop:r,defaultProp:i??!1,onChange:a,caller:vo}),[d,f]=R.useState(0),[p,m]=R.useState(0);return(0,z.jsx)(xo,{scope:t,triggerRef:s,contentRef:c,contentId:On(),titleId:On(),descriptionId:On(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:R.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),wo=`DialogPortal`,[To,Eo]=yo(wo,{forceMount:void 0}),Do=_o(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=So(wo,t);return(0,z.jsx)(To,{scope:t,forceMount:n,children:R.Children.map(r,e=>(0,z.jsx)(vn,{present:n||a.open,children:(0,z.jsx)(Ui,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Oo=`DialogOverlay`,ko=R.forwardRef(_o(function(e,t){let n=Eo(Oo,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=So(Oo,e.__scopeDialog);return a.modal?(0,z.jsx)(vn,{present:r||a.open,children:(0,z.jsx)(jo,{...i,ref:t})}):null},`DialogOverlay`)),Ao=S(`DialogOverlay.RemoveScroll`),jo=R.forwardRef(_o(function(e,t){let{__scopeDialog:n,...r}=e,i=So(Oo,n),a=x(t,yi());return(0,z.jsx)(ao,{as:Ao,allowPinchZoom:!0,shards:[i.contentRef],children:(0,z.jsx)(pn.div,{"data-state":Uo(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Mo=`DialogContent`,No=R.forwardRef(_o(function(e,t){let n=Eo(Mo,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=So(Mo,e.__scopeDialog);return(0,z.jsx)(vn,{present:r||a.open,children:a.modal?(0,z.jsx)(Po,{...i,ref:t}):(0,z.jsx)(Fo,{...i,ref:t})})},`DialogContent`)),Po=R.forwardRef(_o(function(e,t){let n=So(Mo,e.__scopeDialog),r=R.useRef(null),i=x(t,n.contentRef,r);return R.useEffect(()=>{let e=r.current;if(e)return ho(e)},[]),(0,z.jsx)(Io,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Wt(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Wt(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Wt(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Fo=R.forwardRef(_o(function(e,t){let n=So(Mo,e.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return(0,z.jsx)(Io,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Io=R.forwardRef(_o(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=So(Mo,n);return Yi(),(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(Ai,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,z.jsx)(vi,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Uo(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Lo=`DialogTitle`,Ro=R.forwardRef(_o(function(e,t){let{__scopeDialog:n,...r}=e,i=So(Lo,n),{setTitleCount:a}=i;return Yt(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,z.jsx)(pn.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),zo=`DialogDescription`,Bo=R.forwardRef(_o(function(e,t){let{__scopeDialog:n,...r}=e,i=So(zo,n),{setDescriptionCount:a}=i;return Yt(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,z.jsx)(pn.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Vo=`DialogClose`,Ho=R.forwardRef(_o(function(e,t){let{__scopeDialog:n,...r}=e,i=So(Vo,n);return(0,z.jsx)(pn.button,{type:`button`,...r,ref:t,onClick:Wt(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Uo(e){return e?`open`:`closed`}_o(Uo,`getState`);function Wo({...e}){return(0,z.jsx)(Co,{"data-slot":`dialog`,...e})}function Go({...e}){return(0,z.jsx)(Do,{"data-slot":`dialog-portal`,...e})}function Ko({...e}){return(0,z.jsx)(Ho,{"data-slot":`dialog-close`,...e})}function qo({className:e,...t}){return(0,z.jsx)(ko,{"data-slot":`dialog-overlay`,className:C(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Jo({className:e,children:t,showCloseButton:n=!0,...r}){return(0,z.jsxs)(Go,{"data-slot":`dialog-portal`,children:[(0,z.jsx)(qo,{}),(0,z.jsxs)(No,{"data-slot":`dialog-content`,className:C(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,z.jsxs)(Ho,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,z.jsx)(ut,{}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Yo({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`dialog-header`,className:C(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Xo({className:e,showCloseButton:t=!1,children:n,...r}){return(0,z.jsxs)(`div`,{"data-slot":`dialog-footer`,className:C(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,z.jsx)(Ho,{asChild:!0,children:(0,z.jsx)(ci,{variant:`outline`,children:`Close`})})]})}function Zo({className:e,...t}){return(0,z.jsx)(Ro,{"data-slot":`dialog-title`,className:C(`text-lg leading-none font-semibold`,e),...t})}function Qo({className:e,...t}){return(0,z.jsx)(Bo,{"data-slot":`dialog-description`,className:C(`text-sm text-muted-foreground`,e),...t})}function $o({className:e,type:t,...n}){return(0,z.jsx)(`input`,{type:t,"data-slot":`input`,className:C(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}var es=Object.defineProperty,ts=R.forwardRef(((e,t)=>es(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,z.jsx)(pn.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`));function ns({className:e,...t}){return(0,z.jsx)(ts,{"data-slot":`label`,className:C(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var rs=[`top`,`right`,`bottom`,`left`],is=Math.min,as=Math.max,os=Math.round,ss=Math.floor,cs=e=>({x:e,y:e}),ls={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function us(e,t,n){return as(e,is(t,n))}function ds(e,t){return typeof e==`function`?e(t):e}function fs(e){return e.split(`-`)[0]}function ps(e){return e.split(`-`)[1]}function ms(e){return e===`x`?`y`:`x`}function hs(e){return e===`y`?`height`:`width`}function gs(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function _s(e){return ms(gs(e))}function vs(e,t,n){n===void 0&&(n=!1);let r=ps(e),i=_s(e),a=hs(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ds(o)),[o,Ds(o)]}function ys(e){let t=Ds(e);return[bs(e),t,bs(t)]}function bs(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var xs=[`left`,`right`],Ss=[`right`,`left`],Cs=[`top`,`bottom`],ws=[`bottom`,`top`];function Ts(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ss:xs:t?xs:Ss;case`left`:case`right`:return t?Cs:ws;default:return[]}}function Es(e,t,n,r){let i=ps(e),a=Ts(fs(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(bs)))),a}function Ds(e){let t=fs(e);return ls[t]+e.slice(t.length)}function Os(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ks(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Os(e)}function As(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 js(e,t,n){let{reference:r,floating:i}=e,a=gs(t),o=_s(t),s=hs(o),c=fs(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=ps(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ms(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}=ds(t,e),p=ks(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=As(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=As(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 Ns=50,Ps=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ms},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=js(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ns&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=js(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Fs=e=>({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}=ds(e,t)||{};if(l==null)return{};let d=ks(u),f={x:n,y:r},p=_s(i),m=hs(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=is(d[_],T),D=is(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=us(E,k,O),j=!c.arrow&&ps(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Is=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ds(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=fs(r),_=gs(o),v=fs(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ds(o)]:ys(o)),x=p!==`none`;!d&&x&&b.push(...Es(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=vs(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==gs(t))||T.every(e=>gs(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=gs(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;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ls(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rs(e){return rs.some(t=>e[t]>=0)}var zs=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ds(e,t);switch(i){case`referenceHidden`:{let e=Ls(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Rs(e)}}}case`escaped`:{let e=Ls(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Rs(e)}}}default:return{}}}}},Bs=new Set([`left`,`top`]);async function Vs(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=fs(n),s=ps(n),c=gs(n)===`y`,l=Bs.has(o)?-1:1,u=a&&c?-1:1,d=ds(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 Hs=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 Vs(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}}}}},Us=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}=ds(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=gs(i),p=ms(f),m=u[p],h=u[f],g=(e,t)=>us(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}}}}}},Ws=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}=ds(e,t),u={x:n,y:r},d=gs(i),f=ms(d),p=u[f],m=u[d],h=ds(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;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Bs.has(fs(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);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Gs=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}=ds(e,t),c=await i.detectOverflow(t,s),l=fs(n),u=ps(n),d=gs(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=is(p-c[m],g),y=is(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*as(c.left,c.right):S=p-2*as(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 Ks(){return typeof window<`u`}function qs(e){return Xs(e)?(e.nodeName||``).toLowerCase():`#document`}function Js(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ys(e){return((Xs(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Xs(e){return Ks()?e instanceof Node||e instanceof Js(e).Node:!1}function Zs(e){return Ks()?e instanceof Element||e instanceof Js(e).Element:!1}function Qs(e){return Ks()?e instanceof HTMLElement||e instanceof Js(e).HTMLElement:!1}function $s(e){return!Ks()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Js(e).ShadowRoot}function ec(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=dc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function tc(e){return/^(table|td|th)$/.test(qs(e))}function nc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var rc=/transform|translate|scale|rotate|perspective|filter/,ic=/paint|layout|strict|content/,ac=e=>!!e&&e!==`none`,oc;function sc(e){let t=Zs(e)?dc(e):e;return ac(t.transform)||ac(t.translate)||ac(t.scale)||ac(t.rotate)||ac(t.perspective)||!lc()&&(ac(t.backdropFilter)||ac(t.filter))||rc.test(t.willChange||``)||ic.test(t.contain||``)}function cc(e){let t=pc(e);for(;Qs(t)&&!uc(t);){if(sc(t))return t;if(nc(t))return null;t=pc(t)}return null}function lc(){return oc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),oc}function uc(e){return/^(html|body|#document)$/.test(qs(e))}function dc(e){return Js(e).getComputedStyle(e)}function fc(e){return Zs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pc(e){if(qs(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||$s(e)&&e.host||Ys(e);return $s(t)?t.host:t}function mc(e){let t=pc(e);return uc(t)?(e.ownerDocument||e).body:Qs(t)&&ec(t)?t:mc(t)}function hc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=mc(e),i=r===e.ownerDocument?.body,a=Js(r);if(i){let e=gc(a);return t.concat(a,a.visualViewport||[],ec(r)?r:[],e&&n?hc(e):[])}else return t.concat(r,hc(r,[],n))}function gc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _c(e){let t=dc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Qs(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=os(n)!==a||os(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function vc(e){return Zs(e)?e:e.contextElement}function yc(e){let t=vc(e);if(!Qs(t))return cs(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=_c(t),o=(a?os(n.width):n.width)/r,s=(a?os(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var bc=cs(0);function xc(e){let t=Js(e);return!lc()||!t.visualViewport?bc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Sc(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Js(e)}function Cc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=vc(e),o=cs(1);t&&(r?Zs(r)&&(o=yc(r)):o=yc(e));let s=Sc(a,n,r)?xc(a):cs(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=Js(a),t=Zs(r)?Js(r):r,n=e,i=gc(n);for(;i&&t!==n;){let e=yc(i),t=i.getBoundingClientRect(),r=dc(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=Js(i),i=gc(n)}}return As({width:u,height:d,x:c,y:l})}function wc(e,t){let n=fc(e).scrollLeft;return t?t.left+n:Cc(Ys(e)).left+n}function Tc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-wc(e,n),y:n.top+t.scrollTop}}function Ec(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ys(r),s=t?nc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=cs(1),u=cs(0),d=Qs(r);if((d||!a)&&((qs(r)!==`body`||ec(o))&&(c=fc(r)),d)){let e=Cc(r);l=yc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Tc(o,c):cs(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 Dc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Oc(e){let t=fc(e),n=e.ownerDocument.body,r=as(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=as(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+wc(e),o=-t.scrollTop;return dc(n).direction===`rtl`&&(a+=as(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var kc=25;function Ac(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Js(e),a=Ys(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!lc()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(wc(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<=kc&&(s-=o)}return{width:s,height:c,x:l,y:u}}function jc(e,t){let n=Cc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=yc(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Mc(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ac(e,n,t);else if(t===`document`)r=Oc(Ys(e));else if(Zs(t))r=jc(t,n);else{let n=xc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return As(r)}function Nc(e,t){let n=t.get(e);if(n)return n;let r=hc(e,[],!1).filter(e=>Zs(e)&&qs(e)!==`body`),i=null,a=dc(e).position===`fixed`,o=a?pc(e):e;for(;Zs(o)&&!uc(o);){let e=dc(o),t=sc(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=pc(o)}return t.set(e,r),r}function Pc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?nc(t)?[]:Nc(t,this._c):[].concat(n),r],o=Mc(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Mc(t,a[e],i);s=as(n.top,s),c=is(n.right,c),l=is(n.bottom,l),u=as(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Fc(e){let{width:t,height:n}=_c(e);return{width:t,height:n}}function Ic(e,t,n){let r=Qs(t),i=Ys(t),a=n===`fixed`,o=Cc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=cs(0);if((r||!a)&&((qs(t)!==`body`||ec(i))&&(s=fc(t)),r)){let e=Cc(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=wc(i));let l=i&&!r&&!a?Tc(i,s):cs(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Lc(e){return dc(e).position===`static`}function Rc(e,t){if(!Qs(e)||dc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ys(e)===n&&(n=n.ownerDocument.body),n}function zc(e,t){let n=Js(e);if(nc(e))return n;if(!Qs(e)){let t=pc(e);for(;t&&!uc(t);){if(Zs(t)&&!Lc(t))return t;t=pc(t)}return n}let r=Rc(e,t);for(;r&&tc(r)&&Lc(r);)r=Rc(r,t);return r&&uc(r)&&Lc(r)&&!sc(r)?n:r||cc(e)||n}var Bc=async function(e){let t=this.getOffsetParent||zc,n=this.getDimensions,r=await n(e.floating);return{reference:Ic(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Vc(e){return dc(e).direction===`rtl`}var Hc={convertOffsetParentRelativeRectToViewportRelativeRect:Ec,getDocumentElement:Ys,getClippingRect:Pc,getOffsetParent:zc,getElementRects:Bc,getClientRects:Dc,getDimensions:Fc,getScale:yc,isElement:Zs,isRTL:Vc};function Uc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wc(e,t,n){let r=null,i,a=Ys(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ss(d),h=ss(a.clientWidth-(u+f)),g=ss(a.clientHeight-(d+p)),_=ss(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:as(0,is(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Uc(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{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=Js(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Gc(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=vc(e),u=i||a?[...l?hc(l):[],...t?hc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Wc(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?Cc(e):null;c&&g();function g(){let t=Cc(e);h&&!Uc(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 Kc=Hs,qc=Us,Jc=Is,Yc=Gs,Xc=zs,Zc=Fs,Qc=Ws,$c=(e,t,n)=>{let r=new Map,i=n??{},a={...Hc,...i.platform,_c:r};return Ps(e,t,{...i,platform:a})},el=typeof document<`u`?R.useLayoutEffect:function(){};function tl(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(!tl(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)&&!tl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function nl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rl(e,t){let n=nl(e);return Math.round(t*n)/n}function il(e){let t=R.useRef(e);return el(()=>{t.current=e}),t}function al(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]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=R.useState(r);tl(f,r)||p(r);let[m,h]=R.useState(null),[g,_]=R.useState(null),v=R.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=R.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=R.useRef(null),C=R.useRef(null),w=R.useRef(u),T=c!=null,E=il(c),D=il(i),O=il(l),k=R.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),$c(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!tl(w.current,t)&&(w.current=t,un.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);el(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=R.useRef(!1);el(()=>(A.current=!0,()=>{A.current=!1}),[]),el(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=R.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=R.useMemo(()=>({reference:b,floating:x}),[b,x]),N=R.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=rl(M.floating,u.x),r=rl(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...nl(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return R.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var ol=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?{}:Zc({element:r.current,padding:i}).fn(n):r?Zc({element:r,padding:i}).fn(n):{}}}},sl=(e,t)=>{let n=Kc(e);return{name:n.name,fn:n.fn,options:[e,t]}},cl=(e,t)=>{let n=qc(e);return{name:n.name,fn:n.fn,options:[e,t]}},ll=(e,t)=>({fn:Qc(e).fn,options:[e,t]}),ul=(e,t)=>{let n=Jc(e);return{name:n.name,fn:n.fn,options:[e,t]}},dl=(e,t)=>{let n=Yc(e);return{name:n.name,fn:n.fn,options:[e,t]}},fl=(e,t)=>{let n=Xc(e);return{name:n.name,fn:n.fn,options:[e,t]}},pl=(e,t)=>{let n=ol(e);return{name:n.name,fn:n.fn,options:[e,t]}},ml=Object.defineProperty,hl=R.forwardRef(((e,t)=>ml(e,`name`,{value:t,configurable:!0}))(function(e,t){let{children:n,width:r=10,height:i=5,...a}=e;return(0,z.jsx)(pn.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,z.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})},`Arrow`)),gl=Object.defineProperty,_l=(e,t)=>gl(e,`name`,{value:t,configurable:!0});function vl(e){let[t,n]=R.useState(void 0);return Yt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}_l(vl,`useSize`);var yl=Object.defineProperty,bl=(e,t)=>yl(e,`name`,{value:t,configurable:!0}),xl=`Popper`,[Sl,Cl]=Et(xl),[wl,Tl]=Sl(xl),El=bl(e=>{let{__scopePopper:t,children:n}=e,[r,i]=R.useState(null),[a,o]=R.useState(void 0);return(0,z.jsx)(wl,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Dl=`PopperAnchor`,Ol=R.forwardRef(bl(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Tl(Dl,n),o=R.useRef(null),s=a.onAnchorChange,c=x(t,R.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=R.useRef(null);R.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Rl(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,z.jsx)(pn.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),kl=`PopperContent`,[Al,jl]=Sl(kl),Ml=R.forwardRef(bl(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Tl(kl,n),[_,v]=R.useState(null),y=x(t,v),[b,S]=R.useState(null),C=vl(b),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Il),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=al({strategy:`fixed`,placement:E,whileElementsMounted:bl((...e)=>Gc(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[sl({mainAxis:i+T,alignmentAxis:o}),c&&cl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?ll():void 0,...A}),c&&ul({...A}),dl({...A,apply:bl(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&pl({element:b,padding:s}),Ll({arrowWidth:w,arrowHeight:T}),f&&fl({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),I=g.setPlacementState;Yt(()=>(I(N),()=>{I(void 0)}),[N,I]);let[L,ee]=Rl(N),te=Hr(m);Yt(()=>{P&&te?.()},[P,te]);let ne=F.arrow?.x,re=F.arrow?.y,ie=F.arrow?.centerOffset!==0,[ae,oe]=R.useState();return Yt(()=>{_&&oe(window.getComputedStyle(_).zIndex)},[_]),(0,z.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,z.jsx)(Al,{scope:n,placedSide:L,placedAlign:ee,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,z.jsx)(pn.div,{"data-side":L,"data-align":ee,...h,ref:y,style:{...h.style,animation:P?h.style?.animation:`none`}})})})},`PopperContent`)),Nl=`PopperArrow`,Pl={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Fl=R.forwardRef(bl(function(e,t){let{__scopePopper:n,...r}=e,i=jl(Nl,n),a=Pl[i.placedSide];return(0,z.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,z.jsx)(hl,{...r,ref:t,style:{...r.style,display:`block`}})})},`PopperArrow`));function Il(e){return e!==null}bl(Il,`isNotNull`);var Ll=bl(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Rl(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Rl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}bl(Rl,`getSideAndAlignFromPlacement`);var zl=El,Bl=Ol,Vl=Ml,Hl=Fl,Ul=Object.defineProperty,Wl=(e,t)=>Ul(e,`name`,{value:t,configurable:!0});function Gl(e,[t,n]){return Math.min(n,Math.max(t,e))}Wl(Gl,`clamp`);var Kl=Object.defineProperty,ql=(e,t)=>Kl(e,`name`,{value:t,configurable:!0});function Jl(e,t){return R.useReducer((e,n)=>t[e][n]??e,e)}ql(Jl,`useStateMachine`);var Yl=`ScrollArea`,[Xl,Zl]=Et(Yl),[Ql,$l]=Xl(Yl),eu=R.forwardRef(ql(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=R.useState(null),[l,u]=R.useState(null),[d,f]=R.useState(null),[p,m]=R.useState(null),[h,g]=R.useState(null),[_,v]=R.useState(0),[y,b]=R.useState(0),[S,C]=R.useState(!1),[w,T]=R.useState(!1),E=x(t,c),D=Yn(i);return(0,z.jsx)(Ql,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,z.jsx)(pn.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})},`ScrollArea`)),tu=`ScrollAreaViewport`,nu=R.forwardRef(ql(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=$l(tu,n),s=x(t,R.useRef(null),o.onViewportChange);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ru,{nonce:i}),(0,z.jsx)(pn.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,z.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),ru=R.memo(ql(function({nonce:e}){return(0,z.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),iu=`ScrollAreaScrollbar`,au=R.forwardRef(ql(function(e,t){let{forceMount:n,...r}=e,i=$l(iu,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return R.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,z.jsx)(ou,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,z.jsx)(su,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,z.jsx)(cu,{...r,ref:t,forceMount:n}):i.type===`always`?(0,z.jsx)(lu,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),ou=R.forwardRef(ql(function(e,t){let{forceMount:n,...r}=e,i=$l(iu,e.__scopeScrollArea),[a,o]=R.useState(!1);return R.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=ql(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=ql(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,z.jsx)(vn,{present:n||a,children:(0,z.jsx)(cu,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),su=R.forwardRef(ql(function(e,t){let{forceMount:n,...r}=e,i=$l(iu,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=ku(()=>c(`SCROLL_END`),100),[s,c]=Jl(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return R.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),R.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=ql(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,z.jsx)(vn,{present:n||s!==`hidden`,children:(0,z.jsx)(lu,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:Wt(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:Wt(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),cu=R.forwardRef(ql(function(e,t){let n=$l(iu,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=R.useState(!1),s=e.orientation===`horizontal`,c=ku(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Au(n.viewport,c),Au(n.content,c),(0,z.jsx)(vn,{present:r||a,children:(0,z.jsx)(lu,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),lu=R.forwardRef(ql(function(e,t){let{orientation:n=`vertical`,...r}=e,i=$l(iu,e.__scopeScrollArea),a=R.useRef(null),o=R.useRef(0),[s,c]=R.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Su(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:ql(e=>a.current=e,`onThumbChange`),onThumbPointerUp:ql(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:ql(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return wu(e,o.current,s,t)}return ql(d,`getScrollPosition`),n===`horizontal`?(0,z.jsx)(uu,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Tu(e,s,i.dir);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,i.dir))}}):n===`vertical`?(0,z.jsx)(du,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Tu(e,s);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},`ScrollAreaScrollbarVisible`)),uu=R.forwardRef(ql(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=$l(iu,e.__scopeScrollArea),[o,s]=R.useState(),c=R.useRef(null),l=x(t,c,a.onScrollbarXChange);return R.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,z.jsx)(mu,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Cu(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Du(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:xu(o.paddingLeft),paddingEnd:xu(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),du=R.forwardRef(ql(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=$l(iu,e.__scopeScrollArea),[o,s]=R.useState(),c=R.useRef(null),l=x(t,c,a.onScrollbarYChange);return R.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,z.jsx)(mu,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Cu(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Du(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:xu(o.paddingTop),paddingEnd:xu(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[fu,pu]=Xl(iu),mu=R.forwardRef(ql(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=$l(iu,n),[m,h]=R.useState(null),g=x(t,h),_=R.useRef(null),v=R.useRef(``),y=p.viewport,b=r.content-r.viewport,S=Hr(u),C=Hr(c),w=ku(d,10);function T(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return ql(T,`handleDragScroll`),R.useEffect(()=>{let e=ql(e=>{let t=e.target;m?.contains(t)&&S(e,b)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,S]),R.useEffect(C,[r,C]),Au(m,w),Au(p.content,w),(0,z.jsx)(fu,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Hr(a),onThumbPointerUp:Hr(o),onThumbPositionChange:C,onThumbPointerDown:Hr(s),children:(0,z.jsx)(pn.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:Wt(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:Wt(e.onPointerMove,T),onPointerUp:Wt(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),hu=`ScrollAreaThumb`,gu=R.forwardRef(ql(function(e,t){let{forceMount:n,...r}=e,i=pu(hu,e.__scopeScrollArea);return(0,z.jsx)(vn,{present:n||i.hasThumb,children:(0,z.jsx)(_u,{ref:t,...r})})},`ScrollAreaThumb`)),_u=R.forwardRef(ql(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=$l(hu,n),o=pu(hu,n),{onThumbPositionChange:s}=o,c=x(t,o.onThumbChange),l=R.useRef(void 0),u=ku(()=>{l.current&&=(l.current(),void 0)},100);return R.useEffect(()=>{let e=a.viewport;if(e){let t=ql(()=>{if(u(),!l.current){let t=Ou(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,z.jsx)(pn.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:Wt(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:Wt(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),vu=`ScrollAreaCorner`,yu=R.forwardRef(ql(function(e,t){let n=$l(vu,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,z.jsx)(bu,{...e,ref:t}):null},`ScrollAreaCorner`)),bu=R.forwardRef(ql(function(e,t){let{__scopeScrollArea:n,...r}=e,i=$l(vu,n),[a,o]=R.useState(0),[s,c]=R.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return Au(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Au(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),R.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,z.jsx)(pn.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function xu(e){return e?parseInt(e,10):0}ql(xu,`toInt`);function Su(e,t){let n=e/t;return isNaN(n)?0:n}ql(Su,`getThumbRatio`);function Cu(e){let t=Su(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}ql(Cu,`getThumbSize`);function wu(e,t,n,r=`ltr`){let i=Cu(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 Eu([c,l],d)(e)}ql(wu,`getScrollPositionFromPointer`);function Tu(e,t,n=`ltr`){let r=Cu(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Gl(e,n===`ltr`?[0,o]:[o*-1,0]);return Eu([0,o],[0,s])(c)}ql(Tu,`getThumbOffsetFromScroll`);function Eu(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])}}ql(Eu,`linearScale`);function Du(e,t){return e>0&&e<t}ql(Du,`isScrollingWithinScrollbarBounds`);var Ou=ql((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return ql((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)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function ku(e,t){let n=Hr(e),r=R.useRef(0);return R.useEffect(()=>()=>window.clearTimeout(r.current),[]),R.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}ql(ku,`useDebounceCallback`);function Au(e,t){let n=Hr(t);Yt(()=>{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,n])}ql(Au,`useResizeObserver`);var ju=eu,Mu=nu,Nu=yu;function Pu({className:e,children:t,...n}){return(0,z.jsxs)(ju,{"data-slot":`scroll-area`,className:C(`relative`,e),...n,children:[(0,z.jsx)(Mu,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,z.jsx)(Fu,{}),(0,z.jsx)(Nu,{})]})}function Fu({className:e,orientation:t=`vertical`,...n}){return(0,z.jsx)(au,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:C(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,z.jsx)(gu,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var Iu=Object.defineProperty,Lu=(e,t)=>Iu(e,`name`,{value:t,configurable:!0}),Ru=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),zu=R.forwardRef(Lu(function(e,t){return(0,z.jsx)(pn.span,{...e,ref:t,style:{...Ru,...e.style}})},`VisuallyHidden`)),Bu=Object.defineProperty,Vu=(e,t)=>Bu(e,`name`,{value:t,configurable:!0}),Hu=`horizontal`,Uu=[`horizontal`,`vertical`],Wu=R.forwardRef(Vu(function(e,t){let{decorative:n,orientation:r=Hu,...i}=e,a=Gu(r)?r:Hu,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,z.jsx)(pn.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function Gu(e){return Uu.includes(e)}Vu(Gu,`isValidOrientation`);var Ku=Wu;function qu({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,z.jsx)(Ku,{"data-slot":`separator`,decorative:n,orientation:t,className:C(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function Ju({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`skeleton`,className:C(`animate-pulse rounded-md bg-accent`,e),...t})}var Yu=Object.defineProperty,Xu=(e,t)=>Yu(e,`name`,{value:t,configurable:!0}),Zu=!1;function Qu(){let[e,t]=R.useState(Zu);return R.useEffect(()=>{Zu||(Zu=!0,t(!0))},[]),e}Xu(Qu,`useIsHydrated`);var $u=R.useSyncExternalStore;function ed(){return()=>{}}Xu(ed,`subscribe`);function td(){return $u(ed,()=>!0,()=>!1)}Xu(td,`useIsHydratedModern`);var nd=typeof $u==`function`?td:Qu,rd=Object.defineProperty,id=(e,t)=>rd(e,`name`,{value:t,configurable:!0}),ad=`rovingFocusGroup.onEntryFocus`,od={bubbles:!1,cancelable:!0},sd=`RovingFocusGroup`,[cd,ld,ud]=At(sd),[dd,fd]=Et(sd,[ud]),[pd,md]=dd(sd),hd=R.forwardRef(id(function(e,t){return(0,z.jsx)(cd.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,z.jsx)(cd.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,z.jsx)(gd,{...e,ref:t})})})},`RovingFocusGroup`)),gd=R.forwardRef(id(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=R.useRef(null),p=x(t,f),m=Yn(a),[h,g]=an({prop:o,defaultProp:s??null,onChange:c,caller:sd}),[_,v]=R.useState(!1),y=Hr(l),b=ld(n),S=R.useRef(!1),[C,w]=R.useState(0);return R.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(ad,y),()=>e.removeEventListener(ad,y)},[y]),(0,z.jsx)(pd,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:R.useCallback(e=>g(e),[g]),onItemShiftTab:R.useCallback(()=>v(!0),[]),onFocusableItemAdd:R.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:R.useCallback(()=>w(e=>e-1),[]),children:(0,z.jsx)(pn.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Wt(e.onMouseDown,()=>{S.current=!0}),onFocus:Wt(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(ad,od);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Sd([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:Wt(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),_d=`RovingFocusGroupItem`,vd=R.forwardRef(id(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=On(),l=a||c,u=md(_d,n),d=u.currentTabStopId===l,f=ld(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=nd();return Yt(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),R.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,z.jsx)(cd.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,z.jsx)(pn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Wt(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Wt(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Wt(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=xd(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Cd(n,r+1):n.slice(r+1)}setTimeout(()=>Sd(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),yd={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function bd(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}id(bd,`getDirectionAwareKey`);function xd(e,t,n){let r=bd(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return yd[r]}id(xd,`getFocusIntent`);function Sd(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}id(Sd,`focusFirst`);function Cd(e,t){return e.map((n,r)=>e[(t+r)%e.length])}id(Cd,`wrapArray`);var wd=hd,Td=vd,Ed=Object.defineProperty,Dd=(e,t)=>Ed(e,`name`,{value:t,configurable:!0}),Od=`Tabs`,[kd,Ad]=Et(Od,[fd]),jd=fd(),[Md,Nd]=kd(Od),Pd=R.forwardRef(Dd(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Yn(s),[d,f]=an({prop:r,onChange:i,defaultProp:a??``,caller:Od});return(0,z.jsx)(Md,{scope:n,baseId:On(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,z.jsx)(pn.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),Fd=`TabsList`,Id=R.forwardRef(Dd(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=Nd(Fd,n),o=jd(n);return(0,z.jsx)(wd,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,z.jsx)(pn.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),Ld=`TabsTrigger`,Rd=R.forwardRef(Dd(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Nd(Ld,n),s=jd(n),c=Vd(o.baseId,r),l=Hd(o.baseId,r),u=r===o.value;return(0,z.jsx)(Td,{asChild:!0,...s,focusable:!i,active:u,children:(0,z.jsx)(pn.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:Wt(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Wt(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Wt(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),zd=`TabsContent`,Bd=R.forwardRef(Dd(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Nd(zd,n),c=Vd(s.baseId,r),l=Hd(s.baseId,r),u=r===s.value,d=R.useRef(u);return R.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,z.jsx)(vn,{present:i||u,children:({present:n})=>(0,z.jsx)(pn.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function Vd(e,t){return`${e}-trigger-${t}`}Dd(Vd,`makeTriggerId`);function Hd(e,t){return`${e}-content-${t}`}Dd(Hd,`makeContentId`);var Ud=Pd,Wd=Id,Gd=Rd,Kd=Bd;function qd({className:e,orientation:t=`horizontal`,...n}){return(0,z.jsx)(Ud,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:C(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var Jd=De(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Yd({className:e,variant:t=`default`,...n}){return(0,z.jsx)(Wd,{"data-slot":`tabs-list`,"data-variant":t,className:C(Jd({variant:t}),e),...n})}function Xd({className:e,...t}){return(0,z.jsx)(Gd,{"data-slot":`tabs-trigger`,className:C(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function Zd({className:e,...t}){return(0,z.jsx)(Kd,{"data-slot":`tabs-content`,className:C(`flex-1 outline-none`,e),...t})}function Qd({className:e,...t}){return(0,z.jsx)(`textarea`,{"data-slot":`textarea`,className:C(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40`,e),...t})}var $d=Object.defineProperty,ef=(e,t)=>$d(e,`name`,{value:t,configurable:!0}),[tf,nf]=Et(`Tooltip`,[Cl]),rf=Cl(),af=`TooltipProvider`,of=700,sf=`tooltip.open`,[cf,lf]=tf(af),uf=ef(e=>{let{__scopeTooltip:t,delayDuration:n=of,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=R.useRef(!0),s=R.useRef(!1),c=R.useRef(0);return R.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,z.jsx)(cf,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:R.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:R.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:R.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),df=`Tooltip`,[ff,pf]=tf(df),mf=ef(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=lf(df,e.__scopeTooltip),l=rf(t),[u,d]=R.useState(null),[f,p]=R.useState(void 0),m=On(),h=R.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=R.useRef(!1),[y,b]=an({prop:r,defaultProp:i??!1,onChange:ef(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(sf))):c.onClose(),a?.(e)},`onChange`),caller:df}),x=R.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=R.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=R.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=R.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);R.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let T=f??m;return(0,z.jsx)(zl,{...l,children:(0,z.jsx)(ff,{scope:t,contentId:T,setContentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:R.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:R.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})},`Tooltip`),hf=`TooltipTrigger`,gf=R.forwardRef(ef(function(e,t){let{__scopeTooltip:n,...r}=e,i=pf(hf,n),a=lf(hf,n),o=rf(n),s=x(t,R.useRef(null),i.onTriggerChange),c=R.useRef(!1),l=R.useRef(!1),u=R.useCallback(()=>c.current=!1,[]);return R.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,z.jsx)(Bl,{asChild:!0,...o,children:(0,z.jsx)(pn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Wt(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Wt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Wt(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Wt(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Wt(e.onBlur,i.onClose),onClick:Wt(e.onClick,i.onClose)})})},`TooltipTrigger`)),_f=`TooltipPortal`,[vf,yf]=tf(_f,{forceMount:void 0}),bf=ef(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=pf(_f,t);return(0,z.jsx)(vf,{scope:t,forceMount:n,children:(0,z.jsx)(vn,{present:n||a.open,children:(0,z.jsx)(Ui,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),xf=`TooltipContent`,Sf=R.forwardRef(ef(function(e,t){let n=yf(xf,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=pf(xf,e.__scopeTooltip);return(0,z.jsx)(vn,{present:r||o.open,children:o.disableHoverableContent?(0,z.jsx)(Tf,{side:i,...a,ref:t}):(0,z.jsx)(Cf,{side:i,...a,ref:t})})},`TooltipContent`)),Cf=R.forwardRef(ef(function(e,t){let n=pf(xf,e.__scopeTooltip),r=lf(xf,e.__scopeTooltip),i=R.useRef(null),a=x(t,i),[o,s]=R.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=R.useCallback(()=>{s(null),d(!1)},[d]),p=R.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Of(r,Df(r,n.getBoundingClientRect())),a=kf(t.getBoundingClientRect()),o=jf([...i,...a]);s(o),d(!0)},[d]);return R.useEffect(()=>()=>f(),[f]),R.useEffect(()=>{if(c&&u){let e=ef(e=>p(e,u),`handleTriggerLeave`),t=ef(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),R.useEffect(()=>{if(o){let e=ef(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Af(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,z.jsx)(Tf,{...e,ref:a})},`TooltipContentHoverable`)),wf=c(`TooltipContent`),Tf=R.forwardRef(ef(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=pf(xf,n),u=rf(n),{onClose:d}=l;R.useEffect(()=>(document.addEventListener(sf,d),()=>document.removeEventListener(sf,d)),[d]),R.useEffect(()=>{if(l.trigger){let e=ef(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return Yt(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,z.jsx)(vi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,z.jsxs)(Vl,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,z.jsx)(wf,{children:r}),i?(0,z.jsx)(zu,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`)),Ef=R.forwardRef(ef(function(e,t){let{__scopeTooltip:n,...r}=e,i=rf(n);return(0,z.jsx)(Hl,{...i,...r,ref:t})},`TooltipArrow`));function Df(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}ef(Df,`getExitSideFromRect`);function Of(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}ef(Of,`getPaddedExitPoints`);function kf(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}ef(kf,`getPointsFromRect`);function Af(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}ef(Af,`isPointInPolygon`);function jf(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Mf(t)}ef(jf,`getHull`);function Mf(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}ef(Mf,`getHullPresorted`);var Nf=uf,Pf=mf,Ff=gf,If=bf,Lf=Sf,Rf=Ef;function zf({delayDuration:e=0,...t}){return(0,z.jsx)(Nf,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Bf({...e}){return(0,z.jsx)(Pf,{"data-slot":`tooltip`,...e})}function Vf({...e}){return(0,z.jsx)(Ff,{"data-slot":`tooltip-trigger`,...e})}function Hf({className:e,sideOffset:t=0,children:n,...r}){return(0,z.jsx)(If,{children:(0,z.jsxs)(Lf,{"data-slot":`tooltip-content`,sideOffset:t,className:C(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,z.jsx)(Rf,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var Uf={completed:`Completed`,failed:`Failed`,running:`Running`,stopped:`Stopped`};function Wf({state:e}){let t=Object.hasOwn(Uf,e)?e:`unknown`;return(0,z.jsxs)(v,{className:C(`gap-1.5 uppercase tracking-[.03em]`,{"border-destructive bg-destructive-surface text-destructive":t===`failed`,"border-info bg-info-surface text-info":t===`running`,"border-success bg-success-surface text-success":t===`completed`,"border-warning bg-warning-surface text-warning":t===`stopped`}),variant:`outline`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:C(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),Uf[e]??e]})}var Gf=`tool_result`;function Kf(...e){for(let t of e)if(t!=null)return t;return null}function qf(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.call&&!n.result)return n}}function Jf({call:e,result:t}){let n=e??t,r=n?.kind??Gf;return{eventIndices:[e?.index,t?.index].filter(e=>e!==void 0),durationMs:Kf(e?.durationMs,t?.durationMs),finishedAt:Kf(e?.finishedAt,t?.finishedAt),id:`tool-${n?.index??0}`,input:e?.input??t?.input,kind:r,name:Kf(e?.name,t?.name)??r,output:Kf(t?.output,e?.output),startedAt:Kf(e?.startedAt,t?.startedAt),status:Kf(e?.status,t?.status),timingSource:Kf(e?.timingSource,t?.timingSource),toolCallId:Kf(e?.toolCallId,t?.toolCallId)}}function Yf(e){let t=[],n=new Map;for(let r of e){if(r.kind===Gf){let e=r.toolCallId?n.get(r.toolCallId):qf(t);if(e&&!e.result){e.result=r,e.call?.toolCallId&&n.delete(e.call.toolCallId);continue}t.push({call:null,result:r});continue}let e={call:r,result:null};t.push(e),r.toolCallId&&n.set(r.toolCallId,e)}return t.map(Jf)}var Xf=[{id:`turns`,label:`Turns`},{id:`phases`,label:`Phases`},{id:`tools`,label:`Tools`}];function Zf(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Qf(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0}function $f(e){let t=[],n=[];for(let r of e.turns){let e=Zf(r.startedAt)??Zf(r.timestamp);if(e===null)continue;let i=Qf(r.durationMs),a=Zf(r.finishedAt);t.push({...i===void 0?a===null?{}:{end:a}:{duration:i},turnId:r.id,id:r.id,kind:`turn`,label:`${r.harness} turn`,laneId:`turns`,payload:{turn:r,type:`turn`},start:e,status:r.status});let o=[[`model`,r.modelMs],[`tools`,r.toolMs]],s=e;for(let[e,n]of o){let i=Qf(n);i!==void 0&&(t.push({duration:i,id:`${r.id}-phase-${e}`,kind:`${e} phase`,label:`${e===`model`?`Model`:`Tool`} time`,laneId:`phases`,parent:r.id,payload:{turn:r,type:`phase`},start:s,status:r.status}),s+=i)}let c=Qf(r.timeToFirstTokenMs);c!==void 0&&n.push({at:e+c,id:`${r.id}-first-token`,label:`First token`,payload:{turn:r,type:`milestone`},status:r.status});for(let n of Yf(r.tools)){let i=Zf(n.startedAt)??e,a=Qf(n.durationMs),o=Zf(n.finishedAt);t.push({...a===void 0?o===null?{}:{end:o}:{duration:a},turnId:r.id,...n.toolCallId===null?{}:{toolCallId:n.toolCallId},eventIndex:Number(n.id.slice(5)),id:`${r.id}-${n.id}`,kind:n.kind,label:n.name,laneId:`tools`,parent:r.id,payload:{turn:r,type:`tool`},start:i,status:n.status})}}let r=Zf(e.startedAt);return{items:t,lanes:Xf.filter(e=>t.some(t=>t.laneId===e.id)),markers:n,...r===null?{}:{origin:r}}}function ep({cursor:e,focus:t,expanded:n,onExpandedChange:r,onSelectTurn:i,selectedTurnId:a,turns:o}){let[s,c]=(0,R.useState)(!1),l=n??s,u=$f({turns:o}),d=o.find(e=>e.id===t?.turnId),f=d&&t?Yf(d.tools).find(e=>t.toolCallId===void 0?t.eventIndex!==void 0&&e.eventIndices.includes(t.eventIndex):e.toolCallId===t.toolCallId):void 0,p=t?u.items.find(e=>e.turnId===t.turnId&&e.id===(f?`${t.turnId}-${f.id}`:t.turnId)):void 0;return(0,z.jsx)(St,{...e===void 0?{}:{cursor:e},expanded:t?!0:l,onExpandedChange:e=>{n===void 0&&c(e),r?.(e)},getFailureExcerpt:e=>e.payload.turn.failureKind,items:u.items,label:`Conversation timeline`,lanes:u.lanes,markers:u.markers,onSelect:e=>i(e.payload.turn.id),...p?{selectedId:p.id}:a?{selectedId:a}:{}})}function tp(e){let t=(0,R.useRef)(null),n=(0,R.useRef)(new Map),[r,i]=(0,R.useState)(),a=(0,R.useRef)(new Map);a.current=new Map(e.map(e=>[e.id,e.time]));let o=(0,R.useCallback)(()=>{let r=t.current;if(!r)return;let a=r.getBoundingClientRect().top+Math.min(r.clientHeight*.25,160),o=e.map(e=>({element:n.current.get(e.id),...e})).filter(e=>!!e.element);if(o.length===0)return;let s=o[0];if(!s)return;let c=s;for(let e of o)if(e.element.getBoundingClientRect().top<=a)c=e;else break;i(c.time)},[e]),s=(0,R.useCallback)(e=>{t.current?.removeEventListener(`scroll`,o),t.current=e,e?.addEventListener(`scroll`,o,{passive:!0}),o()},[o]);return(0,R.useEffect)(()=>{o();let e=t.current;return()=>e?.removeEventListener(`scroll`,o)},[o]),{containerRef:s,cursor:r,register:(0,R.useCallback)((e,t)=>{t?n.current.set(e,t):n.current.delete(e)},[]),scrollTo:(0,R.useCallback)(e=>{n.current.get(e)?.scrollIntoView({behavior:`smooth`,block:`start`});let t=a.current.get(e);t!==void 0&&i(t)},[])}}function np({className:e,from:t,...n}){return(0,z.jsx)(`div`,{className:C(t===`user`?`flex justify-end`:`grid grid-cols-[2rem_minmax(0,1fr)] items-start gap-3.5`,e),"data-message-author":t,...n})}function rp({className:e,...t}){return(0,z.jsx)(`div`,{className:C(`min-w-0`,e),...t})}function ip({children:e,src:t}){return(0,z.jsxs)(ii,{"aria-hidden":`true`,className:`size-8 rounded-[9px]`,children:[t?(0,z.jsx)(oi,{alt:``,src:t}):null,(0,z.jsx)(ai,{className:`bg-primary text-[9px] font-extrabold text-primary-foreground`,children:e})]})}var ap=/"(?:[^"\\]|\\.)*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null/g;function op(e){try{return JSON.parse(e)}catch{return}}function sp(e,t=2){try{return JSON.stringify(e,null,t)??String(e)}catch{return String(e)}}function cp(e){return sp(e,0)}function lp(e,t){return e.startsWith(`"`)?t?`hljs-attr`:`hljs-string`:e===`true`||e===`false`||e===`null`?`hljs-literal`:`hljs-number`}function up(e){let t=[],n=0;for(let r of e.matchAll(ap)){let i=r[0],a=r.index;a>n&&t.push(e.slice(n,a)),n=a+i.length;let o=/^\s*:/.test(e.slice(n));t.push((0,z.jsx)(`span`,{className:lp(i,o),children:i},`${a}-${i.length}`))}return n<e.length&&t.push(e.slice(n)),t}function dp({className:e,label:t,value:n}){return(0,z.jsx)(`pre`,{"aria-label":t,className:C(`message-json`,e),children:(0,z.jsx)(`code`,{children:up(sp(n))})})}function fp(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var pp=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mp=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hp={};function gp(e,t){return((t||hp).jsx?mp:pp).test(e)}var _p=/[ \t\n\f\r]/g;function vp(e){return typeof e==`object`?e.type===`text`&&yp(e.value):yp(e)}function yp(e){return e.replace(_p,``)===``}var bp=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};bp.prototype.normal={},bp.prototype.property={},bp.prototype.space=void 0;function xp(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new bp(n,r,t)}function Sp(e){return e.toLowerCase()}var Cp=class{constructor(e,t){this.attribute=t,this.property=e}};Cp.prototype.attribute=``,Cp.prototype.booleanish=!1,Cp.prototype.boolean=!1,Cp.prototype.commaOrSpaceSeparated=!1,Cp.prototype.commaSeparated=!1,Cp.prototype.defined=!1,Cp.prototype.mustUseProperty=!1,Cp.prototype.number=!1,Cp.prototype.overloadedBoolean=!1,Cp.prototype.property=``,Cp.prototype.spaceSeparated=!1,Cp.prototype.space=void 0;var wp=L({boolean:()=>B,booleanish:()=>Ep,commaOrSpaceSeparated:()=>Ap,commaSeparated:()=>kp,number:()=>V,overloadedBoolean:()=>Dp,spaceSeparated:()=>Op}),Tp=0,B=jp(),Ep=jp(),Dp=jp(),V=jp(),Op=jp(),kp=jp(),Ap=jp();function jp(){return 2**++Tp}var Mp=Object.keys(wp),Np=class extends Cp{constructor(e,t,n,r){let i=-1;if(super(e,t),Pp(this,`space`,r),typeof n==`number`)for(;++i<Mp.length;){let e=Mp[i];Pp(this,Mp[i],(n&wp[e])===wp[e])}}};Np.prototype.defined=!0;function Pp(e,t,n){n&&(e[t]=n)}function Fp(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Np(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Sp(r)]=r,n[Sp(a.attribute)]=r}return new bp(t,n,e.space)}var Ip=Fp({properties:{ariaActiveDescendant:null,ariaAtomic:Ep,ariaAutoComplete:null,ariaBusy:Ep,ariaChecked:Ep,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:Op,ariaCurrent:null,ariaDescribedBy:Op,ariaDetails:null,ariaDisabled:Ep,ariaDropEffect:Op,ariaErrorMessage:null,ariaExpanded:Ep,ariaFlowTo:Op,ariaGrabbed:Ep,ariaHasPopup:null,ariaHidden:Ep,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Op,ariaLevel:V,ariaLive:null,ariaModal:Ep,ariaMultiLine:Ep,ariaMultiSelectable:Ep,ariaOrientation:null,ariaOwns:Op,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:Ep,ariaReadOnly:Ep,ariaRelevant:null,ariaRequired:Ep,ariaRoleDescription:Op,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:Ep,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Lp(e,t){return t in e?e[t]:t}function Rp(e,t){return Lp(e,t.toLowerCase())}var zp=Fp({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:kp,acceptCharset:Op,accessKey:Op,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alpha:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:Op,autoFocus:B,autoPlay:B,blocking:Op,capture:null,charSet:null,checked:B,cite:null,className:Op,closedBy:null,colorSpace:null,cols:V,colSpan:V,command:null,commandFor:null,content:null,contentEditable:Ep,controls:B,controlsList:Op,coords:V|kp,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:Dp,draggable:Ep,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:Op,height:V,hidden:Dp,high:V,href:null,hrefLang:null,htmlFor:Op,httpEquiv:Op,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:Op,itemRef:Op,itemScope:B,itemType:Op,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:B,optimum:V,pattern:null,ping:Op,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:Op,required:B,reversed:B,rows:V,rowSpan:V,sandbox:Op,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootCustomElementRegistry:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shadowRootSerializable:B,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:Ep,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:Ep,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Op,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:Ep,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:B,disablePictureInPicture:B,disableRemotePlayback:B,exportParts:kp,part:Op,prefix:null,property:null,results:V,security:null,unselectable:null},space:`html`,transform:Rp}),Bp=Fp({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Ap,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:Op,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kp,g2:kp,glyphName:kp,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:Ap,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:V,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Op,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ap,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ap,rev:Ap,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ap,requiredFeatures:Ap,requiredFonts:Ap,requiredFormats:Ap,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:Ap,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ap,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ap,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Lp}),Vp=Fp({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Hp=Fp({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Rp}),Up=Fp({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Wp={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Gp=/[A-Z]/g,Kp=/-[a-z]/g,qp=/^data[-\w.:]+$/i;function Jp(e,t){let n=Sp(t),r=t,i=Cp;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&qp.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Kp,Xp);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Kp.test(e)){let n=e.replace(Gp,Yp);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Np}return new i(r,t)}function Yp(e){return`-`+e.toLowerCase()}function Xp(e){return e.charAt(1).toUpperCase()}var Zp=xp([Ip,zp,Vp,Hp,Up],`html`),Qp=xp([Ip,Bp,Vp,Hp,Up],`svg`);function $p(e){return e.join(` `).trim()}var em=P(((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(`
|
|
42
|
-
`);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})),tm=P((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(em());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}})),nm=P((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))}})),rm=P(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(tm()),r=nm();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})),im=om(`end`),am=om(`start`);function om(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 sm(e){let t=am(e),n=im(e);if(t&&n)return{start:t,end:n}}function cm(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?um(e.position):`start`in e||`end`in e?um(e):`line`in e||`column`in e?lm(e):``}function lm(e){return dm(e&&e.line)+`:`+dm(e&&e.column)}function um(e){return lm(e&&e.start)+`-`+lm(e&&e.end)}function dm(e){return e&&typeof e==`number`?e:1}var fm=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=cm(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}};fm.prototype.file=``,fm.prototype.name=``,fm.prototype.reason=``,fm.prototype.message=``,fm.prototype.stack=``,fm.prototype.column=void 0,fm.prototype.line=void 0,fm.prototype.ancestors=void 0,fm.prototype.cause=void 0,fm.prototype.fatal=void 0,fm.prototype.place=void 0,fm.prototype.ruleId=void 0,fm.prototype.source=void 0;var pm=pe(rm(),1),mm={}.hasOwnProperty,hm=new Map,gm=/[A-Z]/g,_m=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),vm=new Set([`td`,`th`]);function ym(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=Am(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=km(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`?Qp:Zp,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=bm(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function bm(e,t,n){if(t.type===`element`)return xm(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Sm(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return wm(e,t,n);if(t.type===`mdxjsEsm`)return Cm(e,t);if(t.type===`root`)return Tm(e,t,n);if(t.type===`text`)return Em(e,t)}function xm(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Qp,e.schema=i),e.ancestors.push(t);let a=Im(e,t.tagName,!1),o=jm(e,t),s=Nm(e,t);return _m.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!vp(e)})),Dm(e,o,a,t),Om(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Sm(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)}Lm(e,t.position)}function Cm(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lm(e,t.position)}function wm(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Qp,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Im(e,t.name,!0),o=Mm(e,t),s=Nm(e,t);return Dm(e,o,a,t),Om(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Tm(e,t,n){let r={};return Om(r,Nm(e,t)),e.create(t,e.Fragment,r,n)}function Em(e,t){return t.value}function Dm(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Om(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function km(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 Am(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=am(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 jm(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&mm.call(t.properties,i)){let a=Pm(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&vm.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 Mm(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 Lm(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 Lm(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function Nm(e,t){let n=[],r=-1,i=e.passKeys?new Map:hm;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=bm(e,a,o);s!==void 0&&n.push(s)}return n}function Pm(e,t,n){let r=Jp(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?fp(n):$p(n)),r.property===`style`){let t=typeof n==`object`?n:Fm(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Rm(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Wp[r.property]||r.property:r.attribute,n]}}function Fm(e,t){try{return(0,pm.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new fm("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function Im(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=gp(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=gp(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return mm.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Lm(e)}function Lm(e,t){let n=new fm("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function Rm(e){let t={},n;for(n in e)mm.call(e,n)&&(t[zm(n)]=e[n]);return t}function zm(e){let t=e.replace(gm,Bm);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Bm(e){return`-`+e.toLowerCase()}var Vm={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Hm={};function Um(e,t){let n=t||Hm;return Wm(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Wm(e,t,n){if(Km(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Gm(e.children,t,n)}return Array.isArray(e)?Gm(e,t,n):``}function Gm(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Wm(e[i],t,n);return r.join(``)}function Km(e){return!!(e&&typeof e==`object`)}var qm=document.createElement(`i`);function Jm(e){let t=`&`+e+`;`;qm.innerHTML=t;let n=qm.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Ym(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?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);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Xm(e,t){return e.length>0?(Ym(e,e.length,0,t),e):t}var Zm={}.hasOwnProperty;function Qm(e){let t={},n=-1;for(;++n<e.length;)$m(t,e[n]);return t}function $m(e,t){let n;for(n in t){let r=(Zm.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Zm.call(r,a)||(r[a]=[]);let e=i[a];eh(r[a],Array.isArray(e)?e:e?[e]:[])}}}function eh(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Ym(e,0,0,r)}function th(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&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 nh(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var rh=mh(/[A-Za-z]/),ih=mh(/[\dA-Za-z]/),ah=mh(/[#-'*+\--9=?A-Z^-~]/);function oh(e){return e!==null&&(e<32||e===127)}var sh=mh(/\d/),ch=mh(/[\dA-Fa-f]/),lh=mh(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function uh(e){return e!==null&&(e<0||e===32)}function dh(e){return e===-2||e===-1||e===32}var fh=mh(/\p{P}|\p{S}/u),ph=mh(/\s/);function mh(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function hh(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&ih(e.charCodeAt(n+1))&&ih(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function gh(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return dh(r)?(e.enter(n),s(r)):t(r)}function s(r){return dh(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var _h={tokenize:vh};function vh(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),gh(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return H(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var yh={tokenize:xh},bh={tokenize:Sh};function xh(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Ym(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bh,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(bh,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return H(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>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;e<t.events.length;)t.events[e][1].end={...c},e++;Ym(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){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 Sh(e,t,n){return gh(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Ch(e){if(e===null||uh(e)||ph(e))return 1;if(fh(e))return 2}function wh(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Th={name:`attention`,resolveAll:Eh,tokenize:Dh};function Eh(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Oh(d,-c),Oh(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=Xm(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Xm(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Xm(l,wh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Xm(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=Xm(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Ym(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Dh(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ch(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Ch(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Oh(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var kh={name:`autolink`,tokenize:Ah};function Ah(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return rh(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||ih(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||ih(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||oh(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):ah(t)?(e.consume(t),l):n(t)}function u(e){return ih(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||ih(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var jh={partial:!0,tokenize:Mh};function Mh(e,t,n){return r;function r(t){return dh(t)?gh(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||H(e)?t(e):n(e)}}var Nh={continuation:{tokenize:Fh},exit:Ih,name:`blockQuote`,tokenize:Ph};function Ph(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return dh(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Fh(e,t,n){let r=this;return i;function i(t){return dh(t)?gh(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Nh,t,n)(r)}}function Ih(e){e.exit(`blockQuote`)}var Lh={name:`characterEscape`,tokenize:Rh};function Rh(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return lh(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var zh={name:`characterReference`,tokenize:Bh};function Bh(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=ih,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=ch,u):(e.enter(`characterReferenceValue`),a=7,o=sh,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===ih&&!Jm(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Vh={partial:!0,tokenize:Wh},Hh={concrete:!0,name:`codeFenced`,tokenize:Uh};function Uh(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),dh(t)?gh(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||H(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Vh,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||H(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):dh(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),gh(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||H(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||H(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&dh(t)?gh(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||H(t)?e.check(Vh,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||H(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`),dh(t)?gh(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`),dh(t)?gh(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||H(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Wh(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 Gh={name:`codeIndented`,tokenize:qh},Kh={partial:!0,tokenize:Jh};function qh(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),gh(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):H(t)?e.attempt(Kh,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||H(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Jh(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):H(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):gh(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):H(e)?i(e):n(e)}}var Yh={name:`codeText`,previous:Zh,resolve:Xh,tokenize:Qh};function Xh(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<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Zh(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Qh(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):H(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||H(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var $h=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&eg(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),eg(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),eg(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<this.left.length){let t=this.left.splice(e,1/0);eg(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);eg(this.left,t.reverse())}}};function eg(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function tg(e){let t={},n=-1,r,i,a,o,s,c,l,u=new $h(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,ng(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Ym(e,0,1/0,u.slice(0)),!l}function ng(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var rg={resolve:ag,tokenize:og},ig={partial:!0,tokenize:sg};function ag(e){return tg(e),e}function og(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):H(t)?e.check(ig,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function sg(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),gh(e,a,`linePrefix`)}function a(i){if(i===null||H(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function cg(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||oh(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||H(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||uh(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||oh(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function lg(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||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):H(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||H(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!dh(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function ug(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):H(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),gh(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||H(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 dg(e,t){let n;return r;function r(i){return H(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):dh(i)?gh(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var fg={name:`definition`,tokenize:mg},pg={partial:!0,tokenize:hg};function mg(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return lg.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=nh(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 uh(t)?dg(e,l)(t):l(t)}function l(t){return cg(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(pg,d,d)(t)}function d(t){return dh(t)?gh(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||H(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function hg(e,t,n){return r;function r(t){return uh(t)?dg(e,i)(t):n(t)}function i(t){return ug(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return dh(t)?gh(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||H(e)?t(e):n(e)}}var gg={name:`hardBreakEscape`,tokenize:_g};function _g(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return H(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var vg={name:`headingAtx`,resolve:yg,tokenize:bg};function yg(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`},Ym(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function bg(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||uh(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||H(n)?(e.exit(`atxHeading`),t(n)):dh(n)?gh(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||uh(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var xg=`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(`.`),Sg=[`pre`,`script`,`style`,`textarea`],Cg={concrete:!0,name:`htmlFlow`,resolveTo:Eg,tokenize:Dg},wg={partial:!0,tokenize:kg},Tg={partial:!0,tokenize:Og};function Eg(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 Dg(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:I):rh(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):rh(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):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 rh(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||uh(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Sg.includes(l)?(i=1,r.interrupt?t(s):O(s)):xg.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||ih(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 dh(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||rh(t)?(e.consume(t),b):dh(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||ih(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):dh(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):dh(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||H(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||uh(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||dh(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||H(t)?O(t):dh(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):H(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(wg,ee,k)(t)):t===null||H(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Tg,A,ee)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||H(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Sg.includes(n)?(e.consume(t),L):O(t)}return rh(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||H(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),L)}function ee(n){return e.exit(`htmlFlow`),t(n)}}function Og(e,t,n){let r=this;return i;function i(t){return H(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 kg(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(jh,t,n)}}var Ag={name:`htmlText`,tokenize:jg};function jg(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):rh(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):rh(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):H(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(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):H(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):H(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):H(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return rh(t)?(e.consume(t),S):n(t)}function S(t){return t===45||ih(t)?(e.consume(t),S):C(t)}function C(t){return H(t)?(o=C,N(t)):dh(t)?(e.consume(t),C):M(t)}function w(t){return t===45||ih(t)?(e.consume(t),w):t===47||t===62||uh(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||rh(t)?(e.consume(t),E):H(t)?(o=T,N(t)):dh(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||ih(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):H(t)?(o=D,N(t)):dh(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):H(t)?(o=O,N(t)):dh(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):H(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||uh(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||uh(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return dh(t)?gh(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Mg={name:`labelEnd`,resolveAll:Ig,resolveTo:Lg,tokenize:Rg},Ng={tokenize:zg},Pg={tokenize:Bg},Fg={tokenize:Vg};function Ig(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Ym(e,0,e.length,n),e}function Lg(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Xm(s,e.slice(a+1,a+r+3)),s=Xm(s,[[`enter`,u,t]]),s=Xm(s,wh(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Xm(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Xm(s,e.slice(o+1)),s=Xm(s,[[`exit`,c,t]]),Ym(e,a,e.length,s),e}function Rg(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(nh(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Ng,u,o?u:d)(t):t===91?e.attempt(Pg,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Fg,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function zg(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return uh(t)?dg(e,a)(t):a(t)}function a(t){return t===41?u(t):cg(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return uh(t)?dg(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?ug(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return uh(t)?dg(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Bg(e,t,n){let r=this;return i;function i(t){return lg.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(nh(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Vg(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Hg={name:`labelStartImage`,resolveAll:Mg.resolveAll,tokenize:Ug};function Ug(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Wg={name:`labelStartLink`,resolveAll:Mg.resolveAll,tokenize:Gg};function Gg(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Kg={name:`lineEnding`,tokenize:qg};function qg(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),gh(e,t,`linePrefix`)}}var Jg={name:`thematicBreak`,tokenize:Yg};function Yg(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||H(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),dh(t)?gh(e,s,`whitespace`)(t):s(t))}}var Xg={continuation:{tokenize:e_},exit:n_,name:`list`,tokenize:$g},Zg={partial:!0,tokenize:r_},Qg={partial:!0,tokenize:t_};function $g(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:sh(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(Jg,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 sh(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(jh,r.interrupt?n:u,e.attempt(Zg,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return dh(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 e_(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(jh,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,gh(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!dh(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(Qg,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,gh(e,e.attempt(Xg,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function t_(e,t,n){let r=this;return gh(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 n_(e){e.exit(this.containerState.type)}function r_(e,t,n){let r=this;return gh(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!dh(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var i_={name:`setextUnderline`,resolveTo:a_,tokenize:o_};function a_(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 o_(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`),dh(t)?gh(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||H(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var s_={tokenize:c_};function c_(e){let t=this,n=e.attempt(jh,r,e.attempt(this.parser.constructs.flowInitial,i,gh(e,e.attempt(this.parser.constructs.flow,i,e.attempt(rg,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 l_={resolveAll:p_()},u_=f_(`string`),d_=f_(`text`);function f_(e){return{resolveAll:p_(e===`text`?m_: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(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function p_(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function m_(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var h_=L({attentionMarkers:()=>C_,contentInitial:()=>__,disable:()=>w_,document:()=>g_,flow:()=>y_,flowInitial:()=>v_,insideSpan:()=>S_,string:()=>b_,text:()=>x_}),g_={42:Xg,43:Xg,45:Xg,48:Xg,49:Xg,50:Xg,51:Xg,52:Xg,53:Xg,54:Xg,55:Xg,56:Xg,57:Xg,62:Nh},__={91:fg},v_={[-2]:Gh,[-1]:Gh,32:Gh},y_={35:vg,42:Jg,45:[i_,Jg],60:Cg,61:i_,95:Jg,96:Hh,126:Hh},b_={38:zh,92:Lh},x_={[-5]:Kg,[-4]:Kg,[-3]:Kg,33:Hg,38:zh,42:Th,60:[kh,Ag],91:Wg,92:[gg,Lh],93:Mg,95:Th,96:Yh},S_={null:[Th,l_]},C_={null:[42,95]},w_={null:[]};function T_(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=Xm(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=wh(a,l.events,l),l.events):[]}function f(e,t){return D_(p(e),t)}function p(e){return E_(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<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){H(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Ym(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function E_(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-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 D_(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
43
|
-
`;break;case-3:o=`\r
|
|
44
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function O_(e){let t={constructs:Qm([h_,...(e||{}).extensions||[]]),content:n(_h),defined:[],document:n(yh),flow:n(s_),lazy:{},string:n(u_),text:n(d_)};return t;function n(e){return n;function n(n){return T_(t,e,n)}}}function k_(e){for(;!tg(e););return e}var A_=/[\0\t\n\r]/g;function j_(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(A_.lastIndex=u,c=A_.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var M_=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function N_(e){return e.replace(M_,P_)}function P_(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return th(n.slice(t?2:1),t?16:10)}return Jm(n)||e}var F_={}.hasOwnProperty;function I_(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),L_(n)(k_(O_(n).document().write(j_()(e,t,!0))))}function L_(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(_e),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(pe),blockQuote:a(ce),characterEscape:T,characterReference:T,codeFenced:a(le),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(le,o),codeText:a(ue,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(de),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(fe),hardBreakEscape:a(me),hardBreakTrailing:a(me),htmlFlow:a(he,o),htmlFlowData:T,htmlText:a(he,o),htmlTextData:T,image:a(ge),label:o,link:a(_e),listItem:a(ye),listItemValue:f,listOrdered:a(ve,d),listUnordered:a(ve),paragraph:a(be),reference:te,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(pe),strong:a(xe),thematicBreak:a(Ce)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:se,autolinkProtocol:oe,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ie,characterReference:ae,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ne,resourceDestinationString:I,resourceTitleString:L,resource:ee,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};z_(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];F_.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||V_).call(a,void 0,e[0])}for(r.position={start:R_(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:R_(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:R_(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||V_).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+cm({start:e.start,end:e.end})+`): it’s not open`);n.position.end=R_(e.end)}function u(){return Um(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=nh(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Se(),n.position={start:R_(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=R_(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=R_(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=N_(t),n.identifier=nh(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ee(){this.data.inReference=void 0}function te(){this.data.referenceType=`collapsed`}function ne(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=nh(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function re(e){this.data.characterReferenceType=e.type}function ie(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=th(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Jm(t);let i=this.stack[this.stack.length-1];i.value+=r}function ae(e){let t=this.stack.pop();t.position.end=R_(e.end)}function oe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function se(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ce(){return{type:`blockquote`,children:[]}}function le(){return{type:`code`,lang:null,meta:null,value:``}}function ue(){return{type:`inlineCode`,value:``}}function de(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function fe(){return{type:`emphasis`,children:[]}}function pe(){return{type:`heading`,depth:0,children:[]}}function me(){return{type:`break`}}function he(){return{type:`html`,value:``}}function ge(){return{type:`image`,title:null,url:``,alt:null}}function _e(){return{type:`link`,title:null,url:``,children:[]}}function ve(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ye(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function be(){return{type:`paragraph`,children:[]}}function xe(){return{type:`strong`,children:[]}}function Se(){return{type:`text`,value:``}}function Ce(){return{type:`thematicBreak`}}}function R_(e){return{line:e.line,column:e.column,offset:e.offset}}function z_(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?z_(e,r):B_(e,r)}}function B_(e,t){let n;for(n in t)if(F_.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function V_(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+cm({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cm({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+cm({start:t.start,end:t.end})+`) is still open`)}function H_(e){let t=this;t.parser=n;function n(n){return I_(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function U_(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function W_(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
45
|
-
`}]}function G_(e,t){let n=t.value?t.value+`
|
|
46
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function K_(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function q_(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function J_(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=hh(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Y_(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function X_(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Z_(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Q_(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Z_(e,t);let i={src:hh(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function $_(e,t){let n={src:hh(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function ev(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function tv(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Z_(e,t);let i={href:hh(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function nv(e,t){let n={href:hh(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function rv(e,t,n){let r=e.all(t),i=n?iv(n):av(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
47
|
-
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
48
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function iv(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=av(n[r])}return t}function av(e){return e.spread??e.children.length>1}function ov(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function sv(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cv(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function lv(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uv(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=am(t.children[1]),o=im(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function dv(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function fv(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var pv=9,mv=32;function hv(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(gv(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(gv(t.slice(i),i>0,!1)),a.join(``)}function gv(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===pv||t===mv;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===pv||t===mv;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function _v(e,t){let n={type:`text`,value:hv(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function vv(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var yv={blockquote:U_,break:W_,code:G_,delete:K_,emphasis:q_,footnoteReference:J_,heading:Y_,html:X_,imageReference:Q_,image:$_,inlineCode:ev,linkReference:tv,link:nv,listItem:rv,list:ov,paragraph:sv,root:cv,strong:lv,table:uv,tableCell:fv,tableRow:dv,text:_v,thematicBreak:vv,toml:bv,yaml:bv,definition:bv,footnoteDefinition:bv};function bv(){}var xv=typeof self==`object`?self:globalThis,Sv=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new xv[e](t)},Cv=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof xv[e]==`function`?Sv(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(Sv(a,o),i)};return r},wv=e=>Cv(new Map,e)(0),Tv=``,{toString:Ev}={},{keys:Dv}=Object,Ov=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Ev.call(e).slice(8,-1);switch(n){case`Array`:return[1,Tv];case`Object`:return[2,Tv];case`Date`:return[3,Tv];case`RegExp`:return[4,Tv];case`Map`:return[5,Tv];case`Set`:return[6,Tv];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},kv=([e,t])=>e===0&&(t===`function`||t===`symbol`),Av=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Ov(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Dv(r))(e||!kv(Ov(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?Tv:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(kv(Ov(n))||kv(Ov(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!kv(Ov(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},jv=(e,{json:t,lossy:n}={})=>{let r=[];return Av(!(t||n),!!t,new Map,r)(e),r},Mv=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?wv(jv(e,t)):structuredClone(e):(e,t)=>wv(jv(e,t));function Nv(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Pv(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Fv(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Nv,r=e.options.footnoteBackLabel||Pv,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=hh(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...Mv(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
49
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
50
|
-
`}]}}var Iv=(function(e){if(e==null)return Vv;if(typeof e==`function`)return Bv(e);if(typeof e==`object`)return Array.isArray(e)?Lv(e):Rv(e);if(typeof e==`string`)return zv(e);throw Error(`Expected function, string, or object as test`)});function Lv(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Iv(e[n]);return Bv(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Rv(e){let t=e;return Bv(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function zv(e){return Bv(t);function t(t){return t&&t.type===e}}function Bv(e){return t;function t(t,n,r){return!!(Hv(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Vv(){return!0}function Hv(e){return typeof e==`object`&&!!e&&`type`in e}function Uv(e){return e}var Wv=[];function Gv(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Iv(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Uv(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Wv,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Kv(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Kv(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Wv:[e]}function qv(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Gv(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Jv={}.hasOwnProperty,Yv={};function Xv(e,t){let n=t||Yv,r=new Map,i=new Map,a={all:s,applyData:Qv,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...yv,...n.handlers},one:o,options:n,patch:Zv,wrap:ey};return qv(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(Jv.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=Mv(n);return r.children=a.all(e),r}return Mv(e)}return(a.options.unknownHandler||$v)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=ty(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=ty(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Zv(e,t){e.position&&(t.position=sm(e))}function Qv(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,Mv(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function $v(e,t){let n=t.data||{},r=`value`in t&&!(Jv.call(n,`hProperties`)||Jv.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ey(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
51
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
52
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
53
|
-
`}),n}function ty(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ny(e,t){let n=Xv(e,t),r=n.one(e,void 0),i=Fv(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
54
|
-
`},i)),a}function ry(e,t){return e&&`run`in e?async function(n,r){let i=ny(n,{file:r,...t});await e.run(i,r)}:function(n,r){return ny(n,{file:r,...e||t})}}function iy(e){if(e)throw e}var ay=P(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function oy(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function sy(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?cy(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function cy(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var ly={basename:uy,dirname:dy,extname:fy,join:py,sep:`/`};function uy(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);gy(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function dy(e){if(gy(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function fy(e){gy(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function py(...e){let t=-1,n;for(;++t<e.length;)gy(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:my(n)}function my(e){gy(e);let t=e.codePointAt(0)===47,n=hy(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function hy(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function gy(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var _y={cwd:vy};function vy(){return`/`}function yy(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function by(e){if(typeof e==`string`)e=new URL(e);else if(!yy(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return xy(e)}function xy(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Sy=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Cy=class{constructor(e){let t;t=e?yy(e)?{path:e}:typeof e==`string`||Dy(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:_y.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Sy.length;){let e=Sy[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Sy.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?ly.basename(this.path):void 0}set basename(e){Ty(e,`basename`),wy(e,`basename`),this.path=ly.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?ly.dirname(this.path):void 0}set dirname(e){Ey(this.basename,`dirname`),this.path=ly.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?ly.extname(this.path):void 0}set extname(e){if(wy(e,`extname`),Ey(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=ly.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){yy(e)&&(e=by(e)),Ty(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?ly.basename(this.path,this.extname):void 0}set stem(e){Ty(e,`stem`),wy(e,`stem`),this.path=ly.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new fm(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function wy(e,t){if(e&&e.includes(ly.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+ly.sep+"`")}function Ty(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Ey(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Dy(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Oy=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),ky=pe(ay(),1),Ay={}.hasOwnProperty,jy=new class e extends Oy{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=sy()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,ky.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Py(`data`,this.frozen),this.namespace[e]=t,this):Ay.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Py(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Ly(e),n=this.parser||this.Parser;return My(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),My(`process`,this.parser||this.Parser),Ny(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Ly(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);zy(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),My(`processSync`,this.parser||this.Parser),Ny(`processSync`,this.compiler||this.Compiler),this.process(e,r),Iy(`processSync`,`process`,t),n;function r(e,r){t=!0,iy(e),n=r}}run(e,t,n){Fy(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Ly(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Iy(`runSync`,`run`,n),r;function i(e,t){iy(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Ly(t),r=this.compiler||this.Compiler;return Ny(`stringify`,r),Fy(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Py(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,ky.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];oy(o)&&oy(r)&&(r=(0,ky.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function My(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Ny(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Py(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Fy(e){if(!oy(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Iy(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ly(e){return Ry(e)?e:new Cy(e)}function Ry(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function zy(e){return typeof e==`string`||By(e)}function By(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Vy=[],Hy={allowDangerousHtml:!0},Uy=/^(https?|ircs?|mailto|xmpp)$/i,Wy=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Gy(e){let t=Ky(e),n=qy(e);return Jy(t.runSync(t.parse(n),n),e)}function Ky(e){let t=e.rehypePlugins||Vy,n=e.remarkPlugins||Vy,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hy}:Hy;return jy().use(H_).use(n).use(ry,r).use(t)}function qy(e){let t=e.children||``,n=new Cy;return typeof t==`string`?n.value=t:``+t,n}function Jy(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Yy;for(let e of Wy)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return qv(e,l),ym(e,{Fragment:z.Fragment,components:i,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Vm)if(Object.hasOwn(Vm,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Vm[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Yy(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Uy.test(e.slice(0,t))?e:``}var Xy=(function(e,t,n){let r=Iv(n);if(!e||!e.type||!e.children)throw Error(`Expected parent node`);if(typeof t==`number`){if(t<0||t===1/0)throw Error(`Expected positive finite number as index`)}else if(t=e.children.indexOf(t),t<0)throw Error(`Expected child node or index`);for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Zy=(function(e){if(e==null)return tb;if(typeof e==`string`)return $y(e);if(typeof e==`object`)return Qy(e);if(typeof e==`function`)return eb(e);throw Error("Expected function, string, or array as `test`")});function Qy(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Zy(e[n]);return eb(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function $y(e){return eb(t);function t(t){return t.tagName===e}}function eb(e){return t;function t(t,n,r){return!!(nb(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function tb(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function nb(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}var rb=/\n/g,ib=/[\t ]+/g,ab=Zy(`br`),ob=Zy(yb),sb=Zy(`p`),cb=Zy(`tr`),lb=Zy([`datalist`,`head`,`noembed`,`noframes`,`noscript`,`rp`,`script`,`style`,`template`,`title`,vb,bb]),ub=Zy(`address.article.aside.blockquote.body.caption.center.dd.dialog.dir.dl.dt.div.figure.figcaption.footer.form,.h1.h2.h3.h4.h5.h6.header.hgroup.hr.html.legend.li.listing.main.menu.nav.ol.p.plaintext.pre.section.ul.xmp`.split(`.`));function db(e,t){let n=t||{},r=`children`in e?e.children:[],i=ub(e),a=_b(e,{whitespace:n.whitespace||`normal`,breakBefore:!1,breakAfter:!1}),o=[];(e.type===`text`||e.type===`comment`)&&o.push(...mb(e,{whitespace:a,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<r.length;)o.push(...fb(r[s],e,{whitespace:a,breakBefore:s?void 0:i,breakAfter:s<r.length-1?ab(r[s+1]):i}));let c=[],l;for(s=-1;++s<o.length;){let e=o[s];typeof e==`number`?l!==void 0&&e>l&&(l=e):e&&(l!==void 0&&l>-1&&c.push(`
|
|
55
|
-
`.repeat(l)||` `),l=-1,c.push(e))}return c.join(``)}function fb(e,t,n){return e.type===`element`?pb(e,t,n):e.type===`text`?n.whitespace===`normal`?mb(e,n):hb(e):[]}function pb(e,t,n){let r=_b(e,n),i=e.children||[],a=-1,o=[];if(lb(e))return o;let s,c;for(ab(e)||cb(e)&&Xy(t,e,cb)?c=`
|
|
56
|
-
`:sb(e)?(s=2,c=2):ub(e)&&(s=1,c=1);++a<i.length;)o=o.concat(fb(i[a],e,{whitespace:r,breakBefore:a?void 0:s,breakAfter:a<i.length-1?ab(i[a+1]):c}));return ob(e)&&Xy(t,e,ob)&&o.push(` `),s&&o.unshift(s),c&&o.push(c),o}function mb(e,t){let n=String(e.value),r=[],i=[],a=0;for(;a<=n.length;){rb.lastIndex=a;let e=rb.exec(n),i=e&&`index`in e?e.index:n.length;r.push(gb(n.slice(a,i).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,``),a!==0||t.breakBefore,i!==n.length||t.breakAfter)),a=i+1}let o=-1,s;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),s=void 0):r[o]?(typeof s==`number`&&i.push(s),i.push(r[o]),s=0):(o===0||o===r.length-1)&&i.push(0);return i}function hb(e){return[String(e.value)]}function gb(e,t,n){let r=[],i=0,a;for(;i<e.length;){ib.lastIndex=i;let n=ib.exec(e);a=n?n.index:e.length,!i&&!a&&n&&!t&&r.push(``),i!==a&&r.push(e.slice(i,a)),i=n?a+n[0].length:a}return i!==a&&!n&&r.push(``),r.join(` `)}function _b(e,t){if(e.type===`element`){let n=e.properties||{};switch(e.tagName){case`listing`:case`plaintext`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return n.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return n.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}}return t.whitespace}function vb(e){return!!(e.properties||{}).hidden}function yb(e){return e.tagName===`td`||e.tagName===`th`}function bb(e){return e.tagName===`dialog`&&!(e.properties||{}).open}function xb(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(?!struct)(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),f=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],p=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),m=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),h={type:f,keyword:d,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:p},g={className:`function.dispatch`,relevance:0,keywords:{_hint:m},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[g,c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat([`self`]),relevance:0}]),relevance:0},y={className:`function`,begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:h,relevance:0},{begin:u,returnBegin:!0,contains:[l],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[o,s]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:h,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(v,y,g,_,[c,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:h,contains:[`self`,a]},{begin:e.IDENT_RE+`::`,keywords:h},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}function Sb(e){let t={type:[`boolean`,`byte`,`word`,`String`],built_in:`KeyboardController.MouseController.SoftwareSerial.EthernetServer.EthernetClient.LiquidCrystal.RobotControl.GSMVoiceCall.EthernetUDP.EsploraTFT.HttpClient.RobotMotor.WiFiClient.GSMScanner.FileSystem.Scheduler.GSMServer.YunClient.YunServer.IPAddress.GSMClient.GSMModem.Keyboard.Ethernet.Console.GSMBand.Esplora.Stepper.Process.WiFiUDP.GSM_SMS.Mailbox.USBHost.Firmata.PImage.Client.Server.GSMPIN.FileIO.Bridge.Serial.EEPROM.Stream.Mouse.Audio.Servo.File.Task.GPRS.WiFi.Wire.TFT.GSM.SPI.SD`.split(`.`),_hints:`setup.loop.runShellCommandAsynchronously.analogWriteResolution.retrieveCallingNumber.printFirmwareVersion.analogReadResolution.sendDigitalPortPair.noListenOnLocalhost.readJoystickButton.setFirmwareVersion.readJoystickSwitch.scrollDisplayRight.getVoiceCallStatus.scrollDisplayLeft.writeMicroseconds.delayMicroseconds.beginTransmission.getSignalStrength.runAsynchronously.getAsynchronously.listenOnLocalhost.getCurrentCarrier.readAccelerometer.messageAvailable.sendDigitalPorts.lineFollowConfig.countryNameWrite.runShellCommand.readStringUntil.rewindDirectory.readTemperature.setClockDivider.readLightSensor.endTransmission.analogReference.detachInterrupt.countryNameRead.attachInterrupt.encryptionType.readBytesUntil.robotNameWrite.readMicrophone.robotNameRead.cityNameWrite.userNameWrite.readJoystickY.readJoystickX.mouseReleased.openNextFile.scanNetworks.noInterrupts.digitalWrite.beginSpeaker.mousePressed.isActionDone.mouseDragged.displayLogos.noAutoscroll.addParameter.remoteNumber.getModifiers.keyboardRead.userNameRead.waitContinue.processInput.parseCommand.printVersion.readNetworks.writeMessage.blinkVersion.cityNameRead.readMessage.setDataMode.parsePacket.isListening.setBitOrder.beginPacket.isDirectory.motorsWrite.drawCompass.digitalRead.clearScreen.serialEvent.rightToLeft.setTextSize.leftToRight.requestFrom.keyReleased.compassRead.analogWrite.interrupts.WiFiServer.disconnect.playMelody.parseFloat.autoscroll.getPINUsed.setPINUsed.setTimeout.sendAnalog.readSlider.analogRead.beginWrite.createChar.motorsStop.keyPressed.tempoWrite.readButton.subnetMask.debugPrint.macAddress.writeGreen.randomSeed.attachGPRS.readString.sendString.remotePort.releaseAll.mouseMoved.background.getXChange.getYChange.answerCall.getResult.voiceCall.endPacket.constrain.getSocket.writeJSON.getButton.available.connected.findUntil.readBytes.exitValue.readGreen.writeBlue.startLoop.IPAddress.isPressed.sendSysex.pauseMode.gatewayIP.setCursor.getOemKey.tuneWrite.noDisplay.loadImage.switchPIN.onRequest.onReceive.changePIN.playFile.noBuffer.parseInt.overflow.checkPIN.knobRead.beginTFT.bitClear.updateIR.bitWrite.position.writeRGB.highByte.writeRed.setSpeed.readBlue.noStroke.remoteIP.transfer.shutdown.hangCall.beginSMS.endWrite.attached.maintain.noCursor.checkReg.checkPUK.shiftOut.isValid.shiftIn.pulseIn.connect.println.localIP.pinMode.getIMEI.display.noBlink.process.getBand.running.beginSD.drawBMP.lowByte.setBand.release.bitRead.prepare.pointTo.readRed.setMode.noFill.remove.listen.stroke.detach.attach.noTone.exists.buffer.height.bitSet.circle.config.cursor.random.IRread.setDNS.endSMS.getKey.micros.millis.begin.print.write.ready.flush.width.isPIN.blink.clear.press.mkdir.rmdir.close.point.yield.image.BSSID.click.delay.read.text.move.peek.beep.rect.line.open.seek.fill.size.turn.stop.home.find.step.tone.sqrt.RSSI.SSID.end.bit.tan.cos.sin.pow.map.abs.max.min.get.run.put`.split(`.`),literal:[`DIGITAL_MESSAGE`,`FIRMATA_STRING`,`ANALOG_MESSAGE`,`REPORT_DIGITAL`,`REPORT_ANALOG`,`INPUT_PULLUP`,`SET_PIN_MODE`,`INTERNAL2V56`,`SYSTEM_RESET`,`LED_BUILTIN`,`INTERNAL1V1`,`SYSEX_START`,`INTERNAL`,`EXTERNAL`,`DEFAULT`,`OUTPUT`,`INPUT`,`HIGH`,`LOW`]},n=xb(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name=`Arduino`,n.aliases=[`ino`],n.supersetOf=`cpp`,n}function Cb(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}function wb(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,variants:[{begin:`\\b[a-z\\d_]*_t\\b`},{match:/\batomic_[a-z]{3,6}\b/}]},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d={keyword:`asm.auto.break.case.continue.default.do.else.enum.extern.for.fortran.goto.if.inline.register.restrict.return.sizeof.typeof.typeof_unqual.struct.switch.typedef.union.volatile.while._Alignas._Alignof._Atomic._Generic._Noreturn._Static_assert._Thread_local.alignas.alignof.noreturn.static_assert.thread_local._Pragma`.split(`.`),type:`float.double.signed.unsigned.int.short.long.char.void._Bool._BitInt._Complex._Imaginary._Decimal32._Decimal64._Decimal96._Decimal128._Decimal64x._Decimal128x._Float16._Float32._Float64._Float128._Float32x._Float64x._Float128x.const.static.constexpr.complex.bool.imaginary`.split(`.`),literal:`true false NULL`,built_in:`std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr`},f=[c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],p={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:d,contains:f.concat([{begin:/\(/,end:/\)/,keywords:d,contains:f.concat([`self`]),relevance:0}]),relevance:0},m={begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:d,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:d,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(l,{className:`title.function`})],relevance:0},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C`,aliases:[`h`],keywords:d,disableAutodetect:!0,illegal:`</`,contains:[].concat(p,m,f,[c,{begin:e.IDENT_RE+`::`,keywords:d},{className:`class`,beginKeywords:`enum class struct union`,end:/[{;:<>=]/,contains:[{beginKeywords:`final class struct`},e.TITLE_MODE]}]),exports:{preprocessor:c,strings:o,keywords:d}}}function Tb(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(?!struct)(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),f=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],p=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),m=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),h={type:f,keyword:d,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:p},g={className:`function.dispatch`,relevance:0,keywords:{_hint:m},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[g,c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat([`self`]),relevance:0}]),relevance:0},y={className:`function`,begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:h,relevance:0},{begin:u,returnBegin:!0,contains:[l],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[o,s]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:h,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(v,y,g,_,[c,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:h,contains:[`self`,a]},{begin:e.IDENT_RE+`::`,keywords:h},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}function Eb(e){let t=[`bool`,`byte`,`char`,`decimal`,`delegate`,`double`,`dynamic`,`enum`,`float`,`int`,`long`,`nint`,`nuint`,`object`,`sbyte`,`short`,`string`,`ulong`,`uint`,`ushort`],n=[`public`,`private`,`protected`,`static`,`internal`,`protected`,`abstract`,`async`,`extern`,`override`,`unsafe`,`virtual`,`new`,`sealed`,`partial`],r={keyword:`abstract.as.base.break.case.catch.class.const.continue.do.else.event.explicit.extern.finally.fixed.for.foreach.goto.if.implicit.in.interface.internal.is.lock.namespace.new.operator.out.override.params.private.protected.public.readonly.record.ref.return.scoped.sealed.sizeof.stackalloc.static.struct.switch.this.throw.try.typeof.unchecked.unsafe.using.virtual.void.volatile.while`.split(`.`).concat(`add.alias.and.ascending.args.async.await.by.descending.dynamic.equals.file.from.get.global.group.init.into.join.let.nameof.not.notnull.on.or.orderby.partial.record.remove.required.scoped.select.set.unmanaged.value|0.var.when.where.with.yield`.split(`.`)),built_in:t,literal:[`default`,`false`,`null`,`true`]},i=e.inherit(e.TITLE_MODE,{begin:`[a-zA-Z](\\.?\\w)*`}),a={className:`number`,variants:[{begin:`\\b(0b[01']+)`},{begin:`(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)`},{begin:`(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)`}],relevance:0},o={className:`string`,begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},s={className:`string`,begin:`@"`,end:`"`,contains:[{begin:`""`}]},c=e.inherit(s,{illegal:/\n/}),l={className:`subst`,begin:/\{/,end:/\}/,keywords:r},u=e.inherit(l,{illegal:/\n/}),d={className:`string`,begin:/\$"/,end:`"`,illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,u]},f={className:`string`,begin:/\$@"/,end:`"`,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},l]},p=e.inherit(f,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},u]});l.contains=[f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],u.contains=[p,d,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let m={variants:[o,f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h={begin:`<`,end:`>`,contains:[{beginKeywords:`in out`},i]},g=e.IDENT_RE+`(<`+e.IDENT_RE+`(\\s*,\\s*`+e.IDENT_RE+`)*>)?(\\[\\])?`,_={begin:`@`+e.IDENT_RE,relevance:0};return{name:`C#`,aliases:[`cs`,`c#`],keywords:r,illegal:/::/,contains:[e.COMMENT(`///`,`$`,{returnBegin:!0,contains:[{className:`doctag`,variants:[{begin:`///`,relevance:0},{begin:`<!--|-->`},{begin:`</?`,end:`>`}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`meta`,begin:`#`,end:`$`,keywords:{keyword:`if else elif endif define undef warning error line region endregion pragma checksum`}},m,a,{beginKeywords:`class interface`,relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:`where class`},i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`namespace`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`record`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`meta`,begin:`^\\s*\\[(?=[\\w])`,excludeBegin:!0,end:`\\]`,excludeEnd:!0,contains:[{className:`string`,begin:/"/,end:/"/}]},{beginKeywords:`new return throw await else`,relevance:0},{className:`function`,begin:`(`+g+`\\s+)+`+e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:r,contains:[{beginKeywords:n.join(` `),relevance:0},{begin:e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,contains:[e.TITLE_MODE,h],relevance:0},{match:/\(\)/},{className:`params`,begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,relevance:0,contains:[m,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}var Db=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Ob=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),kb=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),Ab=[...Ob,...kb],jb=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),Mb=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),Nb=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),Pb=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function Fb(e){let t=e.regex,n=Db(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i=/@-?\w[\w]*(-\w+)*/,a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+Mb.join(`|`)+`)`},{begin:`:(:)?(`+Nb.join(`|`)+`)`}]},n.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+Pb.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...a,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:jb.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...a,n.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+Ab.join(`|`)+`)\\b`}]}}function Ib(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}function Lb(e){let t={keyword:[`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`],type:[`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int8`,`int16`,`int32`,`int64`,`string`,`uint8`,`uint16`,`uint32`,`uint64`,`int`,`uint`,`uintptr`,`rune`],literal:[`true`,`false`,`iota`,`nil`],built_in:[`append`,`cap`,`close`,`complex`,`copy`,`imag`,`len`,`make`,`new`,`panic`,`print`,`println`,`real`,`recover`,`delete`]};return{name:`Go`,aliases:[`golang`],keywords:t,illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`string`,variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:`number`,variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:`function`,beginKeywords:`func`,end:`\\s*(\\{|$)`,excludeEnd:!0,contains:[e.TITLE_MODE,{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}function Rb(e){let t=e.regex;return{name:`GraphQL`,aliases:[`gql`],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:[`query`,`mutation`,`subscription`,`type`,`input`,`schema`,`directive`,`interface`,`union`,`scalar`,`fragment`,`enum`,`on`],literal:[`true`,`false`,`null`]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:`punctuation`,match:/[.]{3}/,relevance:0},{scope:`punctuation`,begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:`variable`,begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:`meta`,match:/@\w+/,excludeEnd:!0},{scope:`symbol`,begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function zb(e){let t=e.regex,n={className:`number`,relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:`variable`,variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},a={className:`literal`,begin:/\bon|off|true|false|yes|no\b/},o={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:`'''`,end:`'''`,relevance:10},{begin:`"""`,end:`"""`,relevance:10},{begin:`"`,end:`"`},{begin:`'`,end:`'`}]},s={begin:/\[/,end:/\]/,contains:[r,a,i,o,n,`self`],relevance:0},c=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:`TOML, also INI`,aliases:[`toml`],case_insensitive:!0,illegal:/\S/,contains:[r,{className:`section`,begin:/\[+/,end:/\]+/},{begin:t.concat(c,`(\\s*\\.\\s*`,c,`)*`,t.lookahead(/\s*=\s*[^#\s]/)),className:`attr`,starts:{end:/$/,contains:[r,s,a,i,o,n]}}]}}var Bb=`[0-9](_*[0-9])*`,Vb=`\\.(${Bb})`,Hb=`[0-9a-fA-F](_*[0-9a-fA-F])*`,Ub={className:`number`,variants:[{begin:`(\\b(${Bb})((${Vb})|\\.)?|(${Vb}))[eE][+-]?(${Bb})[fFdD]?\\b`},{begin:`\\b(${Bb})((${Vb})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Vb})[fFdD]?\\b`},{begin:`\\b(${Bb})[fFdD]\\b`},{begin:`\\b0[xX]((${Hb})\\.?|(${Hb})?\\.(${Hb}))[pP][+-]?(${Bb})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${Hb})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function Wb(e,t,n){return n===-1?``:e.replace(t,r=>Wb(e,t,n-1))}function Gb(e){let t=e.regex,n=`[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,r=n+Wb(`(?:<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~(?:\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~)*>)?`,/~~~/g,2),i={keyword:`synchronized.abstract.private.var.static.if.const .for.while.strictfp.finally.protected.import.native.final.void.enum.else.break.transient.catch.instanceof.volatile.case.assert.package.default.public.try.switch.continue.throws.protected.public.private.module.requires.exports.do.sealed.yield.permits.goto.when`.split(`.`),literal:[`false`,`true`,`null`],type:[`char`,`boolean`,`long`,`float`,`int`,`byte`,`short`,`double`],built_in:[`super`,`this`]},a={className:`meta`,begin:`@[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,contains:[{begin:/\(/,end:/\)/,contains:[`self`]}]},o={className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:`Java`,aliases:[`jsp`],keywords:i,illegal:/<\/|#/,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:`doctag`,begin:`@[A-Za-z]+`}]}),{begin:/import java\.[a-z]+\./,keywords:`import`,relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:`string`,contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:`keyword`,3:`title.class`}},{match:/non-sealed/,scope:`keyword`},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:`type`,3:`variable`,5:`operator`}},{begin:[/record/,/\s+/,n],className:{1:`keyword`,3:`title.class`},contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`new throw return else`,relevance:0},{begin:[`(?:`+r+`\\s+)`,e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:`title.function`},keywords:i,contains:[{className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[a,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Ub,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Ub,a]}}var Kb=`[A-Za-z$_][0-9A-Za-z$_]*`,qb=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Jb=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],Yb=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Xb=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Zb=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],Qb=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],$b=[].concat(Zb,Yb,Xb);function ex(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=Kb,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:Kb,keyword:qb,literal:Jb,built_in:$b,"variable.language":Qb},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...Yb,...Xb]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...Zb,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function tx(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}var nx=`[0-9](_*[0-9])*`,rx=`\\.(${nx})`,ix=`[0-9a-fA-F](_*[0-9a-fA-F])*`,ax={className:`number`,variants:[{begin:`(\\b(${nx})((${rx})|\\.)?|(${rx}))[eE][+-]?(${nx})[fFdD]?\\b`},{begin:`\\b(${nx})((${rx})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${rx})[fFdD]?\\b`},{begin:`\\b(${nx})[fFdD]\\b`},{begin:`\\b0[xX]((${ix})\\.?|(${ix})?\\.(${ix}))[pP][+-]?(${nx})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${ix})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function ox(e){let t={keyword:`abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual`,built_in:`Byte Short Char Int Long Boolean Float Double Void Unit Nothing`,literal:`true false null`},n={className:`keyword`,begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:`symbol`,begin:/@\w+/}]}},r={className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`@`},i={className:`subst`,begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},a={className:`variable`,begin:`\\$`+e.UNDERSCORE_IDENT_RE},o={className:`string`,variants:[{begin:`"""`,end:`"""(?=[^"])`,contains:[a,i]},{begin:`'`,end:`'`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,a,i]}]};i.contains.push(o);let s={className:`meta`,begin:`@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*`+e.UNDERSCORE_IDENT_RE+`)?`},c={className:`meta`,begin:`@`+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:`string`}),`self`]}]},l=ax,u=e.COMMENT(`/\\*`,`\\*/`,{contains:[e.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:`type`,begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:`Kotlin`,aliases:[`kt`,`kts`],keywords:t,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`}]}),e.C_LINE_COMMENT_MODE,u,n,r,s,c,{className:`function`,beginKeywords:`fun`,end:`[(]|$`,returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+`\\s*\\(`,returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:`type`,begin:/</,end:/>/,keywords:`reified`,relevance:0},{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,u],relevance:0},e.C_LINE_COMMENT_MODE,u,s,c,o,e.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:`title.class`},keywords:`class interface trait`,end:/[:\{(]|$/,excludeEnd:!0,illegal:`extends implements`,contains:[{beginKeywords:`public protected internal private constructor`},e.UNDERSCORE_TITLE_MODE,{className:`type`,begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,c]},o,{className:`meta`,begin:`^#!/usr/bin/env`,end:`$`,illegal:`
|
|
57
|
-
`},l]}}var sx=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),cx=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),lx=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),ux=[...cx,...lx],dx=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),fx=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),px=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),mx=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse(),hx=fx.concat(px).sort().reverse();function gx(e){let t=sx(e),n=hx,r=`([\\w-]+|@\\{[\\w-]+\\})`,i=[],a=[],o=function(e){return{className:`string`,begin:`~?`+e+`.*?`+e}},s=function(e,t,n){return{className:e,begin:t,relevance:n}},c={$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:dx.join(` `)},l={begin:`\\(`,end:`\\)`,contains:a,keywords:c,relevance:0};a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,o(`'`),o(`"`),t.CSS_NUMBER_MODE,{begin:`(url|data-uri)\\(`,starts:{className:`string`,end:`[\\)\\n]`,excludeEnd:!0}},t.HEXCOLOR,l,s(`variable`,`@@?[\\w-]+`,10),s(`variable`,`@\\{[\\w-]+\\}`),s(`built_in`,"~?`[^`]*?`"),{className:`attribute`,begin:`[\\w-]+\\s*:`,end:`:`,returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:`and not`},t.FUNCTION_DISPATCH);let u=a.concat({begin:/\{/,end:/\}/,contains:i}),d={beginKeywords:`when`,endsWithParent:!0,contains:[{beginKeywords:`and not`}].concat(a)},f={begin:`([\\w-]+|@\\{[\\w-]+\\})\\s*:`,returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+mx.join(`|`)+`)\\b`,end:/(?=:)/,starts:{endsWithParent:!0,illegal:`[<=$]`,relevance:0,contains:a}}]},p={className:`keyword`,begin:`@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b`,starts:{end:`[;{}]`,keywords:c,returnEnd:!0,contains:a,relevance:0}},m={className:`variable`,variants:[{begin:`@[\\w-]+\\s*:`,relevance:15},{begin:`@[\\w-]+`}],starts:{end:`[;}]`,returnEnd:!0,contains:u}},h={variants:[{begin:`[\\.#:&\\[>]`,end:`[;{}]`},{begin:r,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d,s(`keyword`,`all\\b`),s(`variable`,`@\\{[\\w-]+\\}`),{begin:`\\b(`+ux.join(`|`)+`)\\b`,className:`selector-tag`},t.CSS_NUMBER_MODE,s(`selector-tag`,r,0),s(`selector-id`,`#([\\w-]+|@\\{[\\w-]+\\})`),s(`selector-class`,`\\.([\\w-]+|@\\{[\\w-]+\\})`,0),s(`selector-tag`,`&`,0),t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,begin:`:(`+fx.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+px.join(`|`)+`)`},{begin:/\(/,end:/\)/,relevance:0,contains:u},{begin:`!important`},t.FUNCTION_DISPATCH]},g={begin:`[\\w-]+:(:)?(${n.join(`|`)})`,returnBegin:!0,contains:[h]};return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,m,g,f,h,d,t.FUNCTION_DISPATCH),{name:`Less`,case_insensitive:!0,illegal:`[=>'/<($"]`,contains:i}}function _x(e){let t=`\\[=*\\[`,n=`\\]=*\\]`,r={begin:t,end:n,contains:[`self`]},i=[e.COMMENT(`--(?!\\[=*\\[)`,`$`),e.COMMENT(`--\\[=*\\[`,n,{contains:[r],relevance:10})];return{name:`Lua`,aliases:[`pluto`],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:`true false nil`,keyword:`and break do else elseif end for goto if in local not or repeat return then until while`,built_in:`_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove`},contains:i.concat([{className:`function`,beginKeywords:`function`,end:`\\)`,contains:[e.inherit(e.TITLE_MODE,{begin:`([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*`}),{className:`params`,begin:`\\(`,endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:`string`,begin:t,end:n,contains:[r],relevance:5}])}}function vx(e){let t={className:`variable`,variants:[{begin:`\\$\\(`+e.UNDERSCORE_IDENT_RE+`\\)`,contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:`variable`,begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:`subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value`},contains:[t,n]},i={begin:`^`+e.UNDERSCORE_IDENT_RE+`\\s*(?=[:+?]?=)`},a={className:`meta`,begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:`.PHONY`}},o={className:`section`,begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:`Makefile`,aliases:[`mk`,`mak`,`make`],keywords:{$pattern:/[\w-]+/,keyword:`define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath`},contains:[e.HASH_COMMENT_MODE,t,n,r,i,a,o]}}function yx(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function bx(e){let t={className:`built_in`,begin:`\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+`},n=/[a-zA-Z@][a-zA-Z0-9_]*/,r={"variable.language":[`this`,`super`],$pattern:n,keyword:`while.export.sizeof.typedef.const.struct.for.union.volatile.static.mutable.if.do.return.goto.enum.else.break.extern.asm.case.default.register.explicit.typename.switch.continue.inline.readonly.assign.readwrite.self.@synchronized.id.typeof.nonatomic.IBOutlet.IBAction.strong.weak.copy.in.out.inout.bycopy.byref.oneway.__strong.__weak.__block.__autoreleasing.@private.@protected.@public.@try.@property.@end.@throw.@catch.@finally.@autoreleasepool.@synthesize.@dynamic.@selector.@optional.@required.@encode.@package.@import.@defs.@compatibility_alias.__bridge.__bridge_transfer.__bridge_retained.__bridge_retain.__covariant.__contravariant.__kindof._Nonnull._Nullable._Null_unspecified.__FUNCTION__.__PRETTY_FUNCTION__.__attribute__.getter.setter.retain.unsafe_unretained.nonnull.nullable.null_unspecified.null_resettable.class.instancetype.NS_DESIGNATED_INITIALIZER.NS_UNAVAILABLE.NS_REQUIRES_SUPER.NS_RETURNS_INNER_POINTER.NS_INLINE.NS_AVAILABLE.NS_DEPRECATED.NS_ENUM.NS_OPTIONS.NS_SWIFT_UNAVAILABLE.NS_ASSUME_NONNULL_BEGIN.NS_ASSUME_NONNULL_END.NS_REFINED_FOR_SWIFT.NS_SWIFT_NAME.NS_SWIFT_NOTHROW.NS_DURING.NS_HANDLER.NS_ENDHANDLER.NS_VALUERETURN.NS_VOIDRETURN`.split(`.`),literal:[`false`,`true`,`FALSE`,`TRUE`,`nil`,`YES`,`NO`,`NULL`],built_in:[`dispatch_once_t`,`dispatch_queue_t`,`dispatch_sync`,`dispatch_async`,`dispatch_once`],type:[`int`,`float`,`char`,`unsigned`,`signed`,`short`,`long`,`double`,`wchar_t`,`unichar`,`void`,`bool`,`BOOL`,`id|0`,`_Bool`]},i={$pattern:n,keyword:[`@interface`,`@class`,`@protocol`,`@implementation`]};return{name:`Objective-C`,aliases:[`mm`,`objc`,`obj-c`,`obj-c++`,`objective-c++`],keywords:r,illegal:`</`,contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:`string`,variants:[{begin:`@"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]}]},{className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),{className:`string`,begin:/<.*?>/,end:/$/,illegal:`\\n`},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`class`,begin:`(`+i.keyword.join(`|`)+`)\\b`,end:/(\{|$)/,excludeEnd:!0,keywords:i,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:`\\.`+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function xx(e){let t=e.regex,n=`abs.accept.alarm.and.atan2.bind.binmode.bless.break.caller.chdir.chmod.chomp.chop.chown.chr.chroot.class.close.closedir.connect.continue.cos.crypt.dbmclose.dbmopen.defined.delete.die.do.dump.each.else.elsif.endgrent.endhostent.endnetent.endprotoent.endpwent.endservent.eof.eval.exec.exists.exit.exp.fcntl.field.fileno.flock.for.foreach.fork.format.formline.getc.getgrent.getgrgid.getgrnam.gethostbyaddr.gethostbyname.gethostent.getlogin.getnetbyaddr.getnetbyname.getnetent.getpeername.getpgrp.getpriority.getprotobyname.getprotobynumber.getprotoent.getpwent.getpwnam.getpwuid.getservbyname.getservbyport.getservent.getsockname.getsockopt.given.glob.gmtime.goto.grep.gt.hex.if.index.int.ioctl.join.keys.kill.last.lc.lcfirst.length.link.listen.local.localtime.log.lstat.lt.ma.map.method.mkdir.msgctl.msgget.msgrcv.msgsnd.my.ne.next.no.not.oct.open.opendir.or.ord.our.pack.package.pipe.pop.pos.print.printf.prototype.push.q|0.qq.quotemeta.qw.qx.rand.read.readdir.readline.readlink.readpipe.recv.redo.ref.rename.require.reset.return.reverse.rewinddir.rindex.rmdir.say.scalar.seek.seekdir.select.semctl.semget.semop.send.setgrent.sethostent.setnetent.setpgrp.setpriority.setprotoent.setpwent.setservent.setsockopt.shift.shmctl.shmget.shmread.shmwrite.shutdown.sin.sleep.socket.socketpair.sort.splice.split.sprintf.sqrt.srand.stat.state.study.sub.substr.symlink.syscall.sysopen.sysread.sysseek.system.syswrite.tell.telldir.tie.tied.time.times.tr.truncate.uc.ucfirst.umask.undef.unless.unlink.unpack.unshift.untie.until.use.utime.values.vec.wait.waitpid.wantarray.warn.when.while.write.x|0.xor.y|0`.split(`.`),r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(` `)},a={className:`subst`,begin:`[$@]\\{`,end:`\\}`,keywords:i},o={begin:/->\{/,end:/\}/},s={scope:`attr`,match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:`variable`,variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,`(?![A-Za-z])(?![@$%])`)},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},l={className:`number`,variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,a,c],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(e,n,i=`\\1`)=>{let a=i===`\\1`?i:t.concat(i,n);return t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,i,r)},p=(e,n,i)=>t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,i,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:`string`,contains:u,variants:[{begin:`q[qwxr]?\\s*\\(`,end:`\\)`,relevance:5},{begin:`q[qwxr]?\\s*\\[`,end:`\\]`,relevance:5},{begin:`q[qwxr]?\\s*\\{`,end:`\\}`,relevance:5},{begin:`q[qwxr]?\\s*\\|`,end:`\\|`,relevance:5},{begin:`q[qwxr]?\\s*<`,end:`>`,relevance:5},{begin:`qw\\s+q`,end:`q`,relevance:5},{begin:`'`,end:`'`,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:`-?\\w+\\s*=>`,relevance:0}]},l,{begin:`(\\/\\/|`+e.RE_STARTERS_RE+`|\\b(split|return|print|reverse|grep)\\b)\\s*`,keywords:`split return print reverse grep`,relevance:0,contains:[e.HASH_COMMENT_MODE,{className:`regexp`,variants:[{begin:f(`s|tr|y`,t.either(...d,{capture:!0}))},{begin:f(`s|tr|y`,`\\(`,`\\)`)},{begin:f(`s|tr|y`,`\\[`,`\\]`)},{begin:f(`s|tr|y`,`\\{`,`\\}`)}],relevance:2},{className:`regexp`,variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p(`(?:m|qr)?`,/\//,/\//)},{begin:p(`m|qr`,t.either(...d,{capture:!0}),/\1/)},{begin:p(`m|qr`,/\(/,/\)/)},{begin:p(`m|qr`,/\[/,/\]/)},{begin:p(`m|qr`,/\{/,/\}/)}]}]},{className:`function`,beginKeywords:`sub method`,end:`(\\s*\\(.*?\\))?[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:`class`,beginKeywords:`class`,end:`[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,l]},{begin:`-\\w\\b`,relevance:0},{begin:`^__DATA__$`,end:`^__END__$`,subLanguage:`mojolicious`,contains:[{begin:`^@@.*`,end:`$`,className:`comment`}]}];return a.contains=m,o.contains=m,{name:`Perl`,aliases:[`pl`,`pm`],keywords:i,contains:m}}function Sx(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:`variable`,match:`\\$+`+r},s={scope:`meta`,variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:`subst`,variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},f=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
|
|
58
|
-
]`,m={scope:`string`,variants:[u,l,d,f]},h={scope:`number`,variants:[{begin:`\\b0[bB][01]+(?:_[01]+)*\\b`},{begin:`\\b0[oO][0-7]+(?:_[0-7]+)*\\b`},{begin:`\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b`},{begin:`(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?`}],relevance:0},g=[`false`,`null`,`true`],_=`__CLASS__.__DIR__.__FILE__.__FUNCTION__.__COMPILER_HALT_OFFSET__.__LINE__.__METHOD__.__NAMESPACE__.__TRAIT__.die.echo.exit.include.include_once.print.require.require_once.array.abstract.and.as.binary.bool.boolean.break.callable.case.catch.class.clone.const.continue.declare.default.do.double.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.extends.final.finally.float.for.foreach.from.global.goto.if.implements.instanceof.insteadof.int.integer.interface.isset.iterable.list.match|0.mixed.new.never.object.or.private.protected.public.readonly.real.return.string.switch.throw.trait.try.unset.use.var.void.while.xor.yield`.split(`.`),v=`Error|0.AppendIterator.ArgumentCountError.ArithmeticError.ArrayIterator.ArrayObject.AssertionError.BadFunctionCallException.BadMethodCallException.CachingIterator.CallbackFilterIterator.CompileError.Countable.DirectoryIterator.DivisionByZeroError.DomainException.EmptyIterator.ErrorException.Exception.FilesystemIterator.FilterIterator.GlobIterator.InfiniteIterator.InvalidArgumentException.IteratorIterator.LengthException.LimitIterator.LogicException.MultipleIterator.NoRewindIterator.OutOfBoundsException.OutOfRangeException.OuterIterator.OverflowException.ParentIterator.ParseError.RangeException.RecursiveArrayIterator.RecursiveCachingIterator.RecursiveCallbackFilterIterator.RecursiveDirectoryIterator.RecursiveFilterIterator.RecursiveIterator.RecursiveIteratorIterator.RecursiveRegexIterator.RecursiveTreeIterator.RegexIterator.RuntimeException.SeekableIterator.SplDoublyLinkedList.SplFileInfo.SplFileObject.SplFixedArray.SplHeap.SplMaxHeap.SplMinHeap.SplObjectStorage.SplObserver.SplPriorityQueue.SplQueue.SplStack.SplSubject.SplTempFileObject.TypeError.UnderflowException.UnexpectedValueException.UnhandledMatchError.ArrayAccess.BackedEnum.Closure.Fiber.Generator.Iterator.IteratorAggregate.Serializable.Stringable.Throwable.Traversable.UnitEnum.WeakReference.WeakMap.Directory.__PHP_Incomplete_Class.parent.php_user_filter.self.static.stdClass`.split(`.`),y={keyword:_,literal:(e=>{let t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(g),built_in:v},b=e=>e.map(e=>e.replace(/\|\d+$/,``)),x={variants:[{match:[/new/,t.concat(p,`+`),t.concat(`(?!`,b(v).join(`\\b|`),`\\b)`),i],scope:{1:`keyword`,4:`title.class`}}]},S=t.concat(r,`\\b(?!\\()`),C={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{2:`variable.constant`}},{match:[/::/,/class/],scope:{2:`variable.language`}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{1:`title.class`,3:`variable.constant`}},{match:[i,t.concat(`::`,t.lookahead(/(?!class\b)/))],scope:{1:`title.class`}},{match:[i,/::/,/class/],scope:{1:`title.class`,3:`variable.language`}}]},w={scope:`attr`,match:t.concat(r,t.lookahead(`:`),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[w,o,C,e.C_BLOCK_COMMENT_MODE,m,h,x]},E={relevance:0,match:[/\b/,t.concat(`(?!fn\\b|function\\b|`,b(_).join(`\\b|`),`|`,b(v).join(`\\b|`),`\\b)`),r,t.concat(p,`*`),t.lookahead(/(?=\()/)],scope:{3:`title.function.invoke`},contains:[T]};T.contains.push(E);let D=[w,C,e.C_BLOCK_COMMENT_MODE,m,h,x],O={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:`meta`,end:/]/,endScope:`meta`,keywords:{literal:g,keyword:[`new`,`array`]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:[`new`,`array`]},contains:[`self`,...D]},...D,{scope:`meta`,variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:y,contains:[O,e.HASH_COMMENT_MODE,e.COMMENT(`//`,`$`),e.COMMENT(`/\\*`,`\\*/`,{contains:[{scope:`doctag`,match:`@[A-Za-z]+`}]}),{match:/__halt_compiler\(\);/,keywords:`__halt_compiler`,starts:{scope:`comment`,end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:`meta`,endsParent:!0}]}},s,{scope:`variable.language`,match:/\$this\b/},o,E,C,{match:[/const/,/\s/,r],scope:{1:`keyword`,3:`variable.constant`}},x,{scope:`function`,relevance:0,beginKeywords:`fn function`,end:/[;{]/,excludeEnd:!0,illegal:`[$%\\[]`,contains:[{beginKeywords:`use`},e.UNDERSCORE_TITLE_MODE,{begin:`=>`,endsParent:!0},{scope:`params`,begin:`\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0,keywords:y,contains:[`self`,O,o,C,e.C_BLOCK_COMMENT_MODE,m,h]}]},{scope:`class`,variants:[{beginKeywords:`enum`,illegal:/[($"]/},{beginKeywords:`class interface trait`,illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:`extends implements`},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:`namespace`,relevance:0,end:`;`,illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:`title.class`})]},{beginKeywords:`use`,relevance:0,end:`;`,contains:[{match:/\b(as|const|function)\b/,scope:`keyword`},e.UNDERSCORE_TITLE_MODE]},m,h]}}function Cx(e){return{name:`PHP template`,subLanguage:`xml`,contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:`php`,contains:[{begin:`/\\*`,end:`\\*/`,skip:!0},{begin:`b"`,end:`"`,skip:!0},{begin:`b'`,end:`'`,skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function wx(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}function Tx(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function Ex(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Dx(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:`R`,keywords:{$pattern:n,keyword:`function if in break next repeat else for while`,literal:`NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10`,built_in:`LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm`},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:`doctag`,match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:`doctag`,begin:`@param`,end:/$/,contains:[{scope:`variable`,variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:`doctag`,match:/@[a-zA-Z]+/},{scope:`keyword`,match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:`"`,end:`"`,relevance:0},{begin:`'`,end:`'`,relevance:0}]},{relevance:0,variants:[{scope:{1:`operator`,2:`number`},match:[i,r]},{scope:{1:`operator`,2:`number`},match:[/%[^%]*%/,r]},{scope:{1:`punctuation`,2:`number`},match:[a,r]},{scope:{2:`number`},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:`operator`},match:[n,/\s+/,/<-/,/\s+/]},{scope:`operator`,relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:`punctuation`,relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Ox(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a={"variable.constant":[`__FILE__`,`__LINE__`,`__ENCODING__`],"variable.language":[`self`,`super`],keyword:`alias.and.begin.BEGIN.break.case.class.defined.do.else.elsif.end.END.ensure.for.if.in.module.next.not.or.redo.require.rescue.retry.return.then.undef.unless.until.when.while.yield.include.extend.prepend.public.private.protected.raise.throw`.split(`.`),built_in:[`proc`,`lambda`,`attr_accessor`,`attr_reader`,`attr_writer`,`define_method`,`private_constant`,`module_function`],literal:[`true`,`false`,`nil`]},o={className:`doctag`,begin:`@[A-Za-z]+`},s={begin:`#<`,end:`>`},c=[e.COMMENT(`#`,`$`,{contains:[o]}),e.COMMENT(`^=begin`,`^=end`,{contains:[o],relevance:10}),e.COMMENT(`^__END__`,e.MATCH_NOTHING_RE)],l={className:`subst`,begin:/#\{/,end:/\}/,keywords:a},u={className:`string`,contains:[e.BACKSLASH_ESCAPE,l],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,l]})]}]},d=`[0-9](_?[0-9])*`,f={className:`number`,relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`},{begin:`\\b0[dD][0-9](_?[0-9])*r?i?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*r?i?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*r?i?\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b`},{begin:`\\b0(_?[0-7])+r?i?\\b`}]},p={variants:[{match:/\(\)/},{className:`params`,begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},m=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:`title.class`},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:`title.class`}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`},{relevance:0,match:r,scope:`title.class`},{match:[/def/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[p]},{begin:e.IDENT_RE+`::`},{className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`(!|\\?)?:`,relevance:0},{className:`symbol`,begin:`:(?!\\s)`,contains:[u,{begin:n}],relevance:0},f,{className:`variable`,begin:`(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`},{className:`params`,begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:`(`+e.RE_STARTERS_RE+`|unless)\\s*`,keywords:`unless`,contains:[{className:`regexp`,contains:[e.BACKSLASH_ESCAPE,l],illegal:/\n/,variants:[{begin:`/`,end:`/[a-z]*`},{begin:/%r\{/,end:/\}[a-z]*/},{begin:`%r\\(`,end:`\\)[a-z]*`},{begin:`%r!`,end:`![a-z]*`},{begin:`%r\\[`,end:`\\][a-z]*`}]}].concat(s,c),relevance:0}].concat(s,c);l.contains=m,p.contains=m;let h=[{begin:/^\s*=>/,starts:{end:`$`,contains:m}},{className:`meta.prompt`,begin:`^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])`,starts:{end:`$`,keywords:a,contains:m}}];return c.unshift(s),{name:`Ruby`,aliases:[`rb`,`gemspec`,`podspec`,`thor`,`irb`],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:`ruby`})].concat(h,c,m)}}function kx(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),s=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],c=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),l=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:l,keyword:o,literal:s,built_in:c},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:`number`,variants:[{begin:`\\b0b([01_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0o([0-7_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0x([A-Fa-f0-9_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)([ui](8|16|32|64|128|size)|f(32|64))?`}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:`keyword`,3:`title.function`}},{className:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:c,type:l}},{className:`punctuation`,begin:`->`},a]}}var Ax=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),jx=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),Mx=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),Nx=[...jx,...Mx],Px=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),Fx=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),Ix=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),Lx=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function Rx(e){let t=Ax(e),n=Ix,r=Fx,i=`@[a-z-]+`,a={className:`variable`,begin:`(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b`,relevance:0};return{name:`SCSS`,case_insensitive:!0,illegal:`[=/|']`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:`selector-id`,begin:`#[A-Za-z0-9_-]+`,relevance:0},{className:`selector-class`,begin:`\\.[A-Za-z0-9_-]+`,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-tag`,begin:`\\b(`+Nx.join(`|`)+`)\\b`,relevance:0},{className:`selector-pseudo`,begin:`:(`+r.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+n.join(`|`)+`)`},a,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+Lx.join(`|`)+`)\\b`},{begin:`\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b`},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,a,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:`@(page|font-face)`,keywords:{$pattern:i,keyword:`@page @font-face`}},{begin:`@`,end:`[{;]`,returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:Px.join(` `)},contains:[{begin:i,className:`keyword`},{begin:/[a-z-]+(?=:)/,className:`attribute`},a,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function zx(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function Bx(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}function Vx(e){return e?typeof e==`string`?e:e.source:null}function Hx(e){return Ux(`(?=`,e,`)`)}function Ux(...e){return e.map(e=>Vx(e)).join(``)}function Wx(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Gx(...e){return`(`+(Wx(e).capture?``:`?:`)+e.map(e=>Vx(e)).join(`|`)+`)`}var Kx=e=>Ux(/\b/,e,/\w$/.test(e)?/\b/:/\B/),qx=[`Protocol`,`Type`].map(Kx),Jx=[`init`,`self`].map(Kx),Yx=[`Any`,`Self`],Xx=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],Zx=[`false`,`nil`,`true`],Qx=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],$x=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],eS=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),tS=Gx(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),nS=Gx(tS,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),rS=Ux(tS,nS,`*`),iS=Gx(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),aS=Gx(iS,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),oS=Ux(iS,aS,`*`),sS=Ux(/[A-Z]/,aS,`*`),cS=[`attached`,`autoclosure`,Ux(/convention\(/,Gx(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,Ux(/objc\(/,oS,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],lS=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function uS(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,Gx(...qx,...Jx)],className:{2:`keyword`}},a={match:Ux(/\./,Gx(...Xx)),relevance:0},o=Xx.filter(e=>typeof e==`string`).concat([`_|0`]),s={variants:[{className:`keyword`,match:Gx(...Xx.filter(e=>typeof e!=`string`).concat(Yx).map(Kx),...Jx)}]},c={$pattern:Gx(/\b\w+/,/#\w+/),keyword:o.concat($x),literal:Zx},l=[i,a,s],u=[{match:Ux(/\./,Gx(...eS)),relevance:0},{className:`built_in`,match:Ux(/\b/,Gx(...eS),/(?=\()/)}],d={match:/->/,relevance:0},f=[d,{className:`operator`,relevance:0,variants:[{match:rS},{match:`\\.(\\.|${nS})+`}]}],p=`([0-9]_*)+`,m=`([0-9a-fA-F]_*)+`,h={className:`number`,relevance:0,variants:[{match:`\\b(${p})(\\.(${p}))?([eE][+-]?(${p}))?\\b`},{match:`\\b0x(${m})(\\.(${m}))?([pP][+-]?(${p}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(e=``)=>({className:`subst`,variants:[{match:Ux(/\\/,e,/[0\\tnr"']/)},{match:Ux(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(e=``)=>({className:`subst`,match:Ux(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),v=(e=``)=>({className:`subst`,label:`interpol`,begin:Ux(/\\/,e,/\(/),end:/\)/}),y=(e=``)=>({begin:Ux(e,/"""/),end:Ux(/"""/,e),contains:[g(e),_(e),v(e)]}),b=(e=``)=>({begin:Ux(e,/"/),end:Ux(/"/,e),contains:[g(e),v(e)]}),x={className:`string`,variants:[y(),y(`#`),y(`##`),y(`###`),b(),b(`#`),b(`##`),b(`###`)]},S=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],C={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:S},w=e=>{let t=Ux(e,/\//),n=Ux(/\//,e);return{begin:t,end:n,contains:[...S,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},T={scope:`regexp`,variants:[w(`###`),w(`##`),w(`#`),C]},E={match:Ux(/`/,oS,/`/)},D=[E,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${aS}+`}],O=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:lS,contains:[...f,h,x]}]}},{scope:`keyword`,match:Ux(/@/,Gx(...cS),Hx(Gx(/\(/,/\s+/)))},{scope:`meta`,match:Ux(/@/,oS)}],k={match:Hx(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:Ux(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,aS,`+`)},{className:`type`,match:sS,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ux(/\s+&\s+/,Hx(sS)),relevance:0}]},A={begin:/</,end:/>/,keywords:c,contains:[...r,...l,...O,d,k]};k.contains.push(A);let j={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:[`self`,{match:Ux(oS,/\s*:/),keywords:`_|0`,relevance:0},...r,T,...l,...u,...f,h,x,...D,...O,k]},M={begin:/</,end:/>/,keywords:`repeat each`,contains:[...r,k]},N={begin:/\(/,end:/\)/,keywords:c,contains:[{begin:Gx(Hx(Ux(oS,/\s*:/)),Hx(Ux(oS,/\s+/,oS,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:oS}]},...r,...l,...f,h,x,...O,k,j],endsParent:!0,illegal:/["']/},P={match:[/(func|macro)/,/\s+/,Gx(E.match,oS,rS)],className:{1:`keyword`,3:`title.function`},contains:[M,N,t],illegal:[/\[/,/%/]},F={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[M,N,t],illegal:/\[|%/},I={match:[/operator/,/\s+/,rS],className:{1:`keyword`,3:`title`}},L={begin:[/precedencegroup/,/\s+/,sS],className:{1:`keyword`,3:`title`},contains:[k],keywords:[...Qx,...Zx],end:/}/},ee={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},te={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},ne={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,oS,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:c,contains:[M,...l,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:`title.class.inherited`,match:sS},...l],relevance:0}]};for(let e of x.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=c;let n=[...l,...u,...f,h,x,...D];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:c,contains:[...r,P,F,ee,te,ne,I,L,{beginKeywords:`import`,end:/$/,contains:[...r],relevance:0},T,...l,...u,...f,h,x,...D,...O,k,j]}}var dS=`[A-Za-z$_][0-9A-Za-z$_]*`,fS=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),pS=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],mS=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),hS=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],gS=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],_S=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],vS=[].concat(gS,mS,hS);function yS(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=dS,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:dS,keyword:fS,literal:pS,built_in:vS,"variable.language":_S},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...mS,...hS]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...gS,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function bS(e){let t=e.regex,n=yS(e),r=dS,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:dS,keyword:fS.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:pS,built_in:vS.concat(i),"variable.language":_S},l={className:`meta`,begin:`@[A-Za-z$_][0-9A-Za-z$_]*`},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function xS(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}function SS(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}function CS(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function wS(e){let t=`true false yes no null`,n={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},a={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),s={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},c={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},l={begin:/\{/,end:/\}/,contains:[c],illegal:`\\n`,relevance:0},u={begin:`\\[`,end:`\\]`,contains:[c],illegal:`\\n`,relevance:0},d=[n,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!<[\\w#;/?:@&=+$,.~*'()[\\]]+>`},{className:`type`,begin:`![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},s,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},l,u,i,a],f=[...d];return f.pop(),f.push(o),c.contains=f,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:d}}var TS={arduino:Sb,bash:Cb,c:wb,cpp:Tb,csharp:Eb,css:Fb,diff:Ib,go:Lb,graphql:Rb,ini:zb,java:Gb,javascript:ex,json:tx,kotlin:ox,less:gx,lua:_x,makefile:vx,markdown:yx,objectivec:bx,perl:xx,php:Sx,"php-template":Cx,plaintext:wx,python:Tx,"python-repl":Ex,r:Dx,ruby:Ox,rust:kx,scss:Rx,shell:zx,sql:Bx,swift:uS,typescript:bS,vbnet:xS,wasm:SS,xml:CS,yaml:wS},ES=pe(P(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),ee=I(`/\\*`,`\\*/`),te=I(`#`,`$`),ne=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:ee,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:te,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function re(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function ie(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ae(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=re,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function oe(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function se(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function ce(e,t){e.relevance===void 0&&(e.relevance=1)}var le=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},ue=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],de=`keyword`;function fe(e,t,n=de){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,fe(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,pe(n[0],n[1])]})}}function pe(e,t){return t?Number(t):+!me(e)}function me(e){return ue.includes(e.toLowerCase())}var he={},ge=e=>{console.error(e)},_e=(e,...t)=>{console.log(`WARN: ${e}`,...t)},ve=(e,t)=>{he[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),he[`${e}/${t}`]=!0)},ye=Error();function be(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function xe(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw ge(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),ye;if(typeof e.beginScope!=`object`||e.beginScope===null)throw ge(`beginScope must be object`),ye;be(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function Se(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw ge(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),ye;if(typeof e.endScope!=`object`||e.endScope===null)throw ge(`endScope must be object`),ye;be(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function Ce(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function we(e){Ce(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),xe(e),Se(e)}function Te(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[ie,se,we,le].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ae,oe,ce].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=fe(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return De(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function Ee(e){return e?e.endsWithParent||Ee(e.starts):!1}function De(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Ee(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Oe=`11.11.1`,ke=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},Ae=i,je=a,Me=Symbol(`nomatch`),Ne=7,Pe=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(_e(s.replace(`{}`,n[1])),_e(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(ve(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),ve(`10.7.0`,`Please use highlight(code, options) instead.
|
|
59
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};te(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,te(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Ne&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(ee=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Me;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==Me)return e}if(r.type===`illegal`&&a===``)return P+=`
|
|
60
|
-
`,1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw ge(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=Te(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,ee=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,ee?ee=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:Ae(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:Ae(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:Ae(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(te(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new ke(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),te(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=je(l,e)}let E=()=>{k(),ve(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),ve(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(ge(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)ge(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function ee(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function te(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function re(e){return ve(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),ve(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:re,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:je,addPlugin:L,removePlugin:ee}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Oe,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in ne)typeof ne[e]==`object`&&n(ne[e]);return Object.assign(e,ne),e},Fe=Pe({});Fe.newInstance=()=>Pe({}),t.exports=Fe,Fe.HighlightJS=Fe,Fe.default=Fe}))()).default,DS={},OS=`hljs-`;function kS(e){let t=ES.newInstance();return e&&a(e),{highlight:n,highlightAuto:r,listLanguages:i,register:a,registerAlias:o,registered:s};function n(e,n,r){let i=r||DS,a=typeof i.prefix==`string`?i.prefix:OS;if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:AS,classPrefix:a});let o=t.highlight(n,{ignoreIllegals:!0,language:e});if(o.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:o.errorRaised});let s=o._emitter.root,c=s.data;return c.language=o.language,c.relevance=o.relevance,s}function r(e,r){let a=(r||DS).subset||i(),o=-1,s=0,c;for(;++o<a.length;){let i=a[o];if(!t.getLanguage(i))continue;let l=n(i,e,r);l.data&&l.data.relevance!==void 0&&l.data.relevance>s&&(s=l.data.relevance,c=l)}return c||{type:`root`,children:[],data:{language:void 0,relevance:s}}}function i(){return t.listLanguages()}function a(e,n){if(typeof e==`string`)t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}function o(e,n){if(typeof e==`string`)t.registerAliases(typeof n==`string`?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases(typeof r==`string`?r:[...r],{languageName:n})}}}function s(e){return!!t.getLanguage(e)}}var AS=class{constructor(e){this.options=e,this.root={type:`root`,children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e===``)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&n.type===`text`?n.value+=e:t.children.push({type:`text`,value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:`element`,tagName:`span`,properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(`.`).map(function(e,n){return n?e+`_`.repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:`element`,tagName:`span`,properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return``}},jS={};function MS(e){let t=e||jS,n=t.aliases,r=t.detect||!1,i=t.languages||TS,a=t.plainText,o=t.prefix,s=t.subset,c=`hljs`,l=kS(i);if(n&&l.registerAlias(n),o){let e=o.indexOf(`-`);c=e===-1?o:o.slice(0,e)}return function(e,t){qv(e,`element`,function(e,n,i){if(e.tagName!==`code`||!i||i.type!==`element`||i.tagName!==`pre`)return;let u=NS(e);if(u===!1||!u&&!r||u&&a&&a.includes(u))return;Array.isArray(e.properties.className)||(e.properties.className=[]),e.properties.className.includes(c)||e.properties.className.unshift(c);let d=db(e,{whitespace:`pre`}),f;try{f=u?l.highlight(u,d,{prefix:o}):l.highlightAuto(d,{prefix:o,subset:s})}catch(n){let r=n;if(u&&/Unknown language/.test(r.message)){t.message("Cannot highlight as `"+u+"`, it’s not registered",{ancestors:[i,e],cause:r,place:e.position,ruleId:`missing-language`,source:`rehype-highlight`});return}throw r}!u&&f.data&&f.data.language&&e.properties.className.push(`language-`+f.data.language),f.children.length>0&&(e.children=f.children)})}}function NS(e){let t=e.properties.className,n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){let e=String(t[n]);if(e===`no-highlight`||e===`nohighlight`)return!1;!r&&e.slice(0,5)===`lang-`&&(r=e.slice(5)),!r&&e.slice(0,9)===`language-`&&(r=e.slice(9))}return r}var PS=`a.blockquote.br.code.del.em.h1.h2.h3.h4.h5.h6.hr.li.ol.p.pre.span.strong.table.tbody.td.th.thead.tr.ul`.split(`.`);function FS({children:e,label:t}){let n=op(e);return n===void 0?(0,z.jsx)(`div`,{className:`message-markdown`,children:(0,z.jsx)(Gy,{allowedElements:[...PS],rehypePlugins:[MS],skipHtml:!0,children:e})}):(0,z.jsx)(dp,{className:`whitespace-pre`,label:`${t} formatted JSON`,value:n})}var IS=200,LS=`mt-0 max-h-72 whitespace-pre-wrap rounded-none border-0 text-[11px]`,RS={completed:`text-success`,failed:`text-destructive`,interrupted:`text-warning`,timeout:`text-warning`};function zS({label:e,value:t}){return(0,z.jsx)(dp,{className:`mt-0 max-h-90 whitespace-pre-wrap rounded-none border-0 text-[11px]`,label:e,value:t})}function BS(e){return e===null||!Number.isFinite(e)?null:e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function VS(e){return e.input===void 0||e.input===null?e.output??``:typeof e.input==`string`?e.input:cp(e.input)}function HS(e){return VS(e).split(`
|
|
61
|
-
`,1)[0]?.trim().slice(0,IS)??``}function US({status:e}){return e?(0,z.jsxs)(`span`,{className:C(`flex shrink-0 items-center gap-1 text-[9px] uppercase tracking-[.08em]`,RS[e]??`text-subtle`),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-current`}),e]}):null}function WS({invocation:e}){let t=[[`Call ID`,e.toolCallId],[`Started`,e.startedAt],[`Finished`,e.finishedAt],[`Timing`,e.timingSource]].filter(([,e])=>e!==null);return t.length===0?null:(0,z.jsx)(`dl`,{"aria-label":`${e.name} tool timing`,className:`flex flex-wrap gap-2 px-3.5 py-2`,children:t.map(([e,t])=>(0,z.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,z.jsx)(`dt`,{className:`text-[9px] uppercase text-subtle`,children:e}),(0,z.jsx)(`dd`,{className:`m-0 font-mono text-[10px] text-muted-foreground`,children:t})]},e))})}function GS({children:e,title:t}){return(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h4`,{className:`m-0 px-3.5 pt-2 text-[9px] font-bold uppercase tracking-[.08em] text-subtle`,children:t}),e]})}function KS({invocation:e,current:t}){let n=BS(e.durationMs),r=HS(e),i=e.input!==void 0&&e.input!==null,a=e.output===null?void 0:op(e.output);return(0,z.jsxs)(Nr,{"aria-current":t?`true`:void 0,"data-tool-call-id":e.toolCallId??void 0,"data-event-index":e.id.slice(5),className:`rounded-[10px] border bg-card px-3`,value:e.id,children:[(0,z.jsxs)(Pr,{"aria-label":`${e.name} tool details`,className:`items-center gap-2 py-1.5 text-xs text-muted-foreground`,children:[(0,z.jsx)(ot,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,z.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:e.name}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[10px] font-normal text-subtle`,children:r}),n?(0,z.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-subtle`,children:n}):null,(0,z.jsx)(US,{status:e.status})]}),(0,z.jsxs)(Fr,{className:`-mx-3 border-t p-0`,children:[(0,z.jsx)(WS,{invocation:e}),i?(0,z.jsx)(GS,{title:`Input`,children:(0,z.jsx)(dp,{className:LS,label:`${e.name} tool input`,value:e.input})}):null,e.output===null?null:(0,z.jsx)(GS,{title:`Output`,children:a===void 0?(0,z.jsx)(`pre`,{"aria-label":`${e.name} tool output`,className:C(`message-json`,LS),children:e.output}):(0,z.jsx)(dp,{className:LS,label:`${e.name} tool output`,value:a})}),!i&&e.output===null?(0,z.jsxs)(`p`,{className:`m-0 px-3.5 py-2 text-[11px] italic text-muted-foreground`,children:[`This `,e.kind,` event carried no input or output.`]}):null]})]})}function qS({usage:e}){let t=[[`Input`,`inputTokens`,e.inputTokens],[`Output`,`outputTokens`,e.outputTokens],[`Cache read`,`cacheReadTokens`,e.cacheReadTokens],[`Cache write`,`cacheWriteTokens`,e.cacheWriteTokens],[`Cost`,`costUsd`,e.costUsd]].filter(([,t])=>Object.hasOwn(e,t));return t.length===0?null:(0,z.jsx)(`dl`,{"aria-label":`Usage`,className:`mt-4.5 flex flex-wrap gap-2`,children:t.map(([e,t,n])=>(0,z.jsxs)(`div`,{className:`flex gap-1.5 rounded-md bg-muted px-2 py-1`,children:[(0,z.jsx)(`dt`,{className:`text-[9px] uppercase text-subtle`,children:e}),(0,z.jsx)(`dd`,{className:`m-0 text-[10px] text-muted-foreground`,children:n===null?`Not reported`:t===`costUsd`&&typeof n==`number`?`$${n.toFixed(4)}`:n??`Not reported`})]},t))})}function JS({events:e}){return(0,z.jsx)(`section`,{"aria-label":`Agent activity`,className:`my-3 space-y-2`,children:[...e].sort((e,t)=>e.index-t.index).map(e=>e.kind===`reasoning`?(0,z.jsx)(Mr,{collapsible:!0,type:`single`,children:(0,z.jsxs)(Nr,{className:`rounded-[10px] border border-dashed bg-card px-3`,value:`reasoning-${e.index}`,children:[(0,z.jsx)(Pr,{className:`py-1.5 text-xs text-muted-foreground`,children:`Reasoning`}),(0,z.jsx)(Fr,{className:`whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground`,children:e.text})]})},`reasoning-${e.index}`):(0,z.jsx)(`div`,{"aria-label":`Agent message`,className:`border-l-2 border-primary pl-3`,role:`group`,children:(0,z.jsx)(FS,{label:`Agent message`,children:e.text})},`message-${e.index}`))})}function YS({author:e,focus:t,turn:n}){let r=(0,R.useRef)(null),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)([]),c=t?.turnId===n.id,l=c?Yf(n.tools).find(e=>t.toolCallId===void 0?t.eventIndex!==void 0&&e.eventIndices.includes(t.eventIndex):e.toolCallId===t.toolCallId):void 0,u=l?.id,d=c?JSON.stringify(t):void 0;(0,R.useEffect)(()=>{d&&(a(!1),u&&s(e=>e.includes(u)?e:[...e,u]))},[d,u]),(0,R.useEffect)(()=>{!d||i||u&&!o.includes(u)||(r.current?.scrollIntoView?.({block:`nearest`}),r.current?.querySelector(`[aria-current="true"]`)?.scrollIntoView?.({block:`nearest`}))},[d,i,o,u]);let f=Object.keys(n.unknown).length>0,p=Yf(n.tools),m=n.status===`running`;return(0,z.jsxs)(`article`,{ref:r,"data-turn-id":n.id,"aria-current":c&&!l?`true`:void 0,"aria-label":`Turn ${n.id} from ${n.harness}`,className:`mx-auto mb-10.5 max-w-[850px]`,children:[(0,z.jsxs)(`button`,{className:`mb-2 text-[10px] text-muted-foreground hover:text-foreground`,type:`button`,"aria-expanded":!i,onClick:()=>a(!i),children:[i?`Expand`:`Collapse`,` turn `,n.id]}),(0,z.jsxs)(`div`,{hidden:i,children:[(0,z.jsx)(np,{from:`user`,children:(0,z.jsxs)(rp,{className:`mb-8 ml-auto max-w-[min(680px,88%)] rounded-[22px_22px_5px_22px] border bg-popover px-5 py-4.5`,children:[(0,z.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[.08em] text-subtle`,children:`You`}),m&&!n.user?(0,z.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,children:`The prompt is recorded when this run finishes.`}):(0,z.jsx)(FS,{label:`User message`,children:n.user})]})}),(0,z.jsxs)(np,{from:`assistant`,children:[(0,z.jsx)(ip,{...e?.avatar?{src:e.avatar}:{},children:e?e.label.slice(0,2).toUpperCase():`OH`}),(0,z.jsxs)(rp,{className:`pt-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[.08em] text-subtle`,children:[(0,z.jsx)(`span`,{children:e?.label??n.harness}),n.model?(0,z.jsx)(v,{variant:`secondary`,className:`font-medium normal-case tracking-normal`,children:n.model}):null]}),n.reasoning?(0,z.jsx)(Mr,{className:`mt-2.5`,collapsible:!0,type:`single`,children:(0,z.jsxs)(Nr,{className:`rounded-[10px] border border-dashed bg-card px-3`,value:`reasoning`,children:[(0,z.jsx)(Pr,{className:`text-xs text-muted-foreground`,children:`Reasoning`}),(0,z.jsx)(Fr,{className:`whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground`,children:n.reasoning})]})}):null,n.agentEvents?.length?(0,z.jsx)(JS,{events:n.agentEvents}):null,p.length>0?(0,z.jsx)(`section`,{"aria-label":`Tool calls`,className:`my-3`,children:(0,z.jsx)(Mr,{className:`space-y-1`,type:`multiple`,value:o,onValueChange:s,children:p.map(e=>(0,z.jsx)(KS,{current:l?.id===e.id,invocation:e},e.id))})}):null,n.assistant?(0,z.jsx)(FS,{label:`Assistant message`,children:n.assistant}):m?(0,z.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,role:`status`,children:`Still running. Its final answer appears when the run finishes.`}):(0,z.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,children:`No assistant text was captured for this run.`}),n.failureKind?(0,z.jsxs)(`p`,{"aria-label":`Failure: ${n.failureKind}`,className:`border-l-2 border-destructive pl-2.5 text-xs text-destructive`,role:`note`,children:[`Failure: `,n.failureKind]}):null,(0,z.jsx)(qS,{usage:n.usage}),f?(0,z.jsx)(Mr,{className:`mt-2.5`,collapsible:!0,type:`single`,children:(0,z.jsxs)(Nr,{className:`rounded-[10px] border bg-card px-3`,value:`unknown`,children:[(0,z.jsx)(Pr,{className:`text-xs text-muted-foreground`,children:`Additional upstream data`}),(0,z.jsx)(Fr,{className:`-mx-3 border-t p-0`,children:(0,z.jsx)(zS,{label:`Additional upstream data detail`,value:n.unknown})})]})}):null]})]})]})]})}Object.freeze({status:`aborted`});function U(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var XS=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ZS=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},QS={};function $S(e){return e&&Object.assign(QS,e),QS}function eC(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 tC(e,t){return typeof t==`bigint`?t.toString():t}function nC(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function rC(e){return e==null}function iC(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function aC(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var oC=Symbol(`evaluating`);function sC(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==oC)return r===void 0&&(r=oC,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function cC(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function lC(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function uC(e){return JSON.stringify(e)}var dC=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function fC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var pC=nC(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function mC(e){if(fC(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(fC(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function hC(e){return mC(e)?{...e}:Array.isArray(e)?[...e]:e}var gC=new Set([`string`,`number`,`symbol`]);function _C(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function vC(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function W(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 yC(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var bC={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function xC(e,t){let n=e._zod.def;return vC(e,lC(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return cC(this,`shape`,e),e},checks:[]}))}function SC(e,t){let n=e._zod.def;return vC(e,lC(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return cC(this,`shape`,r),r},checks:[]}))}function CC(e,t){if(!mC(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");return vC(e,lC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return cC(this,`shape`,n),n},checks:[]}))}function wC(e,t){if(!mC(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return vC(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return cC(this,`shape`,n),n},checks:e._zod.def.checks})}function TC(e,t){return vC(e,lC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return cC(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function EC(e,t,n){return vC(t,lC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return cC(this,`shape`,i),i},checks:[]}))}function DC(e,t,n){return vC(t,lC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return cC(this,`shape`,i),i},checks:[]}))}function OC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function kC(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function AC(e){return typeof e==`string`?e:e?.message}function jC(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=AC(e.inst?._zod.def?.error?.(e))??AC(t?.error?.(e))??AC(n.customError?.(e))??AC(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function MC(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function NC(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var PC=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,tC,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},FC=U(`$ZodError`,PC),IC=U(`$ZodError`,PC,{Parent:Error});function LC(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function RC(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var zC=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new XS;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>jC(e,a,$S())));throw dC(t,i?.callee),t}return o.value},BC=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>jC(e,a,$S())));throw dC(t,i?.callee),t}return o.value},VC=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 XS;return a.issues.length?{success:!1,error:new(e??FC)(a.issues.map(e=>jC(e,i,$S())))}:{success:!0,data:a.value}},HC=VC(IC),UC=e=>async(t,n,r)=>{let i=r?Object.assign(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=>jC(e,i,$S())))}:{success:!0,data:a.value}},WC=UC(IC),GC=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return zC(e)(t,n,i)},KC=e=>(t,n,r)=>zC(e)(t,n,r),qC=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return BC(e)(t,n,i)},JC=e=>async(t,n,r)=>BC(e)(t,n,r),YC=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return VC(e)(t,n,i)},XC=e=>(t,n,r)=>VC(e)(t,n,r),ZC=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return UC(e)(t,n,i)},QC=e=>async(t,n,r)=>UC(e)(t,n,r),$C=/^[cC][^\s-]{8,}$/,ew=/^[0-9a-z]+$/,tw=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nw=/^[0-9a-vA-V]{20}$/,rw=/^[A-Za-z0-9]{27}$/,iw=/^[a-zA-Z0-9_-]{21}$/,aw=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ow=/^([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})$/,sw=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)$/,cw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lw=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function uw(){return new RegExp(lw,`u`)}var dw=/^(?:(?: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])$/,fw=/^(([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}|:))$/,pw=/^((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])$/,mw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gw=/^[A-Za-z0-9_-]*$/,_w=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,vw=/^\+(?:[0-9]){6,14}[0-9]$/,yw=`(?:(?:\\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])))`,bw=RegExp(`^${yw}$`);function xw(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Sw(e){return RegExp(`^${xw(e)}$`)}function Cw(e){let t=xw({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${yw}T(?:${r})$`)}var ww=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Tw=/^-?\d+$/,Ew=/^-?\d+(?:\.\d+)?/,Dw=/^(?:true|false)$/i,Ow=/^null$/i,kw=/^[^A-Z]*$/,Aw=/^[^a-z]*$/,jw=U(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Mw={number:`number`,bigint:`bigint`,object:`date`},Nw=U(`$ZodCheckLessThan`,(e,t)=>{jw.init(e,t);let n=Mw[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Pw=U(`$ZodCheckGreaterThan`,(e,t)=>{jw.init(e,t);let n=Mw[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:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Fw=U(`$ZodCheckMultipleOf`,(e,t)=>{jw.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`?n.value%t.value===BigInt(0):aC(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})}}),Iw=U(`$ZodCheckNumberFormat`,(e,t)=>{jw.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=bC[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=Tw)}),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,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,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),Lw=U(`$ZodCheckMaxLength`,(e,t)=>{var n;jw.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!rC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=MC(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Rw=U(`$ZodCheckMinLength`,(e,t)=>{var n;jw.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!rC(t)&&t.length!==void 0}),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;if(r.length>=t.minimum)return;let i=MC(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),zw=U(`$ZodCheckLengthEquals`,(e,t)=>{var n;jw.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!rC(t)&&t.length!==void 0}),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;if(i===t.length)return;let a=MC(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Bw=U(`$ZodCheckStringFormat`,(e,t)=>{var n,r;jw.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=()=>{})}),Vw=U(`$ZodCheckRegex`,(e,t)=>{Bw.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})}}),Hw=U(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=kw,Bw.init(e,t)}),Uw=U(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Aw,Bw.init(e,t)}),Ww=U(`$ZodCheckIncludes`,(e,t)=>{jw.init(e,t);let n=_C(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})}}),Gw=U(`$ZodCheckStartsWith`,(e,t)=>{jw.init(e,t);let n=RegExp(`^${_C(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})}}),Kw=U(`$ZodCheckEndsWith`,(e,t)=>{jw.init(e,t);let n=RegExp(`.*${_C(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})}}),qw=U(`$ZodCheckOverwrite`,(e,t)=>{jw.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Jw=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}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(`
|
|
62
|
-
`).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?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
63
|
-
`))}},Yw={major:4,minor:1,patch:12},Xw=U(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Yw;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=OC(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new XS;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=OC(e,t))});else{if(e.issues.length===t)continue;r||=OC(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(OC(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new XS;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new XS;return o.then(e=>t(e,r,a))}return t(o,r,a)}}e[`~standard`]={validate:t=>{try{let n=HC(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return WC(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),Zw=U(`$ZodString`,(e,t)=>{Xw.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ww(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}}),Qw=U(`$ZodStringFormat`,(e,t)=>{Bw.init(e,t),Zw.init(e,t)}),$w=U(`$ZodGUID`,(e,t)=>{t.pattern??=ow,Qw.init(e,t)}),eT=U(`$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??=sw(e)}else t.pattern??=sw();Qw.init(e,t)}),tT=U(`$ZodEmail`,(e,t)=>{t.pattern??=cw,Qw.init(e,t)}),nT=U(`$ZodURL`,(e,t)=>{Qw.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:_w.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),rT=U(`$ZodEmoji`,(e,t)=>{t.pattern??=uw(),Qw.init(e,t)}),iT=U(`$ZodNanoID`,(e,t)=>{t.pattern??=iw,Qw.init(e,t)}),aT=U(`$ZodCUID`,(e,t)=>{t.pattern??=$C,Qw.init(e,t)}),oT=U(`$ZodCUID2`,(e,t)=>{t.pattern??=ew,Qw.init(e,t)}),sT=U(`$ZodULID`,(e,t)=>{t.pattern??=tw,Qw.init(e,t)}),cT=U(`$ZodXID`,(e,t)=>{t.pattern??=nw,Qw.init(e,t)}),lT=U(`$ZodKSUID`,(e,t)=>{t.pattern??=rw,Qw.init(e,t)}),uT=U(`$ZodISODateTime`,(e,t)=>{t.pattern??=Cw(t),Qw.init(e,t)}),dT=U(`$ZodISODate`,(e,t)=>{t.pattern??=bw,Qw.init(e,t)}),fT=U(`$ZodISOTime`,(e,t)=>{t.pattern??=Sw(t),Qw.init(e,t)}),pT=U(`$ZodISODuration`,(e,t)=>{t.pattern??=aw,Qw.init(e,t)}),mT=U(`$ZodIPv4`,(e,t)=>{t.pattern??=dw,Qw.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv4`})}),hT=U(`$ZodIPv6`,(e,t)=>{t.pattern??=fw,Qw.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv6`}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),gT=U(`$ZodCIDRv4`,(e,t)=>{t.pattern??=pw,Qw.init(e,t)}),_T=U(`$ZodCIDRv6`,(e,t)=>{t.pattern??=mw,Qw.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function vT(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var yT=U(`$ZodBase64`,(e,t)=>{t.pattern??=hw,Qw.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64`}),e._zod.check=n=>{vT(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function bT(e){if(!gw.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return vT(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var xT=U(`$ZodBase64URL`,(e,t)=>{t.pattern??=gw,Qw.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64url`}),e._zod.check=n=>{bT(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ST=U(`$ZodE164`,(e,t)=>{t.pattern??=vw,Qw.init(e,t)});function CT(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 wT=U(`$ZodJWT`,(e,t)=>{Qw.init(e,t),e._zod.check=n=>{CT(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),TT=U(`$ZodNumber`,(e,t)=>{Xw.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ew,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:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ET=U(`$ZodNumber`,(e,t)=>{Iw.init(e,t),TT.init(e,t)}),DT=U(`$ZodBoolean`,(e,t)=>{Xw.init(e,t),e._zod.pattern=Dw,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}}),OT=U(`$ZodNull`,(e,t)=>{Xw.init(e,t),e._zod.pattern=Ow,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}}),kT=U(`$ZodUnknown`,(e,t)=>{Xw.init(e,t),e._zod.parse=e=>e}),AT=U(`$ZodNever`,(e,t)=>{Xw.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function jT(e,t,n){e.issues.length&&t.issues.push(...kC(n,e.issues)),t.value[n]=e.value}var MT=U(`$ZodArray`,(e,t)=>{Xw.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>jT(t,n,e))):jT(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function NT(e,t,n,r){e.issues.length&&t.issues.push(...kC(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function PT(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=yC(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function FT(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type;for(let i of Object.keys(t)){if(s.has(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=>NT(e,n,i,t))):NT(a,n,i,t)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var IT=U(`$ZodObject`,(e,t)=>{if(Xw.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=nC(()=>PT(t));sC(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=fC,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e]._zod.run({value:s[e],issues:[]},o);n instanceof Promise?c.push(n.then(n=>NT(n,t,e,s))):NT(n,t,e,s)}return i?FT(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),LT=U(`$ZodObjectJIT`,(e,t)=>{IT.init(e,t);let n=e._zod.parse,r=nC(()=>PT(t)),i=e=>{let t=new Jw([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=uC(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let e of n.keys){let n=a[e],r=uC(e);t.write(`const ${n} = ${i(e)};`),t.write(`
|
|
64
|
-
if (${n}.issues.length) {
|
|
65
|
-
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
66
|
-
...iss,
|
|
67
|
-
path: iss.path ? [${r}, ...iss.path] : [${r}]
|
|
68
|
-
})));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (${n}.value === undefined) {
|
|
73
|
-
if (${r} in input) {
|
|
74
|
-
newResult[${r}] = undefined;
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
newResult[${r}] = ${n}.value;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=fC,s=!QS.jitless,c=s&&pC.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?FT([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function RT(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!OC(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>jC(e,r,$S())))}),t)}var zT=U(`$ZodUnion`,(e,t)=>{Xw.init(e,t),sC(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),sC(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),sC(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),sC(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>iC(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>RT(t,i,e,a)):RT(s,i,e,a)}}),BT=U(`$ZodDiscriminatedUnion`,(e,t)=>{zT.init(e,t);let n=e._zod.parse;sC(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=nC(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!fC(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),VT=U(`$ZodIntersection`,(e,t)=>{Xw.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>UT(e,t,n)):UT(e,i,a)}});function HT(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(mC(e)&&mC(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=HT(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=HT(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function UT(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),OC(e))return e;let r=HT(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}var WT=U(`$ZodRecord`,(e,t)=>{Xw.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!mC(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...kC(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...kC(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>jC(e,r,$S())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...kC(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...kC(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),GT=U(`$ZodEnum`,(e,t)=>{Xw.init(e,t);let n=eC(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>gC.has(typeof e)).map(e=>typeof e==`string`?_C(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),KT=U(`$ZodLiteral`,(e,t)=>{if(Xw.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?_C(e):e?_C(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),qT=U(`$ZodTransform`,(e,t)=>{Xw.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ZS(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new XS;return n.value=i,n}});function JT(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var YT=U(`$ZodOptional`,(e,t)=>{Xw.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,sC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),sC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${iC(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>JT(t,e.value)):JT(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),XT=U(`$ZodNullable`,(e,t)=>{Xw.init(e,t),sC(e._zod,`optin`,()=>t.innerType._zod.optin),sC(e._zod,`optout`,()=>t.innerType._zod.optout),sC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${iC(e.source)}|null)$`):void 0}),sC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ZT=U(`$ZodDefault`,(e,t)=>{Xw.init(e,t),e._zod.optin=`optional`,sC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>QT(e,t)):QT(r,t)}});function QT(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var $T=U(`$ZodPrefault`,(e,t)=>{Xw.init(e,t),e._zod.optin=`optional`,sC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),eE=U(`$ZodNonOptional`,(e,t)=>{Xw.init(e,t),sC(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>tE(t,e)):tE(i,e)}});function tE(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var nE=U(`$ZodCatch`,(e,t)=>{Xw.init(e,t),sC(e._zod,`optin`,()=>t.innerType._zod.optin),sC(e._zod,`optout`,()=>t.innerType._zod.optout),sC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>jC(e,n,$S()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>jC(e,n,$S()))},input:e.value}),e.issues=[]),e)}}),rE=U(`$ZodPipe`,(e,t)=>{Xw.init(e,t),sC(e._zod,`values`,()=>t.in._zod.values),sC(e._zod,`optin`,()=>t.in._zod.optin),sC(e._zod,`optout`,()=>t.out._zod.optout),sC(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>iE(e,t.in,n)):iE(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>iE(e,t.out,n)):iE(r,t.out,n)}});function iE(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var aE=U(`$ZodReadonly`,(e,t)=>{Xw.init(e,t),sC(e._zod,`propValues`,()=>t.innerType._zod.propValues),sC(e._zod,`values`,()=>t.innerType._zod.values),sC(e._zod,`optin`,()=>t.innerType._zod.optin),sC(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(oE):oE(r)}});function oE(e){return e.value=Object.freeze(e.value),e}var sE=U(`$ZodLazy`,(e,t)=>{Xw.init(e,t),sC(e._zod,`innerType`,()=>t.getter()),sC(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),sC(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),sC(e._zod,`optin`,()=>e._zod.innerType._zod.optin??void 0),sC(e._zod,`optout`,()=>e._zod.innerType._zod.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),cE=U(`$ZodCustom`,(e,t)=>{jw.init(e,t),Xw.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>lE(t,n,r,e));lE(i,n,r,e)}});function lE(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(NC(e))}}var uE=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function dE(){return new uE}var fE=dE();function pE(e,t){return new e({type:`string`,...W(t)})}function mE(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...W(t)})}function hE(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...W(t)})}function gE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...W(t)})}function _E(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...W(t)})}function vE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...W(t)})}function yE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...W(t)})}function bE(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...W(t)})}function xE(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...W(t)})}function SE(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...W(t)})}function CE(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...W(t)})}function wE(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...W(t)})}function TE(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...W(t)})}function EE(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...W(t)})}function DE(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...W(t)})}function OE(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...W(t)})}function kE(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...W(t)})}function AE(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...W(t)})}function jE(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...W(t)})}function ME(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...W(t)})}function NE(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...W(t)})}function PE(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...W(t)})}function FE(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...W(t)})}function IE(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...W(t)})}function LE(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...W(t)})}function RE(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...W(t)})}function zE(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...W(t)})}function BE(e,t){return new e({type:`number`,checks:[],...W(t)})}function VE(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...W(t)})}function HE(e,t){return new e({type:`boolean`,...W(t)})}function UE(e,t){return new e({type:`null`,...W(t)})}function WE(e){return new e({type:`unknown`})}function GE(e,t){return new e({type:`never`,...W(t)})}function KE(e,t){return new Nw({check:`less_than`,...W(t),value:e,inclusive:!1})}function qE(e,t){return new Nw({check:`less_than`,...W(t),value:e,inclusive:!0})}function JE(e,t){return new Pw({check:`greater_than`,...W(t),value:e,inclusive:!1})}function YE(e,t){return new Pw({check:`greater_than`,...W(t),value:e,inclusive:!0})}function XE(e,t){return new Fw({check:`multiple_of`,...W(t),value:e})}function ZE(e,t){return new Lw({check:`max_length`,...W(t),maximum:e})}function QE(e,t){return new Rw({check:`min_length`,...W(t),minimum:e})}function $E(e,t){return new zw({check:`length_equals`,...W(t),length:e})}function eD(e,t){return new Vw({check:`string_format`,format:`regex`,...W(t),pattern:e})}function tD(e){return new Hw({check:`string_format`,format:`lowercase`,...W(e)})}function nD(e){return new Uw({check:`string_format`,format:`uppercase`,...W(e)})}function rD(e,t){return new Ww({check:`string_format`,format:`includes`,...W(t),includes:e})}function iD(e,t){return new Gw({check:`string_format`,format:`starts_with`,...W(t),prefix:e})}function aD(e,t){return new Kw({check:`string_format`,format:`ends_with`,...W(t),suffix:e})}function oD(e){return new qw({check:`overwrite`,tx:e})}function sD(e){return oD(t=>t.normalize(e))}function cD(){return oD(e=>e.trim())}function lD(){return oD(e=>e.toLowerCase())}function uD(){return oD(e=>e.toUpperCase())}function dD(e,t,n){return new e({type:`array`,element:t,...W(n)})}function fD(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...W(n)})}function pD(e){let t=mD(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(NC(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(NC(r))}},e(n.value,n)));return t}function mD(e,t){let n=new jw({check:`custom`,...W(t)});return n._zod.check=e,n}var hD=U(`ZodISODateTime`,(e,t)=>{uT.init(e,t),BD.init(e,t)});function gD(e){return IE(hD,e)}var _D=U(`ZodISODate`,(e,t)=>{dT.init(e,t),BD.init(e,t)});function vD(e){return LE(_D,e)}var yD=U(`ZodISOTime`,(e,t)=>{fT.init(e,t),BD.init(e,t)});function bD(e){return RE(yD,e)}var xD=U(`ZodISODuration`,(e,t)=>{pT.init(e,t),BD.init(e,t)});function SD(e){return zE(xD,e)}var CD=(e,t)=>{FC.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>RC(e,t)},flatten:{value:t=>LC(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,tC,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,tC,2)}},isEmpty:{get(){return e.issues.length===0}}})};U(`ZodError`,CD);var wD=U(`ZodError`,CD,{Parent:Error}),TD=zC(wD),ED=BC(wD),DD=VC(wD),OD=UC(wD),kD=GC(wD),AD=KC(wD),jD=qC(wD),MD=JC(wD),ND=YC(wD),PD=XC(wD),FD=ZC(wD),ID=QC(wD),LD=U(`ZodType`,(e,t)=>(Xw.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(lC(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]})),e.clone=(t,n)=>vC(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>TD(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>DD(e,t,n),e.parseAsync=async(t,n)=>ED(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>OD(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>kD(e,t,n),e.decode=(t,n)=>AD(e,t,n),e.encodeAsync=async(t,n)=>jD(e,t,n),e.decodeAsync=async(t,n)=>MD(e,t,n),e.safeEncode=(t,n)=>ND(e,t,n),e.safeDecode=(t,n)=>PD(e,t,n),e.safeEncodeAsync=async(t,n)=>FD(e,t,n),e.safeDecodeAsync=async(t,n)=>ID(e,t,n),e.refine=(t,n)=>e.check(QO(t,n)),e.superRefine=t=>e.check($O(t)),e.overwrite=t=>e.check(oD(t)),e.optional=()=>PO(e),e.nullable=()=>IO(e),e.nullish=()=>PO(IO(e)),e.nonoptional=t=>HO(e,t),e.array=()=>q(e),e.or=t=>SO([e,t]),e.and=t=>EO(e,t),e.transform=t=>KO(e,MO(t)),e.default=t=>RO(e,t),e.prefault=t=>BO(e,t),e.catch=t=>WO(e,t),e.pipe=t=>KO(e,t),e.readonly=()=>JO(e),e.describe=t=>{let n=e.clone();return fE.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return fE.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return fE.get(e);let n=e.clone();return fE.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),RD=U(`_ZodString`,(e,t)=>{Zw.init(e,t),LD.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(eD(...t)),e.includes=(...t)=>e.check(rD(...t)),e.startsWith=(...t)=>e.check(iD(...t)),e.endsWith=(...t)=>e.check(aD(...t)),e.min=(...t)=>e.check(QE(...t)),e.max=(...t)=>e.check(ZE(...t)),e.length=(...t)=>e.check($E(...t)),e.nonempty=(...t)=>e.check(QE(1,...t)),e.lowercase=t=>e.check(tD(t)),e.uppercase=t=>e.check(nD(t)),e.trim=()=>e.check(cD()),e.normalize=(...t)=>e.check(sD(...t)),e.toLowerCase=()=>e.check(lD()),e.toUpperCase=()=>e.check(uD())}),zD=U(`ZodString`,(e,t)=>{Zw.init(e,t),RD.init(e,t),e.email=t=>e.check(mE(VD,t)),e.url=t=>e.check(bE(WD,t)),e.jwt=t=>e.check(FE(oO,t)),e.emoji=t=>e.check(xE(KD,t)),e.guid=t=>e.check(hE(HD,t)),e.uuid=t=>e.check(gE(UD,t)),e.uuidv4=t=>e.check(_E(UD,t)),e.uuidv6=t=>e.check(vE(UD,t)),e.uuidv7=t=>e.check(yE(UD,t)),e.nanoid=t=>e.check(SE(qD,t)),e.guid=t=>e.check(hE(HD,t)),e.cuid=t=>e.check(CE(JD,t)),e.cuid2=t=>e.check(wE(YD,t)),e.ulid=t=>e.check(TE(XD,t)),e.base64=t=>e.check(ME(rO,t)),e.base64url=t=>e.check(NE(iO,t)),e.xid=t=>e.check(EE(ZD,t)),e.ksuid=t=>e.check(DE(QD,t)),e.ipv4=t=>e.check(OE($D,t)),e.ipv6=t=>e.check(kE(eO,t)),e.cidrv4=t=>e.check(AE(tO,t)),e.cidrv6=t=>e.check(jE(nO,t)),e.e164=t=>e.check(PE(aO,t)),e.datetime=t=>e.check(gD(t)),e.date=t=>e.check(vD(t)),e.time=t=>e.check(bD(t)),e.duration=t=>e.check(SD(t))});function G(e){return pE(zD,e)}var BD=U(`ZodStringFormat`,(e,t)=>{Qw.init(e,t),RD.init(e,t)}),VD=U(`ZodEmail`,(e,t)=>{tT.init(e,t),BD.init(e,t)}),HD=U(`ZodGUID`,(e,t)=>{$w.init(e,t),BD.init(e,t)}),UD=U(`ZodUUID`,(e,t)=>{eT.init(e,t),BD.init(e,t)}),WD=U(`ZodURL`,(e,t)=>{nT.init(e,t),BD.init(e,t)});function GD(e){return bE(WD,e)}var KD=U(`ZodEmoji`,(e,t)=>{rT.init(e,t),BD.init(e,t)}),qD=U(`ZodNanoID`,(e,t)=>{iT.init(e,t),BD.init(e,t)}),JD=U(`ZodCUID`,(e,t)=>{aT.init(e,t),BD.init(e,t)}),YD=U(`ZodCUID2`,(e,t)=>{oT.init(e,t),BD.init(e,t)}),XD=U(`ZodULID`,(e,t)=>{sT.init(e,t),BD.init(e,t)}),ZD=U(`ZodXID`,(e,t)=>{cT.init(e,t),BD.init(e,t)}),QD=U(`ZodKSUID`,(e,t)=>{lT.init(e,t),BD.init(e,t)}),$D=U(`ZodIPv4`,(e,t)=>{mT.init(e,t),BD.init(e,t)}),eO=U(`ZodIPv6`,(e,t)=>{hT.init(e,t),BD.init(e,t)}),tO=U(`ZodCIDRv4`,(e,t)=>{gT.init(e,t),BD.init(e,t)}),nO=U(`ZodCIDRv6`,(e,t)=>{_T.init(e,t),BD.init(e,t)}),rO=U(`ZodBase64`,(e,t)=>{yT.init(e,t),BD.init(e,t)}),iO=U(`ZodBase64URL`,(e,t)=>{xT.init(e,t),BD.init(e,t)}),aO=U(`ZodE164`,(e,t)=>{ST.init(e,t),BD.init(e,t)}),oO=U(`ZodJWT`,(e,t)=>{wT.init(e,t),BD.init(e,t)}),sO=U(`ZodNumber`,(e,t)=>{TT.init(e,t),LD.init(e,t),e.gt=(t,n)=>e.check(JE(t,n)),e.gte=(t,n)=>e.check(YE(t,n)),e.min=(t,n)=>e.check(YE(t,n)),e.lt=(t,n)=>e.check(KE(t,n)),e.lte=(t,n)=>e.check(qE(t,n)),e.max=(t,n)=>e.check(qE(t,n)),e.int=t=>e.check(uO(t)),e.safe=t=>e.check(uO(t)),e.positive=t=>e.check(JE(0,t)),e.nonnegative=t=>e.check(YE(0,t)),e.negative=t=>e.check(KE(0,t)),e.nonpositive=t=>e.check(qE(0,t)),e.multipleOf=(t,n)=>e.check(XE(t,n)),e.step=(t,n)=>e.check(XE(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function cO(e){return BE(sO,e)}var lO=U(`ZodNumberFormat`,(e,t)=>{ET.init(e,t),sO.init(e,t)});function uO(e){return VE(lO,e)}var dO=U(`ZodBoolean`,(e,t)=>{DT.init(e,t),LD.init(e,t)});function K(e){return HE(dO,e)}var fO=U(`ZodNull`,(e,t)=>{OT.init(e,t),LD.init(e,t)});function pO(e){return UE(fO,e)}var mO=U(`ZodUnknown`,(e,t)=>{kT.init(e,t),LD.init(e,t)});function hO(){return WE(mO)}var gO=U(`ZodNever`,(e,t)=>{AT.init(e,t),LD.init(e,t)});function _O(e){return GE(gO,e)}var vO=U(`ZodArray`,(e,t)=>{MT.init(e,t),LD.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(QE(t,n)),e.nonempty=t=>e.check(QE(1,t)),e.max=(t,n)=>e.check(ZE(t,n)),e.length=(t,n)=>e.check($E(t,n)),e.unwrap=()=>e.element});function q(e,t){return dD(vO,e,t)}var yO=U(`ZodObject`,(e,t)=>{LT.init(e,t),LD.init(e,t),sC(e,`shape`,()=>t.shape),e.keyof=()=>Y(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:hO()}),e.loose=()=>e.clone({...e._zod.def,catchall:hO()}),e.strict=()=>e.clone({...e._zod.def,catchall:_O()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>CC(e,t),e.safeExtend=t=>wC(e,t),e.merge=t=>TC(e,t),e.pick=t=>xC(e,t),e.omit=t=>SC(e,t),e.partial=(...t)=>EC(NO,e,t[0]),e.required=(...t)=>DC(VO,e,t[0])});function bO(e,t){return new yO({type:`object`,shape:e??{},...W(t)})}function J(e,t){return new yO({type:`object`,shape:e,catchall:_O(),...W(t)})}var xO=U(`ZodUnion`,(e,t)=>{zT.init(e,t),LD.init(e,t),e.options=t.options});function SO(e,t){return new xO({type:`union`,options:e,...W(t)})}var CO=U(`ZodDiscriminatedUnion`,(e,t)=>{xO.init(e,t),BT.init(e,t)});function wO(e,t,n){return new CO({type:`union`,options:t,discriminator:e,...W(n)})}var TO=U(`ZodIntersection`,(e,t)=>{VT.init(e,t),LD.init(e,t)});function EO(e,t){return new TO({type:`intersection`,left:e,right:t})}var DO=U(`ZodRecord`,(e,t)=>{WT.init(e,t),LD.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function OO(e,t,n){return new DO({type:`record`,keyType:e,valueType:t,...W(n)})}var kO=U(`ZodEnum`,(e,t)=>{GT.init(e,t),LD.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new kO({...t,checks:[],...W(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new kO({...t,checks:[],...W(r),entries:i})}});function Y(e,t){return new kO({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...W(t)})}var AO=U(`ZodLiteral`,(e,t)=>{KT.init(e,t),LD.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function X(e,t){return new AO({type:`literal`,values:Array.isArray(e)?e:[e],...W(t)})}var jO=U(`ZodTransform`,(e,t)=>{qT.init(e,t),LD.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ZS(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(NC(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(NC(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function MO(e){return new jO({type:`transform`,transform:e})}var NO=U(`ZodOptional`,(e,t)=>{YT.init(e,t),LD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function PO(e){return new NO({type:`optional`,innerType:e})}var FO=U(`ZodNullable`,(e,t)=>{XT.init(e,t),LD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function IO(e){return new FO({type:`nullable`,innerType:e})}var LO=U(`ZodDefault`,(e,t)=>{ZT.init(e,t),LD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function RO(e,t){return new LO({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():hC(t)}})}var zO=U(`ZodPrefault`,(e,t)=>{$T.init(e,t),LD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function BO(e,t){return new zO({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():hC(t)}})}var VO=U(`ZodNonOptional`,(e,t)=>{eE.init(e,t),LD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function HO(e,t){return new VO({type:`nonoptional`,innerType:e,...W(t)})}var UO=U(`ZodCatch`,(e,t)=>{nE.init(e,t),LD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function WO(e,t){return new UO({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var GO=U(`ZodPipe`,(e,t)=>{rE.init(e,t),LD.init(e,t),e.in=t.in,e.out=t.out});function KO(e,t){return new GO({type:`pipe`,in:e,out:t})}var qO=U(`ZodReadonly`,(e,t)=>{aE.init(e,t),LD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function JO(e){return new qO({type:`readonly`,innerType:e})}var YO=U(`ZodLazy`,(e,t)=>{sE.init(e,t),LD.init(e,t),e.unwrap=()=>e._zod.def.getter()});function XO(e){return new YO({type:`lazy`,getter:e})}var ZO=U(`ZodCustom`,(e,t)=>{cE.init(e,t),LD.init(e,t)});function QO(e,t={}){return fD(ZO,e,t)}function $O(e){return pD(e)}function ek(e){let t=XO(()=>SO([G(e),cO(),K(),pO(),q(t),OO(G(),t)]));return t}var tk=de(),nk=[`urgent`,`high`,`medium`,`low`],rk={urgent:`Critical`,high:`High`,medium:`Medium`,low:`Low`},ik={list:`/api/human-items`,item:e=>`/api/human-items/${encodeURIComponent(e)}`,answers:`/api/human-items/answers`,answer:e=>`/api/human-items/${encodeURIComponent(e)}/answer`,complete:e=>`/api/human-items/${encodeURIComponent(e)}/complete`,dismiss:e=>`/api/human-items/${encodeURIComponent(e)}/dismiss`,reopen:e=>`/api/human-items/${encodeURIComponent(e)}/reopen`,note:e=>`/api/human-items/${encodeURIComponent(e)}/note`},ak=G().nullable(),ok=G().regex(/\S/u),sk=J({session:G(),run:ak,plan:ak}),ck=wO(`scope`,[J({scope:X(`nothing`)}),J({scope:X(`work`),run:G(),node:G()}),J({scope:X(`plan`),plan:G()}),J({scope:X(`host`)})]),lk=Y([`manager`,`user`]),uk=J({actor:G(),on_behalf_of:ak,text:ak,choice:ak.optional(),reason:ak,provenance:lk.optional()}),dk=J({id:G().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u),title:G().regex(/^[^\r\n]*\S[^\r\n]*$/u).refine(e=>[...e].length<=80),description:ok});function fk(e){let{kind:t,state:n,resolution:r}=e,i=e.choices??[];if(t===`task`&&i.length>0)return`choices are only valid on questions`;if(new Set(i.map(({id:e})=>e)).size!==i.length)return`a choice id is repeated`;let a=r?.choice??void 0;return a!==void 0&&(n!==`answered`||!i.some(({id:e})=>e===a))?`a resolution's choice is one this answered question offers`:t===`question`&&e.approval!==null?`approval is only valid on tasks`:n===`open`?r===null?void 0:`an open item has no resolution`:r===null?`a resolved item carries its resolution`:n===`answered`?t===`question`&&(r.text===null?a!==void 0:/\S/u.test(r.text))&&r.reason===null?void 0:`an answer is a question's, with a choice or text and no reason`:n===`completed`?t===`task`&&(r.text===null||/\S/u.test(r.text))&&r.reason===null?void 0:`a completion is a task's, with no reason and any comment not blank`:r.text===null?void 0:`a dismissal carries no text`}var pk=J({schema_version:X(1),id:G().min(1),dedup_key:G(),kind:Y([`task`,`question`]),title:ok,body:ok,choices:q(dk).max(6).optional(),priority:Y(nk),owner:sk,block:ck,approval:J({board_copy:G(),key:G()}).nullable(),state:Y([`open`,`answered`,`completed`,`dismissed`]),resolution:uk.nullable(),tracker:J({task:G(),url:GD()}).nullable(),created_at:G(),updated_at:G()}).superRefine((e,t)=>{let n=fk(e);n!==void 0&&t.addIssue({code:`custom`,message:n})}),mk=J({run:G(),node:G(),title:G()}),hk=J({plan:G(),count:cO().int().nonnegative(),preview:q(mk).max(3)}),gk=J({total:cO().int().nonnegative(),plans:q(hk)});function _k(e,t){return!(e.state===`open`&&e.block.scope!==`nothing`)&&(t.total!==0||t.plans.length>0)?`a non-blocking item reports nothing blocked`:new Set(t.plans.map(({plan:e})=>e)).size===t.plans.length?t.plans.some(({count:e,preview:t})=>t.length!==Math.min(e,3))?`a preview is the first three affected steps of its plan`:t.plans.reduce((e,{count:t})=>e+t,0)===t.total?void 0:`the blocked total is the plans' counts`:`a blocked plan appears twice`}var vk=J({available:K(),reason:ak});function yk({dedup_key:e,block:t,owner:n}){return t.scope===`work`&&e===`run:${t.run}#${t.node}`&&n.run===t.run}function bk(e,{available:t,reason:n}){return(t?n!==null:n===null||!/\S/u.test(n))?`a reopen states a reason exactly when it is unavailable`:e.state===`open`||e.state===`answered`||yk(e)||e.resolution?.actor===`engine`?t?`this item's state cannot be reopened`:void 0:t||e.state===`completed`&&e.approval!==null?void 0:`nothing about this item's state refuses a reopen`}var xk=J({item:pk,blocked:gk,reopen:vk}).superRefine(({item:e,blocked:t,reopen:n},r)=>{let i=_k(e,t)??bk(e,n);i!==void 0&&r.addIssue({code:`custom`,message:i})});function Sk(e){let{blocked:t,nodes:n}=e;if(n.length!==t.total)return`the steps are the blocked total`;if(new Set(n.map(({run:e,node:t})=>`${e}\u0000${t}`)).size!==n.length)return`a blocked step appears twice`;let r=0;for(let{count:e,preview:i}of t.plans){let t=n.slice(r,r+e);if(i.some((e,n)=>t[n]?.run!==e.run||t[n]?.node!==e.node))return`a preview is the first steps of its plan's group`;r+=e}}var Ck=J({action:Y([`human-item-raised`,`human-item-answered`,`human-item-completed`,`human-item-dismissed`,`human-item-auto-resolved`,`human-item-reopened`,`human-item-noted`]),at:gD({offset:!0}),actor:ok,on_behalf_of:ak,provenance:lk}),wk=J({item:pk,blocked:gk,nodes:q(mk),reopen:vk,history:q(Ck).optional()}).superRefine((e,t)=>{let n=_k(e.item,e.blocked)??bk(e.item,e.reopen)??Sk(e);n!==void 0&&t.addIssue({code:`custom`,message:n})}),Tk=J({item:xk,event_id:G()}),Ek=wO(`kind`,[J({kind:X(`unavailable`)}),J({kind:X(`conflict`),reason:G()})]),Dk=J({batch:ak.optional(),answered:q(Tk),refused:q(J({id:G(),refusal:Ek}))}),Ok=J({items:q(xk)}),kk=J({kind:Y([`task`,`question`]).nullable().optional(),blocking:K().nullable().optional(),priority:Y(nk).nullable().optional(),state:Y([`open`,`answered`,`completed`,`dismissed`]).nullable().optional(),session:G().nullable().optional(),run:G().nullable().optional(),plan:G().nullable().optional(),host:K().nullable().optional()}),Ak=J({type:X(`human-items`),items:q(xk),detail:wk.nullable()}),jk=cO().finite().nonnegative(),Z=cO().int().nonnegative(),Mk=gD({offset:!0}),Nk=G().min(1).nullable(),Q=e=>bO(e).catchall(hO()),Pk={runs:`/api/v2/runs`,run:e=>`/api/v2/runs/${encodeURIComponent(e)}`,timeline:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline`,conversation:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/conversations/${encodeURIComponent(t)}`,artifact:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,timelineEvents:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline/events`,events:`/api/v2/events`,projects:`/api/v2/projects`,project:e=>`/api/v2/projects/${encodeURIComponent(e)}`,channel:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel`,channelNext:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/next`,channelReply:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/reply`,channelSurface:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/surface`,attest:e=>`/api/v2/runs/${encodeURIComponent(e)}/attest`,stop:e=>`/api/v2/runs/${encodeURIComponent(e)}/stop`,shutdown:`/api/v2/shutdown`,unwatched:`/api/v2/unwatched`,host:`/api/v2/host`,status:e=>`/api/v2/runs/${encodeURIComponent(e)}/status`,results:e=>`/api/v2/runs/${encodeURIComponent(e)}/results`,goals:`/api/v2/goals`,runGoals:e=>`/api/v2/runs/${encodeURIComponent(e)}/goals`,transcript:e=>`/api/v2/runs/${encodeURIComponent(e)}/transcript`,telemetry:e=>`/api/v2/runs/${encodeURIComponent(e)}/telemetry`,agents:e=>`/api/v2/runs/${encodeURIComponent(e)}/agents`,nodeAgents:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/agents`,projectAgents:e=>`/api/v2/projects/${encodeURIComponent(e)}/agents`,subscriptions:`/api/v2/subscriptions`,subscription:e=>`/api/v2/subscriptions/${encodeURIComponent(e)}`},Fk={includeSettled:`include_settled`,includeConversations:`include_conversations`,runId:`run_id`,after:`after`,cursor:`cursor`,limit:`limit`,span:`span`,from:`from`,to:`to`,select:`select`,node:`node`,scope:`scope`,filter:`filter`,correlation:`correlation`,until:`until`,timeout:`timeout`,subscription:`subscription`,tick:`tick`},Ik={run:`run`,node:`node`},Lk={planner:`planner`,detailed:`detailed`},Rk=Y([`complete`,`partial`,`legacy`]),zk=Y([`native`,`labelled`,`inferred`]),Bk=Q({agent_model_ms:K(),judge_model_ms:K(),llmlint_model_ms:K(),tool_ms:K()}),Vk=jk.nullable(),Hk=Z.nullable(),Uk=Q({agent_seconds:Vk,judge_seconds:Vk,llmlint_seconds:Vk,gate_seconds:Vk,publication_wait_seconds:Vk,lock_wait_seconds:Vk,setup_seconds:Vk,scheduling_seconds:Vk,wall_seconds:Vk,agent_model_ms:Hk,judge_model_ms:Hk,llmlint_model_ms:Hk,tool_ms:Hk,idle_orchestration_ms:Hk,unattributed_ms:Hk,wall_ms:Hk,fractions:Q({agent_model:Vk,judge_model:Vk,llmlint_model:Vk,tool:Vk,idle_orchestration:Vk,lock_wait:Vk,setup:Vk,scheduling:Vk})}),Wk=G().regex(/^[A-Za-z0-9_-]+$/,`a member name: letters, digits, hyphens and underscores`),Gk=Y([`agent`,`judge`,`llmlint`]),Kk=jk.nullable(),qk=Q({input_tokens:Kk,output_tokens:Kk,cache_read_tokens:Kk,cache_write_tokens:Kk,cost_usd:Kk}),Jk=Q({agent:qk,judge:qk,llmlint:qk,total:qk}),Yk=Q({session_id:G().min(1),history_id:G().min(1).nullable().optional(),role:Gk,agent_role:Wk.optional(),turn_index:Z.nullable().optional(),started_at:Mk.optional(),finished_at:Mk.nullable().optional()}),Xk=OO(G(),hO()),Zk=Y([`agent`,`gate`,`checks`,`publication`,`timeout`,`provider`,`configuration`,`unknown`]),Qk=Y([`agent`,`judge`,`llmlint`]),$k=Y([`quota_at_launch`,`quota_mid_conversation`,`stale_session_resume`,`rate_limit`,`harness_exit`]),eA=Q({side:Qk.optional(),harness:G().optional(),variant:G().optional(),identity:G().optional(),cause:$k.optional(),raw_tail:G().optional(),reset_time:G().optional(),missing_session_id:G().optional(),wait_seconds:cO().nonnegative().optional(),failure_kind:G().optional(),structured_error:Xk.optional(),judge_unrecorded:K().optional()}).extend({class:Zk,detail:G().optional()}),tA=Q({node:G().min(1),status:G().min(1),outcome:G().min(1).optional(),branch:G().min(1).optional(),comparison_remote:G().min(1).optional(),comparison_base:G().min(1).optional(),checkpoint:G().min(1).optional(),commit:G().min(1).optional(),retry_lineage:Xk.optional(),gate_attestation:Xk.optional(),failure:eA.optional(),timing:Uk.optional(),usage:Jk.optional(),sessions:q(Yk),tool_commands:OO(G(),Z).optional(),turns:Z,lint:Z,timing_quality:Rk,linkage_quality:zk,timing_presence:Bk}),nA=Q({run_id:G().min(1),state:G().min(1),phase:G().min(1),last_event:Nk,last_progress_at:jk.optional(),timing:Uk,nodes:q(tA),providers:q(Xk).optional(),failure:eA.optional(),check_rollup:Xk.optional(),usage:Jk,timing_quality:Rk,linkage_quality:zk,timing_presence:Bk,sources:q(G()),node_work_ms:Q({agent_model_ms:Hk,judge_model_ms:Hk,llmlint_model_ms:Hk,tool_ms:Hk,wall_ms:Hk}),turns:Z,lint:Z,agent_count:Z.optional()}),rA=Q({schema_version:SO([G(),cO()]).optional(),observed_at:G().optional(),identities:q(Xk)}),iA=Q({started_at:Mk.optional(),launch_id:G().min(1),launcher:Y([`claude-code`,`codex`,`unknown`]),session_key:G().min(1).optional(),launcher_session_id:G().min(1).optional()}),aA=G().min(1),oA=Q({labels:OO(G(),G()).optional(),group:G().min(1).optional(),run_id:G().min(1),state:G().min(1),phase:G().min(1),last_event:Nk,last_progress_at:jk.optional(),timing_quality:Rk,linkage_quality:zk,timing:Uk,node_counts:OO(G(),Z),launch:iA.optional(),project:G().min(1).optional(),project_name:G().min(1).optional(),liveness:aA.optional(),unread_surfaces:Z.optional()}),sA=Q({path:G().min(1),reason:G().min(1)}),cA=Q({api_version:X(2),telemetry_schema_version:X(29),observed_at:Mk,runs:q(oA),next_cursor:G().min(1).optional(),unreadable:q(sA).optional(),missing:q(G().min(1)).optional(),provider_health:rA.optional()}),lA=Y([`agent`,`human`,`command`]),uA=Q({id:G().min(1),kind:lA.optional(),persona:G().min(1).optional(),task:G().min(1),deps:q(G().min(1)).optional(),max_turns:Z.positive().optional(),expects_no_diff:K().optional()}),dA=Q({branch:G().min(1),base_branch:G().min(1),pr_base:G().min(1),checkpoint:G().min(1),completed_steps:q(G()).optional(),pr:G().nullable().optional(),mode:Y([`pause`,`retry`,`continue`]).optional(),attempts:Z.optional()}),fA=Q({branch:G().min(1),repo:G().min(1).optional(),identity:G().min(1).optional(),base_branch:G().min(1).optional(),pr:G().min(1).optional(),pr_base:G().min(1).optional()}),pA=q(G()),mA=uA.extend({task:G().min(1).optional(),repo:G().min(1).optional(),steps:q(uA).min(1).optional(),session:G().min(1).optional(),project_dir:G().min(1).optional(),base_branch:G().min(1).optional(),branch:G().min(1).optional(),title:G().min(1).optional(),verify_cmd:G().min(1).optional(),skip_verify:K().optional(),verify_via_ci:K().optional(),merge_policy:Y([`auto`,`direct`,`none`]).optional(),workflow:Y([`local`,`remote`]).optional(),repo_type:Y([`single-owner`,`team`]).optional(),execution_checkout:G().min(1).optional(),stack_bases:q(fA).optional(),resume:dA.optional(),sets:pA.optional(),command:q(G()).min(1).optional(),timeout_seconds:Z.positive().optional()}),hA=mA.superRefine((e,t)=>{e.steps===void 0&&e.task===void 0&&t.addIssue({code:`custom`,path:[`task`],message:"a plan task without `steps` must carry its own `task` prose"})}),gA=Q({gate_log:G().optional(),worker_report:G().optional(),oneharness_session:G().optional()}),_A=Q({id:G().min(1),kind:G().min(1),persona:G().nullable(),status:G().min(1),telemetry:Xk.optional(),artifacts:gA.optional()}),vA=Q({ref:G().min(1),task:G(),unblocks:q(G()),unblocks_publication:K()}),yA=Q({branch:G().min(1),base_branch:G().min(1),pr_base:G(),checkpoint:G().min(1),completed_steps:q(G()),pr:G().nullable(),mode:G().optional()}),bA=Q({identity:G().min(1),target:G().min(1),style:G().min(1).optional(),version:G().min(1)}),xA=Q({producer:G().min(1),target:G().min(1)}),SA=Q({path:G().min(1),content:G().optional(),truncated:K().optional()}),CA=Q({kind:G().optional(),log:SA.optional(),status:G().optional(),task:G().optional(),unblocks:q(G()).optional(),blocked_by:q(G()).optional(),human_actions:q(vA).optional(),completed:K().optional(),exit_code:cO().int().nullable().optional(),verdicts:q(hO()).optional(),usage:Xk.optional(),telemetry:Xk.optional(),repo:G().optional(),branch:G().optional(),commit:G().optional(),base_branch:G().optional(),pr_base:G().optional(),synthetic_stack_base:G().nullable().optional(),stack_bases:q(Xk).optional(),repository_type:Y([`single-owner`,`team`]).nullable().optional(),repo_type:Y([`single-owner`,`team`]).nullable().optional(),publication_workflow:Y([`local`,`remote`]).nullable().optional(),workflow:Y([`local`,`remote`]).nullable().optional(),merge_policy:Y([`auto`,`direct`,`none`]).nullable().optional(),outcome:G().optional(),ok:K().optional(),pr:G().nullable().optional(),release:bA.nullable().optional(),awaiting:q(xA).min(1).optional(),detail:G().optional(),follow_ups:G().nullable().optional(),steps:q(_A).optional(),waiting_steps:q(G()).optional(),resume:yA.nullable().optional(),error:G().nullable().optional(),retry_lineage:Xk.optional(),deferred_cleanup:q(G()).optional(),artifacts:gA.optional()}),wA=Q({ok:K().optional(),state:G().optional(),started_order:q(G()).optional(),results:OO(G(),CA).optional(),schema_version:Z.optional()}),TA=Y([`running`,`done`,`failed`,`waiting`,`parked`,`cancelled`,`complete-but-draft`,`complete-but-held`]),EA=Y([`pending`,`ready`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`complete-but-draft`,`complete-but-held`,`unknown`]),DA=Q({addressable:K(),member:G().min(1).optional(),reason:G().min(1).optional()}).superRefine((e,t)=>{e.addressable===(e.reason!==void 0)&&t.addIssue({code:`custom`,path:[`reason`],message:`a reason is carried exactly when there is no turn to address`})}),OA=Q({id:G().min(1),kind:G(),unblocks:q(G().min(1))}),kA=Q({at:G().min(1),author:G().min(1),command:Xk,reason:G(),envelope:Z.optional(),index:Z.optional(),refusal:Xk.optional()}),AA=Q({run_id:G().min(1),plan:Q({tasks:q(hA),schema_version:Z.optional(),concurrency:Z.positive().optional(),name:G().min(1).optional(),goal:Q({id:G().min(1),text:G().min(1)}).optional()}),node_states:OO(G(),TA),node_status:OO(G(),EA),node_gated_by:OO(G(),q(G().min(1))),node_control:OO(G(),DA),node_results:OO(G(),CA),decisions:q(OA),attestations:q(G()),result:wA.nullable(),last_seq:Z,run_node_sets:pA.optional(),rejected_edits:q(kA).min(1).optional()}),jA=AA.superRefine(MA);function MA(e,t){let n=new Set(e.plan.tasks.map(e=>e.id)),r=new Set(Object.keys(e.node_status));(n.size!==e.plan.tasks.length||n.size!==r.size||[...n].some(e=>!r.has(e)))&&t.addIssue({code:`custom`,path:[`node_status`],message:`must contain exactly one entry for every plan task`}),Object.entries(e.node_gated_by).find(([e,t])=>!n.has(e)||t.some(e=>!n.has(e)))&&t.addIssue({code:`custom`,path:[`node_gated_by`],message:`must name only nodes in this graph's plan`}),Object.keys(e.node_control).find(t=>e.node_status[t]!==`running`)!==void 0&&t.addIssue({code:`custom`,path:[`node_control`],message:`must name only nodes the run has in flight`})}var NA=Q({cacheReadTokens:Kk.optional(),cacheWriteTokens:Kk.optional(),costUsd:Kk.optional(),inputTokens:Kk.optional(),outputTokens:Kk.optional()}),PA=Q({index:Z,input:hO().optional(),kind:G(),name:G().nullable().optional(),output:G().nullable().optional(),toolCallId:G().min(1).optional(),output_truncated:X(!0).optional(),input_truncated:X(!0).optional()}),FA=Q({judge:G(),kind:G(),decision:G(),reason:G()}),IA=Q({assistant:G().nullable(),durationMs:Kk.optional(),failureKind:G().nullable(),finishedAt:Mk.nullable().optional(),harness:G(),id:G(),judges:q(FA).optional(),model:G().nullable(),modelMs:Kk.optional(),reasoning:G().nullable(),startedAt:Mk.nullable().optional(),status:G(),timestamp:Mk,toolMs:Kk.optional(),tools:q(PA),unknown:Xk,usage:NA,user:G()}),LA=Q({conversation:Q({canContinue:K(),harnesses:q(G()),id:G().min(1),name:G(),project:G(),startedAt:Mk,state:G(),turns:q(IA)}),attribution:Q({runId:G().optional(),nodeId:G().optional(),stepId:G().optional(),launchId:G().optional(),launcher:Y([`claude-code`,`codex`,`unknown`]).optional(),transportRole:Gk,agentRole:Wk.optional(),parentConversationId:G().optional(),persona:G().optional(),finishedAt:Mk.nullable().optional(),inferred:X(!0).optional(),timing:Uk.optional()})}),RA=Q({node:G().optional(),conversations:q(LA)}),zA=SO([q(LA),q(RA).transform(e=>e.flatMap(e=>e.conversations))]),BA=Q({name:G(),state:G(),status:G().optional(),conclusion:G().optional(),started_at:Mk.optional(),completed_at:Mk.optional(),required:K(),requirement:G().optional(),url:G().url().nullable().optional()}),VA=Q({ok:K(),output_tail:G(),artifact_id:G().min(1).optional()}),HA=Q({verification:Q({pre_push_hook:K().optional(),required_checks:q(G()).optional(),required_checks_status:G().optional(),expected_gate:q(G()).optional(),checks:q(BA).optional(),records:q(VA)}),publication:Q({pr_url:G().url().optional(),branch:G().optional(),branch_url:G().url().optional(),merged:K(),base_branch:G().optional(),commit:G().optional(),commit_url:G().url().optional()}).optional()}),UA=q(bO({event_id:G().min(1),node:G().min(1),step:G().min(1).optional(),at:cO().finite(),kind:G(),name:G(),detail:G(),description:G(),events:cO().int().nonnegative()})),WA=Q({telemetry:Q({schema_version:Z,as_of:Mk.optional()}).optional(),api_version:X(2),telemetry_schema_version:X(29),observed_at:Mk,run:nA.extend({live_activity:UA.optional()}),graph:jA.nullable(),conversations:zA,node_details:OO(G(),HA).optional().default({}),launch:iA.optional(),provider_health:rA.optional()}),GA=J({complete:K(),loading:q(G()),failed:G().optional()}),KA=J({loading:X(!0)}),qA=tA.partial({sessions:!0,turns:!0,lint:!0,timing_quality:!0,linkage_quality:!0,timing_presence:!0}),JA=Uk.partial().extend({wall_seconds:Vk}),YA=nA.partial({usage:!0,timing_quality:!0,linkage_quality:!0,timing_presence:!0,sources:!0,node_work_ms:!0,lint:!0}).extend({timing:JA,nodes:q(qA),turns:SO([Z,KA]),live_activity:UA.optional()}),XA=AA.partial({node_states:!0,decisions:!0,attestations:!0}).extend({plan:Q({tasks:q(mA),schema_version:Z.optional(),concurrency:Z.positive().optional(),name:G().min(1).optional(),goal:Q({id:G().min(1),text:G().min(1)}).optional()})}).superRefine(MA),ZA=WA.extend({run:YA,graph:XA.nullable(),conversations:zA.optional(),progress:GA.optional()}),QA=Y([`conversation`,`gate_log`,`worker_report`,`oneharness_session`,`pr`]),$A=Y([`run`,`node`,`step`,`dispatch`,`verification`,`publication`,`pr-drafting`,`conflict-resolution`,`human-wait`,`rollup`,`queued`]),ej=Y([`starting`,`dispatching`,`deciding`,`surfacing`,`waiting`,`settled`,`finished`]),tj=Q({kind:QA,value:G().min(1)}),nj=Q({delivered:K(),delivery:Y([`live`,`deferred`]).optional(),reached:Y([`queued`,`worker`,`supervisor`,`judged-with`,`carried`]).optional(),turn:Y([`interrupted`,`turn-end`]).optional(),member:G().min(1).optional(),input_bytes:Z.optional(),reason:G().min(1).optional(),node_id:G().min(1).optional()}).superRefine((e,t)=>{e.delivered&&e.reason!==void 0&&t.addIssue({code:`custom`,path:[`reason`],message:`a delivered redirection carries no reason it did not land`}),e.delivery!==void 0&&e.delivered!==(e.delivery===`live`)&&t.addIssue({code:`custom`,path:[`delivery`],message:"`delivery` is `live` exactly when the running turn took the note"})}),rj=Q({dep:G().min(1),identity:G().min(1).optional(),target:G().min(1).optional(),style:G().min(1).optional(),action:G().min(1).optional(),since:Mk.optional(),waited_seconds:Z.optional(),last_answer:G().min(1).optional()}),ij=Q({kind:G().min(1).optional(),message:G().min(1).optional(),source:G().min(1).optional(),blocking:K().optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a surface record carries at least one recorded fact`})}),aj=Q({name:G().min(1).optional(),required:K().optional(),requirement:G().optional(),url:G().nullable().optional(),state:G().min(1).optional(),kind:G().min(1).optional(),base:G().min(1).optional(),awaited:q(G().min(1)).optional(),grace_seconds:cO().nonnegative().optional(),warned:K().optional(),head:G().min(1).optional(),verdict:G().min(1).optional(),skipped:q(G().min(1)).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a review record carries at least one recorded fact`})}),oj=Q({identity:G().min(1).optional(),target:G().min(1).optional(),style:G().min(1).optional(),version:G().min(1).optional(),landing_commit:G().min(1).optional(),actor:G().min(1).optional(),superseded:K().optional(),form:G().min(1).optional(),outcome:G().min(1).optional(),elapsed_ms:Z.optional(),dep:G().min(1).optional(),delivery:G().min(1).optional(),awaiting:q(rj).min(1).optional(),versions:q(Q({identity:G().min(1),target:G().min(1),version:G().min(1)})).min(1).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a release record carries at least one recorded fact`})}),sj=Q({id:G().min(1),label:G().min(1),order:Z,started_at:Mk}),cj=Q({id:G().min(1),stream:G().min(1).optional(),seq:Z.optional(),journal_order:Z.optional(),record_id:G().min(1).optional(),persona:G().min(1).optional(),dispatch_id:G().min(1).optional(),dispatch_group:sj.optional(),fields:OO(G().min(1),ek()).optional(),kind:G().min(1),at:Mk,node_id:G().min(1).optional(),step_id:G().min(1).optional(),status:G().min(1).optional(),author:G().min(1).optional(),redirection:nj.optional(),release:oj.optional(),surface:ij.optional(),review:aj.optional(),reference:tj.optional(),description:G().optional(),tool:Q({index:Z,tool_call_id:G().min(1).optional(),turn:G().min(1).optional()}).optional()}),lj=Q({started_at:Mk,ended_at:Mk}),uj=Q({kind:G().min(1),blocking:q(G().min(1)).min(1).optional(),ahead:q(G().min(1)).min(1).optional(),limit:Z.optional(),reference:G().min(1).optional(),awaiting:q(G().min(1)).min(1).optional()}),dj=Q({id:G().min(1),kind:$A,label:G(),started_at:Mk,ended_at:Mk.nullable(),events:q(cj),events_total:Z.optional(),parent_id:G().min(1).optional(),node_id:G().min(1).optional(),step_id:G().min(1).optional(),status:G().min(1).optional(),count:Z.optional(),total_duration_ms:Z.optional(),intervals:q(lj).optional(),harness_scope:G().min(1).optional(),dispatch_attempt:G().min(1).optional(),agent_role:Wk.optional(),transport_role:Gk.optional(),dispatch_id:G().min(1).optional(),dispatch_group:sj.optional(),reference:tj.optional(),detail:Q({ok:K().optional(),output_tail:G().optional(),artifact_id:G().optional()}).optional(),phase:ej.optional(),reasons:q(uj).min(1).optional()}).superRefine((e,t)=>{e.reasons!==void 0&&e.kind!==`queued`&&t.addIssue({code:`custom`,path:[`reasons`],message:`only a queued span carries the reasons a node was held`})}),fj=Q({id:G().min(1),kind:QA,content:G(),truncated:K(),turns:q(IA).optional(),unavailable:G().optional()}),pj=Q({api_version:X(2),timeline_schema_version:X(15),observed_at:Mk,run_id:G().min(1),spans:q(dj),progress:GA.optional()}),mj=Q({rows:q(cj.extend({span_id:G().min(1)})),next_cursor:G().min(1).nullable(),total:Z,span:Q({id:G().min(1)}).optional(),observed_at:Mk}),hj=Q({error:Q({code:G(),message:G()})});Q({schema_version:X(1),launch_id:G().min(1),launcher:Y([`claude-code`,`codex`]),launcher_session_id:G().min(1),started_at:Mk,repository_identity:G().min(1)});var gj=Y([`snapshot`,`run.changed`,`conversation.changed`,`activity.changed`,`run.removed`]),_j=Xk;function vj(e){let t=e.indexOf(`:`);if(t===-1)return!1;let n=e.slice(0,t),r=e.slice(t+1);return/^[a-z0-9][a-z0-9-]*$/u.test(n)&&r.length>0&&r.length<=128&&!r.startsWith(`.`)&&/^[A-Za-z0-9._-]+$/u.test(r)}var yj=Q({project:G().min(1).nullable(),name:G().min(1).nullable(),last_write_at:jk.nullable(),runs:q(oA),agent_count:Z.optional()}),bj=Q({api_version:X(2),telemetry_schema_version:X(29),observed_at:Mk,projects:q(yj),unreadable:q(sA).optional()}),xj=yj.extend({api_version:X(2),telemetry_schema_version:X(29),observed_at:Mk}),Sj={api_version:X(2),telemetry_schema_version:X(29),observed_at:Mk},Cj=Y([`manager`,`user`]),wj=e=>e===`user`?`user`:`manager`,Tj=Y([`note`,`amendment`,`answer`]),Ej=J({node:G(),ruling:G(),provenance:Cj,kind:Tj,reply:Z,text:G(),reason:G()}),Dj=Q({id:Z,correlation:G().min(1).optional(),kind:G().min(1),message:G(),source:G().min(1),blocking:K(),queued_at:jk,workstream:G().min(1).optional(),abandoned:K().optional(),declined_ruling:Ej.optional()}).superRefine((e,t)=>{e.kind===`declined-ruling`!=(e.declined_ruling!==void 0)&&t.addIssue({code:`custom`,path:[`declined_ruling`],message:`a declined-ruling surface, and only one, carries its declined ruling`})}),Oj=Y([`worker`,`supervisor`,`both`]),kj=Y([`live`,`next`]),Aj=Y([`detach`,`drop`]),jj=Y([`done`,`failed`]),Mj=Q({sets:pA.optional()}),Nj=wO(`op`,[bO({op:X(`add`),node:hA}).strict(),bO({op:X(`drop`),id:G().min(1),dependents:Aj,reason:G().min(1).optional()}).strict(),bO({op:X(`reparent`),id:G().min(1),deps:q(G().min(1))}).strict(),bO({op:X(`retry`),id:G().min(1),node:hA}).strict(),bO({op:X(`cancel`),id:G().min(1),reason:G().min(1).optional()}).strict(),bO({op:X(`requeue`),id:G().min(1),amend:Mj.optional()}).strict(),bO({op:X(`set-node-sets`),id:G().min(1),sets:pA}).strict(),bO({op:X(`set-run-node-sets`),sets:pA}).strict(),bO({op:X(`attest`),ref:G().min(1)}).strict(),bO({op:X(`complete`),reason:G().min(1)}).strict(),bO({op:X(`amend`),id:G().min(1),text:G().min(1)}).strict(),bO({op:X(`note`),id:G().min(1),addressee:Oj,text:G().min(1),criterion:G().min(1).optional(),deliver:kj.optional(),persist:K().optional(),delivery_timeout_seconds:cO().int().positive().optional()}).strict(),bO({op:X(`withdraw-note`),envelope:G().min(1),index:cO().int().nonnegative(),reason:G().min(1)}).strict(),bO({op:X(`finding`),message:G().min(1),blocking:K().optional(),id:G().min(1).optional()}).strict(),bO({op:X(`settle`),id:G().min(1),outcome:jj,evidence:G().min(1),landing:G().min(1).optional(),release:bO({target:G().min(1),version:G().min(1)}).strict().optional()}).strict(),bO({op:X(`rework`),id:G().min(1),reason:G().min(1),instruction:G().min(1),comments:q(bO({id:G(),url:G()}).strict()).optional(),title:G().optional(),replacement:G().optional()}).strict(),bO({op:X(`retitle`),id:G().min(1),title:G().min(1),reason:G().min(1)}).strict(),bO({op:X(`review`)}).strict(),bO({op:X(`readjust`)}).strict(),bO({op:X(`decline`),id:G().min(1),comments:q(bO({id:G(),url:G()}).strict()),reason:G().min(1)}).strict()]),Pj=Nj.options.map(e=>e.shape.op.value),Fj=bO({version:Z.optional(),author:G().min(1).optional(),completion:K().optional(),message:G().optional(),reason:G().optional(),commands:q(Nj).optional(),provenance:Cj.optional()}).strict().superRefine((e,t)=>{e.commands!==void 0&&e.commands.length>0&&e.version!==4&&t.addIssue({code:`custom`,path:[`version`],message:`an edit envelope requires version 4`})}),Ij=Q({id:Z,reply:Xk,at:jk,correlation:G().min(1).optional()}),Lj=Q({id:Z,author:G().min(1).optional(),commands:q(Xk),provenance:Cj.optional()}),Rj=Q({op:G().min(1).optional(),outcome:G().min(1).optional(),reason:G().optional()}),zj=Q({id:Z,applied:K(),reason:G().optional(),results:q(Rj).optional()}),Bj=Q({...Sj,run_id:G().min(1),surfaces:q(Dj),waiting:q(Dj),held:Dj.nullable(),replies:q(Ij),commands:q(Lj),outcomes:q(zj)}),Vj=Y([`surface`,`running`,`finished`]),Hj=Q({...Sj,run_id:G().min(1),status:Vj,surface:Dj.nullable(),events:q(Xk)}),Uj=Q({...Sj,run_id:G().min(1),receipt:Q({reply:Z,state:G().min(1),verdict:G().min(1).optional(),commands:G().min(1).optional()}),advice:q(G())}),Wj=Q({...Sj,run_id:G().min(1),surface:Z,state:G().min(1)}),Gj=Q({...Sj,run_id:G().min(1),stopped:K(),owner:G().min(1),forced:K(),teardown:G().min(1)}),Kj=Y([`host`]);Y([`host`]);var qj=Y([`delivered`,`no-turn`,`failed`,`not-asked`]),Jj=Y([`graceful`,`killed`,`still-running`]),Yj=Y([`pushed`,`already-on-origin`,`no-remote`,`refused`]),Xj=Q({...Sj,scope:Kj,root:G(),grace_seconds:Z,forced:K(),complete:K(),runs:q(Q({run_id:G().min(1),owner:G().min(1),forced_over_owner:K(),dispatches:q(Q({node:G().min(1),pid:Z,interrupt:qj,detail:G(),ended:Jj,waited_ms:Z})),teardown:G().min(1),branches:q(Q({identity:G(),branch:G(),result:Yj,remote:G().nullable(),commit:G().nullable(),detail:G()}))})),not_pushed:q(Q({identity:G(),branch:G()})),not_pushed_unread:G().nullable(),rendered:G()}),Zj=Q({...Sj,session_key:G().min(1).optional(),reported:q(Q({run:G().min(1),standing:G().min(1),why_not_watched:G()})),unresolved:q(G())}),Qj=Q({schema_version:X(1),host:G(),root:G(),root_error:G().nullable(),free_space:q(Q({roots:q(Q({role:G(),path:G().nullable(),measured_at:G().nullable()})),free_bytes:Z.nullable(),total_bytes:Z.nullable(),error:G().nullable()})),dispatches:q(Q({run:G(),node:G(),launcher:G(),age_ms:jk.nullable(),proof:Y([`held`,`unproven`]),unproven:G().nullable()})),gone:q(Q({run:G(),node:G(),reason:G()})),skipped:q(Q({path:G(),reason:G()}))}),$j=Q({...Sj,reading:Qj.optional(),rendered:G(),unreadable:q(sA).optional()});Q({...Sj,run_id:G().min(1),rendered:G()});var eM=Q({...Sj,run_id:G().min(1),liveness:aA,unread_surfaces:Q({count:Z,oldest_seconds:jk.nullable()}),node_status:OO(G(),G().min(1)),summary:G(),rendered:G()});Q({...Sj,run_id:G().min(1),node:G().min(1).nullable().optional(),rendered:G()}),Q({...Sj,run_id:G().min(1),telemetry:Q({schema_version:Z})});var tM=Q({history_id:G().min(1),harness:G().min(1),variant:G().min(1).optional(),harness_id:G().min(1),started:Mk}),nM=Q({history_session:G().min(1),name:G().min(1),history_dir:G().min(1),history_project:G().min(1),history_file:G().min(1),project:G().min(1),started:Mk,labels:OO(G(),G()),runs:q(tM),run_id:G().min(1).optional()}),rM={...Sj,sessions:q(nM),skipped:Z},iM=Q({...rM,run_id:G().min(1),node:G().min(1).optional()}),aM=Q({...rM,project:G().min(1)}),oM=G().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u),sM=G().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]*)$/u),cM=SO([J({type:X(`sidebar`)}),J({type:X(`detail`),run_id:G().min(1),filter:G().min(1).optional()}),J({type:X(`timeline`),run_id:G().min(1),scope:X(`run`),filter:G().min(1).optional()}),J({type:X(`timeline`),run_id:G().min(1),scope:X(`node`),node:G().min(1),filter:G().min(1).optional()}),J({type:X(`channel`),run_id:G().min(1)}),J({type:X(`human-items`),filter:kk.optional(),item:G().min(1).optional()})]),lM=J({id:G().min(1),name:G(),group:J({project:G(),name:G()}).nullable(),kind:G().nullable(),state:G().min(1),nodes:J({total:Z,done:Z,failed:Z,running:Z}),updated_at:Mk,started_at:Mk.optional()});Object.keys(lM.shape);var uM=SO([J({type:X(`sidebar`)}),J({type:X(`detail`),run_id:G().min(1),detail:ZA}),J({type:X(`timeline`),run_id:G().min(1),scope:X(`run`),detail:ZA,timeline:pj}),J({type:X(`timeline`),run_id:G().min(1),scope:X(`node`),node:G().min(1),detail:ZA,timeline:pj}),J({type:X(`channel`),run_id:G().min(1),detail:ZA,channel:Bj}),Ak]),dM=J({id:sM,sidebar:q(lM).nullable(),visible:uM}),fM=q(SO([G(),Z])),pM=SO([J({p:fM,v:hO()}),J({p:fM,a:q(hO())}),J({p:fM,d:X(!0)})]),mM={id:sM,base:sM,subscription:oM},hM=Y([`unknown-cursor`,`stale-cursor`,`server-restarted`]),gM=J({...mM,type:X(`reset`),reason:hM,snapshot:dM}),_M=SO([gM,J({...mM,type:X(`sidebar.snapshot`),rows:q(lM)}),J({...mM,type:X(`run.changed`),row:lM}),J({...mM,type:X(`run.removed`),run_id:G().min(1)}),J({...mM,type:X(`detail.patch`),run_id:G().min(1),ops:q(pM)}),J({...mM,type:X(`timeline.patch`),run_id:G().min(1),scope:X(`run`),ops:q(pM)}),J({...mM,type:X(`timeline.patch`),run_id:G().min(1),scope:X(`node`),node:G().min(1),ops:q(pM)}),J({...mM,type:X(`channel.patch`),run_id:G().min(1),ops:q(pM)}),J({...mM,type:X(`human-items.patch`),ops:q(pM)})]),vM=[`reset`,`sidebar.snapshot`,`run.changed`,`run.removed`,`detail.patch`,`timeline.patch`,`channel.patch`,`human-items.patch`],yM=J({subscription:oM,view:cM,initial:SO([J({type:X(`snapshot`),snapshot:dM}),gM])}),bM=`api_version,telemetry_schema_version,observed_at,progress,run.run_id,run.state,run.phase,run.last_event,run.timing.wall_seconds,run.nodes.*.node,run.nodes.*.status,run.nodes.*.outcome,run.nodes.*.failure,run.turns,graph.last_seq,graph.run_id,graph.plan.goal,graph.plan.tasks.*.id,graph.plan.tasks.*.kind,graph.plan.tasks.*.name,graph.plan.tasks.*.deps,graph.plan.tasks.*.repo,graph.plan.tasks.*.steps,graph.node_status,graph.node_gated_by,graph.node_control,graph.result,graph.node_results.*.blocked_by,graph.node_results.*.awaiting,graph.node_results.*.outcome,graph.node_results.*.error,graph.node_results.*.detail,node_details`.split(`,`);function xM(e){let t=new Map;for(let n of e){let e=t;for(let t of n.split(`.`)){let n=e.get(t);n===void 0&&(n=new Map,e.set(t,n)),e=n}}return t}xM(bM),J({code:X(`subscription-unavailable`),reason:Y([`expired`,`server-restarted`,`unknown`])});var SM=class extends Error{constructor(e){super(e),this.name=`PatchError`}};function CM(e,t){let n=e;for(let e of t)n=wM(n,e);return n}function wM(e,t){let n=t.p;if(`a`in t)return EM(e,n,e=>{if(!Array.isArray(e))throw new SM(`an append's path names an array`);return[...e,...t.a]});let r=n.at(-1);if(r===void 0)throw new SM(`the root is never replaced or deleted`);return EM(e,n.slice(0,-1),e=>{if(`v`in t){if(Array.isArray(e)&&typeof r==`number`){if(r>=e.length)throw new SM(`a set replaces an existing element`);let n=[...e];return n[r]=t.v,n}if(TM(e)&&typeof r==`string`)return{...e,[r]:t.v};throw new SM(`a set's path does not match its parent`)}if(TM(e)&&typeof r==`string`){if(!Object.hasOwn(e,r))throw new SM(`a deletion names an existing member`);let t={...e};return delete t[r],t}throw new SM(`a deletion names an object member`)})}function TM(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function EM(e,t,n){let[r,...i]=t;if(r===void 0)return n(e);if(Array.isArray(e)&&typeof r==`number`){if(r>=e.length)throw new SM(`an index on the path does not exist`);let t=[...e];return t[r]=EM(e[r],i,n),t}if(TM(e)&&typeof r==`string`){if(!Object.hasOwn(e,r))throw new SM(`a parent on the path does not exist`);return{...e,[r]:EM(e[r],i,n)}}throw new SM(`a path step does not match its parent`)}var DM=1e3;function OM(e){let t=e.lastIndexOf(`:`);return{epoch:e.slice(0,t),seq:BigInt(e.slice(t+1))}}var kM=class{#e;#t;#n;#r;#i;#a;#o;#s;#c=!1;#l=!1;#u=0;#d;#f=()=>{this.#x(),this.#t.onDisconnected?.()};#p=()=>this.#y();#m=()=>this.close(!0);constructor(e,t){this.#e=e,this.#t=t,this.#n=t.view,this.#d=t.paused??!1,globalThis.addEventListener?.(`offline`,this.#f),globalThis.addEventListener?.(`online`,this.#p),globalThis.addEventListener?.(`pagehide`,this.#m);let n=t.initial;if(n===void 0)this.#h({});else{let e=++this.#u;queueMicrotask(()=>{e===this.#u&&!this.#c&&this.#g(n)})}}get view(){return this.#n}change(e){this.#c||zM(e,this.#n)||(this.#n=e,this.#l=!1,this.#x(),this.#h(this.#r===void 0?{}:{replaces:this.#r}))}pause(){this.#d||(this.#d=!0,this.#x())}resume(){this.#d&&(this.#d=!1,this.#y())}close(e=!1){this.#c||(this.#c=!0,this.#u+=1,globalThis.removeEventListener?.(`offline`,this.#f),globalThis.removeEventListener?.(`online`,this.#p),globalThis.removeEventListener?.(`pagehide`,this.#m),this.#x(),this.#r!==void 0&&this.#e.retire(this.#r,e).catch(()=>void 0))}async#h(e){let t=++this.#u,n;try{n=await this.#e.subscribe({view:this.#n,...e})}catch(e){if(t!==this.#u)return;this.#t.onError?.(VM(e));return}if(t!==this.#u||this.#c){this.#e.retire(n.subscription).catch(()=>void 0);return}this.#_(n)}#g(e){let t;try{t=this.#e.parseSubscribed(e)}catch(e){this.#t.onError?.(Error(`The first answer failed contract validation: ${BM(e)}`));return}this.#_(t)}#_(e){let t=RM(this.#n,e);if(t!==void 0){this.#w(Error(`The subscription answered ${t}`));return}this.#r=e.subscription;let n=e.initial;if(n.type===`snapshot`)this.#v(n.snapshot,{kind:`snapshot`});else if(n.subscription!==e.subscription||n.snapshot.id!==n.id){this.#w(Error(`A recreated subscription's reset is not its own snapshot`));return}else this.#v(n.snapshot,{kind:`reset`,reason:n.reason});this.#y()}#v(e,t){this.#i={sidebar:e.sidebar??this.#i?.sidebar,visible:e.visible,applied:e.id},this.#t.onState(this.#i,t)}#y(){if(this.#c||this.#l||this.#d||this.#a!==void 0||this.#r===void 0||this.#i===void 0)return;this.#o!==void 0&&clearTimeout(this.#o),this.#o=void 0;let e=this.#e.url(Pk.events);e.searchParams.set(Fk.subscription,this.#r),e.searchParams.set(Fk.after,this.#i.applied);let t=this.#e.open(e);this.#a=t;let n=!1;this.#s=setTimeout(()=>{this.#a===t&&this.#w(new Se(`Opening the live stream`))},se),t.onopen=()=>{this.#b(),n&&this.#t.onConnected?.(),n=!0};for(let e of vM)t.addEventListener(e,n=>{this.#a===t&&n instanceof MessageEvent&&typeof n.data==`string`&&(this.#b(),this.#C(n.data,e,n.lastEventId))});t.onerror=()=>{this.#a===t&&(this.#t.onDisconnected?.(),t.readyState===2&&(this.#a=void 0,this.#o=setTimeout(()=>{this.#o=void 0,!(this.#c||this.#l||this.#i===void 0)&&this.#h({resume:this.#i.applied})},DM)))}}#b(){this.#s!==void 0&&clearTimeout(this.#s),this.#s=void 0}#x(){this.#b(),this.#a?.close(),this.#a=void 0,this.#o!==void 0&&clearTimeout(this.#o),this.#o=void 0}#S(){this.#x(),this.#y()}#C(e,t,n){let r=this.#i;if(r===void 0||this.#l)return;let i;try{i=_M.parse(JSON.parse(e))}catch(e){this.#w(Error(`A frame failed contract validation: ${BM(e)}`));return}if(i.subscription!==this.#r)return;if(i.type!==t||i.id!==n){this.#w(Error(`A frame's SSE event or id is not the frame's own type and id`));return}let a=OM(r.applied),o=OM(i.id);if(o.epoch===a.epoch&&o.seq<=a.seq)return;if(i.type===`reset`){if(i.snapshot.id!==i.id){this.#w(Error(`A reset frame names a snapshot other than itself`));return}let e=LM(this.#n,i.snapshot);if(e!==void 0){this.#w(Error(`A reset frame re-sent ${e}`));return}this.#v(i.snapshot,{kind:`reset`,reason:i.reason});return}if(o.epoch!==a.epoch){this.#w(Error(`A frame names another server's epoch`));return}if(i.base!==r.applied){this.#S();return}let s;try{s={...AM(r,i,this.#n),applied:i.id}}catch(e){this.#w(Error(`A patch could not be applied: ${BM(e)}`));return}this.#i=s,this.#t.onState(s,{kind:`frame`,frame:i})}#w(e){this.#l=!0,this.#x(),this.#t.onError?.(e)}};function AM(e,t,n){switch(t.type){case`sidebar.snapshot`:return{sidebar:t.rows,visible:e.visible};case`run.changed`:{let n=e.sidebar??[],r=n.findIndex(e=>e.id===t.row.id);return{sidebar:r===-1?[...n,t.row]:n.map((e,n)=>n===r?t.row:e),visible:e.visible}}case`run.removed`:return{sidebar:e.sidebar?.filter(e=>e.id!==t.run_id),visible:e.visible};default:return{sidebar:e.sidebar,visible:MM(e.visible,t,n)}}}function jM(e,t,n,r){let i=e.safeParse(CM(t,n));if(!i.success)throw Error(`the patched ${r} failed contract validation`);return i.data}function MM(e,t,n){let r=e=>Error(`a ${t.type} for ${e} this tab does not show`);if(t.type===`human-items.patch`){if(e.type!==`human-items`)throw r(`human items`);let i=jM(Ak,e,t.ops,`human items`);if(IM(n,i))throw Error(`a human-items.patch moved its detail to another item`);return i}if(e.type===`sidebar`||e.type===`human-items`||e.run_id!==t.run_id)throw r(`a run`);let i=n=>{if(n.run_id!==e.run_id)throw Error(`a ${t.type} moved its payload to another run`);return n};switch(t.type){case`detail.patch`:return{...e,detail:(()=>{let n=jM(ZA,e.detail,t.ops,`detail`);return i(n.run),n})()};case`timeline.patch`:if(e.type!==`timeline`||e.scope!==t.scope)throw r(`a timeline`);if(t.scope===`node`&&(e.scope!==`node`||e.node!==t.node))throw r(`a node's timeline`);return{...e,timeline:i(jM(pj,e.timeline,t.ops,`timeline`))};case`channel.patch`:if(e.type!==`channel`)throw r(`a channel`);return{...e,channel:i(jM(Bj,e.channel,t.ops,`channel`))}}}function NM(e){return[e.type,e.run_id,e.scope,e.node].join(`\0`)}function PM(e){return Array.isArray(e)?e.map(PM):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,PM(t)])):e}function FM(e){if(e!==void 0){if(typeof e!=`string`)return JSON.stringify(PM(e));if(!e.startsWith(`{`))return e;try{return JSON.stringify(PM(JSON.parse(e)))}catch{return e}}}function IM(e,t){return t.detail===null?!1:!(`item`in e)||t.detail.item.id!==e.item}function LM(e,t){let n=t.visible;if(NM(n)!==NM(e))return`the state of another view`;if(n.type===`human-items`)return IM(e,n)?`the detail of another item`:void 0;if(n.type!==`sidebar`)return[n.detail.run.run_id,`timeline`in n?n.timeline.run_id:n.run_id,`channel`in n?n.channel.run_id:n.run_id].every(e=>e===n.run_id)?void 0:`a payload of another run`}function RM(e,t){if(NM(t.view)!==NM(e))return`another view`;let n=e=>`filter`in e?e.filter:void 0;if(FM(n(t.view))!==FM(n(e)))return`another filter`;let r=e=>`item`in e?e.item:void 0;return r(t.view)===r(e)?LM(e,t.initial.snapshot):`another item`}function zM(e,t){return JSON.stringify(e)===JSON.stringify(t)}function BM(e){return e instanceof Error?e.message:String(e)}function VM(e){return e instanceof Error?e:Error(String(e))}var HM=class extends Error{status;code;constructor(e,t,n,r){super(e,r),this.status=t,this.code=n,this.name=`TelemetryClientError`}},UM=50,WM=class{#e;#t;#n;constructor(e,t={}){this.#e=new URL(e),this.#t=t.fetch??globalThis.fetch,this.#n=t.eventSource}async listRuns(e=!1,t,n=UM){let r=this.#r(Pk.runs);return r.searchParams.set(Fk.includeSettled,String(e)),r.searchParams.set(Fk.limit,String(n)),t!==void 0&&r.searchParams.set(Fk.cursor,t),this.#a(r,cA.parse)}async selectRuns(e){if(e.length===0)throw new HM(`Invalid selection`);for(let t of e)if(qM(t,`run ID`),t.includes(`,`))throw new HM(`Invalid run ID`);let t=this.#r(Pk.runs);return t.searchParams.set(Fk.select,e.join(`,`)),this.#a(t,cA.parse)}async getRun(e,t={}){qM(e,`run ID`);let n=this.#r(Pk.run(e));return t.includeConversations!==void 0&&n.searchParams.set(Fk.includeConversations,String(t.includeConversations)),t.filter!==void 0&&n.searchParams.set(Fk.filter,t.filter),this.#a(n,WA.parse)}async getTimeline(e,t,n){qM(e,`run ID`);let r=this.#r(Pk.timeline(e));return n!==void 0&&r.searchParams.set(Fk.filter,n),t===void 0?r.searchParams.set(Fk.scope,Ik.run):(r.searchParams.set(Fk.scope,Ik.node),r.searchParams.set(Fk.node,t)),this.#a(r,pj.parse)}async getConversation(e,t){return qM(e,`run ID`),qM(t,`conversation ID`),this.#a(this.#r(Pk.conversation(e,t)),LA.parse)}async getArtifact(e,t){return qM(e,`run ID`),qM(t,`artifact ID`),this.#a(this.#r(Pk.artifact(e,t)),fj.parse)}async getTimelineEvents(e,t){qM(e,`run ID`),t.node!==void 0&&qM(t.node,`node ID`);let n=this.#r(Pk.timelineEvents(e));n.searchParams.set(Fk.scope,t.scope===`node`&&t.node!==void 0?Ik.node:Ik.run);for(let[e,r]of[[Fk.node,t.node],[Fk.span,t.span],[Fk.cursor,t.cursor],[Fk.from,t.from],[Fk.to,t.to],[Fk.filter,t.filter],[Fk.limit,t.limit===void 0?void 0:String(t.limit)]])r!==void 0&&n.searchParams.set(e,r);return this.#a(n,mj.parse,void 0,`This page of the run's history`)}subscribe(e){e.runId!==void 0&&qM(e.runId,`run ID`),e.after!==void 0&&qM(e.after,`cursor`);let t=this.#r(Pk.events);e.runId!==void 0&&t.searchParams.set(Fk.runId,e.runId),e.after!==void 0&&t.searchParams.set(Fk.after,e.after),e.filter!==void 0&&t.searchParams.set(Fk.filter,e.filter);let n=this.#i(t);for(let t of gj.options)n.addEventListener(t,n=>{try{let r=n,i=JSON.parse(r.data),a=t===`snapshot`?cA.parse(i):_j.parse(i);e.onEvent({id:r.lastEventId,event:t,data:a})}catch(t){e.onError?.(t)}});return n.onerror=t=>e.onError?.(t),{close:()=>n.close()}}live(e){return new kM({subscribe:e=>this.createSubscription(e),retire:(e,t)=>this.retireSubscription(e,t),open:e=>this.#i(e),url:e=>this.#r(e),parseSubscribed:e=>yM.parse(e)},e)}async createSubscription(e){return this.#a(this.#r(Pk.subscriptions),yM.parse,KM(`POST`,e),e.view.type===`sidebar`||e.view.type===`human-items`?`The read of this page`:`The read of this run's history`)}async retireSubscription(e,t=!1){qM(e,`subscription ID`);let n;try{n=await this.#t(this.#r(Pk.subscription(e)),{method:`DELETE`,...t?{keepalive:t}:{}})}catch(e){throw new HM(`Telemetry request failed`,void 0,void 0,{cause:e})}if(!n.ok&&n.status!==204)throw new HM(`Retiring a subscription failed with status ${n.status}`,n.status)}async listProjects(){return this.#a(this.#r(Pk.projects),bj.parse)}async getProject(e){return qM(e,`project ID`),this.#a(this.#r(Pk.project(e)),xj.parse)}async getChannel(e){return qM(e,`run ID`),this.#a(this.#r(Pk.channel(e)),Bj.parse)}async claimNext(e,t){qM(e,`run ID`);let n=this.#r(Pk.channelNext(e));return t!==void 0&&n.searchParams.set(Fk.filter,t),this.#a(n,Hj.parse,{method:`POST`})}async reply(e,t,n){qM(e,`run ID`);let r=this.#r(Pk.channelReply(e));return n!==void 0&&r.searchParams.set(Fk.correlation,n),this.#a(r,Uj.parse,{method:`POST`,headers:{"content-type":`application/json`},body:t})}async surface(e,t){return qM(e,`run ID`),this.#a(this.#r(Pk.channelSurface(e)),Wj.parse,KM(`POST`,t))}async attest(e,t){return qM(e,`run ID`),this.#a(this.#r(Pk.attest(e)),Uj.parse,KM(`POST`,{reference:t}))}async stop(e,t=!1){return qM(e,`run ID`),this.#a(this.#r(Pk.stop(e)),Gj.parse,KM(`POST`,{force:t}))}async listHumanItems(e={}){let t=this.#r(ik.list);for(let[n,r]of Object.entries(e))r!=null&&t.searchParams.set(n,String(r));return this.#a(t,Ok.parse)}async getHumanItem(e){return qM(e,`human-item ID`),this.#a(this.#r(ik.item(e)),wk.parse)}async answerHumanItem(e,t){return qM(e,`human-item ID`),this.#a(this.#r(ik.answer(e)),Tk.parse,KM(`POST`,typeof t==`string`?{text:t}:t))}async answerHumanItems(e){return this.#a(this.#r(ik.answers),Dk.parse,KM(`POST`,{answers:e}))}async completeHumanItem(e){return qM(e,`human-item ID`),this.#a(this.#r(ik.complete(e)),Tk.parse,KM(`POST`,{}))}async dismissHumanItem(e,t){return qM(e,`human-item ID`),this.#a(this.#r(ik.dismiss(e)),Tk.parse,KM(`POST`,t?.trim()?{reason:t}:{}))}async reopenHumanItem(e){return qM(e,`human-item ID`),this.#a(this.#r(ik.reopen(e)),Tk.parse,KM(`POST`,{}))}async noteHumanItem(e,t){return qM(e,`human-item ID`),this.#a(this.#r(ik.note(e)),Tk.parse,KM(`POST`,{text:t}))}async shutdown(e,t={}){return this.#a(this.#r(Pk.shutdown),Xj.parse,KM(`POST`,{scope:e,...GM(t)}))}async unwatched(){return this.#a(this.#r(Pk.unwatched),Zj.parse)}async host(){return this.#a(this.#r(Pk.host),$j.parse)}async getStatus(e){return qM(e,`run ID`),this.#a(this.#r(Pk.status(e)),eM.parse)}async getAgents(e){return qM(e,`run ID`),this.#a(this.#r(Pk.agents(e)),iM.parse)}async getNodeAgents(e,t){return qM(e,`run ID`),qM(t,`node ID`),this.#a(this.#r(Pk.nodeAgents(e,t)),iM.parse)}async getProjectAgents(e){return qM(e,`project ID`),this.#a(this.#r(Pk.projectAgents(e)),aM.parse)}#r(e){return new URL(e,this.#e)}#i(e){return(this.#n??(e=>{if(typeof EventSource>`u`)throw new HM(`EventSource is unavailable; provide an eventSource factory`);return new EventSource(e)}))(e.toString())}async#a(e,t,n,r){let i=r===void 0?void 0:new AbortController,a=i===void 0?void 0:setTimeout(()=>i.abort(),se);try{return await this.#o(e,t,{...n,...i===void 0?{}:{signal:i.signal}})}catch(e){throw i?.signal.aborted===!0&&r!==void 0?new HM(new Se(r).message,void 0,`deadline`,{cause:e}):e}finally{a!==void 0&&clearTimeout(a)}}async#o(e,t,n){let r;try{r=await this.#t(e,n)}catch(e){throw new HM(`Telemetry request failed`,void 0,void 0,{cause:e})}let i=await r.json().catch(e=>{throw r.ok?new HM(`Telemetry server returned invalid JSON`,r.status,void 0,{cause:e}):new HM(`Telemetry request failed with status ${r.status}`,r.status,void 0,{cause:e})});if(!r.ok){let e=hj.safeParse(i);throw new HM(e.success?e.data.error.message:`Telemetry request failed with status ${r.status}`,r.status,e.success?e.data.error.code:void 0)}try{return t(i)}catch(e){throw new HM(`Telemetry response failed contract validation`,r.status,void 0,{cause:e})}}};function GM(e){let{grace:t,force:n=!1}=e;if(t===void 0)return{force:n};if(!Number.isSafeInteger(t)||t<0)throw new HM(`Invalid grace: whole seconds, 0 or more`);return{grace:t,force:n}}function KM(e,t){return{method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}}function qM(e,t){let n=[...e].some(e=>e.charCodeAt(0)<32);if(e.length===0||n||/[/?#]/u.test(e))throw new HM(`Invalid ${t}`)}function JM({outcome:e,label:t}){if(e===void 0)return null;if(e.kind===`refused`){let n=e.error,r=n instanceof HM?n.code:void 0,i=n instanceof HM?n.status:void 0;return(0,z.jsxs)(Lr,{"aria-label":`${t} refused`,variant:`destructive`,children:[(0,z.jsx)(u,{}),(0,z.jsxs)(Rr,{children:[e.title,i!==void 0&&` · ${i}`,r!==void 0&&` ${r}`]}),(0,z.jsx)(zr,{children:(0,z.jsx)(`pre`,{className:`verb-text`,children:n.message})})]})}return(0,z.jsxs)(Lr,{"aria-label":`${t} receipt`,children:[(0,z.jsx)(Le,{}),(0,z.jsx)(Rr,{children:e.title}),(0,z.jsx)(zr,{children:(0,z.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.payload,null,2)})})]})}async function YM(e,t){try{return{kind:`answered`,title:e,payload:await t()}}catch(t){return{kind:`refused`,title:e,error:t instanceof Error?t:Error(String(t))}}}var XM={approve:`Approve`,reject:`Reject`,continue:`Continue`},ZM=[`review`,`readjust`,`decline`,`withdraw-note`],QM=[`approve`,`reject`,`continue`,...Pj.filter(e=>!ZM.some(t=>t===e))];function $M(e){return QM.some(t=>t===e)}var eN={approve:[`message`,`reason`],reject:[`message`,`reason`],continue:[`message`],add:[`json`],drop:[`id`,`dependents`],reparent:[`id`,`deps`],retry:[`id`,`json`],rework:[`id`,`reason`,`instruction`,`comments`,`title`,`replacement`],retitle:[`id`,`title`,`reason`],cancel:[`id`,`reason`],requeue:[`id`,`json`],"set-node-sets":[`id`,`sets`],"set-run-node-sets":[`runSets`],attest:[`reference`],complete:[`reason`],amend:[`id`,`text`],note:[`id`,`addressee`,`text`,`criterion`,`deliver`,`persist`],finding:[`message`,`blocking`,`id`],settle:[`id`,`outcome`,`evidence`,`landing`]};function tN(e,t){let n=nN(e,t);if(`problem`in n)return n;let r=Fj.safeParse(n.envelope);if(!r.success){let e=r.error.issues[0];return{problem:`${e?.path.join(`.`)||`envelope`}: ${e?.message??`not an envelope`}`}}return{envelope:r.data,bytes:JSON.stringify(r.data,null,2)}}function nN(e,t){let n=e=>{let n=t[e];return typeof n==`string`&&n.trim().length>0?n:void 0};switch(e){case`approve`:return{envelope:{completion:!0,...iN(`message`,n(`message`)),...iN(`reason`,n(`reason`))}};case`reject`:return{envelope:{completion:!1,...iN(`message`,n(`message`)),...iN(`reason`,n(`reason`))}};case`continue`:return{envelope:{message:n(`message`)??``}};default:{let r=rN(e,t,n);return`problem`in r?r:{envelope:{version:4,commands:[r.command]}}}}}function rN(e,t,n){let r=n(`id`);switch(e){case`add`:case`retry`:case`requeue`:{let t=n(`json`);if(t===void 0&&e!==`requeue`)return{problem:`node: a node mapping is required`};let i;if(t!==void 0)try{i=JSON.parse(t)}catch(t){return{problem:`${e===`requeue`?`amend`:`node`}: ${t instanceof Error?t.message:`not JSON`}`}}return e===`add`?{command:{op:e,node:i}}:e===`retry`?{command:{op:e,id:r,node:i}}:{command:{op:e,id:r,...iN(`amend`,i)}}}case`set-node-sets`:case`set-run-node-sets`:{let n=[...(e===`set-node-sets`?t.sets:t.runSets)??[]],i=n.findIndex(e=>e.trim().length===0);return i>=0?{problem:`sets.${i}: an override needs a PATH=VALUE`}:e===`set-node-sets`?{command:{op:e,id:r,sets:n}}:{command:{op:e,sets:n}}}case`drop`:return{command:{op:e,id:r,dependents:n(`dependents`)}};case`reparent`:return{command:{op:e,id:r,deps:(t.deps??``).split(`
|
|
81
|
-
`).map(e=>e.trim()).filter(e=>e.length>0)}};case`rework`:{let t,i=n(`comments`);if(i!==void 0)try{t=JSON.parse(i)}catch(e){return{problem:`comments: ${e instanceof Error?e.message:`not JSON`}`}}return{command:{op:e,id:r,reason:n(`reason`),instruction:n(`instruction`),...iN(`comments`,t),...iN(`title`,n(`title`)),...iN(`replacement`,n(`replacement`))}}}case`retitle`:return{command:{op:e,id:r,title:n(`title`),reason:n(`reason`)}};case`cancel`:return{command:{op:e,id:r,...iN(`reason`,n(`reason`))}};case`attest`:return{command:{op:e,ref:n(`reference`)}};case`complete`:return{command:{op:e,reason:n(`reason`)}};case`amend`:return{command:{op:e,id:r,text:n(`text`)}};case`note`:return{command:{op:e,id:r,addressee:n(`addressee`),text:n(`text`),...iN(`criterion`,n(`criterion`)),...iN(`deliver`,n(`deliver`)===`live`?void 0:n(`deliver`)),...t.persist===!1?{persist:!1}:{}}};case`finding`:return{command:{op:e,message:n(`message`),...t.blocking===!0?{blocking:!0}:{},...iN(`id`,r)}};case`settle`:return{command:{op:e,id:r,outcome:n(`outcome`),evidence:n(`evidence`),...iN(`landing`,n(`landing`))}};default:return{problem:`op: ${String(e)} is not an op`}}}function iN(e,t){let n={};return t!==void 0&&(n[e]=t),n}function aN(e){let t=e.op;return typeof t==`string`?t:`?`}function oN({legend:e,sets:t,onChange:n,current:r}){let i=(0,R.useId)(),a=(e,r)=>n(t.map((t,n)=>n===e?r:t)),o=(e,r)=>{let i=[...t],[a]=i.splice(e,1);a!==void 0&&i.splice(r,0,a),n(i)};return(0,z.jsxs)(`fieldset`,{"aria-describedby":`${i}-hint`,className:`sets-editor`,children:[(0,z.jsx)(`legend`,{children:e}),(0,z.jsx)(`p`,{className:`sets-hint`,id:`${i}-hint`,children:`One PATH=VALUE a row, applied in order — the whole list is replaced, and an empty list clears it.`}),t.length===0?(0,z.jsx)(`p`,{className:`sets-empty`,children:`No overrides: sends an empty list.`}):(0,z.jsx)(`ol`,{className:`sets-list`,children:t.map((e,r)=>{let i=r+1;return(0,z.jsxs)(`li`,{className:`sets-row`,children:[(0,z.jsx)($o,{"aria-label":`Override ${i}`,className:`sets-entry`,onChange:e=>a(r,e.target.value),placeholder:`members.worker.agent.model=VALUE`,spellCheck:!1,value:e}),(0,z.jsx)(ci,{"aria-label":`Move override ${i} up`,disabled:r===0,onClick:()=>o(r,r-1),size:`icon`,type:`button`,variant:`ghost`,children:(0,z.jsx)(je,{})}),(0,z.jsx)(ci,{"aria-label":`Move override ${i} down`,disabled:r===t.length-1,onClick:()=>o(r,r+1),size:`icon`,type:`button`,variant:`ghost`,children:(0,z.jsx)(ke,{})}),(0,z.jsx)(ci,{"aria-label":`Remove override ${i}`,onClick:()=>n(t.filter((e,t)=>t!==r)),size:`icon`,type:`button`,variant:`ghost`,children:(0,z.jsx)(ut,{})})]},r)})}),(0,z.jsxs)(`div`,{className:`composer-actions`,children:[(0,z.jsxs)(ci,{onClick:()=>n([...t,``]),size:`sm`,type:`button`,variant:`outline`,children:[(0,z.jsx)($e,{size:14}),` Add override`]}),(0,z.jsxs)(ci,{disabled:r===void 0,onClick:()=>{r!==void 0&&n([...r])},size:`sm`,type:`button`,variant:`outline`,children:[(0,z.jsx)(T,{size:14}),` Load current list`]}),(0,z.jsx)(`span`,{className:`sets-current`,children:r===void 0?`No current list to load`:r.length===0?`Current list: none`:`Current list: ${r.join(` · `)}`})]})]})}function sN(e,t,n){let[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)();return{run:(0,R.useCallback)(async(...r)=>{i(!0);let a=await YM(typeof e==`string`?e:e(...r),()=>t(...r));return o(a),i(!1),a.kind===`answered`&&n?.(),a},[e,t,n]),pending:r,outcome:a}}function cN(e,t,n,r){let[i,a]=(0,R.useState)(`continue`),[o,s]=(0,R.useState)({}),[c,l]=(0,R.useState)(),[u,d]=(0,R.useState)(``),[f,p]=(0,R.useState)(``);return{shortcut:i,setShortcut:a,fields:o,setField:(0,R.useCallback)((e,t)=>s(n=>({...n,[e]:t})),[]),problem:c,compose:(0,R.useCallback)(()=>{let e=tN(i,{...n,...o});if(`problem`in e){l(e.problem);return}l(void 0),d(e.bytes)},[i,o,n]),envelope:u,setEnvelope:d,correlation:f,setCorrelation:p,send:sN(`Reply`,(0,R.useCallback)(()=>e.reply(t,u,f.trim()===``?void 0:f.trim()),[e,t,u,f]),r)}}var lN={message:`Message`,reason:`Reason`,instruction:`Instruction`,title:`Title`,replacement:`Replacement node id (optional)`,comments:`Review comments (JSON, optional)`,id:`Node id`,text:`Text`,addressee:`Addressee`,deliver:`Deliver`,persist:`Carry to the next dispatch if no turn takes it`,criterion:`Criterion (optional)`,dependents:`Dependents`,deps:`Dependencies, one per line`,reference:`Reference`,outcome:`Outcome`,evidence:`Evidence`,landing:`Landing (optional)`,blocking:`Blocking`,json:`Mapping (JSON)`,sets:`Node overrides`,runSets:`Run-wide overrides`},uN={addressee:Oj.options,deliver:kj.options,dependents:Aj.options,outcome:jj.options},dN=Object.fromEntries(Object.entries(uN).map(([e,t])=>[e,t[0]]));function fN({client:e,runId:t,onSent:n,overrides:r}){let i=(0,R.useId)(),{shortcut:a,setShortcut:o,fields:s,setField:c,problem:l,compose:u,envelope:d,setEnvelope:f,correlation:p,setCorrelation:m,send:h}=cN(e,t,dN,n);return(0,z.jsxs)(`section`,{"aria-labelledby":`${i}-heading`,className:`composer`,children:[(0,z.jsx)(`h3`,{id:`${i}-heading`,children:`Reply`}),(0,z.jsxs)(`div`,{className:`composer-shortcut`,children:[(0,z.jsx)(ns,{htmlFor:`${i}-shortcut`,children:`Shortcut`}),(0,z.jsxs)(`select`,{className:`composer-select`,id:`${i}-shortcut`,onChange:e=>{let t=e.target.value;$M(t)&&o(t)},value:a,children:[(0,z.jsx)(`optgroup`,{label:`Verdict`,children:Object.entries(XM).map(([e,t])=>(0,z.jsx)(`option`,{value:e,children:t},e))}),(0,z.jsx)(`optgroup`,{label:`Edit`,children:QM.filter(e=>!(e in XM)).map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,z.jsx)(`div`,{className:`composer-fields`,children:eN[a].map(e=>{let t=`${i}-${e}`,n=uN[e];if(e===`sets`||e===`runSets`){let t=typeof s.id==`string`?s.id.trim():``;return(0,z.jsx)(oN,{current:e===`runSets`?r?.run:r?.nodes.get(t),legend:`${lN[e]}, in order`,onChange:t=>c(e,t),sets:s[e]??[]},e)}if(e===`persist`||e===`blocking`)return(0,z.jsxs)(`div`,{className:`composer-check`,children:[(0,z.jsx)(`input`,{checked:e===`persist`?s.persist!==!1:s.blocking===!0,id:t,onChange:t=>c(e,t.target.checked),type:`checkbox`}),(0,z.jsx)(ns,{htmlFor:t,children:lN[e]})]},e);let a=s[e],o=typeof a==`string`?a:``;return(0,z.jsxs)(`div`,{className:`composer-field`,children:[(0,z.jsx)(ns,{htmlFor:t,children:lN[e]}),n===void 0?e===`message`||e===`text`||e===`json`||e===`deps`||e===`evidence`?(0,z.jsx)(Qd,{id:t,onChange:t=>c(e,t.target.value),rows:e===`json`?5:2,value:o}):(0,z.jsx)($o,{id:t,onChange:t=>c(e,t.target.value),value:o}):(0,z.jsx)(`select`,{className:`composer-select`,id:t,onChange:t=>c(e,t.target.value),value:o||n[0],children:n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]},e)})}),(0,z.jsxs)(`div`,{className:`composer-actions`,children:[(0,z.jsxs)(ci,{onClick:u,size:`sm`,type:`button`,variant:`outline`,children:[(0,z.jsx)(ct,{size:14}),` Compose envelope`]}),l!==void 0&&(0,z.jsx)(`p`,{"aria-label":`Envelope not composed`,className:`composer-problem`,role:`alert`,children:l})]}),(0,z.jsxs)(`div`,{className:`composer-field`,children:[(0,z.jsx)(ns,{htmlFor:`${i}-envelope`,children:`Envelope (sent as typed)`}),(0,z.jsx)(Qd,{className:`composer-envelope`,id:`${i}-envelope`,onChange:e=>f(e.target.value),rows:8,spellCheck:!1,value:d})]}),(0,z.jsxs)(`div`,{className:`composer-field composer-correlation`,children:[(0,z.jsx)(ns,{htmlFor:`${i}-correlation`,children:`Correlation (optional)`}),(0,z.jsx)($o,{id:`${i}-correlation`,onChange:e=>m(e.target.value),value:p})]}),(0,z.jsxs)(`div`,{className:`composer-actions`,children:[(0,z.jsxs)(ci,{disabled:h.pending||d.trim()===``,onClick:()=>void h.run(),size:`sm`,type:`button`,children:[(0,z.jsx)(it,{size:14}),` Send reply`]}),(0,z.jsx)(`span`,{"aria-live":`polite`,className:`run-list-status`,children:h.pending?`Sending…`:``})]}),(0,z.jsx)(JM,{label:`Reply`,outcome:h.outcome})]})}function pN(e){return(0,R.useMemo)(()=>{let t=new Set(e.surfaces.flatMap(e=>e.correlation?[e.correlation]:[]));return{exchanges:[...e.surfaces].reverse().map(t=>({surface:t,replies:e.replies.filter(e=>t.correlation!==void 0&&e.correlation===t.correlation)})),otherReplies:e.replies.filter(e=>!t.has(e.correlation??``))}},[e])}function mN({client:e,runId:t,filter:n,decisions:r,observedAt:i,channel:a,journalSeq:o,overrides:s}){let c=(0,R.useCallback)(()=>void 0,[]),l=sN(`Next`,(0,R.useCallback)(()=>e.claimNext(t,n),[e,t,n]),c);return(0,z.jsx)(Pu,{className:`h-full`,children:(0,z.jsxs)(`div`,{className:`channel-view`,"data-journal-seq":o,children:[(0,z.jsxs)(`section`,{"aria-labelledby":`channel-queue-heading`,className:`channel-section`,children:[(0,z.jsxs)(`div`,{className:`section-heading channel-heading`,children:[(0,z.jsxs)(`h3`,{id:`channel-queue-heading`,children:[(0,z.jsx)(He,{size:15}),` Channel queue`]}),(0,z.jsx)(ci,{disabled:l.pending,onClick:()=>void l.run(),size:`sm`,type:`button`,children:`Next`})]}),a===void 0?(0,z.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,z.jsx)(Ju,{className:`h-2 w-48`}),`Loading channel…`]}):(0,z.jsx)(hN,{observedAt:i,queue:a}),(0,z.jsx)(JM,{label:`Next`,outcome:l.outcome})]}),(0,z.jsx)(CN,{client:e,decisions:r,onWrote:c,runId:t}),(0,z.jsx)(fN,{client:e,onSent:c,overrides:s,runId:t}),(0,z.jsx)(wN,{client:e,onRaised:c,runId:t})]})})}function hN({queue:e,observedAt:t}){let{exchanges:n,otherReplies:r}=pN(e);return(0,z.jsxs)(`div`,{className:`channel-queue`,children:[(0,z.jsxs)(`section`,{"aria-label":`Surfaces`,className:`channel-list`,children:[(0,z.jsx)(`h4`,{children:`Conversation`}),e.surfaces.length===0&&(0,z.jsx)(`p`,{className:`channel-empty`,children:`No surfaces yet.`}),(0,z.jsx)(`ul`,{children:n.map(({surface:e,replies:n})=>(0,z.jsxs)(`li`,{"aria-label":`Surface ${e.id}`,children:[(0,z.jsx)(bN,{observedAt:t,surface:e}),n.length===0?(0,z.jsx)(`p`,{className:`channel-empty`,children:`Waiting for reply`}):n.map(e=>(0,z.jsx)(_N,{reply:e},e.id))]},e.id))})]}),(0,z.jsxs)(`section`,{"aria-label":`Replies`,className:`channel-list`,children:[(0,z.jsx)(`h4`,{children:`Other replies`}),r.map(e=>(0,z.jsx)(_N,{reply:e},e.id))]}),(0,z.jsxs)(`section`,{"aria-label":`Queued commands`,className:`channel-list`,children:[(0,z.jsx)(`h4`,{children:`Queued commands`}),e.commands.length===0?(0,z.jsx)(`p`,{className:`channel-empty`,children:`Nothing awaits the reconciler.`}):(0,z.jsx)(`ul`,{children:e.commands.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsx)(li,{className:`channel-card`,children:(0,z.jsxs)(ui,{children:[(0,z.jsxs)(`div`,{className:`channel-card-head`,children:[(0,z.jsxs)(`strong`,{className:`channel-card-title`,children:[`Envelope `,e.id,` · from`,` `,vN(wj(e.provenance))]}),(0,z.jsx)(`span`,{className:`channel-age`,children:e.commands.map(aN).join(`, `)})]}),(0,z.jsx)(yN,{commands:e.commands})]})})},e.id))})]}),(0,z.jsxs)(`section`,{"aria-label":`Command outcomes`,className:`channel-list`,children:[(0,z.jsx)(`h4`,{children:`Command outcomes`}),e.outcomes.length===0?(0,z.jsx)(`p`,{className:`channel-empty`,children:`The reconciler has answered nothing yet.`}):(0,z.jsx)(`ul`,{children:e.outcomes.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsx)(li,{className:`channel-card`,children:(0,z.jsxs)(ui,{children:[(0,z.jsxs)(`div`,{className:`channel-card-head`,children:[(0,z.jsxs)(`strong`,{className:`channel-card-title`,children:[`Envelope `,e.id]}),(0,z.jsx)(v,{variant:e.applied?`default`:`destructive`,children:e.applied?`applied`:`not applied`})]}),e.reason!==void 0&&(0,z.jsx)(`pre`,{className:`verb-text`,children:e.reason}),e.results!==void 0&&e.results.length>0&&(0,z.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.results,null,2)})]})})},e.id))})]})]})}function gN({text:e,children:t,meta:n,label:r}){let i=e.split(/\r?\n/,1)[0];return(0,z.jsxs)(`details`,{"aria-label":r,className:`channel-message-details`,children:[(0,z.jsxs)(`summary`,{"aria-label":`${r}: ${i}`,children:[(0,z.jsx)(`span`,{className:`channel-message-meta`,children:n}),(0,z.jsxs)(`span`,{className:`channel-message-preview`,children:[i,`…`]})]}),(0,z.jsx)(`pre`,{className:`verb-text`,children:e}),t]})}function _N({reply:e}){let t=typeof e.reply.message==`string`?e.reply.message:`Reply without message`;return(0,z.jsx)(li,{className:`channel-card py-2`,children:(0,z.jsx)(ui,{children:(0,z.jsx)(gN,{label:`Reply ${e.id} message`,text:t,meta:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`strong`,{className:`channel-card-title`,children:[`Reply `,e.id,` · from`,` `,vN(wj(e.reply.provenance))]}),(0,z.jsx)(f,{at:F(e.at),className:`channel-age`,relative:!0})]}),children:(0,z.jsxs)(`details`,{"aria-label":`Raw envelope for reply ${e.id}`,children:[(0,z.jsx)(`summary`,{children:`Raw envelope`}),(0,z.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.reply,null,2)})]})})})})}function vN(e){return e===`user`?`you`:`the manager`}function yN({commands:e}){let t=e.flatMap((e,t)=>e.op===`note`&&typeof e.id==`string`&&typeof e.text==`string`?[{index:t,node:e.id,text:e.text}]:[]);return t.length===0?null:(0,z.jsx)(`ul`,{"aria-label":`Notes`,className:`channel-envelope-notes`,children:t.map(e=>(0,z.jsxs)(`li`,{children:[`Note to `,e.node,`: `,e.text]},e.index))})}function bN({surface:t,observedAt:n}){let r=Math.max(0,(Date.parse(n)-t.queued_at)/1e3),i=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(v,{children:t.kind}),t.blocking&&(0,z.jsx)(v,{variant:`destructive`,children:`blocking`}),(0,z.jsxs)(`span`,{className:`channel-age`,children:[`from `,t.source,t.workstream!==void 0&&` · node ${t.workstream}`,` · surface ${t.id} · ${e(r)} old`]})]}),a=t.declined_ruling;return(0,z.jsx)(li,{className:`channel-card py-2`,children:(0,z.jsx)(ui,{children:a===void 0?(0,z.jsx)(gN,{label:`Surface ${t.id} message`,text:t.message,meta:i}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`channel-card-head`,children:i}),(0,z.jsx)(SN,{ruling:a,source:t.source})]})})})}var xN={note:`note`,amendment:`amendment`,answer:`answer`};function SN({ruling:e,source:t}){let n=e.provenance===`user`?`your`:`the manager's`;return(0,z.jsxs)(`section`,{"aria-label":`Declined ruling`,className:`declined-ruling`,children:[(0,z.jsxs)(`p`,{children:[`The `,t,` on `,e.node,` declined `,n,` `,xN[e.kind],` from reply `,e.reply]}),(0,z.jsx)(`blockquote`,{children:e.text}),(0,z.jsxs)(`p`,{children:[`Reason: `,e.reason]})]})}function CN({client:e,runId:t,decisions:n,onWrote:r}){let i=TN(e,t,r);return(0,z.jsxs)(`section`,{"aria-labelledby":`attest-heading`,className:`channel-section`,children:[(0,z.jsxs)(`h3`,{id:`attest-heading`,children:[(0,z.jsx)(Me,{size:15}),` Ready human actions`]}),n===void 0?(0,z.jsx)(`p`,{className:`channel-empty`,children:te}):n.length===0?(0,z.jsx)(`p`,{className:`channel-empty`,children:`No decision point is holding the graph.`}):(0,z.jsx)(`ul`,{className:`attest-list`,children:n.map(e=>(0,z.jsxs)(`li`,{className:`attest-row`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(v,{variant:`outline`,children:e.kind}),` `,(0,z.jsx)(`span`,{className:`attest-reference`,children:e.id}),e.unblocks.length>0&&(0,z.jsxs)(`span`,{className:`channel-age`,children:[` `,`· unblocks `,e.unblocks.join(`, `)]})]}),(0,z.jsxs)(ci,{disabled:i.pending,onClick:()=>void i.run(e.id),size:`sm`,type:`button`,variant:`outline`,children:[`Attest `,e.id]})]},e.id))}),(0,z.jsx)(JM,{label:`Attest`,outcome:i.outcome})]})}function wN({client:e,runId:t,onRaised:n}){let r=(0,R.useId)(),{kind:i,setKind:a,message:o,setMessage:s,raise:c}=EN(e,t,n);return(0,z.jsxs)(`section`,{"aria-labelledby":`${r}-heading`,className:`channel-section`,children:[(0,z.jsxs)(`h3`,{id:`${r}-heading`,children:[(0,z.jsx)(Ye,{size:15}),` Surface`]}),(0,z.jsxs)(`div`,{className:`composer-fields`,children:[(0,z.jsxs)(`div`,{className:`composer-field`,children:[(0,z.jsx)(ns,{htmlFor:`${r}-kind`,children:`Kind`}),(0,z.jsx)($o,{id:`${r}-kind`,onChange:e=>a(e.target.value),placeholder:`finding`,value:i})]}),(0,z.jsxs)(`div`,{className:`composer-field`,children:[(0,z.jsx)(ns,{htmlFor:`${r}-message`,children:`Message`}),(0,z.jsx)(Qd,{id:`${r}-message`,onChange:e=>s(e.target.value),rows:2,value:o})]})]}),(0,z.jsx)(`div`,{className:`composer-actions`,children:(0,z.jsx)(ci,{disabled:c.pending||i.trim()===``,onClick:()=>void c.run(),size:`sm`,type:`button`,variant:`outline`,children:`Raise surface`})}),(0,z.jsx)(JM,{label:`Surface`,outcome:c.outcome})]})}function TN(e,t,n){return sN(e=>`Attest ${e}`,(0,R.useCallback)(n=>e.attest(t,n),[e,t]),n)}function EN(e,t,n){let[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``);return{kind:r,setKind:i,message:a,setMessage:o,raise:sN(`Surface`,(0,R.useCallback)(()=>e.surface(t,{kind:r,message:a}),[e,t,r,a]),(0,R.useCallback)(()=>{o(``),n()},[n]))}}function DN(e){return/\[[^\]]+\]/.exec(e)?.[0]}function ON({runId:e,control:t,ended:n}){let{stop:r,stopOpen:i,setStopOpen:a,forceOpen:o,setForceOpen:s,refusal:c}=kN(t),l=c===void 0?void 0:DN(c.message),u=r.outcome,d=r.pending,f=t.status.value?.liveness;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`run-actions`,children:[f!==void 0&&(0,z.jsx)(v,{"aria-label":`Liveness ${f}`,className:`run-actions-badge`,variant:`outline`,children:f}),!n&&(0,z.jsxs)(ci,{"aria-label":`Stop`,disabled:d,onClick:()=>a(!0),size:`sm`,title:`Stop`,type:`button`,variant:`destructive`,children:[(0,z.jsx)(Qe,{size:14}),(0,z.jsx)(`span`,{className:`run-action-label`,children:`Stop`})]})]}),(0,z.jsx)(Wo,{onOpenChange:a,open:i,children:(0,z.jsxs)(Jo,{children:[(0,z.jsxs)(Yo,{children:[(0,z.jsxs)(Zo,{children:[`Stop `,e,`?`]}),(0,z.jsx)(Qo,{children:`The run is stopped as the acting session. A run another session owns is refused, naming its owner.`})]}),(0,z.jsxs)(Xo,{children:[(0,z.jsx)(Ko,{asChild:!0,children:(0,z.jsx)(ci,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,z.jsx)(ci,{disabled:d,onClick:()=>void r.run(!1),type:`button`,variant:`destructive`,children:`Stop run`})]})]})}),(0,z.jsx)(Wo,{onOpenChange:s,open:o,children:(0,z.jsxs)(Jo,{children:[(0,z.jsxs)(Yo,{children:[(0,z.jsxs)(Zo,{children:[`Force-stop `,e,l!==void 0&&`, overriding ${l}`,`?`]}),(0,z.jsxs)(Qo,{children:[c?.message,` — `,`a forced stop is journalled forced with the owner it overrode.`]})]}),(0,z.jsxs)(Xo,{children:[(0,z.jsx)(Ko,{asChild:!0,children:(0,z.jsx)(ci,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,z.jsxs)(ci,{disabled:d,onClick:()=>void r.run(!0),type:`button`,variant:`destructive`,children:[`Force stop`,l!==void 0&&`, overriding ${l}`]})]})]})}),u!==void 0&&(0,z.jsxs)(`div`,{className:`run-outcomes`,children:[(0,z.jsx)(JM,{label:`Stop`,outcome:u}),c!==void 0&&(0,z.jsx)(`div`,{className:`composer-actions`,children:(0,z.jsx)(ci,{onClick:()=>s(!0),size:`sm`,type:`button`,variant:`destructive`,children:`Force stop…`})})]})]})}function kN(e){let[t,n]=(0,R.useState)(!1),[r,i]=(0,R.useState)(!1),a=sN(e=>e?`Forced stop`:`Stop`,(0,R.useCallback)(async t=>{try{return await e.stop(t)}finally{n(!1),i(!1)}},[e.stop]));return{stop:a,stopOpen:t,setStopOpen:n,forceOpen:r,setForceOpen:i,refusal:a.outcome?.kind===`refused`&&a.outcome.error instanceof HM&&a.outcome.error.code===`not_owner`?a.outcome.error:void 0}}function AN(e,t,n){let[r,i]=(0,R.useState)({}),a=(0,R.useRef)({key:e});(0,R.useEffect)(()=>{a.current.key=e},[e]),(0,R.useEffect)(()=>{if(e===void 0)return;let n=a.current.out;if(n?.key===e){n.again=!0;return}let r=()=>{let n={key:e,again:!1};a.current.out=n;let o=t=>{a.current.out===n&&(a.current.out=void 0),a.current.key===e&&(t(),n.again&&r())};t().then(t=>o(()=>i({key:e,value:t}))).catch(t=>o(()=>i(n=>({...n.key===e?n:{},key:e,error:jN(t)}))))};r()},[e,n]);let o=r.key===e?r:void 0;return{value:o?.value,error:o?.error,loading:e!==void 0&&o?.value===void 0&&o?.error===void 0}}function jN(e){return e instanceof Error?e:Error(String(e))}function MN(e,t){let[n,r]=(0,R.useState)(0),i=(0,R.useCallback)(()=>r(e=>e+1),[]);return{status:AN(t,()=>e.getStatus(t??``),n),stop:(0,R.useCallback)(async n=>{try{return await e.stop(t??``,n)}finally{i()}},[e,t,i]),reread:i}}function NN(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=NN(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var PN={value:()=>{}};function FN(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new IN(n)}function IN(e){this._=e}function LN(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}IN.prototype=FN.prototype={constructor:IN,on:function(e,t){var n=this._,r=LN(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=RN(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=zN(n[i],e.name,t);else if(t==null)for(i in n)n[i]=zN(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new IN(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function RN(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function zN(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=PN,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var BN={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function VN(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),BN.hasOwnProperty(t)?{space:BN[t],local:e}:e}function HN(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function UN(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function WN(e){var t=VN(e);return(t.local?UN:HN)(t)}function GN(){}function KN(e){return e==null?GN:function(){return this.querySelector(e)}}function qN(e){typeof e!=`function`&&(e=KN(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new FF(r,this._parents)}function JN(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function YN(){return[]}function XN(e){return e==null?YN:function(){return this.querySelectorAll(e)}}function ZN(e){return function(){return JN(e.apply(this,arguments))}}function QN(e){e=typeof e==`function`?ZN(e):XN(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new FF(r,i)}function $N(e){return function(){return this.matches(e)}}function eP(e){return function(t){return t.matches(e)}}var tP=Array.prototype.find;function nP(e){return function(){return tP.call(this.children,e)}}function rP(){return this.firstElementChild}function iP(e){return this.select(e==null?rP:nP(typeof e==`function`?e:eP(e)))}var aP=Array.prototype.filter;function oP(){return Array.from(this.children)}function sP(e){return function(){return aP.call(this.children,e)}}function cP(e){return this.selectAll(e==null?oP:sP(typeof e==`function`?e:eP(e)))}function lP(e){typeof e!=`function`&&(e=$N(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new FF(r,this._parents)}function uP(e){return Array(e.length)}function dP(){return new FF(this._enter||this._groups.map(uP),this._parents)}function fP(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}fP.prototype={constructor:fP,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function pP(e){return function(){return e}}function mP(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new fP(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function hP(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new fP(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function gP(e){return e.__data__}function _P(e,t){if(!arguments.length)return Array.from(this,gP);var n=t?hP:mP,r=this._parents,i=this._groups;typeof e!=`function`&&(e=pP(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=vP(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new FF(o,r),o._enter=s,o._exit=c,o}function vP(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function yP(){return new FF(this._exit||this._groups.map(uP),this._parents)}function bP(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function xP(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new FF(s,this._parents)}function SP(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function CP(e){e||=wP;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new FF(i,this._parents).order()}function wP(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function TP(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function EP(){return Array.from(this)}function DP(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function OP(){let e=0;for(let t of this)++e;return e}function kP(){return!this.node()}function AP(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function jP(e){return function(){this.removeAttribute(e)}}function MP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function NP(e,t){return function(){this.setAttribute(e,t)}}function PP(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function FP(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function IP(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function LP(e,t){var n=VN(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?MP:jP:typeof t==`function`?n.local?IP:FP:n.local?PP:NP)(n,t))}function RP(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function zP(e){return function(){this.style.removeProperty(e)}}function BP(e,t,n){return function(){this.style.setProperty(e,t,n)}}function VP(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function HP(e,t,n){return arguments.length>1?this.each((t==null?zP:typeof t==`function`?VP:BP)(e,t,n??``)):UP(this.node(),e)}function UP(e,t){return e.style.getPropertyValue(t)||RP(e).getComputedStyle(e,null).getPropertyValue(t)}function WP(e){return function(){delete this[e]}}function GP(e,t){return function(){this[e]=t}}function KP(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function qP(e,t){return arguments.length>1?this.each((t==null?WP:typeof t==`function`?KP:GP)(e,t)):this.node()[e]}function JP(e){return e.trim().split(/^|\s+/)}function YP(e){return e.classList||new XP(e)}function XP(e){this._node=e,this._names=JP(e.getAttribute(`class`)||``)}XP.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function ZP(e,t){for(var n=YP(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function QP(e,t){for(var n=YP(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function $P(e){return function(){ZP(this,e)}}function eF(e){return function(){QP(this,e)}}function tF(e,t){return function(){(t.apply(this,arguments)?ZP:QP)(this,e)}}function nF(e,t){var n=JP(e+``);if(arguments.length<2){for(var r=YP(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?tF:t?$P:eF)(n,t))}function rF(){this.textContent=``}function iF(e){return function(){this.textContent=e}}function aF(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function oF(e){return arguments.length?this.each(e==null?rF:(typeof e==`function`?aF:iF)(e)):this.node().textContent}function sF(){this.innerHTML=``}function cF(e){return function(){this.innerHTML=e}}function lF(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function uF(e){return arguments.length?this.each(e==null?sF:(typeof e==`function`?lF:cF)(e)):this.node().innerHTML}function dF(){this.nextSibling&&this.parentNode.appendChild(this)}function fF(){return this.each(dF)}function pF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mF(){return this.each(pF)}function hF(e){var t=typeof e==`function`?e:WN(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function gF(){return null}function _F(e,t){var n=typeof e==`function`?e:WN(e),r=t==null?gF:typeof t==`function`?t:KN(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function vF(){var e=this.parentNode;e&&e.removeChild(this)}function yF(){return this.each(vF)}function bF(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function xF(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function SF(e){return this.select(e?xF:bF)}function CF(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function wF(e){return function(t){e.call(this,t,this.__data__)}}function TF(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function EF(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function DF(e,t,n){return function(){var r=this.__on,i,a=wF(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function OF(e,t,n){var r=TF(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?DF:EF,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function kF(e,t,n){var r=RP(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function AF(e,t){return function(){return kF(this,e,t)}}function jF(e,t){return function(){return kF(this,e,t.apply(this,arguments))}}function MF(e,t){return this.each((typeof t==`function`?jF:AF)(e,t))}function*NF(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var PF=[null];function FF(e,t){this._groups=e,this._parents=t}function IF(){return new FF([[document.documentElement]],PF)}function LF(){return this}FF.prototype=IF.prototype={constructor:FF,select:qN,selectAll:QN,selectChild:iP,selectChildren:cP,filter:lP,data:_P,enter:dP,exit:yP,join:bP,merge:xP,selection:LF,order:SP,sort:CP,call:TP,nodes:EP,node:DP,size:OP,empty:kP,each:AP,attr:LP,style:HP,property:qP,classed:nF,text:oF,html:uF,raise:fF,lower:mF,append:hF,insert:_F,remove:yF,clone:SF,datum:CF,on:OF,dispatch:MF,[Symbol.iterator]:NF};function RF(e){return typeof e==`string`?new FF([[document.querySelector(e)]],[document.documentElement]):new FF([[e]],PF)}function zF(e){let t;for(;t=e.sourceEvent;)e=t;return e}function BF(e,t){if(e=zF(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var VF={passive:!1},HF={capture:!0,passive:!1};function UF(e){e.stopImmediatePropagation()}function WF(e){e.preventDefault(),e.stopImmediatePropagation()}function GF(e){var t=e.document.documentElement,n=RF(e).on(`dragstart.drag`,WF,HF);`onselectstart`in t?n.on(`selectstart.drag`,WF,HF):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function KF(e,t){var n=e.document.documentElement,r=RF(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,WF,HF),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var qF=e=>()=>e;function JF(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}JF.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function YF(e){return!e.ctrlKey&&!e.button}function XF(){return this.parentNode}function ZF(e,t){return t??{x:e.x,y:e.y}}function QF(){return navigator.maxTouchPoints||`ontouchstart`in this}function $F(){var e=YF,t=XF,n=ZF,r=QF,i={},a=FN(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,VF).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(RF(n.view).on(`mousemove.drag`,m,HF).on(`mouseup.drag`,h,HF),GF(n.view),UF(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(WF(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){RF(e.view).on(`mousemove.drag mouseup.drag`,null),KF(e.view,l),WF(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(UF(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(WF(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(UF(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=BF(l||r,t),p,m,h;if((h=n.call(e,new JF(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=BF(l||a,t),_=o;break}u.call(r,e,new JF(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:qF(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:qF(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:qF(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:qF(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function eI(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function tI(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function nI(){}var rI=.7,iI=1/rI,aI=`\\s*([+-]?\\d+)\\s*`,oI=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,sI=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,cI=/^#([0-9a-f]{3,8})$/,lI=RegExp(`^rgb\\(${aI},${aI},${aI}\\)$`),uI=RegExp(`^rgb\\(${sI},${sI},${sI}\\)$`),dI=RegExp(`^rgba\\(${aI},${aI},${aI},${oI}\\)$`),fI=RegExp(`^rgba\\(${sI},${sI},${sI},${oI}\\)$`),pI=RegExp(`^hsl\\(${oI},${sI},${sI}\\)$`),mI=RegExp(`^hsla\\(${oI},${sI},${sI},${oI}\\)$`),hI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};eI(nI,bI,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gI,formatHex:gI,formatHex8:_I,formatHsl:vI,formatRgb:yI,toString:yI});function gI(){return this.rgb().formatHex()}function _I(){return this.rgb().formatHex8()}function vI(){return NI(this).formatHsl()}function yI(){return this.rgb().formatRgb()}function bI(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=cI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xI(t):n===3?new TI(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?SI(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?SI(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=lI.exec(e))?new TI(t[1],t[2],t[3],1):(t=uI.exec(e))?new TI(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dI.exec(e))?SI(t[1],t[2],t[3],t[4]):(t=fI.exec(e))?SI(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=pI.exec(e))?MI(t[1],t[2]/100,t[3]/100,1):(t=mI.exec(e))?MI(t[1],t[2]/100,t[3]/100,t[4]):hI.hasOwnProperty(e)?xI(hI[e]):e===`transparent`?new TI(NaN,NaN,NaN,0):null}function xI(e){return new TI(e>>16&255,e>>8&255,e&255,1)}function SI(e,t,n,r){return r<=0&&(e=t=n=NaN),new TI(e,t,n,r)}function CI(e){return e instanceof nI||(e=bI(e)),e?(e=e.rgb(),new TI(e.r,e.g,e.b,e.opacity)):new TI}function wI(e,t,n,r){return arguments.length===1?CI(e):new TI(e,t,n,r??1)}function TI(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}eI(TI,wI,tI(nI,{brighter(e){return e=e==null?iI:iI**+e,new TI(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rI:rI**+e,new TI(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new TI(AI(this.r),AI(this.g),AI(this.b),kI(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:EI,formatHex:EI,formatHex8:DI,formatRgb:OI,toString:OI}));function EI(){return`#${jI(this.r)}${jI(this.g)}${jI(this.b)}`}function DI(){return`#${jI(this.r)}${jI(this.g)}${jI(this.b)}${jI((isNaN(this.opacity)?1:this.opacity)*255)}`}function OI(){let e=kI(this.opacity);return`${e===1?`rgb(`:`rgba(`}${AI(this.r)}, ${AI(this.g)}, ${AI(this.b)}${e===1?`)`:`, ${e})`}`}function kI(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function AI(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jI(e){return e=AI(e),(e<16?`0`:``)+e.toString(16)}function MI(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new FI(e,t,n,r)}function NI(e){if(e instanceof FI)return new FI(e.h,e.s,e.l,e.opacity);if(e instanceof nI||(e=bI(e)),!e)return new FI;if(e instanceof FI)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new FI(o,s,c,e.opacity)}function PI(e,t,n,r){return arguments.length===1?NI(e):new FI(e,t,n,r??1)}function FI(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}eI(FI,PI,tI(nI,{brighter(e){return e=e==null?iI:iI**+e,new FI(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rI:rI**+e,new FI(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new TI(RI(e>=240?e-240:e+120,i,r),RI(e,i,r),RI(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new FI(II(this.h),LI(this.s),LI(this.l),kI(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=kI(this.opacity);return`${e===1?`hsl(`:`hsla(`}${II(this.h)}, ${LI(this.s)*100}%, ${LI(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function II(e){return e=(e||0)%360,e<0?e+360:e}function LI(e){return Math.max(0,Math.min(1,e||0))}function RI(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var zI=e=>()=>e;function BI(e,t){return function(n){return e+n*t}}function VI(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function HI(e){return(e=+e)==1?UI:function(t,n){return n-t?VI(t,n,e):zI(isNaN(t)?n:t)}}function UI(e,t){var n=t-e;return n?BI(e,n):zI(isNaN(e)?t:e)}var WI=(function e(t){var n=HI(t);function r(e,t){var r=n((e=wI(e)).r,(t=wI(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=UI(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function GI(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function KI(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qI(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=nL(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function JI(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function YI(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function XI(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=nL(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var ZI=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,QI=new RegExp(ZI.source,`g`);function $I(e){return function(){return e}}function eL(e){return function(t){return e(t)+``}}function tL(e,t){var n=ZI.lastIndex=QI.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=ZI.exec(e))&&(i=QI.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:YI(r,i)})),n=QI.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?eL(c[0].x):$I(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function nL(e,t){var n=typeof t,r;return t==null||n===`boolean`?zI(t):(n===`number`?YI:n===`string`?(r=bI(t))?(t=r,WI):tL:t instanceof bI?WI:t instanceof Date?JI:KI(t)?GI:Array.isArray(t)?qI:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?XI:YI)(e,t)}var rL=180/Math.PI,iL={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function aL(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*rL,skewX:Math.atan(c)*rL,scaleX:o,scaleY:s}}var oL;function sL(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?iL:aL(t.a,t.b,t.c,t.d,t.e,t.f)}function cL(e){return e==null||(oL||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),oL.setAttribute(`transform`,e),!(e=oL.transform.baseVal.consolidate()))?iL:(e=e.matrix,aL(e.a,e.b,e.c,e.d,e.e,e.f))}function lL(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:YI(e,i)},{i:c-2,x:YI(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:YI(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:YI(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:YI(e,n)},{i:s-2,x:YI(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var uL=lL(sL,`px, `,`px)`,`deg)`),dL=lL(cL,`, `,`)`,`)`),fL=1e-12;function pL(e){return((e=Math.exp(e))+1/e)/2}function mL(e){return((e=Math.exp(e))-1/e)/2}function hL(e){return((e=Math.exp(2*e))-1)/(e+1)}var gL=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<fL)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=pL(y),c=s/(n*g)*(i*hL(t*r+y)-mL(y));return[a+c*d,o+c*f,s*i/pL(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),_L=0,vL=0,yL=0,bL=1e3,xL,SL,CL=0,wL=0,TL=0,EL=typeof performance==`object`&&performance.now?performance:Date,DL=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function OL(){return wL||=(DL(kL),EL.now()+TL)}function kL(){wL=0}function AL(){this._call=this._time=this._next=null}AL.prototype=jL.prototype={constructor:AL,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?OL():+n)+(t==null?0:+t),!this._next&&SL!==this&&(SL?SL._next=this:xL=this,SL=this),this._call=e,this._time=n,IL()},stop:function(){this._call&&(this._call=null,this._time=1/0,IL())}};function jL(e,t,n){var r=new AL;return r.restart(e,t,n),r}function ML(){OL(),++_L;for(var e=xL,t;e;)(t=wL-e._time)>=0&&e._call.call(void 0,t),e=e._next;--_L}function NL(){wL=(CL=EL.now())+TL,_L=vL=0;try{ML()}finally{_L=0,FL(),wL=0}}function PL(){var e=EL.now(),t=e-CL;t>bL&&(TL-=t,CL=e)}function FL(){for(var e,t=xL,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:xL=n);SL=e,IL(r)}function IL(e){_L||(vL&&=clearTimeout(vL),e-wL>24?(e<1/0&&(vL=setTimeout(NL,e-EL.now()-TL)),yL&&=clearInterval(yL)):(yL||=(CL=EL.now(),setInterval(PL,bL)),_L=1,DL(NL)))}function LL(e,t,n){var r=new AL;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var RL=FN(`start`,`end`,`cancel`,`interrupt`),zL=[];function BL(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;WL(e,n,{name:t,index:r,group:i,on:RL,tween:zL,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function VL(e,t){var n=UL(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function HL(e,t){var n=UL(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function UL(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function WL(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=jL(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return LL(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(LL(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function GL(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function KL(e){return this.each(function(){GL(this,e)})}function qL(e,t){var n,r;return function(){var i=HL(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function JL(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=HL(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function YL(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=UL(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?qL:JL)(n,e,t))}function XL(e,t,n){var r=e._id;return e.each(function(){var e=HL(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return UL(e,r).value[t]}}function ZL(e,t){var n;return(typeof t==`number`?YI:t instanceof bI?WI:(n=bI(t))?(t=n,WI):tL)(e,t)}function QL(e){return function(){this.removeAttribute(e)}}function $L(e){return function(){this.removeAttributeNS(e.space,e.local)}}function eR(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function tR(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function nR(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function rR(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function iR(e,t){var n=VN(e),r=n===`transform`?dL:ZL;return this.attrTween(e,typeof t==`function`?(n.local?rR:nR)(n,r,XL(this,`attr.`+e,t)):t==null?(n.local?$L:QL)(n):(n.local?tR:eR)(n,r,t))}function aR(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function oR(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function sR(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&oR(e,i)),n}return i._value=t,i}function cR(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&aR(e,i)),n}return i._value=t,i}function lR(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=VN(e);return this.tween(n,(r.local?sR:cR)(r,t))}function uR(e,t){return function(){VL(this,e).delay=+t.apply(this,arguments)}}function dR(e,t){return t=+t,function(){VL(this,e).delay=t}}function fR(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?uR:dR)(t,e)):UL(this.node(),t).delay}function pR(e,t){return function(){HL(this,e).duration=+t.apply(this,arguments)}}function mR(e,t){return t=+t,function(){HL(this,e).duration=t}}function hR(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?pR:mR)(t,e)):UL(this.node(),t).duration}function gR(e,t){if(typeof t!=`function`)throw Error();return function(){HL(this,e).ease=t}}function _R(e){var t=this._id;return arguments.length?this.each(gR(t,e)):UL(this.node(),t).ease}function vR(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();HL(this,e).ease=n}}function yR(e){if(typeof e!=`function`)throw Error();return this.each(vR(this._id,e))}function bR(e){typeof e!=`function`&&(e=$N(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new YR(r,this._parents,this._name,this._id)}function xR(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new YR(o,this._parents,this._name,this._id)}function SR(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function CR(e,t,n){var r,i,a=SR(t)?VL:HL;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function wR(e,t){var n=this._id;return arguments.length<2?UL(this.node(),n).on.on(e):this.each(CR(n,e,t))}function TR(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ER(){return this.on(`end.remove`,TR(this._id))}function DR(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=KN(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,BL(l[f],t,n,f,l,UL(u,n)));return new YR(a,this._parents,t,n)}function OR(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=XN(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=UL(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&BL(p,t,n,h,f,m);a.push(f),o.push(u)}return new YR(a,o,t,n)}var kR=IF.prototype.constructor;function AR(){return new kR(this._groups,this._parents)}function jR(e,t){var n,r,i;return function(){var a=UP(this,e),o=(this.style.removeProperty(e),UP(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function MR(e){return function(){this.style.removeProperty(e)}}function NR(e,t,n){var r,i=n+``,a;return function(){var o=UP(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function PR(e,t,n){var r,i,a;return function(){var o=UP(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),UP(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function FR(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=HL(this,e),l=c.on,u=c.value[a]==null?s||=MR(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function IR(e,t,n){var r=(e+=``)==`transform`?uL:ZL;return t==null?this.styleTween(e,jR(e,r)).on(`end.style.`+e,MR(e)):typeof t==`function`?this.styleTween(e,PR(e,r,XL(this,`style.`+e,t))).each(FR(this._id,e)):this.styleTween(e,NR(e,r,t),n).on(`end.style.`+e,null)}function LR(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function RR(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&LR(e,a,n)),r}return a._value=t,a}function zR(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,RR(e,t,n??``))}function BR(e){return function(){this.textContent=e}}function VR(e){return function(){var t=e(this);this.textContent=t??``}}function HR(e){return this.tween(`text`,typeof e==`function`?VR(XL(this,`text`,e)):BR(e==null?``:e+``))}function UR(e){return function(t){this.textContent=e.call(this,t)}}function WR(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&UR(r)),t}return r._value=e,r}function GR(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,WR(e))}function KR(){for(var e=this._name,t=this._id,n=ZR(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=UL(c,t);BL(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new YR(r,this._parents,e,n)}function qR(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=HL(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var JR=0;function YR(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function XR(e){return IF().transition(e)}function ZR(){return++JR}var QR=IF.prototype;YR.prototype=XR.prototype={constructor:YR,select:DR,selectAll:OR,selectChild:QR.selectChild,selectChildren:QR.selectChildren,filter:bR,merge:xR,selection:AR,transition:KR,call:QR.call,nodes:QR.nodes,node:QR.node,size:QR.size,empty:QR.empty,each:QR.each,on:wR,attr:iR,attrTween:lR,style:IR,styleTween:zR,text:HR,textTween:GR,remove:ER,tween:YL,delay:fR,duration:hR,ease:_R,easeVarying:yR,end:qR,[Symbol.iterator]:QR[Symbol.iterator]};function $R(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ez={time:null,delay:0,duration:250,ease:$R};function tz(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function nz(e){var t,n;e instanceof YR?(t=e._id,e=e._name):(t=ZR(),(n=ez).time=OL(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&BL(c,e,t,l,o,n||tz(c,t));return new YR(r,this._parents,e,t)}IF.prototype.interrupt=KL,IF.prototype.transition=nz;var rz=e=>()=>e;function iz(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function az(e,t,n){this.k=e,this.x=t,this.y=n}az.prototype={constructor:az,scale:function(e){return e===1?this:new az(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new az(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var oz=new az(1,0,0);sz.prototype=az.prototype;function sz(e){for(;!e.__zoom;)if(!(e=e.parentNode))return oz;return e.__zoom}function cz(e){e.stopImmediatePropagation()}function lz(e){e.preventDefault(),e.stopImmediatePropagation()}function uz(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function dz(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function fz(){return this.__zoom||oz}function pz(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mz(){return navigator.maxTouchPoints||`ontouchstart`in this}function hz(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function gz(){var e=uz,t=dz,n=hz,r=pz,i=mz,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=gL,l=FN(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,fz).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,fz),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(oz.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new az(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new az(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new az(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=RF(this.that).datum();l.call(e,this.that,new iz(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=BF(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],GL(this),s.start();lz(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=RF(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=BF(t,i),l=t.clientX,u=t.clientY;GF(t.view),cz(t),a.mouse=[c,this.__zoom.invert(c)],GL(this),a.start();function d(e){if(lz(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=BF(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),KF(e.view,a.moved),lz(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=BF(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);lz(r),s>0?RF(this).transition().duration(s).call(x,d,c,r):RF(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(cz(t),s=0;s<i;++s)c=r[s],l=BF(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),GL(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(lz(e),s=0;s<a;++s)c=i[s],l=BF(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(cz(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=BF(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=RF(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:rz(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:rz(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:rz(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:rz([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var _z={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},vz=[[-1/0,-1/0],[1/0,1/0]],yz=[`Enter`,` `,`Escape`],bz={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},xz;(function(e){e.Strict=`strict`,e.Loose=`loose`})(xz||={});var Sz;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Sz||={});var Cz;(function(e){e.Partial=`partial`,e.Full=`full`})(Cz||={});var wz={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Tz;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Tz||={});var Ez;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Ez||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var Dz={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function Oz(e){return e===null?null:e?`valid`:`invalid`}var kz=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,Az=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),jz=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Mz=(e,t=[0,0])=>{let{width:n,height:r}=fB(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Nz=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:Jz(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):jz(n)?n:t.nodeLookup.get(n.id)),Kz(e,i?Xz(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Pz=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Kz(n,Xz(e)),r=!0)}),r?Jz(n):{x:0,y:0,width:0,height:0}},Fz=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Qz(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Iz=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Lz(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=fB(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Rz({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=lB(Pz(Lz(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function zz({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,_z.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&dB(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=dB(d)?Hz(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,_z.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function Bz({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Iz(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var Vz=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Hz=(e={x:0,y:0},t,n)=>({x:Vz(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Vz(e.y,t[0][1],t[1][1]-(n?.height??0))});function Uz(e,t,n){let{width:r,height:i}=fB(n),{x:a,y:o}=n.internals.positionAbsolute;return Hz(e,[[a,o],[a+r,o+i]],t)}var Wz=(e,t,n)=>e<t?Vz(Math.abs(e-t),1,t)/t:e>n?-Vz(Math.abs(e-n),1,t)/t:0,Gz=(e,t,n=15,r=40)=>[Wz(e.x,r,t.width-r)*n,Wz(e.y,r,t.height-r)*n],Kz=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),qz=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Jz=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Yz=(e,t=[0,0])=>{let{x:n,y:r}=jz(e)?e.internals.positionAbsolute:Mz(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Xz=(e,t=[0,0])=>{let{x:n,y:r}=jz(e)?e.internals.positionAbsolute:Mz(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Zz=(e,t)=>Jz(Kz(qz(e),qz(t))),Qz=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},$z=(e,t)=>Qz(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),eB=e=>tB(e.width)&&tB(e.height)&&tB(e.x)&&tB(e.y),tB=e=>!isNaN(e)&&isFinite(e),nB=(e,t)=>(e,t)=>{},rB=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),iB=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?rB(s,o):s},aB=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function oB(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function sB(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=oB(e,n),i=oB(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=oB(e.top??e.y??0,n),i=oB(e.bottom??e.y??0,n),a=oB(e.left??e.x??0,t),o=oB(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function cB(e,t,n,r,i,a){let{x:o,y:s}=aB(e,[t,n,r]),{x:c,y:l}=aB({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var lB=(e,t,n,r,i,a)=>{let o=sB(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=Vz(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=cB(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},uB=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function dB(e){return e!=null&&e!==`parent`}function fB(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function pB(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function mB(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function hB(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function gB(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function _B(e){return{...bz,...e||{}}}function vB(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=wB(e),s=iB({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?rB(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var yB=e=>({width:e.offsetWidth,height:e.offsetHeight}),bB=e=>e?.getRootNode?.()||window?.document,xB=[`INPUT`,`SELECT`,`TEXTAREA`];function SB(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?xB.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var CB=e=>`clientX`in e,wB=(e,t)=>{let n=CB(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},TB=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...yB(t)}})};function EB({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function DB(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function OB({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-DB(t-r,a),n];case $.Right:return[t+DB(r-t,a),n];case $.Top:return[t,n-DB(n-i,a)];case $.Bottom:return[t,n+DB(i-n,a)]}}function kB({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=OB({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=OB({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=EB({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function AB({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function jB({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function MB({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Kz(Xz(e),Xz(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),$z({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Jz(a))>0}var NB=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,PB=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),FB=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,_z.error006()),t;let r=n.getEdgeId||NB,i;return i=kz(e)?{...e}:{...e,id:r(e)},PB(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function IB({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=AB({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var LB={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},RB=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},zB=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function BB({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=LB[t],c=LB[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=RB({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=AB({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function VB(e,t,n,r){let i=Math.min(zB(e,t)/2,zB(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function HB({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=BB({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=VB(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function UB(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function WB(e){let{sourceNode:t,targetNode:n}=e;if(!UB(t)||!UB(n))return null;let r=t.internals.handleBounds||GB(t.handles),i=n.internals.handleBounds||GB(n.handles),a=qB(r?.source??[],e.sourceHandle),o=qB(e.connectionMode===xz.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,_z.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=KB(t,a,s),u=KB(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function GB(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function KB(e,t,n=$.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??fB(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function qB(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function JB(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function YB(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=JB(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var XB=1e3,ZB=10,QB={nodeOrigin:[0,0],nodeExtent:vz,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},$B={...QB,checkEquality:!0};function eV(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function tV(e,t,n){let r=eV(QB,n);for(let n of e.values())if(n.parentId)oV(n,e,t,r);else{let e=Hz(Mz(n,r.nodeOrigin),dB(n.extent)?n.extent:r.nodeExtent,fB(n));n.internals.positionAbsolute=e}}function nV(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function rV(e){return e===`manual`}function iV(e,t,n,r={}){let i=eV($B,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!rV(i.zIndexMode)?XB:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=Hz(Mz(u,i.nodeOrigin),dB(u.extent)?u.extent:i.nodeExtent,fB(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:nV(u,e),z:sV(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&oV(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function aV(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function oV(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=eV(QB,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}aV(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*ZB),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=cV(e,u,o,s,a&&!rV(c)?XB:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function sV(e,t,n){let r=tB(e.zIndex)?e.zIndex:0;return rV(n)?r:r+(e.selected?t:0)}function cV(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=fB(e),l=Mz(e,n),u=dB(e.extent)?Hz(l,e.extent,c):l,d=Hz({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Uz(d,c,t));let f=sV(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function lV(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Zz(a.get(n.parentId)?.expandedRect??Yz(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=fB(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function uV(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=yB(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=dB(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=Uz(h,s,n))}else m&&(h=Hz(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:TB(`source`,r.nodeElement,p,d,e.id),target:TB(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&oV(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Yz(g,i)}))}}if(f.length>0){let e=lV(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function dV({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function fV(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function pV(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;fV(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),fV(`target`,s,c,e,i,o),t.set(r.id,r)}}function mV(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:mV(n,t):!1}function hV(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function gV(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!mV(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function _V({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function vV({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=rB(a,t);return{x:o.x-a.x,y:o.y-a.y}}function yV({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=RF(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?qz(Pz(s)):null,x=v&&l?vV({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:rB(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=zz({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=_V({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Gz(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=vB(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=gV(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=_V({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=$F().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=vB(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=wB(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=vB(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=wB(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=wB(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=_V({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!hV(t,`.${g}`,v))&&(!_||hV(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function bV(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())$z(i,Yz(e))>0&&r.push(e);return r}var xV=250;function SV(e,t,n,r){let i=[],a=1/0,o=bV(e,n,t+xV);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=KB(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function CV(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...KB(o,c,c.position,!0)}:c}function wV(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function TV(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var EV=()=>!0;function DV(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=EV,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=bB(e.target),E=0,D,{x:O,y:k}=wB(e),A=wV(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=CV(i,A,r,c,t);if(!N)return;let P=wB(e,j),F=!1,I=null,L=!1,ee=null;function te(){if(!u||!j)return;let[e,t]=Gz(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let ne={...N,nodeId:i,type:A,position:N.position},re=c.get(i),ie={inProgress:!0,isValid:null,from:KB(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:P,toHandle:null,toPosition:Dz[ne.position],toNode:null,pointer:P};function ae(){M=!0,y(ie),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ae();function oe(e){if(!M){let{x:t,y:n}=wB(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ae()}if(!x()||!ne){se(e);return}let a=b();P=wB(e,j),D=SV(iB(P,a,!1,[1,1]),n,c,ne),F||=(te(),!0);let s=OV(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});ee=s.handleDomNode,I=s.connection,L=TV(!!D,s.isValid);let u=c.get(i),f=u?KB(u,ne,$.Left,!0):ie.from,p={...ie,from:f,isValid:L,to:s.toHandle&&L?aB({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:Dz[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),ie=p}function se(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||ee)&&I&&L&&h?.(I);let{inProgress:t,...n}=ie,r={...n,toPosition:ie.toHandle?ie.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,ee=null,T.removeEventListener(`mousemove`,oe),T.removeEventListener(`mouseup`,se),T.removeEventListener(`touchmove`,oe),T.removeEventListener(`touchend`,se)}}T.addEventListener(`mousemove`,oe),T.addEventListener(`mouseup`,se),T.addEventListener(`touchmove`,oe),T.addEventListener(`touchend`,se)}function OV(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=EV,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=wB(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=wV(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===xz.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=CV(t,e,a,u,n,!0)}return _}var kV={onPointerDown:DV,isValid:OV};function AV({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=RF(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&uB()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=gz().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:BF}}var jV=e=>({x:e.x,y:e.y,zoom:e.k}),MV=({x:e,y:t,zoom:n})=>oz.translate(e,t).scale(n),NV=(e,t)=>e.target.closest(`.${t}`),PV=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),FV=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,IV=(e,t=0,n=FV,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},LV=e=>{let t=e.ctrlKey&&uB()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function RV({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(NV(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=BF(u),t=d*2**LV(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Sz.Vertical?0:u.deltaX*f,m=i===Sz.Horizontal?0:u.deltaY*f;!uB()&&u.shiftKey&&i!==Sz.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=jV(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function zV({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=NV(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function BV({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=jV(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function VV({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&PV(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,jV(a.transform))}}function HV({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&PV(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=jV(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function UV({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(NV(d,`${l}-flow__node`)||NV(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||NV(d,s)&&m||NV(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function WV({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=gz().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=RF(e).call(f);y({x:i.x,y:i.y,zoom:Vz(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(LV);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?nL:gL).transform(IV(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!tB(E)||E<0?0:E);let k=O?RV({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):zV({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=BV({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=VV({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=HV({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=UV({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=MV(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=MV(e);return await g(n,t),n}function x(e){if(p){let t=MV(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?sz(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?nL:gL).scaleTo(IV(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?nL:gL).scaleBy(IV(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!tB(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var GV;(function(e){e.Line=`line`,e.Handle=`handle`})(GV||={});function KV({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function qV(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function JV(e,t){return Math.max(0,t-e)}function YV(e,t){return Math.max(0,e-t)}function XV(e,t,n){return Math.max(0,t-e,e-n)}function ZV(e,t){return e?!t:t}function QV(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=XV(E,h,g),j=XV(D,_,v);if(o){let e=0,t=0;c&&w<0?e=JV(y+w+O,o[0][0]):!c&&w>0&&(e=YV(y+E+O,o[1][0])),l&&T<0?t=JV(b+T+k,o[0][1]):!l&&T>0&&(t=YV(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=YV(y+w,s[0][0]):!c&&w<0&&(e=JV(y+E,s[1][0])),l&&T>0?t=YV(b+T,s[0][1]):!l&&T<0&&(t=JV(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=XV(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?YV(b+k+E/C,o[1][1])*C:JV(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?JV(b+E/C,s[1][1])*C:YV(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=XV(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?YV(y+D*C+O,o[1][0])/C:JV(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?JV(y+D*C,s[1][0])/C:YV(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(ZV(c,l)?-w:w)/C:w=(ZV(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var $V={width:0,height:0,x:0,y:0},eH={...$V,pointerX:0,pointerY:0,aspectRatio:1};function tH(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function nH({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=RF(e),o={controlDirection:qV(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...$V},h={...eH};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:qV(e)};let g,_=null,v=[],y,b,x,S=!1,C=$F().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=vB(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=dB(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=tH(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=vB(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=QV(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=KV({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var rH=P((e=>{var t=M();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})),iH=P(((e,t)=>{t.exports=rH()})),aH=P((e=>{var t=M(),n=iH();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}})),oH=pe(P(((e,t)=>{t.exports=aH()}))(),1),sH=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},cH=e=>e?sH(e):sH,{useDebugValue:lH}=R.default,{useSyncExternalStoreWithSelector:uH}=oH.default,dH=e=>e;function fH(e,t=dH,n){let r=uH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return lH(r),r}var pH=(e,t)=>{let n=cH(e),r=(e,r=t)=>fH(n,e,r);return Object.assign(r,n),r},mH=(e,t)=>e?pH(e,t):pH;function hH(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var gH=(0,R.createContext)(null),_H=gH.Provider,vH=_z.error001(`react`);function yH(e,t){let n=(0,R.useContext)(gH);if(n===null)throw Error(vH);return fH(n,e,t)}function bH(){let e=(0,R.useContext)(gH);if(e===null)throw Error(vH);return(0,R.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var xH={display:`none`},SH={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},CH=`react-flow__node-desc`,wH=`react-flow__edge-desc`,TH=`react-flow__aria-live`,EH=e=>e.ariaLiveMessage,DH=e=>e.ariaLabelConfig;function OH({rfId:e}){let t=yH(EH);return(0,z.jsx)(`div`,{id:`${TH}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:SH,children:t})}function kH({rfId:e,disableKeyboardA11y:t}){let n=yH(DH);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{id:`${CH}-${e}`,style:xH,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,z.jsx)(`div`,{id:`${wH}-${e}`,style:xH,children:n[`edge.a11yDescription.default`]}),!t&&(0,z.jsx)(OH,{rfId:e})]})}var AH=(0,R.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,z.jsx)(`div`,{className:NN([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));AH.displayName=`Panel`;var jH=`https://reactflow.dev?utm_source=attribution`;function MH({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,z.jsx)(AH,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${jH}`,children:(0,z.jsx)(`a`,{href:jH,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var NH=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},PH=e=>e.id;function FH(e,t){return hH(e.selectedNodes.map(PH),t.selectedNodes.map(PH))&&hH(e.selectedEdges.map(PH),t.selectedEdges.map(PH))}function IH({onSelectionChange:e}){let t=bH(),{selectedNodes:n,selectedEdges:r}=yH(NH,FH);return(0,R.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var LH=e=>!!e.onSelectionChangeHandlers;function RH({onSelectionChange:e}){let t=yH(LH);return e||t?(0,z.jsx)(IH,{onSelectionChange:e}):null}var zH=[0,0],BH={x:0,y:0,zoom:1},VH=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],HH=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),UH={translateExtent:vz,nodeOrigin:zH,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function WH(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=yH(HH,hH),l=bH();(0,R.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=UH,s()}),[]);let u=(0,R.useRef)(UH);return(0,R.useEffect)(()=>{for(let s of VH){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:_B(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},VH.map(t=>e[t])),null}function GH(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function KH(e){let[t,n]=(0,R.useState)(e===`system`?null:e);return(0,R.useEffect)(()=>{if(e!==`system`){n(e);return}let t=GH(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?GH()?.matches?`dark`:`light`:t}var qH=typeof document<`u`?document:null;function JH(e=null,t={target:qH,actInsideInputWithModifier:!0}){let[n,r]=(0,R.useState)(!1),i=(0,R.useRef)(!1),a=(0,R.useRef)(new Set([])),[o,s]=(0,R.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
82
|
-
`).replace(`
|
|
83
|
-
|
|
84
|
-
`,`
|
|
85
|
-
+`).split(`
|
|
86
|
-
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,R.useEffect)(()=>{let n=t?.target??qH,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&SB(e))return!1;let n=XH(e.code,s);if(a.current.add(e[n]),YH(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=XH(e.code,s);YH(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function YH(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function XH(e,t){return t.includes(e)?`code`:`key`}var ZH=()=>{let e=bH();return(0,R.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=lB(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return iB(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=aB(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function QH(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)$H(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function $H(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function eU(e,t){return QH(e,t)}function tU(e,t){return QH(e,t)}function nU(e,t){return{id:e,type:`select`,selected:t}}function rU(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(nU(a.id,e)))}return r}function iU({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function aU(e){return{id:e.id,type:`remove`}}var oU=nB(`React Flow`,`https://reactflow.dev/`);function sU(e,t,n={}){return FB(e,t,{...n,onError:n.onError??oU})}var cU=e=>Az(e),lU=e=>kz(e);function uU(e){return(0,R.forwardRef)(e)}var dU=typeof window<`u`?R.useLayoutEffect:R.useEffect;function fU(e){let[t,n]=(0,R.useState)(BigInt(0)),[r]=(0,R.useState)(()=>pU(()=>n(e=>e+BigInt(1))));return dU(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function pU(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var mU=(0,R.createContext)(null);function hU({children:e}){let t=bH(),n=fU((0,R.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=iU({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=fU((0,R.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(iU({items:s,lookup:o}))},[])),i=(0,R.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,z.jsx)(mU.Provider,{value:i,children:e})}function gU(){let e=(0,R.useContext)(mU);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var _U=e=>!!e.panZoom;function vU(){let e=ZH(),t=bH(),n=gU(),r=yH(_U),i=(0,R.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=cU(e)?e:n.get(e.id),a=i.parentId?mB(i.position,i.measured,i.parentId,n,r):i.position;return Yz({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&cU(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&lU(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await Bz({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(aU);o?.(f),c(e)}if(m){let e=d.map(aU);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=eB(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=Yz(s?r:a),l=$z(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=eB(e)?e:a(e);if(!r)return!1;let i=$z(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Nz(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??gB();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,R.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var yU=e=>e.selected,bU=typeof window<`u`?window:void 0;function xU({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=bH(),{deleteElements:r}=vU(),i=JH(e,{actInsideInputWithModifier:!1}),a=JH(t,{target:bU});(0,R.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(yU),edges:e.filter(yU)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,R.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function SU(e){let t=bH();(0,R.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=yB(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,_z.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var CU={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},wU=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function TU({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Sz.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=bH(),S=(0,R.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=yH(wU,hH),E=JH(f),D=(0,R.useRef)();SU(S);let O=(0,R.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,R.useEffect)(()=>{if(S.current){D.current=WV({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,R.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,z.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:CU,children:m})}var EU=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function DU(){let{userSelectionActive:e,userSelectionRect:t}=yH(EU,hH);return e&&t?(0,z.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var OU=(e,t)=>n=>{n.target===t.current&&e?.(n)},kU=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function AU({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Cz.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,R.useRef)(0),_=bH(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=yH(kU,hH),C=y&&(e||v),w=(0,R.useRef)(null),T=(0,R.useRef)(),E=(0,R.useRef)(new Set),D=(0,R.useRef)(new Set),O=(0,R.useRef)(!1),k=(0,R.useRef)(!1),A=(0,R.useRef)({x:0,y:0}),j=(0,R.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=wB(n.nativeEvent,T.current),l=iB({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=aB(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(Fz(a,m,i,n===Cz.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}hB(h,E.current)||c(rU(a,E.current,!0)),hB(g,D.current)||l(rU(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function ee(){if(!i||!T.current)return;let[e,t]=Gz(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(ee);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(ee)})}let te=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,R.useEffect)(()=>()=>te(),[]),(0,z.jsxs)(`div`,{className:NN([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:OU(M,w),onContextMenu:OU(N,w),onWheel:OU(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=wB(e.nativeEvent,T.current);A.current={x:o,y:c};let l=aB({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(ee(),!0),L(o,c)}:p,onPointerUp:e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),te())},onPointerCancel:C?e=>{e.target?.releasePointerCapture?.(e.pointerId),te()}:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:CU,children:[h,(0,z.jsx)(DU,{})]})}function jU({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,_z.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function MU({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=bH(),[c,l]=(0,R.useState)(!1),u=(0,R.useRef)();return(0,R.useEffect)(()=>{if(!t)return u.current=yV({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{jU({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,R.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var NU=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function PU(){let e=bH();return(0,R.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=NU(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=rB(t,i));let{position:a,positionAbsolute:s}=zz({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var FU=(0,R.createContext)(null),IU=FU.Provider;FU.Consumer;var LU=()=>(0,R.useContext)(FU),RU=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),zU=(0,R.createContext)(null);function BU({children:e}){let t=yH(RU,hH);return(0,z.jsx)(zU.Provider,{value:t,children:e})}function VU(){let e=(0,R.useContext)(zU);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var HU={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},UU=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return HU;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===xz.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function WU({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=bH(),_=LU(),{connectOnClick:v,noPanClassName:y,rfId:b}=VU(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=yH(UU(_,m,e),hH);_||g.getState().onError?.(`010`,_z.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(sU(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=CB(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();kV.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,z.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:NN([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=bB(t.target),h=n||c,{connection:v,isValid:y}=kV.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var GU=(0,R.memo)(uU(WU));function KU({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,z.jsxs)(z.Fragment,{children:[e?.label,(0,z.jsx)(GU,{type:`source`,position:n,isConnectable:t})]})}function qU({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(GU,{type:`target`,position:n,isConnectable:t}),e?.label,(0,z.jsx)(GU,{type:`source`,position:r,isConnectable:t})]})}function JU(){return null}function YU({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(GU,{type:`target`,position:n,isConnectable:t}),e?.label]})}var XU={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ZU={input:KU,default:qU,output:YU,group:JU};function QU(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var $U=e=>{let{width:t,height:n,x:r,y:i}=Pz(e.nodeLookup,{filter:e=>!!e.selected});return{width:tB(t)?t:null,height:tB(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function eW({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=bH(),{width:i,height:a,transformString:o,userSelectionActive:s}=yH($U,hH),c=PU(),l=(0,R.useRef)(null);(0,R.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(MU({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,z.jsx)(`div`,{className:NN([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,z.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(XU,e.key)&&(e.preventDefault(),c({direction:XU[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var tW=typeof window<`u`?window:void 0,nW=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function rW({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:ee}=yH(nW,hH),te=JH(l,{target:tW}),ne=JH(h,{target:tW}),re=ne||w,ie=ne||b,ae=u&&re!==!0,oe=te||ee||ae;return xU({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,z.jsx)(TU,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:ie,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&re,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:ae,children:(0,z.jsxs)(AU,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:re,autoPanOnSelection:T,isSelecting:!!oe,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:ae,children:[e,L&&(0,z.jsx)(eW,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}rW.displayName=`FlowRenderer`;var iW=(0,R.memo)(rW),aW=e=>t=>e?Fz(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function oW(e){return yH((0,R.useCallback)(aW(e),[e]),hH)}var sW=e=>e.updateNodeInternals;function cW(){let e=yH(sW),[t]=(0,R.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,R.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function lW({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=bH(),a=(0,R.useRef)(null),o=(0,R.useRef)(null),s=(0,R.useRef)(e.sourcePosition),c=(0,R.useRef)(e.targetPosition),l=(0,R.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,R.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,R.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,R.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function uW({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=yH(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},hH),S=y.type||`default`,C=g?.[S]||ZU[S];C===void 0&&(v?.(`003`,_z.error003(S)),S=`default`,C=g?.default||ZU.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=bH(),k=pB(y),A=lW({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=MU({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=PU();if(y.hidden)return null;let N=fB(y),P=QU(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,ee=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,ne=o?e=>o(e,{...b.userNode}):void 0,re=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&jU({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},ie=t=>{if(!(SB(t.nativeEvent)||m)){if(yz.includes(t.key)&&T){let n=t.key===`Escape`;jU({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(XU,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:XU[t.key],factor:t.shiftKey?4:1})}}},ae=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Fz(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,z.jsx)(`div`,{className:NN([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:ee,onContextMenu:te,onClick:re,onDoubleClick:ne,onKeyDown:D?ie:void 0,tabIndex:D?0:void 0,onFocus:D?ae:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${CH}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,z.jsx)(IU,{value:e,children:(0,z.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var dW=(0,R.memo)(uW),fW=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function pW(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=yH(fW,hH),a=oW(e.onlyRenderVisibleElements),o=cW();return(0,z.jsx)(`div`,{className:`react-flow__nodes`,style:CU,children:a.map(a=>(0,z.jsx)(dW,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}pW.displayName=`NodeRenderer`;var mW=(0,R.memo)(pW);function hW(e){return yH((0,R.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&MB({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),hH)}var gW=({color:e=`none`,strokeWidth:t=1})=>(0,z.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),_W=({color:e=`none`,strokeWidth:t=1})=>(0,z.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),vW={[Ez.Arrow]:gW,[Ez.ArrowClosed]:_W};function yW(e){let t=bH();return(0,R.useMemo)(()=>Object.prototype.hasOwnProperty.call(vW,e)?vW[e]:(t.getState().onError?.(`009`,_z.error009(e)),null),[e])}var bW=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=yW(t);return c?(0,z.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,z.jsx)(c,{color:n,strokeWidth:o})}):null},xW=({defaultColor:e,rfId:t})=>{let n=yH(e=>e.edges),r=yH(e=>e.defaultEdgeOptions),i=(0,R.useMemo)(()=>YB(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,z.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,z.jsx)(`defs`,{children:i.map(e=>(0,z.jsx)(bW,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};xW.displayName=`MarkerDefinitions`;var SW=(0,R.memo)(xW);function CW({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,R.useState)({x:1,y:0,width:0,height:0}),p=NN([`react-flow__edge-textwrapper`,l]),m=(0,R.useRef)(null);return(0,R.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,z.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,z.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,z.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}CW.displayName=`EdgeText`;var wW=(0,R.memo)(CW);function TW({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{...u,d:e,fill:`none`,className:NN([`react-flow__edge-path`,u.className])}),l?(0,z.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&tB(t)&&tB(n)?(0,z.jsx)(wW,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function EW({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function DW({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=EW({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=EW({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=EB({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function OW(e){return(0,R.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=DW({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,z.jsx)(TW,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var kW=OW({isInternal:!1}),AW=OW({isInternal:!0});kW.displayName=`SimpleBezierEdge`,AW.displayName=`SimpleBezierEdgeInternal`;function jW(e){return(0,R.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=HB({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,z.jsx)(TW,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var MW=jW({isInternal:!1}),NW=jW({isInternal:!0});MW.displayName=`SmoothStepEdge`,NW.displayName=`SmoothStepEdgeInternal`;function PW(e){return(0,R.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,z.jsx)(MW,{...n,id:r,pathOptions:(0,R.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var FW=PW({isInternal:!1}),IW=PW({isInternal:!0});FW.displayName=`StepEdge`,IW.displayName=`StepEdgeInternal`;function LW(e){return(0,R.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=IB({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,z.jsx)(TW,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var RW=LW({isInternal:!1}),zW=LW({isInternal:!0});RW.displayName=`StraightEdge`,zW.displayName=`StraightEdgeInternal`;function BW(e){return(0,R.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=kB({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,z.jsx)(TW,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var VW=BW({isInternal:!1}),HW=BW({isInternal:!0});VW.displayName=`BezierEdge`,HW.displayName=`BezierEdgeInternal`;var UW={default:HW,straight:zW,step:IW,smoothstep:NW,simplebezier:AW},WW={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},GW=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,KW=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,qW=`react-flow__edgeupdater`;function JW({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,z.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:NN([qW,`${qW}-${s}`]),cx:GW(t,r,e),cy:KW(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function YW({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=bH(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;kV.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,z.jsxs)(z.Fragment,{children:[(e===!0||e===`source`)&&(0,z.jsx)(JW,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,z.jsx)(JW,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function XW({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=yH(t=>t.edgeLookup.get(e)),b=yH(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||UW[x];S===void 0&&(_?.(`011`,_z.error011(x)),x=`default`,S=h?.default||UW.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,R.useRef)(null),[D,O]=(0,R.useState)(!1),[k,A]=(0,R.useState)(!1),j=bH(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee}=yH((0,R.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return WW;let i=WB({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=jB({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||WW,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),hH),te=(0,R.useMemo)(()=>y.markerStart?`url('#${JB(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,R.useMemo)(()=>y.markerEnd?`url('#${JB(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let re=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},ie=a?e=>{a(e,{...y})}:void 0,ae=o?e=>{o(e,{...y})}:void 0,oe=s?e=>{s(e,{...y})}:void 0,se=c?e=>{c(e,{...y})}:void 0,ce=l?e=>{l(e,{...y})}:void 0;return(0,z.jsx)(`svg`,{style:{zIndex:M},children:(0,z.jsxs)(`g`,{className:NN([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:re,onDoubleClick:ie,onContextMenu:ae,onMouseEnter:oe,onMouseMove:se,onMouseLeave:ce,onKeyDown:C?t=>{if(!v&&yz.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${wH}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,z.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:te,markerEnd:ne,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,z.jsx)(YW,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee,setUpdateHover:O,setReconnecting:A})]})})}var ZW=(0,R.memo)(XW),QW=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function $W({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=yH(QW,hH),b=hW(t);return(0,z.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,z.jsx)(SW,{defaultColor:e,rfId:n}),b.map(e=>(0,z.jsx)(ZW,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}$W.displayName=`EdgeRenderer`;var eG=(0,R.memo)($W),tG=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function nG({children:e}){let t=bH(),n=(0,R.useRef)(null),[r]=(0,R.useState)(()=>t.getState().transform);return dU(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=tG(r)))};return r(),t.subscribe(r)},[t]),(0,z.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:tG(r)},children:e})}function rG(e){let t=vU(),n=(0,R.useRef)(!1);(0,R.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var iG=e=>e.panZoom?.syncViewport;function aG(e){let t=yH(iG),n=bH();return(0,R.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function oG(e){return e.connection.inProgress?{...e.connection,to:iB(e.connection.to,e.transform)}:{...e.connection}}function sG(e){return e?t=>e(oG(t)):oG}function cG(e){return yH(sG(e),hH)}var lG=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function uG({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=yH(lG,hH);return a&&i&&c?(0,z.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,z.jsx)(`g`,{className:NN([`react-flow__connection`,Oz(s)]),children:(0,z.jsx)(dG,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var dG=({style:e,type:t=Tz.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=cG();if(!i)return;if(n)return(0,z.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Oz(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Tz.Bezier:[m]=kB(h);break;case Tz.SimpleBezier:[m]=DW(h);break;case Tz.Step:[m]=HB({...h,borderRadius:0});break;case Tz.SmoothStep:[m]=HB(h);break;default:[m]=IB(h)}return(0,z.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};dG.displayName=`ConnectionLine`;var fG={};function pG(e=fG){(0,R.useRef)(e),bH(),(0,R.useEffect)(()=>{},[e])}function mG(){bH(),(0,R.useRef)(!1),(0,R.useEffect)(()=>{},[])}function hG({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:ee,panOnDrag:te,autoPanOnSelection:ne,onPaneClick:re,onPaneMouseEnter:ie,onPaneMouseMove:ae,onPaneMouseLeave:oe,onPaneScroll:se,onPaneContextMenu:ce,paneClickDistance:le,nodeClickDistance:ue,onEdgeContextMenu:de,onEdgeMouseEnter:fe,onEdgeMouseMove:pe,onEdgeMouseLeave:me,reconnectRadius:he,onReconnect:ge,onReconnectStart:_e,onReconnectEnd:ve,noDragClassName:ye,noWheelClassName:be,noPanClassName:xe,disableKeyboardA11y:Se,nodeExtent:Ce,rfId:we,viewport:Te,onViewportChange:Ee,nodesDraggable:De}){return pG(e),pG(t),mG(),rG(n),aG(Te),(0,z.jsx)(iW,{onPaneClick:re,onPaneMouseEnter:ie,onPaneMouseMove:ae,onPaneMouseLeave:oe,onPaneContextMenu:ce,onPaneScroll:se,paneClickDistance:le,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:ee,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:te,autoPanOnSelection:ne,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ye,noWheelClassName:be,noPanClassName:xe,disableKeyboardA11y:Se,onViewportChange:Ee,isControlledViewport:!!Te,children:(0,z.jsxs)(nG,{children:[(0,z.jsx)(eG,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ge,onReconnectStart:_e,onReconnectEnd:ve,onlyRenderVisibleElements:T,onEdgeContextMenu:de,onEdgeMouseEnter:fe,onEdgeMouseMove:pe,onEdgeMouseLeave:me,reconnectRadius:he,defaultMarkerColor:M,noPanClassName:xe,disableKeyboardA11y:Se,rfId:we}),(0,z.jsx)(uG,{style:h,type:m,component:g,containerStyle:_}),(0,z.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,z.jsx)(mW,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ue,onlyRenderVisibleElements:T,noPanClassName:xe,noDragClassName:ye,disableKeyboardA11y:Se,nodeExtent:Ce,rfId:we,nodesDraggable:De}),(0,z.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}hG.displayName=`GraphView`;var gG=(0,R.memo)(hG),_G=nB(`React Flow`,`https://reactflow.dev/`),vG=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??vz;pV(h,g,_);let{nodesInitialized:x}=iV(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=lB(Pz(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:vz,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:xz.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...wz},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:_G,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:bz,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},yG=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>mH((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Rz({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...vG({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=iV(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();pV(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=uV(e,n,r,i,a,o,l);d&&(tV(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=KB(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=lV(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(eU(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(tU(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>nU(e,!0)));return}i(rU(r,new Set([...e]),!0)),a(rU(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>nU(e,!0)));return}a(rU(n,new Set([...e]))),i(rU(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(nU(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(nU(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,nU(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,nU(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(iV(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return dV({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...wz}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...vG()})}},Object.is);function bG({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,R.useState)(()=>yG({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,z.jsx)(_H,{value:m,children:(0,z.jsx)(hU,{children:(0,z.jsx)(BU,{children:p})})})}function xG({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,R.useContext)(gH)?(0,z.jsx)(z.Fragment,{children:e}):(0,z.jsx)(bG,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var SG={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function CG({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:ee=Tz.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:ie=`Backspace`,selectionKeyCode:ae=`Shift`,selectionOnDrag:oe=!1,selectionMode:se=Cz.Full,panActivationKeyCode:ce=`Space`,multiSelectionKeyCode:le=uB()?`Meta`:`Control`,zoomActivationKeyCode:ue=uB()?`Meta`:`Control`,snapToGrid:de,snapGrid:fe,onlyRenderVisibleElements:pe=!1,selectNodesOnDrag:me,nodesDraggable:he,autoPanOnNodeFocus:ge,nodesConnectable:_e,nodesFocusable:ve,nodeOrigin:ye=zH,edgesFocusable:be,edgesReconnectable:xe,elementsSelectable:Se=!0,defaultViewport:Ce=BH,minZoom:we=.5,maxZoom:Te=2,translateExtent:Ee=vz,preventScrolling:De=!0,nodeExtent:Oe,defaultMarkerColor:ke=`#b1b1b7`,zoomOnScroll:Ae=!0,zoomOnPinch:je=!0,panOnScroll:Me=!1,panOnScrollSpeed:Ne=.5,panOnScrollMode:Pe=Sz.Free,zoomOnDoubleClick:Fe=!0,panOnDrag:Ie=!0,onPaneClick:Le,onPaneMouseEnter:Re,onPaneMouseMove:ze,onPaneMouseLeave:Be,onPaneScroll:Ve,onPaneContextMenu:He,paneClickDistance:Ue=1,nodeClickDistance:We=0,children:Ge,onReconnect:Ke,onReconnectStart:qe,onReconnectEnd:Je,onEdgeContextMenu:Ye,onEdgeDoubleClick:Xe,onEdgeMouseEnter:Ze,onEdgeMouseMove:Qe,onEdgeMouseLeave:$e,reconnectRadius:et=10,onNodesChange:tt,onEdgesChange:nt,noDragClassName:rt=`nodrag`,noWheelClassName:it=`nowheel`,noPanClassName:at=`nopan`,fitView:ot,fitViewOptions:st,connectOnClick:ct,attributionPosition:lt,proOptions:ut,defaultEdgeOptions:dt,elevateNodesOnSelect:ft=!0,elevateEdgesOnSelect:pt=!1,disableKeyboardA11y:mt=!1,autoPanOnConnect:ht,autoPanOnNodeDrag:gt,autoPanOnSelection:_t=!0,autoPanSpeed:vt,connectionRadius:yt,isValidConnection:bt,onError:xt,style:St,id:Ct,nodeDragThreshold:wt,connectionDragThreshold:Tt,viewport:Et,onViewportChange:Dt,width:Ot,height:kt,colorMode:At=`light`,debug:jt,onScroll:Mt,ariaLabelConfig:Nt,zIndexMode:Pt=`basic`,...Ft},It){let Lt=Ct||`1`,Rt=KH(At),zt=(0,R.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Mt?.(e)},[Mt]);return(0,z.jsx)(`div`,{"data-testid":`rf__wrapper`,...Ft,onScroll:zt,style:{...St,...SG},ref:It,className:NN([`react-flow`,i,Rt]),id:Ct,role:`application`,children:(0,z.jsxs)(xG,{nodes:e,edges:t,width:Ot,height:kt,fitView:ot,fitViewOptions:st,minZoom:we,maxZoom:Te,nodeOrigin:ye,nodeExtent:Oe,zIndexMode:Pt,children:[(0,z.jsx)(WH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:he,autoPanOnNodeFocus:ge,nodesConnectable:_e,nodesFocusable:ve,edgesFocusable:be,edgesReconnectable:xe,elementsSelectable:Se,elevateNodesOnSelect:ft,elevateEdgesOnSelect:pt,minZoom:we,maxZoom:Te,nodeExtent:Oe,onNodesChange:tt,onEdgesChange:nt,snapToGrid:de,snapGrid:fe,connectionMode:L,translateExtent:Ee,connectOnClick:ct,defaultEdgeOptions:dt,fitView:ot,fitViewOptions:st,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:at,nodeOrigin:ye,rfId:Lt,autoPanOnConnect:ht,autoPanOnNodeDrag:gt,autoPanSpeed:vt,onError:xt,connectionRadius:yt,isValidConnection:bt,selectNodesOnDrag:me,nodeDragThreshold:wt,connectionDragThreshold:Tt,onBeforeDelete:I,debug:jt,ariaLabelConfig:Nt,zIndexMode:Pt}),(0,z.jsx)(gG,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:ee,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:ae,selectionOnDrag:oe,selectionMode:se,deleteKeyCode:ie,multiSelectionKeyCode:le,panActivationKeyCode:ce,zoomActivationKeyCode:ue,onlyRenderVisibleElements:pe,defaultViewport:Ce,translateExtent:Ee,minZoom:we,maxZoom:Te,preventScrolling:De,zoomOnScroll:Ae,zoomOnPinch:je,zoomOnDoubleClick:Fe,panOnScroll:Me,panOnScrollSpeed:Ne,panOnScrollMode:Pe,panOnDrag:Ie,autoPanOnSelection:_t,onPaneClick:Le,onPaneMouseEnter:Re,onPaneMouseMove:ze,onPaneMouseLeave:Be,onPaneScroll:Ve,onPaneContextMenu:He,paneClickDistance:Ue,nodeClickDistance:We,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ke,onReconnectStart:qe,onReconnectEnd:Je,onEdgeContextMenu:Ye,onEdgeDoubleClick:Xe,onEdgeMouseEnter:Ze,onEdgeMouseMove:Qe,onEdgeMouseLeave:$e,reconnectRadius:et,defaultMarkerColor:ke,noDragClassName:rt,noWheelClassName:it,noPanClassName:at,rfId:Lt,disableKeyboardA11y:mt,nodeExtent:Oe,viewport:Et,onViewportChange:Dt,nodesDraggable:he}),(0,z.jsx)(RH,{onSelectionChange:k}),Ge,(0,z.jsx)(MH,{proOptions:ut,position:lt}),(0,z.jsx)(kH,{rfId:Lt,disableKeyboardA11y:mt})]})})}var wG=uU(CG);_z.error014();function TG({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,z.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:NN([`react-flow__background-pattern`,n,r])})}function EG({radius:e,className:t}){return(0,z.jsx)(`circle`,{cx:e,cy:e,r:e,className:NN([`react-flow__background-pattern`,`dots`,t])})}var DG;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(DG||={});var OG={[DG.Dots]:1,[DG.Lines]:1,[DG.Cross]:6},kG=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function AG({id:e,variant:t=DG.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,R.useRef)(null),{transform:f,patternId:p}=yH(kG,hH),m=r||OG[t],h=t===DG.Dots,g=t===DG.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,z.jsxs)(`svg`,{className:NN([`react-flow__background`,l]),style:{...c,...CU,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,z.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,z.jsx)(EG,{radius:y/2,className:u}):(0,z.jsx)(TG,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,z.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}AG.displayName=`Background`;var jG=(0,R.memo)(AG);function MG(){return(0,z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,z.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function NG(){return(0,z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,z.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function PG(){return(0,z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,z.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function FG(){return(0,z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,z.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function IG(){return(0,z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,z.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function LG({children:e,className:t,...n}){return(0,z.jsx)(`button`,{type:`button`,className:NN([`react-flow__controls-button`,t]),...n,children:e})}var RG=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function zG({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=bH(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=yH(RG,hH),{zoomIn:y,zoomOut:b,fitView:x}=vU();return(0,z.jsxs)(AH,{className:NN([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(LG,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,z.jsx)(MG,{})}),(0,z.jsx)(LG,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,z.jsx)(NG,{})})]}),n&&(0,z.jsx)(LG,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,z.jsx)(PG,{})}),r&&(0,z.jsx)(LG,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,z.jsx)(IG,{}):(0,z.jsx)(FG,{})}),u]})}zG.displayName=`Controls`;var BG=(0,R.memo)(zG);function VG({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,z.jsx)(`rect`,{className:NN([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var HG=(0,R.memo)(VG),UG=e=>e.nodes.map(e=>e.id),WG=e=>e instanceof Function?e:()=>e;function GG({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=HG,onClick:o}){let s=yH(UG,hH),c=WG(t),l=WG(e),u=WG(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,z.jsx)(z.Fragment,{children:s.map(e=>(0,z.jsx)(qG,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function KG({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=yH(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=fB(r);return{node:r,x:i,y:a,width:o,height:s}},hH);return!l||l.hidden||!pB(l)?null:(0,z.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var qG=(0,R.memo)(KG),JG=(0,R.memo)(GG),YG=200,XG=150,ZG=e=>!e.hidden,QG=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Zz(Pz(e.nodeLookup,{filter:ZG}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},$G=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,eK=(e,t)=>$G(e.viewBB,t.viewBB)&&$G(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,tK=`react-flow__minimap-desc`;function nK({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=bH(),S=(0,R.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=yH(QG,eK),j=e?.width??YG,M=e?.height??XG,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,ee=b*F,te=C.x-(I-C.width)/2-ee,ne=C.y-(L-C.height)/2-ee,re=I+ee*2,ie=L+ee*2,ae=`${tK}-${T}`,oe=(0,R.useRef)(0),se=(0,R.useRef)();oe.current=F,(0,R.useEffect)(()=>{if(S.current&&E)return se.current=AV({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>oe.current}),()=>{se.current?.destroy()}},[E]),(0,R.useEffect)(()=>{se.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ce=p?e=>{let[t,n]=se.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,le=m?(0,R.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ue=_??A[`minimap.ariaLabel`];return(0,z.jsx)(AH,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:NN([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,z.jsxs)(`svg`,{width:j,height:M,viewBox:`${te} ${ne} ${re} ${ie}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ae,ref:S,onClick:ce,children:[ue&&(0,z.jsx)(`title`,{id:ae,children:ue}),(0,z.jsx)(JG,{onClick:le,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,z.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-ee},${ne-ee}h${re+ee*2}v${ie+ee*2}h${-re-ee*2}z
|
|
87
|
-
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}nK.displayName=`MiniMap`,(0,R.memo)(nK);var rK=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,iK={[GV.Line]:`right`,[GV.Handle]:`bottom-right`};function aK({nodeId:e,position:t,variant:n=GV.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=LU(),y=typeof e==`string`?e:v,b=bH(),x=(0,R.useRef)(null),S=n===GV.Handle,C=yH((0,R.useCallback)(rK(S&&p),[S,p]),hH),w=(0,R.useRef)(null),T=t??iK[n];return(0,R.useEffect)(()=>{if(!(!x.current||!y))return w.current||=nH({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=lV([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...mB({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,z.jsx)(`div`,{className:NN([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,R.memo)(aK);function oK({data:e}){let t=e.style===`success`?Ne:e.style===`danger`||e.style===`muted`?ut:e.style===`active`?Re:ze;return(0,z.jsxs)(`article`,{"aria-label":`${e.label}: ${e.state}`,className:C(`dag-node`,`state-${e.state}`,`token-${e.style}`),"data-selected":e.selected,children:[(0,z.jsx)(GU,{type:`target`,position:$.Left}),(0,z.jsxs)(`div`,{className:`node-heading`,children:[(0,z.jsx)(v,{className:`px-1.5 py-0 text-[9px] tracking-[.1em] uppercase`,variant:`outline`,children:e.kind}),(0,z.jsx)(t,{className:C(e.style===`active`&&`spin`),size:17})]}),(0,z.jsx)(`strong`,{children:e.label}),(0,z.jsx)(`span`,{className:`node-status`,children:e.state}),e.reason!==void 0&&(0,z.jsx)(`span`,{className:`node-reason`,title:e.reason,children:e.reason}),e.awaits!==void 0&&(0,z.jsx)(`span`,{className:`node-awaits`,title:e.awaits,children:e.awaits}),(0,z.jsx)(GU,{type:`source`,position:$.Right})]})}function sK({data:e,id:t,markerEnd:n,style:r}){return(0,z.jsx)(TW,{id:t,path:cK(e?.points??[]),markerEnd:n,style:r})}function cK(e){let[t,...n]=e;return t?`M ${t.x} ${t.y} ${n.map(e=>`L ${e.x} ${e.y}`).join(` `)}`:``}function lK({edits:e}){return e===void 0?null:(0,z.jsxs)(`section`,{"aria-labelledby":`rejected-edits-title`,className:`rejected-edits`,children:[(0,z.jsx)(`h2`,{id:`rejected-edits-title`,children:`Refused edits`}),(0,z.jsx)(`ol`,{children:e.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`span`,{className:`rejected-edit-what`,children:e.author}),(0,z.jsx)(`span`,{className:`rejected-edit-reason`,children:e.reason})]},`${e.at}:${e.envelope??``}:${e.index??``}`))})]})}var uK={dagNode:oK},dK={routed:sK};function fK({nodes:e,selectedNodeId:t,onSelectNode:n,journalSeq:r,rejectedEdits:i}){let a=(0,R.useMemo)(()=>{let t=new Map;for(let n of e)ue(n.status)&&t.set(n.id,xe(n));return t},[e]),o=(0,R.useMemo)(()=>new Map(e.map(e=>[e.id,ye(e)])),[e]),{nodes:s,edges:c}=(0,R.useMemo)(()=>{let n=new Set(e.map(e=>e.id)),r=le({nodes:e.map(e=>({id:e.id,label:e.label,kind:e.kind,state:e.status,...o.get(e.id)===void 0?{}:{lines:1}})),edges:e.flatMap(e=>(e.task?.deps??[]).filter(e=>n.has(e)).map(t=>({id:`${t}->${e.id}`,source:t,target:e.id})))});return{nodes:r.nodes.map(e=>({id:e.id,type:`dagNode`,position:{x:e.x,y:e.y},data:{label:e.label,kind:e.kind,state:e.state,style:e.style,selected:e.id===t,...a.get(e.id)===void 0?{}:{reason:a.get(e.id)},...o.get(e.id)===void 0?{}:{awaits:o.get(e.id)}},width:e.width,height:e.height,measured:{width:e.width,height:e.height},handles:[{type:`target`,position:$.Left,x:0,y:e.height/2,width:0,height:0},{type:`source`,position:$.Right,x:e.width,y:e.height/2,width:0,height:0}]})),edges:r.edges.map(t=>({id:t.id,source:t.source,target:t.target,type:`routed`,data:{points:t.points},animated:e.find(({id:e})=>e===t.target)?.status===`running`}))}},[e,a,o,t]);return(0,z.jsxs)(`div`,{className:`graph-wrap`,"data-journal-seq":r,children:[(0,z.jsxs)(wG,{nodes:s,edges:c,colorMode:`dark`,nodeTypes:uK,edgeTypes:dK,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,onInit:e=>void e.fitView(),onNodeClick:(e,t)=>n(t.id),"aria-label":`DAG execution graph`,children:[(0,z.jsx)(jG,{color:`var(--border)`,gap:22}),(0,z.jsx)(BG,{showInteractive:!1})]}),(0,z.jsx)(lK,{edits:i}),(0,z.jsx)(`ol`,{className:`accessible-node-list`,"aria-label":`DAG nodes`,children:e.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),children:[e.label,`: `,e.status,a.get(e.id)===void 0?``:` — ${a.get(e.id)}`,o.get(e.id)===void 0?``:` — ${o.get(e.id)}`]})},e.id))})]})}function pK({value:e,label:t=`Record`}){return e==null?(0,z.jsx)(`span`,{children:`Not recorded`}):typeof e==`boolean`?(0,z.jsx)(`span`,{children:e?`Yes`:`No`}):typeof e==`string`||typeof e==`number`?(0,z.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:String(e)}):Array.isArray(e)?e.length===0?(0,z.jsx)(`span`,{children:`None`}):(0,z.jsx)(`ol`,{"aria-label":t,children:e.map((e,n)=>(0,z.jsx)(`li`,{"aria-label":`${t}.${n}`,children:(0,z.jsx)(pK,{label:`${t}.${n}`,value:e})},n))}):typeof e==`object`?(0,z.jsx)(`div`,{className:`structured-fields`,children:Object.entries(e).map(([e,n])=>(0,z.jsxs)(`fieldset`,{"aria-label":`${t}.${e}`,children:[(0,z.jsx)(`legend`,{children:e.replaceAll(`_`,` `)}),(0,z.jsx)(pK,{label:`${t}.${e}`,value:n})]},e))}):(0,z.jsx)(`span`,{children:`Not recorded`})}function mK(e,t){let[n,r]=(0,R.useState)(0);return{host:AN(`host`,()=>e.host(),n),unwatched:AN(`unwatched`,()=>e.unwatched(),n),refresh:(0,R.useCallback)(()=>{r(e=>e+1),t?.()},[t])}}var hK=[`Run`,`Node`,`Provider`,`Age (ms)`,`Proof`];function gK(e,t){let n=e?.runs??[];if(t===void 0)return n;let r=new Map(t.map(e=>[e.id,e])),i=new Set(n.map(e=>e.run_id));return[...n.flatMap(e=>{let t=r.get(e.run_id);if(t===void 0)return[];let{done:n,failed:i,running:a}=t.nodes;return[{run_id:e.run_id,state:t.state,node_counts:{...e.node_counts,done:n,failed:i,running:a}}]}),...(e===void 0?[]:t).filter(e=>!i.has(e.id)).map(({id:e,state:t,nodes:{done:n,failed:r,running:i}})=>({run_id:e,state:t,node_counts:{done:n,failed:r,running:i}}))]}function _K({client:e,onRefresh:t,list:n,rows:r,listError:i,children:a}){let{host:o,unwatched:s,refresh:c}=mK(e,t),l=o.value?.reading;return(0,z.jsx)(Pu,{className:`min-h-0 flex-1`,children:(0,z.jsxs)(`section`,{"aria-label":`Host`,className:`channel-view host-page`,children:[(0,z.jsxs)(`h2`,{children:[`This host`,l&&(0,z.jsxs)(z.Fragment,{children:[` · `,(0,z.jsx)(`output`,{"aria-label":`Host name`,className:`host-name`,children:l.host})]})]}),(0,z.jsx)(ci,{onClick:c,children:`Refresh host`}),(o.error||s.error)&&(0,z.jsx)(`p`,{role:`alert`,children:o.error?.message??s.error?.message}),o.loading&&(0,z.jsx)(`p`,{role:`status`,children:`Reading host…`}),l&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`dl`,{children:[(0,z.jsx)(`dt`,{children:`Runs root`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`output`,{"aria-label":`Runs root path`,children:l.root})})]}),l.root_error&&(0,z.jsx)(`p`,{role:`alert`,children:l.root_error}),(0,z.jsxs)(`section`,{"aria-label":`Free space`,children:[(0,z.jsx)(`h3`,{children:`Free space`}),l.free_space.map((e,t)=>(0,z.jsxs)(`dl`,{children:[(0,z.jsx)(`dt`,{children:`Filesystem`}),(0,z.jsx)(`dd`,{children:e.roots.map((e,t)=>(0,z.jsxs)(`span`,{children:[t>0&&` · `,e.role,`:`,` `,(0,z.jsx)(`output`,{"aria-label":`Filesystem root path`,children:e.path??`unresolved`}),e.measured_at&&(0,z.jsxs)(z.Fragment,{children:[` `,`(measured at`,` `,(0,z.jsx)(`output`,{"aria-label":`Measured root ancestor`,children:e.measured_at}),`)`]})]},e.role))}),(0,z.jsx)(`dt`,{children:`Free bytes`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`output`,{"aria-label":`Free capacity bytes`,children:e.free_bytes??`Unknown`})}),(0,z.jsx)(`dt`,{children:`Total bytes`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`output`,{"aria-label":`Total capacity bytes`,children:e.total_bytes??`Unknown`})}),e.error&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`dt`,{children:`Error`}),(0,z.jsx)(`dd`,{children:e.error})]})]},e.roots[0]?.path??t))]}),(0,z.jsxs)(`section`,{"aria-label":`Providers and dispatches`,children:[(0,z.jsx)(`h3`,{children:`Providers and dispatches`}),l.dispatches.length===0?(0,z.jsx)(`p`,{children:`No live dispatches`}):(0,z.jsx)(`section`,{"aria-label":`Providers and dispatches table`,className:`host-table`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsx)(`tr`,{children:hK.map(e=>(0,z.jsx)(`th`,{children:e},e))})}),(0,z.jsx)(`tbody`,{children:l.dispatches.map(e=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{"data-label":`Run`,children:e.run}),(0,z.jsx)(`td`,{"data-label":`Node`,children:e.node}),(0,z.jsx)(`td`,{"data-label":`Provider`,children:e.launcher}),(0,z.jsx)(`td`,{"data-label":`Age (ms)`,children:(0,z.jsx)(`output`,{"aria-label":`Dispatch age milliseconds`,className:`host-age`,children:e.age_ms??`Unknown`})}),(0,z.jsxs)(`td`,{"data-label":`Proof`,children:[e.proof,e.unproven&&`: ${e.unproven}`]})]},`${e.run}/${e.node}`))})]})})]}),(0,z.jsxs)(`section`,{"aria-label":`Gone dispatches`,children:[(0,z.jsx)(`h3`,{children:`Gone dispatches`}),l.gone.map(e=>(0,z.jsxs)(`p`,{children:[e.run,` · `,e.node,` · `,e.reason]},`${e.run}/${e.node}`))]}),l.skipped.map(e=>(0,z.jsxs)(`p`,{children:[e.path,`: `,e.reason]},e.path))]}),(0,z.jsxs)(`section`,{"aria-label":`Unwatched runs`,children:[(0,z.jsxs)(`h3`,{children:[`Unwatched runs: `,s.value?.reported.length??`…`]}),s.value?.reported.map(e=>(0,z.jsxs)(`dl`,{children:[(0,z.jsx)(`dt`,{children:e.run}),(0,z.jsxs)(`dd`,{children:[e.standing,` · `,e.why_not_watched]})]},e.run)),s.value?.unresolved.map(e=>(0,z.jsx)(`p`,{children:e},e))]}),(0,z.jsxs)(`section`,{"aria-label":`Runs on the host`,children:[(0,z.jsx)(`h3`,{children:`Runs on the host`}),i&&(0,z.jsxs)(`p`,{role:`alert`,children:[`Listing unavailable: `,i.message]}),gK(n,r).map(e=>(0,z.jsx)(`p`,{children:[e.run_id,e.state,j(e.node_counts)].filter(Boolean).join(` · `)},e.run_id))]}),(0,z.jsxs)(`details`,{"aria-label":`Provider health`,children:[(0,z.jsx)(`summary`,{children:`Provider health`}),(0,z.jsx)(pK,{value:n?.provider_health})]}),a]})})}function vK(e,t,n){let{value:r,error:i}=AN(t?`host-listing`:void 0,async()=>{let[t,n]=await Promise.all([e.listRuns(!0),e.listProjects()]);return{...t,runs:n.projects.flatMap(e=>e.runs),next_cursor:void 0}},n);return t?{list:r,error:i}:{}}function yK(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function bK(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function xK(e){return e}var SK=[],CK=`skip`;function wK(e,t,n,r){if(!e||typeof e!=`object`)throw Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,a,o,s,c;if(typeof n==`function`||n&&typeof n==`object`?(a=t,o=n,r&&(i=!1)):(o=t,n&&(i=!1)),typeof o==`function`)s=o;else if(o&&typeof o==`object`){if(!(o.enter===null||o.enter===void 0))if(typeof o.enter==`function`)s=o.enter;else throw Error("Unexpected value `"+o.enter+"` for `visitors.enter`, expected optional visitor");if(typeof o.exit==`function`)c=o.exit;else throw Error("Unexpected value `"+o.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw Error("Unexpected value `"+o+"` for `enter` or `visitors`, expected visitor or object with visitors");let l=Iv(a),u=i?1:-1;d(e,void 0,[])();function d(e,t,n){let r=e&&typeof e==`object`?e:{};if(typeof r.type==`string`){let t=typeof r.tagName==`string`?r.tagName:typeof r.name==`string`?r.name:void 0;Object.defineProperty(o,"name",{value:`node (`+xK(e.type+(t?`<`+t+`>`:``))+`)`})}return o;function o(){let r=!a||l(e,t,n[n.length-1]||void 0),o=SK;if(s&&r&&(o=TK(s(e,n,t)),o[0]===!1))return o;if(`children`in e&&e.children){let t=e;if(t.children&&o[0]!==`skip`){let e=(i?-1:t.children.length)+u,r=[...n,t];for(;e>-1&&e<t.children.length;){let n=t.children[e],i=d(n,e,r)();if(i[0]===!1)return i;e=typeof i[1]==`number`?i[1]:e+u}}}if(c&&r){let r=TK(c(e,n,t));if(r[0]===`skip`)throw Error("Unexpected value `"+r[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(r[0]===!1||typeof r[1]==`number`)return r}return o}}}function TK(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?SK:[e]}function EK(e,t,n){let r=Iv((n||{}).ignore||[]),i=DK(t),a=-1;for(;++a<i.length;)wK(e,o);function o(e,t,n){if(e.type===`text`&&typeof n==`number`)return s(e,t,n);if(r(e,n,t[t.length-1]))return CK}function s(e,t,n){let r=t[t.length-1],o=i[a][0],s=i[a][1],c=0,l=!1,u=[];o.lastIndex=0;let d=o.exec(e.value);for(;d;){let n=d.index,r={index:d.index,input:d.input,stack:[...t,e]},i=s(...d,r);if(typeof i==`string`&&(i=i.length>0?{type:`text`,value:i}:void 0),i===!1)o.lastIndex=n+1;else{if(c!==n&&f({type:`text`,value:e.value.slice(c,n)}),Array.isArray(i))for(let e of i)f(e);else i&&f(i);c=n+d[0].length,l=!0}if(!o.global)break;d=o.exec(e.value)}return l?(c<e.value.length&&f({type:`text`,value:e.value.slice(c)}),r.children.splice(n,1,...u)):u=[e],n+u.length;function f(e){let t=u[u.length-1];t&&t.type===`text`&&e.type===`text`?t.value+=e.value:u.push(e)}}}function DK(e){if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let t=[],n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([OK(e[0]),kK(e[1])])}return t}function OK(e){return typeof e==`string`?new RegExp(bK(e),`g`):e}function kK(e){return typeof e==`function`?e:function(){return e}}var AK=`phrasing`,jK=[`autolink`,`link`,`image`,`label`];function MK(){return{transforms:[BK],enter:{literalAutolink:PK,literalAutolinkEmail:FK,literalAutolinkHttp:FK,literalAutolinkWww:FK},exit:{literalAutolink:zK,literalAutolinkEmail:RK,literalAutolinkHttp:IK,literalAutolinkWww:LK}}}function NK(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:AK,notInConstruct:jK},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:AK,notInConstruct:jK},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:AK,notInConstruct:jK}]}}function PK(e){this.enter({type:`link`,title:null,url:``,children:[],position:void 0},e)}function FK(e){this.config.enter.autolinkProtocol.call(this,e)}function IK(e){this.config.exit.autolinkProtocol.call(this,e)}function LK(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function RK(e){this.config.exit.autolinkEmail.call(this,e)}function zK(e){this.exit(e)}function BK(e){EK(e,[[/(?<![\da-z])(https?:\/\/|www(?=\.))([\w-]*\.[\w\-.]*)([^\t\n\r ]*)/gi,VK],[/(?<![\w+\-.@])xmpp:([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)(\/(?:[\w\-/]|\.(?=[\dA-Za-z]))*)?/g,WK],[/(?<![\w+\-.@])mailto:([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)/g,UK],[/(?<![\w+\-.]|(?:^|[^\d@A-Za-z])(?:mailto|xmpp):)([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)/g,HK]],{ignore:[`link`,`linkReference`]})}function VK(e,t,n,r,i){if(!qK(i))return!1;let a=``;if(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),fh(n.charCodeAt(0))||!GK(n))return!1;let o=KK(n+r),s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0],position:void 0}],position:void 0};return o[1]?[s,{type:`text`,value:o[1],position:void 0}]:s}function HK(e,t,n){return!/[\d\-_]$/.test(n)&&{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n,position:void 0}],position:void 0}}function UK(e,t,n){if(/[\d\-_]$/.test(n))return!1;let r=`mailto:`+t+`@`+n;return{type:`link`,title:null,url:r,children:[{type:`text`,value:r,position:void 0}],position:void 0}}function WK(e,t,n,r,i){if(/[\d\-_]$/.test(n)||r&&(!/[A-Za-z]$/.test(r)||i.input.charAt(i.index+e.length)===`@`))return!1;let a=`xmpp:`+t+`@`+n+(r||``);return{type:`link`,title:null,url:a,children:[{type:`text`,value:a,position:void 0}],position:void 0}}function GK(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[\dA-Za-z]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[\dA-Za-z]/.test(t[t.length-2])))}function KK(e){let t=e.length;for(;t>0;){let n=e.charCodeAt(t-1);if(n===33||n===34||n===38||n===39||n===41||n===44||n===46||n===58||n===59||n===60||n===62||n===63||n===93||n===125)t--;else break}if(t===e.length)return[e,void 0];let n=e.slice(t);e=e.slice(0,t);let r=n.indexOf(`)`),i=yK(e,`(`),a=yK(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function qK(e){let t=e.input.charCodeAt(e.index-1);return e.index===0||ph(t)||fh(t)}rq.peek=nq;function JK(){this.buffer()}function YK(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function XK(){this.buffer()}function ZK(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function QK(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=nh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $K(e){this.exit(e)}function eq(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=nh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tq(e){this.exit(e)}function nq(){return`[`}function rq(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function iq(){return{enter:{gfmFootnoteCallString:JK,gfmFootnoteCall:YK,gfmFootnoteDefinitionLabelString:XK,gfmFootnoteDefinition:ZK},exit:{gfmFootnoteCallString:QK,gfmFootnoteCall:$K,gfmFootnoteDefinitionLabelString:eq,gfmFootnoteDefinition:tq}}}function aq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:rq},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
88
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?sq:oq))),s(),o}}function oq(e,t,n){return t===0?e:sq(e,t,n)}function sq(e,t,n){return(n?``:` `)+e}var cq=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];pq.attention=mq,pq.peek=hq;function lq(){return{canContainEols:[`delete`],enter:{strikethrough:dq},exit:{strikethrough:fq}}}function uq(){return{handlers:{delete:pq},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:cq}]}}function dq(e){this.enter({type:`delete`,children:[],position:void 0},e)}function fq(e){this.exit(e)}function pq(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function mq(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function hq(){return`~`}function gq(e){return e.length}function _q(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||gq,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=vq(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=yq(r[d]);else{let e=yq(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u],r=n.fillRows===!1?Math.max(1,o[u===1?0:u].length):l;d=-1;let i=[];for(;++d<r;){let o=e[d]||``,s=``,l=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];if(n===114)s=` `.repeat(e);else if(n===99){let t=e/2;e%2?(s=` `.repeat(t+.5),l=` `.repeat(t-.5)):(s=` `.repeat(t),l=s)}else l=` `.repeat(e)}n.delimiterStart!==!1&&!d&&i.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&o===``)&&(n.delimiterStart!==!1||d)&&i.push(` `),n.alignDelimiters!==!1&&i.push(s),i.push(o),n.alignDelimiters!==!1&&i.push(l),n.padding!==!1&&i.push(` `),(n.delimiterEnd!==!1||d!==r-1)&&i.push(`|`)}m.push(n.delimiterEnd===!1?i.join(``).replace(/ +$/,``):i.join(``))}return m.join(`
|
|
89
|
-
`)}function vq(e){return e==null?``:String(e)}function yq(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function bq(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),xq);return i(),o}function xq(e,t,n){return`>`+(n?``:` `)+e}function Sq(e,t){return Cq(e,t.inConstruct,!0)&&!Cq(e,t.notInConstruct,!1)}function Cq(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function wq(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
90
|
-
`&&Sq(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
91
|
-
`}function Tq(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function Eq(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Dq(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Oq(e,t,n,r){let i=Dq(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Eq(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,kq);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(Tq(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
92
|
-
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
93
|
-
`),a&&(u+=s.move(a+`
|
|
94
|
-
`)),u+=s.move(c),l(),u}function kq(e,t,n){return(n?``:` `)+e}function Aq(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function jq(e,t,n,r){let i=Aq(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
95
|
-
`,...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()),o(),l}function Mq(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Nq(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Pq(e,t,n){let r=Ch(e),i=Ch(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Fq.peek=Iq;function Fq(e,t,n,r){let i=Mq(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Pq(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Nq(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Pq(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Nq(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Iq(e,t,n){return n.options.emphasis||`*`}function Lq(e,t){let n=!1;return qv(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&Um(e)&&(t.options.setext||n))}function Rq(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(Lq(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
96
|
-
`,after:`
|
|
97
|
-
`});return r(),t(),o+`
|
|
98
|
-
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
99
|
-
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
100
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=Nq(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}zq.peek=Bq;function zq(e){return e.value||``}function Bq(){return`<`}Vq.peek=Hq;function Vq(e,t,n,r){let i=Aq(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...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 Hq(){return`!`}Uq.peek=Wq;function Uq(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 Wq(){return`!`}Gq.peek=Kq;function Gq(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Kq(){return"`"}function qq(e,t){let n=Um(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Jq.peek=Yq;function Jq(e,t,n,r){let i=Aq(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(qq(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 Yq(e,t,n){return qq(e,n)?`<`:`[`}Xq.peek=Zq;function Xq(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 Zq(){return`[`}function Qq(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 $q(e){let t=Qq(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 eJ(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function tJ(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 nJ(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?eJ(n):Qq(n),s=e.ordered?o===`.`?`)`:`.`:$q(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),tJ(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function rJ(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function iJ(e,t,n,r){let i=rJ(n),a=n.bulletCurrent||Qq(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-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 aJ(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var oJ=Iv([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function sJ(e,t,n,r){return(e.children.some(function(e){return oJ(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function cJ(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}lJ.peek=uJ;function lJ(e,t,n,r){let i=cJ(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=Pq(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Nq(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Pq(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Nq(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function uJ(e,t,n){return n.options.strong||`*`}function dJ(e,t,n,r){return n.safe(e.value,r)}function fJ(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 pJ(e,t,n){let r=(tJ(n)+(n.options.ruleSpaces?` `:``)).repeat(fJ(n));return n.options.ruleSpaces?r.slice(0,-1):r}var mJ={blockquote:bq,break:wq,code:Oq,definition:jq,emphasis:Fq,hardBreak:wq,heading:Rq,html:zq,image:Vq,imageReference:Uq,inlineCode:Gq,link:Jq,linkReference:Xq,list:nJ,listItem:iJ,paragraph:aJ,root:sJ,strong:lJ,text:dJ,thematicBreak:pJ};function hJ(){return{enter:{table:gJ,tableData:bJ,tableHeader:bJ,tableRow:vJ},exit:{codeText:xJ,table:_J,tableData:yJ,tableHeader:yJ,tableRow:yJ}}}function gJ(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[],position:void 0},e),this.data.inTable=!0}function _J(e){this.exit(e),this.data.inTable=void 0}function vJ(e){this.enter({type:`tableRow`,children:[],position:void 0},e)}function yJ(e){this.exit(e)}function bJ(e){this.enter({type:`tableCell`,children:[],position:void 0},e)}function xJ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,SJ));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function SJ(e,t){return t===`|`?t:e}function CJ(e){let{tableCellPadding:t,tablePipeAlign:n,stringLength:r}=e||{},i=t?` `:`|`;return{handlers:{inlineCode:d,table:a,tableCell:s,tableRow:o},join:[wJ],unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
101
|
-
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}]};function a(e,t,n,r){let i=l(e,n,r),a=i[0];if(a){let t=e.align?e.align.length:0,n=-1;if(!t)for(;++n<i.length;)i[n].length>t&&(t=i[n].length);for(;a.length<t;)a.push(``)}return c(i,e.align)}function o(e,t,n,r){let i=c([u(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
102
|
-
`))}function s(e,t,n,r){let a=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:i,after:i});return o(),a(),s}function c(e,i){return _q(e,{align:i,alignDelimiters:n,fillRows:!1,padding:t,stringLength:r})}function l(e,t,n){let{children:r}=e,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=u(r[i],t,n);return o(),a}function u(e,t,n){let{children:r}=e,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=s(r[i],e,t,n);return o(),a}function d(e,t,n){let r=mJ.inlineCode(e,t,n);if(!n.stack.includes(`tableCell`))return r;let i=[],a=0,o=r.indexOf(`|`);for(;o!==-1;){let e=o;for(;e>a&&r.charCodeAt(e-1)===92;)e--;i.push(r.slice(a,o)),(o-e)%2==0&&i.push(`\\`),a=o,o=r.indexOf(`|`,o+1)}return i.push(r.slice(a)),i.join(``)}}function wJ(e,t,n,r){if(e.type===`table`&&n.type===`listItem`&&n.spread===!1&&(t.type===`definition`||t.type===`heading`&&TJ(t,r)||t.type===`paragraph`||t.type===`table`))return 1}function TJ(e,t){let n=!1;return qv(e,function(e){if(e.type===`break`||`value`in e&&/\r?\n|\r/.test(e.value))return n=!0,!1}),!!((!e.depth||e.depth<3)&&Um(e)&&(t.options.setext||n))}function EJ(){return{exit:{taskListCheckValueChecked:OJ,taskListCheckValueUnchecked:OJ,paragraph:kJ}}}function DJ(){return{handlers:{paragraph:AJ},join:[jJ]}}function OJ(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function kJ(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start={...n.position.start}))}}this.exit(e)}function AJ(e,t,n,r){if(!t||t.type!==`listItem`||MJ(t)!==e)return mJ.paragraph(e,t,n,r);let i=`[`+(t.checked?`x`:` `)+`] `,a=n.createTracker(r);return a.move(i),i+mJ.paragraph(e.children.length>0?e:{type:`paragraph`,children:[{type:`text`,value:` `}]},t,n,{...r,...a.current()})}function jJ(e,t,n){if(!(e.type===`definition`&&n.type===`listItem`))return;let r=MJ(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function MJ(e){if(typeof e.checked==`boolean`)for(let t of e.children){if(t.type===`paragraph`)return t;if(t.type!==`definition`)return}}function NJ(){return[MK(),iq(),lq(),hJ(),EJ()]}function PJ(e){return{extensions:[NK(),aq(e),uq(),CJ(e),DJ()]}}var FJ={tokenize:YJ,partial:!0},IJ={tokenize:XJ,partial:!0},LJ={tokenize:ZJ,partial:!0},RJ={tokenize:QJ,partial:!0},zJ={tokenize:$J,partial:!0},BJ={name:`wwwAutolink`,tokenize:qJ,previous:eY},VJ={name:`protocolAutolink`,tokenize:JJ,previous:tY},HJ={name:`emailAutolink`,tokenize:KJ,previous:nY},UJ={};function WJ(){return{text:UJ}}for(var GJ=48;GJ<123;)UJ[GJ]=HJ,GJ++,GJ===58?GJ=65:GJ===91&&(GJ=97);UJ[43]=HJ,UJ[45]=HJ,UJ[46]=HJ,UJ[95]=HJ,UJ[72]=[HJ,VJ],UJ[104]=[HJ,VJ],UJ[87]=[HJ,BJ],UJ[119]=[HJ,BJ];function KJ(e,t,n){let r=this,i,a;return o;function o(t){return!rY(t)||!nY.call(r,r.previous)||iY(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return rY(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(zJ,u,l)(t):t===45||t===95||ih(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&rh(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function qJ(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!eY.call(r,r.previous)||iY(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(FJ,e.attempt(IJ,e.attempt(LJ,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function JJ(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&tY.call(r,r.previous)&&!iY(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(rh(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||oh(t)||uh(t)||ph(t)||fh(t)?n(t):e.attempt(IJ,e.attempt(LJ,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function YJ(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function XJ(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(RJ,c,s)(t):t===null||uh(t)||ph(t)||t!==45&&fh(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function ZJ(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(RJ,t,a)(o):o===null||uh(o)||ph(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function QJ(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||uh(o)||ph(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||uh(e)||ph(e)?t(e):r(e)}function a(e){return rh(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):rh(t)?(e.consume(t),o):n(t)}}function $J(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return ih(e)?n(e):t(e)}}function eY(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||uh(e)}function tY(e){return!rh(e)}function nY(e){return!(e===47||rY(e))}function rY(e){return e===43||e===45||e===46||e===95||ih(e)}function iY(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var aY={tokenize:pY,partial:!0};function oY(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:uY,continuation:{tokenize:dY},exit:fY}},text:{91:{name:`gfmFootnoteCall`,tokenize:lY},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:sY,resolveTo:cY}}}}function sY(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=nh(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 cY(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 lY(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||uh(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(nh(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return uh(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 uY(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||uh(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=nh(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return uh(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),gh(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function dY(e,t,n){return e.check(jh,t,e.attempt(aY,t,n))}function fY(e){e.exit(`gfmFootnoteDefinition`)}function pY(e,t,n){let r=this;return gh(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 mY(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(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Ym(o,o.length,0,wh(s,e.slice(r+1,n),t)),Ym(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ym(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Ch(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Ch(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var hY=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){gY(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,this.index.clear()}};function gY(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function _Y(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function vY(){return{flow:{null:{name:`table`,tokenize:yY,resolveAll:bY}}}}function yY(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];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):H(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):dh(t)?gh(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||uh(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,dh(t)?gh(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 dh(t)?gh(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||H(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 dh(t)?gh(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||H(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||H(n)?(e.exit(`tableRow`),t(n)):dh(n)?gh(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||uh(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 bY(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 hY;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(SY(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=xY(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=xY(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=xY(f,t,o,i,n,d)):(o[0]=o[1],d=xY(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&SY(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=_Y(t.events,n))}return e}function xY(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},CY(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=CY(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=CY(t.events,n[2]),a=CY(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},CY(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function SY(e,t,n,r,i){let a=[],o=CY(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 CY(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var wY={name:`tasklistCheck`,tokenize:EY};function TY(){return{text:{91:wY}}}function EY(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 uh(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 H(r)?t(r):dh(r)?e.check({tokenize:DY},t,n)(r):n(r)}}function DY(e,t,n){return gh(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function OY(e){return Qm([WJ(),oY(),mY(e),vY(),TY()])}var kY={};function AY(e){let t=this,n=e||kY,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(OY(n)),a.push(NJ()),o.push(PJ(n))}var jY=new Set([`http:`,`https:`,`mailto:`]);function MY(e){try{return new URL(e)}catch{return}}function NY(e){let t=e===void 0?void 0:MY(e)?.protocol;return t!==void 0&&jY.has(t)?e:void 0}var PY={target:`_blank`,rel:`noopener noreferrer`},FY=typeof window>`u`?R.useEffect:R.useLayoutEffect;function IY(e,t){let n=(0,R.useRef)(null);return FY(()=>{let t=n.current;if(!t||e===void 0)return;let r=()=>{t.removeAttribute(`data-otg-table-cut`);let e=t.querySelector(`table`);if(!e||t.scrollHeight<=t.clientHeight)return;let n=e.getBoundingClientRect().top-t.getBoundingClientRect().top;t.toggleAttribute(`data-otg-table-cut`,n<t.clientHeight)};r();let i=t.clientWidth,a=new ResizeObserver(()=>{t.clientWidth!==i&&(i=t.clientWidth,r())});a.observe(t);let o=!0;return document.fonts?.ready.then(()=>{o&&r()}),()=>{o=!1,a.disconnect()}},[e,t]),n}function LY(e){return e.tagName===`img`?{type:`text`,value:String(e.properties?.alt||`image`)}:(e.children&&=e.children.map(LY),e)}function RY(){let e=t=>{t.tagName===`a`?LY(t):t.children?.forEach(e)};return e}function zY({href:e,children:t}){let n=NY(e);return(0,z.jsx)(`a`,{href:n,...n===void 0?{}:PY,children:t})}var BY={a:({href:e,children:t})=>(0,z.jsx)(zY,{href:e,children:t}),img:({src:e,alt:t})=>(0,z.jsx)(zY,{href:typeof e==`string`?e:void 0,children:t||`image`})},VY=[AY],HY=[RY];function UY({source:e,clamp:t}){let n=t!==void 0&&Number.isInteger(t)&&t>0?t:void 0,r=IY(n,e),i=n===void 0?void 0:{WebkitLineClamp:n,maxHeight:`calc(${n} * 1lh)`};return(0,z.jsx)(`div`,{className:n===void 0?`otg-markdown`:`otg-markdown otg-markdown--clamped`,ref:r,style:i,children:(0,z.jsx)(Gy,{components:BY,rehypePlugins:HY,remarkPlugins:VY,children:e})})}function WY({title:e,body:t,badges:n,meta:r,links:i,actions:a,clamp:o,children:s,className:c,...l}){let u=(0,R.useId)();return(0,z.jsx)(`article`,{...l,"aria-labelledby":u,className:c?`otg-card ${c}`:`otg-card`,children:(0,z.jsxs)(`div`,{className:`otg-card__surface`,children:[(0,z.jsxs)(`div`,{className:`otg-card__header`,children:[n!=null&&(0,z.jsx)(`div`,{className:`otg-card__badges`,children:n}),(0,z.jsx)(`h3`,{className:`otg-card__title`,id:u,children:e}),a!=null&&(0,z.jsx)(`div`,{className:`otg-card__actions`,children:a})]}),r!=null&&(0,z.jsx)(`div`,{className:`otg-card__meta`,children:r}),i!=null&&(0,z.jsx)(`div`,{className:`otg-card__links`,children:i}),t?(0,z.jsx)(UY,{source:t,...o===void 0?{}:{clamp:o}}):null,s]})})}var GY=new Map([[`github.com`,`GitHub`],[`linear.app`,`Linear`]]);function KY(e){return GY.get(MY(e)?.hostname??``)??`tracker`}function qY({url:e,label:t,...n}){let r=NY(e);return(0,z.jsx)(`a`,{"aria-label":`Open ${KY(e)} issue ${t}`,...n,href:r,...PY,className:[`otg-source-link`,n.className].filter(Boolean).join(` `),children:t})}var JY=15e3;function YY(e,t,n){let[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),p=(0,R.useRef)(null),{key:m,phase:h,followUp:g}=e,_=h===`sending`||g?.phase===`failed`||g?.phase===`sending`;return(0,R.useLayoutEffect)(()=>{if(f(!1),_)return;let e=setTimeout(()=>f(!0),JY);return()=>clearTimeout(e)},[`${m}:${h}:${g?.kind??``}:${g?.phase??``}`,_]),(0,R.useEffect)(()=>{c(!1),u(``)},[m]),(0,R.useEffect)(()=>{g?.kind===`note`&&g.phase===`done`&&(c(!1),u(``))},[g]),(0,R.useEffect)(()=>{if(!d||r||s)return;let e=p.current?.contains(document.activeElement)??!1;a&&e||t()},[d,r,a,s,t]),(0,R.useEffect)(()=>{if(!r)return;let e=e=>{let t=p.current;t!==null&&e.target instanceof Node&&!t.contains(e.target)&&i(!1)};return document.addEventListener(`pointerover`,e,!0),()=>document.removeEventListener(`pointerover`,e,!0)},[r]),(0,R.useEffect)(()=>{let e=p.current;if(e===null)return;let t=()=>n(e.getBoundingClientRect().height);t();let r=new ResizeObserver(t);return r.observe(e),()=>{r.disconnect(),n(0)}},[n]),{holds:{ref:p,onFocus:()=>o(!0),onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||o(!1)},onPointerEnter:()=>i(!0),onPointerLeave:()=>i(!1)},writing:s,setWriting:c,text:l,setText:u}}var XY={complete:`Completed`,dismiss:`Dismissed`},ZY={complete:`Completing`,dismiss:`Dismissing`},QY={complete:`Reopened`,dismiss:`Restored`};function $Y(e){let{action:t,title:n,phase:r,error:i,followUp:a}=e;if(r===`failed`)return`Not ${XY[t].toLowerCase()}: ${n}. ${i??``}`.trim();let o=QY[t],s=t===`dismiss`?`Reason`:`Comment`;return a?.phase===`failed`?a.kind===`undo`?`Not ${o.toLowerCase()}: ${n}. ${a.error??``}`.trim():`${s} not saved: ${n}. ${a.error??``}`.trim():a?.phase===`done`?a.kind===`undo`?`${o}: ${n}`:`${s} saved: ${n}`:r===`sending`?`${ZY[t]}: ${n}…`:`${XY[t]}: ${n}`}function eX({toast:e,onUndo:t,onNote:n,onClose:r,onRoom:i}){let{holds:a,writing:o,setWriting:s,text:c,setText:l}=YY(e,r,i),u=(0,R.useId)(),{action:d,phase:f,followUp:p}=e,m=f===`failed`||p?.phase===`failed`,h=f!==`failed`,g=p?.kind===`undo`&&p.phase===`done`,_=d===`dismiss`?`Add reason`:`Add comment`,v=d===`dismiss`?`Reason`:`Comment`;return(0,z.jsxs)(`section`,{"aria-label":`Action result`,className:`human-items-toast`,"data-phase":p?.phase??f,"data-tone":m?`failure`:`success`,...a,children:[(0,z.jsx)(`p`,{className:`human-items-toast-message`,role:m?`alert`:`status`,children:$Y(e)}),h&&!g&&(0,z.jsxs)(`div`,{className:`human-items-toast-actions`,children:[(0,z.jsx)(tX,{label:d===`dismiss`?`Restore`:`Reopen`,onPress:t,reopen:e.reopen,sending:p?.kind===`undo`&&p.phase===`sending`}),!o&&(0,z.jsx)(`button`,{className:`human-items-toast-action`,onClick:()=>s(!0),type:`button`,children:_})]}),h&&!g&&o&&(0,z.jsxs)(`form`,{className:`human-items-toast-note`,onSubmit:e=>{e.preventDefault(),c.trim()!==``&&n(c)},children:[(0,z.jsx)(`label`,{className:`sr-only`,htmlFor:u,children:v}),(0,z.jsx)(`input`,{autoFocus:!0,id:u,onChange:e=>l(e.target.value),placeholder:`${v}, then Enter`,readOnly:p?.kind===`note`&&p.phase===`sending`,value:c}),(0,z.jsx)(`button`,{className:`human-items-toast-action`,type:`submit`,children:p?.kind===`note`&&p.phase===`failed`?`Send again`:`Send`})]}),(0,z.jsx)(`button`,{"aria-label":`Close`,className:`human-items-toast-close`,onClick:r,type:`button`,children:(0,z.jsx)(ut,{"aria-hidden":`true`,size:14})})]})}function tX({label:e,reopen:t,sending:n,onPress:r}){let[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1),c=(0,R.useId)();return t?.available===!1?(0,z.jsxs)(`fieldset`,{"aria-label":`${e} (unavailable)`,className:`human-items-toast-action human-items-unavailable`,onPointerEnter:()=>s(!0),onPointerLeave:()=>s(!1),children:[(0,z.jsx)(`button`,{"aria-describedby":c,disabled:!0,type:`button`,children:e}),(0,z.jsx)(`sup`,{className:`human-items-why-anchor`,children:(0,z.jsx)(`button`,{"aria-controls":c,"aria-expanded":i,"aria-label":`Why ${e} is unavailable`,className:`human-items-why`,onClick:()=>a(e=>!e),type:`button`,children:`?`})}),(0,z.jsx)(`span`,{className:`human-items-why-tip`,hidden:!(i||o),id:c,role:`tooltip`,children:t.reason})]}):(0,z.jsx)(`button`,{"aria-busy":n,className:`human-items-toast-action`,onClick:()=>{n||r()},type:`button`,children:n?`${e}…`:e})}var nX=nk.map(e=>({wire:e,label:rk[e]}));function rX(e){return rk[e.priority]}function iX(e){return e.kind===`task`?`Task`:`Question`}var aX={open:`Open`,answered:`Answered`,completed:`Completed`,dismissed:`Dismissed`},oX=[`open`,`answered`,`completed`,`dismissed`],sX=oX.map(e=>({state:e,label:aX[e]}));function cX(e){return aX[e.state]}function lX(e){return e.state===`open`&&e.block.scope!==`nothing`}function uX(e){return e===1?`1 step`:`${e} steps`}function dX(e){let{item:t,blocked:n}=e;if(!lX(t))return[];switch(t.block.scope){case`host`:return[`blocks all work on this host`];case`plan`:return[`blocks all of ${t.block.plan}`];case`work`:return n.plans.map(({plan:e,count:t})=>`blocks ${uX(t)} in ${e}`);default:return[]}}function fX(e){let t=dX(e);return e.item.block.scope===`work`?e.blocked.plans.map(({count:e,preview:n},r)=>{let i=e-n.length,a=n.map(({node:e})=>e).join(`, `);return`${t[r]}: ${a}${i>0?` +${i} more`:``}`}).join(`; `):t.join(`; `)}function pX(e){if(e.block.scope===`host`)return`host`;let{plan:t,run:n,session:r}=e.owner;return t!==null&&n!==null?`plan ${t} / run ${n}`:t===null?n===null?`session ${r}`:`run ${n}`:`plan ${t}`}function mX(e){let t=dX(e);if(e.item.block.scope!==`work`)return t.map(t=>({phrase:t,nodes:e.nodes}));let n=0;return e.blocked.plans.map(({count:r},i)=>{let a=e.nodes.slice(n,n+r);return n+=r,{phrase:t[i]??``,nodes:a}})}function hX(e){return e===`user`?`you`:`the manager`}function gX(e){return e.resolution?.provenance??`manager`}var _X={"human-item-raised":`Raised`,"human-item-answered":`Answered`,"human-item-completed":`Completed`,"human-item-dismissed":`Dismissed`,"human-item-auto-resolved":`Resolved`,"human-item-reopened":`Reopened`,"human-item-noted":`Note`};function vX(e){return`${_X[e.action]} by ${hX(e.provenance)}`}function yX(e){let{item:t}=e,{plan:n,run:r}=t.owner,i=dX(e).join(`; `),a={answered:`Answered`,completed:`Completed`,dismissed:`Dismissed`}[t.state];return[{label:`Priority`,value:rX(t)},{label:`Kind`,value:iX(t)},{label:`State`,value:cX(t)},{label:`Source`,value:pX(t)},...n===null?[]:[{label:`Plan`,value:n}],...r===null?[]:[{label:`Run`,value:r}],{label:`Blocks`,value:i===``?`Nothing`:i},{label:`Raised`,at:t.created_at},...a===void 0?[]:[{label:a,at:t.updated_at,party:hX(gX(t))}]]}function bX(e,t){return e.find(e=>e===t)}var xX=[``,`task`,`question`],SX=[``,`yes`,`no`],CX=[``,...nk],wX=oX,TX=[``,`session`,`run`,`plan`,`host`],EX={kind:``,blocking:``,priority:``,state:`open`,source:``,sourceId:``};function DX(e){let t=e.sourceId.trim();return{...e.kind===``?{}:{kind:e.kind},...e.blocking===``?{}:{blocking:e.blocking===`yes`},...e.priority===``?{}:{priority:e.priority},...e.state===`open`?{}:{state:e.state},...e.source===`host`?{host:!0}:{},...e.source!==``&&e.source!==`host`&&t!==``?{[e.source]:t}:{}}}function OX(e){return Number(e.kind!==EX.kind)+Number(e.blocking!==EX.blocking)+Number(e.priority!==EX.priority)+Number(e.state!==EX.state)+Number(e.source!==EX.source)}var kX=[`priority`,`kind`,`source`,`blocking`,`none`],AX=`priority`,jX=[{value:`priority`,label:`Priority`},{value:`kind`,label:`Kind`},{value:`source`,label:`Source`},{value:`blocking`,label:`Blocking`},{value:`none`,label:`None`}];function MX(e,t){let{item:n}=e;switch(t){case`priority`:return{key:n.priority,label:rX(n),rank:nk.indexOf(n.priority)};case`kind`:return{key:n.kind,label:iX(n),rank:n.kind===`task`?0:1};case`blocking`:return lX(n)?{key:`blocking`,label:`Blocking`,rank:0}:{key:`not-blocking`,label:`Not blocking`,rank:1};case`source`:{let e=pX(n);return{key:e,label:`Source: ${e}`,rank:0}}}}function NX(e,t){if(t===`none`)return[{key:`all`,items:e}];let n=new Map;return e.forEach((e,r)=>{let{key:i,label:a,rank:o}=MX(e,t),s=n.get(i);s?s.items.push(e):n.set(i,{label:a,rank:o,first:r,items:[e]})}),[...n.entries()].sort(([,e],[,t])=>e.rank-t.rank||e.first-t.first).map(([e,{label:t,items:n}])=>({key:e,label:t,items:n}))}function PX({answers:e,onRoom:t}){let n=(0,R.useRef)(null),{count:r,remaining:i,sending:a,sendError:o,notices:s}=e,c=r>0||o!==void 0||s.length>0;return(0,R.useEffect)(()=>{let e=n.current;if(e===null)return;let r=()=>t(e.getBoundingClientRect().height);r();let i=new ResizeObserver(r);return i.observe(e),()=>{i.disconnect(),t(0)}},[t,c]),c?(0,z.jsxs)(`section`,{"aria-label":`Drafted answers`,className:`human-items-send`,ref:n,children:[r>0&&(0,z.jsxs)(`div`,{className:`human-items-send-bar`,children:[(0,z.jsx)(`button`,{className:`human-items-send-action`,"data-primary":`true`,disabled:a,onClick:()=>void e.send(),type:`button`,children:a?`Sending…`:`Send ${r} ${r===1?`answer`:`answers`}`}),(0,z.jsx)(`button`,{className:`human-items-send-action`,disabled:a,onClick:e.discard,type:`button`,children:`Discard`}),i>0&&(0,z.jsxs)(`span`,{className:`human-items-send-more`,children:[i,` more after this`]})]}),o!==void 0&&(0,z.jsxs)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:[`Not sent, and your drafts are kept: `,o]}),s.length>0&&(0,z.jsx)(`ul`,{"aria-label":`Not sent`,className:`human-items-not-sent`,children:s.map(t=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`p`,{children:[(0,z.jsxs)(`strong`,{children:[`Not sent: `,t.title]}),` (`,t.reason,`)`]}),t.choiceTitle!==void 0&&(0,z.jsxs)(`p`,{children:[`Choice: `,t.choiceTitle]}),t.text!==void 0&&(0,z.jsx)(UY,{source:t.text}),(0,z.jsx)(`button`,{className:`human-items-send-action`,onClick:()=>e.clearNotice(t.key),type:`button`,children:`Clear`})]},t.key))})]}):null}var FX=`onepipeline-ui.human-items.group-by`;function IX(){try{return bX(kX,window.localStorage.getItem(`onepipeline-ui.human-items.group-by`)??``)??`priority`}catch{return AX}}function LX(){let[e,t]=(0,R.useState)(IX);return{groupBy:e,setGroupBy:(0,R.useCallback)(e=>{t(e);try{window.localStorage.setItem(FX,e)}catch{}},[])}}var RX=`answered or dismissed elsewhere`,zX=`onepipeline-ui.human-items.draft.`,BX=/^[^\s/?#]+$/u,VX=J({title:G(),choice:G().optional(),choiceTitle:G().optional(),text:G().optional()});function HX(){try{let e={};for(let t=0;t<window.localStorage.length;t+=1){let n=window.localStorage.key(t);if(n===null||!n.startsWith(zX))continue;let r=n.slice(33),i=UX(window.localStorage.getItem(n));i!==void 0&&BX.test(r)&&(e[r]=i)}return e}catch{return}}function UX(e){if(e!==null)try{let t=VX.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function WX(e,t){try{t===void 0?window.localStorage.removeItem(`${zX}${e}`):window.localStorage.setItem(`${zX}${e}`,JSON.stringify(t))}catch{}}function GX(e){return e!==void 0&&e.trim()!==``}function KX(e){return e.choice!==void 0||GX(e.text)}function qX(e,t){return{id:e,...t.choice===void 0?{}:{choice:t.choice},...GX(t.text)?{text:t.text}:{}}}function JX(e){return e.kind===`conflict`?e.reason:`human items are unavailable on this host`}async function YX(e,t){try{return(await e.getHumanItem(t)).item.state!==`open`}catch(e){return e instanceof HM&&e.status===404||void 0}}function XX(e,t){return e[t]===void 0?e:Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}function ZX(e,t,n,r,i,a){let[o,s]=(0,R.useState)(()=>HX()??{}),[c,l]=(0,R.useState)({}),[u,d]=(0,R.useState)([]),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(),g=(0,R.useRef)(!1),_=(0,R.useRef)(0),v=(0,R.useRef)(o);v.current=o;let y=(0,R.useRef)(new Set),b=(0,R.useRef)(new Set),x=(0,R.useRef)(0),S=(0,R.useCallback)((e,t)=>{WX(e,t),s(n=>t===void 0?XX(n,e):{...n,[e]:t}),l(t=>XX(t,e)),h(void 0)},[]),C=(0,R.useCallback)((e,t)=>{let n=v.current[e];if(n===void 0)return;WX(e,void 0),s(t=>XX(t,e)),l(t=>XX(t,e)),_.current+=1;let r=_.current;d(e=>[...e,{...n,key:r,reason:t}])},[]),w=(0,R.useCallback)((e,t)=>{let{id:n,title:r}=e.item,{text:i}=v.current[n]??{},a={title:r,...v.current[n]?.choice===t.id?{}:{choice:t.id,choiceTitle:t.title},...i===void 0?{}:{text:i}};S(n,KX(a)?a:void 0)},[S]),T=(0,R.useCallback)((e,t)=>{let{id:n,title:r}=e.item,{choice:i,choiceTitle:a}=v.current[n]??{},o={title:r,...i===void 0?{}:{choice:i},...a===void 0?{}:{choiceTitle:a},...t===``?{}:{text:t}};S(n,o.choice===void 0&&t===``?void 0:o)},[S]),E=Object.entries(o).filter(([,e])=>KX(e)),D=E.slice(0,50),O=(0,R.useCallback)(async(t,n)=>{await YX(e,t)===!0?C(t,n):l(e=>({...e,[t]:n}))},[e,C]),k=(0,R.useCallback)(async()=>{if(g.current)return;let t=HX(),n=D.filter(([e])=>t!==void 0&&t[e]===void 0);for(let[e]of n)s(t=>XX(t,e));let r=D.flatMap(([e,t])=>n.some(([t])=>t===e)?[]:[qX(e,t)]);if(r.length!==0){g.current=!0,p(!0),h(void 0),a(r.map(({id:e})=>e));try{let t=await e.answerHumanItems(r);for(let{item:e}of t.answered)WX(e.item.id,void 0),s(t=>XX(t,e.item.id)),l(t=>XX(t,e.item.id));i(t.answered),await Promise.all(t.refused.map(({id:e,refusal:t})=>O(e,JX(t))))}catch(e){h(e instanceof Error?e.message:String(e))}finally{g.current=!1,p(!1),a([])}}},[D,e,i,a,O]),A=(0,R.useCallback)(()=>{for(let e of Object.keys(v.current))WX(e,void 0);s({}),l({}),h(void 0)},[]),j=(0,R.useCallback)(e=>{d(t=>t.filter(t=>t.key!==e))},[]);return(0,R.useEffect)(()=>{y.current.clear(),x.current+=1},[n]),(0,R.useEffect)(()=>{if(t===void 0||f)return;for(let e of Object.keys(o)){if(r(e))continue;let i=t.find(({item:t})=>t.id===e);if(i!==void 0){y.current.delete(e),i.item.state!==`open`&&C(e,RX);continue}y.current.has(e)||b.current.has(e)||n(e)}function n(t){let r=x.current;b.current.add(t),YX(e,t).then(e=>{if(e===!1&&r!==x.current&&!g.current){n(t);return}b.current.delete(t),!g.current&&(e===!0?C(t,RX):e===!1&&y.current.add(t))})}},[e,o,t,C,f,r]),{drafts:o,refusals:c,notices:u,sending:f,sendError:m,count:D.length,remaining:E.length-D.length,pressChoice:w,setText:T,retire:C,send:k,discard:A,clearNotice:j}}function QX(e){let[t,n]=(0,R.useState)(EX),[r,i]=(0,R.useState)(),a=(0,R.useMemo)(()=>{if(!e)return;let n=DX(t);return{type:`human-items`,...Object.keys(n).length===0?{}:{filter:n},...r===void 0?{}:{item:r}}},[e,JSON.stringify(DX(t)),r]);return(0,R.useEffect)(()=>{e||(n(EX),i(void 0))},[e]),{choice:t,setChoice:n,selectedId:r,setSelectedId:i,view:a}}function $X(e,t,n,r,i=``){let[a,o]=(0,R.useState)({}),[s,c]=(0,R.useState)(),[l,u]=(0,R.useState)([]),[d,f]=(0,R.useState)({}),[p,m]=(0,R.useState)({}),[h,g]=(0,R.useState)(),_=(0,R.useRef)(new Set),v=(0,R.useRef)(new Map),y=(0,R.useRef)(0),b=(0,R.useRef)(void 0);b.current=s;let x=t.items,S=(0,R.useRef)(i);S.current=i,(0,R.useEffect)(()=>{m(e=>Object.keys(e).length===0?e:{})},[i]);let C=(0,R.useMemo)(()=>{if(x===void 0)return;let e=x.flatMap(e=>{if(d[e.item.id]!==void 0)return[];let t=p[e.item.id]?.view;return t===void 0||!tZ(t,e)?[e]:t.item.state===r?[t]:[]}),t=t=>e.some(({item:e})=>e.id===t);for(let{view:n,at:a,filter:o}of Object.values(p))o===i&&n.item.state===r&&!t(n.item.id)&&e.splice(Math.min(a,e.length),0,n);for(let{view:n,at:r}of l)t(n.item.id)||e.splice(Math.min(r,e.length),0,n);return e},[x,l,p,d,r,i]);(0,R.useEffect)(()=>{x!==void 0&&m(e=>{let t=Object.entries(e).filter(([e,{view:t}])=>{let n=x.find(({item:t})=>t.id===e);return n===void 0?t.item.state===r:tZ(t,n)});return t.length===Object.keys(e).length?e:Object.fromEntries(t)})},[x,r]);let w=t.error===void 0&&t.item===n?t.detail:void 0,T=n===void 0?void 0:p[n]?.view,E=w&&T!==void 0&&tZ(T,{item:w.item})?{...w,item:T.item,reopen:T.reopen}:w,D=(0,R.useRef)(x);D.current=x;let O=ZX(e,x,i,(0,R.useCallback)(e=>_.current.has(e),[]),(0,R.useCallback)(e=>{let t=S.current;m(n=>{let r={...n};for(let{item:n}of e){let e=Math.max(0,D.current?.findIndex(({item:e})=>e.id===n.item.id)??0);r[n.item.id]={view:n,at:e,filter:t}}return r});let n=new Set(e.map(({item:e})=>e.item.id));u(e=>e.filter(({view:e})=>!n.has(e.item.id)))},[]),(0,R.useCallback)(e=>{let t=D.current??[];u(e.flatMap(e=>{let n=t.findIndex(({item:t})=>t.id===e),r=t[n];return r===void 0?[]:[{view:r,at:n}]}))},[])),{retire:k}=O,A=(0,R.useCallback)((e,t)=>c(n=>n?.key===e?t(n):n),[]),j=(0,R.useCallback)((t,n)=>{let{id:r,title:i}=t.item;if(_.current.has(r))return;_.current.add(r);let a=++y.current,s=S.current,l=Math.max(0,D.current?.findIndex(({item:e})=>e.id===r)??0);o(e=>({...e,[r]:{}})),f(e=>({...e,[r]:{view:t,at:l}})),c({key:a,id:r,title:i,action:n.action,phase:`sending`});let u=n.action===`complete`?e.completeHumanItem(r):e.dismissHumanItem(r,n.reason);v.current.set(a,u),u.then(e=>{m(t=>({...t,[r]:{view:e.item,at:l,filter:s}})),o(e=>({...e,[r]:{}})),k(r,`dismissed here`),A(a,t=>({...t,phase:`done`,reopen:e.item.reopen}))},e=>{let t=nZ(e);o(e=>({...e,[r]:{error:t}})),A(a,e=>({...e,phase:`failed`,error:t})),g({id:r})}).finally(()=>{_.current.delete(r),f(eZ(r))})},[e,A,k]),M=(0,R.useCallback)((e,t)=>{let n=b.current;if(n===void 0)return;let r=v.current.get(n.key);if(r===void 0||n.followUp?.phase===`sending`)return;let{key:i,id:a}=n,o=S.current;A(i,t=>({...t,followUp:{kind:e,phase:`sending`}})),r.then(n=>{if(e===`undo`&&!n.item.reopen.available){A(i,e=>({...e,followUp:void 0}));return}t(a).then(t=>{m(e=>({...e,[a]:{view:t.item,at:e[a]?.at??0,filter:o}})),A(i,n=>({...n,reopen:t.item.reopen,followUp:{kind:e,phase:`done`}}))},t=>A(i,n=>({...n,followUp:{kind:e,phase:`failed`,error:nZ(t)}})))},()=>A(i,e=>({...e,followUp:void 0})))},[A]),N=(0,R.useCallback)(()=>M(`undo`,t=>e.reopenHumanItem(t)),[e,M]),P=(0,R.useCallback)(t=>M(`note`,n=>e.noteHumanItem(n,t)),[e,M]),F=(0,R.useCallback)(()=>c(void 0),[]);return{items:C,listError:n===void 0||C===void 0?t.error:void 0,detail:E===null?void 0:E,gone:n!==void 0&&E===null,detailError:n===void 0?void 0:t.error,writes:a,answers:O,write:j,toast:s,undo:N,note:P,closeToast:F,returned:h}}function eZ(e){return t=>t[e]===void 0?t:Object.fromEntries(Object.entries(t).filter(([t])=>t!==e))}function tZ(e,t){return Date.parse(e.item.updated_at)>Date.parse(t.item.updated_at)}function nZ(e){return e instanceof Error?e.message:String(e)}var rZ=`data-card-action`,iZ=4;function aZ({client:e,live:t,choice:n,setChoice:r,selectedId:i,setSelectedId:a}){let o=$X(e,t,i,n.state,JSON.stringify(n)),{groupBy:s,setGroupBy:c}=LX(),[l,u]=(0,R.useState)(0),[d,f]=(0,R.useState)(0),p=(0,R.useRef)(null),m=o.items?.find(({item:e})=>e.id===i)??o.detail,h=(0,R.useRef)(void 0);m===void 0?h.current?.item.id!==i&&(h.current=void 0):h.current=m;let g=(e,t)=>{e.item.id===i&&a(void 0),o.write(e,t)},_=o.returned;(0,R.useEffect)(()=>{_!==void 0&&p.current?.querySelector(`[data-item-id="${CSS.escape(_.id)}"]`)?.scrollIntoView({block:`nearest`})},[_]);let v=NX(o.items??[],s);return(0,z.jsxs)(`section`,{"aria-label":`Action items`,className:`human-items-page`,"data-detail-open":i!==void 0,style:oZ(l,d),children:[(0,z.jsx)(lZ,{choice:n,groupBy:s,onChange:r,onGroupBy:c}),(0,z.jsxs)(`div`,{className:`human-items-body`,children:[(0,z.jsxs)(`section`,{"aria-label":`Action item list`,className:`human-items-list`,children:[o.listError&&(0,z.jsx)(`p`,{role:`alert`,children:o.listError}),o.items===void 0&&!o.listError&&(0,z.jsx)(`p`,{role:`status`,children:`Reading action items…`}),o.items?.length===0&&(0,z.jsx)(`p`,{role:`status`,children:`No action items match these filters.`}),(0,z.jsx)(`div`,{className:`human-items-groups`,onKeyDown:e=>cZ(e,p.current),ref:p,children:v.map(e=>(0,z.jsx)(sZ,{answering:o.answers,group:e,groupBy:s,onSelect:a,onWrite:g,selectedId:i,writes:o.writes},e.key))}),(o.items?.length??0)>0&&(0,z.jsx)(`button`,{className:`card-actions-entry`,onFocus:()=>p.current?.querySelector(`[${rZ}]`)?.focus(),type:`button`,children:`Card actions: use the arrow keys`})]}),i!==void 0&&(0,z.jsx)(yZ,{answering:o.answers,error:o.detailError,detail:o.detail,gone:o.gone,lastShown:h.current,onClose:()=>a(void 0),onWrite:g,state:o.writes[i],view:m})]}),(0,z.jsx)(PX,{answers:o.answers,onRoom:f}),o.toast&&(0,z.jsx)(eX,{onClose:o.closeToast,onNote:o.note,onRoom:u,onUndo:o.undo,toast:o.toast})]})}function oZ(e,t){return{"--toast-room":`${e}px`,"--send-room":`${t}px`}}function sZ({group:e,groupBy:t,selectedId:n,writes:r,answering:i,onSelect:a,onWrite:o}){let s=(0,R.useId)(),c=e.items.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsx)(fZ,{answering:i,groupBy:t,onSelect:()=>a(e.item.id),onWrite:o,selected:e.item.id===n,state:r[e.item.id],view:e})},e.item.id));return e.label===void 0?(0,z.jsx)(`ul`,{"aria-label":`Action items`,children:c}):(0,z.jsxs)(`section`,{"aria-labelledby":s,className:`human-items-group`,children:[(0,z.jsxs)(`h2`,{className:`human-items-group-heading`,id:s,children:[e.label,` `,(0,z.jsxs)(`span`,{className:`human-items-group-count`,children:[`(`,e.items.length,`)`]})]}),(0,z.jsx)(`ul`,{"aria-labelledby":s,children:c})]})}function cZ(e,t){let n=e.target;if(t===null||!(n instanceof HTMLElement)||!n.hasAttribute(rZ))return;let r=[...t.querySelectorAll(`[${rZ}]`)],i=r.indexOf(n),a=e.key===`ArrowRight`||e.key===`ArrowDown`?r[Math.min(i+1,r.length-1)]:e.key===`ArrowLeft`||e.key===`ArrowUp`?r[Math.max(i-1,0)]:e.key===`Home`?r[0]:e.key===`End`?r.at(-1):void 0;a!==void 0&&(e.preventDefault(),a.focus())}function lZ({choice:e,groupBy:t,onChange:n,onGroupBy:r}){let i=(0,R.useId)(),[a,o]=(0,R.useState)(!1),s=(t,r)=>n({...e,[t]:r}),c=e.source!==``&&e.source!==`host`,l=OX(e)+Number(t!==AX);return(0,z.jsxs)(`div`,{className:`human-items-controls`,"data-open":a,children:[(0,z.jsxs)(`button`,{"aria-controls":`${i}-filters`,"aria-expanded":a,"aria-label":l>0?`Filters, ${l} changed`:`Filters`,className:`human-items-filters-toggle`,onClick:()=>o(e=>!e),type:`button`,children:[(0,z.jsx)(at,{"aria-hidden":`true`,size:14}),`Filters`,l>0&&(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`human-items-filters-count`,children:l})]}),(0,z.jsxs)(`fieldset`,{className:`human-items-filters`,id:`${i}-filters`,children:[(0,z.jsx)(`legend`,{className:`sr-only`,children:`Filter action items`}),(0,z.jsx)(`label`,{htmlFor:`${i}-group`,children:`Group by`}),(0,z.jsx)(`select`,{id:`${i}-group`,onChange:e=>r(bX(kX,e.target.value)??`priority`),value:t,children:jX.map(({value:e,label:t})=>(0,z.jsx)(`option`,{value:e,children:t},e))}),(0,z.jsx)(`label`,{htmlFor:`${i}-kind`,children:`Kind`}),(0,z.jsxs)(`select`,{id:`${i}-kind`,onChange:e=>s(`kind`,bX(xX,e.target.value)??``),value:e.kind,children:[(0,z.jsx)(`option`,{value:``,children:`Any kind`}),(0,z.jsx)(`option`,{value:`task`,children:`Task`}),(0,z.jsx)(`option`,{value:`question`,children:`Question`})]}),(0,z.jsx)(`label`,{htmlFor:`${i}-blocking`,children:`Blocking`}),(0,z.jsxs)(`select`,{id:`${i}-blocking`,onChange:e=>s(`blocking`,bX(SX,e.target.value)??``),value:e.blocking,children:[(0,z.jsx)(`option`,{value:``,children:`Any`}),(0,z.jsx)(`option`,{value:`yes`,children:`Yes`}),(0,z.jsx)(`option`,{value:`no`,children:`No`})]}),(0,z.jsx)(`label`,{htmlFor:`${i}-priority`,children:`Priority`}),(0,z.jsxs)(`select`,{id:`${i}-priority`,onChange:e=>s(`priority`,bX(CX,e.target.value)??``),value:e.priority,children:[(0,z.jsx)(`option`,{value:``,children:`Any priority`}),nX.map(({wire:e,label:t})=>(0,z.jsx)(`option`,{value:e,children:t},e))]}),(0,z.jsx)(`label`,{htmlFor:`${i}-state`,children:`State`}),(0,z.jsx)(`select`,{id:`${i}-state`,onChange:e=>s(`state`,bX(wX,e.target.value)??`open`),value:e.state,children:sX.map(({state:e,label:t})=>(0,z.jsx)(`option`,{value:e,children:t},e))}),(0,z.jsx)(`label`,{htmlFor:`${i}-source`,children:`Source`}),(0,z.jsxs)(`select`,{id:`${i}-source`,onChange:e=>s(`source`,bX(TX,e.target.value)??``),value:e.source,children:[(0,z.jsx)(`option`,{value:``,children:`Any source`}),(0,z.jsx)(`option`,{value:`session`,children:`Session`}),(0,z.jsx)(`option`,{value:`run`,children:`Run`}),(0,z.jsx)(`option`,{value:`plan`,children:`Plan`}),(0,z.jsx)(`option`,{value:`host`,children:`Host`})]}),c&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`label`,{htmlFor:`${i}-source-id`,children:`Source identifier`}),(0,z.jsx)(`input`,{id:`${i}-source-id`,onChange:e=>s(`sourceId`,e.target.value),placeholder:`${e.source} id`,type:`search`,value:e.sourceId})]})]})]})}function uZ(e){return e.target instanceof Element&&e.target.closest(`a, button, textarea, input, select`)===null}function dZ({view:e,groupBy:t}){let{item:n}=e;return(0,z.jsxs)(z.Fragment,{children:[t!==`priority`&&(0,z.jsx)(`span`,{className:`human-item-priority`,"data-priority":n.priority,children:rX(n)}),t!==`kind`&&(0,z.jsx)(`span`,{className:`human-item-kind`,children:iX(n)}),t!==`blocking`&&lX(n)&&(0,z.jsx)(`span`,{className:`human-item-blocking`,children:`Blocking`})]})}function fZ({view:e,groupBy:t,selected:n,state:r,answering:i,onSelect:a,onWrite:o}){let{item:s}=e,c=s.state===`open`,l=fX(e),u=[...c?[]:[cX(s)],...l?[l]:[],...t===`source`?[]:[`Source: ${pX(s)}`]],d=(s.choices?.length??0)>0;return(0,z.jsxs)(WY,{actions:(0,z.jsx)(pZ,{item:e,onSelect:a,onWrite:o}),badges:(0,z.jsx)(dZ,{groupBy:t,view:e}),body:s.body,className:`human-item-card`,clamp:iZ,"data-blocking":lX(s),"data-item-id":s.id,"data-selected":n,meta:u.length===0?void 0:u.map((e,t)=>(0,z.jsxs)(R.Fragment,{children:[t>0&&` · `,(0,z.jsx)(`span`,{children:e})]},e)),onClick:e=>{uZ(e)&&a()},title:s.title,children:[s.kind===`question`&&c&&d&&(0,z.jsxs)(`fieldset`,{className:`human-item-choices`,children:[(0,z.jsxs)(`legend`,{className:`sr-only`,children:[`Choices: `,s.title]}),s.choices?.map(t=>(0,z.jsx)(mZ,{answering:i,choice:t,view:e},t.id))]}),s.kind===`question`&&c&&!d&&(0,z.jsx)(hZ,{answering:i,label:`Answer: ${s.title}`,view:e}),(0,z.jsx)(gZ,{view:e}),(0,z.jsx)(_Z,{reason:i.refusals[s.id]}),(0,z.jsx)(vZ,{state:r})]})}function pZ({item:e,onSelect:t,onWrite:n}){let{item:r}=e,i=r.state===`open`;return(0,z.jsxs)(z.Fragment,{children:[r.tracker&&(0,z.jsx)(qY,{className:`human-item-tracker`,"data-card-action":``,label:r.tracker.task,title:r.tracker.task,onClick:e=>e.stopPropagation(),tabIndex:-1,url:r.tracker.url}),(0,z.jsx)(`button`,{className:`human-item-action`,"data-card-action":``,tabIndex:-1,onClick:t,type:`button`,"aria-label":`Details: ${r.title}`,children:`Details`}),i&&r.kind===`task`&&(0,z.jsx)(`button`,{className:`human-item-action`,"data-card-action":``,tabIndex:-1,onClick:()=>n(e,{action:`complete`}),type:`button`,"aria-label":`Complete: ${r.title}`,children:`Complete`}),i&&(0,z.jsx)(`button`,{className:`human-item-action`,"data-card-action":``,tabIndex:-1,onClick:()=>n(e,{action:`dismiss`}),type:`button`,"aria-label":`Dismiss: ${r.title}`,children:`Dismiss`})]})}function mZ({view:e,choice:t,answering:n}){return(0,z.jsx)(`button`,{"aria-pressed":n.drafts[e.item.id]?.choice===t.id,className:`human-item-choice`,disabled:n.sending,onClick:()=>n.pressChoice(e,t),type:`button`,children:t.title})}function hZ({view:e,label:t,answering:n}){return(0,z.jsx)(`textarea`,{"aria-busy":n.sending,"aria-label":t,className:`human-item-answer`,onChange:t=>n.setText(e,t.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||e.preventDefault()},placeholder:`Write an answer`,readOnly:n.sending,rows:1,value:n.drafts[e.item.id]?.text??``})}function gZ({view:e}){let{item:t}=e;if(t.state!==`answered`||t.resolution===null)return null;let{choice:n,text:r}=t.resolution,i=t.choices?.find(({id:e})=>e===n);return(0,z.jsxs)(`section`,{"aria-label":`Answer`,className:`human-item-answered`,children:[i&&(0,z.jsx)(`p`,{className:`human-item-answered-choice`,children:i.title}),r!==null&&(0,z.jsx)(UY,{source:r})]})}function _Z({reason:e}){return e===void 0?null:(0,z.jsxs)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:[`Not sent: `,e]})}function vZ({state:e}){return e?.error?(0,z.jsx)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:e.error}):null}function yZ({view:e,detail:t,gone:n,lastShown:r,error:i,state:a,answering:o,onWrite:s,onClose:c}){if(n&&e===void 0)return(0,z.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,children:[(0,z.jsxs)(`header`,{className:`human-item-detail-head`,children:[r&&(0,z.jsx)(`h2`,{children:r.item.title}),(0,z.jsx)(ci,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,z.jsx)(ut,{size:14})})]}),(0,z.jsx)(`p`,{role:`status`,children:`Resolved: this item needs nothing more from you.`})]});let l=t??e;if(l===void 0)return(0,z.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,children:[(0,z.jsx)(ci,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,z.jsx)(ut,{size:14})}),i?(0,z.jsx)(`p`,{role:`alert`,children:i}):(0,z.jsx)(`p`,{role:`status`,children:`Reading…`})]});let{item:u}=l,d=u.state===`open`,p=u.choices??[],m=u.kind===`question`&&d;return(0,z.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,tabIndex:0,children:[(0,z.jsxs)(`header`,{className:`human-item-detail-head`,children:[(0,z.jsx)(`h2`,{children:u.title}),(0,z.jsx)(ci,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,z.jsx)(ut,{size:14})})]}),i&&(0,z.jsx)(`p`,{role:`alert`,children:i}),(0,z.jsx)(`section`,{"aria-label":`Full body`,className:`human-item-detail-body`,children:(0,z.jsx)(UY,{source:u.body})}),m&&p.length>0&&(0,z.jsxs)(`fieldset`,{className:`human-item-choice-list`,children:[(0,z.jsx)(`legend`,{children:`Choices`}),p.map(e=>(0,z.jsxs)(`div`,{className:`human-item-choice-entry`,children:[(0,z.jsx)(mZ,{answering:o,choice:e,view:l}),(0,z.jsx)(`div`,{className:`human-item-choice-description`,children:(0,z.jsx)(UY,{source:e.description})})]},e.id))]}),m&&(0,z.jsx)(hZ,{answering:o,label:`Answer in detail: ${u.title}`,view:l}),(0,z.jsx)(gZ,{view:l}),(0,z.jsx)(_Z,{reason:o.refusals[u.id]}),(0,z.jsxs)(`div`,{className:`human-item-detail-actions`,children:[d&&u.kind===`task`&&(0,z.jsx)(ci,{onClick:()=>s(l,{action:`complete`}),size:`sm`,type:`button`,children:`Complete`}),d&&(0,z.jsx)(ci,{onClick:()=>s(l,{action:`dismiss`}),size:`sm`,type:`button`,variant:`outline`,children:`Dismiss`}),(0,z.jsx)(vZ,{state:a})]}),t?.history!==void 0&&t.history.length>0&&(0,z.jsx)(bZ,{history:t.history}),(0,z.jsxs)(`dl`,{className:`human-item-metadata`,children:[yX(l).map(e=>(0,z.jsxs)(R.Fragment,{children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:`value`in e?e.value:(0,z.jsxs)(z.Fragment,{children:[e.party!==void 0&&`By ${e.party} · `,(0,z.jsx)(f,{at:e.at,relative:!0})]})})]},e.label)),t&&t.nodes.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`dt`,{children:`Blocked steps`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`section`,{"aria-label":`Blocked steps`,className:`human-item-steps`,children:mX(t).map(({phrase:e,nodes:t})=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{children:e}),(0,z.jsx)(`ul`,{children:t.map(e=>(0,z.jsxs)(`li`,{children:[e.run,` / `,e.node,`: `,e.title]},`${e.run}/${e.node}`))})]},e))})})]}),u.tracker&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`dt`,{children:`Tracker`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(qY,{className:`human-item-tracker-full`,label:u.tracker.task,url:u.tracker.url})})]})]})]})}function bZ({history:e}){return(0,z.jsxs)(`section`,{"aria-label":`History`,className:`human-item-history`,children:[(0,z.jsx)(`h3`,{children:`History`}),(0,z.jsx)(`ol`,{children:e.map((e,t)=>(0,z.jsxs)(`li`,{children:[vX(e),` · `,(0,z.jsx)(f,{at:e.at,relative:!0})]},t))})]})}function xZ({className:e,state:t}){let n=SZ(t);return(0,z.jsxs)(v,{className:C(`gap-1.5 tracking-[.03em] uppercase`,n&&wZ[n],e),variant:`outline`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:C(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}function SZ(e){return AZ[e]}var CZ=e=>{let t=SZ(e);return C(`size-2 shrink-0 rounded-full bg-current`,t===void 0?`text-muted-foreground`:TZ[t])},wZ={success:`border-success bg-success-surface text-success`,destructive:`border-destructive bg-destructive-surface text-destructive`,warning:`border-warning bg-warning-surface text-warning`,info:`border-info bg-info-surface text-info`},TZ={success:`text-success`,destructive:`text-destructive`,warning:`text-warning`,info:`text-info`},EZ=`success`,DZ=`destructive`,OZ=`warning`,kZ={blocked:OZ,cancelled:DZ,"complete-but-draft":OZ,"complete-but-held":OZ,done:EZ,failed:DZ,"not-completed":DZ,parked:void 0,pending:void 0,ready:void 0,running:`info`,skipped:OZ,unknown:void 0,waiting:void 0},AZ={...kZ,complete:kZ.done,settled:kZ.done,active:kZ.running},jZ=`/human-items`;function MZ(e){return e===`/human-items`||e===`/human-items/`}function NZ(e){return MZ(e)?`/`:e}function PZ(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}var FZ=()=>window.location.pathname;function IZ(){let e=(0,R.useSyncExternalStore)(PZ,FZ,FZ),t=(0,R.useCallback)(()=>{let e=new URLSearchParams;for(let t of new URLSearchParams(window.location.search).getAll(`hide-kind`))e.append(`hide-kind`,t);let t=e.size>0?`?${e}`:``;window.history.pushState(null,``,`${jZ}${t}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{active:MZ(e),open:t}}var LZ={graph:`graph`,overall:`overall`,channel:`channel`};function RZ(e){return e!==null&&Object.hasOwn(LZ,e)}var zZ={projects:`projects`,runs:`runs`};function BZ(e){return e!==null&&Object.hasOwn(zZ,e)}var VZ={decisions:{label:`Decisions`,description:`Decision points and settlements only`,profile:Lk.planner},activity:{label:`Detailed activity`,description:`Every record all three producers put on the stream`,profile:Lk.detailed}};function HZ(e){return e!==null&&Object.hasOwn(VZ,e)}var UZ={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,remote:`Remote`};function WZ(e){return e!==null&&Object.hasOwn(UZ,e)}function GZ(e,t){let n=e.get(t);return n!==null&&ge(n)?n:void 0}function KZ(){let e=(0,R.useSyncExternalStore)(qZ,JZ,JZ),t=new URLSearchParams(e),n=t.get(`list`),r=BZ(n)?n:`projects`,i=t.get(`project`),a=i!==null&&(i===`none`||vj(i))?i:void 0,o=GZ(t,`run`),s=GZ(t,`node`),c=GZ(t,`event`),l=t.get(`view`),u=t.get(`tab`),d=t.get(`detail`),f=HZ(d)?d:`activity`,p=u===`pr`||u===`checks`?`remote`:WZ(u)?u:`timeline`,m=RZ(l)?l:s===void 0?`overall`:`graph`,h=(0,R.useCallback)((e,t=!1)=>{let n=new URLSearchParams(window.location.search);e(n);let r=t?window.location.pathname:NZ(window.location.pathname);window.history.pushState(null,``,`${r}?${n}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{list:r,host:t.get(`page`)===`host`,hiddenKinds:t.getAll(`hide-kind`),selectHost:()=>h(e=>{e.set(`page`,`host`)}),selectKinds:e=>h(t=>{t.delete(`hide-kind`);for(let n of e)t.append(`hide-kind`,n)},!0),projectKey:a,runId:o,nodeId:s,itemId:c,view:m,detail:f,nodeTab:p,selectList:e=>h(t=>{e===`projects`?t.delete(`list`):t.set(`list`,e),t.delete(`project`)}),selectProject:e=>h(t=>{e===void 0?t.delete(`project`):t.set(`project`,e),t.delete(`list`),t.delete(`run`),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectRun:e=>h(t=>{t.set(`run`,e),t.delete(`page`),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectNode:e=>h(t=>{e?t.set(`node`,e):t.delete(`node`),t.delete(`event`),t.delete(`tab`),t.set(`view`,`graph`)}),selectItem:e=>h(t=>{e?t.set(`event`,e):t.delete(`event`)}),showOverall:()=>h(e=>{e.set(`view`,`overall`),e.delete(`node`),e.delete(`event`),e.delete(`tab`)}),selectDetail:e=>h(t=>{e===`activity`?t.delete(`detail`):t.set(`detail`,e)}),selectNodeTab:e=>h(t=>{e===`timeline`?t.delete(`tab`):t.set(`tab`,e),e!==`timeline`&&t.delete(`event`)}),selectView:e=>h(t=>{t.set(`view`,e),t.delete(`node`),t.delete(`event`),t.delete(`tab`)})}}function qZ(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function JZ(){return window.location.search}function YZ(e){return[...e].sort((e,t)=>{let n=e.started_at,r=t.started_at;return n!==void 0&&r===void 0?-1:n===void 0&&r!==void 0?1:(r===void 0?0:Date.parse(r))-(n===void 0?0:Date.parse(n))||Date.parse(t.updated_at)-Date.parse(e.updated_at)||e.id.localeCompare(t.id)})}function XZ(e){let t=new Map;for(let n of e){let e=n.group?.project??`none`,r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t].map(([e,t])=>{let n=YZ(t),r=t[0]?.group?.project??null,i=t.map(e=>e.updated_at).reduce((e,t)=>Date.parse(t)>Date.parse(e)?t:e);return{key:e,project:r,label:r===null?`Other runs`:n.find(e=>e.group?.name)?.group?.name??r,rows:n,updatedAt:i}}).sort((e,t)=>Number(e.project===null)-Number(t.project===null)||Date.parse(t.updatedAt)-Date.parse(e.updatedAt)||e.key.localeCompare(t.key))}function ZZ(e){let{done:t,failed:n,running:r}=e.nodes;return j({done:t,failed:n,running:r})}function QZ(e,t){let n=new Map(e.map(e=>[e.id,JSON.stringify(e)])),r=t.filter(e=>n.get(e.id)!==JSON.stringify(e)).length,i=new Set(t.map(e=>e.id));return r+e.filter(e=>!i.has(e.id)).length}function $Z(e,t,n,r){let[i,a]=(0,R.useState)(new Set),o=(0,R.useCallback)(e=>{a(t=>t.has(e)?t:new Set(t).add(e))},[]),s=(0,R.useCallback)(e=>{a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),c=(0,R.useMemo)(()=>XZ(e??[]),[e]),l=c.find(e=>e.rows.some(e=>e.id===n))?.key,[u,d]=(0,R.useState)();return l!==u&&(d(l),l!==void 0&&o(l)),(0,R.useMemo)(()=>({kinds:[...new Set(e?.flatMap(e=>e.kind?[e.kind]:[])??[])].sort(),groups:c.map(e=>{let n=e.rows.filter(e=>!e.kind||!t.includes(e.kind)),a=n[0];return{key:e.key,label:e.label,runs:n,expanded:i.has(e.key),toggle:()=>s(e.key),open:()=>{o(e.key),a&&r(a.id)}}})}),[e,c,t,i,o,s,r])}var eQ=240,tQ=`data-row-key`;function nQ(e,t){let n=(0,R.useRef)(new Map);(0,R.useLayoutEffect)(()=>{let t=e.current;if(t===null)return;let r=t.getBoundingClientRect().top,i=[...t.querySelectorAll(`[${tQ}]`)],a=new Map(i.map(e=>[e.getAttribute(`data-row-key`)??``,e.getBoundingClientRect().top-r])),o=[...n.current.keys()].filter(e=>a.has(e)),s=[...a.keys()].filter(e=>n.current.has(e));if(o.join(`
|
|
103
|
-
`)!==s.join(`
|
|
104
|
-
`)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of i){let t=n.current.get(e.getAttribute(`data-row-key`)??``),r=a.get(e.getAttribute(`data-row-key`)??``);t===void 0||r===void 0||t===r||e.animate([{transform:`translateY(${t-r}px)`},{transform:`translateY(0)`}],{duration:eQ,easing:`ease-out`})}n.current=a},[e,t])}function rQ({rows:e,failed:t=!1,selectedRunId:n,onSelect:r,onOpenProject:i,onHost:a,hostCurrent:o=!1,onActionItems:s,actionItemsCurrent:c=!1,hiddenKinds:l,onKindsChange:u,updates:d,drawerOpen:f=!1,drawerRef:p}){let{kinds:m,groups:h}=$Z(e,l,n,i??r),g=(0,R.useRef)(null);return nQ(g,h),(0,z.jsx)(`nav`,{"aria-label":`Projects`,className:`run-nav`,"data-open":f,id:`run-navigation`,ref:p,children:(0,z.jsx)(Pu,{className:`h-full`,children:(0,z.jsxs)(`div`,{className:`px-[18px] py-6 max-sm:px-2`,children:[(0,z.jsxs)(`div`,{className:`brand`,children:[(0,z.jsx)(`div`,{"aria-hidden":`true`,className:`brand-mark`,children:(0,z.jsx)(Oe,{size:20})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`eyebrow`,children:`Local orchestration`}),(0,z.jsx)(`h1`,{children:`DAG Observatory`})]})]}),(0,z.jsx)(qu,{className:`my-[22px]`}),(0,z.jsxs)(`div`,{className:`nav-pages`,children:[(0,z.jsx)(ci,{"aria-current":o?`page`:void 0,onClick:a,variant:`ghost`,children:`Host`}),s&&(0,z.jsx)(ci,{"aria-current":c?`page`:void 0,onClick:s,variant:`ghost`,children:`Action items`})]}),m.length>0&&(0,z.jsxs)(`details`,{className:`kind-filter`,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsxs)(`span`,{children:[`Run kinds:`,` `,m.filter(e=>!l.includes(e)).length,` of`,` `,m.length]}),(0,z.jsx)(Pe,{"aria-hidden":`true`,size:14})]}),(0,z.jsxs)(`fieldset`,{children:[(0,z.jsx)(`legend`,{className:`sr-only`,children:`Run kinds`}),m.map(e=>(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:!l.includes(e),onChange:t=>u(t.target.checked?l.filter(t=>t!==e):[...l,e])}),e]},e))]})]}),d,e===void 0?(0,z.jsx)(`p`,{role:`status`,children:t?`Projects did not load`:`Loading projects…`}):(0,z.jsx)(`div`,{className:`nav-rows`,ref:g,children:h.map(e=>(0,z.jsxs)(`fieldset`,{"aria-label":`Project ${e.label}`,className:`project-group`,children:[(0,z.jsxs)(`div`,{className:`project-row`,[tQ]:`project:${e.key}`,children:[(0,z.jsx)(`button`,{"aria-expanded":e.expanded,"aria-label":`${e.expanded?`Collapse`:`Expand`} ${e.label}`,className:`project-toggle`,onClick:e.toggle,type:`button`,children:(0,z.jsx)(Fe,{"aria-hidden":`true`,"data-open":e.expanded,size:12})}),(0,z.jsxs)(`button`,{className:`project-open`,onClick:e.open,type:`button`,children:[(0,z.jsx)(`span`,{className:`project-name`,children:e.label}),(0,z.jsxs)(`span`,{className:`project-count`,children:[e.runs.length,(0,z.jsx)(`span`,{className:`sr-only`,children:` shown runs`})]})]})]}),e.expanded&&e.runs.length===0&&(0,z.jsx)(`p`,{className:`run-list-status`,role:`status`,children:`No runs of the shown kinds.`}),e.expanded&&e.runs.length>0&&(0,z.jsx)(`ul`,{"aria-label":`Runs of ${e.label}`,className:`run-list`,children:e.runs.map(e=>{let t=n===e.id,i=[e.state,ZZ(e)].filter(Boolean).join(` · `);return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{"aria-current":t?`page`:void 0,className:`run-link`,"data-active":t,onClick:()=>r(e.id),title:i,type:`button`,"data-row-key":`run:${e.id}`,children:[(0,z.jsxs)(Bf,{children:[(0,z.jsx)(Vf,{asChild:!0,children:(0,z.jsx)(`span`,{role:`img`,"aria-label":e.state,className:C(`run-dot`,CZ(e.state))})}),(0,z.jsx)(Hf,{children:e.state})]}),(0,z.jsx)(`span`,{className:`run-link-name`,children:e.name}),e.kind&&(0,z.jsx)(`span`,{"aria-label":e.kind,className:`run-link-tag`,role:`note`,children:e.kind}),t&&(0,z.jsx)(`span`,{className:`run-link-counts`,children:i})]})},e.id)})})]},e.key))})]})})})}function iQ(){let[e,t]=(0,R.useState)(!1),n=(0,R.useRef)(null),r=(0,R.useRef)(null),i=(0,R.useRef)(!1),a=(0,R.useCallback)(()=>t(!1),[]),o=(0,R.useCallback)(()=>t(e=>!e),[]);return(0,R.useEffect)(()=>{if(!e)return;let r=e=>{e.key===`Escape`&&t(!1)},i=()=>{n.current?.offsetParent===null&&t(!1)};return document.addEventListener(`keydown`,r),window.addEventListener(`resize`,i),()=>{document.removeEventListener(`keydown`,r),window.removeEventListener(`resize`,i)}},[e]),(0,R.useEffect)(()=>{e?r.current?.querySelector(`button`)?.focus():i.current&&n.current?.focus(),i.current=e},[e]),{open:e,close:a,toggle:o,menuButton:n,drawer:r}}function aQ(e,t){let[n,r]=(0,R.useState)(0),i=(0,R.useRef)(void 0),a=(0,R.useRef)(t);a.current=t;let o=e===`live`,s=(0,R.useRef)(o);s.current=o;let c=(0,R.useCallback)(e=>{i.current=void 0,r(0),a.current(e)},[]),l=(0,R.useCallback)(()=>{i.current!==void 0&&c(i.current.value)},[c]),u=(0,R.useCallback)((e,t=1)=>{s.current?c(e):(i.current={value:e},r(e=>e+t))},[c]),d=(0,R.useCallback)(()=>{i.current=void 0,r(0)},[]);return(0,R.useEffect)(()=>{o&&l()},[o,l]),(0,R.useEffect)(()=>{if(typeof e!=`number`)return;let t=setInterval(l,e*1e3);return()=>clearInterval(t)},[e,l]),{waiting:n,show:c,take:l,offer:u,drop:d}}function oQ(e,t){let[n,r]=(0,R.useState)(),[i,a]=(0,R.useState)(),[o,s]=(0,R.useState)({}),c=(0,R.useRef)([]),[l,u]=(0,R.useState)(),[d,f]=(0,R.useState)(),[p,m]=(0,R.useState)(),[h,g]=(0,R.useState)(),[_,v]=(0,R.useState)(),[y,b]=(0,R.useState)(),[x,S]=(0,R.useState)(0),C=t.runId,w=l===void 0||C!==void 0&&l.some(e=>e.id===C)?C:C!==void 0||t.selectFirst?YZ(l)[0]?.id:void 0,T=(0,R.useMemo)(()=>t.humanItems??k(t.host?void 0:w,t.view,t.nodeId,t.filter),[t.humanItems,t.host,w,t.view,t.nodeId,t.filter]),E=(0,R.useRef)(void 0),D=(0,R.useRef)(T);D.current=T;let O=(0,R.useRef)(t.first),A=aQ(t.navigationUpdates,f),j=aQ(t.mainUpdates,(0,R.useCallback)(e=>{r(e.state),a(e.view);let{visible:t}=e.state;if(t.type===`human-items`){let{items:n,detail:r}=t;s({items:n,detail:r,...e.view.type===`human-items`&&e.view.item!==void 0?{item:e.view.item}:{}})}m(new Date().toISOString()),e.reset!==void 0&&b(`The live view was re-sent whole: ${e.reset}.`)},[])),M=t.navigationUpdates!==`off`||t.mainUpdates!==`off`,N=(0,R.useRef)(M);N.current=M,(0,R.useEffect)(()=>{g(void 0);let t=!0,n=O.current;if(O.current=void 0,n?.error!==void 0){g(n.error);return}let r=e.live({view:D.current,paused:!N.current,...n?.answer!==void 0&&JSON.stringify(n.address.view)===JSON.stringify(D.current)?{initial:n.answer}:{},onState:(e,n)=>{let i=c.current;e.sidebar!==void 0&&(c.current=e.sidebar,u(e.sidebar)),g(void 0),v(void 0);let a={state:e,view:r.view,...n.kind===`reset`?{reset:n.reason}:{}};if(n.kind===`snapshot`){if(j.show(a),e.sidebar!==void 0){if(t)A.show(e.sidebar);else if(i!==e.sidebar){let t=QZ(i,e.sidebar);t>0&&A.offer(e.sidebar,t)}}t=!1;return}if(n.kind===`reset`){e.sidebar!==void 0&&A.offer(e.sidebar),j.offer(a);return}if(n.frame.type===`sidebar.snapshot`){A.show(n.frame.rows);return}let o=n.frame.type===`run.changed`||n.frame.type===`run.removed`;o&&e.sidebar!==void 0&&A.offer(e.sidebar),(!o||e.visible.type===`sidebar`)&&j.offer(a)},onError:e=>{if(r.view.type===`human-items`){s(t=>({...t.items===void 0?{}:{items:t.items},error:e.message})),r.change({type:`sidebar`});return}if(e instanceof HM&&(e.code===`run_not_found`||e.code===`node_not_found`)){r.change({type:`sidebar`});return}g(e)},onDisconnected:()=>v(Error(`Live telemetry stream disconnected`)),onConnected:()=>v(void 0)});return E.current=r,()=>{r.close(),E.current===r&&(E.current=void 0)}},[e,x,j.show,j.offer,A.show,A.offer]),(0,R.useEffect)(()=>{JSON.stringify(E.current?.view)!==JSON.stringify(T)&&j.drop(),E.current?.change(T),T.type!==`human-items`&&s(e=>Object.keys(e).length===0?e:{})},[T,j.drop]),(0,R.useEffect)(()=>{M?E.current?.resume():E.current?.pause()},[M]);let P=(0,R.useCallback)(()=>{A.take(),j.take()},[A.take,j.take]),F=(0,R.useCallback)(()=>{b(void 0),P(),S(e=>e+1)},[P]),I=n?.visible,L=I!==void 0&&I.type!==`sidebar`&&I.type!==`human-items`&&I.run_id===w&&sQ(I,T)&&JSON.stringify(i)===JSON.stringify(T)?I:void 0,ee=(0,R.useRef)(void 0),te=L?.detail??(ee.current?.run.run_id===w?ee.current:void 0);ee.current=te;let ne=(0,R.useMemo)(()=>cQ(te),[te]),re=h!==void 0&&T.type===`timeline`&&te!==void 0;return{rows:l,navigationRows:d,navigationWaiting:A.waiting,hostRows:n?.sidebar,mainWaiting:j.waiting,runId:w,detail:te,timeline:L&&`timeline`in L?L.timeline:void 0,channel:L&&`channel`in L?L.channel:void 0,humanItems:o,timelineError:re?h:void 0,loading:n===void 0&&h===void 0,lastUpdated:p,activity:ne,error:re?_:h??_,notice:y,refresh:F}}function sQ(e,t){return t.type===e.type?t.type===`timeline`&&e.type===`timeline`?t.scope===e.scope&&(t.scope===`run`||e.scope===`node`&&e.node===t.node):!0:!1}function cQ(e){let t=e?.run.live_activity;if(t===void 0)return[];let n=UA.safeParse(t);return n.success?n.data:[]}var lQ={minutes:60,seconds:1},uQ=e=>Object.hasOwn(lQ,e),dQ=600%lQ.minutes==0?{amount:String(600/lQ.minutes),unit:`minutes`}:{amount:`600`,unit:`seconds`};function fQ(e){let t=e.amount.trim();if(!/^\d+$/u.test(t))return;let n=Number(t)*lQ[e.unit];return Number.isSafeInteger(n)?n:void 0}function pQ(e){if(e===0)return`no grace`;let t=Math.floor(e/60),n=e%60,r=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return t===0?r(n,`second`):n===0?r(t,`minute`):`${r(t,`minute`)} ${r(n,`second`)}`}function mQ(e){return e.map(e=>({runId:e.run_id,owner:_e(e.launch)}))}function hQ(e,t){return t instanceof HM&&t.status!==void 0&&t.code!==void 0?{phase:`refused`,sent:e,error:t}:{phase:`lost`,sent:e,error:t instanceof Error?t:Error(String(t))}}var gQ={dispatchStopped:`dispatch-stopped`,hostShutdown:`host-shutdown`};function _Q(e,t,n){let r=new Set(e.runs.map(({runId:e})=>e)),i=Object.values(gQ);return n.flatMap(e=>{if(!r.has(e.run_id))return[];let n=e.last_event;if(n===null||!i.includes(n))return[];let a=t.get(e.run_id);return a!==void 0&&a.last_event===n&&a.last_progress_at===e.last_progress_at?[]:[{runId:e.run_id,recorded:n===gQ.hostShutdown?gQ.hostShutdown:gQ.dispatchStopped}]})}function vQ(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).format(e)}function yQ(e){return(0,R.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.owner,(t.get(n.owner)??0)+1);return[...t].map(([e,t])=>({owner:e,count:t}))},[e])}var bQ=`Each live dispatch is asked to stop and commit, and given the grace to end itself; whatever is still standing then is torn down, and every branch the run's records name is pushed to its origin. Nothing is sent until you confirm.`;function xQ({open:e,onOpenChange:t,runs:n,blocked:r,unreadable:i=0,onConfirm:a}){let o=(0,R.useId)(),[s,c]=(0,R.useState)(dQ),[l,u]=(0,R.useState)(!1),d=fQ(s),f=n!==void 0&&r===void 0,p=()=>{c(dQ),u(!1),t(!1)};return(0,z.jsx)(Wo,{onOpenChange:e=>e?t(!0):p(),open:e,children:(0,z.jsxs)(Jo,{className:`shutdown-dialog`,children:[(0,z.jsxs)(Yo,{children:[(0,z.jsx)(Zo,{children:`Shut down the entire host?`}),(0,z.jsx)(Qo,{children:bQ})]}),(0,z.jsxs)(`div`,{className:`shutdown-dialog-body`,children:[r===void 0?n===void 0?(0,z.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:`Reading which runs this acts on…`}):(0,z.jsx)(CQ,{caption:`It acts on all ${SQ(n.length)} on this host, over their owners — each is interrupted, torn down and pushed:`,label:`Runs on this host`,runs:n,warning:!0}):(0,z.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:r}),i>0&&(0,z.jsxs)(`p`,{className:`shutdown-scope-note`,children:[i===1?`1 run root on this host could not be read`:`${i} run roots on this host could not be read`,`: the engine cannot read them either, so this shutdown signals nothing in them and pushes none of their branches.`]}),(0,z.jsxs)(`fieldset`,{className:`shutdown-grace`,children:[(0,z.jsx)(`legend`,{children:`Grace`}),(0,z.jsxs)(`div`,{className:`shutdown-grace-row`,children:[(0,z.jsx)(ns,{className:`sr-only`,htmlFor:`${o}-grace`,children:`Grace`}),(0,z.jsx)($o,{"aria-describedby":`${o}-grace-help`,"aria-invalid":d===void 0,id:`${o}-grace`,inputMode:`numeric`,min:0,onChange:e=>c({...s,amount:e.target.value}),step:1,type:`number`,value:s.amount}),(0,z.jsx)(ns,{className:`sr-only`,htmlFor:`${o}-unit`,children:`Grace unit`}),(0,z.jsx)(`select`,{className:`composer-select`,id:`${o}-unit`,onChange:e=>{let t=e.target.value;uQ(t)&&c({...s,unit:t})},value:s.unit,children:Object.keys(lQ).map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]}),(0,z.jsx)(`p`,{className:`channel-age`,id:`${o}-grace-help`,children:d===void 0?`The grace is a whole number of minutes or seconds, 0 or more.`:`How long each live dispatch has to end itself once asked: ${pQ(d)}. The engine's default is ${pQ(fQ(dQ)??0)}.`})]}),(0,z.jsxs)(`div`,{className:`composer-check shutdown-force`,children:[(0,z.jsx)(`input`,{checked:l,id:`${o}-force`,onChange:e=>u(e.target.checked),type:`checkbox`}),(0,z.jsx)(ns,{htmlFor:`${o}-force`,children:`Force: skip the interrupt and the wait and go straight to the teardown — whatever a worker had not committed is lost.`})]})]}),(0,z.jsxs)(Xo,{children:[(0,z.jsx)(Ko,{asChild:!0,children:(0,z.jsx)(ci,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,z.jsx)(ci,{disabled:!f||d===void 0,onClick:()=>{d!==void 0&&(a(d,l),p())},type:`button`,variant:`destructive`,children:`Shut down the host`})]})]})})}var SQ=e=>e===1?`1 run`:`${e} runs`;function CQ({caption:e,label:t,runs:n,warning:r=!1}){let i=yQ(n);return(0,z.jsxs)(`div`,{className:`shutdown-runs`,"data-warning":r,children:[(0,z.jsx)(`p`,{className:`shutdown-scope-note`,children:e}),(0,z.jsx)(`ul`,{"aria-label":t,children:i.map(({owner:e,count:t})=>(0,z.jsxs)(`li`,{children:[e,` — `,SQ(t)]},e))})]})}function wQ(e,t,n){let[r,i]=(0,R.useState)(),a=TQ(r!==void 0,e,t,n);return{open:r,setOpen:i,opener:e=>()=>i(e),runs:a.rows===void 0||r===void 0?void 0:mQ(a.rows),blocked:a.blocked,unreadable:e?.unreadable?.length??0}}function TQ(e,t,n,r){let i=(0,R.useRef)(new Set),a=t?.next_cursor;return(0,R.useEffect)(()=>{if(!e){i.current.clear();return}a===void 0||r||i.current.has(a)||(i.current.add(a),n())},[e,a,r,n]),t===void 0?{blocked:`Reading the runs listing this view holds…`}:a===void 0?{rows:t.runs}:!r&&i.current.has(a)?{blocked:`The rest of the runs listing could not be read (${t.runs.length} runs read), so the runs this acts on cannot all be named. Close this and try again.`}:{blocked:`Reading the rest of the runs listing so every run this acts on can be named (${t.runs.length} read so far)…`}}function EQ(e,t){let[n,r]=(0,R.useState)({phase:`idle`}),i=(0,R.useRef)(!1);return{state:n,confirm:(0,R.useCallback)((n,a,o)=>{if(i.current)return;i.current=!0;let s={scope:e,runs:n,grace:a,force:o,sentAt:Date.now()};r({phase:`sending`,sent:s}),t({grace:a,force:o}).then(e=>r({phase:`answered`,sent:s,report:e}),e=>r(hQ(s,e))).finally(()=>{i.current=!1})},[e,t]),dismiss:(0,R.useCallback)(()=>{i.current||r({phase:`idle`})},[])}}var DQ=[`host`];function OQ(e){return{host:EQ(`host`,(0,R.useCallback)(t=>e.shutdown(`host`,t),[e]))}}function kQ({list:e,loadMore:t,loadingMore:n,shutdowns:r}){let{open:i,setOpen:a,opener:o,runs:s,blocked:c,unreadable:l}=wQ(e,t,n),u=r.host.state.phase===`sending`;return(0,z.jsxs)(`fieldset`,{"aria-label":`Shut down runs on this host`,className:`host-shutdown`,children:[(0,z.jsx)(`p`,{className:`eyebrow`,children:`This host`}),(0,z.jsx)(`div`,{className:`host-shutdown-actions`,children:(0,z.jsxs)(ci,{disabled:u,onClick:o(`host`),size:`sm`,type:`button`,variant:`destructive`,children:[(0,z.jsx)(et,{size:14}),` Shut down the entire host`]})}),DQ.map(e=>(0,z.jsx)(xQ,{blocked:c,onConfirm:(e,t)=>s!==void 0&&r.host.confirm(s,e,t),onOpenChange:t=>a(t?e:void 0),open:i===e,runs:i===e?s:void 0,unreadable:l},e))]})}var AQ=1e3;function jQ(e,t){let[n,r]=(0,R.useState)(()=>Date.now());(0,R.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),AQ);return()=>clearInterval(e)},[]);let i=_Q(e,(0,R.useRef)(new Map(t.filter(t=>e.runs.some(({runId:e})=>e===t.run_id)).map(e=>[e.run_id,e]))).current,t);return{now:n,progress:i,done:i.filter(({recorded:e})=>e===gQ.hostShutdown).length,deadline:e.sentAt+e.grace*1e3,asks:!e.force&&e.grace>0}}function MQ({label:e,state:t,rows:n,onDismiss:r}){return t.phase===`idle`?null:(0,z.jsxs)(`section`,{"aria-label":e,className:`shutdown-status`,children:[t.phase===`sending`?(0,z.jsx)(PQ,{rows:n,sent:t.sent}):t.phase===`lost`?(0,z.jsxs)(Lr,{"aria-label":`${e} lost`,variant:`destructive`,children:[(0,z.jsx)(st,{}),(0,z.jsx)(Rr,{children:`Shutdown lost: no answer came back`}),(0,z.jsxs)(zr,{children:[(0,z.jsxs)(`p`,{children:[`The request sent at `,vQ(t.sent.sentAt),` ended without an answer (`,t.error.message,`). The engine may still be carrying out the shutdown — check the runs before sending another.`]}),(0,z.jsx)(NQ,{sent:t.sent})]})]}):t.phase===`refused`?(0,z.jsxs)(Lr,{"aria-label":`${e} refused`,variant:`destructive`,children:[(0,z.jsx)(u,{}),(0,z.jsxs)(Rr,{children:[`Shutdown refused · `,t.error.status,` `,t.error.code]}),(0,z.jsxs)(zr,{children:[(0,z.jsx)(`pre`,{className:`verb-text`,children:t.error.message}),(0,z.jsx)(`p`,{children:`Nothing was signalled and nothing was pushed.`})]})]}):(0,z.jsx)(IQ,{label:e,report:t.report}),t.phase!==`sending`&&(0,z.jsx)(`div`,{className:`composer-actions`,children:(0,z.jsx)(ci,{onClick:r,size:`sm`,type:`button`,variant:`outline`,children:`Dismiss`})})]})}function NQ({sent:e}){return(0,z.jsxs)(`p`,{className:`channel-age`,children:[`Sent `,vQ(e.sentAt),` · scope `,e.scope,` · grace`,` `,pQ(e.grace),e.force?` · forced`:``,` · `,e.runs.length,` `,e.runs.length===1?`run`:`runs`,` in scope`]})}function PQ({sent:e,rows:t}){let{now:n,progress:r,done:i,deadline:a,asks:o}=jQ(e,t);return(0,z.jsxs)(`div`,{"aria-live":`polite`,className:`shutdown-inflight`,role:`status`,children:[(0,z.jsxs)(`p`,{className:`shutdown-inflight-head`,children:[(0,z.jsx)(Ge,{"aria-hidden":`true`,className:`animate-spin`,size:14}),(0,z.jsx)(`strong`,{children:`Shutdown in progress`}),` — still waiting for the engine's answer, `,_(Math.max(0,n-e.sentAt)),` after it was sent.`]}),(0,z.jsx)(NQ,{sent:e}),(0,z.jsx)(`p`,{children:o?n<a?`Waiting out the ${pQ(e.grace)} grace until ${vQ(a)} (${_(a-n)} left) for each live dispatch to end itself; runs are worked through one after another, each with its own grace.`:`The first grace ran out at ${vQ(a)}; the engine is tearing down what is still standing and pushing branches, run by run.`:`Forced: nothing is asked or waited for; the engine is tearing the runs down and pushing their branches.`}),(0,z.jsxs)(`p`,{children:[i,` of `,e.runs.length,` `,e.runs.length===1?`run has`:`runs have`,` recorded their shutdown.`]}),r.length>0&&(0,z.jsx)(`ul`,{"aria-label":`Recorded so far`,children:r.map(({runId:e,recorded:t})=>(0,z.jsxs)(`li`,{children:[e,`:`,` `,t===gQ.hostShutdown?`put down — host-shutdown recorded after its teardown and pushes`:`its dispatches are stopping — dispatch-stopped recorded`]},e))})]})}function FQ(e){let t=e.remote===null?``:` to ${e.remote}`,n=e.commit===null?``:` at ${e.commit}`;switch(e.result){case`pushed`:return`pushed${t}${n}`;case`already-on-origin`:return`already on its origin${t}${n}; nothing was pushed`;case`no-remote`:return`not pushed: this identity has no origin${n}`;case`refused`:return`could not be preserved${n}`}}function IQ({label:e,report:t}){return(0,z.jsxs)(Lr,{"aria-label":`${e} report`,variant:t.complete?`default`:`destructive`,children:[t.complete?(0,z.jsx)(Le,{}):(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:t.complete?`Shutdown complete`:`Shutdown incomplete`}),(0,z.jsxs)(zr,{className:`shutdown-report`,children:[!t.complete&&(0,z.jsx)(`p`,{children:`Not everything went as asked: a dispatch was killed at the deadline or is still running, a teardown was not clean, or a branch could not be preserved. Read the runs below.`}),(0,z.jsxs)(`p`,{className:`channel-age`,children:[`Scope `,t.scope,` · grace `,pQ(t.grace_seconds),t.forced?` · forced`:``,` · runs root `,t.root]}),t.runs.length===0?(0,z.jsx)(`p`,{children:`No run was selected: nothing was signalled.`}):t.runs.map(e=>(0,z.jsxs)(`section`,{"aria-label":`Shutdown of ${e.run_id}`,className:`shutdown-report-run`,children:[(0,z.jsxs)(`h4`,{children:[e.run_id,` · owner `,e.owner,e.forced_over_owner&&` — another session's run, acted on over its owner`]}),e.dispatches.length===0?(0,z.jsx)(`p`,{children:`No live dispatch to interrupt.`}):(0,z.jsx)(`ul`,{"aria-label":`Dispatches of ${e.run_id}`,children:e.dispatches.map(e=>(0,z.jsxs)(`li`,{children:[e.node,` (pid `,e.pid,`): interrupt`,` `,e.interrupt,`; ended `,e.ended,` after`,` `,_(e.waited_ms),(0,z.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.node}-${e.pid}`))}),(0,z.jsxs)(`p`,{children:[`Teardown: `,e.teardown]}),e.branches.length===0?(0,z.jsx)(`p`,{children:`No branch this run's records name.`}):(0,z.jsx)(`ul`,{"aria-label":`Branches of ${e.run_id}`,children:e.branches.map(e=>(0,z.jsxs)(`li`,{children:[e.identity,`@`,e.branch,`: `,FQ(e),(0,z.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.identity}@${e.branch}`))})]},e.run_id)),t.not_pushed_unread===null?t.not_pushed.length===0?(0,z.jsx)(`p`,{children:`Other unpublished branches on this host: none.`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{children:[`Other unpublished branches on this host, which this shutdown did not push (`,t.not_pushed.length,`):`]}),(0,z.jsx)(`ul`,{"aria-label":`Branches not pushed`,children:t.not_pushed.map(({identity:e,branch:t})=>(0,z.jsxs)(`li`,{children:[e,`@`,t]},`${e}@${t}`))})]}):(0,z.jsxs)(`p`,{children:[`Other unpublished branches on this host: not read —`,` `,t.not_pushed_unread,`. This is not a count of zero: there may be work on this host nothing outside it carries.`]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:`The engine's own report`}),(0,z.jsx)(`pre`,{className:`verb-text`,children:t.rendered})]})]})]})}var LQ={crosshair:!0,ticks:{minSpacingPx:80}},RQ=2e3;function zQ(e){let[t,n]=e;if(n-t>=2e3)return e;let r=(t+n)/2;return[r-RQ/2,r+RQ/2]}var BQ=1e3;function VQ({completedAt:e,startedAt:t}){let n=t===void 0?void 0:be(t),r=e===void 0?void 0:be(e),i=HQ(n!==void 0&&r===void 0);return n===void 0?null:r===void 0?(0,z.jsxs)(z.Fragment,{children:[_(i-n.getTime()),` · running`]}):(0,z.jsx)(z.Fragment,{children:_(r.getTime()-n.getTime())})}function HQ(e){let[t,n]=(0,R.useState)(()=>Date.now());return(0,R.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),BQ);return()=>clearInterval(t)},[e]),t}function UQ({control:e}){if(e===void 0)return null;let t=e.addressable?`Turn reachable`:`No turn to reach`,n=e.addressable?`a planner's note can be delivered into the ${e.member??`member`} turn in flight`:e.reason,r=e.addressable?Xe:Je;return(0,z.jsxs)(v,{"aria-label":`${t}: ${n}`,className:C(`node-view-control gap-1.5`,e.addressable?`border-info bg-info-surface text-info`:`border-warning bg-warning-surface text-warning`),title:n,variant:`outline`,children:[(0,z.jsx)(r,{"aria-hidden":`true`,size:12}),t]})}function WQ({failure:e}){return(0,z.jsxs)(`p`,{className:`page-failed`,role:`alert`,children:[(0,z.jsxs)(`span`,{children:[`Earlier rows did not load: `,e.message]}),(0,z.jsx)(`button`,{onClick:e.retry,type:`button`,children:`Try again`})]})}function GQ({failure:e,loading:t,onLoad:n}){return e===void 0?(0,z.jsx)(`button`,{className:`load-earlier`,disabled:t,onClick:n,type:`button`,children:t?`Loading earlier rows…`:`Load earlier rows`}):(0,z.jsx)(WQ,{failure:e})}function KQ(e,t){let[n,r]=(0,R.useState)(null);return(0,R.useLayoutEffect)(()=>{n!==null&&!n.isConnected&&r(null)}),(0,R.useLayoutEffect)(()=>{let i=e.current;if(!t||n!==null||i===null)return;let a=()=>{let e=i.querySelector(`[aria-label^="Timeline plot"]`);return e===null?!1:(getComputedStyle(e).position===`static`&&(e.style.position=`relative`),r(e),!0)};if(a())return;let o=new MutationObserver(()=>{a()&&o.disconnect()});return o.observe(i,{childList:!0,subtree:!0}),()=>o.disconnect()}),n}function qQ({container:e,range:t,stretches:n}){let r=KQ(e,n.length>0);if(r===null)return null;let i=Math.max(t[1]-t[0],1),a=e=>(Math.min(Math.max(e,t[0]),t[1])-t[0])/i*100;return(0,un.createPortal)(n.map(([e,t])=>(0,z.jsx)(`span`,{className:`history-hatch`,"data-from":e,"data-to":t,style:{left:`${a(e)}%`,width:`${a(t)-a(e)}%`},children:(0,z.jsx)(`span`,{className:`history-hatch-label`,children:ee})},`${e}-${t}`)),r)}function JQ(e){return e===`human-step`?`human step`:e}function YQ(e){return e.style===`human-step`}function XQ(e){switch(e){case`not-released`:return`not released yet`;case`awaiting-human-step`:return`waiting for the human step`;case`not-answered`:return`the registry did not answer`;case`not-landed`:return`released, but not carrying this work yet`;default:return e}}function ZQ(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function QQ(e){if(e!==void 0)return e===`live`?`Live — into the turn that was already running`:e===`next`?`Deferred — onto the node's next dispatch`:e}function $Q(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function e$({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:JQ(e.style)],[`Version`,e.version],[`Probe outcome`,e.outcome],[`Probed through`,e.form],[`Probe took`,e.elapsed_ms===void 0?void 0:`${e.elapsed_ms} ms`],[`Acknowledged by`,e.actor],[`Superseded`,ZQ(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,QQ(e.delivery)]].filter(([,e])=>e!==void 0);return(0,z.jsxs)(z.Fragment,{children:[t.length>0&&(0,z.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e}),(0,z.jsx)(`dd`,{children:t})]},e))}),e.awaiting!==void 0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Held on`}),(0,z.jsx)(`ul`,{className:`release-awaiting`,children:e.awaiting.map(e=>(0,z.jsxs)(`li`,{children:[YQ(e)?(0,z.jsxs)(Lr,{children:[(0,z.jsx)(me,{}),(0,z.jsxs)(Rr,{children:[`Waiting on a person · `,$Q(e)]}),(0,z.jsx)(zr,{children:e.action??`The release is a human step and the run recorded no action for it.`})]}):(0,z.jsxs)(`p`,{className:`detail-note`,children:[`Waiting on an automated release · `,$Q(e)]}),(0,z.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:XQ(e.last_answer),e.waited_seconds===void 0?void 0:`waited ${e.waited_seconds}s`].filter(e=>e!==void 0).join(` · `)})]},`${e.dep}·${e.identity??``}·${e.target??``}`))})]}),e.versions!==void 0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Versions adopted`}),(0,z.jsx)(`ul`,{className:`release-awaiting`,children:e.versions.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`p`,{className:`detail-note`,children:[e.identity,` · `,e.target,` · `,e.version]})},`${e.identity}·${e.target}`))})]})]})}function t$({node:e}){let t=e.result?.release??void 0;if(t===void 0)return(0,z.jsx)(z.Fragment,{children:`Not recorded`});let n=t.identity!==e.task?.repo;return(0,z.jsx)(z.Fragment,{children:[t.target,t.style===void 0?void 0:JQ(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function n$({artifactId:e,client:t,runId:n}){let r=AN(`${n}/${e}`,()=>t.getArtifact(n,e),0),i=r.value?.turns??[];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Oneharness conversation`}),r.loading?(0,z.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`Loading conversation…`}):r.value===void 0?(0,z.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`The history store holds no readable copy of that conversation.`}):r.value.unavailable===void 0?(0,z.jsx)(li,{className:`gap-0 py-3`,children:(0,z.jsx)(ui,{className:`px-3`,children:i.map(e=>(0,z.jsx)(YS,{turn:e},e.id))})}):(0,z.jsxs)(Lr,{variant:`destructive`,children:[(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:`Transcript unavailable`}),(0,z.jsx)(zr,{children:r.value.unavailable})]})]})}function r$({artifactId:e,client:t,heading:n,missing:r,noun:i,runId:a,unreadable:o}){let s=i$(e),c=AN(s===void 0?void 0:`${a}/${s}`,()=>t.getArtifact(a,s??``),0),l=c.value?.content;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:n}),s===void 0?(0,z.jsx)(`p`,{className:`detail-note`,children:r}):c.loading?(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`detail-note`,children:[`Loading `,i,`…`]}):l===void 0?(0,z.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:o}):(0,z.jsxs)(z.Fragment,{children:[c.value?.truncated===!0&&(0,z.jsxs)(`p`,{className:`detail-note`,children:[`The server keeps the end of a `,i,` this long; its beginning is not shown.`]}),(0,z.jsx)(`section`,{"aria-label":n,children:(0,z.jsx)(`pre`,{children:l})})]})]})}function i$(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}function a$(e,t,n,r){let[i,a]=(0,R.useState)(),o=t===void 0||n===void 0?void 0:JSON.stringify([t,n]);(0,R.useEffect)(()=>{if(o===void 0||t===void 0||n===void 0)return;let r=!0;return e.getConversation(t,n).then(e=>{r&&a({key:o,conversation:e})}).catch(e=>{if(!r)return;let t=e instanceof Error?e:Error(String(e));a(e=>e?.key===o&&e.conversation!==void 0?e:{key:o,error:t})}),()=>{r=!1}},[e,t,n,o,r]);let s=i?.key===o?i:void 0;return(0,R.useMemo)(()=>({conversation:s?.conversation,error:s?.error,loading:o!==void 0&&s===void 0}),[s,o])}var o$=32;function s$(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function c$(e,t){let n=(0,R.useRef)(null),r=(0,R.useRef)(!0),i=(0,R.useRef)({key:e,count:t}),a=(0,R.useCallback)(()=>{let e=n.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=o$)},[]),o=(0,R.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=s$(e),n.current?.addEventListener(`scroll`,a,{passive:!0}),a()},[a]);return(0,R.useLayoutEffect)(()=>{let a=i.current;i.current={key:e,count:t};let o=a.key===e&&a.count>0&&t>a.count,s=n.current;!o||s===null||!r.current||(s.scrollTop=s.scrollHeight)},[e,t]),o}var l$=25;function u$({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:j$(r),a=i?.kind===`conversation`?i.value:void 0,s=a$(e,t,a,r===void 0?void 0:E$(r));return(0,z.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,z.jsx)(Pu,{className:`h-full`,children:(0,z.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:c$(a,D$(r,s)),children:r===void 0?(0,z.jsxs)(`div`,{className:`detail-placeholder`,children:[(0,z.jsx)(We,{size:30}),(0,z.jsx)(`p`,{children:`Select an item in the timeline to read what it recorded.`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(o,{row:r}),(0,z.jsx)(qu,{className:`my-4`}),(0,z.jsx)(d$,{client:e,runId:t,node:n,reference:i,row:r,transcript:s})]})})})})}function d$({client:e,runId:t,row:n,node:r,reference:i,transcript:a}){let o=O$(n);if(o!==void 0)return(0,z.jsx)(x$,{redirection:o,row:n});let s=k$(n);if(s!==void 0)return(0,z.jsx)(e$,{release:s});let c=A$(n);return c===void 0?i?.kind===`conversation`?(0,z.jsxs)(z.Fragment,{children:[n.rowKind===`event`&&(0,z.jsx)(w$,{row:n,reference:i}),(0,z.jsx)(g$,{row:n,transcript:a})]}):N$(n)?(0,z.jsx)(_$,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&i$(i.value)!==void 0?(0,z.jsx)(v$,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&i$(i.value)!==void 0?(0,z.jsx)(y$,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):P$(n,i)&&r!==void 0?(0,z.jsx)(b$,{node:r,reference:i}):(0,z.jsx)(w$,{reference:i,row:n}):(0,z.jsx)(C$,{row:n,surface:c})}function f$({turn:e}){return e.judges===void 0||e.judges.length===0?null:(0,z.jsx)(`ul`,{"aria-label":`Judges on turn ${e.id}`,className:`judge-decisions`,children:e.judges.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`span`,{className:`judge-decision-who`,children:[e.judge,` (`,e.kind,`)`]}),` `,e.decision,` — `,e.reason]},e.judge))})}function p$(e){return e.tool?.turn??e.id}function m$(e,t){if(e.rowKind!==`event`||e.event.tool===void 0)return;let n=p$(e.event),r=t.find(({id:e})=>e===n);if(r===void 0)return;let{index:i,tool_call_id:a}=e.event.tool;return a!==void 0&&r.tools.some(e=>e.toolCallId===a)?{turnId:r.id,toolCallId:a}:{turnId:r.id,eventIndex:i}}function h$({turn:e}){let t=[e.unknown.instruction_truncated===!0?`its prompt`:void 0,e.unknown.truncated===!0?`its reply`:void 0,e.tools.some(e=>e.output_truncated===!0)?`a tool's output`:void 0,e.tools.some(e=>e.input_truncated===!0)?`a tool's input`:void 0].filter(e=>e!==void 0);return t.length===0?null:(0,z.jsxs)(Lr,{className:`mb-3`,role:`note`,children:[(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:`Cut by the recorder`}),(0,z.jsxs)(zr,{children:[`The run's recorder cut `,t.join(`, `),` to its bound, and no whole copy exists: neither the member's report nor a history file this run names holds it.`]})]})}function g$({row:e,transcript:t}){let[n,r]=(0,R.useState)(l$),i=t.conversation?.conversation.turns??[],a=e.rowKind===`event`?p$(e.event):void 0,o=a===void 0?i:i.filter(({id:e})=>e===a),s=tp(o.map(e=>({id:e.id,time:Date.parse(e.timestamp)})));if(t.loading)return(0,z.jsxs)(`div`,{"aria-live":`polite`,className:`loading-inline`,children:[(0,z.jsx)(Ju,{className:`h-2 w-40`}),(0,z.jsx)(Ju,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,z.jsxs)(Lr,{variant:`destructive`,children:[(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:`Transcript unavailable`}),(0,z.jsx)(zr,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:c,attribution:l}=t.conversation,d=F$(l.agentRole,l.transportRole),f=m$(e,o);return(0,z.jsx)(li,{className:`gap-0 py-3`,children:(0,z.jsxs)(ui,{className:`px-3`,children:[(0,z.jsxs)(`header`,{className:`transcript-header`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`eyebrow`,children:[e.dispatch===void 0?``:`${e.dispatch.label} · `,d,l.persona?` · ${l.persona}`:``]}),(0,z.jsx)(`h4`,{children:c.name})]}),(0,z.jsx)(Wf,{state:c.state})]}),(0,z.jsx)(qu,{className:`my-2.5`}),(0,z.jsx)(`div`,{className:`conversation-timeline-sticky`,children:(0,z.jsx)(ep,{cursor:s.cursor,...f===void 0?{}:{focus:f},onSelectTurn:s.scrollTo,turns:[...o]})}),o.length===0?(0,z.jsx)(`p`,{className:`detail-note`,children:`This turn is no longer part of the recorded transcript.`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{ref:s.containerRef,children:o.slice(0,n).map(e=>(0,z.jsxs)(`div`,{ref:t=>s.register(e.id,t),children:[(0,z.jsx)(h$,{turn:e}),(0,z.jsx)(YS,{author:{label:d},...f?.turnId===e.id?{focus:f}:{},turn:e}),(0,z.jsx)(f$,{turn:e})]},e.id))}),o.length>n&&(0,z.jsxs)(ci,{onClick:()=>r(n+l$),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,o.length,` turns`]})]})]})})}function _$({row:e,client:t,runId:n,reference:r}){let i=e.rowKind===`span`?e.span.detail:void 0,a=i?.artifact_id??(r?.kind===`gate_log`?r.value:void 0);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Verification record`}),(0,z.jsx)(`dl`,{className:`facts`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Result`}),(0,z.jsx)(`dd`,{children:i?.ok===void 0?e.status??`in progress`:i.ok?`passed`:`failed`})]})}),i?.output_tail&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Output`}),(0,z.jsx)(`pre`,{children:i.output_tail})]}),(0,z.jsx)(r$,{artifactId:a,client:t,heading:`Full log`,missing:`No readable log was recorded.`,noun:`log`,runId:n,unreadable:`No readable log was recorded.`}),(0,z.jsxs)(`p`,{className:`detail-note`,children:[`Verification `,e.status??`in progress`,`.`]})]})}function v$({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(r$,{artifactId:e,client:t,heading:`Worker report`,missing:`This settlement recorded no report.`,noun:`report`,runId:i,unreadable:`This run kept no readable copy of that report.`}),(0,z.jsx)(w$,{reference:n,row:r})]})}function y$({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(n$,{artifactId:e,client:t,runId:i}),(0,z.jsx)(w$,{reference:n,row:r})]})}function b$({node:e,reference:t}){let n=e.detail?.verification.checks??[],r=e.detail?.publication;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Publication`}),r?.pr_url&&(0,z.jsx)(T$,{fallback:``,reference:{kind:`pr`,value:r.pr_url}}),r?.merged&&r.commit_url?(0,z.jsx)(`p`,{className:`detail-link`,children:(0,z.jsxs)(`a`,{href:r.commit_url,rel:`noreferrer`,target:`_blank`,children:[`Merged commit `,r.commit?.slice(0,8),` `,(0,z.jsx)(Ve,{size:13})]})}):r?.branch_url?(0,z.jsx)(`p`,{className:`detail-link`,children:(0,z.jsxs)(`a`,{href:r.branch_url,rel:`noreferrer`,target:`_blank`,children:[`Branch `,r.branch,` `,(0,z.jsx)(Ve,{size:13})]})}):!r?.pr_url&&(0,z.jsx)(T$,{fallback:`No publication was recorded.`,reference:t}),(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Observed checks`}),n.length===0?(0,z.jsx)(`p`,{className:`detail-note`,children:`No checks were observed on this node.`}):(0,z.jsx)(`dl`,{className:`facts`,children:n.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.name}),(0,z.jsx)(`dd`,{children:e.url?(0,z.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.state}):e.state})]},e.name))})]})}function x$({redirection:e,row:t}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`dl`,{className:`facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Delivery`}),(0,z.jsx)(`dd`,{children:e.delivered?`Live — into the turn that was already running`:`Deferred — onto the node's next dispatch`})]}),e.turn!==void 0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Turn`}),(0,z.jsx)(`dd`,{children:e.turn===`turn-end`?`Left to end — the note reached it as it ended`:`Interrupted — its replacement opened on the note`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Redirected at`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(f,{at:t.startedAt,relative:!0})})]}),e.member!==void 0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Member`}),(0,z.jsx)(`dd`,{children:e.member})]}),e.input_bytes!==void 0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Note`}),(0,z.jsxs)(`dd`,{children:[e.input_bytes,` bytes offered`]})]}),(0,z.jsx)(S$,{row:t})]}),e.reason!==void 0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Why it was not delivered`}),(0,z.jsx)(`p`,{className:`detail-note`,children:e.reason})]})]})}function S$({row:e}){let t=e.rowKind===`event`?b(e.event):void 0;return t===void 0?null:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Author`}),(0,z.jsx)(`dd`,{children:t})]})}function C$({surface:e,row:t}){let n=[[`Kind`,e.kind],[`Raised by`,e.source],[`Blocking`,e.blocking===void 0?void 0:e.blocking?`yes — dependents wait on the answer`:`no — nothing waits on it`]].filter(([,e])=>e!==void 0);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`dl`,{className:`facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Recorded at`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(f,{at:t.startedAt,relative:!0})})]}),n.map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e}),(0,z.jsx)(`dd`,{children:t})]},e))]}),e.message!==void 0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Message`}),(0,z.jsx)(`p`,{className:`detail-note`,children:e.message})]})]})}function w$({row:e,reference:t}){if(e.rowKind===`event`)return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`dl`,{className:`facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Recorded at`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(f,{at:e.startedAt,relative:!0})})]}),Object.entries(e.event.fields??{}).map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e}),(0,z.jsx)(`dd`,{children:typeof t==`string`?t:JSON.stringify(t)})]},e))]}),t!==void 0&&(0,z.jsx)(T$,{reference:t,fallback:`No recorded artifact.`})]});let n=e.rowKind===`group`?void 0:e,r=e.rowKind===`span`&&e.span.count!==void 0?`${e.span.count} records`:void 0,i=(e.rowKind===`span`?e.span.reasons:void 0)??[];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`dl`,{className:`facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Recorded at`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(f,{at:e.startedAt,relative:!0})})]}),e.rowKind===`span`&&(e.endedAt!==null||e.status===`running`)&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Ended`}),(0,z.jsx)(`dd`,{children:e.endedAt===null?`Still running`:(0,z.jsx)(f,{at:e.endedAt,relative:!0})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Status`}),(0,z.jsx)(`dd`,{children:e.status??`Not recorded`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Duration`}),(0,z.jsx)(`dd`,{children:e.durationMs===null?`Not recorded`:_(e.durationMs)})]}),r!==void 0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Aggregated`}),(0,z.jsx)(`dd`,{children:r})]}),i.length>0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Waiting on`}),(0,z.jsx)(`dd`,{children:i.map(h).join(` and `)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Step`}),(0,z.jsx)(`dd`,{children:M$(n)??`None`})]}),(0,z.jsx)(S$,{row:e})]}),(0,z.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,z.jsx)(T$,{fallback:e.rowKind===`span`&&e.span.kind===`dispatch`?`No transcript was recorded for this dispatch.`:`This item points at no recorded artifact.`,reference:t})]})}function T$({reference:e,fallback:t}){return e===void 0?(0,z.jsx)(`p`,{className:`detail-note`,children:t}):e.value.startsWith(`http`)?(0,z.jsx)(`p`,{className:`detail-link`,children:(0,z.jsxs)(`a`,{href:e.value,rel:`noreferrer`,target:`_blank`,children:[e.value,` `,(0,z.jsx)(Ve,{size:13})]})}):(0,z.jsxs)(`p`,{className:`detail-note`,children:[(0,z.jsx)(`span`,{className:`detail-reference-kind`,children:e.kind}),(0,z.jsx)(`code`,{children:e.value})]})}function E$(e){if(e.rowKind!==`span`)return e.id;let t=e.span.events.at(-1);return[e.span.id,e.span.status??``,e.span.ended_at??``,e.span.events.length,t?.id??``,t?.at??``,t?.status??``].join(`|`)}function D$(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function O$(e){return e.rowKind===`event`?e.event.redirection:void 0}function k$(e){return e.rowKind===`event`?e.event.release:void 0}function A$(e){return e.rowKind===`event`?e.event.surface:void 0}function j$(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function M$(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function N$(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function P$(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function F$(e,t){return we(e,t)}var I$=500,L$=dj.omit({events:!0});function R$(e,t){if(t===void 0)return e;let n=new Set(e.events.map(e=>e.id)),r=t.filter(e=>!n.has(e.id));return r.length===0?e:{...e,events:[...e.events,...r].sort((e,t)=>Date.parse(e.at)-Date.parse(t.at)||(e.journal_order??0)-(t.journal_order??0))}}function z$(e){let t=e.flatMap(e=>{let t=e.events_total;if(t===void 0||t<=e.events.length)return[];let n=e.events[0],r=Date.parse(e.started_at),i=n===void 0?Date.parse(e.ended_at??e.started_at):Date.parse(n.at);return i>r?[[r,i]]:[]}).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n.at(-1);t!==void 0&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}function B$({client:e,runId:t,scope:n,nodeId:r,filter:i,timeline:a}){let o=(0,R.useRef)(new Map),s=(0,R.useRef)(new Map),c=(0,R.useRef)(new Map),l=(0,R.useRef)(new Set),u=(0,R.useRef)(new Set),[d,f]=(0,R.useState)(0),[p,m]=(0,R.useState)(),[h,g]=(0,R.useState)(!1),_=(0,R.useRef)(!1),v=(0,R.useCallback)(()=>f(e=>e+1),[]),y=(0,R.useCallback)(e=>{for(let t of e.rows)o.current.set(t.id,t)},[]),b=(0,R.useCallback)((e,t)=>{m({message:e instanceof Error?e.message:String(e),retry:()=>{m(void 0),t()}}),v()},[v]),x=(0,R.useMemo)(()=>{if(a===void 0)return a;if(n===`node`)for(let e of a.spans)for(let t of e.events)o.current.has(t.id)||o.current.set(t.id,{...t,span_id:e.id});let e=new Map;for(let t of o.current.values()){let n=e.get(t.span_id);n===void 0?e.set(t.span_id,[t]):n.push(t)}return e.size===0&&s.current.size===0?a:{...a,spans:a.spans.map(t=>{let n=R$(t,e.get(t.id)),r=s.current.get(t.id);return r===void 0?n:{...r,...n,events:n.events}})}},[a,d,n]),S=r??``,C=(0,R.useMemo)(()=>n!==`node`||c.current.get(S)===null?[]:z$((x?.spans??[]).filter(e=>!u.current.has(e.id))),[x,n,S,d]),w=n===`node`&&c.current.has(S)?c.current.get(S)!==null:(a?.spans??[]).some(e=>e.events_total!==void 0&&e.events_total>e.events.length),T=n===`node`&&c.current.get(S)===null,E=(0,R.useCallback)(a=>{if(_.current||n!==`node`||r===void 0||c.current.get(S)===null)return;_.current=!0,g(!0);let o=c.current.get(S)??void 0;e.getTimelineEvents(t,{scope:n,node:r,...a===!0?{limit:I$}:{},...o===void 0?{}:{cursor:o},...i===void 0?{}:{filter:i}}).then(e=>{y(e),c.current.set(S,e.next_cursor),v()}).catch(e=>b(e,()=>E(a))).finally(()=>{_.current=!1,g(!1)})},[v,e,S,b,i,r,t,n,y]),D=(0,R.useCallback)(async(r,a)=>{try{let a;for(;;){let o=await e.getTimelineEvents(t,{scope:n,limit:I$,...r,...a===void 0?{}:{cursor:a},...i===void 0?{}:{filter:i}});y(o);let{span:c}=o;if(r.span!==void 0&&c!==void 0&&s.current.set(r.span,L$.parse(c)),o.next_cursor===null&&r.span!==void 0&&r.from===void 0&&r.to===void 0&&u.current.add(r.span),v(),o.next_cursor===null)return;a=o.next_cursor}}catch(e){b(e,a)}},[v,e,b,i,t,n,y]),O=(0,R.useCallback)(e=>{let t=`span:${e}`;l.current.has(t)||(l.current.add(t),D({span:e,...r===void 0?{}:{node:r}},()=>{l.current.delete(t),O(e)}))},[r,D]),k=(0,R.useCallback)(e=>{let t=`row:${e??``}`;l.current.has(t)||(l.current.add(t),D(e===void 0?{}:{node:e},()=>{l.current.delete(t),k(e)}))},[D]),A=(0,R.useCallback)((e,t,n)=>{let r=`stretch:${n??``}:${e}:${t}`;l.current.has(r)||(l.current.add(r),D({...n===void 0?{}:{node:n},from:new Date(e).toISOString(),to:new Date(t).toISOString()},()=>{l.current.delete(r),A(e,t,n)}))},[D]);return{...x===void 0?{}:{timeline:x},unheld:C,canLoadEarlier:w,readToStart:T,loadingEarlier:h,loadEarlier:E,loadSpan:O,loadRow:k,loadStretch:A,...p===void 0?{}:{failure:p}}}var V$=`No earlier history remains`,H$=`This node is not on the run's graph, so the plan holds no task for it.`;function U$({client:e,runId:t,node:n,nodes:r,timeline:i,timelineError:a,filter:o,runLoaded:s=!0,onRetry:c,selectedItemId:l,onSelectItem:d,onBack:f,selectedTab:p,onSelectTab:m}){let h=(0,R.useMemo)(()=>ae(i,n.id),[i,n.id]);(0,R.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(l===void 0?f():d())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,d,l]);let g=n.detail?.publication===void 0?n.result?.pr??void 0:n.detail.publication.pr_url;return(0,z.jsxs)(`section`,{"aria-label":`Timeline for ${n.label}`,className:`node-view`,children:[(0,z.jsxs)(`header`,{className:`node-view-head`,children:[(0,z.jsx)(`nav`,{"aria-label":`Breadcrumb`,children:(0,z.jsxs)(`ol`,{className:`breadcrumb`,children:[(0,z.jsx)(`li`,{children:(0,z.jsxs)(ci,{onClick:f,size:`sm`,type:`button`,variant:`ghost`,children:[(0,z.jsx)(Ae,{size:14}),` Graph`]})}),(0,z.jsx)(`li`,{"aria-current":`page`,children:(0,z.jsx)(`span`,{className:`breadcrumb-node`,children:n.label})})]})}),(0,z.jsxs)(`div`,{className:`node-view-facts`,children:[(0,z.jsx)(xZ,{className:`node-view-state`,state:n.status}),(0,z.jsx)(UQ,{control:n.control}),(0,z.jsxs)(`span`,{className:`node-view-meta`,children:[oe(n),` node ·`,` `,s?`${n.telemetry?.turns??0} turns · ${n.telemetry?.lint??0} lint turns`:`turns ${te}`]}),g!==void 0&&(0,z.jsxs)(`a`,{className:`node-view-pr`,href:g,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,z.jsx)(Ve,{size:12})]})]})]}),(0,z.jsx)(i1,{node:n,nodes:r}),(0,z.jsx)(n1,{node:n}),(0,z.jsx)(r1,{node:n}),(0,z.jsxs)(qd,{className:`node-tabs`,onValueChange:e=>{WZ(e)&&m(e)},value:p,children:[(0,z.jsx)(Yd,{"aria-label":`Node details`,variant:`line`,children:Object.entries(UZ).map(([e,t])=>(0,z.jsx)(Xd,{value:e,children:t},e))}),(0,z.jsxs)(Zd,{className:`node-tab-panel`,value:`task`,children:[n.task===void 0?(0,z.jsx)(`p`,{children:H$}):s?(0,z.jsx)(UY,{source:$$(n.task)}):(0,z.jsx)(`p`,{className:`loading-value`,children:te}),(0,z.jsxs)(`dl`,{className:`facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Settled as`}),(0,z.jsx)(`dd`,{children:a1(n.result?.outcome)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Outcome`}),(0,z.jsx)(`dd`,{children:a1(n.result?.detail)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Graph overrides`}),(0,z.jsx)(`dd`,{children:s?(n.task?.sets??[]).length===0?`None`:(0,z.jsx)(`ol`,{"aria-label":`Graph overrides`,className:`sets-served`,children:n.task?.sets?.map((e,t)=>(0,z.jsx)(`li`,{children:(0,z.jsx)(`code`,{children:e})},t))}):te})]})]})]}),(0,z.jsx)(Zd,{className:`node-tab-panel`,value:`criteria`,children:n.task===void 0?(0,z.jsx)(`p`,{children:H$}):s?(0,z.jsx)(UY,{source:e1(n.task)}):(0,z.jsx)(`p`,{className:`loading-value`,children:te})}),(0,z.jsx)(Zd,{className:`node-tab-panel`,value:`dependencies`,children:(0,z.jsxs)(`dl`,{className:`facts`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Dependencies`}),(0,z.jsx)(`dd`,{children:(n.task?.deps??[]).map(e=>{let t=r.find(t=>t.id===e)?.status;return t===void 0?e:`${e} (${t})`}).join(`, `)||`None`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Unblocks`}),(0,z.jsx)(`dd`,{children:n.dependents.join(`, `)||`None`})]})]})}),(0,z.jsxs)(Zd,{className:`node-tab-panel`,value:`remote`,children:[!s&&(0,z.jsx)(`p`,{className:`loading-value`,children:`Loading…`}),(0,z.jsxs)(`dl`,{className:`facts`,hidden:!s,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Publication`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(t1,{node:n})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Branch`}),(0,z.jsx)(`dd`,{children:n.detail?.publication?.branch??`Not recorded`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Merge`}),(0,z.jsx)(`dd`,{children:n.detail?.publication?n.detail.publication.merged?`Merged`:`Not merged`:`Not recorded`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Release`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(t$,{node:n})})]}),(0,z.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,z.jsx)(`dt`,{children:`Verification coverage`}),(0,z.jsxs)(`dd`,{children:[`Hook:`,` `,n.detail?.verification.pre_push_hook?`present`:`not recorded`,` · `,`Required checks:`,` `,n.detail?.verification.required_checks?.join(`, `)||`none configured`]})]}),(0,z.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,z.jsx)(`dt`,{children:`Observed checks`}),(0,z.jsx)(`dd`,{children:(n.detail?.verification.checks??[]).length===0?`No checks observed`:(0,z.jsxs)(`table`,{"aria-label":`Remote checks`,className:`remote-checks`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:`Name`}),(0,z.jsx)(`th`,{children:`Status`}),(0,z.jsx)(`th`,{children:`Conclusion`}),(0,z.jsx)(`th`,{children:`Runtime`}),(0,z.jsx)(`th`,{children:`Required`})]})}),(0,z.jsx)(`tbody`,{children:n.detail?.verification.checks?.map(e=>(0,z.jsxs)(`tr`,{className:e.status===`completed`&&![`success`,`neutral`,`skipped`].includes(e.conclusion??``)?`check-failing`:void 0,children:[(0,z.jsx)(`th`,{scope:`row`,children:e.url?(0,z.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.name}):e.name}),(0,z.jsx)(`td`,{children:e.status??`Not recorded`}),(0,z.jsx)(`td`,{children:e.conclusion??`—`}),(0,z.jsx)(`td`,{children:(0,z.jsx)(VQ,{...e.started_at===void 0?{}:{startedAt:e.started_at},...e.completed_at===void 0?{}:{completedAt:e.completed_at}})}),(0,z.jsxs)(`td`,{title:e.requirement,className:e.required?`check-required`:`check-optional`,children:[(0,z.jsx)(`svg`,{role:`img`,"aria-label":e.required?`required`:`not required`,width:`12`,height:`12`,viewBox:`0 0 12 12`,children:e.required?(0,z.jsx)(`path`,{d:`M6 0.5 L11 2.5 V6 C11 9 8.5 11 6 11.5 C3.5 11 1 9 1 6 V2.5 Z`,fill:`currentColor`}):(0,z.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`2 1.5`})}),e.required?`Required`:`Optional`]})]},e.name))})]})})]})]})]}),(0,z.jsx)(Zd,{className:`node-timeline-panel`,value:`timeline`,children:a===void 0?i===void 0?(0,z.jsx)(`div`,{"aria-live":`polite`,className:`loading-state`,children:`Loading the recorded timeline…`}):h.rows.length===0?(0,z.jsxs)(li,{className:`m-5 items-center gap-2 p-8 text-muted-foreground`,children:[(0,z.jsx)(`p`,{className:`m-0`,children:`This node has no recorded timeline yet.`}),(0,z.jsx)(`p`,{className:`m-0 text-[11px]`,children:`Spans and events appear here as the run records them.`})]}):(0,z.jsx)(W$,{client:e,...o===void 0?{}:{filter:o},node:n,onSelectItem:d,runId:t,selectedItemId:l,timeline:i}):(0,z.jsxs)(Lr,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:`Timeline unavailable`}),(0,z.jsxs)(zr,{children:[a.message,` `,c!==void 0&&(0,z.jsx)(ci,{onClick:c,size:`sm`,variant:`outline`,children:`Try again`})]})]})})]})]})}function W$({client:e,filter:n,node:a,onSelectItem:o,runId:s,selectedItemId:c,timeline:l}){let u=B$({client:e,runId:s,scope:`node`,nodeId:a.id,timeline:l,...n===void 0?{}:{filter:n}}),d=u.timeline??l,f=(0,R.useMemo)(()=>t(d,a.id),[d,a.id]),[p,h]=(0,R.useState)(()=>new Set),_=(0,R.useMemo)(()=>{if(c!==void 0)return ie(f.tree,c).find(e=>e.rowKind===`group`)?.id},[f.tree,c]),v=(0,R.useMemo)(()=>_===void 0?p:new Set([...p,_]),[p,_]),b=(0,R.useMemo)(()=>m(f.tree,v),[f.tree,v]),x=(0,R.useMemo)(()=>b.flatMap(e=>e.entryKind===`row`?[{id:e.row.id,time:Date.parse(e.row.startedAt)}]:[]),[b]),S=tp(x),[C,w]=(0,R.useState)(!1),[T,E]=(0,R.useState)(),D=(0,R.useMemo)(()=>y(f.items,f.lanes),[f.items,f.lanes]),O=(0,R.useMemo)(()=>r(f.markers,f.items,c),[f.items,f.markers,c]),k=(0,R.useMemo)(()=>G$([...f.items,...f.markers.map(({at:e})=>({start:e}))]),[f.items,f.markers]),A=(0,R.useMemo)(()=>G$([...C?f.items:D,...O.map(({at:e})=>({start:e}))]),[C,f.items,D,O]),j=S.cursor===void 0?void 0:Math.min(Math.max(S.cursor,k[0]),k[1]),M=c===void 0?void 0:i(f.rows,c),N=(0,R.useRef)(0),P=e=>{N.current=Date.now()+500,o(e),S.scrollTo(e)},F=(0,R.useRef)(P);F.current=P;let I=(0,R.useCallback)(e=>F.current(e),[]),L=(0,R.useRef)(null),{containerRef:ee}=S,te=(0,R.useCallback)(e=>{L.current=e,ee(e)},[ee]),ne=(0,R.useRef)(null),re=(0,R.useRef)(void 0),{loadEarlier:ae,loadSpan:oe,loadStretch:se}=u,ce=(0,R.useRef)(void 0),le=()=>{re.current=Y$(L.current),ce.current=x.length,ae()},ue=()=>{u.canLoadEarlier&&!u.loadingEarlier&&u.failure===void 0&&le()};(0,R.useLayoutEffect)(()=>{let e=L.current,t=re.current;if(e===null||t===void 0||u.loadingEarlier)return;re.current=void 0;let n=!1;for(let[r,i]of Y$(e)){let a=t.get(r);if(a===void 0)n=!0;else if(n){e.scrollTop+=i-a;return}}},[d,u.loadingEarlier]);let{canLoadEarlier:de,loadingEarlier:fe}=u,pe=x.length;(0,R.useEffect)(()=>{let e=ce.current;if(!(e===void 0||fe)){if(pe>e||!de||u.failure!==void 0){ce.current=void 0;return}re.current=Y$(L.current),ae(!0)}},[pe,de,fe,ae,u.failure]),(0,R.useEffect)(()=>{c!==void 0&&M===void 0&&de&&!fe&&u.failure===void 0&&ae()},[c,M,de,fe,ae,u.failure]);let me=M?.rowKind===`span`?M.span.id:void 0;(0,R.useEffect)(()=>{me!==void 0&&oe(me)},[me,oe]),(0,R.useEffect)(()=>{if(T===void 0)return;let e=setTimeout(()=>se(T[0],T[1],a.id),250);return()=>clearTimeout(e)},[T,se,a.id]);let{scrollTo:he}=S;return(0,R.useEffect)(()=>{c!==void 0&&(N.current=Date.now()+500,he(c))},[c,he]),(0,z.jsxs)(`div`,{className:`node-execution`,"data-expanded":C,children:[(0,z.jsxs)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,ref:ne,children:[(0,z.jsx)(qQ,{container:ne,range:T??A,stretches:u.unheld}),(0,z.jsx)(St,{...LQ,axis:{origin:k[0]},cursor:j,expanded:C,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:C?f.items:D,lanes:f.lanes,markers:O,onExpandedChange:w,onRangeChange:e=>E(e[0]<=A[0]&&e[1]>=A[1]?void 0:zQ(e)),onSelect:e=>P(e.id),range:T??A,selectedId:c})]}),(0,z.jsxs)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,onKeyDown:e=>{q$.has(e.key)&&J$(e.currentTarget)&&ue()},onScroll:e=>{J$(e.currentTarget)&&Date.now()>N.current&&ue()},onWheel:e=>{e.deltaY<0&&J$(e.currentTarget)&&ue()},ref:te,children:[u.readToStart&&u.failure===void 0&&(0,z.jsx)(`p`,{className:`history-start`,role:`status`,children:V$}),(u.canLoadEarlier||u.failure!==void 0)&&(0,z.jsx)(GQ,{...u.failure===void 0?{}:{failure:u.failure},loading:u.loadingEarlier,onLoad:le}),g(b).map(e=>{let t=e.entries.map(e=>e.entryKind===`row`?(0,z.jsx)(Q$,{onOpen:I,register:S.register,row:e.row,selected:e.row.id===c},e.row.id):(0,z.jsx)(X$,{entry:e,onToggle:()=>h(t=>{let n=new Set(t);return n.has(e.group.id)?n.delete(e.group.id):n.add(e.group.id),n})},`collapse-${e.group.id}`));return e.dispatch===void 0?(0,z.jsx)(R.Fragment,{children:t},e.id):(0,z.jsxs)(`section`,{"aria-label":e.dispatch.label,className:`transcript-dispatch`,children:[(0,z.jsx)(`h3`,{children:e.dispatch.label}),t]},e.id)})]}),M!==void 0&&(0,z.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,z.jsx)(ci,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>o(),size:`icon`,variant:`ghost`,children:(0,z.jsx)(ut,{})}),(0,z.jsx)(u$,{client:e,node:a,row:M,runId:s})]})]})}function G$(e){let t=e.map(({start:e})=>e),n=e.map(e=>e.end??e.start);if(t.length===0)return[0,1];let r=Math.min(...t),i=Math.max(...n);return[r,i>r?i:r+1]}var K$=120,q$=new Set([`ArrowUp`,`PageUp`,`Home`]);function J$(e){return e.scrollTop<K$}function Y$(e){let t=new Map;for(let n of e?.querySelectorAll(`article.transcript-item[data-row-id]`)??[])t.set(n.dataset.rowId??``,n.getBoundingClientRect().top);return t}function X$({entry:e,onToggle:t}){let n=Te(e.hidden,e.group.kind);return(0,z.jsx)(`p`,{className:`transcript-collapsed`,children:(0,z.jsxs)(`button`,{"aria-expanded":e.expanded,onClick:t,type:`button`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),e.expanded?`Collapse ${n}`:`Show ${n}`]})})}function Z$(e,t){let[n,r]=[e.row,t.row];return e.selected===t.selected&&e.register===t.register&&e.onOpen===t.onOpen&&n.id===r.id&&n.rowKind===r.rowKind&&n.displayLabel===r.displayLabel&&n.displayKind===r.displayKind&&n.startedAt===r.startedAt&&n.durationMs===r.durationMs&&n.status===r.status&&n.sessionName===r.sessionName&&n.dispatch?.label===r.dispatch?.label&&(n.rowKind===`event`&&r.rowKind===`event`?n.category===r.category&&n.event.seq===r.event.seq:n.rowKind!==`event`&&r.rowKind!==`event`)}var Q$=(0,R.memo)(function({row:e,selected:t,register:n,onOpen:r}){let{id:i}=e,a=(0,R.useCallback)(e=>n(i,e),[n,i]);return(0,z.jsx)(`article`,{"aria-label":e.displayLabel,className:`transcript-item`,"data-dispatch-group":e.dispatch?.label,"data-journal-seq":e.rowKind===`event`?e.event.seq:void 0,"data-row-id":e.id,"data-selected":t,ref:a,children:(0,z.jsxs)(`button`,{"aria-label":`Open ${e.displayLabel}`,onClick:()=>r(e.id),type:`button`,children:[(0,z.jsxs)(`span`,{className:`eyebrow`,children:[e.rowKind===`event`&&(0,z.jsx)(s,{category:e.category}),e.displayKind]}),(0,z.jsx)(`strong`,{children:e.displayLabel}),(0,z.jsxs)(`span`,{className:`transcript-facts`,children:[(0,z.jsx)(f,{at:e.startedAt}),e.durationMs!==null&&` · ${_(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})},Z$);function $$(e){if(e.task!==void 0)return e.task;let t=e.steps??[];return t.length===0?`No task prose recorded.`:t.map(e=>`## ${e.id}\n\n${e.task}`).join(`
|
|
105
|
-
|
|
106
|
-
`)}function e1(e){let t=$$(e),n=/(?:^|\n)##[ \t]*acceptance[ \t]+criteria[ \t]*\r?\n([\s\S]*?)(?=\r?\n##[ \t]|$)/i.exec(t)?.[1]?.trim();return n===void 0||n.length===0?`No acceptance criteria recorded in this node's task.`:n}function t1({node:e}){let t=e.detail?.publication;if(t===void 0)return typeof e.result?.pr==`string`&&e.result.pr?(0,z.jsxs)(`a`,{className:`node-view-pr`,href:e.result.pr,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,z.jsx)(Ve,{size:12})]}):(0,z.jsx)(z.Fragment,{children:`Not recorded`});let n=(t.merged?[[t.pr_url,`Pull request`],[t.commit_url,`Commit ${t.commit?.slice(0,8)??``}`]]:[[t.pr_url,`Pull request`],[t.branch_url,t.branch??`Branch`]]).filter(([e])=>e);return n.length===0?(0,z.jsx)(z.Fragment,{children:`Not recorded`}):(0,z.jsx)(z.Fragment,{children:n.map(([e,t],n)=>(0,z.jsxs)(`span`,{children:[n>0&&` · `,(0,z.jsxs)(`a`,{className:`node-view-pr`,href:e,rel:`noreferrer`,target:`_blank`,children:[t,` `,(0,z.jsx)(Ve,{size:12})]})]},e))})}function n1({node:e}){let t=ce(e);if(t.length===0)return null;let n=e.result?.detail?.trim()||void 0;return(0,z.jsxs)(`section`,{"aria-label":`Awaited releases`,className:`node-awaiting m-5 rounded-lg border border-warning bg-warning-surface px-4 py-3 text-warning`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,z.jsx)(Ze,{size:16}),e.status===`complete-but-held`?`Complete, and held unlanded until its releases arrive`:`Complete, and held as a draft until its releases arrive`]}),(0,z.jsxs)(`dl`,{className:`facts facts-stacked`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:t.length===1?`Awaits`:`Awaits ${t.length}`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`ul`,{className:`awaited-releases`,children:t.map(e=>(0,z.jsxs)(`li`,{children:[`the `,(0,z.jsx)(`strong`,{children:e.target}),` release of`,` `,(0,z.jsx)(`code`,{children:e.producer})]},`${e.producer} ${e.target}`))})})]}),n!==void 0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Detail`}),(0,z.jsx)(`dd`,{children:n})]})]})]})}function r1({node:e}){if(e.kind!==`command`)return null;let t=e.task?.command,n=e.task?.timeout_seconds,r=e.result?.outcome,i=e.result?.log;return(0,z.jsxs)(`section`,{"aria-label":`Command`,className:`node-command m-5`,children:[(0,z.jsxs)(`dl`,{className:`facts`,children:[t!==void 0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Command`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`code`,{children:t.join(` `)})})]}),n!==void 0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Timeout`}),(0,z.jsxs)(`dd`,{children:[n,` seconds`]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Outcome`}),(0,z.jsx)(`dd`,{children:r??e.status})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Log`}),(0,z.jsx)(`dd`,{children:i===void 0?`The command has not started.`:i.path})]})]}),i?.content===void 0?i!==void 0&&(0,z.jsx)(`p`,{className:`node-command-log-missing`,children:`The log is not readable from this run.`}):(0,z.jsxs)(`figure`,{className:`node-command-log-figure`,children:[(0,z.jsx)(`figcaption`,{children:`Command log`}),(0,z.jsx)(`pre`,{className:`node-command-log`,children:i.truncated===!0?`…${i.content}`:i.content})]})]})}function i1({node:e,nodes:t}){if(!ue(e.status))return null;let n=e.status===`blocked`||e.status===`skipped`,r=fe(e),i=e.result?.error||void 0,a=e.result?.exit_code;return(0,z.jsxs)(Lr,{className:C(`m-5 w-auto`,n&&`border-warning bg-warning-surface text-warning`),variant:n?`default`:`destructive`,children:[n?(0,z.jsx)(Ze,{}):(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:n?`This node is ${e.status}`:`This node ${e.status===`cancelled`?`was cancelled`:e.status===`not-completed`?`did not complete`:`failed`}${e.failure?`: ${e.failure.class}`:``}`}),(0,z.jsx)(zr,{children:(0,z.jsxs)(`dl`,{className:`facts`,children:[n&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.status===`skipped`?`Unmet`:`Blocked by`}),(0,z.jsx)(`dd`,{children:e.blockers.length>0?e.blockers.map(e=>{let n=t.find(t=>t.id===e)?.status;return n===void 0?e:`${e} (${n})`}).join(`, `):`Nothing recorded; the run has not written what holds it.`})]}),e.status===`skipped`&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Attempts`}),(0,z.jsx)(`dd`,{children:`Never attempted`})]}),!n&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Detail`}),(0,z.jsx)(`dd`,{children:r??`No reason was recorded for this outcome.`})]}),i!==void 0&&i!==r&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Error`}),(0,z.jsx)(`dd`,{children:i})]}),typeof a==`number`&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:`Exit code`}),(0,z.jsx)(`dd`,{children:a})]})]})})]})}function a1(e){return e==null||e===``?`Not recorded`:typeof e==`string`?e:JSON.stringify(e,null,2)}function o1(e){let[t,n]=(0,R.useState)(!1);return{open:t,onToggle:(0,R.useCallback)(t=>{let r=t.currentTarget.open;n(r),r&&e?.()},[e])}}function s1({label:e,className:t,onOpen:n,children:r}){let i=o1(n);return(0,z.jsxs)(`details`,{"aria-label":e,className:t,open:i.open,onToggle:i.onToggle,children:[(0,z.jsx)(`summary`,{children:e}),i.open&&r]})}function c1({client:t,detail:n,nodes:r,timeline:i,timelineError:o,filter:s,onRetry:c,journalSeq:l,onSelectNode:d,selectedItemId:m,onSelectItem:h}){let g=n.run.run_id,_=B$({client:t,runId:g,scope:`run`,...s===void 0?{}:{filter:s},...i===void 0?{}:{timeline:i}}),v=_.timeline,y=D(n.progress),b=!y||Ce(n,`telemetry`)||Ce(n,`run.timing`)||Ce(n,`run.usage`),x=Ee(n),S=(0,R.useMemo)(()=>A(v,r),[v,r]),C=(v?.spans??[]).filter(e=>e.node_id===void 0),w=C.find(e=>e.id===m),T=C.flatMap(e=>e.events).find(e=>(e.record_id??e.id)===m)??C.flatMap(e=>e.events).find(e=>e.id===m),E=w===void 0?T===void 0?void 0:a(T):p(w),{loadSpan:O,loadRow:k}=_;(0,R.useEffect)(()=>{m!==void 0&&E===void 0&&v!==void 0&&k(void 0)},[m,E,v,k]);let j=w?.id;return(0,R.useEffect)(()=>{j!==void 0&&O(j)},[j,O]),(0,R.useEffect)(()=>{let e=e=>{e.key===`Escape`&&m!==void 0&&h()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h,m]),(0,z.jsxs)(`div`,{className:`overall-view`,"data-journal-seq":l,children:[(0,z.jsx)(Pu,{className:`h-full`,children:(0,z.jsxs)(`div`,{className:`p-[34px] max-sm:p-3`,children:[(0,z.jsxs)(`section`,{className:`overall-hero`,children:[(0,z.jsx)(`p`,{className:`eyebrow`,children:`Whole DAG`}),(0,z.jsx)(`h2`,{children:g}),n.graph?.plan.goal?.text&&(0,z.jsx)(`p`,{className:`run-goal`,children:n.graph.plan.goal.text}),(0,z.jsxs)(`p`,{children:[n.run.phase,` ·`,` `,n.run.last_event?`last event ${n.run.last_event}`:`no events recorded yet`]})]}),(0,z.jsxs)(`section`,{"aria-label":`Run records`,children:[(0,z.jsx)(s1,{label:`Timing and usage`,children:b?(0,z.jsx)(`p`,{className:`loading-value`,children:te}):(0,z.jsxs)(z.Fragment,{children:[x!==void 0&&(0,z.jsxs)(`p`,{className:`loading-value`,children:[`as of `,(0,z.jsx)(f,{at:x}),`, updating`]}),(0,z.jsx)(pK,{value:n.telemetry})]})}),(0,z.jsx)(s1,{label:`Goal and repository identities`,children:(0,z.jsx)(pK,{value:{goal:n.graph?.plan.goal,repositories:[...new Set(n.graph?.plan.tasks.flatMap(e=>e.repo?[e.repo]:[])??[])]}})}),(0,z.jsx)(s1,{label:`Recorded results`,children:(0,z.jsx)(pK,{value:n.graph?.result})}),(0,z.jsx)(s1,{label:`Provider health`,children:y?(0,z.jsx)(pK,{value:n.provider_health}):(0,z.jsx)(`p`,{className:`loading-value`,children:te})})]}),(0,z.jsxs)(`section`,{"aria-label":`Run metrics`,className:`metric-grid`,children:[(0,z.jsx)(d1,{icon:(0,z.jsx)(Oe,{}),label:`Status`,value:n.run.state}),(0,z.jsx)(d1,{icon:(0,z.jsx)(Ue,{}),label:`Nodes`,value:String(n.run.nodes.length)}),(0,z.jsx)(d1,{icon:(0,z.jsx)(ze,{}),label:`Wall time`,value:n.run.timing.wall_seconds===null?`not measured`:e(n.run.timing.wall_seconds)}),(0,z.jsx)(d1,{icon:(0,z.jsx)(Be,{}),label:`Turns`,value:typeof n.run.turns==`number`?String(n.run.turns):te})]}),(0,z.jsx)(li,{className:`gap-0 py-[15px]`,children:(0,z.jsxs)(ui,{className:`px-[15px]`,children:[(0,z.jsxs)(`div`,{className:`section-heading`,children:[(0,z.jsx)(Oe,{size:16}),(0,z.jsx)(`h3`,{children:`Graph timeline`})]}),o===void 0?v===void 0?(0,z.jsx)(`p`,{"aria-live":`polite`,className:`m-0 text-[11px] text-muted-foreground`,children:`Loading the run's timeline…`}):v.spans.length===0?(0,z.jsx)(`p`,{className:`m-0 text-[11px] text-muted-foreground`,children:`This run has recorded no timeline yet.`}):(0,z.jsx)(l1,{failureShown:E===void 0,graph:S,history:_,runRecordsToLoad:C.some(e=>e.events_total===void 0||e.events_total>e.events.length),onOpenNode:d,onOpenItem:h,selectedItemId:m}):(0,z.jsxs)(Lr,{className:`live-issue`,variant:`destructive`,children:[(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:`Timeline unavailable`}),(0,z.jsxs)(zr,{children:[o.message,` `,c!==void 0&&(0,z.jsx)(ci,{onClick:c,size:`sm`,variant:`outline`,children:`Try again`})]})]})]})})]})}),E!==void 0&&(0,z.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,z.jsx)(ci,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>h(),size:`icon`,variant:`ghost`,children:(0,z.jsx)(ut,{})}),(0,z.jsx)(u$,{client:t,row:E,runId:g}),_.failure!==void 0&&(0,z.jsx)(WQ,{failure:_.failure})]})]})}function l1({failureShown:e,graph:t,history:n,runRecordsToLoad:r,onOpenNode:i,onOpenItem:a,selectedItemId:o}){let[s,c]=(0,R.useState)(),[l,u]=(0,R.useState)(!1),[d,p]=(0,R.useState)(new Set),m=s??t.range,[h,g]=(0,R.useState)(!1),{loadRow:_,loadStretch:v}=n;(0,R.useEffect)(()=>{if(s===void 0)return;let e=setTimeout(()=>v(s[0],s[1],void 0),250);return()=>clearTimeout(e)},[s,v]);let y=e=>{e.kind===`record`&&e.nodeId===void 0||e.nodeId===void 0?a(e.id):i(e.nodeId)},b=t.line.lanes.filter(({id:e})=>t.line.items.some(t=>t.laneId===e));return(0,z.jsxs)(`div`,{className:`graph-timeline`,"data-rows-open":l,children:[(0,z.jsx)(St,{...LQ,axis:{origin:t.range[0]},expanded:!1,items:t.line.items,label:`Graph timeline`,lanes:b,markers:t.line.markers,onExpandedChange:u,onRangeChange:e=>c(zQ(e)),onSelect:e=>y(e.payload),range:m,selectedId:o}),t.line.markers.some(e=>e.at>t.range[1])&&(0,z.jsxs)(`section`,{"aria-label":`Records after execution`,className:`p-3 border-t`,children:[(0,z.jsx)(`h3`,{className:`eyebrow`,children:`After execution ended`}),t.line.markers.filter(e=>e.at>t.range[1]).map(e=>(0,z.jsxs)(ci,{onClick:()=>y(e.payload),variant:`outline`,size:`sm`,children:[e.payload.label,` ·`,` `,(0,z.jsx)(f,{at:e.payload.startedAt})]},e.id))]}),e&&n.failure!==void 0&&(0,z.jsx)(WQ,{failure:n.failure}),r&&!h&&(0,z.jsx)(`button`,{className:`load-earlier`,onClick:()=>{g(!0),_(void 0)},type:`button`,children:`Load the run's own records`}),l&&(0,z.jsx)(`ol`,{className:`graph-rows`,children:t.rows.map(e=>(0,z.jsx)(u1,{onOpen:y,onOpenNode:i,onExpandedChange:t=>{t&&_(e.nodeId),p(n=>{let r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})},expanded:d.has(e.id),origin:t.range[0],range:m,onRangeChange:e=>c(zQ(e)),row:e,selectedItemId:o},e.id))})]})}function u1({row:e,range:t,origin:n,expanded:r,onExpandedChange:i,onRangeChange:a,onOpen:o,onOpenNode:s,selectedItemId:c}){let l=e.nodeId;return(0,z.jsxs)(`li`,{className:`graph-row`,"data-row-kind":e.kind,children:[(0,z.jsxs)(`header`,{className:`graph-row-head`,children:[l===void 0?(0,z.jsx)(`span`,{className:`graph-row-name`,children:e.label}):(0,z.jsx)(`button`,{className:`graph-row-name`,onClick:()=>s(l),type:`button`,children:e.label}),(0,z.jsxs)(`span`,{className:`graph-row-facts`,children:[_(e.workedMs),` recorded · `,_(e.idleMs),` `,`idle`]})]}),(0,z.jsx)(St,{...LQ,axis:{origin:n},expanded:r,items:r?e.items:e.line,label:`${e.label} timeline`,lanes:e.lanes,markers:e.markers,onExpandedChange:i,onRangeChange:a,onSelect:e=>o(e.payload),range:t,selectedId:c})]})}function d1({icon:e,label:t,value:n}){return(0,z.jsxs)(li,{"aria-label":t,className:`metric flex-row items-center gap-3 p-4`,role:`group`,children:[e,(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{children:t}),(0,z.jsx)(`strong`,{children:n})]})]})}var f1=6,p1=8,m1=`[aria-describedby^="timeline-detail-"]`,h1=e=>{if(!(e instanceof Element))return;let t=l(e);if(t!==void 0)return t;let n=e.closest(m1);if(!(n instanceof HTMLElement))return;let r=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return r?{element:n,detail:r}:void 0},g1=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t;function _1(){let e=(0,R.useRef)(null),[t,n]=(0,R.useState)(),[r,i]=(0,R.useState)(),a=t??r,o=(0,R.useCallback)(()=>{n(void 0),i(void 0)},[]);(0,R.useEffect)(()=>{let e=e=>n(t=>g1(t,h1(e.target))),t=e=>i(t=>g1(t,h1(e.target))),r=e=>i(t=>g1(t,h1(e.relatedTarget))),a=()=>n(void 0);return document.addEventListener(`pointerover`,e),document.addEventListener(`pointerleave`,a),document.addEventListener(`focusin`,t),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`pointerover`,e),document.removeEventListener(`pointerleave`,a),document.removeEventListener(`focusin`,t),document.removeEventListener(`focusout`,r)}},[]);let s=(0,R.useCallback)(()=>{let t=e.current;if(t===null||a===void 0)return;if(!a.element.isConnected)return o();let n=a.element.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.innerWidth-r.width-p1,s=Math.min(Math.max(n.left,p1),Math.max(p1,i)),c=n.bottom+f1,l=n.top-r.height-f1,u=Math.max(p1,window.innerHeight-r.height-p1),d=c+r.height<=window.innerHeight-p1?c:l,f=Math.min(Math.max(d,p1),u);t.style.left=`${Math.round(s)}px`,t.style.top=`${Math.round(f)}px`,t.style.visibility=`visible`},[a,o]);return(0,R.useLayoutEffect)(s,[s]),(0,R.useEffect)(()=>{if(a!==void 0)return window.addEventListener(`scroll`,s,!0),window.addEventListener(`resize`,s),()=>{window.removeEventListener(`scroll`,s,!0),window.removeEventListener(`resize`,s)}},[a,s]),a===void 0?null:(0,un.createPortal)((0,z.jsx)(`div`,{"aria-hidden":`true`,className:`timeline-popover`,"data-testid":`timeline-popover`,ref:e,style:{visibility:`hidden`},children:a.detail},a.detail),document.body)}var v1=[{setting:`live`,label:`Live`},{setting:10,label:`Every 10 seconds`},{setting:30,label:`Every 30 seconds`},{setting:60,label:`Every minute`},{setting:300,label:`Every 5 minutes`},{setting:`off`,label:`Off`}],y1=`live`,b1={navigation:`dag-ui.updates.navigation`,main:`dag-ui.updates.main`};function x1(e){return v1.find(({setting:t})=>String(t)===e)?.setting}function S1(e){try{return window.localStorage.getItem(e)}catch{return null}}function C1(e,t){try{window.localStorage.setItem(e,String(t))}catch{}}function w1(e,t){let[n,r]=(0,R.useState)(()=>x1(S1(e))??t);return[n,(0,R.useCallback)(t=>{r(t),C1(e,t)},[e])]}function T1(){let[e,t]=w1(b1.navigation,30),[n,r]=w1(b1.main,y1);return{navigation:e,setNavigation:t,main:n,setMain:r}}function E1({name:e,caption:t,setting:n,waiting:r,onChange:i}){return(0,z.jsxs)(`div`,{className:`update-setting`,children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:t}),(0,z.jsx)(`select`,{"aria-label":e,onChange:e=>{let t=x1(e.target.value);t!==void 0&&i(t)},value:String(n),children:v1.map(({setting:e,label:t})=>(0,z.jsx)(`option`,{value:String(e),children:t},e))})]}),r>0&&(0,z.jsxs)(`output`,{"aria-label":`${e} waiting`,className:`update-waiting`,children:[r,` waiting`]})]})}var D1=new WM(window.location.origin,{fetch:window.fetch.bind(window)}),O1=Object.entries(VZ);function k1(e){let t=(0,R.useRef)({value:e,count:0});return t.current.value!==e&&(t.current={value:e,count:t.current.count+1}),t.current.count}var A1=()=>Promise.resolve();function j1({client:e=D1,first:t,onDrawn:n}){let r=KZ(),i=IZ(),a=r.host||i.active,o=QX(i.active),s=VZ[r.detail].profile,c=T1(),l=iQ(),d=oQ(e,{runId:r.runId,view:re(r.view,r.nodeId),nodeId:r.nodeId,filter:s,selectFirst:!a,host:a,humanItems:o.view,navigationUpdates:c.navigation,mainUpdates:c.main,...t===void 0?{}:{first:t}}),p=d.rows,m=d.runId,h=d.activity.at(-1),g=d.detail,_=(0,R.useMemo)(()=>g?N(g):[],[g]),v=MN(e,m),y=OQ(e),[b,x]=(0,R.useState)(0),S=y.host.state.phase===`sending`,C=k1(p),{list:w,error:T}=vK(e,r.host||S,b+(S?C:0)),E=g===void 0?void 0:ne(g),k=D(g?.progress),A=g?.progress?.failed??d.timeline?.progress?.failed,j=!a&&(g?.progress?.complete===!1||d.timeline?.progress?.complete===!1),M=!a&&g===void 0&&d.error!==void 0,P=(0,R.useRef)(!1);(0,R.useLayoutEffect)(()=>{P.current||(g!==void 0||d.error!==void 0)&&(P.current=!0,n?.())},[g,d.error,n]);let F=I(g,_,r.nodeId);return(0,R.useEffect)(()=>{if(a||!p)return;let e=XZ(p),t=e.find(e=>e.rows.some(e=>e.id===r.runId)),n=t?.rows.find(e=>e.id===r.runId),i=(t?.rows??e.flatMap(e=>e.rows)).filter(e=>!e.kind||!r.hiddenKinds.includes(e.kind));(!r.runId||n?.kind&&r.hiddenKinds.includes(n.kind))&&i[0]&&r.selectRun(i[0].id)},[p,r,a]),(0,R.useEffect)(()=>{if(m&&r.runId&&r.runId!==m){let e=new URLSearchParams(window.location.search);e.set(`run`,m),e.delete(`node`),e.delete(`event`),e.set(`view`,r.view),window.history.replaceState(null,``,`${window.location.pathname}?${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}},[r.runId,m,r.view]),(0,z.jsxs)(zf,{children:[(0,z.jsx)(_1,{}),(0,z.jsxs)(`div`,{className:`app-shell`,children:[(0,z.jsx)(rQ,{rows:d.navigationRows,failed:d.rows===void 0&&d.error!==void 0,selectedRunId:m,onSelect:e=>{r.selectRun(e),l.close()},onOpenProject:r.selectRun,onHost:()=>{r.selectHost(),l.close()},hostCurrent:r.host&&!i.active,onActionItems:()=>{i.open(),l.close()},actionItemsCurrent:i.active,hiddenKinds:r.hiddenKinds,onKindsChange:r.selectKinds,drawerOpen:l.open,drawerRef:l.drawer,updates:(0,z.jsx)(E1,{caption:`Navigation`,name:`Navigation updates`,onChange:c.setNavigation,setting:c.navigation,waiting:d.navigationWaiting})}),l.open&&(0,z.jsx)(`button`,{"aria-label":`Close navigation`,className:`nav-scrim`,onClick:l.close,type:`button`}),(0,z.jsxs)(`main`,{className:`workspace`,inert:l.open,children:[(0,z.jsxs)(`section`,{"aria-label":m&&!a?`Run header`:`Workspace header`,className:`topbar${m&&!a?` run-topbar`:``}`,children:[(0,z.jsx)(`button`,{"aria-controls":`run-navigation`,"aria-expanded":l.open,"aria-label":`Open navigation`,className:`nav-menu`,onClick:l.toggle,ref:l.menuButton,type:`button`,children:(0,z.jsx)(qe,{"aria-hidden":`true`,size:18})}),(0,z.jsx)(`div`,{className:`topbar-title`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`eyebrow`,children:`Execution telemetry`}),(0,z.jsx)(`h2`,{children:i.active?`Action items`:r.host?`Host`:m??`No DAG selected`})]})}),(0,z.jsxs)(`div`,{className:`topbar-actions`,children:[!a&&m!==void 0&&(0,z.jsx)(ON,{control:v,runId:m,ended:g!==void 0&&(g.run.state===`settled`||g.run.state.startsWith(`ended-`))}),(0,z.jsxs)(`span`,{className:`connection`,children:[(0,z.jsx)(rt,{size:15}),d.lastUpdated===void 0?`Waiting for first update`:(0,z.jsxs)(z.Fragment,{children:[`Last updated`,` `,(0,z.jsx)(f,{at:d.lastUpdated,relative:!0})]})]}),!a&&h!==void 0&&(0,z.jsxs)(`button`,{className:`last-activity connection`,type:`button`,title:`${h.node}: ${M1(h)}`,onClick:()=>{r.selectNode(h.node),r.selectItem(h.event_id)},children:[h.node,`: `,M1(h)]})]}),(0,z.jsxs)(`div`,{className:`main-updates`,children:[(0,z.jsx)(E1,{caption:`Updates`,name:`Main area updates`,onChange:c.setMain,setting:c.main,waiting:d.mainWaiting}),(0,z.jsxs)(ci,{onClick:()=>{x(e=>e+1),d.refresh()},size:`sm`,type:`button`,variant:`outline`,children:[(0,z.jsx)(tt,{size:14}),` Refresh`]})]})]}),!a&&g&&(0,z.jsxs)(s1,{label:`Run details`,className:`run-header-details`,onOpen:v.reread,children:[(0,z.jsxs)(`p`,{children:[`Launching session:`,` `,k?_e(g.launch):`Loading…`]}),v.status.error&&(0,z.jsxs)(`p`,{role:`alert`,children:[`Status unavailable: `,v.status.error.message]}),v.status.value&&(0,z.jsxs)(`dl`,{children:[(0,z.jsx)(`dt`,{children:`Summary`}),(0,z.jsx)(`dd`,{children:v.status.value.summary}),(0,z.jsx)(`dt`,{children:`Graph state`}),(0,z.jsx)(`dd`,{children:O(v.status.value.node_status)}),(0,z.jsx)(`dt`,{children:`Unread surfaces`}),(0,z.jsx)(`dd`,{children:v.status.value.unread_surfaces.count}),(0,z.jsx)(`dt`,{children:`Oldest unread (seconds)`}),(0,z.jsx)(`dd`,{children:v.status.value.unread_surfaces.oldest_seconds??`None`}),(0,z.jsx)(`dt`,{children:`Last progress`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(`output`,{"aria-label":`Last progress`,children:k?g.run.last_progress_at===void 0?`Not recorded`:(0,z.jsx)(f,{at:new Date(g.run.last_progress_at*1e3).toISOString(),relative:!0}):`Loading…`})})]}),v.status.value&&(0,z.jsx)(`section`,{"aria-label":`Node statuses`,children:(0,z.jsx)(pK,{value:v.status.value.node_status})})]}),d.error&&!M&&(0,z.jsxs)(Lr,{className:`live-issue rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:`Live telemetry issue`}),(0,z.jsxs)(zr,{children:[d.error.message,` `,(0,z.jsx)(ci,{onClick:d.refresh,size:`sm`,type:`button`,variant:`outline`,children:`Try again`})]})]}),A!==void 0&&(0,z.jsxs)(Lr,{className:`live-issue rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,z.jsx)(u,{}),(0,z.jsx)(Rr,{children:`The rest of this run's history did not load`}),(0,z.jsxs)(zr,{children:[A,` `,(0,z.jsx)(ci,{onClick:d.refresh,size:`sm`,type:`button`,variant:`outline`,children:`Try again`})]})]}),d.notice&&(0,z.jsx)(`p`,{className:`live-notice`,role:`status`,children:d.notice}),(0,z.jsx)(MQ,{label:`Shutdown of the entire host`,onDismiss:y.host.dismiss,rows:w?.runs??[],state:y.host.state}),i.active?(0,z.jsx)(aZ,{client:e,live:d.humanItems,choice:o.choice,setChoice:o.setChoice,selectedId:o.selectedId,setSelectedId:o.setSelectedId}):r.host?(0,z.jsx)(_K,{client:e,listError:T,onRefresh:()=>x(e=>e+1),list:w,rows:d.hostRows,children:(0,z.jsx)(kQ,{list:w,loadMore:A1,loadingMore:!1,shutdowns:y})}):(0,z.jsxs)(qd,{className:`min-h-0 flex-1 gap-0`,onValueChange:e=>e===`overall`?r.showOverall():e===`graph`?r.selectNode(void 0):RZ(e)?r.selectView(e):void 0,value:r.view,children:[(0,z.jsxs)(`div`,{className:`view-tabs`,children:[(0,z.jsxs)(Yd,{"aria-label":`DAG views`,variant:`line`,children:[(0,z.jsxs)(Xd,{value:`graph`,children:[(0,z.jsx)(lt,{size:15}),` Graph`]}),(0,z.jsxs)(Xd,{value:`overall`,children:[(0,z.jsx)(nt,{size:15}),` Overall`]}),(0,z.jsxs)(Xd,{value:`channel`,children:[(0,z.jsx)(He,{size:15}),` Channel`]})]}),(0,z.jsxs)(`fieldset`,{className:`detail-switch`,children:[(0,z.jsx)(`legend`,{className:`sr-only`,children:`Level of detail`}),O1.map(([e,{label:t,description:n}])=>(0,z.jsx)(ci,{"aria-pressed":r.detail===e,onClick:()=>r.selectDetail(e),size:`sm`,title:n,type:`button`,variant:r.detail===e?`default`:`outline`,children:t},e))]})]}),(0,z.jsx)(Zd,{className:`min-h-0`,value:r.view,children:M&&d.error?(0,z.jsx)(`div`,{className:`loading-state`,children:(0,z.jsxs)(`div`,{className:`read-failed`,role:`alert`,children:[(0,z.jsx)(`strong`,{children:`This run's history did not load`}),(0,z.jsx)(`p`,{children:d.error.message}),(0,z.jsx)(`button`,{onClick:d.refresh,type:`button`,children:`Try again`})]})}):!g&&(d.loading||m!==void 0)?(0,z.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,z.jsx)(Ju,{className:`h-2 w-48`}),(0,z.jsx)(Ju,{className:`h-2 w-32`}),`Loading execution history…`]}):g&&m?r.view===`channel`?(0,z.jsx)(mN,{channel:d.channel,client:e,decisions:E?.decisions,filter:s,journalSeq:E?.last_seq,observedAt:g.observed_at,overrides:E&&k?he(E):void 0,runId:m}):r.view===`overall`?(0,z.jsx)(c1,{client:e,detail:g,filter:s,journalSeq:E?.last_seq,nodes:_,onRetry:d.refresh,timeline:d.timeline,timelineError:d.timelineError,onSelectNode:r.selectNode,onSelectItem:r.selectItem,selectedItemId:r.itemId},`${m}:${s??``}`):F?(0,z.jsx)(U$,{client:e,filter:s,runLoaded:k,onRetry:d.refresh,node:F,nodes:_,onBack:()=>r.selectNode(void 0),onSelectItem:r.selectItem,runId:m,selectedItemId:r.itemId,selectedTab:r.nodeTab,onSelectTab:r.selectNodeTab,timeline:d.timeline,timelineError:d.timelineError},`${m}:${F.id}:${s??``}`):(0,z.jsx)(fK,{journalSeq:E?.last_seq,nodes:_,rejectedEdits:E?.rejected_edits,selectedNodeId:r.nodeId,onSelectNode:r.selectNode}):(0,z.jsxs)(`div`,{className:`empty-state`,children:[(0,z.jsx)(lt,{size:34}),(0,z.jsx)(`h2`,{children:`No DAG runs found`}),(0,z.jsx)(`p`,{children:`Start an orchestrated run to see it appear here.`})]})})]})]}),j&&A===void 0&&(0,z.jsx)(`p`,{className:`history-loading`,role:`status`,children:`The rest of this run's history is still loading`})]})]})}function M1(e){return e.description||e.kind}var N1=class extends R.Component{state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`DAG UI render failed`,e,t.componentStack)}render(){return this.state.error?(0,z.jsxs)(`main`,{className:`fatal-error`,role:`alert`,children:[(0,z.jsx)(`p`,{className:`eyebrow`,children:`Rendering error`}),(0,z.jsx)(`h1`,{children:`The DAG view could not be displayed.`}),(0,z.jsx)(`p`,{children:this.state.error.message}),(0,z.jsx)(ci,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}};function P1(e,t,n){let r=n===void 0?e:document.createElement(`div`);r!==e&&(r.setAttribute(`data-app-behind-first-screen`,``),r.style.cssText=`position:fixed;inset:0;visibility:hidden;`,document.body.appendChild(r)),(0,tk.createRoot)(r).render((0,z.jsx)(R.StrictMode,{children:(0,z.jsx)(N1,{children:(0,z.jsx)(j1,{first:t,onDrawn:()=>{r!==e&&(n?.unmount(),e.replaceWith(r),r.id=`root`,r.removeAttribute(`data-app-behind-first-screen`),r.style.cssText=``)}})})}))}export{P1 as mountApp};
|