fifony 0.1.47 → 0.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +78 -0
  2. package/app/dist/assets/CommandPalette-CZDG20HW.js +1 -0
  3. package/app/dist/assets/{KeyboardShortcutsHelp-CqEFfGcE.js → KeyboardShortcutsHelp-TYhQc4aA.js} +1 -1
  4. package/app/dist/assets/OnboardingWizard-CQ9YmVIT.js +1 -0
  5. package/app/dist/assets/agents.lazy-CgakDm_P.js +1 -0
  6. package/app/dist/assets/analytics.lazy-C0rw3sov.js +1 -0
  7. package/app/dist/assets/{createLucideIcon-luywpIq4.js → createLucideIcon-B3bah5lk.js} +1 -1
  8. package/app/dist/assets/hooks-CNPue7d7.js +1 -0
  9. package/app/dist/assets/index-B8XCmr0-.css +1 -0
  10. package/app/dist/assets/index-Dfn02uW3.js +47 -0
  11. package/app/dist/assets/index.lazy-JdqhBwPd.js +44 -0
  12. package/app/dist/assets/services-CHpVij2M.css +1 -0
  13. package/app/dist/assets/services.lazy-BShKUCOt.js +12 -0
  14. package/app/dist/assets/vendor-X6HTElZW.js +9 -0
  15. package/app/dist/assets/viz-Dsh_q2DK.js +4 -0
  16. package/app/dist/index.html +5 -4
  17. package/app/dist/service-worker.js +32 -1
  18. package/dist/agent/run-local.js +89 -76
  19. package/dist/{agent-DFSFG6DG.js → agent-DJ4SCNBZ.js} +22 -17
  20. package/dist/{analytics-broadcaster-O4AE3RUK.js → analytics-broadcaster-INNYWHDJ.js} +25 -20
  21. package/dist/approve-plan.command-WE2CO3H2.js +21 -0
  22. package/dist/{chunk-HOIOVUHI.js → chunk-5M7PBFMZ.js} +8 -6
  23. package/dist/chunk-7R7XFXJM.js +1247 -0
  24. package/dist/{chunk-2PRRKBG6.js → chunk-A4P2MYJF.js} +22 -9
  25. package/dist/chunk-AFOV3ZAF.js +722 -0
  26. package/dist/chunk-AFP36N23.js +134 -0
  27. package/dist/{chunk-AAZKYWOY.js → chunk-AFYKGVSP.js} +103 -8
  28. package/dist/chunk-APJOZXRP.js +737 -0
  29. package/dist/chunk-DLSPRIQL.js +241 -0
  30. package/dist/{chunk-5AMWD66T.js → chunk-EDIPHR5B.js} +6 -4
  31. package/dist/{chunk-K36BWMUV.js → chunk-JU3MF3MW.js} +2526 -736
  32. package/dist/{chunk-7TXZYZR5.js → chunk-N5HCNY4O.js} +7 -5
  33. package/dist/{chunk-JRLWLZOD.js → chunk-NKMZYPIS.js} +31 -23
  34. package/dist/{chunk-PI7Y77R3.js → chunk-OFIVTM2E.js} +17 -7
  35. package/dist/{chunk-QH6VCTET.js → chunk-RCSJFMQG.js} +909 -98
  36. package/dist/{chunk-AAVROEQC.js → chunk-UR7T7IA6.js} +253 -349
  37. package/dist/{chunk-QHISYRXJ.js → chunk-VOYLU3MI.js} +57 -3
  38. package/dist/{chunk-EBCSQFPR.js → chunk-W5IULOWV.js} +2 -3
  39. package/dist/chunk-X37RNTWU.js +193 -0
  40. package/dist/{chunk-PACI3T4I.js → chunk-XY2APMDE.js} +13 -5
  41. package/dist/chunk-Z6ZWNWWR.js +34 -0
  42. package/dist/cli.js +45 -17
  43. package/dist/constants-AAP7ZGCX.js +124 -0
  44. package/dist/create-issue.command-SX3AXXIC.js +29 -0
  45. package/dist/fsm-agent-JGV22WK4.js +59 -0
  46. package/dist/{fsm-issue-EHTSKMFN.js → fsm-issue-LHIJM5VB.js} +12 -8
  47. package/dist/{fsm-service-7O4AJG2R.js → fsm-service-GGDKUTWS.js} +13 -4
  48. package/dist/{helpers-ON2S7UEF.js → helpers-AENVYEZJ.js} +6 -2
  49. package/dist/{issue-log-broadcaster-FZGVEEIX.js → issue-log-broadcaster-QQWM7LOV.js} +29 -18
  50. package/dist/{issues-3YNNTB4U.js → issues-RXFKKSXB.js} +10 -7
  51. package/dist/{log-analyzer-EIX6R6PP.js → log-analyzer-4LNXQISY.js} +30 -20
  52. package/dist/{logger-IFLXTQPS.js → logger-4F6ATWNA.js} +2 -1
  53. package/dist/mcp/server.js +6 -2
  54. package/dist/merge-workspace.command-ZNGIZC4O.js +29 -0
  55. package/dist/{parallel-executor-DWESCNX3.js → parallel-executor-OL5CB33L.js} +78 -19
  56. package/dist/{pid-manager-UBWXVSMD.js → pid-manager-EDT4DHAU.js} +2 -1
  57. package/dist/queue-workers-NSKIIMQ2.js +43 -0
  58. package/dist/replan-issue.command-73PETERX.js +21 -0
  59. package/dist/retry-issue.command-DIDP4OCS.js +21 -0
  60. package/dist/reverse-proxy-server-QSS3H4UH.js +97 -0
  61. package/dist/scheduler-5YORYECF.js +37 -0
  62. package/dist/service-log-broadcaster-JIUP2L3D.js +21 -0
  63. package/dist/{settings-SOTIS6ZD.js → settings-ZNDXYL46.js} +34 -23
  64. package/dist/settings.resource-OKUHXICJ.js +35 -0
  65. package/dist/{store-S3NAYZ3S.js → store-P3ACO6YA.js} +22 -17
  66. package/dist/telemetry-KVUFHDQS.js +828 -0
  67. package/dist/template-variants-HEPLYKMP.js +24 -0
  68. package/dist/trace-bundle-IJOV7IWH.js +41 -0
  69. package/dist/{web-push-QCTLS7EJ.js → web-push-X2LLMQ4M.js} +2 -1
  70. package/dist/websocket-Q2TUCIC2.js +103 -0
  71. package/dist/{workspace-OS7GPMCN.js → workspace-TDX3NJCX.js} +10 -6
  72. package/package.json +12 -9
  73. package/app/dist/assets/CommandPalette-CL8p78lG.js +0 -1
  74. package/app/dist/assets/OnboardingWizard-BmI50ZUv.js +0 -1
  75. package/app/dist/assets/analytics.lazy-CXGjZabc.js +0 -1
  76. package/app/dist/assets/index-CEaccpYh.js +0 -96
  77. package/app/dist/assets/index-CzzWGzux.css +0 -1
  78. package/app/dist/assets/vendor-uqBx3VSC.js +0 -9
  79. package/dist/approve-plan.command-QGQZZXTQ.js +0 -17
  80. package/dist/chunk-N4KFNX2G.js +0 -370
  81. package/dist/chunk-VM5QAYP5.js +0 -404
  82. package/dist/create-issue.command-VAKYRECC.js +0 -24
  83. package/dist/merge-workspace.command-T2NIGR4M.js +0 -24
  84. package/dist/queue-workers-V57BYXAY.js +0 -38
  85. package/dist/replan-issue.command-2GQ3QXCR.js +0 -17
  86. package/dist/retry-issue.command-GJBUUYDJ.js +0 -17
  87. package/dist/scheduler-KYILMWLD.js +0 -32
  88. package/dist/settings.resource-JMD3JQOS.js +0 -30
  89. package/dist/websocket-T2Y3BY4B.js +0 -61
@@ -0,0 +1,44 @@
1
+ import{n as e,r as t,t as n}from"./rolldown-runtime-Dw2cE7zH.js";import{I as r,d as i,f as a,h as o,m as s,o as c}from"./vendor-X6HTElZW.js";import{t as l}from"./api-CEr_D4e5.js";import{$ as u,A as d,F as f,N as p,P as m,T as h,_ as g,_t as _,b as v,ct as y,ft as b,ht as x,j as S,k as C,pt as w,q as T,ut as E,w as D,z as O}from"./index-Dfn02uW3.js";function k(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ee=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,A=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,j={};function M(e,t){return((t||j).jsx?A:ee).test(e)}var te=/[ \t\n\f\r]/g;function ne(e){return typeof e==`object`?e.type===`text`?N(e.value):!1:N(e)}function N(e){return e.replace(te,``)===``}var P=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};P.prototype.normal={},P.prototype.property={},P.prototype.space=void 0;function re(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new P(n,r,t)}function ie(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var ae=e({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>ce,number:()=>R,overloadedBoolean:()=>se,spaceSeparated:()=>z}),oe=0,I=le(),L=le(),se=le(),R=le(),z=le(),ce=le(),B=le();function le(){return 2**++oe}var ue=Object.keys(ae),de=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),fe(this,`space`,r),typeof n==`number`)for(;++i<ue.length;){let e=ue[i];fe(this,ue[i],(n&ae[e])===ae[e])}}};de.prototype.defined=!0;function fe(e,t,n){n&&(e[t]=n)}function pe(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new de(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ie(r)]=r,n[ie(a.attribute)]=r}return new P(t,n,e.space)}var me=pe({properties:{ariaActiveDescendant:null,ariaAtomic:L,ariaAutoComplete:null,ariaBusy:L,ariaChecked:L,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:z,ariaCurrent:null,ariaDescribedBy:z,ariaDetails:null,ariaDisabled:L,ariaDropEffect:z,ariaErrorMessage:null,ariaExpanded:L,ariaFlowTo:z,ariaGrabbed:L,ariaHasPopup:null,ariaHidden:L,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:z,ariaLevel:R,ariaLive:null,ariaModal:L,ariaMultiLine:L,ariaMultiSelectable:L,ariaOrientation:null,ariaOwns:z,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:L,ariaReadOnly:L,ariaRelevant:null,ariaRequired:L,ariaRoleDescription:z,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:L,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function he(e,t){return t in e?e[t]:t}function ge(e,t){return he(e,t.toLowerCase())}var _e=pe({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ce,acceptCharset:z,accessKey:z,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:z,autoFocus:I,autoPlay:I,blocking:z,capture:null,charSet:null,checked:I,cite:null,className:z,cols:R,colSpan:null,content:null,contentEditable:L,controls:I,controlsList:z,coords:R|ce,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:se,draggable:L,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:z,height:R,hidden:se,high:R,href:null,hrefLang:null,htmlFor:z,httpEquiv:z,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:z,itemRef:z,itemScope:I,itemType:z,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,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:I,optimum:R,pattern:null,ping:z,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:z,required:I,reversed:I,rows:R,rowSpan:R,sandbox:z,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:L,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:L,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:z,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:L,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:I,disableRemotePlayback:I,prefix:null,property:null,results:R,security:null,unselectable:null},space:`html`,transform:ge}),ve=pe({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:B,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:z,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:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,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:ce,g2:ce,glyphName:ce,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:B,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,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:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:z,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:B,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:B,rev:B,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:B,requiredFeatures:B,requiredFonts:B,requiredFormats:B,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:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:B,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:B,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:B,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:he}),ye=pe({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()}}),be=pe({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ge}),xe=pe({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Se={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`},Ce=/[A-Z]/g,we=/-[a-z]/g,Te=/^data[-\w.:]+$/i;function Ee(e,t){let n=ie(t),r=t,i=F;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Te.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(we,Oe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!we.test(e)){let n=e.replace(Ce,De);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=de}return new i(r,t)}function De(e){return`-`+e.toLowerCase()}function Oe(e){return e.charAt(1).toUpperCase()}var ke=re([me,_e,ye,be,xe],`html`),Ae=re([me,ve,ye,be,xe],`svg`);function je(e){return e.join(` `).trim()}var Me=n(((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,u=`
2
+ `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),Ne=n((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(Me());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}})),Pe=n((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))}})),Fe=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Ne()),r=Pe();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})),Ie=Re(`end`),Le=Re(`start`);function Re(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 ze(e){let t=Le(e),n=Ie(e);if(t&&n)return{start:t,end:n}}function Be(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?He(e.position):`start`in e||`end`in e?He(e):`line`in e||`column`in e?Ve(e):``}function Ve(e){return Ue(e&&e.line)+`:`+Ue(e&&e.column)}function He(e){return Ve(e&&e.start)+`-`+Ve(e&&e.end)}function Ue(e){return e&&typeof e==`number`?e:1}var V=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=Be(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}};V.prototype.file=``,V.prototype.name=``,V.prototype.reason=``,V.prototype.message=``,V.prototype.stack=``,V.prototype.column=void 0,V.prototype.line=void 0,V.prototype.ancestors=void 0,V.prototype.cause=void 0,V.prototype.fatal=void 0,V.prototype.place=void 0,V.prototype.ruleId=void 0,V.prototype.source=void 0;var We=t(Fe(),1),Ge={}.hasOwnProperty,Ke=new Map,qe=/[A-Z]/g,Je=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Ye=new Set([`td`,`th`]),Xe=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ze(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=ct(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=st(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`?Ae:ke,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Qe(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Qe(e,t,n){if(t.type===`element`)return $e(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return et(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return nt(e,t,n);if(t.type===`mdxjsEsm`)return tt(e,t);if(t.type===`root`)return rt(e,t,n);if(t.type===`text`)return it(e,t)}function $e(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Ae,e.schema=i),e.ancestors.push(t);let a=mt(e,t.tagName,!1),o=lt(e,t),s=dt(e,t);return Je.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!ne(e):!0})),at(e,o,a,t),ot(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function et(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)}ht(e,t.position)}function tt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ht(e,t.position)}function nt(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Ae,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:mt(e,t.name,!0),o=ut(e,t),s=dt(e,t);return at(e,o,a,t),ot(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function rt(e,t,n){let r={};return ot(r,dt(e,t)),e.create(t,e.Fragment,r,n)}function it(e,t){return t.value}function at(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ot(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function st(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 ct(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Le(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 lt(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ge.call(t.properties,i)){let a=ft(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Ye.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 ut(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 ht(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 ht(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function dt(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ke;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=Qe(e,a,o);s!==void 0&&n.push(s)}return n}function ft(e,t,n){let r=Ee(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?k(n):je(n)),r.property===`style`){let t=typeof n==`object`?n:pt(e,String(n));return e.stylePropertyNameCase===`css`&&(t=gt(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Se[r.property]||r.property:r.attribute,n]}}function pt(e,t){try{return(0,We.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new V("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=Xe+`#cannot-parse-style-attribute`,r}}function mt(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=M(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=M(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Ge.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);ht(e)}function ht(e,t){let n=new V("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=Xe+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function gt(e){let t={},n;for(n in e)Ge.call(e,n)&&(t[_t(n)]=e[n]);return t}function _t(e){let t=e.replace(qe,vt);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function vt(e){return`-`+e.toLowerCase()}var yt={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`]},bt={};function xt(e,t){let n=t||bt;return St(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function St(e,t,n){if(wt(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 Ct(e.children,t,n)}return Array.isArray(e)?Ct(e,t,n):``}function Ct(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=St(e[i],t,n);return r.join(``)}function wt(e){return!!(e&&typeof e==`object`)}var Tt=document.createElement(`i`);function Et(e){let t=`&`+e+`;`;Tt.innerHTML=t;let n=Tt.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function H(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 U(e,t){return e.length>0?(H(e,e.length,0,t),e):t}var Dt={}.hasOwnProperty;function Ot(e){let t={},n=-1;for(;++n<e.length;)kt(t,e[n]);return t}function kt(e,t){let n;for(n in t){let r=(Dt.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Dt.call(r,a)||(r[a]=[]);let e=i[a];At(r[a],Array.isArray(e)?e:e?[e]:[])}}}function At(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);H(e,0,0,r)}function jt(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 Mt(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var W=Bt(/[A-Za-z]/),G=Bt(/[\dA-Za-z]/),Nt=Bt(/[#-'*+\--9=?A-Z^-~]/);function Pt(e){return e!==null&&(e<32||e===127)}var Ft=Bt(/\d/),It=Bt(/[\dA-Fa-f]/),Lt=Bt(/[!-/:-@[-`{-~]/);function K(e){return e!==null&&e<-2}function q(e){return e!==null&&(e<0||e===32)}function J(e){return e===-2||e===-1||e===32}var Rt=Bt(/\p{P}|\p{S}/u),zt=Bt(/\s/);function Bt(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Vt(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&G(e.charCodeAt(n+1))&&G(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 Y(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return J(r)?(e.enter(n),s(r)):t(r)}function s(r){return J(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Ht={tokenize:Ut};function Ut(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`),Y(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 K(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Wt={tokenize:Kt},Gt={tokenize:qt};function Kt(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 H(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(Gt,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(Gt,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 K(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++;H(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 qt(e,t,n){return Y(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Jt(e){if(e===null||q(e)||zt(e))return 1;if(Rt(e))return 2}function Yt(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 Xt={name:`attention`,resolveAll:Zt,tokenize:Qt};function Zt(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};$t(d,-c),$t(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=U(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=U(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=U(l,Yt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=U(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=U(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,H(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 Qt(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Jt(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=Jt(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 $t(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var en={name:`autolink`,tokenize:tn};function tn(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 W(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||G(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||G(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||Pt(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Nt(t)?(e.consume(t),l):n(t)}function u(e){return G(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||G(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var nn={partial:!0,tokenize:rn};function rn(e,t,n){return r;function r(t){return J(t)?Y(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||K(e)?t(e):n(e)}}var an={continuation:{tokenize:sn},exit:cn,name:`blockQuote`,tokenize:on};function on(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 J(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function sn(e,t,n){let r=this;return i;function i(t){return J(t)?Y(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(an,t,n)(r)}}function cn(e){e.exit(`blockQuote`)}var ln={name:`characterEscape`,tokenize:un};function un(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 Lt(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var dn={name:`characterReference`,tokenize:fn};function fn(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=G,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=It,u):(e.enter(`characterReferenceValue`),a=7,o=Ft,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===G&&!Et(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 pn={partial:!0,tokenize:gn},mn={concrete:!0,name:`codeFenced`,tokenize:hn};function hn(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`),J(t)?Y(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||K(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(pn,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||K(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):J(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Y(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||K(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||K(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&&J(t)?Y(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||K(t)?e.check(pn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||K(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),J(t)?Y(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),J(t)?Y(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||K(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function gn(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 _n={name:`codeIndented`,tokenize:yn},vn={partial:!0,tokenize:bn};function yn(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Y(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):K(t)?e.attempt(vn,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||K(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function bn(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Y(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):K(e)?i(e):n(e)}}var xn={name:`codeText`,previous:Cn,resolve:Sn,tokenize:wn};function Sn(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 Cn(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function wn(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)):K(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||K(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 Tn=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&&En(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),En(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),En(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);En(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);En(this.left,t.reverse())}}};function En(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 Dn(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Tn(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,On(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 H(e,0,1/0,u.slice(0)),!l}function On(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 kn={resolve:jn,tokenize:Mn},An={partial:!0,tokenize:Nn};function jn(e){return Dn(e),e}function Mn(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):K(t)?e.check(An,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 Nn(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Y(e,a,`linePrefix`)}function a(i){if(i===null||K(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 Pn(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||Pt(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||K(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||q(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Pt(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 Fn(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):K(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||K(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!J(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function In(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Y(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||K(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Ln(e,t){let n;return r;function r(i){return K(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):J(i)?Y(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Rn={name:`definition`,tokenize:Bn},zn={partial:!0,tokenize:Vn};function Bn(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Fn.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Mt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return q(t)?Ln(e,l)(t):l(t)}function l(t){return Pn(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(zn,d,d)(t)}function d(t){return J(t)?Y(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||K(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Vn(e,t,n){return r;function r(t){return q(t)?Ln(e,i)(t):n(t)}function i(t){return In(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return J(t)?Y(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||K(e)?t(e):n(e)}}var Hn={name:`hardBreakEscape`,tokenize:Un};function Un(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return K(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Wn={name:`headingAtx`,resolve:Gn,tokenize:Kn};function Gn(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`},H(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Kn(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||q(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||K(n)?(e.exit(`atxHeading`),t(n)):J(n)?Y(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||q(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var qn=`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(`.`),Jn=[`pre`,`script`,`style`,`textarea`],Yn={concrete:!0,name:`htmlFlow`,resolveTo:Qn,tokenize:$n},Xn={partial:!0,tokenize:tr},Zn={partial:!0,tokenize:er};function Qn(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 $n(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:N):W(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):W(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return W(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||q(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Jn.includes(l)?(i=1,r.interrupt?t(s):O(s)):qn.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||G(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return J(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||W(t)?(e.consume(t),b):J(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||G(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):J(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):J(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||K(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||q(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||J(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||K(t)?O(t):J(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),P):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):K(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Xn,re,k)(t)):t===null||K(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Zn,ee,re)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),A}function A(t){return t===null||K(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),N):O(t)}function M(t){return t===47?(e.consume(t),o=``,te):O(t)}function te(t){if(t===62){let n=o.toLowerCase();return Jn.includes(n)?(e.consume(t),P):O(t)}return W(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),te):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),P):t===45&&i===2?(e.consume(t),N):O(t)}function P(t){return t===null||K(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),P)}function re(n){return e.exit(`htmlFlow`),t(n)}}function er(e,t,n){let r=this;return i;function i(t){return K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function tr(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(nn,t,n)}}var nr={name:`htmlText`,tokenize:rr};function rr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):W(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):W(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):K(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):K(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):K(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):K(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return W(t)?(e.consume(t),S):n(t)}function S(t){return t===45||G(t)?(e.consume(t),S):C(t)}function C(t){return K(t)?(o=C,M(t)):J(t)?(e.consume(t),C):j(t)}function w(t){return t===45||G(t)?(e.consume(t),w):t===47||t===62||q(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||W(t)?(e.consume(t),E):K(t)?(o=T,M(t)):J(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||G(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):K(t)?(o=D,M(t)):J(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):K(t)?(o=O,M(t)):J(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,A):t===null?n(t):K(t)?(o=k,M(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||q(t)?T(t):(e.consume(t),ee)}function A(e){return e===47||e===62||q(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return J(t)?Y(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var ir={name:`labelEnd`,resolveAll:cr,resolveTo:lr,tokenize:ur},ar={tokenize:dr},or={tokenize:fr},sr={tokenize:pr};function cr(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&&H(e,0,e.length,n),e}function lr(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=U(s,e.slice(a+1,a+r+3)),s=U(s,[[`enter`,u,t]]),s=U(s,Yt(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=U(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=U(s,e.slice(o+1)),s=U(s,[[`exit`,c,t]]),H(e,a,e.length,s),e}function ur(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(Mt(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(ar,u,o?u:d)(t):t===91?e.attempt(or,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(sr,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function dr(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 q(t)?Ln(e,a)(t):a(t)}function a(t){return t===41?u(t):Pn(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return q(t)?Ln(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?In(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return q(t)?Ln(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 fr(e,t,n){let r=this;return i;function i(t){return Fn.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Mt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function pr(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 mr={name:`labelStartImage`,resolveAll:ir.resolveAll,tokenize:hr};function hr(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 gr={name:`labelStartLink`,resolveAll:ir.resolveAll,tokenize:_r};function _r(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 vr={name:`lineEnding`,tokenize:yr};function yr(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Y(e,t,`linePrefix`)}}var br={name:`thematicBreak`,tokenize:xr};function xr(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||K(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),J(t)?Y(e,s,`whitespace`)(t):s(t))}}var X={continuation:{tokenize:Tr},exit:Dr,name:`list`,tokenize:wr},Sr={partial:!0,tokenize:Or},Cr={partial:!0,tokenize:Er};function wr(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:Ft(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(br,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 Ft(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(nn,r.interrupt?n:u,e.attempt(Sr,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return J(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Tr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(nn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Y(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!J(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Cr,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Y(e,e.attempt(X,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Er(e,t,n){let r=this;return Y(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Dr(e){e.exit(this.containerState.type)}function Or(e,t,n){let r=this;return Y(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!J(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var kr={name:`setextUnderline`,resolveTo:Ar,tokenize:jr};function Ar(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 jr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),J(t)?Y(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||K(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Mr={tokenize:Nr};function Nr(e){let t=this,n=e.attempt(nn,r,e.attempt(this.parser.constructs.flowInitial,i,Y(e,e.attempt(this.parser.constructs.flow,i,e.attempt(kn,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 Pr={resolveAll:Rr()},Fr=Lr(`string`),Ir=Lr(`text`);function Lr(e){return{resolveAll:Rr(e===`text`?zr: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 Rr(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 zr(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 Br=e({attentionMarkers:()=>Jr,contentInitial:()=>Hr,disable:()=>Yr,document:()=>Vr,flow:()=>Wr,flowInitial:()=>Ur,insideSpan:()=>qr,string:()=>Gr,text:()=>Kr}),Vr={42:X,43:X,45:X,48:X,49:X,50:X,51:X,52:X,53:X,54:X,55:X,56:X,57:X,62:an},Hr={91:Rn},Ur={[-2]:_n,[-1]:_n,32:_n},Wr={35:Wn,42:br,45:[kr,br],60:Yn,61:kr,95:br,96:mn,126:mn},Gr={38:dn,92:ln},Kr={[-5]:vr,[-4]:vr,[-3]:vr,33:mr,38:dn,42:Xt,60:[en,nr],91:gr,92:[Hn,ln],93:ir,95:Xt,96:xn},qr={null:[Xt,Pr]},Jr={null:[42,95]},Yr={null:[]};function Xr(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=U(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Yt(a,l.events,l),l.events):[]}function f(e,t){return Qr(p(e),t)}function p(e){return Zr(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){K(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&&H(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 Zr(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 Qr(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=`
3
+ `;break;case-3:o=`\r
4
+ `;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 $r(e){let t={constructs:Ot([Br,...(e||{}).extensions||[]]),content:n(Ht),defined:[],document:n(Wt),flow:n(Mr),lazy:{},string:n(Fr),text:n(Ir)};return t;function n(e){return n;function n(n){return Xr(t,e,n)}}}function ei(e){for(;!Dn(e););return e}var ti=/[\0\t\n\r]/g;function ni(){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(ti.lastIndex=u,c=ti.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 ri=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ii(e){return e.replace(ri,ai)}function ai(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return jt(n.slice(t?2:1),t?16:10)}return Et(n)||e}var oi={}.hasOwnProperty;function si(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),ci(n)(ei($r(n).document().write(ni()(e,t,!0))))}function ci(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(me),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ue),blockQuote:a(R),characterEscape:T,characterReference:T,codeFenced:a(z),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(z,o),codeText:a(ce,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(B),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(le),hardBreakEscape:a(de),hardBreakTrailing:a(de),htmlFlow:a(fe,o),htmlFlowData:T,htmlText:a(fe,o),htmlTextData:T,image:a(pe),label:o,link:a(me),listItem:a(ge),listItemValue:f,listOrdered:a(he,d),listUnordered:a(he),paragraph:a(_e),reference:ie,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ue),strong:a(ve),thematicBreak:a(be)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:se,autolinkProtocol:L,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:I,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(A),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(ee),htmlTextData:E,image:c(M),label:ne,labelText:te,lineEnding:D,link:c(j),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:F,resourceDestinationString:N,resourceTitleString:P,resource:re,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};ui(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]];oi.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]||fi).call(a,void 0,e[0])}for(r.position={start:li(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:li(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:li(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]||fi).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Be({start:e.start,end:e.end})+`): it’s not open`);n.position.end=li(e.end)}function u(){return xt(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=Mt(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=ye(),n.position={start:li(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=li(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=li(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 ee(){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.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 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 te(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=ii(t),n.identifier=Mt(t).toLowerCase()}function ne(){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 N(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function P(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function re(){this.data.inReference=void 0}function ie(){this.data.referenceType=`collapsed`}function F(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Mt(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ae(e){this.data.characterReferenceType=e.type}function oe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=jt(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Et(t);let i=this.stack[this.stack.length-1];i.value+=r}function I(e){let t=this.stack.pop();t.position.end=li(e.end)}function L(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 R(){return{type:`blockquote`,children:[]}}function z(){return{type:`code`,lang:null,meta:null,value:``}}function ce(){return{type:`inlineCode`,value:``}}function B(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function le(){return{type:`emphasis`,children:[]}}function ue(){return{type:`heading`,depth:0,children:[]}}function de(){return{type:`break`}}function fe(){return{type:`html`,value:``}}function pe(){return{type:`image`,title:null,url:``,alt:null}}function me(){return{type:`link`,title:null,url:``,children:[]}}function he(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ge(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function _e(){return{type:`paragraph`,children:[]}}function ve(){return{type:`strong`,children:[]}}function ye(){return{type:`text`,value:``}}function be(){return{type:`thematicBreak`}}}function li(e){return{line:e.line,column:e.column,offset:e.offset}}function ui(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?ui(e,r):di(e,r)}}function di(e,t){let n;for(n in t)if(oi.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 fi(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Be({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Be({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Be({start:t.start,end:t.end})+`) is still open`)}function pi(e){let t=this;t.parser=n;function n(n){return si(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function mi(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 hi(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
5
+ `}]}function gi(e,t){let n=t.value?t.value+`
6
+ `:``,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 _i(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vi(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yi(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Vt(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 bi(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 xi(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Si(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 Ci(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Si(e,t);let i={src:Vt(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 wi(e,t){let n={src:Vt(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 Ti(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 Ei(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Si(e,t);let i={href:Vt(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 Di(e,t){let n={href:Vt(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 Oi(e,t,n){let r=e.all(t),i=n?ki(n):Ai(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:`
7
+ `}),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:`
8
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function ki(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Ai(n[r])}return t}function Ai(e){return e.spread??e.children.length>1}function ji(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 Mi(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ni(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Pi(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fi(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=Le(t.children[1]),o=Ie(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 Ii(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 Li(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Ri=9,zi=32;function Bi(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Vi(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Vi(t.slice(i),i>0,!1)),a.join(``)}function Vi(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Ri||t===zi;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Ri||t===zi;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Hi(e,t){let n={type:`text`,value:Bi(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Ui(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Wi={blockquote:mi,break:hi,code:gi,delete:_i,emphasis:vi,footnoteReference:yi,heading:bi,html:xi,imageReference:Ci,image:wi,inlineCode:Ti,linkReference:Ei,link:Di,listItem:Oi,list:ji,paragraph:Mi,root:Ni,strong:Pi,table:Fi,tableCell:Li,tableRow:Ii,text:Hi,thematicBreak:Ui,toml:Gi,yaml:Gi,definition:Gi,footnoteDefinition:Gi};function Gi(){}var Ki=typeof self==`object`?self:globalThis,qi=(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(new Ki[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new Ki[a](o),i)};return r},Ji=e=>qi(new Map,e)(0),Yi=``,{toString:Xi}={},{keys:Zi}=Object,Qi=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Xi.call(e).slice(8,-1);switch(n){case`Array`:return[1,Yi];case`Object`:return[2,Yi];case`Date`:return[3,Yi];case`RegExp`:return[4,Yi];case`Map`:return[5,Yi];case`Set`:return[6,Yi];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},$i=([e,t])=>e===0&&(t===`function`||t===`symbol`),ea=(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]=Qi(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 Zi(r))(e||!$i(Qi(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,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||!($i(Qi(n))||$i(Qi(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!$i(Qi(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},ta=(e,{json:t,lossy:n}={})=>{let r=[];return ea(!(t||n),!!t,new Map,r)(e),r},na=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Ji(ta(e,t)):structuredClone(e):(e,t)=>Ji(ta(e,t));function ra(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 ia(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function aa(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||ra,r=e.options.footnoteBackLabel||ia,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=Vt(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:{...na(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
9
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
10
+ `}]}}var oa=(function(e){if(e==null)return da;if(typeof e==`function`)return ua(e);if(typeof e==`object`)return Array.isArray(e)?sa(e):ca(e);if(typeof e==`string`)return la(e);throw Error(`Expected function, string, or object as test`)});function sa(e){let t=[],n=-1;for(;++n<e.length;)t[n]=oa(e[n]);return ua(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function ca(e){let t=e;return ua(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function la(e){return ua(t);function t(t){return t&&t.type===e}}function ua(e){return t;function t(t,n,r){return!!(fa(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function da(){return!0}function fa(e){return typeof e==`object`&&!!e&&`type`in e}function pa(e){return e}var ma=[];function ha(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=oa(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 (`+pa(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=ma,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=ga(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 ga(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?ma:[e]}function _a(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),ha(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 va={}.hasOwnProperty,ya={};function ba(e,t){let n=t||ya,r=new Map,i=new Map,a={all:s,applyData:Sa,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Wi,...n.handlers},one:o,options:n,patch:xa,wrap:wa};return _a(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(va.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=na(n);return r.children=a.all(e),r}return na(e)}return(a.options.unknownHandler||Ca)(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=Ta(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Ta(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function xa(e,t){e.position&&(t.position=ze(e))}function Sa(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,na(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Ca(e,t){let n=t.data||{},r=`value`in t&&!(va.call(n,`hProperties`)||va.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 wa(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
11
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
12
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
13
+ `}),n}function Ta(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ea(e,t){let n=ba(e,t),r=n.one(e,void 0),i=aa(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
14
+ `},i)),a}function Da(e,t){return e&&`run`in e?async function(n,r){let i=Ea(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ea(n,{file:r,...e||t})}}function Oa(e){if(e)throw e}var ka=n(((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 Aa(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 ja(){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?Ma(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 Ma(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 Z={basename:Na,dirname:Pa,extname:Fa,join:Ia,sep:`/`};function Na(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);za(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 Pa(e){if(za(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 Fa(e){za(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 Ia(...e){let t=-1,n;for(;++t<e.length;)za(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:La(n)}function La(e){za(e);let t=e.codePointAt(0)===47,n=Ra(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Ra(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 za(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Ba={cwd:Va};function Va(){return`/`}function Ha(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Ua(e){if(typeof e==`string`)e=new URL(e);else if(!Ha(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 Wa(e)}function Wa(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 Ga=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Ka=class{constructor(e){let t;t=e?Ha(e)?{path:e}:typeof e==`string`||Xa(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Ba.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Ga.length;){let e=Ga[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)Ga.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Z.basename(this.path):void 0}set basename(e){Ja(e,`basename`),qa(e,`basename`),this.path=Z.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Z.dirname(this.path):void 0}set dirname(e){Ya(this.basename,`dirname`),this.path=Z.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Z.extname(this.path):void 0}set extname(e){if(qa(e,`extname`),Ya(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=Z.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Ha(e)&&(e=Ua(e)),Ja(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Z.basename(this.path,this.extname):void 0}set stem(e){Ja(e,`stem`),qa(e,`stem`),this.path=Z.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 V(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 qa(e,t){if(e&&e.includes(Z.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Z.sep+"`")}function Ja(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Ya(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Xa(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Za=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Qa=t(ka(),1),$a={}.hasOwnProperty,eo=new class e extends Za{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=ja()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Qa.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(ro(`data`,this.frozen),this.namespace[e]=t,this):$a.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ro(`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=oo(e),n=this.parser||this.Parser;return to(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),to(`process`,this.parser||this.Parser),no(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=oo(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);co(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(),to(`processSync`,this.parser||this.Parser),no(`processSync`,this.compiler||this.Compiler),this.process(e,r),ao(`processSync`,`process`,t),n;function r(e,r){t=!0,Oa(e),n=r}}run(e,t,n){io(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=oo(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),ao(`runSync`,`run`,n),r;function i(e,t){Oa(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=oo(t),r=this.compiler||this.Compiler;return no(`stringify`,r),io(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(ro(`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,Qa.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];Aa(o)&&Aa(r)&&(r=(0,Qa.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function to(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function no(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function ro(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 io(e){if(!Aa(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function ao(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function oo(e){return so(e)?e:new Ka(e)}function so(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function co(e){return typeof e==`string`||lo(e)}function lo(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Q=o(),$=t(r(),1),uo=[],fo={allowDangerousHtml:!0},po=/^(https?|ircs?|mailto|xmpp)$/i,mo=[{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 ho(e){let t=go(e),n=_o(e);return vo(t.runSync(t.parse(n),n),e)}function go(e){let t=e.rehypePlugins||uo,n=e.remarkPlugins||uo,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fo}:fo;return eo().use(pi).use(n).use(Da,r).use(t)}function _o(e){let t=e.children||``,n=new Ka;return typeof t==`string`?n.value=t:``+t,n}function vo(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||yo;for(let e of mo)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return _a(e,l),Ze(e,{Fragment:Q.Fragment,components:i,ignoreInvalidStyle:!0,jsx:Q.jsx,jsxs:Q.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 yt)if(Object.hasOwn(yt,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=yt[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 yo(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||po.test(e.slice(0,t))?e:``}var bo=[`chat-sessions`],xo=e=>[`chat-session`,e];function So(){let e=s(),[t,n]=(0,$.useState)(null),[r,o]=(0,$.useState)([]),[c,u]=(0,$.useState)(null),d=a({queryKey:bo,queryFn:()=>l.get(`/chat/sessions`),staleTime:1e4}),f=a({queryKey:xo(t),queryFn:()=>l.get(`/chat/sessions/${encodeURIComponent(t)}`),enabled:!!t,staleTime:5e3}),p=(0,$.useMemo)(()=>{let e=d.data?.sessions;return Array.isArray(e)?e:[]},[d.data]),m=f.data?.session??null,h=(0,$.useMemo)(()=>{let e=m&&Array.isArray(m.turns)?m.turns:[];return r.length===0||e.length>=r.length?e:[...e,...r.slice(e.length)]},[m,r]),g=i({mutationFn:({sessionId:e,message:t,history:n})=>{let r=new AbortController,i=setTimeout(()=>r.abort(),9e4);return fetch(`/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({sessionId:e||void 0,message:t,history:n}),signal:r.signal}).then(async e=>{clearTimeout(i);let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`HTTP ${e.status}`);return t}).catch(e=>{throw clearTimeout(i),e.name===`AbortError`?Error(`Response took too long. The AI might be busy — try again.`):e})}}),_=i({mutationFn:({sessionId:e,action:t})=>l.post(`/chat/action`,{sessionId:e,action:t})}),v=i({mutationFn:e=>l.post(`/chat/sessions`,e?{name:e}:{}),onSuccess:t=>{t.session?.id&&n(t.session.id),e.invalidateQueries({queryKey:bo})}}),y=i({mutationFn:e=>l.delete(`/chat/sessions/${encodeURIComponent(e)}`),onSuccess:(r,i)=>{t===i&&n(null),e.invalidateQueries({queryKey:bo})}}),b=i({mutationFn:({id:e,name:t})=>l.patch(`/chat/sessions/${encodeURIComponent(e)}`,{name:t}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:bo}),e.invalidateQueries({queryKey:xo(n)})}}),x=(0,$.useCallback)(e=>{if(!e?.trim())return;let n=e.trim();o(e=>[...e,{role:`user`,content:n,timestamp:new Date().toISOString()}]);let i=r.filter(e=>e.role===`user`||e.role===`assistant`).map(e=>({role:e.role,content:e.content}));u(Date.now()),g.mutate({sessionId:t,message:n,history:i},{onSuccess:e=>{u(null),e.response&&o(t=>[...t,{role:`assistant`,content:e.response,actions:e.actions,timestamp:new Date().toISOString()}])},onError:()=>{u(null)}})},[t,g,r]),S=(0,$.useCallback)(e=>!t||!e?Promise.resolve(null):_.mutateAsync({sessionId:t,action:e}),[t,_]),C=(0,$.useCallback)(e=>v.mutate(e),[v]),w=(0,$.useCallback)(e=>y.mutate(e),[y]),T=(0,$.useCallback)((e,t)=>b.mutate({id:e,name:t}),[b]),E=(0,$.useCallback)(e=>{n(e??null),o([])},[]);return{sessions:p,currentSessionId:t,currentSession:m,messages:h,isLoading:g.isPending,isSending:g.isPending,sendingStartedAt:c,isSessionsLoading:d.isLoading,isSessionLoading:f.isLoading&&!!t,error:g.error?.message??null,sessionsError:d.error?.message??null,lastResponse:g.data??null,sendMessage:x,executeAction:S,createSession:C,deleteSession:w,renameSession:T,selectSession:E,isExecutingAction:_.isPending,isCreatingSession:v.isPending,isDeletingSession:y.isPending,isRenamingSession:b.isPending,clearError:()=>g.reset()}}var Co={"create-issue":{label:`Create Issue`,icon:m,btnClass:`btn-success`,hasButton:!0},"start-service":{label:`Start Service`,icon:f,btnClass:`btn-primary`,hasButton:!0},"stop-service":{label:`Stop Service`,icon:h,btnClass:`btn-warning`,hasButton:!0},"restart-service":{label:`Restart Service`,icon:p,btnClass:`btn-info`,hasButton:!0},"retry-issue":{label:`Retry`,icon:S,btnClass:`btn-warning`,hasButton:!0},"replan-issue":{label:`Replan`,icon:p,btnClass:`btn-warning`,hasButton:!0},"approve-issue":{label:`Approve`,icon:y,btnClass:`btn-success`,hasButton:!0},"merge-issue":{label:`Merge`,icon:T,btnClass:`btn-primary`,hasButton:!0},"read-file":{label:`File`,icon:u,hasButton:!1},"read-service-log":{label:`Service Log`,icon:D,hasButton:!1}},wo={task:`badge-primary`,bug:`badge-error`,feature:`badge-info`,chore:`badge-ghost`};function To({payload:e}){let t=wo[e?.issueType]??`badge-ghost`;return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[e?.issueType&&(0,Q.jsx)(`span`,{className:`badge badge-xs ${t}`,children:e.issueType}),(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e?.title||`Untitled`})]}),e?.description&&(0,Q.jsx)(`p`,{className:`text-xs opacity-60 line-clamp-2 leading-relaxed`,children:e.description})]})}function Eo({payload:e}){return(0,Q.jsx)(`div`,{className:`text-sm`,children:(0,Q.jsx)(`span`,{className:`font-mono text-xs opacity-70`,children:e?.serviceName||e?.name||`service`})})}function Do({payload:e}){return(0,Q.jsxs)(`div`,{className:`text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs opacity-70`,children:e?.identifier||e?.issueId||e?.id||`issue`}),e?.title&&(0,Q.jsx)(`span`,{className:`ml-2 text-xs opacity-50 truncate`,children:e.title})]})}function Oo({payload:e}){return(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-mono opacity-60 truncate`,children:e?.path||e?.filePath||`unknown`}),e?.content&&(0,Q.jsx)(`pre`,{className:`text-[11px] leading-relaxed bg-base-200 rounded px-2.5 py-2 overflow-x-auto max-h-48 font-mono`,children:(0,Q.jsx)(`code`,{children:e.content})})]})}function ko({payload:e}){return(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-mono opacity-60`,children:e?.serviceName||e?.name||`service`}),e?.content&&(0,Q.jsx)(`pre`,{className:`text-[11px] leading-relaxed bg-base-200 rounded px-2.5 py-2 overflow-x-auto max-h-48 font-mono whitespace-pre-wrap`,children:e.content})]})}function Ao(e,t){switch(e){case`create-issue`:return(0,Q.jsx)(To,{payload:t});case`start-service`:case`stop-service`:case`restart-service`:return(0,Q.jsx)(Eo,{payload:t});case`retry-issue`:case`replan-issue`:case`approve-issue`:case`merge-issue`:return(0,Q.jsx)(Do,{payload:t});case`read-file`:return(0,Q.jsx)(Oo,{payload:t});case`read-service-log`:return(0,Q.jsx)(ko,{payload:t});default:return(0,Q.jsx)(`div`,{className:`text-xs opacity-50 font-mono`,children:JSON.stringify(t,null,2)})}}function jo({action:e,sessionId:t}){let[n,r]=(0,$.useState)(`idle`),[i,a]=(0,$.useState)(null),o=Co[e?.type];if(!o||e.type===`list-issues`||e.type===`list-services`)return null;let{label:s,icon:c,btnClass:u,hasButton:d}=o,f=(0,$.useCallback)(async()=>{if(!(n===`loading`||n===`success`)){r(`loading`),a(null);try{await l.post(`/chat/action`,{sessionId:t,action:e}),r(`success`)}catch(e){r(`error`),a(e instanceof Error?e.message:String(e))}}},[t,e,n]);return(0,Q.jsxs)(`div`,{className:`border border-base-300 rounded-lg overflow-hidden bg-base-100 max-w-md`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-base-200/50 border-b border-base-300`,children:[(0,Q.jsx)(c,{className:`size-3.5 opacity-50 shrink-0`}),(0,Q.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider opacity-40`,children:s})]}),(0,Q.jsx)(`div`,{className:`px-3 py-2`,children:Ao(e.type,e.payload)}),d&&(0,Q.jsxs)(`div`,{className:`px-3 py-2 border-t border-base-300 flex items-center justify-between gap-2`,children:[n===`error`&&i&&(0,Q.jsx)(`span`,{className:`text-[11px] text-error truncate flex-1`,children:i}),n!==`error`&&(0,Q.jsx)(`span`,{}),(0,Q.jsxs)(`button`,{className:`btn btn-xs ${n===`success`?`btn-ghost text-success`:u} gap-1`,onClick:f,disabled:n===`loading`||n===`success`,children:[n===`loading`&&(0,Q.jsx)(O,{className:`size-3 animate-spin`}),n===`success`&&(0,Q.jsx)(w,{className:`size-3`}),n===`idle`&&(0,Q.jsx)(c,{className:`size-3`}),n===`error`&&(0,Q.jsx)(S,{className:`size-3`}),(0,Q.jsx)(`span`,{children:n===`success`?`Done`:n===`error`?`Retry`:s})]})]})]})}var Mo=c(`/chat/`)({component:as}),No=[{label:`Planning`,states:[`Planning`]},{label:`Needs Approval`,states:[`PendingApproval`]},{label:`In Progress`,states:[`Queued`,`Running`,`Reviewing`]},{label:`Blocked`,states:[`Blocked`]},{label:`Review`,states:[`PendingDecision`]},{label:`Done`,states:[`Approved`,`Merged`,`Cancelled`]}],Po={Planning:`bg-info`,Queued:`bg-info`,Running:`bg-primary animate-pulse`,Reviewing:`bg-secondary animate-pulse`,PendingApproval:`bg-warning`,PendingDecision:`bg-warning`,Blocked:`bg-error`,Merged:`bg-success`,Approved:`bg-success`,Cancelled:`bg-neutral`},Fo={Planning:`info`,Queued:`info`,Running:`primary`,Reviewing:`secondary`,PendingApproval:`warning`,PendingDecision:`warning`,Blocked:`error`,Merged:`success`,Approved:`success`,Cancelled:`neutral`},Io=[`Create an issue`,`What's the project status?`,`Check services`,`Show blocked issues`],Lo=[`Explain the plan`,`What's blocking this?`,`Retry execution`,`Show the diff`];function Ro(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=Date.now()-t.getTime();return n<5e3?`just now`:n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:`${Math.round(n/864e5)}d ago`}function zo(e,t){if(!t||e.role!==t.role)return!0;let n=new Date(e.timestamp).getTime(),r=new Date(t.timestamp).getTime();return Number.isNaN(n)||Number.isNaN(r)?!1:Math.abs(n-r)>5*6e4}var Bo={p:({children:e})=>(0,Q.jsx)(`p`,{className:`mb-2 last:mb-0`,children:e}),ul:({children:e})=>(0,Q.jsx)(`ul`,{className:`list-disc list-inside mb-2 space-y-0.5`,children:e}),ol:({children:e})=>(0,Q.jsx)(`ol`,{className:`list-decimal list-inside mb-2 space-y-0.5`,children:e}),li:({children:e})=>(0,Q.jsx)(`li`,{children:e}),strong:({children:e})=>(0,Q.jsx)(`strong`,{className:`font-semibold`,children:e}),code:({inline:e,children:t})=>e?(0,Q.jsx)(`code`,{className:`bg-base-300/60 px-1 py-0.5 rounded text-[0.85em] font-mono`,children:t}):(0,Q.jsx)(`code`,{children:t}),pre:({children:e})=>(0,Q.jsx)(`pre`,{className:`my-2 rounded-lg bg-base-300/60 px-3 py-2 text-xs leading-relaxed overflow-x-auto font-mono`,children:e}),h1:({children:e})=>(0,Q.jsx)(`h3`,{className:`font-bold text-base mb-1`,children:e}),h2:({children:e})=>(0,Q.jsx)(`h3`,{className:`font-bold text-sm mb-1`,children:e}),h3:({children:e})=>(0,Q.jsx)(`h4`,{className:`font-semibold text-sm mb-1`,children:e}),blockquote:({children:e})=>(0,Q.jsx)(`blockquote`,{className:`border-l-2 border-base-content/20 pl-3 italic opacity-70 mb-2`,children:e}),hr:()=>(0,Q.jsx)(`hr`,{className:`border-base-content/10 my-2`}),a:({href:e,children:t})=>(0,Q.jsx)(`a`,{href:e,className:`underline opacity-80 hover:opacity-100`,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Vo(e){return e?(0,Q.jsx)(ho,{components:Bo,children:e}):null}var Ho=new Set([`read-file`,`read-service-log`]),Uo=new Set([`create-issue`,`approve-issue`,`merge-issue`,`retry-issue`,`replan-issue`]),Wo=new Set([`start-service`,`stop-service`,`restart-service`]),Go={direct:null,explored:`0 0 0 2px oklch(0.62 0.21 250 / 0.65)`,dispatched:`0 0 0 2px oklch(0.65 0.2 145 / 0.65)`,operated:`0 0 0 2px oklch(0.70 0.18 68 / 0.65)`,multi:`0 0 0 2px oklch(0.62 0.22 300 / 0.65), 0 0 8px oklch(0.62 0.22 300 / 0.25)`},Ko={direct:`Fifony`,explored:`Read files to answer`,dispatched:`Dispatched an action`,operated:`Managed a service`,multi:`Used multiple tools`};function qo(e){if(!Array.isArray(e)||e.length===0)return`direct`;let t=e.map(e=>e?.type??e?.action??``).filter(Boolean),n=!1,r=!1,i=!1;for(let e of t)Ho.has(e)?n=!0:Uo.has(e)?r=!0:Wo.has(e)&&(i=!0);return(n?1:0)+(r?1:0)+(i?1:0)>=2?`multi`:n?`explored`:r?`dispatched`:i?`operated`:`direct`}function Jo({mode:e=`direct`,pulsing:t=!1}){let n=Go[e]??null,r=Ko[e]??`Fifony`;return(0,Q.jsx)(`div`,{className:`w-8 h-8 rounded-full overflow-hidden shrink-0${t?` animate-pulse`:``}`,style:n?{boxShadow:n}:void 0,title:r,children:(0,Q.jsx)(`img`,{src:`/dinofffaur.webp`,alt:`Fifony`,className:`w-full h-full rounded-full object-cover`})})}function Yo({startedAt:e}){let[t,n]=(0,$.useState)(0);return(0,$.useEffect)(()=>{if(!e)return;let t=()=>n(Math.round((Date.now()-e)/1e3));t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),(0,Q.jsxs)(`div`,{className:`chat chat-start chat-msg-in`,children:[(0,Q.jsx)(`div`,{className:`chat-image avatar`,children:(0,Q.jsx)(Jo,{mode:`direct`,pulsing:!0})}),(0,Q.jsxs)(`div`,{className:`chat-bubble bg-base-200/60 text-base-content flex items-center gap-1.5 py-2.5 px-3`,children:[(0,Q.jsx)(`span`,{className:`typing-dot size-1.5 rounded-full bg-base-content/40`,style:{animationDelay:`0ms`}}),(0,Q.jsx)(`span`,{className:`typing-dot size-1.5 rounded-full bg-base-content/40`,style:{animationDelay:`150ms`}}),(0,Q.jsx)(`span`,{className:`typing-dot size-1.5 rounded-full bg-base-content/40`,style:{animationDelay:`300ms`}}),t>3&&(0,Q.jsxs)(`span`,{className:`text-[10px] text-base-content/30 ml-1 tabular-nums`,children:[t,`s`]})]})]})}function Xo({error:e,onRetry:t}){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5 px-3 py-2.5 bg-error/8 border border-error/15 rounded-xl text-sm animate-fade-in max-w-lg`,children:[(0,Q.jsx)(v,{className:`size-3.5 text-error/70 shrink-0 mt-0.5`}),(0,Q.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,Q.jsx)(`span`,{className:`text-error/70 text-xs leading-relaxed`,children:e})}),t&&(0,Q.jsx)(`button`,{className:`btn btn-ghost btn-xs text-error/70 shrink-0`,onClick:t,children:`Retry`})]})}function Zo({role:e,content:t,timestamp:n,actions:r,sessionId:i,showTime:a}){let o=e===`user`,s=o?null:qo(r);return o?(0,Q.jsxs)(`div`,{className:`chat chat-end chat-msg-out`,children:[(0,Q.jsx)(`div`,{className:`chat-bubble bg-primary text-primary-content text-sm leading-relaxed`,style:{wordBreak:`break-word`},children:t}),a&&n&&(0,Q.jsx)(`div`,{className:`chat-footer opacity-40 text-[10px] select-none`,children:Ro(n)})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 items-start chat-msg-in`,children:[(0,Q.jsxs)(`div`,{className:`chat chat-start w-full`,children:[(0,Q.jsx)(`div`,{className:`chat-image avatar`,children:(0,Q.jsx)(Jo,{mode:s})}),(0,Q.jsx)(`div`,{className:`chat-bubble bg-base-200/60 text-base-content text-sm leading-relaxed`,style:{wordBreak:`break-word`},children:Vo(t)}),a&&n&&(0,Q.jsx)(`div`,{className:`chat-footer opacity-40 text-[10px] select-none`,children:Ro(n)})]}),Array.isArray(r)&&r.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 pl-10`,children:r.map((e,t)=>(0,Q.jsx)(jo,{action:e,sessionId:i},t))})]})}function Qo({onSuggestion:e,selectedIssue:t}){let n=t?Lo:Io;return(0,Q.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center px-5 pb-8`,children:(0,Q.jsxs)(`div`,{className:`w-full max-w-md space-y-6 animate-fade-in-up`,children:[t?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`div`,{className:`text-base-content/40 text-sm`,children:`Discussing`}),(0,Q.jsxs)(`div`,{className:`bg-base-200/40 rounded-xl px-4 py-3 border border-base-300/50`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`size-2 rounded-full shrink-0 ${Po[t.state]||`bg-base-content/20`}`}),(0,Q.jsx)(`span`,{className:`font-mono text-xs text-base-content/50`,children:t.identifier})]}),(0,Q.jsx)(`div`,{className:`text-sm font-medium mt-1 text-base-content/80`,children:t.title}),t.description&&(0,Q.jsx)(`div`,{className:`text-xs text-base-content/40 mt-1.5 line-clamp-2 leading-relaxed`,children:t.description})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-1 text-center`,children:[(0,Q.jsx)(`h2`,{className:`text-xl font-semibold text-base-content/80`,children:`Hey. What are you working on?`}),(0,Q.jsx)(`p`,{className:`text-sm text-base-content/35`,children:`Ask about your project, manage issues, or just think out loud.`})]}),(0,Q.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1 -mx-1 px-1 no-scrollbar`,children:n.map(t=>(0,Q.jsx)(`button`,{className:`chip-suggestion shrink-0 text-xs px-3.5 py-2 rounded-full border border-base-300/60 text-base-content/50 bg-base-100 hover:border-primary/30 hover:text-primary/70 hover:bg-primary/5 transition-all duration-150 active:scale-95 whitespace-nowrap`,onClick:()=>e(t),children:t},t))})]})})}function $o({issue:e,onDeselect:t}){if(!e)return null;let n=Fo[e.state]||`neutral`;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5 px-4 py-2 shrink-0 animate-fade-in`,style:{background:`color-mix(in oklab, var(--color-${n}) 6%, transparent)`,borderBottom:`1px solid color-mix(in oklab, var(--color-${n}) 15%, transparent)`},children:[(0,Q.jsx)(`span`,{className:`size-2 rounded-full shrink-0 ${Po[e.state]||`bg-base-content/20`}`}),(0,Q.jsx)(`span`,{className:`text-xs font-mono font-semibold truncate`,style:{color:`var(--color-${n})`},children:e.identifier}),(0,Q.jsx)(`span`,{className:`text-xs text-base-content/50 truncate flex-1 min-w-0`,children:e.title}),(0,Q.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-circle shrink-0 opacity-40 hover:opacity-80`,onClick:t,"aria-label":`Clear issue context`,children:(0,Q.jsx)(g,{className:`size-3`})})]})}function es({issue:e,isSelected:t,onToggle:n}){let r=Po[e.state]||`bg-base-content/20`;return(0,Q.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-left text-xs transition-all duration-150 ${t?`bg-primary/8 text-base-content border-l-2 border-l-primary pl-2`:`text-base-content/60 hover:bg-base-200/60 border-l-2 border-l-transparent`}`,onClick:()=>n(e),title:`${e.identifier}: ${e.title}`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full shrink-0 ${r}`}),(0,Q.jsx)(`span`,{className:`font-mono shrink-0 ${t?`text-primary/70`:`opacity-40`}`,children:e.identifier}),(0,Q.jsx)(`span`,{className:`truncate flex-1`,children:e.title})]})}function ts({label:e,issues:t,selectedIssueId:n,onToggle:r,defaultCollapsed:i}){let[a,o]=(0,$.useState)(i??!1);return(0,Q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Q.jsxs)(`button`,{className:`flex items-center gap-1.5 px-2.5 py-1 w-full text-left text-[10px] font-semibold uppercase tracking-wider text-base-content/30 hover:text-base-content/50 transition-colors`,onClick:()=>o(e=>!e),children:[(0,Q.jsx)(a?E:b,{className:`size-2.5`}),(0,Q.jsx)(`span`,{children:e}),(0,Q.jsx)(`span`,{className:`ml-auto font-mono text-base-content/20`,children:t.length})]}),!a&&t.map(e=>(0,Q.jsx)(es,{issue:e,isSelected:e.id===n,onToggle:r},e.id))]})}function ns({issues:e,selectedIssueId:t,onToggle:n,search:r,onSearchChange:i}){let a=(0,$.useMemo)(()=>{let t=r.toLowerCase(),n=t?e.filter(e=>`${e.identifier} ${e.title}`.toLowerCase().includes(t)):e;return No.map(e=>({...e,issues:n.filter(t=>e.states.includes(t.state)).sort((e,t)=>(t.updatedAt||t.createdAt||``).localeCompare(e.updatedAt||e.createdAt||``))})).filter(e=>e.issues.length>0)},[e,r]),o=e.length;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`px-3 pt-3 pb-1.5 shrink-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-semibold text-base-content/60`,children:`Issues`}),o>0&&(0,Q.jsx)(`span`,{className:`text-[10px] font-mono text-base-content/25 bg-base-200/60 rounded-full px-1.5 py-0.5`,children:o})]}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(d,{className:`size-3 absolute left-2.5 top-1/2 -translate-y-1/2 text-base-content/25`}),(0,Q.jsx)(`input`,{className:`input input-xs input-bordered w-full pl-7 text-xs bg-base-200/30 border-base-300/50 rounded-lg`,placeholder:`Search...`,value:r,onChange:e=>i(e.target.value)}),r&&(0,Q.jsx)(`button`,{className:`absolute right-1.5 top-1/2 -translate-y-1/2 btn btn-ghost btn-xs btn-circle size-4`,onClick:()=>i(``),"aria-label":`Clear search`,children:(0,Q.jsx)(g,{className:`size-2.5`})})]})]}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 px-1.5 py-1.5 space-y-2.5`,children:a.length===0?(0,Q.jsx)(`div`,{className:`text-xs text-base-content/25 text-center py-8`,children:r?`No matches`:`No issues yet`}):a.map(e=>(0,Q.jsx)(ts,{label:e.label,issues:e.issues,selectedIssueId:t,onToggle:n,defaultCollapsed:e.label===`Done`},e.label))})]})}function rs({activeTab:e,setActiveTab:t,issueCount:n}){return(0,Q.jsxs)(`div`,{className:`flex border-b border-base-300 bg-base-100 shrink-0 md:hidden`,children:[(0,Q.jsxs)(`button`,{className:`flex-1 py-2.5 text-xs font-medium text-center transition-colors relative ${e===`chat`?`text-primary`:`text-base-content/40`}`,onClick:()=>t(`chat`),children:[`Chat`,e===`chat`&&(0,Q.jsx)(`span`,{className:`absolute bottom-0 left-1/4 right-1/4 h-0.5 bg-primary rounded-full`})]}),(0,Q.jsxs)(`button`,{className:`flex-1 py-2.5 text-xs font-medium text-center transition-colors relative ${e===`issues`?`text-primary`:`text-base-content/40`}`,onClick:()=>t(`issues`),children:[`Issues`,n>0&&(0,Q.jsx)(`span`,{className:`ml-1 text-[10px] font-mono text-base-content/25`,children:n}),e===`issues`&&(0,Q.jsx)(`span`,{className:`absolute bottom-0 left-1/4 right-1/4 h-0.5 bg-primary rounded-full`})]})]})}function is({visible:e,onClick:t}){return e?(0,Q.jsx)(`button`,{className:`absolute bottom-20 left-1/2 -translate-x-1/2 btn btn-circle btn-sm bg-base-200/80 border-base-300/50 shadow-lg backdrop-blur-sm hover:bg-base-200 transition-all duration-200 z-10 animate-fade-in`,onClick:t,"aria-label":`Scroll to bottom`,children:(0,Q.jsx)(x,{className:`size-3.5 text-base-content/50`})}):null}function as(){let e=So(),{issues:t}=_(),n=s(),[r,i]=(0,$.useState)(``),[a,o]=(0,$.useState)(!0),[c,u]=(0,$.useState)(``),[d,f]=(0,$.useState)(null),[p,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(null),[v,y]=(0,$.useState)([]),[b,x]=(0,$.useState)(`chat`),[S,w]=(0,$.useState)(!1),T=(0,$.useRef)(null),D=(0,$.useRef)(null),k=(0,$.useRef)(0),ee=(0,$.useMemo)(()=>d?t.find(e=>e.id===d)??null:null,[d,t]),A=e.isSending||p,j=e.error||h;(0,$.useEffect)(()=>{let t=t=>{let n=t.detail?.issueId;n&&n!==d&&(f(n),y([]),g(null),e.selectSession(null),x(`chat`))};return window.addEventListener(`spark:chat:select-issue`,t),()=>window.removeEventListener(`spark:chat:select-issue`,t)},[d,e]);let M=(0,$.useCallback)(()=>{T.current&&T.current.scrollTo({top:T.current.scrollHeight,behavior:`smooth`})},[]);(0,$.useEffect)(()=>{T.current&&e.messages.length!==k.current&&(k.current=e.messages.length,M())},[e.messages.length,M]),(0,$.useEffect)(()=>{A&&M()},[A,M]),(0,$.useEffect)(()=>{D.current?.focus()},[e.currentSessionId]),(0,$.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{w(e.scrollHeight-e.scrollTop-e.clientHeight>200)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]);let te=(0,$.useCallback)(t=>{d===t.id?f(null):f(t.id),e.selectSession(null),g(null),y([])},[d,e]),ne=(0,$.useCallback)(()=>{f(null),e.selectSession(null),g(null),y([])},[e]),N=(0,$.useCallback)(async t=>{if(!t?.trim()||A)return;let n=t.trim();if(!d){e.sendMessage(n);return}y(e=>[...e,{role:`user`,content:n,timestamp:new Date().toISOString()}]),m(!0),g(null);try{let e=await l.post(`/chat`,{message:n,issueId:d,history:v.filter(e=>e.role===`user`||e.role===`assistant`).map(e=>({role:e.role,content:e.content}))});e.response&&y(t=>[...t,{role:`assistant`,content:e.response,actions:e.actions,timestamp:new Date().toISOString()}])}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[A,d,e,n]),P=(0,$.useCallback)(()=>{let e=r.trim();e&&(i(``),D.current&&(D.current.style.height=`auto`),N(e))},[r,N]),re=(0,$.useCallback)(e=>{A||(x(`chat`),N(e))},[A,N]),ie=(0,$.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),P()),e.key===`Escape`&&(e.preventDefault(),D.current?.blur())},[P]),F=(0,$.useCallback)(e=>{i(e.target.value);let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,120)}px`},[]),ae=(0,$.useCallback)(()=>{let t=e.messages;for(let n=t.length-1;n>=0;n--)if(t[n].role===`user`){e.clearError(),g(null),N(t[n].content);return}},[e,N]),[,oe]=(0,$.useState)(0);(0,$.useEffect)(()=>{if(e.messages.length===0&&t.length===0)return;let n=setInterval(()=>oe(e=>e+1),3e4);return()=>clearInterval(n)},[e.messages.length,t.length]);let I=e.lastResponse?.provider??null,L=d?v:e.messages,se=(0,$.useMemo)(()=>L.map(e=>({role:e.role,content:e.content,timestamp:e.timestamp||e.createdAt||e.updatedAt,actions:e.actions})),[L]),R=se.length>0,z=(0,$.useCallback)(e=>{te(e),x(`chat`)},[te]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`style`,{children:`
15
+ .chat-msg-in { animation: chatSlideInLeft 220ms ease-out both; }
16
+ .chat-msg-out { animation: chatSlideInRight 220ms ease-out both; }
17
+ @keyframes chatSlideInLeft {
18
+ from { opacity: 0; transform: translateX(-10px); }
19
+ to { opacity: 1; transform: translateX(0); }
20
+ }
21
+ @keyframes chatSlideInRight {
22
+ from { opacity: 0; transform: translateX(10px); }
23
+ to { opacity: 1; transform: translateX(0); }
24
+ }
25
+ .typing-dot {
26
+ animation: typingDot 1.2s ease-in-out infinite;
27
+ }
28
+ @keyframes typingDot {
29
+ 0%, 60%, 100% { opacity: 0.25; transform: scale(0.85); }
30
+ 30% { opacity: 1; transform: scale(1.1); }
31
+ }
32
+ .chip-suggestion:hover {
33
+ transform: translateY(-1px);
34
+ }
35
+ .no-scrollbar::-webkit-scrollbar { display: none; }
36
+ .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
37
+ .chat-input-wrap:focus-within {
38
+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--color-primary) 20%, transparent);
39
+ border-color: color-mix(in oklab, var(--color-primary) 40%, transparent);
40
+ }
41
+ .send-btn:active:not(:disabled) {
42
+ transform: scale(0.88);
43
+ }
44
+ `}),(0,Q.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[(0,Q.jsx)(`aside`,{className:`${a?`w-[240px]`:`w-0`} hidden md:flex flex-col border-r border-base-300/60 bg-base-100 shrink-0 transition-all duration-200 overflow-hidden`,children:(0,Q.jsx)(ns,{issues:t,selectedIssueId:d,onToggle:te,search:c,onSearchChange:u})}),(0,Q.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 min-h-0`,children:[(0,Q.jsx)(rs,{activeTab:b,setActiveTab:x,issueCount:t.length}),b===`issues`&&(0,Q.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 md:hidden bg-base-100`,children:(0,Q.jsx)(ns,{issues:t,selectedIssueId:d,onToggle:z,search:c,onSearchChange:u})}),(0,Q.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 ${b===`chat`?`flex`:`hidden md:flex`}`,children:[(0,Q.jsx)($o,{issue:ee,onDeselect:ne}),(0,Q.jsxs)(`div`,{ref:T,className:`flex-1 overflow-y-auto min-h-0 relative`,children:[(0,Q.jsx)(`div`,{className:`max-w-2xl mx-auto px-4 py-4 space-y-3`,children:!R&&!A?(0,Q.jsx)(Qo,{onSuggestion:re,selectedIssue:ee}):R?(0,Q.jsxs)(Q.Fragment,{children:[se.map((t,n)=>(0,Q.jsx)(Zo,{role:t.role,content:t.content,timestamp:t.timestamp,actions:t.actions,sessionId:e.currentSessionId,showTime:zo(t,se[n-1])},`${e.currentSessionId}-${n}`)),A&&(0,Q.jsx)(Yo,{startedAt:e.sendingStartedAt}),j&&(0,Q.jsx)(Xo,{error:j,onRetry:ae})]}):e.isSessionLoading?(0,Q.jsx)(`div`,{className:`flex-1 flex items-center justify-center py-20`,children:(0,Q.jsx)(O,{className:`size-5 animate-spin text-base-content/20`})}):(0,Q.jsx)(Qo,{onSuggestion:re,selectedIssue:ee})}),(0,Q.jsx)(is,{visible:S&&R,onClick:M})]}),(0,Q.jsx)(`div`,{className:`shrink-0 bg-base-100 border-t border-base-300/40 pb-[env(safe-area-inset-bottom)]`,children:(0,Q.jsxs)(`div`,{className:`max-w-2xl mx-auto px-3 py-3`,children:[(0,Q.jsxs)(`div`,{className:`chat-input-wrap flex items-end gap-0 bg-base-200/40 border border-base-300/50 rounded-2xl px-3 py-1.5 transition-all duration-200`,children:[(0,Q.jsx)(`textarea`,{ref:D,className:`flex-1 bg-transparent border-none outline-none resize-none text-sm leading-relaxed py-1.5 placeholder:text-base-content/25 min-h-[24px]`,rows:1,placeholder:ee?`Ask about ${ee.identifier}...`:`What can I help with?`,value:r,onChange:F,onKeyDown:ie,disabled:A,style:{maxHeight:`120px`}}),(0,Q.jsx)(`button`,{className:`send-btn shrink-0 size-8 rounded-xl flex items-center justify-center transition-all duration-150 ml-1 ${r.trim()?`bg-primary text-primary-content hover:brightness-110`:`bg-base-300/50 text-base-content/20`}`,onClick:P,disabled:A||!r.trim(),"aria-label":`Send message`,title:`Send (Enter)`,children:A?(0,Q.jsx)(O,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(C,{className:`size-3.5`})})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mt-1.5 px-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`button`,{className:`hidden md:flex btn btn-ghost btn-xs btn-square size-4 opacity-20 hover:opacity-50 p-0`,onClick:()=>o(e=>!e),"aria-label":`Toggle sidebar`,title:`Toggle issues sidebar`,children:a?(0,Q.jsx)(E,{className:`size-3 rotate-180`}):(0,Q.jsx)(E,{className:`size-3`})}),(0,Q.jsx)(`span`,{className:`text-[10px] text-base-content/15`,children:`Enter to send · Shift+Enter for newline`})]}),I&&(0,Q.jsxs)(`span`,{className:`text-[10px] text-base-content/15`,children:[`via `,I]})]})]})})]})]})]})]})}export{Mo as Route};
@@ -0,0 +1 @@
1
+ .react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#ffffff80;--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:#f0f0f099;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;background-color:var(--xy-background-color,var(--xy-background-color-default));--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #00000014;--xy-node-boxshadow-selected-default:0 0 0 .5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:#0059dc14;--xy-selection-border-default:1px dotted #0059dccc;--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#96969640;--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:#3c3c3c99;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#777;--xy-background-pattern-lines-color-default:#777;--xy-background-pattern-cross-color-default:#777;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #ffffff14;--xy-node-boxshadow-selected-default:0 0 0 .5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:#c8c8dc14;--xy-selection-border-default:1px dotted #c8c8dccc;--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{pointer-events:none;position:absolute;overflow:visible}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}svg.react-flow__connectionline{z-index:1001;position:absolute;overflow:visible}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:0;left:50%;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px)translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px)translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__viewport-portal{-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__minimap{background:var(--xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default)))}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(--xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default)));stroke:var(--xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default)));stroke-width:var(--xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default)))}.react-flow__minimap-node{fill:var(--xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default)));stroke:var(--xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default)));stroke-width:var(--xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default)))}.react-flow__background-pattern.dots{fill:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default)))}.react-flow__background-pattern.lines{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default)))}.react-flow__background-pattern.cross{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default)))}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));flex-direction:column;display:flex}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)));width:26px;height:26px;color:var(--xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default)));cursor:pointer;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;padding:4px;display:flex}.react-flow__controls-button svg{fill:currentColor;width:100%;max-width:12px;max-height:12px}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));width:150px;color:var(--xy-node-color,var(--xy-node-color-default));text-align:center;border:var(--xy-node-border,var(--xy-node-border-default));background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));padding:10px;font-size:12px}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(--xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default)));color:var(--xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default)))}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)))}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;width:5px;height:5px;translate:-50% -50%}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}
@@ -0,0 +1,12 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t,h as n,o as r}from"./vendor-X6HTElZW.js";import{s as i,t as a}from"./api-CEr_D4e5.js";import{N as o,k as s}from"./hooks-CNPue7d7.js";import{t as c}from"./createLucideIcon-B3bah5lk.js";import{B as l,D as u,F as d,O as f,R as p,S as m,T as h,W as g,X as _,_ as v,_t as y,at as b,b as x,bt as S,d as C,f as w,g as T,h as E,j as D,m as O,nt as k,p as A,pt as j,st as M,ut as ee,v as N,vt as P,w as F,xt as I}from"./index-Dfn02uW3.js";var L=c(`scan`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]),R=e(t(),1),te=1e4,ne=30;function re(e,t=!0){let[n,r]=(0,R.useState)(()=>Array(ne).fill(0)),i=(0,R.useRef)(0),a=(0,R.useRef)(!1),[c,l]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{if(!t||!e)return;i.current=0,s(e);let n=S(e,e=>{i.current+=typeof e==`string`?e.length:0,a.current||(a.current=!0,l(!0))}),c=setInterval(()=>{let e=i.current;i.current=0,r(t=>[...t.slice(1),e])},te);return()=>{o(e),n(),clearInterval(c)}},[e,t]),{buckets:n,peak:Math.max(...n,1),hasData:c}}var z=n(),B=r(`/services`)({component:Be});function V({startedAt:e,running:t}){let[n,r]=(0,R.useState)(0);return(0,R.useEffect)(()=>{if(!t||!e){r(0);return}let n=()=>r(Date.now()-Date.parse(e));n();let i=setInterval(n,1e3);return()=>clearInterval(i)},[t,e]),!t||!e?null:(0,z.jsx)(z.Fragment,{children:i(n)})}var H=[`#3d3d3d`,`#c0392b`,`#27ae60`,`#d4a017`,`#2980b9`,`#8e44ad`,`#16a085`,`#bdc3c7`],U=[`#666`,`#e74c3c`,`#2ecc71`,`#f1c40f`,`#3498db`,`#9b59b6`,`#1abc9c`,`#ecf0f1`],W=[`#1a1a1a`,`#6b0000`,`#004d1a`,`#4d3800`,`#00234d`,`#3a0066`,`#004d40`,`#4a4a4a`],G=[`#333`,`#c0392b`,`#27ae60`,`#b8860b`,`#1a5276`,`#6c3483`,`#0e6655`,`#7f8c8d`];function K(e){let t=/\x1b\[([0-9;]*)m/g,n=null,r=null,i=!1,a=!1,o=!1,s=``,c=0,l=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),u=e=>{if(!e)return;let t=l(e),c=[];n&&c.push(`color:${n}`),r&&c.push(`background:${r}`),i&&c.push(`font-weight:700`),a&&c.push(`opacity:0.5`),o&&c.push(`font-style:italic`),s+=c.length?`<span style="${c.join(`;`)}">${t}</span>`:t};for(let s of e.matchAll(t)){u(e.slice(c,s.index)),c=s.index+s[0].length;let t=s[1]===``?[0]:s[1].split(`;`).map(Number),l=0;for(;l<t.length;){let e=t[l++];e===0?(n=r=null,i=a=o=!1):e===1?i=!0:e===2?a=!0:e===3?o=!0:e===22?(i=!1,a=!1):e===23?o=!1:e>=30&&e<=37?n=H[e-30]:e===38?t[l]===5&&l+1<t.length?l+=2:t[l]===2&&l+3<t.length&&(n=`rgb(${t[l+1]},${t[l+2]},${t[l+3]})`,l+=4):e===39?n=null:e>=40&&e<=47?r=W[e-40]:e===49?r=null:e>=90&&e<=97?n=U[e-90]:e>=100&&e<=107&&(r=G[e-100])}}return u(e.slice(c)),s}function q(e){let t={running:{dot:`text-success fill-success`,strip:`bg-success`,badge:`badge-success`,label:`Running`,spinning:!1},starting:{dot:`text-warning fill-warning`,strip:`bg-warning`,badge:`badge-warning`,label:`Starting`,spinning:!0},stopping:{dot:`text-warning fill-warning`,strip:`bg-warning/60`,badge:`badge-warning`,label:`Stopping`,spinning:!0},crashed:{dot:`text-error fill-error`,strip:`bg-error`,badge:`badge-error`,label:`Crashed`,spinning:!1},stopped:{dot:`opacity-20`,strip:`bg-base-300`,badge:`badge-ghost opacity-50`,label:`Stopped`,spinning:!1}};return t[e]??t.stopped}var J=[{label:`Auto`,value:0},{label:`5s`,value:5e3},{label:`10s`,value:1e4},{label:`30s`,value:3e4},{label:`1m`,value:6e4}],ie=1e3;function ae({id:e,running:t,state:n}){let{liveMode:r}=y(),[i,c]=(0,R.useState)(``),[u,d]=(0,R.useState)(0),[f,p]=(0,R.useState)(`idle`),[m,h]=(0,R.useState)(null),[g,_]=(0,R.useState)(0),[v,x]=(0,R.useState)(!1),[C,w]=(0,R.useState)(!1),T=(0,R.useRef)(null),[E,D]=(0,R.useState)(!0),O=(0,R.useMemo)(()=>i?K(i):``,[i]),A=!!(i&&i.trim()),M=(0,R.useRef)(0),ee=(0,R.useRef)(r),N=(0,R.useCallback)(async()=>{if(e){p(`loading`),h(null);try{let t=await a.get(`/services/${encodeURIComponent(e)}/log`);c(t.logTail??``),M.current=t.logSize??0,d(t.logSize??0),p(t.logTail?`live`:`idle`)}catch(e){h(e instanceof Error?e.message:`Failed to load logs.`),p(`error`)}}},[e]),P=(0,R.useCallback)(async()=>{if(e)try{let t=await a.get(`/services/${encodeURIComponent(e)}/log?after=${M.current}`);t.text?(c(e=>e+t.text),M.current=t.logSize??M.current,d(t.logSize??M.current),lastChunkAtRef.current=Date.now(),p(`live`)):(t.logSize??M.current)<M.current&&N()}catch{}},[e,N]);(0,R.useEffect)(()=>{if(c(``),M.current=0,d(0),p(`idle`),!e)return;N(),s(e);let t=S(e,e=>{c(t=>t+e),M.current+=new TextEncoder().encode(e).length,p(`live`)});return()=>{o(e),t()}},[e,N]),(0,R.useEffect)(()=>{if(!t||!e||g>0||r)return;p(e=>e===`error`||e===`loading`?e:`live`);let n=setInterval(P,ie);return()=>clearInterval(n)},[t,e,g,r,P]),(0,R.useEffect)(()=>{let n=ee.current;ee.current=r,!(!e||n||!r)&&(P(),t&&p(`live`))},[r,e,t,P]),(0,R.useEffect)(()=>{if(!g||!e)return;let t=setInterval(P,g);return()=>clearInterval(t)},[g,e,P]),(0,R.useEffect)(()=>{E&&T.current&&(T.current.scrollTop=T.current.scrollHeight)},[O,E]);let I=(0,R.useCallback)(()=>{if(!T.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:n}=T.current;D(e+n>=t-40)},[]),L=g>0?`poll ${g/1e3}s`:r?`ws`:`fallback ${ie/1e3}s`;return(0,z.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-base-200/40 border-t border-b border-base-200 shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(F,{className:`size-3.5 opacity-30`}),(0,z.jsx)(`span`,{className:`text-[10px] font-medium opacity-40 uppercase tracking-widest`,children:`Output`})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f===`loading`?(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs opacity-40`,children:[(0,z.jsx)(l,{className:`size-2.5 animate-spin`}),`loading`]}):f===`error`?(0,z.jsx)(`span`,{className:`text-xs text-error/70`,children:`error`}):A&&n===`crashed`?(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-error/70`,children:[(0,z.jsx)(b,{className:`size-2 fill-current`}),`crash log`]}):f===`live`?(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-success`,children:[(0,z.jsx)(b,{className:`size-2 fill-success`}),L]}):A?(0,z.jsx)(`span`,{className:`text-xs opacity-45`,children:`saved log`}):(0,z.jsx)(`span`,{className:`text-xs opacity-25`,children:`no output`}),v&&(0,z.jsx)(`div`,{className:`flex items-center gap-0.5 border border-base-300 rounded overflow-hidden ml-1`,children:J.map(e=>(0,z.jsx)(`button`,{onClick:()=>_(e.value),className:`px-1.5 py-0.5 text-[10px] font-mono transition-colors ${g===e.value?`bg-primary text-primary-content`:`hover:bg-base-300 opacity-50 hover:opacity-100`}`,children:e.label},e.value))}),(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-35 hover:opacity-70 px-1`,onClick:()=>x(e=>!e),title:`Poll interval`,children:`⚙`}),A&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-40 hover:opacity-80 px-1.5`,title:`Copy log`,onClick:()=>{navigator.clipboard.writeText(i).then(()=>{w(!0),setTimeout(()=>w(!1),1500)})},children:C?(0,z.jsx)(j,{className:`size-3 text-success`}):(0,z.jsx)(k,{className:`size-3`})}),(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-40 hover:opacity-80 px-1.5`,onClick:N,title:`Reload full log`,children:`↺`}),!E&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-40 hover:opacity-80`,onClick:()=>{D(!0),T.current?.scrollTo(0,T.current.scrollHeight)},children:`↓ end`})]})]}),(0,z.jsx)(`pre`,{ref:T,onScroll:I,className:`flex-1 overflow-y-auto p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed bg-base-100 min-h-0`,dangerouslySetInnerHTML:{__html:O||(m?`<span style="color:color-mix(in srgb, currentColor 60%, transparent)">${String(m).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}</span>`:`<span style="opacity:0.2">No output yet. Start the service to see logs here.</span>`)}})]})}function oe({id:e,generation:t}){let[n,r]=(0,R.useState)(``),[i,o]=(0,R.useState)(0),[s,c]=(0,R.useState)(!1),[u,d]=(0,R.useState)(`idle`),[f,p]=(0,R.useState)(!1),m=(0,R.useRef)(null),h=(0,R.useMemo)(()=>n?K(n):``,[n]);(0,R.useEffect)(()=>{r(``),o(0),d(`loading`),a.get(`/services/${encodeURIComponent(e)}/log/history/${t}`).then(e=>{r(e.logTail??``),o(e.logSize??0),c(e.truncated??!1),d(e.logTail?`loaded`:`empty`)}).catch(()=>d(`error`))},[e,t]);let g=t===1?`Previous session`:`Oldest session`,_=i>0?`${(i/1024).toFixed(1)}KB`:null;return(0,z.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-base-200/40 border-t border-b border-base-200 shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(F,{className:`size-3.5 opacity-30`}),(0,z.jsx)(`span`,{className:`text-[10px] font-medium opacity-40 uppercase tracking-widest`,children:g})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u===`loading`&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs opacity-40`,children:[(0,z.jsx)(l,{className:`size-2.5 animate-spin`}),`loading`]}),u===`loaded`&&_&&(0,z.jsxs)(`span`,{className:`text-xs opacity-40`,children:[_,s?` (truncated)`:``]}),u===`error`&&(0,z.jsx)(`span`,{className:`text-xs text-error/70`,children:`error`}),u===`empty`&&(0,z.jsx)(`span`,{className:`text-xs opacity-25`,children:`empty`}),n&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-40 hover:opacity-80 px-1.5`,title:`Copy log`,onClick:()=>{navigator.clipboard.writeText(n).then(()=>{p(!0),setTimeout(()=>p(!1),1500)})},children:f?(0,z.jsx)(j,{className:`size-3 text-success`}):(0,z.jsx)(k,{className:`size-3`})})]})]}),(0,z.jsx)(`pre`,{ref:m,className:`flex-1 overflow-y-auto p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed bg-base-100 min-h-0`,dangerouslySetInnerHTML:{__html:h||(u===`error`?`<span style="opacity:0.3">Failed to load log.</span>`:`<span style="opacity:0.2">No output in this session.</span>`)}})]})}function se({id:e,running:t}){let{buckets:n,peak:r}=re(e,t);return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 border-t border-base-200/60 bg-base-200/20 shrink-0`,children:[(0,z.jsx)(`svg`,{width:149,height:20,className:`overflow-visible shrink-0`,children:n.map((e,t)=>{let n=e===0?1:Math.max(2,Math.round(e/r*19)),i=t*5,a=20-n,o=t>=27;return(0,z.jsx)(`rect`,{x:i,y:a,width:4,height:n,rx:.5,className:e===0?`fill-base-content/10`:o?`fill-success/75`:`fill-success/45`},t)})}),(0,z.jsx)(`span`,{className:`text-[10px] opacity-30 shrink-0`,children:`5 min`}),(0,z.jsx)(`span`,{className:`flex-1`}),(0,z.jsx)(`span`,{className:`text-[10px] opacity-25 tabular-nums`,children:`log activity`})]})}function ce({service:e,onClose:t,onRefresh:n,graph:r,proxyRoutes:i,localDomain:o,proxyPort:s}){let[c,u]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),[m,S]=(0,R.useState)(null),[C,w]=(0,R.useState)(!1),[T,O]=(0,R.useState)({open:!1,defaultValues:null}),[k,A]=(0,R.useState)(null),[j,P]=(0,R.useState)([0]),[F,I]=(0,R.useState)(0),[te,ne]=(0,R.useState)(0),{createIssue:re,showToast:B}=y(),H=(0,R.useCallback)(()=>{a.get(`/services/${encodeURIComponent(e.id)}/log/generations`).then(e=>P(e.generations?.length?e.generations:[0])).catch(()=>P([0]))},[e.id]);(0,R.useEffect)(()=>{H(),I(0)},[e.id,H]);let U=e.state??(e.running?`running`:`stopped`),W=q(U),G=U===`running`||U===`starting`,K=(0,R.useMemo)(()=>me(e.id,i,o,s),[e.id,i,o,s]),J=(0,R.useMemo)(()=>r?.nodes?.find(t=>t.id===e.id)??null,[r,e.id]),ie=(0,R.useMemo)(()=>Oe(J?.protocols,3),[J]),ce=(0,R.useCallback)(async()=>{u(!0);try{await a.post(`/services/${e.id}/start`,{}),await n(),I(0),ne(e=>e+1),setTimeout(H,500)}finally{u(!1)}},[e.id,n,H]),le=(0,R.useCallback)(async()=>{u(!0);try{await a.post(`/services/${e.id}/stop`,{}),await n()}finally{u(!1)}},[e.id,n]),ue=(0,R.useCallback)(async()=>{u(!0);try{await a.post(`/services/${e.id}/restart`,{}),await n(),I(0),ne(e=>e+1),setTimeout(H,500)}finally{u(!1)}},[e.id,n,H]),de=(0,R.useCallback)(async()=>{p(!0),S(null);try{let t=await a.post(`/services/${e.id}/detect-healthcheck`,{});S(t.found?{found:!0,healthcheck:t.healthcheck}:{found:!1}),t.found&&await n()}catch(e){S(`error`),B(e.message??`Detection failed`,`error`)}finally{p(!1)}},[e.id,n,B]),fe=(0,R.useCallback)(async()=>{w(!0),A(null);try{let t=await a.post(`/services/${e.id}/fix`,{});t.hasProblem?A({healthy:!1,title:t.title,description:t.description,issueType:t.issueType}):A({healthy:!0})}catch(e){A({error:e.message??`Analysis failed`})}finally{w(!1)}},[e.id]),pe=U===`running`?`text-success`:U===`crashed`?`text-error`:U===`starting`||U===`stopping`?`text-warning`:`opacity-35`,he=!!(k&&!k.healthy),Y=!!(he&&(k?.error||U===`crashed`));return(0,z.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,z.jsx)(`div`,{className:`h-px w-full shrink-0 ${W.strip} opacity-60`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 shrink-0`,children:[W.spinning?(0,z.jsx)(l,{className:`size-3 shrink-0 animate-spin ${pe}`}):(0,z.jsx)(b,{className:`size-1.5 shrink-0 ${W.dot}`}),(0,z.jsx)(`span`,{className:`font-semibold text-sm truncate leading-none`,children:e.name}),(0,z.jsx)(`span`,{className:`text-xs font-medium shrink-0 ${pe}`,children:W.label}),e.running&&e.startedAt&&(0,z.jsx)(`span`,{className:`text-xs opacity-55 tabular-nums shrink-0`,children:(0,z.jsx)(V,{startedAt:e.startedAt,running:e.running})}),e.port&&(0,z.jsxs)(`span`,{className:`text-xs font-mono opacity-50 shrink-0`,children:[`:`,e.port]}),e.pid&&U===`running`&&(0,z.jsxs)(`span`,{className:`text-[11px] font-mono opacity-45 tabular-nums shrink-0`,children:[`pid `,e.pid]}),(0,z.jsx)(`span`,{className:`flex-1`}),G&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost gap-1 h-6 min-h-0 px-1.5 opacity-60 hover:opacity-90 shrink-0`,onClick:ue,disabled:c,title:`Restart`,children:(0,z.jsx)(D,{className:`size-3`})}),G?(0,z.jsxs)(`button`,{className:`btn btn-xs btn-error h-6 min-h-0 gap-1 px-2 shrink-0`,onClick:le,disabled:c,children:[c?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(h,{className:`size-3`}),`Stop`]}):(0,z.jsxs)(`button`,{className:`btn btn-xs btn-success h-6 min-h-0 gap-1 px-2 shrink-0`,onClick:ce,disabled:c||U===`stopping`,children:[c?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(d,{className:`size-3`}),`Start`]}),(0,z.jsx)(`button`,{onClick:t,className:`btn btn-ghost btn-xs btn-circle h-6 min-h-0 w-6 opacity-40 hover:opacity-80 shrink-0`,children:(0,z.jsx)(v,{className:`size-3.5`})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-t border-base-200/60 shrink-0 min-w-0`,children:[(0,z.jsx)(`code`,{className:`font-mono text-[11px] opacity-65 truncate flex-1 leading-none`,children:e.command}),e.cwd&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] font-mono opacity-45 shrink-0`,children:[(0,z.jsx)(_,{className:`size-3`}),e.cwd]}),U===`crashed`&&e.crashCount>0&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-error/50 shrink-0`,children:[(0,z.jsx)(x,{className:`size-3`}),e.crashCount]}),e.logSize!=null&&e.logSize>0&&(0,z.jsxs)(`span`,{className:`text-[11px] font-mono opacity-45 shrink-0 tabular-nums`,children:[(e.logSize/1024).toFixed(1),`KB`]}),(U===`running`||U===`crashed`)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`w-px h-3 bg-base-content/10 shrink-0`}),(0,z.jsxs)(`button`,{className:`btn btn-xs btn-ghost h-6 min-h-0 gap-1 px-2 text-[11px] opacity-70 hover:opacity-100 shrink-0`,onClick:de,disabled:f||C,children:[f?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(L,{className:`size-3`}),f?`Scanning…`:`Detect`]}),m&&m!==`error`&&(m.found?(0,z.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-success shrink-0`,children:[(0,z.jsx)(M,{className:`size-3`}),m.healthcheck?.endpoint??`port ${m.healthcheck?.port}`]}):(0,z.jsx)(`span`,{className:`text-[11px] opacity-30 shrink-0`,children:`no config detected`})),(0,z.jsxs)(`button`,{className:`btn btn-xs btn-ghost h-6 min-h-0 gap-1 px-2 text-[11px] opacity-70 hover:opacity-100 shrink-0`,onClick:fe,disabled:C||f,children:[C?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(N,{className:`size-3`}),C?`Analyzing…`:`Analyze`]}),k?.healthy&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-success/70 shrink-0`,children:[(0,z.jsx)(M,{className:`size-3 shrink-0`}),`Clean`]})]})]}),(0,z.jsx)(`div`,{className:`grid shrink-0`,style:{gridTemplateRows:he?`1fr`:`0fr`,transition:`grid-template-rows 220ms cubic-bezier(0.16, 1, 0.3, 1)`},children:(0,z.jsx)(`div`,{className:`overflow-hidden`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-2.5 px-3 py-2.5 border-b ${Y?`bg-error/5 border-error/20`:`bg-warning/5 border-warning/20`}`,children:[(0,z.jsx)(x,{className:`size-3.5 shrink-0 mt-0.5 ${Y?`text-error`:`text-warning`}`}),(0,z.jsx)(`div`,{className:`flex-1 min-w-0`,children:k?.error?(0,z.jsx)(`p`,{className:`text-xs leading-relaxed opacity-70`,children:k.error}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`text-sm font-medium leading-snug`,children:k?.title}),k?.description&&(0,z.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5 line-clamp-2 leading-relaxed`,children:k.description})]})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[!k?.error&&k?.title&&(0,z.jsxs)(`button`,{className:`btn btn-xs h-6 min-h-0 gap-1 px-2.5 ${Y?`btn-error`:`btn-warning`}`,onClick:()=>O({open:!0,defaultValues:{title:k.title,description:k.description,issueType:k.issueType}}),children:[`Create Issue`,(0,z.jsx)(ee,{className:`size-3`})]}),(0,z.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-circle h-5 min-h-0 w-5 opacity-30 hover:opacity-70`,onClick:()=>A(null),children:(0,z.jsx)(v,{className:`size-3`})})]})]})})}),K.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 border-t border-base-200/60 shrink-0`,children:[(0,z.jsx)(g,{className:`size-3 opacity-20 shrink-0`}),K.map(e=>e.url?(0,z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-[11px] font-mono text-primary/60 hover:text-primary transition-colors truncate`,children:e.url},e.id):(0,z.jsx)(`span`,{className:`text-[11px] font-mono opacity-35 truncate`,children:e.label},e.id))]}),J&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 border-t border-base-200/60 shrink-0 text-[10px] font-mono`,children:[(0,z.jsx)(`span`,{className:`opacity-30`,children:`mesh`}),(0,z.jsxs)(`span`,{className:`opacity-50`,children:[J.requestsIn??0,` in`]}),(0,z.jsxs)(`span`,{className:`opacity-50`,children:[J.requestsOut??0,` out`]}),((J.bytesIn??0)>0||(J.bytesOut??0)>0)&&(0,z.jsxs)(`span`,{className:`opacity-45`,children:[Z(J.bytesIn),` in / `,Z(J.bytesOut),` out`]}),(J.errorsIn??0)>0&&(0,z.jsxs)(`span`,{className:`text-error/80`,children:[J.errorsIn,` err in`]}),(J.errorsOut??0)>0&&(0,z.jsxs)(`span`,{className:`text-error/80`,children:[J.errorsOut,` err out`]}),(J.activeFlows??0)>0&&(0,z.jsxs)(`span`,{className:`opacity-50`,children:[J.activeFlows,` active`]}),J.lastSeenAt&&(0,z.jsx)(`span`,{className:`opacity-35`,children:De(J.lastSeenAt)}),ie.length>0&&(0,z.jsx)(`span`,{className:`opacity-35`,children:ie.join(` · `)})]}),e.running&&(0,z.jsx)(se,{id:e.id,running:e.running}),j.length>1&&(0,z.jsx)(`div`,{className:`flex items-center gap-0 px-3 border-t border-base-200/60 shrink-0 bg-base-200/20`,children:j.map(e=>(0,z.jsx)(`button`,{onClick:()=>I(e),className:`px-3 py-1.5 text-[11px] font-medium border-b-2 transition-colors ${F===e?`border-primary text-primary`:`border-transparent opacity-50 hover:opacity-80`}`,children:e===0?`Current`:e===1?`Previous`:`Oldest`},e))}),F===0?(0,z.jsx)(ae,{id:e.id,running:e.running,state:U},`${e.id}-${te}`):(0,z.jsx)(oe,{id:e.id,generation:F}),(0,z.jsx)(E,{open:T.open,onClose:()=>O({open:!1,defaultValues:null}),onSubmit:async e=>{await re.mutateAsync(e),O({open:!1,defaultValues:null})},defaultValues:T.defaultValues,onToast:B})]})}function le({service:e,onClose:t,onRefresh:n,graph:r,proxyRoutes:i,localDomain:a,proxyPort:o}){let[s,c]=(0,R.useState)(!1),l=(0,R.useCallback)(()=>{c(!0),setTimeout(()=>{c(!1),t()},250)},[t]);return(0,R.useEffect)(()=>{let e=e=>{e.key===`Escape`&&l()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C,{onClick:l,className:s?`animate-fade-out`:`animate-fade-in`}),(0,z.jsx)(A,{closing:s,width:`w-full sm:w-[500px] lg:w-[40vw] lg:min-w-[520px] xl:min-w-[600px]`,onClick:e=>e.stopPropagation(),children:(0,z.jsx)(ce,{service:e,onClose:l,onRefresh:n,graph:r,proxyRoutes:i,localDomain:a,proxyPort:o})})]})}function ue(e){return e==null||e<=0?null:e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function de(e){if(e)return Array.isArray(e)?e[0]:e}function fe(e,t,n=4433){let r=de(e.host)??t;if(!r)return e.target??null;let i=e.pathPrefix??``,a=Number(n??4433);return`${a===443?`https://${r}`:`https://${r}:${a}`}${i}`}function pe(e){return e.host?(Array.isArray(e.host)?e.host.join(`, `):e.host)+(e.pathPrefix??``):e.pathPrefix?e.pathPrefix:e.target??e.id}function me(e,t,n,r=4433){return e?(t??[]).filter(t=>t.serviceId===e).map(e=>({id:e.id,label:pe(e),url:fe(e,n,r),host:de(e.host)??n??``,pathPrefix:e.pathPrefix??``})):[]}var he=30,Y=3,ge=1,_e=he*(Y+ge)-ge,ve=16;function ye({id:e,running:t}){let{buckets:n,peak:r}=re(e,t);return(0,z.jsx)(`svg`,{width:_e,height:ve,className:`overflow-visible`,children:n.map((e,t)=>{let n=e===0?1:Math.max(2,Math.round(e/r*(ve-1))),i=t*(Y+ge),a=ve-n,o=t>=he-3;return(0,z.jsx)(`rect`,{x:i,y:a,width:Y,height:n,rx:.5,className:e===0?`fill-base-content/10`:o?`fill-success/80`:`fill-success/50`},t)})})}function be({service:e,selected:t,onSelect:n,onRefresh:r}){let[i,o]=(0,R.useState)(!1),s=e.state??(e.running?`running`:`stopped`),c=q(s),u=s===`stopped`||s===`crashed`,f=s===`running`||s===`starting`,p=e.health??null,m=(0,R.useCallback)(async(t,n)=>{t.stopPropagation(),o(!0);try{await a.post(`/services/${e.id}/${n}`,{}),setTimeout(()=>r?.(),500)}finally{o(!1)}},[e.id,r]),g=ue(e.logSize),_=!e.running||!e.port?null:p?p.healthy?(0,z.jsxs)(`span`,{className:`flex items-center gap-0.5 text-success/70`,title:`Healthy — ${p.latencyMs}ms`,children:[(0,z.jsx)(b,{className:`size-1.5 fill-current`}),(0,z.jsxs)(`span`,{className:`text-[10px] tabular-nums`,children:[p.latencyMs,`ms`]})]}):(0,z.jsxs)(`span`,{className:`flex items-center gap-0.5 text-error/70`,title:`Unhealthy`,children:[(0,z.jsx)(b,{className:`size-1.5 fill-current`}),(0,z.jsx)(`span`,{className:`text-[10px]`,children:`down`})]}):(0,z.jsx)(b,{className:`size-1.5 text-base-content/20 fill-base-content/20`,title:`Checking...`});return(0,z.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`group relative text-left rounded-md border border-base-content/[0.08] bg-base-200/40 transition-all duration-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 overflow-hidden
2
+ ${t?`ring-1 ring-primary/30 bg-base-200/70`:`hover:bg-base-200/60`}${s===`crashed`?` border-error/20`:``}`,children:[(0,z.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 w-[3px] ${s===`running`?`bg-success/50`:s===`starting`?`bg-success/30 animate-pulse`:s===`crashed`?`bg-error/50`:`bg-base-content/10`} transition-colors duration-300`}),(0,z.jsxs)(`div`,{className:`pl-3.5 pr-3 py-2.5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(b,{className:`size-1.5 shrink-0 ${c.dot}${c.spinning?` animate-pulse`:``}`}),(0,z.jsx)(`span`,{className:`font-medium text-sm leading-none truncate flex-1 min-w-0`,children:e.name}),u&&(0,z.jsxs)(`span`,{role:`button`,tabIndex:-1,className:`btn btn-xs btn-ghost h-5 min-h-0 gap-1 px-1.5 text-success/70 hover:text-success hover:bg-success/10`,onClick:e=>m(e,`start`),children:[i?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(d,{className:`size-3`}),`Start`]}),f&&(0,z.jsx)(`span`,{role:`button`,tabIndex:-1,className:`btn btn-xs btn-ghost h-5 min-h-0 px-1 opacity-0 group-hover:opacity-100 hover:bg-base-300/50 transition-opacity`,onClick:e=>m(e,`restart`),title:`Restart`,children:i?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(D,{className:`size-2.5 opacity-50`})}),f&&(0,z.jsx)(`span`,{role:`button`,tabIndex:-1,className:`btn btn-xs btn-ghost h-5 min-h-0 px-1 opacity-0 group-hover:opacity-100 text-error/50 hover:text-error hover:bg-error/10 transition-opacity`,onClick:e=>m(e,`stop`),children:i?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(h,{className:`size-2.5`})})]}),(0,z.jsx)(`div`,{className:`font-mono text-[11px] opacity-35 truncate mt-1 leading-none`,children:e.command}),(s===`running`||s===`starting`||s===`crashed`)&&(0,z.jsxs)(`div`,{className:`flex items-center gap-x-2.5 gap-y-0.5 flex-wrap text-[11px] tabular-nums opacity-40 mt-1.5 leading-tight`,children:[e.running&&e.startedAt&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`opacity-60`,children:`up`}),(0,z.jsx)(V,{startedAt:e.startedAt,running:!0})]}),e.pid&&s===`running`&&(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`span`,{className:`opacity-60`,children:`pid`}),` `,e.pid]}),e.port&&(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`span`,{className:`opacity-60`,children:`:`}),e.port]}),_,g&&(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`span`,{className:`opacity-60`,children:`log`}),` `,g]}),e.crashCount>0&&(0,z.jsxs)(`span`,{className:`text-error/70 flex items-center gap-0.5`,children:[(0,z.jsx)(x,{className:`size-2.5`}),e.crashCount]}),e.errorCount>0&&(0,z.jsxs)(`span`,{className:`text-error/70 flex items-center gap-0.5`,children:[(0,z.jsx)(x,{className:`size-2.5`}),e.errorCount,` err`]}),e.autoStart&&(0,z.jsx)(`span`,{className:`opacity-40`,children:`auto`})]}),s===`running`&&(0,z.jsx)(`div`,{className:`mt-1.5`,title:`Log volume — 5min window, 10s buckets`,children:(0,z.jsx)(ye,{id:e.id,running:e.running})})]})]})}function xe({service:e,onClose:t,onRefresh:n}){let[r,i]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1),[c,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(null),g=e.state??(e.running?`running`:`stopped`),_=q(g),v=g===`stopped`||g===`crashed`,y=g===`running`||g===`starting`,b=e.runtimeServiceKind===`mesh`?`mesh`:`proxy`,x=b===`mesh`?`network runtime · mesh`:`network runtime · ingress`,S=(0,R.useCallback)(()=>{i(!0),setTimeout(()=>{i(!1),t()},250)},[t]);(0,R.useEffect)(()=>{let e=e=>{e.key===`Escape`&&S()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S]),(0,R.useEffect)(()=>{let e=b===`mesh`?`/mesh/status`:`/proxy/reverse/status`;a.get(e).then(f).catch(()=>{}),b===`mesh`&&a.get(`/mesh`).then(e=>m(e?.graph??null)).catch(()=>{})},[b]);let T=(0,R.useMemo)(()=>{if(!c)return null;if(b===`mesh`){let e=p,t=Array.isArray(e?.edges)?e.edges:[],n=e?.totalRequests??t.reduce((e,t)=>e+Number(t.requestCount??0),0),r=t.reduce((e,t)=>e+Number(t.errorCount??0),0),i=t.reduce((e,t)=>e+Number(t.bytesIn??0),0),a=t.reduce((e,t)=>e+Number(t.bytesOut??0),0),o=n>0?r/n:0;return{running:c.running,port:c.port,totalRequests:n,totalErrors:r,errorRate:o,totalBytesIn:i,totalBytesOut:a,activeEdges:t.length,nodeCount:Array.isArray(e?.nodes)?e.nodes.length:0}}return{running:c.running,port:c.port,routeCount:c.routes?.length??0,localDomain:c.localDomain??null}},[c,p,b]),E=(0,R.useCallback)(async t=>{s(!0);try{await a.post(`/services/${e.id}/${t}`,{}),setTimeout(()=>n?.(),300)}finally{s(!1)}},[e.id,n]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C,{onClick:S,className:r?`animate-fade-out`:`animate-fade-in`}),(0,z.jsxs)(A,{closing:r,width:`w-full sm:w-[560px] lg:w-[42vw] lg:min-w-[540px]`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`flex items-start justify-between px-5 pt-5 pb-4 border-b border-base-content/[0.07] shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,z.jsx)(u,{className:`size-4 shrink-0 ${_.dot}${_.spinning?` animate-pulse`:``}`}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,z.jsx)(`span`,{className:`font-semibold text-sm leading-tight truncate`,children:e.name}),(0,z.jsx)(`span`,{className:`badge badge-xs badge-outline opacity-60`,children:x}),e.port&&(0,z.jsxs)(`span`,{className:`text-[10px] font-mono opacity-40`,children:[`:`,e.port]})]}),e.command&&(0,z.jsx)(`div`,{className:`font-mono text-[11px] opacity-35 truncate mt-0.5`,children:e.command})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 ml-3`,children:[v&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost text-success opacity-60 hover:opacity-100`,onClick:()=>E(`start`),disabled:o,title:`Start`,children:o?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(d,{className:`size-3`})}),y&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost text-error opacity-60 hover:opacity-100`,onClick:()=>E(`stop`),disabled:o,title:`Stop`,children:o?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(h,{className:`size-3`})}),(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-50 hover:opacity-90`,onClick:()=>E(`restart`),disabled:o,title:`Restart`,children:o?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(D,{className:`size-3`})}),(0,z.jsx)(w,{onClick:S})]})]}),T&&(0,z.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-content/[0.06] shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-2`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold ${T.running?`text-success`:`opacity-25`}`,children:T.running?`running`:`stopped`}),T.port&&(0,z.jsxs)(`span`,{className:`text-[10px] font-mono opacity-35`,children:[`:`,T.port]})]}),b===`mesh`?(0,z.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-x-4 gap-y-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-[9px] opacity-30 uppercase tracking-widest mb-0.5`,children:`requests`}),(0,z.jsx)(`div`,{className:`text-sm font-semibold font-mono tabular-nums opacity-70`,children:T.totalRequests>0?T.totalRequests.toLocaleString():(0,z.jsx)(`span`,{className:`opacity-30 text-xs`,children:`—`})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-[9px] opacity-30 uppercase tracking-widest mb-0.5`,children:`error rate`}),(0,z.jsx)(`div`,{className:`text-sm font-semibold font-mono tabular-nums ${T.errorRate>.05?`text-error/80`:`opacity-70`}`,children:T.totalRequests>0?`${Math.round(T.errorRate*100)}%`:(0,z.jsx)(`span`,{className:`opacity-30 text-xs`,children:`—`})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-[9px] opacity-30 uppercase tracking-widest mb-0.5`,children:`data in/out`}),(0,z.jsx)(`div`,{className:`text-sm font-semibold font-mono tabular-nums opacity-70`,children:T.totalBytesIn+T.totalBytesOut>0?Z(T.totalBytesIn+T.totalBytesOut):(0,z.jsx)(`span`,{className:`opacity-30 text-xs`,children:`—`})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-[9px] opacity-30 uppercase tracking-widest mb-0.5`,children:`connections`}),(0,z.jsx)(`div`,{className:`text-sm font-semibold font-mono tabular-nums opacity-70`,children:T.activeEdges>0?`${T.activeEdges} paths`:(0,z.jsx)(`span`,{className:`opacity-30 text-xs`,children:`—`})})]})]}):(0,z.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-[9px] opacity-30 uppercase tracking-widest mb-0.5`,children:`routes`}),(0,z.jsx)(`div`,{className:`text-sm font-semibold font-mono tabular-nums opacity-70`,children:T.routeCount>0?T.routeCount:(0,z.jsx)(`span`,{className:`opacity-30 text-xs`,children:`—`})})]}),T.localDomain&&(0,z.jsxs)(`div`,{className:`col-span-2`,children:[(0,z.jsx)(`div`,{className:`text-[9px] opacity-30 uppercase tracking-widest mb-0.5`,children:`domain`}),(0,z.jsx)(`div`,{className:`text-xs font-mono opacity-55 truncate`,children:T.localDomain})]})]})]}),(0,z.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,z.jsx)(ae,{id:e.id,running:e.running,state:g})})]})]})}function Se({service:e,onRefresh:t}){let[n,r]=(0,R.useState)(!1),[i,o]=(0,R.useState)(!1),s=e.state??(e.running?`running`:`stopped`),c=q(s),f=s===`stopped`||s===`crashed`,p=s===`running`||s===`starting`,m=(e.runtimeServiceKind===`mesh`?`mesh`:`proxy`)==`mesh`?`network runtime · mesh`:`network runtime · ingress`,g=(0,R.useCallback)(async n=>{o(!0);try{await a.post(`/services/${e.id}/${n}`,{}),setTimeout(()=>t?.(),300)}finally{o(!1)}},[e.id,t]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`rounded-md border border-base-content/[0.08] bg-base-200/30 overflow-hidden relative`,children:[(0,z.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 w-[3px] ${s===`running`?`bg-primary/40`:s===`starting`?`bg-primary/20 animate-pulse`:`bg-base-content/10`} transition-colors duration-300`}),(0,z.jsx)(`div`,{className:`pl-3.5 pr-3 py-2.5`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(u,{className:`size-3.5 shrink-0 ${c.dot}${c.spinning?` animate-pulse`:``}`}),(0,z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,z.jsx)(`span`,{className:`font-medium text-sm truncate`,children:e.name}),(0,z.jsx)(`span`,{className:`badge badge-xs badge-outline opacity-60`,children:m}),e.port&&(0,z.jsxs)(`span`,{className:`text-[10px] font-mono opacity-35`,children:[`:`,e.port]})]}),(0,z.jsx)(`div`,{className:`font-mono text-[11px] opacity-35 truncate mt-1`,children:e.command})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-45 hover:opacity-90`,onClick:()=>r(!0),title:`Logs`,children:(0,z.jsx)(F,{className:`size-3.5`})}),(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-45 hover:opacity-90`,onClick:()=>g(`restart`),disabled:i,title:`Restart`,children:i?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(D,{className:`size-3`})}),p&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost text-error opacity-50 hover:opacity-100`,onClick:()=>g(`stop`),disabled:i,title:`Stop`,children:i?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(h,{className:`size-3`})}),f&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost text-success opacity-50 hover:opacity-100`,onClick:()=>g(`start`),disabled:i,title:`Start`,children:i?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(d,{className:`size-3`})})]})]})})]}),n&&(0,z.jsx)(xe,{service:e,onClose:()=>r(!1),onRefresh:t})]})}function Ce(){return(0,z.jsx)(`div`,{className:`rounded-md bg-base-200/50 animate-pulse`,children:(0,z.jsxs)(`div`,{className:`px-3.5 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,z.jsx)(`div`,{className:`h-3.5 w-24 rounded bg-base-300 flex-1 max-w-[8rem]`}),(0,z.jsx)(`div`,{className:`h-4 w-12 rounded-full bg-base-300 shrink-0`})]}),(0,z.jsx)(`div`,{className:`h-2.5 w-36 rounded bg-base-300 mb-2`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`div`,{className:`h-2.5 w-12 rounded bg-base-300`}),(0,z.jsx)(`div`,{className:`h-2.5 w-10 rounded bg-base-300`}),(0,z.jsx)(`div`,{className:`h-2.5 w-14 rounded bg-base-300`})]})]})})}function we(e){let t=(e||`unknown`).toLowerCase();return t===`https`?`#2563eb`:t===`http`?`#22c55e`:t===`wss`?`#7c3aed`:t===`ws`?`#c026d3`:t===`tcp`?`#f59e0b`:t===`grpc`?`#0ea5e9`:`#6b7280`}function X(e){return e?String(e).toUpperCase():`unknown`}function Te(e,t){if(!e||!t)return null;let n=Date.parse(e),r=Date.parse(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<n)return null;let i=Math.max(0,r-n);if(i<1e3)return`<1s window`;if(i<6e4)return`${Math.round(i/1e3)}s window`;let a=i/6e4;return a<10?`${a.toFixed(1)}m window`:`${Math.round(a)}m window`}function Ee(e){let t=Number(e??0);if(!Number.isFinite(t)||t<=0)return null;if(t<60)return`${t}s target`;let n=t/60;return n<10?`${n.toFixed(1)}m target`:`${Math.round(n)}m target`}function Z(e){let t=Number(e??0);return!Number.isFinite(t)||t<=0?`0B`:t<1024?`${Math.round(t)}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function De(e,t=Date.now()){let n=Date.parse(e??``);if(!Number.isFinite(n))return null;let r=Math.max(0,t-n);if(r<1e3)return`just now`;if(r<6e4)return`${Math.round(r/1e3)}s ago`;let i=r/6e4;return i<10?`${i.toFixed(1)}m ago`:`${Math.round(i)}m ago`}function Q(e,t=4){return Object.entries(e??{}).filter(([,e])=>Number(e)>0).sort((e,t)=>Number(t[1])-Number(e[1])).slice(0,t)}function Oe(e,t=2){return Object.entries(e??{}).filter(([,e])=>Number(e)>0).sort((e,t)=>Number(t[1])-Number(e[1])).slice(0,t).map(([e])=>X(e))}function ke(e,t,n,r=3){if(!e?.edges?.length||!t)return[];let i=new Map;for(let r of e.edges){let e=typeof r.source==`object`?r.source.id:r.source,a=typeof r.target==`object`?r.target.id:r.target,o=n===`inbound`?a===t?e:null:e===t?a:null;if(!o)continue;let s=i.get(o)??{id:o,requestCount:0,errorCount:0,bytesIn:0,bytesOut:0,lastSeenAt:null,protocols:{}};s.requestCount+=Number(r.requestCount??0),s.errorCount+=Number(r.errorCount??0),s.bytesIn+=Number(r.bytesIn??0),s.bytesOut+=Number(r.bytesOut??0);let c=String(r.dominantProtocol??`unknown`).toLowerCase();s.protocols[c]=Number(s.protocols[c]??0)+Number(r.requestCount??0),(!s.lastSeenAt||Date.parse(r.lastSeenAt??``)>Date.parse(s.lastSeenAt??``))&&(s.lastSeenAt=r.lastSeenAt??s.lastSeenAt),i.set(o,s)}return Array.from(i.values()).sort((e,t)=>t.requestCount===e.requestCount?Date.parse(t.lastSeenAt??``)-Date.parse(e.lastSeenAt??``):t.requestCount-e.requestCount).slice(0,r).map(e=>({...e,errorRate:e.requestCount>0?e.errorCount/e.requestCount:0,topProtocols:Oe(e.protocols,2)}))}function Ae(e){if(e?.id)return e.id;let t=typeof e?.source==`object`?e.source.id:e?.source,n=typeof e?.target==`object`?e.target.id:e?.target,r=e?.dominantProtocol??e?.protocol??`unknown`;return`${t??`unknown`}\u0000${n??`unknown`}\u0000${r}`}function je(e){return String(e??``).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\n`)}function Me(e){return String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var $={base:`#ffffff`,surface:`#f8fafc`,surfaceAlt:`#eef2ff`,border:`#cbd5e1`,borderStrong:`#94a3b8`,text:`#0f172a`,textMuted:`#64748b`,primary:`#2563eb`,success:`#16a34a`,error:`#dc2626`,warning:`#d97706`};function Ne(e,t){let n=String(e??``).trim().match(/^([0-9.]+)\s+([0-9.]+)%\s+([0-9.]+)%$/);if(!n)return t;let r=Number(n[1])/360,i=Number(n[2])/100,a=Number(n[3])/100;if(![r,i,a].every(e=>Number.isFinite(e)))return t;if(i===0){let e=Math.round(a*255).toString(16).padStart(2,`0`);return`#${e}${e}${e}`}let o=(e,t,n)=>{let r=n;return r<0&&(r+=1),r>1&&--r,r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e},s=a<.5?a*(1+i):a+i-a*i,c=2*a-s;return`#${[Math.round(o(c,s,r+1/3)*255),Math.round(o(c,s,r)*255),Math.round(o(c,s,r-1/3)*255)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function Pe(){if(typeof window>`u`)return $;let e=getComputedStyle(document.documentElement),t=(t,n)=>{let r=e.getPropertyValue(t).trim();return r?Ne(r,n):n};return{base:t(`--b1`,$.base),surface:t(`--b2`,$.surface),surfaceAlt:t(`--b3`,$.surfaceAlt),border:t(`--b3`,$.border),borderStrong:t(`--n`,$.borderStrong),text:t(`--bc`,$.text),textMuted:t(`--nc`,$.textMuted),primary:t(`--p`,$.primary),success:t(`--su`,$.success),error:t(`--er`,$.error),warning:t(`--wa`,$.warning)}}function Fe(e,t,n,r){if(!e?.nodes?.length)return{dot:``,edgeLookup:new Map};let i=t?Ae(t):null,a=new Set;if(n!=null){a.add(n);for(let t of e.edges??[]){let e=typeof t.source==`object`?t.source.id:t.source,r=typeof t.target==`object`?t.target.id:t.target;e===n&&r&&a.add(r),r===n&&e&&a.add(e)}}let o=Math.max(...(e.edges??[]).map(e=>Number(e.requestCount??0)),1),s=new Map;e.nodes.forEach((e,t)=>{s.set(e.id,`node_${t}`)});let c=new Map,l=[`digraph ServiceMesh {`,` graph [rankdir=LR, bgcolor="transparent", pad="0.3", nodesep="0.45", ranksep="0.85", overlap=false, splines=true, concentrate=true];`,` node [shape=box, style="rounded,filled", fontname="Helvetica", fontsize=11, margin="0.18,0.14", color="${r.border}", fillcolor="${r.base}", fontcolor="${r.text}", penwidth=1.1];`,` edge [fontname="Helvetica", fontsize=9, color="${r.borderStrong}", arrowsize=0.7, penwidth=1.6];`];for(let t of e.nodes){let e=s.get(t.id),i=t.external===!0,o=Number(t.requestsIn??0),c=Number(t.errorsIn??0),u=o>0?Math.round(c/o*100):0,d=n===t.id,f=n!=null&&!a.has(t.id),p=i?r.borderStrong:t.state===`crashed`?r.error:t.state===`running`||t.state===`starting`?r.success:r.borderStrong,m=d?r.primary:f?r.border:p,h=d?r.surfaceAlt:f||i?r.surface:r.base,g=f?r.textMuted:r.text,_=f?r.textMuted:d?r.primary:r.textMuted,v=d?2.4:1.2,y=i?`rounded,dashed,filled`:`rounded,filled`,b=[];t.port&&b.push(`:${t.port}`),!i&&o>0&&b.push(`${o} req`),!i&&u>0&&b.push(`${u}% err`);let x=Me(t.name),S=b.length>0?Me(b.join(` · `)):``,C=S?`<
3
+ <TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0">
4
+ <TR><TD><FONT POINT-SIZE="12"><B>${x}</B></FONT></TD></TR>
5
+ <TR><TD><FONT POINT-SIZE="9" COLOR="${_}">${S}</FONT></TD></TR>
6
+ </TABLE>
7
+ >`:`<
8
+ <TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0">
9
+ <TR><TD><FONT POINT-SIZE="12"><B>${x}</B></FONT></TD></TR>
10
+ </TABLE>
11
+ >`;l.push(` ${e} [label=${C}, color="${m}", fillcolor="${h}", fontcolor="${g}", penwidth=${v}, style="${y}", URL="mesh://node/${encodeURIComponent(t.id)}", tooltip="${je(t.name)}"];`)}for(let t of e.edges??[]){let e=typeof t.source==`object`?t.source.id:t.source,a=typeof t.target==`object`?t.target.id:t.target;if(!s.has(e)||!s.has(a))continue;let u=Ae(t);c.set(u,t);let d=Number(t.requestCount??0),f=Number(t.errorCount??0),p=Number(t.avgLatencyMs??0),m=d>0?f/d:0,h=i===u,g=n!=null&&!(n!=null&&(e===n||a===n)),_=1.4+Math.log1p(d)/Math.log1p(o)*4.2,v=h?r.primary:g?r.border:f>0?m>=.15?r.error:r.warning:r.borderStrong,y=h?(_+1.4).toFixed(2):_.toFixed(2),b=`${e} → ${a} | ${d} req | ${X(t.dominantProtocol)}${p>0?` | ${p}ms`:``}${f>0?` | ${f} err`:``}`;l.push(` ${s.get(e)} -> ${s.get(a)} [color="${v}", penwidth=${y}, URL="mesh://edge/${encodeURIComponent(u)}", tooltip="${je(b)}"];`)}return l.push(`}`),{dot:l.join(`
12
+ `),edgeLookup:c}}function Ie({graph:e,onSelectEdge:t,selectedEdge:n,selectedServiceId:r,proxyRoutes:i,localDomain:a,proxyPort:o,onSelectService:s}){let[c,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(()=>$);(0,R.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>h(Pe());e();let t=new MutationObserver(()=>e());return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`class`,`style`]}),()=>t.disconnect()},[]);let{dot:g,edgeLookup:_}=(0,R.useMemo)(()=>Fe(e,n,r,m),[e,n,r,m]);(0,R.useEffect)(()=>{if(!g){l(null);return}let e=!0;return d(!0),p(null),(async()=>{try{let{instance:t}=await O(async()=>{let{instance:e}=await import(`./viz-Dsh_q2DK.js`);return{instance:e}},[]),n=(await t()).renderString(g,{format:`svg`,engine:`dot`});e&&l(n)}catch(t){e&&p(t instanceof Error?t.message:String(t))}finally{e&&d(!1)}})(),()=>{e=!1}},[g]);let v=(0,R.useCallback)(e=>{let n=e.target?.closest?.(`a`);if(!n)return;let r=n.getAttribute(`xlink:href`)||n.getAttribute(`href`)||``;if(r.startsWith(`mesh://`)){if(e.preventDefault(),r.startsWith(`mesh://node/`)){let e=decodeURIComponent(r.slice(12));e&&s?.(e);return}if(r.startsWith(`mesh://edge/`)){let e=decodeURIComponent(r.slice(12));t?.(_.get(e)??null)}}},[_,t,s]);return!e||!e.nodes.length?(0,z.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 opacity-20`,children:[(0,z.jsx)(T,{className:`size-5`}),(0,z.jsx)(`span`,{className:`text-xs`,children:`Start services and trigger inter-service HTTP(S) traffic to see the mesh`})]}):(0,z.jsxs)(`div`,{className:`w-full h-full overflow-auto rounded-box bg-base-100/40 border border-base-content/[0.06]`,children:[u&&(0,z.jsx)(`div`,{className:`flex items-center justify-center h-full text-sm opacity-40`,children:`Rendering graph...`}),f&&(0,z.jsxs)(`div`,{className:`flex items-center justify-center h-full text-sm text-error/70 px-6 text-center`,children:[`Failed to render service mesh: `,f]}),!u&&!f&&c&&(0,z.jsx)(`div`,{className:`min-w-max min-h-full p-4 [&_svg]:max-w-none [&_svg]:h-auto [&_svg]:cursor-default [&_a]:cursor-pointer`,onClick:v,dangerouslySetInnerHTML:{__html:c}})]})}function Le(){return(0,z.jsx)(`div`,{className:`absolute top-2 right-2 z-10 pointer-events-none`,children:(0,z.jsxs)(`div`,{className:`bg-base-200/80 backdrop-blur-sm border border-base-content/[0.06] rounded px-2.5 py-2 text-[10px] space-y-1.5 shadow-sm`,children:[(0,z.jsx)(`div`,{className:`font-semibold opacity-45 uppercase tracking-wider`,children:`Graph Legend`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`div`,{className:`h-[2px] w-5 rounded-full bg-base-content/35`}),(0,z.jsx)(`div`,{className:`h-[2px] w-8 rounded-full bg-base-content/35`})]}),(0,z.jsx)(`span`,{className:`opacity-45`,children:`width = volume`})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`div`,{className:`h-[2px] w-6 rounded-full bg-success/80`}),(0,z.jsx)(`div`,{className:`h-[2px] w-6 rounded-full bg-error/80`})]}),(0,z.jsx)(`span`,{className:`opacity-45`,children:`edge color = health`})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`div`,{className:`size-4 rounded border-2 bg-base-100 border-success/80`}),(0,z.jsx)(`div`,{className:`size-4 rounded border-2 bg-base-100 border-error/80`}),(0,z.jsx)(`div`,{className:`size-4 rounded border-2 border-dashed bg-base-100 border-base-content/40`})]}),(0,z.jsx)(`span`,{className:`opacity-45`,children:`node border = state`})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`div`,{className:`px-2 py-0.5 rounded bg-info/20 border border-info/60 text-[9px] font-mono`,children:`click`}),(0,z.jsx)(`span`,{className:`opacity-45`,children:`click node/edge to inspect`})]})]})})}function Re({service:e,nodeMetrics:t,inboundPeers:n,outboundPeers:r,inboundPeerTotal:i=0,outboundPeerTotal:a=0,onSelectPeer:o}){if(!e||!t)return null;let s=Oe(t.protocols,3),c=Math.max(0,Number(i??0)-Number(n?.length??0)),l=Math.max(0,Number(a??0)-Number(r?.length??0)),u=e=>{let t=Number(e?.errorRate??0);return t>=.25?`text-error`:t>0?`text-warning`:``};return(0,z.jsx)(`div`,{className:`absolute bottom-2 left-2 z-10`,children:(0,z.jsxs)(`div`,{className:`bg-base-200/88 backdrop-blur-sm border border-base-content/[0.06] rounded px-2.5 py-2 text-[10px] shadow-sm max-w-[320px]`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`font-semibold opacity-70 truncate`,children:e.name}),e.port&&(0,z.jsxs)(`span`,{className:`font-mono opacity-30`,children:[`:`,e.port]}),(0,z.jsx)(`span`,{className:`flex-1`}),t.lastSeenAt&&(0,z.jsx)(`span`,{className:`opacity-25`,children:De(t.lastSeenAt)})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 mt-1 font-mono`,children:[(0,z.jsxs)(`span`,{className:`opacity-45`,children:[t.requestsIn??0,` in`]}),(0,z.jsxs)(`span`,{className:`opacity-45`,children:[t.requestsOut??0,` out`]}),((t.bytesIn??0)>0||(t.bytesOut??0)>0)&&(0,z.jsxs)(`span`,{className:`opacity-40`,children:[Z(t.bytesIn),` / `,Z(t.bytesOut)]}),(t.activeFlows??0)>0&&(0,z.jsxs)(`span`,{className:`opacity-45`,children:[t.activeFlows,` active`]}),(t.errorsIn??0)>0&&(0,z.jsxs)(`span`,{className:`text-error/80`,children:[t.errorsIn,` err in`]}),(t.errorsOut??0)>0&&(0,z.jsxs)(`span`,{className:`text-error/80`,children:[t.errorsOut,` err out`]})]}),s.length>0&&(0,z.jsx)(`div`,{className:`mt-1 font-mono opacity-35`,children:s.join(` · `)}),(n?.length>0||r?.length>0)&&(0,z.jsxs)(`div`,{className:`mt-1.5 space-y-1 font-mono`,children:[n?.length>0&&(0,z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,z.jsx)(`span`,{className:`opacity-25 shrink-0`,children:`in`}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 min-w-0`,children:[n.map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>o?.(e.id),className:`pointer-events-auto opacity-40 hover:opacity-75 truncate transition-opacity ${u(e)}`,title:e.errorCount>0?`${e.errorCount} errors · ${Math.round((e.errorRate??0)*100)}% error`:`${e.requestCount} requests`,children:[e.id,(0,z.jsxs)(`span`,{className:`opacity-30`,children:[`:`,e.requestCount]}),e.errorCount>0&&(0,z.jsxs)(`span`,{className:`opacity-45`,children:[` !`,e.errorCount]}),e.topProtocols.length>0&&(0,z.jsxs)(`span`,{className:`opacity-25`,children:[` `,e.topProtocols.join(`/`)]})]},`in-${e.id}`)),c>0&&(0,z.jsxs)(`span`,{className:`opacity-25`,children:[`+`,c,` more`]})]})]}),r?.length>0&&(0,z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,z.jsx)(`span`,{className:`opacity-25 shrink-0`,children:`out`}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 min-w-0`,children:[r.map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>o?.(e.id),className:`pointer-events-auto opacity-40 hover:opacity-75 truncate transition-opacity ${u(e)}`,title:e.errorCount>0?`${e.errorCount} errors · ${Math.round((e.errorRate??0)*100)}% error`:`${e.requestCount} requests`,children:[e.id,(0,z.jsxs)(`span`,{className:`opacity-30`,children:[`:`,e.requestCount]}),e.errorCount>0&&(0,z.jsxs)(`span`,{className:`opacity-45`,children:[` !`,e.errorCount]}),e.topProtocols.length>0&&(0,z.jsxs)(`span`,{className:`opacity-25`,children:[` `,e.topProtocols.join(`/`)]})]},`out-${e.id}`)),l>0&&(0,z.jsxs)(`span`,{className:`opacity-25`,children:[`+`,l,` more`]})]})]})]})]})})}function ze({edge:e}){if(!e)return null;let t=typeof e.source==`object`?e.source.id:e.source,n=typeof e.target==`object`?e.target.id:e.target,r=(e.protocolCounts??[]).slice(0,3),i=Q(e.methodCounts),a=Q(e.statusClassCounts);return(0,z.jsx)(`div`,{className:`absolute bottom-2 left-2 z-10 pointer-events-none`,children:(0,z.jsxs)(`div`,{className:`bg-base-200/90 backdrop-blur-sm border border-base-content/[0.06] rounded px-2.5 py-2 text-[10px] shadow-sm max-w-[320px]`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(`span`,{className:`font-mono opacity-65 truncate`,children:[t,` → `,n]}),(0,z.jsx)(`span`,{className:`flex-1`}),e.lastSeenAt&&(0,z.jsx)(`span`,{className:`opacity-25`,children:De(e.lastSeenAt)})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 mt-1 font-mono`,children:[(0,z.jsxs)(`span`,{className:`opacity-45`,children:[e.requestCount,` req`]}),(0,z.jsxs)(`span`,{className:`opacity-45`,children:[e.avgLatencyMs,`ms`]}),(0,z.jsx)(`span`,{className:`opacity-45`,children:X(e.dominantProtocol)}),(e.bytesIn>0||e.bytesOut>0)&&(0,z.jsxs)(`span`,{className:`opacity-40`,children:[Z(e.bytesIn),` in / `,Z(e.bytesOut),` out`]}),(e.activeFlows??0)>0&&(0,z.jsxs)(`span`,{className:`opacity-45`,children:[e.activeFlows,` active`]}),(e.errorCount??0)>0&&(0,z.jsxs)(`span`,{className:`text-error/80`,children:[e.errorCount,` err`]})]}),r.length>0&&(0,z.jsx)(`div`,{className:`mt-1 font-mono opacity-35`,children:r.map(e=>`${X(e.protocol)}:${e.count}`).join(` · `)}),i.length>0&&(0,z.jsx)(`div`,{className:`mt-1 font-mono opacity-35`,children:i.map(([e,t])=>`${e}:${t}`).join(` · `)}),a.length>0&&(0,z.jsx)(`div`,{className:`mt-1 font-mono opacity-35`,children:a.map(([e,t])=>`${e}:${t}`).join(` · `)})]})})}function Be(){let{liveMode:e}=y(),{services:t,runtimeServices:n,loading:r,refresh:i}=I({liveMode:e,pollInterval:e?!1:15e3}),{graph:o,nativeGraph:s,status:c,clearMesh:u}=P({liveMode:e}),[d,g]=(0,R.useState)(null),[_,b]=(0,R.useState)(null),[x,S]=(0,R.useState)({routes:[],localDomain:null});(0,R.useEffect)(()=>{a.get(`/proxy/reverse/status`).then(e=>S(e)).catch(()=>{})},[]);let C=x?.routes??[],w=x?.localDomain??null,T=x?.port??4433,E=c?.running??!1,D=Te(s?.windowStart??o?.windowStart,s?.windowEnd??o?.windowEnd),O=Ee(c?.liveWindowSeconds),k=(0,R.useCallback)(()=>i(),[i]),A=t.find(e=>e.id===d)??null,j=o?.nodes?.find(e=>e.id===d)??null,M=(0,R.useMemo)(()=>ke(o,d,`inbound`,3),[o,d]),ee=(0,R.useMemo)(()=>ke(o,d,`outbound`,3),[o,d]),N=(0,R.useMemo)(()=>ke(o,d,`inbound`,2**53-1).length,[o,d]),F=(0,R.useMemo)(()=>ke(o,d,`outbound`,2**53-1).length,[o,d]);(0,R.useEffect)(()=>{d&&!r&&!A&&g(null)},[d,A,r]);let L=(0,R.useCallback)(e=>{g(t=>t===e?null:e)},[]),te=(0,R.useCallback)(()=>g(null),[]),ne=(0,R.useCallback)(async()=>{await a.post(`/services/start-all`,{}),await k()},[k]),re=(0,R.useCallback)(async()=>{await Promise.all(t.filter(e=>e.running).map(e=>a.post(`/services/${e.id}/stop`,{}))),await k()},[t,k]),[B,V]=(0,R.useState)(!1),H=(0,R.useCallback)(async()=>{V(!0);try{await a.post(`/services/kill-all`,{}),await k()}finally{V(!1)}},[k]),U=t.some(e=>e.running),W=t.length>0&&t.every(e=>e.running),G=t.filter(e=>e.running).length,K=e=>e.running||e.state===`starting`||e.state===`crashed`,q=t.filter(K),J=t.filter(e=>!K(e));return(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-base-200 shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,z.jsx)(f,{className:`size-3.5 opacity-35`}),(0,z.jsx)(`span`,{className:`text-xs font-semibold opacity-55 uppercase tracking-widest`,children:`Services`}),!r&&t.length>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,z.jsxs)(`span`,{className:`text-[11px] opacity-30 tabular-nums`,children:[G,`/`,t.length]}),(0,z.jsx)(`div`,{className:`w-16 h-1 rounded-full bg-base-300 overflow-hidden`,children:(0,z.jsx)(`div`,{className:`h-full bg-success/60 rounded-full transition-all duration-300`,style:{width:`${G/t.length*100}%`}})})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 mr-2`,title:E?`Mesh runtime active`:`Configure mesh in Settings → Services`,children:[(0,z.jsx)(p,{className:`size-3 ${E?`text-success/70`:`opacity-25`}`}),(0,z.jsx)(`span`,{className:`text-[10px] opacity-35`,children:`HTTP mesh`}),O&&(0,z.jsx)(`span`,{className:`text-[10px] opacity-20 tabular-nums`,children:O})]}),E&&(o?.totalRequests??0)>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 mr-1`,children:[(0,z.jsxs)(`span`,{className:`text-[10px] opacity-25 tabular-nums`,children:[o.totalRequests,` req · `,o.edges?.length??0,` conn`]}),D&&(0,z.jsx)(`span`,{className:`text-[10px] opacity-20 tabular-nums`,children:D}),_&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-40 hover:opacity-80 h-4 min-h-0 px-1 text-[10px]`,onClick:()=>b(null),children:`clear filter`}),(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-25 hover:opacity-60 h-4 min-h-0 px-1`,onClick:u,title:`Clear traffic data`,children:(0,z.jsx)(m,{className:`size-2.5`})})]}),t.length>0&&!W&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-50 hover:opacity-90`,onClick:ne,children:`Start all`}),U&&(0,z.jsx)(`button`,{className:`btn btn-xs btn-ghost text-error opacity-50 hover:opacity-90`,onClick:re,children:`Stop all`}),(U||E||n.some(e=>e.running))&&(0,z.jsxs)(`button`,{className:`btn btn-xs btn-error opacity-70 hover:opacity-100 gap-1`,onClick:H,disabled:B,title:`Stop all services, mesh, and proxy`,children:[B?(0,z.jsx)(l,{className:`size-3 animate-spin`}):(0,z.jsx)(h,{className:`size-3`}),`Kill all`]})]})]}),(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row min-h-0 overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`lg:w-[360px] xl:w-[392px] shrink-0 overflow-y-auto border-b lg:border-b-0 lg:border-r border-base-content/[0.06] p-2.5`,children:[r&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(Ce,{}),(0,z.jsx)(Ce,{}),(0,z.jsx)(Ce,{}),(0,z.jsx)(Ce,{})]}),!r&&t.length===0&&n.length===0&&(0,z.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 px-5 py-12`,children:[(0,z.jsx)(f,{className:`size-8 opacity-10`}),(0,z.jsxs)(`div`,{className:`text-center`,children:[(0,z.jsx)(`p`,{className:`text-sm font-medium opacity-60`,children:`No services configured`}),(0,z.jsx)(`p`,{className:`text-xs opacity-35 mt-1`,children:`Add services in Settings to manage them here.`})]})]}),!r&&n.length>0&&(0,z.jsxs)(`section`,{className:`mb-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold opacity-30 uppercase tracking-widest`,children:`Network Runtime`}),(0,z.jsx)(`div`,{className:`flex-1 h-px bg-base-content/5`}),(0,z.jsx)(`span`,{className:`text-[10px] opacity-20 tabular-nums`,children:n.length})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5`,children:n.map(e=>(0,z.jsx)(Se,{service:e,onRefresh:k},e.id))})]}),!r&&q.length>0&&(0,z.jsxs)(`section`,{className:`mb-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,z.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-success/60 shrink-0`}),(0,z.jsx)(`span`,{className:`text-[10px] font-semibold text-success/60 uppercase tracking-widest`,children:`Online`}),(0,z.jsx)(`div`,{className:`flex-1 h-px bg-success/[0.06]`}),(0,z.jsx)(`span`,{className:`text-[10px] opacity-25 tabular-nums`,children:q.length})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5`,children:q.map(e=>(0,z.jsx)(be,{service:e,selected:e.id===d,onSelect:L,onRefresh:k},e.id))})]}),!r&&J.length>0&&(0,z.jsxs)(`section`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,z.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-base-content/15 shrink-0`}),(0,z.jsx)(`span`,{className:`text-[10px] font-semibold opacity-25 uppercase tracking-widest`,children:`Offline`}),(0,z.jsx)(`div`,{className:`flex-1 h-px bg-base-content/[0.04]`}),(0,z.jsx)(`span`,{className:`text-[10px] opacity-20 tabular-nums`,children:J.length})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5`,children:J.map(e=>(0,z.jsx)(be,{service:e,selected:e.id===d,onSelect:L,onRefresh:k},e.id))})]})]}),(0,z.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-hidden`,children:(0,z.jsx)(`div`,{className:`flex-1 min-h-[300px] lg:min-h-0 relative`,children:E?(0,z.jsxs)(z.Fragment,{children:[_&&(0,z.jsxs)(`div`,{className:`absolute top-2 left-2 right-2 z-10 flex items-center gap-2 bg-base-200/90 backdrop-blur-sm rounded border border-base-content/[0.06] px-2.5 py-1.5 text-[10px] shadow-sm pointer-events-none`,children:[(0,z.jsxs)(`span`,{className:`font-mono opacity-60 truncate`,children:[typeof _.source==`object`?_.source.id:_.source,` → `,typeof _.target==`object`?_.target.id:_.target]}),(0,z.jsxs)(`span`,{className:`opacity-40 shrink-0 tabular-nums`,children:[_.requestCount,`req · `,_.avgLatencyMs,`ms`,` · `,X(_.dominantProtocol),(_.bytesIn>0||_.bytesOut>0)&&(0,z.jsxs)(`span`,{children:[` · `,Z(_.bytesIn),` in / `,Z(_.bytesOut),` out`]}),_.activeFlows>0&&(0,z.jsxs)(`span`,{children:[` · `,_.activeFlows,` active`]}),_.errorCount>0&&(0,z.jsxs)(`span`,{className:`text-error`,children:[` · `,_.errorCount,`err`]})]}),(0,z.jsx)(`span`,{className:`flex-1`}),_.lastSeenAt&&(0,z.jsx)(`span`,{className:`opacity-25 shrink-0`,children:De(_.lastSeenAt)}),D&&(0,z.jsx)(`span`,{className:`opacity-25 shrink-0`,children:D}),(0,z.jsx)(`button`,{className:`pointer-events-auto opacity-40 hover:opacity-80`,onClick:()=>b(null),children:(0,z.jsx)(v,{className:`size-3`})})]}),(0,z.jsx)(Ie,{graph:o,onSelectEdge:b,selectedEdge:_,selectedServiceId:d,proxyRoutes:C,localDomain:w,proxyPort:T,onSelectService:L}),!_&&(0,z.jsx)(Le,{}),!_&&A&&j&&(0,z.jsx)(Re,{service:A,nodeMetrics:j,inboundPeers:M,outboundPeers:ee,inboundPeerTotal:N,outboundPeerTotal:F,onSelectPeer:L}),_&&(0,z.jsx)(ze,{edge:_}),_&&(0,z.jsxs)(`div`,{className:`absolute bottom-2 right-2 bg-base-200/90 backdrop-blur-sm rounded border border-base-content/[0.06] px-2.5 py-2 text-[10px] pointer-events-none max-w-[280px]`,children:[_.protocolCounts?.length>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 font-mono`,children:[(0,z.jsx)(`span`,{className:`opacity-40 shrink-0`,children:`observed`}),(0,z.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:_.protocolCounts.slice(0,3).map(e=>(0,z.jsxs)(`span`,{className:`opacity-60`,style:{color:we(e.protocol)},children:[e.protocol,(0,z.jsxs)(`span`,{className:`opacity-40 text-base-content`,children:[`:`,e.count]})]},e.protocol))})]}),Q(_.methodCounts).length>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 font-mono`,children:[(0,z.jsx)(`span`,{className:`opacity-40 shrink-0`,children:`methods`}),(0,z.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:Q(_.methodCounts).map(([e,t])=>(0,z.jsxs)(`span`,{className:`opacity-60`,children:[e,(0,z.jsxs)(`span`,{className:`opacity-40 text-base-content`,children:[`:`,t]})]},e))})]}),Q(_.statusClassCounts).length>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 font-mono`,children:[(0,z.jsx)(`span`,{className:`opacity-40 shrink-0`,children:`status`}),(0,z.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:Q(_.statusClassCounts).map(([e,t])=>(0,z.jsxs)(`span`,{className:e.startsWith(`4`)||e.startsWith(`5`)?`text-error/80`:`opacity-60`,children:[e,(0,z.jsxs)(`span`,{className:`opacity-40 text-base-content`,children:[`:`,t]})]},e))})]}),_.topPaths?.length>0&&(0,z.jsx)(`div`,{className:`space-y-0.5`,children:_.topPaths.slice(0,4).map(e=>(0,z.jsxs)(`div`,{className:`flex items-center gap-2 font-mono`,children:[(0,z.jsx)(`span`,{className:`opacity-35 truncate`,children:e.path}),(0,z.jsxs)(`span`,{className:`shrink-0 opacity-50 tabular-nums`,children:[e.count,`×`]})]},e.path))}),(_.bytesIn>0||_.bytesOut>0)&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5 font-mono`,children:[(0,z.jsx)(`span`,{className:`opacity-40 shrink-0`,children:`bytes`}),(0,z.jsxs)(`span`,{className:`opacity-60`,children:[Z(_.bytesIn),` in`]}),(0,z.jsxs)(`span`,{className:`opacity-60`,children:[Z(_.bytesOut),` out`]})]})]}),!_&&(o?.totalRequests??0)>0&&(0,z.jsx)(`div`,{className:`absolute bottom-2 right-2 pointer-events-none`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-3 bg-base-200/80 backdrop-blur-sm border border-base-content/[0.06] rounded px-2.5 py-1.5 text-[10px] font-mono tabular-nums`,children:[(0,z.jsxs)(`span`,{className:`opacity-30`,children:[o.totalRequests,` req`]}),(0,z.jsx)(`span`,{className:`opacity-20`,children:`·`}),(0,z.jsxs)(`span`,{className:`opacity-30`,children:[o.edges?.length??0,` paths`]}),D&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`opacity-20`,children:`·`}),(0,z.jsx)(`span`,{className:`opacity-30`,children:D})]}),s?.edges?.length>0&&(()=>{let e=s.edges.map(e=>e.latency?.percentiles?.[`0.5`]??e.latency?.percentiles?.p50).filter(e=>e!=null),t=e.length?Math.round(e.reduce((e,t)=>e+t,0)/e.length*1e3):null;return t==null?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`opacity-20`,children:`·`}),(0,z.jsxs)(`span`,{className:`opacity-40 ${t>200?`text-warning`:``}`,children:[`p50 `,t,`ms`]})]})})()]})})]}):(0,z.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2`,children:[(0,z.jsx)(p,{className:`size-6 opacity-10`}),(0,z.jsxs)(`div`,{className:`text-center`,children:[(0,z.jsx)(`p`,{className:`text-sm font-medium opacity-30`,children:`Service Mesh`}),(0,z.jsx)(`p`,{className:`text-xs opacity-20 mt-0.5`,children:c?`Enable and configure mesh in /settings/services to capture traffic`:`Loading…`})]})]})})})]}),A&&(0,z.jsx)(le,{service:A,onClose:te,onRefresh:k,graph:o,proxyRoutes:C,localDomain:w,proxyPort:T},A.id)]})}export{B as Route};