@vohongtho.infotech/code-intel 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,10 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
6
6
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{fe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?de(n):``}function me(e,t){switch(e.tag){case 26:case 27:case 5:return de(e.type);case 16:return de(`Lazy`);case 13:return e.child!==t&&t!==null?de(`Suspense Fallback`):de(`Suspense`);case 19:return de(`SuspenseList`);case 0:case 15:return pe(e.type,!1);case 11:return pe(e.type.render,!1);case 1:return pe(e.type,!0);case 31:return de(`Activity`);default:return``}}function he(e){try{var t=``,n=null;do t+=me(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
7
  Error generating stack: `+e.message+`
8
8
  `+e.stack}}var ge=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,ve=t.unstable_cancelCallback,ye=t.unstable_shouldYield,be=t.unstable_requestPaint,xe=t.unstable_now,Se=t.unstable_getCurrentPriorityLevel,Ce=t.unstable_ImmediatePriority,we=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,Ee=t.unstable_LowPriority,De=t.unstable_IdlePriority,Oe=t.log,ke=t.unstable_setDisableYieldValue,Ae=null,je=null;function Me(e){if(typeof Oe==`function`&&ke(e),je&&typeof je.setStrictMode==`function`)try{je.setStrictMode(Ae,e)}catch{}}var Ne=Math.clz32?Math.clz32:Ie,Pe=Math.log,Fe=Math.LN2;function Ie(e){return e>>>=0,e===0?32:31-(Pe(e)/Fe|0)|0}var Le=256,Re=262144,ze=4194304;function Be(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ve(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Be(n))):i=Be(o):i=Be(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Be(n))):i=Be(o)):i=Be(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function He(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ue(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function We(){var e=ze;return ze<<=1,!(ze&62914560)&&(ze=4194304),e}function Ge(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ke(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ne(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Je(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Je(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ne(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ye(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ne(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Xe(e,t){var n=t&-t;return n=n&42?1:Ze(n),(n&(e.suspendedLanes|t))===0?n:0}function Ze(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Qe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function $e(){var e=N.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function et(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var tt=Math.random().toString(36).slice(2),nt=`__reactFiber$`+tt,rt=`__reactProps$`+tt,it=`__reactContainer$`+tt,at=`__reactEvents$`+tt,ot=`__reactListeners$`+tt,st=`__reactHandles$`+tt,ct=`__reactResources$`+tt,lt=`__reactMarker$`+tt;function ut(e){delete e[nt],delete e[rt],delete e[at],delete e[ot],delete e[st]}function dt(e){var t=e[nt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[it]||n[nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[nt])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function ft(e){if(e=e[nt]||e[it]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function pt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function mt(e){var t=e[ct];return t||=e[ct]={hoistableStyles:new Map,hoistableScripts:new Map},t}function ht(e){e[lt]=!0}var gt=new Set,_t={};function vt(e,t){yt(e,t),yt(e+`Capture`,t)}function yt(e,t){for(_t[e]=t,e=0;e<t.length;e++)gt.add(t[e])}var bt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),xt={},St={};function Ct(e){return ge.call(St,e)?!0:ge.call(xt,e)?!1:bt.test(e)?St[e]=!0:(xt[e]=!0,!1)}function wt(e,t,n){if(Ct(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Tt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Et(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Dt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ot(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function kt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function At(e){if(!e._valueTracker){var t=Ot(e)?`checked`:`value`;e._valueTracker=kt(e,t,``+e[t])}}function jt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ot(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Mt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Nt=/[\n"\\]/g;function Pt(e){return e.replace(Nt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ft(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Dt(t)):e.value!==``+Dt(t)&&(e.value=``+Dt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Lt(e,o,Dt(n)):Lt(e,o,Dt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Dt(s):e.removeAttribute(`name`)}function It(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){At(e);return}n=n==null?``:``+Dt(n),t=t==null?n:``+Dt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),At(e)}function Lt(e,t,n){t===`number`&&Mt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Rt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Dt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function zt(e,t,n){if(t!=null&&(t=``+Dt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Dt(n)}function Bt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(j(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Dt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),At(e)}function Vt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ht=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Ut(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ht.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Wt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Ut(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ut(e,o,t[o])}function Gt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Kt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`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`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`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`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`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`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),qt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Jt(e){return qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var Xt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qt=null,$t=null;function en(e){var t=ft(e);if(t&&(e=t.stateNode)){var n=e[rt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ft(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Pt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[rt]||null;if(!a)throw Error(i(90));Ft(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&jt(r)}break a;case`textarea`:zt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Rt(e,!!n.multiple,t,!1)}}}var tn=!1;function nn(e,t,n){if(tn)return e(t,n);tn=!0;try{return e(t)}finally{if(tn=!1,(Qt!==null||$t!==null)&&(yu(),Qt&&(t=Qt,e=$t,$t=Qt=null,en(t),e)))for(t=0;t<e.length;t++)en(e[t])}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[rt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var an=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,`passive`,{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return un=i.slice(e,1<r?1-r:void 0)}function fn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function pn(){return!0}function mn(){return!1}function hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?pn:mn,this.isPropagationStopped=mn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=hn(gn),U=h({},gn,{view:0,detail:0}),vn=hn(U),W,yn,bn,xn=h({},U,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==bn&&(bn&&e.type===`mousemove`?(W=e.screenX-bn.screenX,yn=e.screenY-bn.screenY):yn=W=0,bn=e),W)},movementY:function(e){return`movementY`in e?e.movementY:yn}}),Sn=hn(xn),Cn=hn(h({},xn,{dataTransfer:0})),wn=hn(h({},U,{relatedTarget:0})),Tn=hn(h({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),En=hn(h({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Dn=hn(h({},gn,{data:0})),On={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},kn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},An={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=An[e])?!!t[e]:!1}function Mn(){return jn}var Nn=hn(h({},U,{key:function(e){if(e.key){var t=On[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mn,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Pn=hn(h({},xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Fn=hn(h({},U,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mn})),In=hn(h({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Ln=hn(h({},xn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Rn=hn(h({},gn,{newState:0,oldState:0})),zn=[9,13,27,32],Bn=an&&`CompositionEvent`in window,Vn=null;an&&`documentMode`in document&&(Vn=document.documentMode);var Hn=an&&`TextEvent`in window&&!Vn,Un=an&&(!Bn||Vn&&8<Vn&&11>=Vn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Jn=!1;function Yn(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Xn(e,t){if(Jn)return e===`compositionend`||!Bn&&Kn(e,t)?(e=dn(),un=ln=cn=null,Jn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Un&&t.locale!==`ko`?null:t.data;default:return null}}var Zn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Qn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Zn[e.type]:t===`textarea`}function $n(e,t,n,r){Qt?$t?$t.push(r):$t=[r]:Qt=r,t=Td(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var er=null,tr=null;function nr(e){vd(e,0)}function rr(e){if(jt(pt(e)))return e}function ir(e,t){if(e===`change`)return t}var ar=!1;if(an){var or;if(an){var sr=`oninput`in document;if(!sr){var cr=document.createElement(`div`);cr.setAttribute(`oninput`,`return;`),sr=typeof cr.oninput==`function`}or=sr}else or=!1;ar=or&&(!document.documentMode||9<document.documentMode)}function lr(){er&&(er.detachEvent(`onpropertychange`,ur),tr=er=null)}function ur(e){if(e.propertyName===`value`&&rr(tr)){var t=[];$n(t,tr,e,Zt(e)),nn(nr,t)}}function dr(e,t,n){e===`focusin`?(lr(),er=t,tr=n,er.attachEvent(`onpropertychange`,ur)):e===`focusout`&&lr()}function fr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return rr(tr)}function pr(e,t){if(e===`click`)return rr(t)}function mr(e,t){if(e===`input`||e===`change`)return rr(t)}function hr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var gr=typeof Object.is==`function`?Object.is:hr;function _r(e,t){if(gr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ge.call(t,i)||!gr(e[i],t[i]))return!1}return!0}function vr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yr(e,t){var n=vr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=vr(n)}}function br(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?br(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mt(e.document)}return t}function Sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Cr=an&&`documentMode`in document&&11>=document.documentMode,wr=null,Tr=null,Er=null,Dr=!1;function Or(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Dr||wr==null||wr!==Mt(r)||(r=wr,`selectionStart`in r&&Sr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Er&&_r(Er,r)||(Er=r,r=Td(Tr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=wr)))}function kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ar={animationend:kr(`Animation`,`AnimationEnd`),animationiteration:kr(`Animation`,`AnimationIteration`),animationstart:kr(`Animation`,`AnimationStart`),transitionrun:kr(`Transition`,`TransitionRun`),transitionstart:kr(`Transition`,`TransitionStart`),transitioncancel:kr(`Transition`,`TransitionCancel`),transitionend:kr(`Transition`,`TransitionEnd`)},jr={},Mr={};an&&(Mr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ar.animationend.animation,delete Ar.animationiteration.animation,delete Ar.animationstart.animation),`TransitionEvent`in window||delete Ar.transitionend.transition);function Nr(e){if(jr[e])return jr[e];if(!Ar[e])return e;var t=Ar[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Mr)return jr[e]=t[n];return e}var Pr=Nr(`animationend`),Fr=Nr(`animationiteration`),Ir=Nr(`animationstart`),Lr=Nr(`transitionrun`),Rr=Nr(`transitionstart`),zr=Nr(`transitioncancel`),Br=Nr(`transitionend`),Vr=new Map,Hr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Hr.push(`scrollEnd`);function Ur(e,t){Vr.set(e,t),vt(t,[e])}var Wr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Gr=[],Kr=0,qr=0;function Jr(){for(var e=Kr,t=qr=Kr=0;t<e;){var n=Gr[t];Gr[t++]=null;var r=Gr[t];Gr[t++]=null;var i=Gr[t];Gr[t++]=null;var a=Gr[t];if(Gr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Qr(n,i,a)}}function Yr(e,t,n,r){Gr[Kr++]=e,Gr[Kr++]=t,Gr[Kr++]=n,Gr[Kr++]=r,qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xr(e,t,n,r){return Yr(e,t,n,r),$r(e)}function Zr(e,t){return Yr(e,null,null,t),$r(e)}function Qr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ne(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function $r(e){if(50<uu)throw uu=0,du=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ei={};function ti(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ni(e,t,n,r){return new ti(e,t,n,r)}function ri(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ii(e,t){var n=e.alternate;return n===null?(n=ni(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ai(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function oi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ri(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,ce.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ne:return e=ni(31,n,t,a),e.elementType=ne,e.lanes=o,e;case y:return si(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ni(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case ee:return e=ni(13,n,t,a),e.elementType=ee,e.lanes=o,e;case T:return e=ni(19,n,t,a),e.elementType=T,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case E:s=14;break a;case te:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ni(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function si(e,t,n,r){return e=ni(7,e,r,t),e.lanes=n,e}function ci(e,t,n){return e=ni(6,e,null,t),e.lanes=n,e}function li(e){var t=ni(18,null,null,0);return t.stateNode=e,t}function ui(e,t,n){return t=ni(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var di=new WeakMap;function fi(e,t){if(typeof e==`object`&&e){var n=di.get(e);return n===void 0?(t={value:e,source:t,stack:he(t)},di.set(e,t),t):n}return{value:e,source:t,stack:he(t)}}var pi=[],mi=0,hi=null,gi=0,_i=[],vi=0,yi=null,bi=1,xi=``;function Si(e,t){pi[mi++]=gi,pi[mi++]=hi,hi=e,gi=t}function Ci(e,t,n){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,yi=e;var r=bi;e=xi;var i=32-Ne(r)-1;r&=~(1<<i),n+=1;var a=32-Ne(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,bi=1<<32-Ne(t)+i|n<<i|r,xi=a+e}else bi=1<<a|n<<i|r,xi=e}function wi(e){e.return!==null&&(Si(e,1),Ci(e,1,0))}function Ti(e){for(;e===hi;)hi=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null;for(;e===yi;)yi=_i[--vi],_i[vi]=null,xi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null}function Ei(e,t){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,bi=t.id,xi=t.overflow,yi=e}var Di=null,Oi=null,G=!1,ki=null,Ai=!1,ji=Error(i(519));function Mi(e){throw Ri(fi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ji}function Ni(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[nt]=e,t[rt]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),It(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),Bt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||Mi(e,!0)}function Pi(e){for(Di=e.return;Di;)switch(Di.tag){case 5:case 31:case 13:Ai=!1;return;case 27:case 3:Ai=!0;return;default:Di=Di.return}}function Fi(e){if(e!==Di)return!1;if(!G)return Pi(e),G=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Ud(e.type,e.memoizedProps)),n=!n),n&&Oi&&Mi(e),Pi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=uf(e)}else t===27?(t=Oi,Zd(e.type)?(e=lf,lf=null,Oi=e):Oi=t):Oi=Di?cf(e.stateNode.nextSibling):null;return!0}function Ii(){Oi=Di=null,G=!1}function Li(){var e=ki;return e!==null&&(Xl===null?Xl=e:Xl.push.apply(Xl,e),ki=null),e}function Ri(e){ki===null?ki=[e]:ki.push(e)}var zi=oe(null),Bi=null,Vi=null;function Hi(e,t,n){F(zi,t._currentValue),t._currentValue=n}function Ui(e){e._currentValue=zi.current,se(zi)}function Wi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Gi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Wi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Wi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ki(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;gr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===R.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&Gi(t,e,n,r),t.flags|=262144}function qi(e){for(e=e.firstContext;e!==null;){if(!gr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ji(e){Bi=e,Vi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yi(e){return Zi(Bi,e)}function Xi(e,t){return Bi===null&&Ji(e),Zi(e,t)}function Zi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Vi===null){if(e===null)throw Error(i(308));Vi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Vi=Vi.next=t;return n}var Qi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},$i=t.unstable_scheduleCallback,ea=t.unstable_NormalPriority,ta={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function na(){return{controller:new Qi,data:new Map,refCount:0}}function ra(e){e.refCount--,e.refCount===0&&$i(ea,function(){e.controller.abort()})}var ia=null,aa=0,oa=0,sa=null;function ca(e,t){if(ia===null){var n=ia=[];aa=0,oa=ud(),sa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return aa++,t.then(la,la),t}function la(){if(--aa===0&&ia!==null){sa!==null&&(sa.status=`fulfilled`);var e=ia;ia=null,oa=0,sa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ua(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var da=M.S;M.S=function(e,t){$l=xe(),typeof t==`object`&&t&&typeof t.then==`function`&&ca(e,t),da!==null&&da(e,t)};var fa=oe(null);function pa(){var e=fa.current;return e===null?Ll.pooledCache:e}function ma(e,t){t===null?F(fa,fa.current):F(fa,t.pool)}function ha(){var e=pa();return e===null?null:{parent:ta._currentValue,pool:e}}var ga=Error(i(460)),_a=Error(i(474)),va=Error(i(542)),ya={then:function(){}};function ba(e){return e=e.status,e===`fulfilled`||e===`rejected`}function xa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ta(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=Ll,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ta(e),e}throw Ca=t,ga}}function Sa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ca=e,ga):e}}var Ca=null;function wa(){if(Ca===null)throw Error(i(459));var e=Ca;return Ca=null,e}function Ta(e){if(e===ga||e===va)throw Error(i(483))}var Ea=null,Da=0;function Oa(e){var t=Da;return Da+=1,Ea===null&&(Ea=[]),xa(Ea,e,t)}function ka(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Aa(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ja(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ii(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ci(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===te&&Sa(i)===t.type)?(t=a(t,n.props),ka(t,n),t.return=e,t):(t=oi(n.type,n.key,n.props,null,e.mode,r),ka(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ui(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=si(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ci(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=oi(t.type,t.key,t.props,null,e.mode,n),ka(n,t),n.return=e,n;case v:return t=ui(t,e.mode,n),t.return=e,t;case te:return t=Sa(t),f(e,t,n)}if(j(t)||O(t))return t=si(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Oa(t),n);if(t.$$typeof===C)return f(e,Xi(e,t),n);Aa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case te:return n=Sa(n),p(e,t,n,r)}if(j(n)||O(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Oa(n),r);if(n.$$typeof===C)return p(e,t,Xi(e,n),r);Aa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case te:return r=Sa(r),m(e,t,n,r,i)}if(j(r)||O(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Oa(r),i);if(r.$$typeof===C)return m(e,t,n,Xi(t,r),i);Aa(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),G&&Si(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return G&&Si(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),G&&Si(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),G&&Si(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return G&&Si(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),G&&Si(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===te&&Sa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ka(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=si(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=oi(o.type,o.key,o.props,null,e.mode,c),ka(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ui(o,e.mode,c),c.return=e,e=c}return s(e);case te:return o=Sa(o),b(e,r,o,c)}if(j(o))return h(e,r,o,c);if(O(o)){if(l=O(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Oa(o),c);if(o.$$typeof===C)return b(e,r,Xi(e,o),c);Aa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ci(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Da=0;var i=b(e,t,n,r);return Ea=null,i}catch(t){if(t===ga||t===va)throw t;var a=ni(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ma=ja(!0),Na=ja(!1),Pa=!1;function Fa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ia(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function La(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ra(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,J&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$r(e),Qr(e,null,n),t}return Yr(e,r,t,n),$r(e)}function za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}function Ba(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Va=!1;function Ha(){if(Va){var e=sa;if(e!==null)throw e}}function Ua(e,t,n,r){Va=!1;var i=e.updateQueue;Pa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(X&f)===f:(r&f)===f){f!==0&&f===oa&&(Va=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Pa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Wl|=o,e.lanes=o,e.memoizedState=d}}function Wa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ga(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Wa(n[e],t)}var Ka=oe(null),qa=oe(0);function Ja(e,t){e=Hl,F(qa,e),F(Ka,t),Hl=e|t.baseLanes}function Ya(){F(qa,Hl),F(Ka,Ka.current)}function Xa(){Hl=qa.current,se(Ka),se(qa)}var Za=oe(null),Qa=null;function $a(e){var t=e.alternate;F(io,io.current&1),F(Za,e),Qa===null&&(t===null||Ka.current!==null||t.memoizedState!==null)&&(Qa=e)}function eo(e){F(io,io.current),F(Za,e),Qa===null&&(Qa=e)}function to(e){e.tag===22?(F(io,io.current),F(Za,e),Qa===null&&(Qa=e)):no(e)}function no(){F(io,io.current),F(Za,Za.current)}function ro(e){se(Za),Qa===e&&(Qa=null),se(io)}var io=oe(0);function ao(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var oo=0,K=null,q=null,so=null,co=!1,lo=!1,uo=!1,fo=0,po=0,mo=null,ho=0;function go(){throw Error(i(321))}function _o(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gr(e[n],t[n]))return!1;return!0}function vo(e,t,n,r,i,a){return oo=a,K=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?Fs:Is,uo=!1,a=n(r,i),uo=!1,lo&&(a=bo(t,n,r,i)),yo(e),a}function yo(e){M.H=Ps;var t=q!==null&&q.next!==null;if(oo=0,so=q=K=null,co=!1,po=0,mo=null,t)throw Error(i(300));e===null||$s||(e=e.dependencies,e!==null&&qi(e)&&($s=!0))}function bo(e,t,n,r){K=e;var a=0;do{if(lo&&(mo=null),po=0,lo=!1,25<=a)throw Error(i(301));if(a+=1,so=q=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}M.H=Ls,o=t(n,r)}while(lo);return o}function xo(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?Oo(t):t,e=e.useState()[0],(q===null?null:q.memoizedState)!==e&&(K.flags|=1024),t}function So(){var e=fo!==0;return fo=0,e}function Co(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function wo(e){if(co){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}co=!1}oo=0,so=q=K=null,lo=!1,po=fo=0,mo=null}function To(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return so===null?K.memoizedState=so=e:so=so.next=e,so}function Eo(){if(q===null){var e=K.alternate;e=e===null?null:e.memoizedState}else e=q.next;var t=so===null?K.memoizedState:so.next;if(t!==null)so=t,q=e;else{if(e===null)throw K.alternate===null?Error(i(467)):Error(i(310));q=e,e={memoizedState:q.memoizedState,baseState:q.baseState,baseQueue:q.baseQueue,queue:q.queue,next:null},so===null?K.memoizedState=so=e:so=so.next=e}return so}function Do(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oo(e){var t=po;return po+=1,mo===null&&(mo=[]),e=xa(mo,e,t),t=K,(so===null?t.memoizedState:so.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?Fs:Is),e}function ko(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Oo(e);if(e.$$typeof===C)return Yi(e)}throw Error(i(438,String(e)))}function Ao(e){var t=null,n=K.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=K.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Do(),K.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=re;return t.index++,n}function jo(e,t){return typeof t==`function`?t(e):t}function Mo(e){return No(Eo(),q,e)}function No(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(oo&f)===f:(X&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===oa&&(d=!0);else if((oo&p)===p){u=u.next,p===oa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,K.lanes|=p,Wl|=p;f=u.action,uo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,K.lanes|=f,Wl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!gr(o,e.memoizedState)&&($s=!0,d&&(n=sa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Po(e){var t=Eo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);gr(o,t.memoizedState)||($s=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Fo(e,t,n){var r=K,a=Eo(),o=G;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!gr((q||a).memoizedState,n);if(s&&(a.memoizedState=n,$s=!0),a=a.queue,os(Ro.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||so!==null&&so.memoizedState.tag&1){if(r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,a,n,t),null),Ll===null)throw Error(i(349));o||oo&127||Io(r,t,n)}return n}function Io(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=K.updateQueue,t===null?(t=Do(),K.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lo(e,t,n,r){t.value=n,t.getSnapshot=r,zo(t)&&Bo(e)}function Ro(e,t,n){return n(function(){zo(t)&&Bo(e)})}function zo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gr(e,n)}catch{return!0}}function Bo(e){var t=Zr(e,2);t!==null&&mu(t,e,2)}function Vo(e){var t=To();if(typeof e==`function`){var n=e;if(e=n(),uo){Me(!0);try{n()}finally{Me(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:e},t}function Ho(e,t,n,r){return e.baseState=n,No(e,q,typeof r==`function`?r:jo)}function Uo(e,t,n,r,a){if(js(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};M.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Wo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Wo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),Go(e,t,s)}catch(n){qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),Go(e,t,a)}catch(n){qo(e,t,n)}}function Go(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ko(e,t,n)},function(n){return qo(e,t,n)}):Ko(e,t,n)}function Ko(e,t,n){t.status=`fulfilled`,t.value=n,Jo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Wo(e,n)))}function qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Jo(t),t=t.next;while(t!==r)}e.action=null}function Jo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Yo(e,t){return t}function Xo(e,t){if(G){var n=Ll.formState;if(n!==null){a:{var r=K;if(G){if(Oi){b:{for(var i=Oi,a=Ai;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Oi=cf(i.nextSibling),r=i.data===`F!`;break a}}Mi(r)}r=!1}r&&(t=n[0])}}return n=To(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:t},n.queue=r,n=Os.bind(null,K,r),r.dispatch=n,r=Vo(!1),a=As.bind(null,K,!1,r.queue),r=To(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Uo.bind(null,K,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Zo(e){return Qo(Eo(),q,e)}function Qo(e,t,n){if(t=No(e,t,Yo)[0],e=Mo(jo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Oo(t)}catch(e){throw e===ga?va:e}else r=t;t=Eo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(K.flags|=2048,ts(9,{destroy:void 0},$o.bind(null,i,n),null)),[r,a,e]}function $o(e,t){e.action=t}function es(e){var t=Eo(),n=q;if(n!==null)return Qo(t,n,e);Eo(),t=t.memoizedState,n=Eo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=K.updateQueue,t===null&&(t=Do(),K.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ns(){return Eo().memoizedState}function rs(e,t,n,r){var i=To();K.flags|=e,i.memoizedState=ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function is(e,t,n,r){var i=Eo();r=r===void 0?null:r;var a=i.memoizedState.inst;q!==null&&r!==null&&_o(r,q.memoizedState.deps)?i.memoizedState=ts(t,a,n,r):(K.flags|=e,i.memoizedState=ts(1|t,a,n,r))}function as(e,t){rs(8390656,8,e,t)}function os(e,t){is(2048,8,e,t)}function ss(e){K.flags|=4;var t=K.updateQueue;if(t===null)t=Do(),K.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function cs(e){var t=Eo().memoizedState;return ss({ref:t,nextImpl:e}),function(){if(J&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ls(e,t){return is(4,2,e,t)}function us(e,t){return is(4,4,e,t)}function ds(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fs(e,t,n){n=n==null?null:n.concat([e]),is(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&_o(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hs(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&_o(t,r[1]))return r[0];if(r=e(),uo){Me(!0);try{e()}finally{Me(!1)}}return n.memoizedState=[r,t],r}function gs(e,t,n){return n===void 0||oo&1073741824&&!(X&261930)?e.memoizedState=t:(e.memoizedState=n,e=pu(),K.lanes|=e,Wl|=e,n)}function _s(e,t,n,r){return gr(n,t)?n:Ka.current===null?!(oo&42)||oo&1073741824&&!(X&261930)?($s=!0,e.memoizedState=n):(e=pu(),K.lanes|=e,Wl|=e,t):(e=gs(e,n,r),gr(e,t)||($s=!0),e)}function vs(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};M.T=s,As(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,ua(c,r),fu(e)):ks(e,t,r,fu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},fu())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=xs(e).queue;vs(e,a,t,P,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:P},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},fu())}function Cs(){return Yi(Qf)}function ws(){return Eo().memoizedState}function Ts(){return Eo().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=fu();e=La(n);var r=Ra(t,e,n);r!==null&&(mu(r,t,n),za(r,t,n)),t={cache:na()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=fu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=Xr(e,t,n,r),n!==null&&(mu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,fu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,gr(s,o))return Yr(e,t,i,0),Ll===null&&Jr(),!1}catch{}if(n=Xr(e,t,i,r),n!==null)return mu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(i(479))}else t=Xr(e,n,r,2),t!==null&&mu(t,e,2)}function js(e){var t=e.alternate;return e===K||t!==null&&t===K}function Ms(e,t){lo=co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}var Ps={readContext:Yi,use:ko,useCallback:go,useContext:go,useEffect:go,useImperativeHandle:go,useLayoutEffect:go,useInsertionEffect:go,useMemo:go,useReducer:go,useRef:go,useState:go,useDebugValue:go,useDeferredValue:go,useTransition:go,useSyncExternalStore:go,useId:go,useHostTransitionStatus:go,useFormState:go,useActionState:go,useOptimistic:go,useMemoCache:go,useCacheRefresh:go};Ps.useEffectEvent=go;var Fs={readContext:Yi,use:ko,useCallback:function(e,t){return To().memoizedState=[e,t===void 0?null:t],e},useContext:Yi,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=To();t=t===void 0?null:t;var r=e();if(uo){Me(!0);try{e()}finally{Me(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=To();if(n!==void 0){var i=n(t);if(uo){Me(!0);try{n(t)}finally{Me(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,K,e),[r.memoizedState,e]},useRef:function(e){var t=To();return e={current:e},t.memoizedState=e},useState:function(e){e=Vo(e);var t=e.queue,n=Os.bind(null,K,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(To(),e,t)},useTransition:function(){var e=Vo(!1);return e=vs.bind(null,K,e.queue,!0,!1),To().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=K,a=To();if(G){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ll===null)throw Error(i(349));X&127||Io(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Ro.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,o,n,t),null),n},useId:function(){var e=To(),t=Ll.identifierPrefix;if(G){var n=xi,r=bi;n=(r&~(1<<32-Ne(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=fo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=ho++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Cs,useFormState:Xo,useActionState:Xo,useOptimistic:function(e){var t=To();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=As.bind(null,K,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ao,useCacheRefresh:function(){return To().memoizedState=Es.bind(null,K)},useEffectEvent:function(e){var t=To(),n={impl:e};return t.memoizedState=n,function(){if(J&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Is={readContext:Yi,use:ko,useCallback:ms,useContext:Yi,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Mo,useRef:ns,useState:function(){return Mo(jo)},useDebugValue:ps,useDeferredValue:function(e,t){return _s(Eo(),q.memoizedState,e,t)},useTransition:function(){var e=Mo(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:ws,useHostTransitionStatus:Cs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){return Ho(Eo(),q,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Is.useEffectEvent=cs;var Ls={readContext:Yi,use:ko,useCallback:ms,useContext:Yi,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Po,useRef:ns,useState:function(){return Po(jo)},useDebugValue:ps,useDeferredValue:function(e,t){var n=Eo();return q===null?gs(n,e,t):_s(n,q.memoizedState,e,t)},useTransition:function(){var e=Po(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:ws,useHostTransitionStatus:Cs,useFormState:es,useActionState:es,useOptimistic:function(e,t){var n=Eo();return q===null?(n.baseState=e,[e,n.queue.dispatch]):Ho(n,q,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Ls.useEffectEvent=cs;function Rs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var zs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fu(),i=La(r);i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(mu(t,e,r),za(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fu(),i=La(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(mu(t,e,r),za(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fu(),r=La(n);r.tag=2,t!=null&&(r.callback=t),t=Ra(e,r,n),t!==null&&(mu(t,e,n),za(t,e,n))}};function Bs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!_r(n,r)||!_r(i,a):!0}function Vs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&zs.enqueueReplaceState(t,t.state,null)}function Hs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Us(e){Wr(e)}function Ws(e){console.error(e)}function Gs(e){Wr(e)}function Ks(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){return n=La(n),n.tag=3,n.payload={element:null},n.callback=function(){Ks(e,t)},n}function Ys(e){return e=La(e),e.tag=3,e}function Xs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){qs(t,n,r),typeof i!=`function`&&(nu===null?nu=new Set([this]):nu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Zs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ki(t,n,a,!0),n=Za.current,n!==null){switch(n.tag){case 31:case 13:return Qa===null?Eu():n.alternate===null&&Ul===0&&(Ul=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ya?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,a)),!1;case 22:return n.flags|=65536,r===ya?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Wu(e,r,a)),!1}throw Error(i(435,n.tag))}return Wu(e,r,a),Eu(),!1}if(G)return t=Za.current,t===null?(r!==ji&&(t=Error(i(423),{cause:r}),Ri(fi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=fi(r,n),a=Js(e.stateNode,r,a),Ba(e,a),Ul!==4&&(Ul=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ji&&(e=Error(i(422),{cause:r}),Ri(fi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=fi(o,n),Yl===null?Yl=[o]:Yl.push(o),Ul!==4&&(Ul=2),t===null)return!0;r=fi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Js(n.stateNode,r,e),Ba(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(nu===null||!nu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ys(a),Xs(a,e,n,r),Ba(n,a),!1}n=n.return}while(n!==null);return!1}var Qs=Error(i(461)),$s=!1;function ec(e,t,n,r){t.child=e===null?Na(t,null,n,r):Ma(t,e.child,n,r)}function tc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Ji(t),r=vo(e,t,n,o,a,i),s=So(),e!==null&&!$s?(Co(e,t,i),Tc(e,t,i)):(G&&s&&wi(t),t.flags|=1,ec(e,t,r,i),t.child)}function nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ri(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,rc(e,t,a,r,i)):(e=oi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ec(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?_r:n,n(o,r)&&e.ref===t.ref)return Tc(e,t,i)}return t.flags|=1,e=ii(a,r),e.ref=t.ref,e.return=t,t.child=e}function rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(_r(a,r)&&e.ref===t.ref)if($s=!1,t.pendingProps=r=a,Ec(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Tc(e,t,i)}return dc(e,t,n,r,i)}function ic(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return oc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ma(t,a===null?null:a.cachePool),a===null?Ya():Ja(t,a),to(t);else return r=t.lanes=536870912,oc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ma(t,null),Ya(),no(t)):(ma(t,a.cachePool),Ja(t,a),no(t),t.memoizedState=null);return ec(e,t,i,n),t.child}function ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function oc(e,t,n,r,i){var a=pa();return a=a===null?null:{parent:ta._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ma(t,null),Ya(),to(t),e!==null&&Ki(e,t,r,!0),t.childLanes=i,null}function sc(e,t){return t=bc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function cc(e,t,n){return Ma(t,e.child,null,n),e=sc(t,t.pendingProps),e.flags|=2,ro(t),t.memoizedState=null,e}function lc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(G){if(r.mode===`hidden`)return e=sc(t,r),t.lanes=536870912,ac(null,e);if(eo(t),(e=Oi)?(e=rf(e,Ai),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Mi(t);return t.lanes=536870912,null}return sc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(eo(t),a)if(t.flags&256)t.flags&=-257,t=cc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if($s||Ki(e,t,n,!1),a=(n&e.childLanes)!==0,$s||a){if(r=Ll,r!==null&&(s=Xe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Zr(e,s),mu(r,e,s),Qs;Eu(),t=cc(e,t,n)}else e=o.treeContext,Oi=cf(s.nextSibling),Di=t,G=!0,ki=null,Ai=!1,e!==null&&Ei(t,e),t=sc(t,r),t.flags|=4096;return t}return e=ii(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function dc(e,t,n,r,i){return Ji(t),n=vo(e,t,n,r,void 0,i),r=So(),e!==null&&!$s?(Co(e,t,i),Tc(e,t,i)):(G&&r&&wi(t),t.flags|=1,ec(e,t,n,i),t.child)}function fc(e,t,n,r,i,a){return Ji(t),t.updateQueue=null,n=bo(t,r,n,i),yo(e),r=So(),e!==null&&!$s?(Co(e,t,a),Tc(e,t,a)):(G&&r&&wi(t),t.flags|=1,ec(e,t,n,a),t.child)}function pc(e,t,n,r,i){if(Ji(t),t.stateNode===null){var a=ei,o=n.contextType;typeof o==`object`&&o&&(a=Yi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=zs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Fa(t),o=n.contextType,a.context=typeof o==`object`&&o?Yi(o):ei,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Rs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&zs.enqueueReplaceState(a,a.state,null),Ua(t,r,a,i),Ha(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Hs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ei,typeof u==`object`&&u&&(o=Yi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Vs(t,a,r,o),Pa=!1;var f=t.memoizedState;a.state=f,Ua(t,r,a,i),Ha(),l=t.memoizedState,s||f!==l||Pa?(typeof d==`function`&&(Rs(t,n,d,r),l=t.memoizedState),(c=Pa||Bs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ia(e,t),o=t.memoizedProps,u=Hs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ei,typeof l==`object`&&l&&(c=Yi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Vs(t,a,r,c),Pa=!1,f=t.memoizedState,a.state=f,Ua(t,r,a,i),Ha();var p=t.memoizedState;o!==d||f!==p||Pa||e!==null&&e.dependencies!==null&&qi(e.dependencies)?(typeof s==`function`&&(Rs(t,n,s,r),p=t.memoizedState),(u=Pa||Bs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&qi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,uc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ma(t,e.child,null,i),t.child=Ma(t,null,n,i)):ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Tc(e,t,i),e}function mc(e,t,n,r){return Ii(),t.flags|=256,ec(e,t,n,r),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:ha()}}function _c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ql),e}function vc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(io.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(G){if(a?$a(t):no(t),(e=Oi)?(e=rf(e,Ai),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Mi(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(no(t),a=t.mode,c=bc({mode:`hidden`,children:c},a),r=si(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(null,r)):($a(t),yc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?($a(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState===null?(no(t),c=r.fallback,a=t.mode,r=bc({mode:`visible`,children:r.children},a),c=si(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ma(t,e.child,null,n),r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,t=ac(null,r)):(no(t),t.child=e.child,t.flags|=128,t=null);else if($a(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ri({value:r,source:null,stack:null}),t=xc(e,t,n)}else if($s||Ki(e,t,n,!1),s=(n&e.childLanes)!==0,$s||s){if(s=Ll,s!==null&&(r=Xe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Zr(e,r),mu(s,e,r),Qs;af(c)||Eu(),t=xc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Oi=cf(c.nextSibling),Di=t,G=!0,ki=null,Ai=!1,e!==null&&Ei(t,e),t=yc(t,r.children),t.flags|=4096);return t}return a?(no(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ii(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=si(c,a,n,null),c.flags|=2):c=ii(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ac(null,r),r=t.child,c=e.child.memoizedState,c===null?c=gc(n):(a=c.cachePool,a===null?a=ha():(l=ta._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(e.child,r)):($a(t),n=e.child,e=n.sibling,n=ii(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function yc(e,t){return t=bc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function bc(e,t){return e=ni(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return Ma(t,e.child,null,n),e=yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wi(e.return,t,n)}function Cc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function wc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=io.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,F(io,o),ec(e,t,r,n),r=G?gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sc(e,n,t);else if(e.tag===19)Sc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ao(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Cc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ao(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Cc(t,!0,n,null,a,r);break;case`together`:Cc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ki(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ec(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&qi(e))):!0}function Dc(e,t,n){switch(t.tag){case 3:z(t,t.stateNode.containerInfo),Hi(t,ta,e.memoizedState.cache),Ii();break;case 27:case 5:V(t);break;case 4:z(t,t.stateNode.containerInfo);break;case 10:Hi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?($a(t),e=Tc(e,t,n),e===null?null:e.sibling):vc(e,t,n):($a(t),t.flags|=128,null);$a(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Ki(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return wc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),F(io,io.current),r)break;return null;case 22:return t.lanes=0,ic(e,t,n,t.pendingProps);case 24:Hi(t,ta,e.memoizedState.cache)}return Tc(e,t,n)}function Oc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Ec(e,n)&&!(t.flags&128))return $s=!1,Dc(e,t,n);$s=!!(e.flags&131072)}else $s=!1,G&&t.flags&1048576&&Ci(t,gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Sa(t.elementType),t.type=e,typeof e==`function`)ri(e)?(r=Hs(e,r),t.tag=1,t=pc(null,t,e,r,n)):(t.tag=0,t=dc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=tc(null,t,e,r,n);break a}else if(a===E){t.tag=14,t=nc(null,t,e,r,n);break a}}throw t=A(e)||e,Error(i(306,t,``))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Hs(r,t.pendingProps),pc(e,t,r,a,n);case 3:a:{if(z(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ia(e,t),Ua(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Hi(t,ta,r),r!==o.cache&&Gi(t,[ta],n,!0),Ha(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=mc(e,t,r,n);break a}else if(r!==a){a=fi(Error(i(424)),t),Ri(a),t=mc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Oi=cf(e.firstChild),Di=t,G=!0,ki=null,Ai=!0,n=Na(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ii(),r===a){t=Tc(e,t,n);break a}ec(e,t,r,n)}t=t.child}return t;case 26:return uc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:G||(n=t.type,e=t.pendingProps,r=Bd(L.current).createElement(n),r[nt]=t,r[rt]=e,Pd(r,n,e),ht(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return V(t),e===null&&G&&(r=t.stateNode=ff(t.type,t.pendingProps,L.current),Di=t,Ai=!0,a=Oi,Zd(t.type)?(lf=a,Oi=cf(r.firstChild)):Oi=a),ec(e,t,t.pendingProps.children,n),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&G&&((a=r=Oi)&&(r=tf(r,t.type,t.pendingProps,Ai),r===null?a=!1:(t.stateNode=r,Di=t,Oi=cf(r.firstChild),Ai=!1,a=!0)),a||Mi(t)),V(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=vo(e,t,xo,null,null,n),Qf._currentValue=a),uc(e,t),ec(e,t,r,n),t.child;case 6:return e===null&&G&&((e=n=Oi)&&(n=nf(n,t.pendingProps,Ai),n===null?e=!1:(t.stateNode=n,Di=t,Oi=null,e=!0)),e||Mi(t)),null;case 13:return vc(e,t,n);case 4:return z(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ma(t,null,r,n):ec(e,t,r,n),t.child;case 11:return tc(e,t,t.type,t.pendingProps,n);case 7:return ec(e,t,t.pendingProps,n),t.child;case 8:return ec(e,t,t.pendingProps.children,n),t.child;case 12:return ec(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Hi(t,t.type,r.value),ec(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Ji(t),a=Yi(a),r=r(a),t.flags|=1,ec(e,t,r,n),t.child;case 14:return nc(e,t,t.type,t.pendingProps,n);case 15:return rc(e,t,t.type,t.pendingProps,n);case 19:return wc(e,t,n);case 31:return lc(e,t,n);case 22:return ic(e,t,n,t.pendingProps);case 24:return Ji(t),r=Yi(ta),e===null?(a=pa(),a===null&&(a=Ll,o=na(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Fa(t),Hi(t,ta,a)):((e.lanes&n)!==0&&(Ia(e,t),Ua(t,null,null,n),Ha()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Hi(t,ta,r),r!==a.cache&&Gi(t,[ta],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Hi(t,ta,r))),ec(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function kc(e){e.flags|=4}function Ac(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Cu())e.flags|=8192;else throw Ca=ya,_a}else e.flags&=-16777217}function jc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Cu())e.flags|=8192;else throw Ca=ya,_a}function Mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:We(),e.lanes|=t,Jl|=t)}function Nc(e,t){if(!G)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Pc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fc(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pc(t),null;case 1:return Pc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ui(ta),B(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?kc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Li())),Pc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(kc(t),o===null?(Pc(t),Ac(t,a,null,r,n)):(Pc(t),jc(t,o))):o?o===e.memoizedState?(Pc(t),t.flags&=-16777217):(kc(t),Pc(t),jc(t,o)):(e=e.memoizedProps,e!==r&&kc(t),Pc(t),Ac(t,a,e,r,n)),null;case 27:if(H(t),n=L.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}e=ce.current,Fi(t)?Ni(t,e):(e=ff(a,r,n),t.stateNode=e,kc(t))}return Pc(t),null;case 5:if(H(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}if(o=ce.current,Fi(t))Ni(t,o);else{var s=Bd(L.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[nt]=t,o[rt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=L.current,Fi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Di,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[nt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Mi(t,!0)}else e=Bd(e).createTextNode(r),e[nt]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[nt]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ro(t),t):(ro(t),null);if(t.flags&128)throw Error(i(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Fi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[nt]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),a=!1}else a=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ro(t),t):(ro(t),null)}return ro(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return B(),e===null&&xd(t.stateNode.containerInfo),Pc(t),null;case 10:return Ui(t.type),Pc(t),null;case 19:if(se(io),r=t.memoizedState,r===null)return Pc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Nc(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ao(e),o!==null){for(t.flags|=128,Nc(r,!1),e=o.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ai(n,e),n=n.sibling;return F(io,io.current&1|2),G&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&xe()>eu&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304)}else{if(!a)if(e=ao(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!G)return Pc(t),null}else 2*xe()-r.renderingStartTime>eu&&n!==536870912&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=xe(),e.sibling=null,n=io.current,F(io,a?n&1|2:n&1),G&&Si(t,r.treeForkCount),e);case 22:case 23:return ro(t),Xa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&se(fa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ui(ta),Pc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Ic(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(ta),B(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return H(t),null;case 31:if(t.memoizedState!==null){if(ro(t),t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return se(io),null;case 4:return B(),null;case 10:return Ui(t.type),null;case 22:case 23:return ro(t),Xa(),e!==null&&se(fa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ui(ta),null;case 25:return null;default:return null}}function Lc(e,t){switch(Ti(t),t.tag){case 3:Ui(ta),B();break;case 26:case 27:case 5:H(t);break;case 4:B();break;case 31:t.memoizedState!==null&&ro(t);break;case 13:ro(t);break;case 19:se(io);break;case 10:Ui(t.type);break;case 22:case 23:ro(t),Xa(),e!==null&&se(fa);break;case 24:Ui(ta)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Q(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Q(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Q(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ga(t,n)}catch(t){Q(e,e.return,t)}}}function Vc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Q(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Q(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Q(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Q(e,t,n)}else n.current=null}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Q(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[rt]=t}catch(t){Q(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[nt]=e,t[rt]=n}catch(t){Q(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Rd=sp,e=xr(e),Sr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Hs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Q(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&Rc(5,n);break;case 1:if(vl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Q(n,n.return,e)}else{var i=Hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Q(n,n.return,e)}}r&64&&Bc(n),r&512&&Hc(n,n.return);break;case 3:if(vl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ga(e,t)}catch(e){Q(n,n.return,e)}}break;case 27:t===null&&r&4&&Xc(n);case 26:case 5:vl(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ll(e,n);break;case 13:vl(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?bl(e,n,(n.subtreeFlags&8772)!=0):vl(e,n),Zc=i,Qc=a}break;case 30:break;default:vl(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ut(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var al=null,ol=!1;function sl(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(je&&typeof je.onCommitFiberUnmount==`function`)try{je.onCommitFiberUnmount(Ae,n)}catch{}switch(n.tag){case 26:Qc||Uc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Uc(n,t);var r=al,i=ol;Zd(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),pf(n.stateNode),al=r,ol=i;break;case 5:Qc||Uc(n,t);case 6:if(r=al,i=ol,al=null,sl(e,t,n),al=r,ol=i,al!==null)if(ol)try{(al.nodeType===9?al.body:al.nodeName===`HTML`?al.ownerDocument.body:al).removeChild(n.stateNode)}catch(e){Q(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){Q(n,t,e)}break;case 18:al!==null&&(ol?(e=al,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(al,n.stateNode));break;case 4:r=al,i=ol,al=n.stateNode.containerInfo,ol=!0,sl(e,t,n),al=r,ol=i;break;case 0:case 11:case 14:case 15:zc(2,n,t),Qc||zc(4,n,t),sl(e,t,n);break;case 1:Qc||(Uc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,sl(e,t,n),Qc=r;break;default:sl(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Q(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Q(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),t;default:throw Error(i(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function pl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){al=c.stateNode,ol=!1;break a}break;case 5:al=c.stateNode,ol=!1;break a;case 3:case 4:al=c.stateNode.containerInfo,ol=!0;break a}c=c.return}if(al===null)throw Error(i(160));cl(o,s,a),al=null,ol=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(zc(3,e,e.return),Rc(3,e),zc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&64&&Zc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ml;if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[lt]||o[nt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[nt]=e,ht(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[nt]=e,ht(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode);else e.stateNode=If(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),n!==null&&r&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),e.flags&32){a=e.stateNode;try{Vt(a,``)}catch(t){Q(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Gc(e,a,n===null?a:n.memoizedProps)),r&1024&&($c=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Q(e,e.return,t)}}break;case 3:if(Bf=null,a=ml,ml=gf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Q(e,e.return,t)}$c&&($c=!1,_l(e));break;case 4:r=ml,ml=gf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ql=xe()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Zc,d=Qc;if(Zc=u||a,Qc=d||l,pl(t,e),Qc=d,Zc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Zc||Qc||yl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Q(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Q(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Q(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Kc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Yc(e,qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Vt(o,``),n.flags&=-33),Yc(e,qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Jc(e,qc(e),s);break;default:throw Error(i(161))}}catch(t){Q(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zc(4,t,t.return),yl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),yl(t);break;case 27:pf(t.stateNode);case 26:case 5:Uc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:bl(i,a,n),Rc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Q(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Wa(c[i],s)}catch(e){Q(r,r.return,e)}}n&&o&64&&Bc(a),Hc(a,a.return);break;case 27:Xc(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ll(i,a);break;case 13:bl(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Hc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ra(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ra(e))}function Cl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wl(e,t,n,r),t=t.sibling}function wl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Cl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:Cl(e,t,n,r);break;case 3:Cl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ra(e)));break;case 12:if(i&2048){Cl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Q(t,t.return,e)}}else Cl(e,t,n,r);break;case 31:Cl(e,t,n,r);break;case 13:Cl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Cl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Cl(e,t,n,r):El(e,t),i&2048&&xl(o,t);break;case 24:Cl(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:Cl(e,t,n,r)}}function Tl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Tl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:El(n,r),i&2048&&xl(r.alternate,r);break;case 24:El(n,r),i&2048&&Sl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var Dl=8192;function Ol(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)kl(e,t,n),e=e.sibling}function kl(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&Dl&&e.memoizedState!==null&&Gf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=ml;ml=gf(e.stateNode.containerInfo),Ol(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,Ol(e,t,n),Dl=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function Al(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ml(e),e=e.sibling}function Ml(e){switch(e.tag){case 0:case 11:case 15:jl(e),e.flags&2048&&zc(9,e,e.return);break;case 3:jl(e);break;case 12:jl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nl(e)):jl(e);break;default:jl(e)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zc(8,t,t.return),Nl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nl(t));break;default:Nl(t)}e=e.sibling}}function Pl(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:zc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ra(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Fl={getCacheForType:function(e){var t=Yi(ta),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Yi(ta).controller.signal}},Il=typeof WeakMap==`function`?WeakMap:Map,J=0,Ll=null,Y=null,X=0,Z=0,Rl=null,zl=!1,Bl=!1,Vl=!1,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=null,Xl=null,Zl=!1,Ql=0,$l=0,eu=1/0,tu=null,nu=null,ru=0,iu=null,au=null,ou=0,su=0,cu=null,lu=null,uu=0,du=null;function fu(){return J&2&&X!==0?X&-X:M.T===null?$e():ud()}function pu(){if(ql===0)if(!(X&536870912)||G){var e=Re;Re<<=1,!(Re&3932160)&&(Re=262144),ql=e}else ql=536870912;return e=Za.current,e!==null&&(e.flags|=32),ql}function mu(e,t,n){(e===Ll&&(Z===2||Z===9)||e.cancelPendingCommit!==null)&&(xu(e,0),vu(e,X,ql,!1)),Ke(e,n),(!(J&2)||e!==Ll)&&(e===Ll&&(!(J&2)&&(Gl|=n),Ul===4&&vu(e,X,ql,!1)),nd(e))}function hu(e,t,n){if(J&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||He(e,t),a=r?ku(e,t):Du(e,t,!0),o=r;do{if(a===0){Bl&&!r&&vu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!_u(n)){a=Du(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Yl;var l=c.current.memoizedState.isDehydrated;if(l&&(xu(c,s).flags|=256),s=Du(c,s,!1),s!==2){if(Vl&&!l){c.errorRecoveryDisabledLanes|=o,Gl|=o,a=4;break a}o=Xl,Xl=a,o!==null&&(Xl===null?Xl=o:Xl.push.apply(Xl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){xu(e,0),vu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:vu(r,t,ql,!zl);break a;case 2:Xl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Ql+300-xe(),10<a)){if(vu(r,t,ql,!zl),Ve(r,0,!0)!==0)break a;ou=t,r.timeoutHandle=Kd(gu.bind(null,r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,o,`Throttled`,-0,0),a);break a}gu(r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,o,null,-0,0)}}break}while(1);nd(e)}function gu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yt},kl(t,a,d);var m=(a&62914560)===a?Ql-xe():(a&4194048)===a?$l-xe():0;if(m=qf(d,m),m!==null){ou=a,e.cancelPendingCommit=m(Iu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),vu(e,a,o,!l);return}}Iu(e,t,a,n,r,i,o,s,c)}function _u(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!gr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function vu(e,t,n,r){t&=~Kl,t&=~Gl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ne(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Je(e,n,t)}function yu(){return J&6?!0:(rd(0,!1),!1)}function bu(){if(Y!==null){if(Z===0)var e=Y.return;else e=Y,Vi=Bi=null,wo(e),Ea=null,Da=0,e=Y;for(;e!==null;)Lc(e.alternate,e),e=e.return;Y=null}}function xu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ou=0,bu(),Ll=e,Y=n=ii(e.current,null),X=t,Z=0,Rl=null,zl=!1,Bl=He(e,t),Vl=!1,Jl=ql=Kl=Gl=Wl=Ul=0,Xl=Yl=null,Zl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ne(r),a=1<<i;t|=e[i],r&=~a}return Hl=t,Jr(),n}function Su(e,t){K=null,M.H=Ps,t===ga||t===va?(t=wa(),Z=3):t===_a?(t=wa(),Z=4):Z=t===Qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Rl=t,Y===null&&(Ul=1,Ks(e,fi(t,e.current)))}function Cu(){var e=Za.current;return e===null?!0:(X&4194048)===X?Qa===null:(X&62914560)===X||X&536870912?e===Qa:!1}function wu(){var e=M.H;return M.H=Ps,e===null?Ps:e}function Tu(){var e=M.A;return M.A=Fl,e}function Eu(){Ul=4,zl||(X&4194048)!==X&&Za.current!==null||(Bl=!0),!(Wl&134217727)&&!(Gl&134217727)||Ll===null||vu(Ll,X,ql,!1)}function Du(e,t,n){var r=J;J|=2;var i=wu(),a=Tu();(Ll!==e||X!==t)&&(tu=null,xu(e,t)),t=!1;var o=Ul;a:do try{if(Z!==0&&Y!==null){var s=Y,c=Rl;switch(Z){case 8:bu(),o=6;break a;case 3:case 2:case 9:case 6:Za.current===null&&(t=!0);var l=Z;if(Z=0,Rl=null,Nu(e,s,c,l),n&&Bl){o=0;break a}break;default:l=Z,Z=0,Rl=null,Nu(e,s,c,l)}}Ou(),o=Ul;break}catch(t){Su(e,t)}while(1);return t&&e.shellSuspendCounter++,Vi=Bi=null,J=r,M.H=i,M.A=a,Y===null&&(Ll=null,X=0,Jr()),o}function Ou(){for(;Y!==null;)ju(Y)}function ku(e,t){var n=J;J|=2;var r=wu(),a=Tu();Ll!==e||X!==t?(tu=null,eu=xe()+500,xu(e,t)):Bl=He(e,t);a:do try{if(Z!==0&&Y!==null){t=Y;var o=Rl;b:switch(Z){case 1:Z=0,Rl=null,Nu(e,t,o,1);break;case 2:case 9:if(ba(o)){Z=0,Rl=null,Mu(t);break}t=function(){Z!==2&&Z!==9||Ll!==e||(Z=7),nd(e)},o.then(t,t);break a;case 3:Z=7;break a;case 4:Z=5;break a;case 7:ba(o)?(Z=0,Rl=null,Mu(t)):(Z=0,Rl=null,Nu(e,t,o,7));break;case 5:var s=null;switch(Y.tag){case 26:s=Y.memoizedState;case 5:case 27:var c=Y;if(s?Wf(s):c.stateNode.complete){Z=0,Rl=null;var l=c.sibling;if(l!==null)Y=l;else{var u=c.return;u===null?Y=null:(Y=u,Pu(u))}break b}}Z=0,Rl=null,Nu(e,t,o,5);break;case 6:Z=0,Rl=null,Nu(e,t,o,6);break;case 8:bu(),Ul=6;break a;default:throw Error(i(462))}}Au();break}catch(t){Su(e,t)}while(1);return Vi=Bi=null,M.H=r,M.A=a,J=n,Y===null?(Ll=null,X=0,Jr(),Ul):0}function Au(){for(;Y!==null&&!ye();)ju(Y)}function ju(e){var t=Oc(e.alternate,e,Hl);e.memoizedProps=e.pendingProps,t===null?Pu(e):Y=t}function Mu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fc(n,t,t.pendingProps,t.type,void 0,X);break;case 11:t=fc(n,t,t.pendingProps,t.type.render,t.ref,X);break;case 5:wo(t);default:Lc(n,t),t=Y=ai(t,Hl),t=Oc(n,t,Hl)}e.memoizedProps=e.pendingProps,t===null?Pu(e):Y=t}function Nu(e,t,n,r){Vi=Bi=null,wo(t),Ea=null,Da=0;var i=t.return;try{if(Zs(e,i,t,n,X)){Ul=1,Ks(e,fi(n,e.current)),Y=null;return}}catch(t){if(i!==null)throw Y=i,t;Ul=1,Ks(e,fi(n,e.current)),Y=null;return}t.flags&32768?(G||r===1?e=!0:Bl||X&536870912?e=!1:(zl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Za.current,r!==null&&r.tag===13&&(r.flags|=16384))),Fu(t,e)):Pu(t)}function Pu(e){var t=e;do{if(t.flags&32768){Fu(t,zl);return}e=t.return;var n=Fc(t.alternate,t,Hl);if(n!==null){Y=n;return}if(t=t.sibling,t!==null){Y=t;return}Y=t=e}while(t!==null);Ul===0&&(Ul=5)}function Fu(e,t){do{var n=Ic(e.alternate,e);if(n!==null){n.flags&=32767,Y=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Y=e;return}Y=e=n}while(e!==null);Ul=6,Y=null}function Iu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Vu();while(ru!==0);if(J&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=qr,qe(e,n,o,s,c,l),e===Ll&&(Y=Ll=null,X=0),au=t,iu=e,ou=n,su=o,cu=a,lu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(Te,function(){return Hu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=M.T,M.T=null,a=N.p,N.p=2,s=J,J|=4;try{nl(e,t,n)}finally{J=s,N.p=a,M.T=r}}ru=1,Lu(),Ru(),zu()}}function Lu(){if(ru===1){ru=0;var e=iu,t=au,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=J;J|=4;try{hl(t,e);var a=zd,o=xr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&br(s.ownerDocument.documentElement,s)){if(c!==null&&Sr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=yr(s,h),v=yr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{J=i,N.p=r,M.T=n}}e.current=t,ru=2}}function Ru(){if(ru===2){ru=0;var e=iu,t=au,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=J;J|=4;try{rl(e,t.alternate,t)}finally{J=i,N.p=r,M.T=n}}ru=3}}function zu(){if(ru===4||ru===3){ru=0,be();var e=iu,t=au,n=ou,r=lu;t.subtreeFlags&10256||t.flags&10256?ru=5:(ru=0,au=iu=null,Bu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(nu=null),Qe(n),t=t.stateNode,je&&typeof je.onCommitFiberRoot==`function`)try{je.onCommitFiberRoot(Ae,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=M.T,i=N.p,N.p=2,M.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{M.T=t,N.p=i}}ou&3&&Vu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===du?uu++:(uu=0,du=e):uu=0,rd(0,!1)}}function Bu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ra(t)))}function Vu(){return Lu(),Ru(),zu(),Hu()}function Hu(){if(ru!==5)return!1;var e=iu,t=su;su=0;var n=Qe(ou),r=M.T,a=N.p;try{N.p=32>n?32:n,M.T=null,n=cu,cu=null;var o=iu,s=ou;if(ru=0,au=iu=null,ou=0,J&6)throw Error(i(331));var c=J;if(J|=4,Ml(o.current),wl(o,o.current,s,n),J=c,rd(0,!1),je&&typeof je.onPostCommitFiberRoot==`function`)try{je.onPostCommitFiberRoot(Ae,o)}catch{}return!0}finally{N.p=a,M.T=r,Bu(e,t)}}function Uu(e,t,n){t=fi(n,t),t=Js(e.stateNode,t,2),e=Ra(e,t,2),e!==null&&(Ke(e,2),nd(e))}function Q(e,t,n){if(e.tag===3)Uu(e,e,n);else for(;t!==null;){if(t.tag===3){Uu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(nu===null||!nu.has(r))){e=fi(n,e),n=Ys(2),r=Ra(t,n,2),r!==null&&(Xs(n,r,t,e),Ke(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Vl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(X&n)===n&&(Ul===4||Ul===3&&(X&62914560)===X&&300>xe()-Ql?!(J&2)&&xu(e,0):Kl|=n,Jl===X&&(Jl=0)),nd(e)}function Ku(e,t){t===0&&(t=We()),e=Zr(e,t),e!==null&&(Ke(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return _e(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ne(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=X,a=Ve(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||He(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=xe(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}ru!==0&&ru!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ne(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ue(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=X,n=Ve(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Z===2||Z===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ve(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||He(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ve(r),Qe(n)){case 2:case 8:n=we;break;case 32:n=Te;break;case 268435456:n=De;break;default:n=Te}return r=sd.bind(null,e),n=_e(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ve(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(ru!==0&&ru!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Vu()&&e.callbackNode!==n)return null;var r=X;return r=Ve(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(hu(e,r,t),od(e,xe()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Vu())return null;hu(e,t,!0)}function ld(){Yd(function(){J&6?_e(Ce,id):ad()})}function ud(){if(td===0){var e=oa;e===0&&(e=Le,Le<<=1,!(Le&261888)&&(Le=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Jt(``+e)}function fd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[rt]||null).action),o=r.submitter;o&&(t=(t=o[rt]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);bs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),bs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<Hr.length;md++){var hd=Hr[md];Ur(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Ur(Pr,`onAnimationEnd`),Ur(Fr,`onAnimationIteration`),Ur(Ir,`onAnimationStart`),Ur(`dblclick`,`onDoubleClick`),Ur(`focusin`,`onFocus`),Ur(`focusout`,`onBlur`),Ur(Lr,`onTransitionRun`),Ur(Rr,`onTransitionStart`),Ur(zr,`onTransitionCancel`),Ur(Br,`onTransitionEnd`),yt(`onMouseEnter`,[`mouseout`,`mouseover`]),yt(`onMouseLeave`,[`mouseout`,`mouseover`]),yt(`onPointerEnter`,[`pointerout`,`pointerover`]),yt(`onPointerLeave`,[`pointerout`,`pointerover`]),vt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),vt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),vt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),vt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),vt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),vt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[at];n===void 0&&(n=t[at]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,gt.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!on||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=dt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}nn(function(){var r=a,i=Zt(n),s=[];a:{var c=Vr.get(e);if(c!==void 0){var l=_n,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=Nn;break;case`focusin`:u=`focus`,l=wn;break;case`focusout`:u=`blur`,l=wn;break;case`beforeblur`:case`afterblur`:l=wn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Sn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Cn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Fn;break;case Pr:case Fr:case Ir:l=Tn;break;case Br:l=In;break;case`scroll`:case`scrollend`:l=vn;break;case`wheel`:l=Ln;break;case`copy`:case`cut`:case`paste`:l=En;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Pn;break;case`toggle`:case`beforetoggle`:l=Rn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=rn(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Xt&&(u=n.relatedTarget||n.fromElement)&&(dt(u)||u[it]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?dt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Sn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Pn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:pt(l),h=u==null?c:pt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,dt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?pt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ir;else if(Qn(c))if(ar)v=mr;else{v=fr;var y=dr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Gt(r.elementType)&&(v=ir):v=pr;if(v&&=v(e,r)){$n(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Lt(c,`number`,c.value)}switch(y=r?pt(r):window,e){case`focusin`:(Qn(y)||y.contentEditable===`true`)&&(wr=y,Tr=r,Er=null);break;case`focusout`:Er=Tr=wr=null;break;case`mousedown`:Dr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Dr=!1,Or(s,n,i);break;case`selectionchange`:if(Cr)break;case`keydown`:case`keyup`:Or(s,n,i)}var b;if(Bn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Jn?Kn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Un&&n.locale!==`ko`&&(Jn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Jn&&(b=dn()):(cn=i,ln=`value`in cn?cn.value:cn.textContent,Jn=!0)),y=Td(r,x),0<y.length&&(x=new Dn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=qn(n),b!==null&&(x.data=b)))),(b=Hn?Yn(e,n):Xn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new Dn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),pd(s,e,r,n,i)}vd(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=rn(e,n),i!=null&&r.unshift(wd(e,i,a)),i=rn(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=rn(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=rn(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
9
- `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Vt(e,``+r);break;case`className`:Tt(e,`class`,r);break;case`tabIndex`:Tt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Tt(e,n,r);break;case`style`:Wt(e,r,o);break;case`data`:if(t!==`object`){Tt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Jt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),wt(e,`popover`,r);break;case`xlinkActuate`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:wt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Kt.get(n)||n,wt(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Wt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Vt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!_t.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[rt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):wt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Md(e,t,r,d,n,null)}}It(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Rt(e,!!r,n,!0):Rt(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Md(e,t,s,c,n,null)}Bt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Ft(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Rt(e,!!n,n?[]:``,!1):Rt(e,!!n,t,!0)):Rt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Md(e,t,s,a,r,o)}zt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[lt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),ut(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[lt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ut(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=N.d;N.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=yu();return e||t}function yf(e){var t=ft(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Pt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Pt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Pt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Pt(n.imageSizes)+`"]`)):i+=`[href="`+Pt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Pt(r)+`"][href="`+Pt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),ht(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=mt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);ht(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=mt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ht(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=mt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ht(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=L.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=mt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=mt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=mt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Pt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),ht(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Pt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Pt(n.href)+`"]`);if(r)return t.instance=r,ht(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ht(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,ht(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,ht(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ht(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[lt]||a[nt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ht(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ge(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ge(0),this.hiddenUpdates=Ge(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ni(3,null,null,t),e.current=a,a.stateNode=e,t=na(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Fa(a),e}function tp(e){return e?(e=ei,e):ei}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=La(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ra(e,r,t),n!==null&&(mu(n,e,t),za(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Zr(e,67108864);t!==null&&mu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=fu();t=Ze(t);var n=Zr(e,t);n!==null&&mu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,up(e,t,n,r)}finally{N.p=a,M.T=i}}function lp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,up(e,t,n,r)}finally{N.p=a,M.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=ft(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Be(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ne(o);s.entanglements[1]|=c,o&=~c}nd(a),!(J&6)&&(eu=xe()+500,rd(0,!1))}}break;case 31:case 13:s=Zr(a,2),s!==null&&mu(s,a,2),yu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Zt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=dt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Se()){case Ce:return 2;case we:return 8;case Te:case Ee:return 32;case De:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ft(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=dt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,et(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,et(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=ft(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=ft(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[rt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[rt]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,fu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),yu(),t[it]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=$e();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.5`)throw Error(i(527,Lp,`19.2.5`));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Ae=zp.inject(Rp),je=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Us,s=Ws,c=Gs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[it]=t.current,xd(e),new Fp(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),v=o(((e,t)=>{t.exports=_()})),y=c(g(),1),b=c(u(),1),x=v(),S={view:`login`,serverUrl:`http://localhost:4747`,connected:!1,currentUser:null,repoName:``,nodes:[],edges:[],selectedNode:null,hoveredNodeId:null,filters:{hiddenNodeKinds:new Set([`cluster`,`flow`,`directory`]),hiddenEdgeKinds:new Set,focusDepth:`all`},search:{query:``,results:[]},chat:{messages:[],loading:!1},mode:`repo`,groupName:``,groupMembers:[],groupContracts:[],groupLinks:[],groupSyncedAt:null};function C(e,t){switch(t.type){case`SET_VIEW`:return{...e,view:t.view};case`SET_SERVER_URL`:return{...e,serverUrl:t.url};case`SET_CONNECTED`:return{...e,connected:t.connected};case`SET_CURRENT_USER`:return{...e,currentUser:t.user};case`SET_REPO_NAME`:return{...e,repoName:t.name};case`SET_GRAPH`:return{...e,nodes:t.nodes,edges:t.edges};case`SELECT_NODE`:return{...e,selectedNode:t.node};case`HOVER_NODE`:return{...e,hoveredNodeId:t.nodeId};case`SET_SEARCH`:return{...e,search:{query:t.query,results:t.results}};case`ADD_CHAT_MESSAGE`:return{...e,chat:{...e.chat,messages:[...e.chat.messages,t.message]}};case`UPDATE_LAST_CHAT_MESSAGE`:{let n=e.chat.messages.slice();return n.length===0?e:(n[n.length-1]={...n[n.length-1],...t.message},{...e,chat:{...e.chat,messages:n}})}case`SET_CHAT_LOADING`:return{...e,chat:{...e.chat,loading:t.loading}};case`CLEAR_CHAT`:return{...e,chat:{messages:[],loading:!1}};case`TOGGLE_NODE_KIND`:{let n=new Set(e.filters.hiddenNodeKinds);return n.has(t.kind)?n.delete(t.kind):n.add(t.kind),{...e,filters:{...e.filters,hiddenNodeKinds:n}}}case`TOGGLE_EDGE_KIND`:{let n=new Set(e.filters.hiddenEdgeKinds);return n.has(t.kind)?n.delete(t.kind):n.add(t.kind),{...e,filters:{...e.filters,hiddenEdgeKinds:n}}}case`SET_FOCUS_DEPTH`:return{...e,filters:{...e.filters,focusDepth:t.depth}};case`RESET_FILTERS`:return{...e,filters:S.filters};case`SET_MODE`:return{...e,mode:t.mode};case`SET_GROUP_NAME`:return{...e,groupName:t.name};case`SET_GROUP_MEMBERS`:return{...e,groupMembers:t.members};case`SET_GROUP_CONTRACTS`:return{...e,groupContracts:t.contracts,groupLinks:t.links,groupSyncedAt:t.syncedAt};default:return e}}var w=(0,b.createContext)({state:S,dispatch:()=>{}});function ee({children:e}){let[t,n]=(0,b.useReducer)(C,S);return(0,x.jsx)(w.Provider,{value:{state:t,dispatch:n},children:e})}function T(){return(0,b.useContext)(w)}var E=class{constructor(e){this.baseUrl=e}csrfToken=null;async getCsrfToken(){if(this.csrfToken)return this.csrfToken;let e=await(await fetch(`${this.baseUrl}/auth/csrf-token`,{credentials:`include`})).json();return this.csrfToken=e.csrfToken,this.csrfToken}async bootstrapStatus(){let e=await fetch(`${this.baseUrl}/auth/bootstrap-status`,{credentials:`include`});return e.ok?e.json():{needsBootstrap:!1}}async bootstrap(e,t){let n=await this.getCsrfToken(),r=await fetch(`${this.baseUrl}/auth/bootstrap`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":n},credentials:`include`,body:JSON.stringify({username:e,password:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e?.error?.message??`Bootstrap failed`)}return r.json()}async login(e,t){let n=await this.getCsrfToken(),r=await fetch(`${this.baseUrl}/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":n},credentials:`include`,body:JSON.stringify({username:e,password:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e?.error?.message??`Login failed`)}return r.json()}async logout(){let e=await this.getCsrfToken();await fetch(`${this.baseUrl}/auth/logout`,{method:`POST`,headers:{"X-CSRF-Token":e},credentials:`include`}),this.csrfToken=null}async authStatus(){let e=await fetch(`${this.baseUrl}/auth/status`,{credentials:`include`});return e.ok?e.json():{authenticated:!1}}async fetchGraph(e){let t=await fetch(`${this.baseUrl}/api/v1/graph/${e}`,{credentials:`include`});if(!t.ok)throw Error(`Failed to fetch graph: ${t.statusText}`);return t.json()}async search(e,t=20){let n=await this.getCsrfToken(),r=await fetch(`${this.baseUrl}/api/v1/search`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":n},credentials:`include`,body:JSON.stringify({query:e,limit:t})});if(!r.ok)throw Error(`Search failed: ${r.statusText}`);return r.json()}async vectorSearch(e,t=10){let n=await this.getCsrfToken(),r=await fetch(`${this.baseUrl}/api/v1/vector-search`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":n},credentials:`include`,body:JSON.stringify({query:e,limit:t})});if(!r.ok)throw Error(`Vector search failed: ${r.statusText}`);return r.json()}async vectorStatus(){let e=await fetch(`${this.baseUrl}/api/v1/vector-status`,{credentials:`include`});return e.ok?e.json():{ready:!1,building:!1}}async listRepos(){let e=await fetch(`${this.baseUrl}/api/v1/repos`,{credentials:`include`});if(!e.ok)throw Error(`Failed to list repos: ${e.statusText}`);return e.json()}async readFile(e){let t=await this.getCsrfToken(),n=await fetch(`${this.baseUrl}/api/v1/files/read`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":t},credentials:`include`,body:JSON.stringify({file_path:e})});if(!n.ok)throw Error(`Failed to read file: ${n.statusText}`);return n.json()}async inspectNode(e){let t=await fetch(`${this.baseUrl}/api/v1/nodes/${encodeURIComponent(e)}`,{credentials:`include`});if(!t.ok)throw Error(`Inspect failed: ${t.statusText}`);return t.json()}async blastRadius(e,t=`both`,n=3){let r=await this.getCsrfToken(),i=await fetch(`${this.baseUrl}/api/v1/blast-radius`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":r},credentials:`include`,body:JSON.stringify({target:e,direction:t,max_hops:n})});if(!i.ok)throw Error(`Blast radius failed: ${i.statusText}`);return i.json()}async grep(e){let t=await this.getCsrfToken(),n=await fetch(`${this.baseUrl}/api/v1/grep`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":t},credentials:`include`,body:JSON.stringify({pattern:e})});if(!n.ok)throw Error(`Grep failed: ${n.statusText}`);return n.json()}async listFlows(){let e=await fetch(`${this.baseUrl}/api/v1/flows`,{credentials:`include`});if(!e.ok)throw Error(`List flows failed: ${e.statusText}`);return e.json()}async listGroups(){let e=await fetch(`${this.baseUrl}/api/v1/groups`,{credentials:`include`});if(!e.ok)throw Error(`Failed to list groups: ${e.statusText}`);return e.json()}async getGroup(e){let t=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}`,{credentials:`include`});if(!t.ok)throw Error(`Group not found: ${t.statusText}`);return t.json()}async getGroupContracts(e){let t=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/contracts`,{credentials:`include`});if(t.status===404)return null;if(!t.ok)throw Error(`Failed to get contracts: ${t.statusText}`);return t.json()}async syncGroup(e){let t=await this.getCsrfToken(),n=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/sync`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":t},credentials:`include`});if(!n.ok)throw Error(`Sync failed: ${n.statusText}`);return n.json()}async searchGroup(e,t,n=20){let r=await this.getCsrfToken(),i=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/search`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":r},credentials:`include`,body:JSON.stringify({q:t,limit:n})});if(!i.ok)throw Error(`Group search failed: ${i.statusText}`);return i.json()}async fetchGroupGraph(e){let t=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/graph`,{credentials:`include`});if(!t.ok)throw Error(`Failed to fetch group graph: ${t.statusText}`);return t.json()}async sourcePreview(e,t,n){let r=new URLSearchParams({file:e});t!==void 0&&r.set(`startLine`,String(t)),n!==void 0&&r.set(`endLine`,String(n));let i=await fetch(`${this.baseUrl}/api/v1/source?${r.toString()}`,{credentials:`include`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.error?.message??`Source preview failed: ${i.statusText}`)}return i.json()}async queryGQL(e){let t=await this.getCsrfToken(),n=await fetch(`${this.baseUrl}/api/v1/query`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":t},credentials:`include`,body:JSON.stringify({gql:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e?.error?.message??`Query failed: ${n.statusText}`)}return n.json()}};function te(){let{state:e,dispatch:t}=T(),n=window.location.port===`5173`||window.location.port===`5174`?`http://localhost:4747`:window.location.origin,[r,i]=(0,b.useState)(n),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(``),[l,u]=(0,b.useState)(``),[d,f]=(0,b.useState)(``),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(!0),[_,v]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{let r=new E(e.serverUrl||n);(async()=>{try{let{needsBootstrap:i}=await r.bootstrapStatus();if(i){v(!0),g(!1);return}let a=await r.authStatus();a.authenticated&&a.user&&(t({type:`SET_SERVER_URL`,url:e.serverUrl||n}),t({type:`SET_CURRENT_USER`,user:a.user}),t({type:`SET_VIEW`,view:`connect`}))}catch{}g(!1)})()},[]),h?(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`flex items-center gap-3 text-gray-400`,children:[(0,x.jsx)(ne,{className:`w-5 h-5 text-cyan-500`}),(0,x.jsx)(`span`,{className:`text-sm`,children:`Checking session…`})]})}):_?(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`bg-[#0a0d18] border border-gray-800/60 rounded-2xl shadow-2xl w-full max-w-sm p-10`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col items-center mb-8`,children:[(0,x.jsx)(`div`,{className:`w-14 h-14 rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white text-3xl font-bold shadow-lg mb-4 select-none`,children:`◈`}),(0,x.jsx)(`h1`,{className:`text-2xl font-bold text-white tracking-tight`,children:`Code Intel`}),(0,x.jsx)(`p`,{className:`text-gray-400 text-sm mt-1`,children:`First-time Setup`})]}),(0,x.jsx)(`div`,{className:`mb-4 rounded-lg bg-cyan-950/40 border border-cyan-800/50 px-4 py-3`,children:(0,x.jsx)(`p`,{className:`text-cyan-300 text-sm leading-snug`,children:`No admin account found. Create one to get started.`})}),(0,x.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!a.trim()||!s.trim()){f(`Username and password are required`);return}if(s.length<8){f(`Password must be at least 8 characters`);return}if(s!==l){f(`Passwords do not match`);return}f(``),m(!0);try{let{user:e}=await new E(r).bootstrap(a.trim(),s);t({type:`SET_SERVER_URL`,url:r}),t({type:`SET_CURRENT_USER`,user:e}),t({type:`SET_VIEW`,view:`connect`})}catch(e){f(e instanceof Error?e.message:`Setup failed`)}finally{m(!1)}},className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Server URL`}),(0,x.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),disabled:p,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`http://localhost:4747`,autoComplete:`off`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Admin Username`}),(0,x.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),disabled:p,autoComplete:`username`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`admin`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Password`}),(0,x.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),disabled:p,autoComplete:`new-password`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`••••••••`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Confirm Password`}),(0,x.jsx)(`input`,{type:`password`,value:l,onChange:e=>u(e.target.value),disabled:p,autoComplete:`new-password`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`••••••••`})]}),d&&(0,x.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg bg-red-950/40 border border-red-800/50 px-4 py-3`,children:[(0,x.jsx)(`svg`,{className:`w-4 h-4 text-red-400 mt-0.5 shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z`})}),(0,x.jsx)(`p`,{className:`text-red-400 text-sm leading-snug`,children:d})]}),(0,x.jsx)(`button`,{type:`submit`,disabled:p,className:`w-full bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 text-white font-semibold rounded-lg py-2.5 transition flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed mt-2`,children:p?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ne,{className:`w-4 h-4`}),`Creating account…`]}):`Create Admin Account`})]})]})}):(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`bg-[#0a0d18] border border-gray-800/60 rounded-2xl shadow-2xl w-full max-w-sm p-10`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col items-center mb-8`,children:[(0,x.jsx)(`div`,{className:`w-14 h-14 rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white text-3xl font-bold shadow-lg mb-4 select-none`,children:`◈`}),(0,x.jsx)(`h1`,{className:`text-2xl font-bold text-white tracking-tight`,children:`Code Intel`}),(0,x.jsx)(`p`,{className:`text-gray-400 text-sm mt-1`,children:`Sign in to your account`})]}),(0,x.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!a.trim()||!s.trim()){f(`Username and password are required`);return}f(``),m(!0);try{let{user:e}=await new E(r).login(a.trim(),s);t({type:`SET_SERVER_URL`,url:r}),t({type:`SET_CURRENT_USER`,user:e}),t({type:`SET_VIEW`,view:`connect`})}catch(e){f(e instanceof Error?e.message:`Login failed`)}finally{m(!1)}},className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Server URL`}),(0,x.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),disabled:p,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`http://localhost:4747`,autoComplete:`off`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Username`}),(0,x.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),disabled:p,autoComplete:`username`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`admin`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Password`}),(0,x.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),disabled:p,autoComplete:`current-password`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`••••••••`})]}),d&&(0,x.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg bg-red-950/40 border border-red-800/50 px-4 py-3`,children:[(0,x.jsx)(`svg`,{className:`w-4 h-4 text-red-400 mt-0.5 shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z`})}),(0,x.jsx)(`p`,{className:`text-red-400 text-sm leading-snug`,children:d})]}),(0,x.jsx)(`button`,{type:`submit`,disabled:p,className:`w-full bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 text-white font-semibold rounded-lg py-2.5 transition flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed mt-2`,children:p?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ne,{className:`w-4 h-4`}),`Signing in…`]}):`Sign in`})]}),(0,x.jsxs)(`div`,{className:`mt-6 pt-5 border-t border-gray-800/60`,children:[(0,x.jsxs)(`p`,{className:`text-center text-xs text-gray-600`,children:[`No account?`,` `,(0,x.jsx)(`span`,{className:`font-mono text-gray-500`,children:`code-intel user create admin --role admin`})]}),(0,x.jsxs)(`p`,{className:`text-center text-xs text-gray-700 mt-1.5`,children:[`Or use a Bearer token via`,` `,(0,x.jsx)(`span`,{className:`font-mono text-gray-600`,children:`Authorization: Bearer <token>`})]})]})]})})}function ne({className:e=``}){return(0,x.jsxs)(`svg`,{className:`animate-spin ${e}`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,x.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,x.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z`})]})}function re(){let{dispatch:e}=T(),t=window.location.port===`5173`||window.location.port===`5174`?`http://localhost:4747`:window.location.origin,[n,r]=(0,b.useState)(t),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(`repo`),[u,d]=(0,b.useState)([]),[f,p]=(0,b.useState)([]),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(null);(0,b.useEffect)(()=>{v(t)},[]);let v=async e=>{try{d(await new E(e).listRepos()),a(``)}catch{d([])}};(0,b.useEffect)(()=>{c===`group`&&y()},[c,n]);let y=async()=>{h(!0);try{p(await new E(n).listGroups())}catch{p([])}finally{h(!1)}},S=async t=>{a(``),s(!0);try{let r=new E(n);e({type:`SET_SERVER_URL`,url:n}),e({type:`SET_MODE`,mode:`repo`}),e({type:`SET_REPO_NAME`,name:t}),e({type:`SET_VIEW`,view:`loading`});let{nodes:i,edges:a}=await r.fetchGraph(t);e({type:`SET_GRAPH`,nodes:i,edges:a}),e({type:`SET_CONNECTED`,connected:!0}),e({type:`SET_VIEW`,view:`exploring`})}catch(t){a(t instanceof Error?t.message:`Connection failed`),e({type:`SET_VIEW`,view:`connect`}),s(!1)}},C=async t=>{a(``),_(t);try{let r=new E(n);e({type:`SET_SERVER_URL`,url:n}),e({type:`SET_VIEW`,view:`loading`});let[i,a]=await Promise.all([r.getGroup(t),r.fetchGroupGraph(t)]);e({type:`SET_MODE`,mode:`group`}),e({type:`SET_GROUP_NAME`,name:t}),e({type:`SET_GROUP_MEMBERS`,members:i.members}),e({type:`SET_REPO_NAME`,name:t}),e({type:`SET_GRAPH`,nodes:a.nodes,edges:a.edges}),e({type:`SET_CONNECTED`,connected:!0}),e({type:`SET_VIEW`,view:`exploring`}),r.getGroupContracts(t).then(t=>{t&&e({type:`SET_GROUP_CONTRACTS`,contracts:t.contracts,links:t.links,syncedAt:t.syncedAt})}).catch(()=>{})}catch(t){a(t instanceof Error?t.message:`Failed to load group`),e({type:`SET_VIEW`,view:`connect`})}finally{_(null)}};return(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`bg-[#0a0d18] border border-gray-800/60 rounded-2xl shadow-2xl w-full max-w-md p-10`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col items-center mb-8`,children:[(0,x.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white text-2xl font-bold shadow-lg mb-4 select-none`,children:`◈`}),(0,x.jsx)(`h1`,{className:`text-2xl font-bold text-white tracking-tight`,children:`Code Intel`}),(0,x.jsx)(`p`,{className:`text-gray-400 text-sm mt-1`,children:`Knowledge Graph Explorer`})]}),(0,x.jsx)(`div`,{className:`flex bg-gray-900/60 rounded-lg p-1 mb-6 border border-gray-800/50`,children:[`repo`,`group`].map(e=>(0,x.jsx)(`button`,{onClick:()=>l(e),className:`flex-1 py-1.5 rounded-md text-sm font-medium transition ${c===e?`bg-gradient-to-r from-cyan-600 to-blue-600 text-white shadow`:`text-gray-400 hover:text-gray-200`}`,children:e===`repo`?`⬡ Repository`:`⬢ Group`},e))}),(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-2`,children:`Server URL`}),(0,x.jsx)(`input`,{type:`text`,value:n,onChange:e=>{r(e.target.value),v(e.target.value)},disabled:o||g!==null,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50`,placeholder:`http://localhost:4747`})]}),i&&(0,x.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg bg-red-950/40 border border-red-800/50 px-4 py-3`,children:[(0,x.jsx)(`svg`,{className:`w-4 h-4 text-red-400 mt-0.5 shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z`})}),(0,x.jsx)(`p`,{className:`text-red-400 text-sm leading-snug`,children:i})]}),c===`repo`&&(0,x.jsx)(`div`,{children:u.length>0?(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(`p`,{className:`text-xs text-gray-500 uppercase tracking-widest font-medium`,children:`Indexed repositories`}),u.map(e=>(0,x.jsxs)(`button`,{onClick:()=>S(e.name),disabled:o,className:`w-full flex items-center justify-between bg-gray-900/60 hover:bg-gray-800/60 border rounded-lg px-4 py-3 transition group disabled:opacity-50 disabled:cursor-not-allowed text-left ${e.active?`border-cyan-700/60 hover:border-cyan-600`:`border-gray-700/60 hover:border-cyan-700/50`}`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`div`,{className:`text-sm font-semibold text-cyan-400 truncate`,children:e.name}),e.active&&(0,x.jsx)(`span`,{className:`text-[9px] bg-cyan-900/50 text-cyan-400 border border-cyan-700/50 px-1.5 py-0.5 rounded-full font-medium shrink-0`,children:`active`})]}),(0,x.jsxs)(`div`,{className:`text-xs text-gray-500 truncate`,children:[e.nodes.toLocaleString(),` nodes · `,e.edges.toLocaleString(),` edges`]}),e.path&&(0,x.jsx)(`div`,{className:`text-[10px] text-gray-600 font-mono truncate mt-0.5`,children:e.path})]}),o?(0,x.jsx)(D,{className:`w-4 h-4 text-cyan-400 ml-2 shrink-0`}):(0,x.jsx)(`span`,{className:`text-gray-600 group-hover:text-cyan-500 transition text-lg ml-2 shrink-0`,children:`→`})]},e.name))]}):(0,x.jsxs)(`div`,{className:`bg-gray-900/40 border border-gray-800 rounded-lg px-4 py-6 text-center`,children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-sm mb-2`,children:`No repositories found at this URL.`}),(0,x.jsx)(`p`,{className:`text-gray-600 text-xs font-mono`,children:`code-intel analyze`})]})}),c===`group`&&(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-gray-400 uppercase tracking-widest`,children:`Available Groups`}),(0,x.jsx)(`button`,{onClick:y,disabled:m,className:`text-xs text-cyan-500 hover:text-cyan-400 transition disabled:opacity-50`,children:`↻ Refresh`})]}),m?(0,x.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-gray-500 text-sm gap-2`,children:[(0,x.jsx)(D,{className:`w-4 h-4`}),`Loading groups…`]}):f.length===0?(0,x.jsxs)(`div`,{className:`bg-gray-900/40 border border-gray-800 rounded-lg px-4 py-6 text-center`,children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-sm mb-2`,children:`No groups found.`}),(0,x.jsx)(`p`,{className:`text-gray-600 text-xs font-mono`,children:`code-intel group create <name>`})]}):(0,x.jsx)(`div`,{className:`space-y-2 max-h-64 overflow-y-auto pr-1`,children:f.map(e=>(0,x.jsxs)(`button`,{onClick:()=>C(e.name),disabled:g!==null,className:`w-full flex items-center justify-between bg-gray-900/60 hover:bg-gray-800/60 border border-gray-700/60 hover:border-indigo-700/50 rounded-lg px-4 py-3 transition group disabled:opacity-50 disabled:cursor-not-allowed text-left`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`span`,{className:`text-indigo-400 font-semibold text-sm`,children:[`⬢ `,e.name]}),g===e.name&&(0,x.jsx)(D,{className:`w-3 h-3 text-indigo-400`})]}),(0,x.jsxs)(`div`,{className:`text-gray-500 text-xs mt-0.5`,children:[e.memberCount,` repo`,e.memberCount===1?``:`s`,e.lastSync?` · synced ${new Date(e.lastSync).toLocaleDateString()}`:` · not synced`]})]}),(0,x.jsx)(`span`,{className:`text-gray-600 group-hover:text-indigo-400 transition text-lg`,children:`→`})]},e.name))}),(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-600 mt-3 text-center`,children:[`Create groups with `,(0,x.jsx)(`span`,{className:`font-mono text-gray-500`,children:`code-intel group create <name>`})]})]})]})]})})}function D({className:e=``}){return(0,x.jsxs)(`svg`,{className:`animate-spin ${e}`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,x.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,x.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z`})]})}function O(){return(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-6`,children:[(0,x.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,x.jsx)(`span`,{className:`absolute inline-flex h-16 w-16 rounded-xl bg-cyan-500/20 animate-ping`}),(0,x.jsx)(`div`,{className:`relative w-14 h-14 rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white text-3xl font-bold shadow-xl shadow-cyan-900/40 select-none`,children:`◈`})]}),(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,x.jsx)(`p`,{className:`text-gray-300 text-lg font-medium tracking-wide`,children:`Building knowledge graph…`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:-0.3s]`}),(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:-0.15s]`}),(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-cyan-500 animate-bounce`})]})]}),(0,x.jsx)(`p`,{className:`text-gray-600 text-sm tracking-widest uppercase`,children:`Indexing nodes and edges…`})]})})}var k=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}))();function A(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}var j=A;typeof Object.assign==`function`&&(j=Object.assign);function M(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function N(e){return typeof e==`object`&&!!e}function P(e){let t;for(t in e)return!1;return!0}function ie(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function ae(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function oe(e){return!(!N(e)||e.attributes&&!Array.isArray(e.attributes))}function se(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function F(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function ce(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var I=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},L=class e extends I{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},R=class e extends I{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},z=class e extends I{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function B(e,t){this.key=e,this.attributes=t,this.clear()}B.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function V(e,t){this.key=e,this.attributes=t,this.clear()}V.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function H(e,t){this.key=e,this.attributes=t,this.clear()}H.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function le(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}le.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},le.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},le.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},le.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var ue=0,de=1,fe=2,pe=3;function me(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===ue){if(s=e._nodes.get(r),!s)throw new R(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===pe){if(i=``+i,c=e._edges.get(i),!c)throw new R(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new R(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new R(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===de?c.source:c.target,l=i,u=a}return[s,l,u]}function he(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);return a.attributes[o]}}function ge(e,t,n){e.prototype[t]=function(e,r){let[i]=me(this,t,n,e,r);return i.attributes}}function _e(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function ve(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=me(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function ye(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=me(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new L(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function be(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function xe(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);if(!N(o))throw new L(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function Se(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);if(!N(o))throw new L(`Graph.${t}: provided attributes are not a plain object.`);return j(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function Ce(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);if(typeof o!=`function`)throw new L(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}var we=[{name:e=>`get${e}Attribute`,attacher:he},{name:e=>`get${e}Attributes`,attacher:ge},{name:e=>`has${e}Attribute`,attacher:_e},{name:e=>`set${e}Attribute`,attacher:ve},{name:e=>`update${e}Attribute`,attacher:ye},{name:e=>`remove${e}Attribute`,attacher:be},{name:e=>`replace${e}Attributes`,attacher:xe},{name:e=>`merge${e}Attributes`,attacher:Se},{name:e=>`update${e}Attributes`,attacher:Ce}];function Te(e){we.forEach(function({name:t,attacher:n}){n(e,t(`Node`),ue),n(e,t(`Source`),de),n(e,t(`Target`),fe),n(e,t(`Opposite`),pe)})}function Ee(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function De(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=``+e,a=``+arguments[1];if(r=M(this,i,a,n),!r)throw new R(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,r=this._edges.get(e),!r)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Oe(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function ke(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=M(this,o,s,n),!a)throw new R(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function Ae(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=M(this,o,s,n),!a)throw new R(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new L(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function je(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function Me(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!N(r))throw new L(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function Ne(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!N(r))throw new L(`Graph.${t}: provided attributes are not a plain object.`);return j(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function Pe(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new L(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}var Fe=[{name:e=>`get${e}Attribute`,attacher:Ee},{name:e=>`get${e}Attributes`,attacher:De},{name:e=>`has${e}Attribute`,attacher:Oe},{name:e=>`set${e}Attribute`,attacher:ke},{name:e=>`update${e}Attribute`,attacher:Ae},{name:e=>`remove${e}Attribute`,attacher:je},{name:e=>`replace${e}Attributes`,attacher:Me},{name:e=>`merge${e}Attributes`,attacher:Ne},{name:e=>`update${e}Attributes`,attacher:Pe}];function Ie(e){Fe.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var Le=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function Re(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function ze(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function Be(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function Ve(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function He(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function Ue(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function We(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function Ge(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function Ke(e,t){if(e.size===0)return ce();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function qe(e,t,n,r,i,a){let o=t?ze:Re,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function Je(e,t,n,r){let i=[];return qe(!1,e,t,n,r,function(e){i.push(e)}),i}function Ye(e,t,n){let r=ce();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=F(r,Be(n.in))),t!==`in`&&n.out!==void 0&&(r=F(r,Be(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=F(r,Be(n.undirected))),r}function Xe(e,t,n,r,i,a,o){let s=n?He:Ve,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function Ze(e,t,n,r,i){let a=[];return Xe(!1,e,t,n,r,i,function(e){a.push(e)}),a}function Qe(e,t,n,r){let i=ce();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=F(i,Ue(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=F(i,Ue(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=F(i,Ue(n.undirected,r))),i}function $e(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return We(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new R(`Graph.${n}: could not find the "${e}" node in the graph.`);return Je(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new R(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.${n}: could not find the "${t}" target node in the graph.`);return Ze(r,this.multi,i,a,t)}throw new L(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function et(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(!(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)){if(arguments.length===1)return n=e,Ge(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);return qe(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new R(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Xe(!1,r,this.multi,i,o,t,n)}throw new L(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new L(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new L(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function tt(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,Ge(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);return qe(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new R(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Xe(!0,r,this.multi,i,o,t,n)}throw new L(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function nt(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return ce();if(!arguments.length)return Ke(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);return Ye(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Qe(r,i,n,t)}throw new L(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function rt(e){Le.forEach(t=>{$e(e,t),et(e,t),tt(e,t),nt(e,t)})}var it=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function at(){this.A=null,this.B=null}at.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},at.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function ot(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function st(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return ot(e,null,r,r.undirected,i);if(typeof n==`string`)return ot(e,null,r,r[n],i)}let a=new at,o;if(t!==`undirected`){if(n!==`out`){if(o=ot(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=ot(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=ot(e,a,r,r.undirected,i),e&&o))return o}function ct(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return st(!1,e,t,n,function(e){r.push(e)}),r}function lt(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function ut(e,t,n){if(e!==`mixed`){if(e===`undirected`)return lt(null,n,n.undirected);if(typeof t==`string`)return lt(null,n,n[t])}let r=ce(),i=new at;return e!==`undirected`&&(t!==`out`&&(r=F(r,lt(i,n,n.in))),t!==`in`&&(r=F(r,lt(i,n,n.out)))),e!==`directed`&&(r=F(r,lt(i,n,n.undirected))),r}function dt(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new R(`Graph.${n}: could not find the "${e}" node in the graph.`);return ct(r===`mixed`?this.type:r,i,t)}}function ft(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);st(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new L(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function pt(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new R(`Graph.${o}: could not find the "${e}" node in the graph.`);return st(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function mt(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return ce();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);return ut(r===`mixed`?this.type:r,i,t)}}function ht(e){it.forEach(t=>{dt(e,t),ft(e,t),pt(e,t),mt(e,t)})}function gt(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function _t(e,t){let n={key:e};return P(t.attributes)||(n.attributes=j({},t.attributes)),n}function vt(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return P(n.attributes)||(r.attributes=j({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function yt(e){if(!N(e))throw new L(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new L(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!N(e.attributes)||e.attributes===null))throw new L(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function bt(e){if(!N(e))throw new L(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new L(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new L(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!N(e.attributes)||e.attributes===null))throw new L(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new L(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}var xt=se(),St=new Set([`directed`,`undirected`,`mixed`]),Ct=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),wt=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],Tt={allowSelfLoops:!0,multi:!1,type:`mixed`};function Et(e,t,n){if(n&&!N(n))throw new L(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new z(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function Dt(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function Ot(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new z(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new z(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!N(s))throw new L(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new z(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),l=e._nodes.get(o);if(!c)throw new R(`Graph.${t}: source node "${a}" not found.`);if(!l)throw new R(`Graph.${t}: target node "${o}" not found.`);let u={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new z(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new z(`Graph.${t}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let d=new le(r,i,c,l,s);e._edges.set(i,d);let f=a===o;return r?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),r?e._undirectedSize++:e._directedSize++,u.key=i,e.emit(`edgeAdded`,u),i}function kt(e,t,n,r,i,a,o,s,c){if(!r&&e.type===`undirected`)throw new z(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new z(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!=`function`)throw new L(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!N(s))throw new L(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=``+a,o=``+o;let l;if(c&&(l=s,s=void 0),!e.allowSelfLoops&&a===o)throw new z(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=e._nodes.get(a),d=e._nodes.get(o),f,p;if(!n&&(f=e._edges.get(i),f)){if((f.source.key!==a||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==a))throw new z(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!e.multi&&u&&(p=r?u.undirected[o]:u.out[o]),p){let t=[p.key,!1,!1,!1];if(c?!l:!s)return t;if(c){let t=p.attributes;p.attributes=l(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:p.key,attributes:p.attributes})}else j(p.attributes,s),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:p.key,attributes:p.attributes,data:s});return t}s||={},c&&l&&(s=l(s));let m={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new z(`Graph.${t}: the "${i}" edge already exists in the graph.`);let h=!1,g=!1;u||(u=Dt(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=Dt(e,o,{}),g=!0),f=new le(r,i,u,d,s),e._edges.set(i,f);let _=a===o;return r?(u.undirectedDegree++,d.undirectedDegree++,_&&(u.undirectedLoops++,e._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,_&&(u.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,m.key=i,e.emit(`edgeAdded`,m),[i,!0,h,g]}function At(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var jt=class e extends k.EventEmitter{constructor(e){if(super(),e=j({},Tt,e),typeof e.multi!=`boolean`)throw new L(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!St.has(e.type))throw new L(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new L(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?B:e.type===`directed`?V:H;ie(this,`NodeDataClass`,t);let n=`geid_`+xt()+`_`,r=0;ie(this,`_attributes`,{}),ie(this,`_nodes`,new Map),ie(this,`_edges`,new Map),ie(this,`_directedSize`,0),ie(this,`_undirectedSize`,0),ie(this,`_directedSelfLoopCount`,0),ie(this,`_undirectedSelfLoopCount`,0),ie(this,`_edgeKeyGenerator`,()=>{let e;do e=n+ r++;while(this._edges.has(e));return e}),ie(this,`_options`,e),Ct.forEach(e=>ie(this,e,this[e])),ae(this,`order`,()=>this._nodes.size),ae(this,`size`,()=>this._edges.size),ae(this,`directedSize`,()=>this._directedSize),ae(this,`undirectedSize`,()=>this._undirectedSize),ae(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),ae(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),ae(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),ae(this,`multi`,this._options.multi),ae(this,`type`,this._options.type),ae(this,`allowSelfLoops`,this._options.allowSelfLoops),ae(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new L(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new L(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new L(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new z(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new R(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new z(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new R(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new z(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`directed`?!1:t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new R(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new R(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new R(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Et(this,e,t).key}mergeNode(e,t){if(t&&!N(t))throw new L(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(j(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new L(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do At(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do At(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do At(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=M(this,e,n,this.type),!t)throw new R(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new R(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return At(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new z(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new z(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=M(this,e,t,`directed`);if(!n)throw new R(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return At(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new z(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new z(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=M(this,e,t,`undirected`);if(!n)throw new R(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return At(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new L(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!N(e))throw new L(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!N(e))throw new L(`Graph.mergeAttributes: provided attributes are not a plain object.`);return j(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new L(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new L(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!oe(t))throw new L(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new L(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!oe(t))throw new L(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new L(`Graph.forEachAdjacencyEntry: expecting a callback.`);gt(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new L(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);gt(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new L(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);gt(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new L(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);gt(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new L(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new L(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new L(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new L(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new L(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new L(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new L(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new L(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=_t(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=vt(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!N(t))throw new L(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!N(t.attributes))throw new L(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new L(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],yt(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new L(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],bt(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(j({},this._options,t));return n.replaceAttributes(j({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=j({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new z(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new z(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new z(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,Ot(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,j({},i.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!Ct.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,ie(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(jt.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=jt.prototype.inspect),wt.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?Ot:kt;e.generateKey?jt.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:jt.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),Te(jt),Ie(jt),rt(jt),ht(jt);var Mt=class extends jt{constructor(e){let t=j({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new L(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new L(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},Nt=class extends jt{constructor(e){let t=j({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new L(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new L(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},Pt=class extends jt{constructor(e){let t=j({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new L(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},Ft=class extends jt{constructor(e){let t=j({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new L(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new L(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},It=class extends jt{constructor(e){let t=j({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new L(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new L(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function Lt(e){e.from=function(t,n){let r=new e(j({},t.options,n));return r.import(t),r}}Lt(jt),Lt(Mt),Lt(Nt),Lt(Pt),Lt(Ft),Lt(It),jt.Graph=jt,jt.DirectedGraph=Mt,jt.UndirectedGraph=Nt,jt.MultiGraph=Pt,jt.MultiDirectedGraph=Ft,jt.MultiUndirectedGraph=It,jt.InvalidArgumentsGraphError=L,jt.NotFoundGraphError=R,jt.UsageGraphError=z;function Rt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function zt(e){var t=Rt(e,`string`);return typeof t==`symbol`?t:t+``}function Bt(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Vt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,zt(r.key),r)}}function Ht(e,t,n){return t&&Vt(e.prototype,t),n&&Vt(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function Ut(e){return Ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ut(e)}function Wt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wt=function(){return!!e})()}function Gt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Kt(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Gt(e)}function qt(e,t,n){return t=Ut(t),Kt(e,Wt()?Reflect.construct(t,n||[],Ut(e).constructor):t.apply(e,n))}function Jt(e,t){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jt(e,t)}function Yt(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&Jt(e,t)}function Xt(e){if(Array.isArray(e))return e}function Zt(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Qt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $t(e,t){if(e){if(typeof e==`string`)return Qt(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qt(e,t):void 0}}function en(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
9
+ `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Vt(e,``+r);break;case`className`:Tt(e,`class`,r);break;case`tabIndex`:Tt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Tt(e,n,r);break;case`style`:Wt(e,r,o);break;case`data`:if(t!==`object`){Tt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Jt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),wt(e,`popover`,r);break;case`xlinkActuate`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:wt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Kt.get(n)||n,wt(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Wt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Vt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!_t.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[rt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):wt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Md(e,t,r,d,n,null)}}It(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Rt(e,!!r,n,!0):Rt(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Md(e,t,s,c,n,null)}Bt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Ft(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Rt(e,!!n,n?[]:``,!1):Rt(e,!!n,t,!0)):Rt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Md(e,t,s,a,r,o)}zt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[lt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),ut(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[lt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ut(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=N.d;N.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=yu();return e||t}function yf(e){var t=ft(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Pt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Pt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Pt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Pt(n.imageSizes)+`"]`)):i+=`[href="`+Pt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Pt(r)+`"][href="`+Pt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),ht(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=mt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);ht(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=mt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ht(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=mt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ht(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=L.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=mt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=mt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=mt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Pt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),ht(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Pt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Pt(n.href)+`"]`);if(r)return t.instance=r,ht(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ht(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,ht(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,ht(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ht(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[lt]||a[nt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ht(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ge(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ge(0),this.hiddenUpdates=Ge(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ni(3,null,null,t),e.current=a,a.stateNode=e,t=na(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Fa(a),e}function tp(e){return e?(e=ei,e):ei}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=La(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ra(e,r,t),n!==null&&(mu(n,e,t),za(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Zr(e,67108864);t!==null&&mu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=fu();t=Ze(t);var n=Zr(e,t);n!==null&&mu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,up(e,t,n,r)}finally{N.p=a,M.T=i}}function lp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,up(e,t,n,r)}finally{N.p=a,M.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=ft(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Be(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ne(o);s.entanglements[1]|=c,o&=~c}nd(a),!(J&6)&&(eu=xe()+500,rd(0,!1))}}break;case 31:case 13:s=Zr(a,2),s!==null&&mu(s,a,2),yu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Zt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=dt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Se()){case Ce:return 2;case we:return 8;case Te:case Ee:return 32;case De:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ft(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=dt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,et(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,et(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=ft(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=ft(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[rt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[rt]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,fu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),yu(),t[it]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=$e();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.5`)throw Error(i(527,Lp,`19.2.5`));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Ae=zp.inject(Rp),je=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Us,s=Ws,c=Gs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[it]=t.current,xd(e),new Fp(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),v=o(((e,t)=>{t.exports=_()})),y=c(g(),1),b=c(u(),1),x=v(),S={view:`login`,serverUrl:`http://localhost:4747`,connected:!1,currentUser:null,repoName:``,nodes:[],edges:[],selectedNode:null,hoveredNodeId:null,filters:{hiddenNodeKinds:new Set([`cluster`,`flow`,`directory`]),hiddenEdgeKinds:new Set,focusDepth:`all`},search:{query:``,results:[]},chat:{messages:[],loading:!1},mode:`repo`,groupName:``,groupMembers:[],groupContracts:[],groupLinks:[],groupSyncedAt:null};function C(e,t){switch(t.type){case`SET_VIEW`:return{...e,view:t.view};case`SET_SERVER_URL`:return{...e,serverUrl:t.url};case`SET_CONNECTED`:return{...e,connected:t.connected};case`SET_CURRENT_USER`:return{...e,currentUser:t.user};case`SET_REPO_NAME`:return{...e,repoName:t.name};case`SET_GRAPH`:return{...e,nodes:t.nodes,edges:t.edges};case`SELECT_NODE`:return{...e,selectedNode:t.node};case`HOVER_NODE`:return{...e,hoveredNodeId:t.nodeId};case`SET_SEARCH`:return{...e,search:{query:t.query,results:t.results}};case`ADD_CHAT_MESSAGE`:return{...e,chat:{...e.chat,messages:[...e.chat.messages,t.message]}};case`UPDATE_LAST_CHAT_MESSAGE`:{let n=e.chat.messages.slice();return n.length===0?e:(n[n.length-1]={...n[n.length-1],...t.message},{...e,chat:{...e.chat,messages:n}})}case`SET_CHAT_LOADING`:return{...e,chat:{...e.chat,loading:t.loading}};case`CLEAR_CHAT`:return{...e,chat:{messages:[],loading:!1}};case`TOGGLE_NODE_KIND`:{let n=new Set(e.filters.hiddenNodeKinds);return n.has(t.kind)?n.delete(t.kind):n.add(t.kind),{...e,filters:{...e.filters,hiddenNodeKinds:n}}}case`TOGGLE_EDGE_KIND`:{let n=new Set(e.filters.hiddenEdgeKinds);return n.has(t.kind)?n.delete(t.kind):n.add(t.kind),{...e,filters:{...e.filters,hiddenEdgeKinds:n}}}case`SET_FOCUS_DEPTH`:return{...e,filters:{...e.filters,focusDepth:t.depth}};case`RESET_FILTERS`:return{...e,filters:S.filters};case`SET_MODE`:return{...e,mode:t.mode};case`SET_GROUP_NAME`:return{...e,groupName:t.name};case`SET_GROUP_MEMBERS`:return{...e,groupMembers:t.members};case`SET_GROUP_CONTRACTS`:return{...e,groupContracts:t.contracts,groupLinks:t.links,groupSyncedAt:t.syncedAt};default:return e}}var w=(0,b.createContext)({state:S,dispatch:()=>{}});function ee({children:e}){let[t,n]=(0,b.useReducer)(C,S);return(0,x.jsx)(w.Provider,{value:{state:t,dispatch:n},children:e})}function T(){return(0,b.useContext)(w)}var E=class{constructor(e){this.baseUrl=e}csrfToken=null;async getCsrfToken(){if(this.csrfToken)return this.csrfToken;let e=await(await fetch(`${this.baseUrl}/auth/csrf-token`,{credentials:`include`})).json();return this.csrfToken=e.csrfToken,this.csrfToken}async bootstrapStatus(){let e=await fetch(`${this.baseUrl}/auth/bootstrap-status`,{credentials:`include`});return e.ok?e.json():{needsBootstrap:!1}}async bootstrap(e,t){let n=await this.getCsrfToken(),r=await fetch(`${this.baseUrl}/auth/bootstrap`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":n},credentials:`include`,body:JSON.stringify({username:e,password:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e?.error?.message??`Bootstrap failed`)}return r.json()}async login(e,t){let n=await this.getCsrfToken(),r=await fetch(`${this.baseUrl}/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":n},credentials:`include`,body:JSON.stringify({username:e,password:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e?.error?.message??`Login failed`)}return r.json()}async logout(){let e=await this.getCsrfToken();await fetch(`${this.baseUrl}/auth/logout`,{method:`POST`,headers:{"X-CSRF-Token":e},credentials:`include`}),this.csrfToken=null}async authStatus(){let e=await fetch(`${this.baseUrl}/auth/status`,{credentials:`include`});return e.ok?e.json():{authenticated:!1}}async fetchGraph(e){let t=await fetch(`${this.baseUrl}/api/v1/graph/${e}`,{credentials:`include`});if(!t.ok)throw Error(`Failed to fetch graph: ${t.statusText}`);return t.json()}async search(e,t=20){let n=await this.getCsrfToken(),r=await fetch(`${this.baseUrl}/api/v1/search`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":n},credentials:`include`,body:JSON.stringify({query:e,limit:t})});if(!r.ok)throw Error(`Search failed: ${r.statusText}`);return r.json()}async vectorSearch(e,t=10){let n=await this.getCsrfToken(),r=await fetch(`${this.baseUrl}/api/v1/vector-search`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":n},credentials:`include`,body:JSON.stringify({query:e,limit:t})});if(!r.ok)throw Error(`Vector search failed: ${r.statusText}`);return r.json()}async vectorStatus(){let e=await fetch(`${this.baseUrl}/api/v1/vector-status`,{credentials:`include`});return e.ok?e.json():{ready:!1,building:!1}}async listRepos(){let e=await fetch(`${this.baseUrl}/api/v1/repos`,{credentials:`include`});if(!e.ok)throw Error(`Failed to list repos: ${e.statusText}`);return e.json()}async readFile(e){let t=await this.getCsrfToken(),n=await fetch(`${this.baseUrl}/api/v1/files/read`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":t},credentials:`include`,body:JSON.stringify({file_path:e})});if(!n.ok)throw Error(`Failed to read file: ${n.statusText}`);return n.json()}async inspectNode(e){let t=await fetch(`${this.baseUrl}/api/v1/nodes/${encodeURIComponent(e)}`,{credentials:`include`});if(!t.ok)throw Error(`Inspect failed: ${t.statusText}`);return t.json()}async blastRadius(e,t=`both`,n=3){let r=await this.getCsrfToken(),i=await fetch(`${this.baseUrl}/api/v1/blast-radius`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":r},credentials:`include`,body:JSON.stringify({target:e,direction:t,max_hops:n})});if(!i.ok)throw Error(`Blast radius failed: ${i.statusText}`);return i.json()}async grep(e){let t=await this.getCsrfToken(),n=await fetch(`${this.baseUrl}/api/v1/grep`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":t},credentials:`include`,body:JSON.stringify({pattern:e})});if(!n.ok)throw Error(`Grep failed: ${n.statusText}`);return n.json()}async listFlows(){let e=await fetch(`${this.baseUrl}/api/v1/flows`,{credentials:`include`});if(!e.ok)throw Error(`List flows failed: ${e.statusText}`);return e.json()}async listGroups(){let e=await fetch(`${this.baseUrl}/api/v1/groups`,{credentials:`include`});if(!e.ok)throw Error(`Failed to list groups: ${e.statusText}`);return e.json()}async getGroup(e){let t=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}`,{credentials:`include`});if(!t.ok)throw Error(`Group not found: ${t.statusText}`);return t.json()}async getGroupContracts(e){let t=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/contracts`,{credentials:`include`});if(t.status===404)return null;if(!t.ok)throw Error(`Failed to get contracts: ${t.statusText}`);return t.json()}async syncGroup(e){let t=await this.getCsrfToken(),n=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/sync`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":t},credentials:`include`});if(!n.ok)throw Error(`Sync failed: ${n.statusText}`);return n.json()}async searchGroup(e,t,n=20){let r=await this.getCsrfToken(),i=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/search`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":r},credentials:`include`,body:JSON.stringify({q:t,limit:n})});if(!i.ok)throw Error(`Group search failed: ${i.statusText}`);return i.json()}async fetchGroupGraph(e){let t=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/graph`,{credentials:`include`});if(!t.ok)throw Error(`Failed to fetch group graph: ${t.statusText}`);return t.json()}async sourcePreview(e,t,n){let r=new URLSearchParams({file:e});t!==void 0&&r.set(`startLine`,String(t)),n!==void 0&&r.set(`endLine`,String(n));let i=await fetch(`${this.baseUrl}/api/v1/source?${r.toString()}`,{credentials:`include`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.error?.message??`Source preview failed: ${i.statusText}`)}return i.json()}async getGroupTopology(e){let t=await fetch(`${this.baseUrl}/api/v1/groups/${encodeURIComponent(e)}/topology`,{credentials:`include`});if(!t.ok)throw Error(`Failed to get topology: ${t.statusText}`);return t.json()}async queryGQL(e){let t=await this.getCsrfToken(),n=await fetch(`${this.baseUrl}/api/v1/query`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":t},credentials:`include`,body:JSON.stringify({gql:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e?.error?.message??`Query failed: ${n.statusText}`)}return n.json()}};function te(){let{state:e,dispatch:t}=T(),n=window.location.port===`5173`||window.location.port===`5174`?`http://localhost:4747`:window.location.origin,[r,i]=(0,b.useState)(n),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(``),[l,u]=(0,b.useState)(``),[d,f]=(0,b.useState)(``),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(!0),[_,v]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{let r=new E(e.serverUrl||n);(async()=>{try{let{needsBootstrap:i}=await r.bootstrapStatus();if(i){v(!0),g(!1);return}let a=await r.authStatus();a.authenticated&&a.user&&(t({type:`SET_SERVER_URL`,url:e.serverUrl||n}),t({type:`SET_CURRENT_USER`,user:a.user}),t({type:`SET_VIEW`,view:`connect`}))}catch{}g(!1)})()},[]),h?(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`flex items-center gap-3 text-gray-400`,children:[(0,x.jsx)(ne,{className:`w-5 h-5 text-cyan-500`}),(0,x.jsx)(`span`,{className:`text-sm`,children:`Checking session…`})]})}):_?(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`bg-[#0a0d18] border border-gray-800/60 rounded-2xl shadow-2xl w-full max-w-sm p-10`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col items-center mb-8`,children:[(0,x.jsx)(`div`,{className:`w-14 h-14 rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white text-3xl font-bold shadow-lg mb-4 select-none`,children:`◈`}),(0,x.jsx)(`h1`,{className:`text-2xl font-bold text-white tracking-tight`,children:`Code Intel`}),(0,x.jsx)(`p`,{className:`text-gray-400 text-sm mt-1`,children:`First-time Setup`}),(0,x.jsxs)(`span`,{className:`mt-1.5 text-[10px] font-mono text-gray-600 select-none`,children:[`v`,`0.7.0`]})]}),(0,x.jsx)(`div`,{className:`mb-4 rounded-lg bg-cyan-950/40 border border-cyan-800/50 px-4 py-3`,children:(0,x.jsx)(`p`,{className:`text-cyan-300 text-sm leading-snug`,children:`No admin account found. Create one to get started.`})}),(0,x.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!a.trim()||!s.trim()){f(`Username and password are required`);return}if(s.length<8){f(`Password must be at least 8 characters`);return}if(s!==l){f(`Passwords do not match`);return}f(``),m(!0);try{let{user:e}=await new E(r).bootstrap(a.trim(),s);t({type:`SET_SERVER_URL`,url:r}),t({type:`SET_CURRENT_USER`,user:e}),t({type:`SET_VIEW`,view:`connect`})}catch(e){f(e instanceof Error?e.message:`Setup failed`)}finally{m(!1)}},className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Server URL`}),(0,x.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),disabled:p,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`http://localhost:4747`,autoComplete:`off`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Admin Username`}),(0,x.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),disabled:p,autoComplete:`username`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`admin`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Password`}),(0,x.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),disabled:p,autoComplete:`new-password`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`••••••••`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Confirm Password`}),(0,x.jsx)(`input`,{type:`password`,value:l,onChange:e=>u(e.target.value),disabled:p,autoComplete:`new-password`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`••••••••`})]}),d&&(0,x.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg bg-red-950/40 border border-red-800/50 px-4 py-3`,children:[(0,x.jsx)(`svg`,{className:`w-4 h-4 text-red-400 mt-0.5 shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z`})}),(0,x.jsx)(`p`,{className:`text-red-400 text-sm leading-snug`,children:d})]}),(0,x.jsx)(`button`,{type:`submit`,disabled:p,className:`w-full bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 text-white font-semibold rounded-lg py-2.5 transition flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed mt-2`,children:p?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ne,{className:`w-4 h-4`}),`Creating account…`]}):`Create Admin Account`})]})]})}):(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`bg-[#0a0d18] border border-gray-800/60 rounded-2xl shadow-2xl w-full max-w-sm p-10`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col items-center mb-8`,children:[(0,x.jsx)(`div`,{className:`w-14 h-14 rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white text-3xl font-bold shadow-lg mb-4 select-none`,children:`◈`}),(0,x.jsx)(`h1`,{className:`text-2xl font-bold text-white tracking-tight`,children:`Code Intel`}),(0,x.jsx)(`p`,{className:`text-gray-400 text-sm mt-1`,children:`Sign in to your account`}),(0,x.jsxs)(`span`,{className:`mt-1.5 text-[10px] font-mono text-gray-600 select-none`,children:[`v`,`0.7.0`]})]}),(0,x.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!a.trim()||!s.trim()){f(`Username and password are required`);return}f(``),m(!0);try{let{user:e}=await new E(r).login(a.trim(),s);t({type:`SET_SERVER_URL`,url:r}),t({type:`SET_CURRENT_USER`,user:e}),t({type:`SET_VIEW`,view:`connect`})}catch(e){f(e instanceof Error?e.message:`Login failed`)}finally{m(!1)}},className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Server URL`}),(0,x.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),disabled:p,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`http://localhost:4747`,autoComplete:`off`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Username`}),(0,x.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),disabled:p,autoComplete:`username`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`admin`})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-1.5`,children:`Password`}),(0,x.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),disabled:p,autoComplete:`current-password`,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50 text-sm`,placeholder:`••••••••`})]}),d&&(0,x.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg bg-red-950/40 border border-red-800/50 px-4 py-3`,children:[(0,x.jsx)(`svg`,{className:`w-4 h-4 text-red-400 mt-0.5 shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z`})}),(0,x.jsx)(`p`,{className:`text-red-400 text-sm leading-snug`,children:d})]}),(0,x.jsx)(`button`,{type:`submit`,disabled:p,className:`w-full bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 text-white font-semibold rounded-lg py-2.5 transition flex items-center justify-center gap-2 disabled:opacity-60 disabled:cursor-not-allowed mt-2`,children:p?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ne,{className:`w-4 h-4`}),`Signing in…`]}):`Sign in`})]}),(0,x.jsxs)(`div`,{className:`mt-6 pt-5 border-t border-gray-800/60`,children:[(0,x.jsxs)(`p`,{className:`text-center text-xs text-gray-600`,children:[`No account?`,` `,(0,x.jsx)(`span`,{className:`font-mono text-gray-500`,children:`code-intel user create admin --role admin`})]}),(0,x.jsxs)(`p`,{className:`text-center text-xs text-gray-700 mt-1.5`,children:[`Or use a Bearer token via`,` `,(0,x.jsx)(`span`,{className:`font-mono text-gray-600`,children:`Authorization: Bearer <token>`})]})]})]})})}function ne({className:e=``}){return(0,x.jsxs)(`svg`,{className:`animate-spin ${e}`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,x.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,x.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z`})]})}function re(){let{dispatch:e}=T(),t=window.location.port===`5173`||window.location.port===`5174`?`http://localhost:4747`:window.location.origin,[n,r]=(0,b.useState)(t),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(`repo`),[u,d]=(0,b.useState)([]),[f,p]=(0,b.useState)([]),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(null);(0,b.useEffect)(()=>{v(t)},[]);let v=async e=>{try{d(await new E(e).listRepos()),a(``)}catch{d([])}};(0,b.useEffect)(()=>{c===`group`&&y()},[c,n]);let y=async()=>{h(!0);try{p(await new E(n).listGroups())}catch{p([])}finally{h(!1)}},S=async t=>{a(``),s(!0);try{let r=new E(n);e({type:`SET_SERVER_URL`,url:n}),e({type:`SET_MODE`,mode:`repo`}),e({type:`SET_REPO_NAME`,name:t}),e({type:`SET_VIEW`,view:`loading`});let{nodes:i,edges:a}=await r.fetchGraph(t);e({type:`SET_GRAPH`,nodes:i,edges:a}),e({type:`SET_CONNECTED`,connected:!0}),e({type:`SET_VIEW`,view:`exploring`})}catch(t){a(t instanceof Error?t.message:`Connection failed`),e({type:`SET_VIEW`,view:`connect`}),s(!1)}},C=async t=>{a(``),_(t);try{let r=new E(n);e({type:`SET_SERVER_URL`,url:n}),e({type:`SET_VIEW`,view:`loading`});let[i,a]=await Promise.all([r.getGroup(t),r.fetchGroupGraph(t)]);e({type:`SET_MODE`,mode:`group`}),e({type:`SET_GROUP_NAME`,name:t}),e({type:`SET_GROUP_MEMBERS`,members:i.members}),e({type:`SET_REPO_NAME`,name:t}),e({type:`SET_GRAPH`,nodes:a.nodes,edges:a.edges}),e({type:`SET_CONNECTED`,connected:!0}),e({type:`SET_VIEW`,view:`exploring`}),r.getGroupContracts(t).then(t=>{t&&e({type:`SET_GROUP_CONTRACTS`,contracts:t.contracts,links:t.links,syncedAt:t.syncedAt})}).catch(()=>{})}catch(t){a(t instanceof Error?t.message:`Failed to load group`),e({type:`SET_VIEW`,view:`connect`})}finally{_(null)}};return(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`bg-[#0a0d18] border border-gray-800/60 rounded-2xl shadow-2xl w-full max-w-md p-10`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col items-center mb-8`,children:[(0,x.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white text-2xl font-bold shadow-lg mb-4 select-none`,children:`◈`}),(0,x.jsx)(`h1`,{className:`text-2xl font-bold text-white tracking-tight`,children:`Code Intel`}),(0,x.jsx)(`p`,{className:`text-gray-400 text-sm mt-1`,children:`Knowledge Graph Explorer`})]}),(0,x.jsx)(`div`,{className:`flex bg-gray-900/60 rounded-lg p-1 mb-6 border border-gray-800/50`,children:[`repo`,`group`].map(e=>(0,x.jsx)(`button`,{onClick:()=>l(e),className:`flex-1 py-1.5 rounded-md text-sm font-medium transition ${c===e?`bg-gradient-to-r from-cyan-600 to-blue-600 text-white shadow`:`text-gray-400 hover:text-gray-200`}`,children:e===`repo`?`⬡ Repository`:`⬢ Group`},e))}),(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-xs font-medium text-gray-400 uppercase tracking-widest mb-2`,children:`Server URL`}),(0,x.jsx)(`input`,{type:`text`,value:n,onChange:e=>{r(e.target.value),v(e.target.value)},disabled:o||g!==null,className:`w-full bg-gray-900 text-white rounded-lg px-4 py-2.5 border border-gray-700 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500/40 placeholder-gray-600 transition disabled:opacity-50`,placeholder:`http://localhost:4747`})]}),i&&(0,x.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg bg-red-950/40 border border-red-800/50 px-4 py-3`,children:[(0,x.jsx)(`svg`,{className:`w-4 h-4 text-red-400 mt-0.5 shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z`})}),(0,x.jsx)(`p`,{className:`text-red-400 text-sm leading-snug`,children:i})]}),c===`repo`&&(0,x.jsx)(`div`,{children:u.length>0?(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(`p`,{className:`text-xs text-gray-500 uppercase tracking-widest font-medium`,children:`Indexed repositories`}),u.map(e=>(0,x.jsxs)(`button`,{onClick:()=>S(e.name),disabled:o,className:`w-full flex items-center justify-between bg-gray-900/60 hover:bg-gray-800/60 border rounded-lg px-4 py-3 transition group disabled:opacity-50 disabled:cursor-not-allowed text-left ${e.active?`border-cyan-700/60 hover:border-cyan-600`:`border-gray-700/60 hover:border-cyan-700/50`}`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`div`,{className:`text-sm font-semibold text-cyan-400 truncate`,children:e.name}),e.active&&(0,x.jsx)(`span`,{className:`text-[9px] bg-cyan-900/50 text-cyan-400 border border-cyan-700/50 px-1.5 py-0.5 rounded-full font-medium shrink-0`,children:`active`})]}),(0,x.jsxs)(`div`,{className:`text-xs text-gray-500 truncate`,children:[e.nodes.toLocaleString(),` nodes · `,e.edges.toLocaleString(),` edges`]}),e.path&&(0,x.jsx)(`div`,{className:`text-[10px] text-gray-600 font-mono truncate mt-0.5`,children:e.path})]}),o?(0,x.jsx)(D,{className:`w-4 h-4 text-cyan-400 ml-2 shrink-0`}):(0,x.jsx)(`span`,{className:`text-gray-600 group-hover:text-cyan-500 transition text-lg ml-2 shrink-0`,children:`→`})]},e.name))]}):(0,x.jsxs)(`div`,{className:`bg-gray-900/40 border border-gray-800 rounded-lg px-4 py-6 text-center`,children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-sm mb-2`,children:`No repositories found at this URL.`}),(0,x.jsx)(`p`,{className:`text-gray-600 text-xs font-mono`,children:`code-intel analyze`})]})}),c===`group`&&(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-gray-400 uppercase tracking-widest`,children:`Available Groups`}),(0,x.jsx)(`button`,{onClick:y,disabled:m,className:`text-xs text-cyan-500 hover:text-cyan-400 transition disabled:opacity-50`,children:`↻ Refresh`})]}),m?(0,x.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-gray-500 text-sm gap-2`,children:[(0,x.jsx)(D,{className:`w-4 h-4`}),`Loading groups…`]}):f.length===0?(0,x.jsxs)(`div`,{className:`bg-gray-900/40 border border-gray-800 rounded-lg px-4 py-6 text-center`,children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-sm mb-2`,children:`No groups found.`}),(0,x.jsx)(`p`,{className:`text-gray-600 text-xs font-mono`,children:`code-intel group create <name>`})]}):(0,x.jsx)(`div`,{className:`space-y-2 max-h-64 overflow-y-auto pr-1`,children:f.map(e=>(0,x.jsxs)(`button`,{onClick:()=>C(e.name),disabled:g!==null,className:`w-full flex items-center justify-between bg-gray-900/60 hover:bg-gray-800/60 border border-gray-700/60 hover:border-indigo-700/50 rounded-lg px-4 py-3 transition group disabled:opacity-50 disabled:cursor-not-allowed text-left`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`span`,{className:`text-indigo-400 font-semibold text-sm`,children:[`⬢ `,e.name]}),g===e.name&&(0,x.jsx)(D,{className:`w-3 h-3 text-indigo-400`})]}),(0,x.jsxs)(`div`,{className:`text-gray-500 text-xs mt-0.5`,children:[e.memberCount,` repo`,e.memberCount===1?``:`s`,e.lastSync?` · synced ${new Date(e.lastSync).toLocaleDateString()}`:` · not synced`]})]}),(0,x.jsx)(`span`,{className:`text-gray-600 group-hover:text-indigo-400 transition text-lg`,children:`→`})]},e.name))}),(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-600 mt-3 text-center`,children:[`Create groups with `,(0,x.jsx)(`span`,{className:`font-mono text-gray-500`,children:`code-intel group create <name>`})]})]})]})]})})}function D({className:e=``}){return(0,x.jsxs)(`svg`,{className:`animate-spin ${e}`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,x.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,x.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z`})]})}function O(){return(0,x.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-[#040812]`,children:(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-6`,children:[(0,x.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,x.jsx)(`span`,{className:`absolute inline-flex h-16 w-16 rounded-xl bg-cyan-500/20 animate-ping`}),(0,x.jsx)(`div`,{className:`relative w-14 h-14 rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white text-3xl font-bold shadow-xl shadow-cyan-900/40 select-none`,children:`◈`})]}),(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,x.jsx)(`p`,{className:`text-gray-300 text-lg font-medium tracking-wide`,children:`Building knowledge graph…`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:-0.3s]`}),(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:-0.15s]`}),(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-cyan-500 animate-bounce`})]})]}),(0,x.jsx)(`p`,{className:`text-gray-600 text-sm tracking-widest uppercase`,children:`Indexing nodes and edges…`})]})})}var k=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}))();function A(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}var j=A;typeof Object.assign==`function`&&(j=Object.assign);function M(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function N(e){return typeof e==`object`&&!!e}function P(e){let t;for(t in e)return!1;return!0}function ie(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function ae(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function oe(e){return!(!N(e)||e.attributes&&!Array.isArray(e.attributes))}function se(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function F(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function ce(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var I=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},L=class e extends I{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},R=class e extends I{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},z=class e extends I{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function B(e,t){this.key=e,this.attributes=t,this.clear()}B.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function V(e,t){this.key=e,this.attributes=t,this.clear()}V.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function H(e,t){this.key=e,this.attributes=t,this.clear()}H.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function le(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}le.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},le.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},le.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},le.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var ue=0,de=1,fe=2,pe=3;function me(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===ue){if(s=e._nodes.get(r),!s)throw new R(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===pe){if(i=``+i,c=e._edges.get(i),!c)throw new R(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new R(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new R(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===de?c.source:c.target,l=i,u=a}return[s,l,u]}function he(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);return a.attributes[o]}}function ge(e,t,n){e.prototype[t]=function(e,r){let[i]=me(this,t,n,e,r);return i.attributes}}function _e(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function ve(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=me(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function ye(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=me(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new L(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function be(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function xe(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);if(!N(o))throw new L(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function Se(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);if(!N(o))throw new L(`Graph.${t}: provided attributes are not a plain object.`);return j(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function Ce(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=me(this,t,n,e,r,i);if(typeof o!=`function`)throw new L(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}var we=[{name:e=>`get${e}Attribute`,attacher:he},{name:e=>`get${e}Attributes`,attacher:ge},{name:e=>`has${e}Attribute`,attacher:_e},{name:e=>`set${e}Attribute`,attacher:ve},{name:e=>`update${e}Attribute`,attacher:ye},{name:e=>`remove${e}Attribute`,attacher:be},{name:e=>`replace${e}Attributes`,attacher:xe},{name:e=>`merge${e}Attributes`,attacher:Se},{name:e=>`update${e}Attributes`,attacher:Ce}];function Te(e){we.forEach(function({name:t,attacher:n}){n(e,t(`Node`),ue),n(e,t(`Source`),de),n(e,t(`Target`),fe),n(e,t(`Opposite`),pe)})}function Ee(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function De(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=``+e,a=``+arguments[1];if(r=M(this,i,a,n),!r)throw new R(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,r=this._edges.get(e),!r)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Oe(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function ke(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=M(this,o,s,n),!a)throw new R(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function Ae(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=M(this,o,s,n),!a)throw new R(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new L(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function je(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function Me(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!N(r))throw new L(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function Ne(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!N(r))throw new L(`Graph.${t}: provided attributes are not a plain object.`);return j(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function Pe(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=M(this,a,o,n),!i)throw new R(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new R(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new L(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}var Fe=[{name:e=>`get${e}Attribute`,attacher:Ee},{name:e=>`get${e}Attributes`,attacher:De},{name:e=>`has${e}Attribute`,attacher:Oe},{name:e=>`set${e}Attribute`,attacher:ke},{name:e=>`update${e}Attribute`,attacher:Ae},{name:e=>`remove${e}Attribute`,attacher:je},{name:e=>`replace${e}Attributes`,attacher:Me},{name:e=>`merge${e}Attributes`,attacher:Ne},{name:e=>`update${e}Attributes`,attacher:Pe}];function Ie(e){Fe.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var Le=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function Re(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function ze(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function Be(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function Ve(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function He(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function Ue(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function We(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function Ge(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function Ke(e,t){if(e.size===0)return ce();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function qe(e,t,n,r,i,a){let o=t?ze:Re,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function Je(e,t,n,r){let i=[];return qe(!1,e,t,n,r,function(e){i.push(e)}),i}function Ye(e,t,n){let r=ce();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=F(r,Be(n.in))),t!==`in`&&n.out!==void 0&&(r=F(r,Be(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=F(r,Be(n.undirected))),r}function Xe(e,t,n,r,i,a,o){let s=n?He:Ve,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function Ze(e,t,n,r,i){let a=[];return Xe(!1,e,t,n,r,i,function(e){a.push(e)}),a}function Qe(e,t,n,r){let i=ce();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=F(i,Ue(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=F(i,Ue(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=F(i,Ue(n.undirected,r))),i}function $e(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return We(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new R(`Graph.${n}: could not find the "${e}" node in the graph.`);return Je(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new R(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.${n}: could not find the "${t}" target node in the graph.`);return Ze(r,this.multi,i,a,t)}throw new L(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function et(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(!(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)){if(arguments.length===1)return n=e,Ge(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);return qe(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new R(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Xe(!1,r,this.multi,i,o,t,n)}throw new L(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new L(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new L(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function tt(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,Ge(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);return qe(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new R(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Xe(!0,r,this.multi,i,o,t,n)}throw new L(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function nt(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return ce();if(!arguments.length)return Ke(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);return Ye(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Qe(r,i,n,t)}throw new L(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function rt(e){Le.forEach(t=>{$e(e,t),et(e,t),tt(e,t),nt(e,t)})}var it=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function at(){this.A=null,this.B=null}at.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},at.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function ot(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function st(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return ot(e,null,r,r.undirected,i);if(typeof n==`string`)return ot(e,null,r,r[n],i)}let a=new at,o;if(t!==`undirected`){if(n!==`out`){if(o=ot(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=ot(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=ot(e,a,r,r.undirected,i),e&&o))return o}function ct(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return st(!1,e,t,n,function(e){r.push(e)}),r}function lt(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function ut(e,t,n){if(e!==`mixed`){if(e===`undirected`)return lt(null,n,n.undirected);if(typeof t==`string`)return lt(null,n,n[t])}let r=ce(),i=new at;return e!==`undirected`&&(t!==`out`&&(r=F(r,lt(i,n,n.in))),t!==`in`&&(r=F(r,lt(i,n,n.out)))),e!==`directed`&&(r=F(r,lt(i,n,n.undirected))),r}function dt(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new R(`Graph.${n}: could not find the "${e}" node in the graph.`);return ct(r===`mixed`?this.type:r,i,t)}}function ft(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);st(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new L(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function pt(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new R(`Graph.${o}: could not find the "${e}" node in the graph.`);return st(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function mt(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return ce();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new R(`Graph.${a}: could not find the "${e}" node in the graph.`);return ut(r===`mixed`?this.type:r,i,t)}}function ht(e){it.forEach(t=>{dt(e,t),ft(e,t),pt(e,t),mt(e,t)})}function gt(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function _t(e,t){let n={key:e};return P(t.attributes)||(n.attributes=j({},t.attributes)),n}function vt(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return P(n.attributes)||(r.attributes=j({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function yt(e){if(!N(e))throw new L(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new L(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!N(e.attributes)||e.attributes===null))throw new L(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function bt(e){if(!N(e))throw new L(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new L(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new L(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!N(e.attributes)||e.attributes===null))throw new L(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new L(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}var xt=se(),St=new Set([`directed`,`undirected`,`mixed`]),Ct=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),wt=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],Tt={allowSelfLoops:!0,multi:!1,type:`mixed`};function Et(e,t,n){if(n&&!N(n))throw new L(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new z(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function Dt(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function Ot(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new z(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new z(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!N(s))throw new L(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new z(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),l=e._nodes.get(o);if(!c)throw new R(`Graph.${t}: source node "${a}" not found.`);if(!l)throw new R(`Graph.${t}: target node "${o}" not found.`);let u={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new z(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new z(`Graph.${t}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let d=new le(r,i,c,l,s);e._edges.set(i,d);let f=a===o;return r?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),r?e._undirectedSize++:e._directedSize++,u.key=i,e.emit(`edgeAdded`,u),i}function kt(e,t,n,r,i,a,o,s,c){if(!r&&e.type===`undirected`)throw new z(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new z(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!=`function`)throw new L(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!N(s))throw new L(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=``+a,o=``+o;let l;if(c&&(l=s,s=void 0),!e.allowSelfLoops&&a===o)throw new z(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=e._nodes.get(a),d=e._nodes.get(o),f,p;if(!n&&(f=e._edges.get(i),f)){if((f.source.key!==a||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==a))throw new z(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!e.multi&&u&&(p=r?u.undirected[o]:u.out[o]),p){let t=[p.key,!1,!1,!1];if(c?!l:!s)return t;if(c){let t=p.attributes;p.attributes=l(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:p.key,attributes:p.attributes})}else j(p.attributes,s),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:p.key,attributes:p.attributes,data:s});return t}s||={},c&&l&&(s=l(s));let m={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new z(`Graph.${t}: the "${i}" edge already exists in the graph.`);let h=!1,g=!1;u||(u=Dt(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=Dt(e,o,{}),g=!0),f=new le(r,i,u,d,s),e._edges.set(i,f);let _=a===o;return r?(u.undirectedDegree++,d.undirectedDegree++,_&&(u.undirectedLoops++,e._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,_&&(u.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,m.key=i,e.emit(`edgeAdded`,m),[i,!0,h,g]}function At(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var jt=class e extends k.EventEmitter{constructor(e){if(super(),e=j({},Tt,e),typeof e.multi!=`boolean`)throw new L(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!St.has(e.type))throw new L(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new L(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?B:e.type===`directed`?V:H;ie(this,`NodeDataClass`,t);let n=`geid_`+xt()+`_`,r=0;ie(this,`_attributes`,{}),ie(this,`_nodes`,new Map),ie(this,`_edges`,new Map),ie(this,`_directedSize`,0),ie(this,`_undirectedSize`,0),ie(this,`_directedSelfLoopCount`,0),ie(this,`_undirectedSelfLoopCount`,0),ie(this,`_edgeKeyGenerator`,()=>{let e;do e=n+ r++;while(this._edges.has(e));return e}),ie(this,`_options`,e),Ct.forEach(e=>ie(this,e,this[e])),ae(this,`order`,()=>this._nodes.size),ae(this,`size`,()=>this._edges.size),ae(this,`directedSize`,()=>this._directedSize),ae(this,`undirectedSize`,()=>this._undirectedSize),ae(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),ae(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),ae(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),ae(this,`multi`,this._options.multi),ae(this,`type`,this._options.type),ae(this,`allowSelfLoops`,this._options.allowSelfLoops),ae(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new L(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new L(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new L(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new z(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new R(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new z(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new R(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new z(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`directed`?!1:t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new R(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new R(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new R(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new R(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new R(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Et(this,e,t).key}mergeNode(e,t){if(t&&!N(t))throw new L(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(j(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new L(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new R(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do At(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do At(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do At(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=M(this,e,n,this.type),!t)throw new R(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new R(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return At(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new z(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new z(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=M(this,e,t,`directed`);if(!n)throw new R(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return At(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new z(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new z(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=M(this,e,t,`undirected`);if(!n)throw new R(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return At(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new L(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!N(e))throw new L(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!N(e))throw new L(`Graph.mergeAttributes: provided attributes are not a plain object.`);return j(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new L(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new L(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!oe(t))throw new L(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new L(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!oe(t))throw new L(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new L(`Graph.forEachAdjacencyEntry: expecting a callback.`);gt(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new L(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);gt(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new L(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);gt(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new L(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);gt(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new L(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new L(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new L(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new L(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new L(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new L(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new L(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new L(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=_t(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=vt(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!N(t))throw new L(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!N(t.attributes))throw new L(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new L(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],yt(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new L(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],bt(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(j({},this._options,t));return n.replaceAttributes(j({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=j({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new z(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new z(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new z(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,Ot(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,j({},i.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!Ct.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,ie(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(jt.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=jt.prototype.inspect),wt.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?Ot:kt;e.generateKey?jt.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:jt.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),Te(jt),Ie(jt),rt(jt),ht(jt);var Mt=class extends jt{constructor(e){let t=j({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new L(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new L(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},Nt=class extends jt{constructor(e){let t=j({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new L(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new L(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},Pt=class extends jt{constructor(e){let t=j({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new L(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},Ft=class extends jt{constructor(e){let t=j({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new L(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new L(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},It=class extends jt{constructor(e){let t=j({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new L(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new L(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function Lt(e){e.from=function(t,n){let r=new e(j({},t.options,n));return r.import(t),r}}Lt(jt),Lt(Mt),Lt(Nt),Lt(Pt),Lt(Ft),Lt(It),jt.Graph=jt,jt.DirectedGraph=Mt,jt.UndirectedGraph=Nt,jt.MultiGraph=Pt,jt.MultiDirectedGraph=Ft,jt.MultiUndirectedGraph=It,jt.InvalidArgumentsGraphError=L,jt.NotFoundGraphError=R,jt.UsageGraphError=z;function Rt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function zt(e){var t=Rt(e,`string`);return typeof t==`symbol`?t:t+``}function Bt(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Vt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,zt(r.key),r)}}function Ht(e,t,n){return t&&Vt(e.prototype,t),n&&Vt(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function Ut(e){return Ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ut(e)}function Wt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wt=function(){return!!e})()}function Gt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Kt(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Gt(e)}function qt(e,t,n){return t=Ut(t),Kt(e,Wt()?Reflect.construct(t,n||[],Ut(e).constructor):t.apply(e,n))}function Jt(e,t){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jt(e,t)}function Yt(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&Jt(e,t)}function Xt(e){if(Array.isArray(e))return e}function Zt(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Qt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $t(e,t){if(e){if(typeof e==`string`)return Qt(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qt(e,t):void 0}}function en(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
10
10
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tn(e,t){return Xt(e)||Zt(e,t)||$t(e,t)||en()}var nn={black:`#000000`,silver:`#C0C0C0`,gray:`#808080`,grey:`#808080`,white:`#FFFFFF`,maroon:`#800000`,red:`#FF0000`,purple:`#800080`,fuchsia:`#FF00FF`,green:`#008000`,lime:`#00FF00`,olive:`#808000`,yellow:`#FFFF00`,navy:`#000080`,blue:`#0000FF`,teal:`#008080`,aqua:`#00FFFF`,darkblue:`#00008B`,mediumblue:`#0000CD`,darkgreen:`#006400`,darkcyan:`#008B8B`,deepskyblue:`#00BFFF`,darkturquoise:`#00CED1`,mediumspringgreen:`#00FA9A`,springgreen:`#00FF7F`,cyan:`#00FFFF`,midnightblue:`#191970`,dodgerblue:`#1E90FF`,lightseagreen:`#20B2AA`,forestgreen:`#228B22`,seagreen:`#2E8B57`,darkslategray:`#2F4F4F`,darkslategrey:`#2F4F4F`,limegreen:`#32CD32`,mediumseagreen:`#3CB371`,turquoise:`#40E0D0`,royalblue:`#4169E1`,steelblue:`#4682B4`,darkslateblue:`#483D8B`,mediumturquoise:`#48D1CC`,indigo:`#4B0082`,darkolivegreen:`#556B2F`,cadetblue:`#5F9EA0`,cornflowerblue:`#6495ED`,rebeccapurple:`#663399`,mediumaquamarine:`#66CDAA`,dimgray:`#696969`,dimgrey:`#696969`,slateblue:`#6A5ACD`,olivedrab:`#6B8E23`,slategray:`#708090`,slategrey:`#708090`,lightslategray:`#778899`,lightslategrey:`#778899`,mediumslateblue:`#7B68EE`,lawngreen:`#7CFC00`,chartreuse:`#7FFF00`,aquamarine:`#7FFFD4`,skyblue:`#87CEEB`,lightskyblue:`#87CEFA`,blueviolet:`#8A2BE2`,darkred:`#8B0000`,darkmagenta:`#8B008B`,saddlebrown:`#8B4513`,darkseagreen:`#8FBC8F`,lightgreen:`#90EE90`,mediumpurple:`#9370DB`,darkviolet:`#9400D3`,palegreen:`#98FB98`,darkorchid:`#9932CC`,yellowgreen:`#9ACD32`,sienna:`#A0522D`,brown:`#A52A2A`,darkgray:`#A9A9A9`,darkgrey:`#A9A9A9`,lightblue:`#ADD8E6`,greenyellow:`#ADFF2F`,paleturquoise:`#AFEEEE`,lightsteelblue:`#B0C4DE`,powderblue:`#B0E0E6`,firebrick:`#B22222`,darkgoldenrod:`#B8860B`,mediumorchid:`#BA55D3`,rosybrown:`#BC8F8F`,darkkhaki:`#BDB76B`,mediumvioletred:`#C71585`,indianred:`#CD5C5C`,peru:`#CD853F`,chocolate:`#D2691E`,tan:`#D2B48C`,lightgray:`#D3D3D3`,lightgrey:`#D3D3D3`,thistle:`#D8BFD8`,orchid:`#DA70D6`,goldenrod:`#DAA520`,palevioletred:`#DB7093`,crimson:`#DC143C`,gainsboro:`#DCDCDC`,plum:`#DDA0DD`,burlywood:`#DEB887`,lightcyan:`#E0FFFF`,lavender:`#E6E6FA`,darksalmon:`#E9967A`,violet:`#EE82EE`,palegoldenrod:`#EEE8AA`,lightcoral:`#F08080`,khaki:`#F0E68C`,aliceblue:`#F0F8FF`,honeydew:`#F0FFF0`,azure:`#F0FFFF`,sandybrown:`#F4A460`,wheat:`#F5DEB3`,beige:`#F5F5DC`,whitesmoke:`#F5F5F5`,mintcream:`#F5FFFA`,ghostwhite:`#F8F8FF`,salmon:`#FA8072`,antiquewhite:`#FAEBD7`,linen:`#FAF0E6`,lightgoldenrodyellow:`#FAFAD2`,oldlace:`#FDF5E6`,magenta:`#FF00FF`,deeppink:`#FF1493`,orangered:`#FF4500`,tomato:`#FF6347`,hotpink:`#FF69B4`,coral:`#FF7F50`,darkorange:`#FF8C00`,lightsalmon:`#FFA07A`,orange:`#FFA500`,lightpink:`#FFB6C1`,pink:`#FFC0CB`,gold:`#FFD700`,peachpuff:`#FFDAB9`,navajowhite:`#FFDEAD`,moccasin:`#FFE4B5`,bisque:`#FFE4C4`,mistyrose:`#FFE4E1`,blanchedalmond:`#FFEBCD`,papayawhip:`#FFEFD5`,lavenderblush:`#FFF0F5`,seashell:`#FFF5EE`,cornsilk:`#FFF8DC`,lemonchiffon:`#FFFACD`,floralwhite:`#FFFAF0`,snow:`#FFFAFA`,lightyellow:`#FFFFE0`,ivory:`#FFFFF0`},rn=new Int8Array(4),an=new Int32Array(rn.buffer,0,1),on=new Float32Array(rn.buffer,0,1),sn=/^\s*rgba?\s*\(/,cn=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function ln(e){var t=0,n=0,r=0,i=1;if(e[0]===`#`)e.length===4?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),r=parseInt(e.charAt(5)+e.charAt(6),16)),e.length===9&&(i=parseInt(e.charAt(7)+e.charAt(8),16)/255);else if(sn.test(e)){var a=e.match(cn);a&&(t=+a[1],n=+a[2],r=+a[3],a[4]&&(i=+a[4]))}return{r:t,g:n,b:r,a:i}}var un={};for(var dn in nn)un[dn]=pn(nn[dn]),un[nn[dn]]=un[dn];function fn(e,t,n,r,i){return an[0]=r<<24|n<<16|t<<8|e,i&&(an[0]&=4278190079),on[0]}function pn(e){if(e=e.toLowerCase(),un[e]!==void 0)return un[e];var t=ln(e),n=t.r,r=t.g,i=t.b,a=t.a;a=a*255|0;var o=fn(n,r,i,a,!0);return un[e]=o,o}var mn={};function hn(e){if(mn[e]!==void 0)return mn[e];var t=fn((e&16711680)>>>16,(e&65280)>>>8,e&255,255,!0);return mn[e]=t,t}function gn(e,t,n,r){return n+(t<<8)+(e<<16)}function _n(e,t,n,r,i,a){var o=Math.floor(n/a*i),s=Math.floor(e.drawingBufferHeight/a-r/a*i),c=new Uint8Array(4);e.bindFramebuffer(e.FRAMEBUFFER,t),e.readPixels(o,s,1,1,e.RGBA,e.UNSIGNED_BYTE,c);var l=tn(c,4);return[l[0],l[1],l[2],l[3]]}function U(e,t,n){return(t=zt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?vn(Object(n),!0).forEach(function(t){U(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yn(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Ut(e))!==null;);return e}function bn(){return bn=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=yn(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},bn.apply(null,arguments)}function xn(e,t,n,r){var i=bn(Ut(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function Sn(e){return e.normalized?1:e.size}function Cn(e){var t=0;return e.forEach(function(e){return t+=Sn(e)}),t}function wn(e,t,n){var r=e===`VERTEX`?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(r);if(i===null)throw Error(`loadShader: error while creating the shader`);if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var a=t.getShaderInfoLog(i);throw t.deleteShader(i),Error(`loadShader: error while compiling the shader:
11
11
  ${a}
12
- ${n}`)}return i}function Tn(e,t){return wn(`VERTEX`,e,t)}function En(e,t){return wn(`FRAGMENT`,e,t)}function Dn(e,t){var n=e.createProgram();if(n===null)throw Error(`loadProgram: error while creating the program.`);var r,i;for(r=0,i=t.length;r<i;r++)e.attachShader(n,t[r]);if(e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS))throw e.deleteProgram(n),Error(`loadProgram: error while linking the program.`);return n}function On(e){var t=e.gl,n=e.buffer,r=e.program,i=e.vertexShader,a=e.fragmentShader;t.deleteShader(i),t.deleteShader(a),t.deleteProgram(r),t.deleteBuffer(n)}var kn=`#define PICKING_MODE
12
+ ${n}`)}return i}function Tn(e,t){return wn(`VERTEX`,e,t)}function En(e,t){return wn(`FRAGMENT`,e,t)}function Dn(e,t){var n=e.createProgram();if(n===null)throw Error(`loadProgram: error while creating the program.`);var r,i;for(r=0,i=t.length;r<i;r++)e.attachShader(n,t[r]);if(e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)){var a=e.getProgramInfoLog(n);throw e.deleteProgram(n),Error(`loadProgram: error while linking the program: ${a}`)}return n}function On(e){var t=e.gl,n=e.buffer,r=e.program,i=e.vertexShader,a=e.fragmentShader;t.deleteShader(i),t.deleteShader(a),t.deleteProgram(r),t.deleteBuffer(n)}var kn=`#define PICKING_MODE
13
13
  `,An=U(U(U(U(U(U(U(U({},WebGL2RenderingContext.BOOL,1),WebGL2RenderingContext.BYTE,1),WebGL2RenderingContext.UNSIGNED_BYTE,1),WebGL2RenderingContext.SHORT,2),WebGL2RenderingContext.UNSIGNED_SHORT,2),WebGL2RenderingContext.INT,4),WebGL2RenderingContext.UNSIGNED_INT,4),WebGL2RenderingContext.FLOAT,4),jn=function(){function e(t,n,r){Bt(this,e),U(this,`array`,new Float32Array),U(this,`constantArray`,new Float32Array),U(this,`capacity`,0),U(this,`verticesCount`,0);var i=this.getDefinition();if(this.VERTICES=i.VERTICES,this.VERTEX_SHADER_SOURCE=i.VERTEX_SHADER_SOURCE,this.FRAGMENT_SHADER_SOURCE=i.FRAGMENT_SHADER_SOURCE,this.UNIFORMS=i.UNIFORMS,this.ATTRIBUTES=i.ATTRIBUTES,this.METHOD=i.METHOD,this.CONSTANT_ATTRIBUTES=`CONSTANT_ATTRIBUTES`in i?i.CONSTANT_ATTRIBUTES:[],this.CONSTANT_DATA=`CONSTANT_DATA`in i?i.CONSTANT_DATA:[],this.isInstanced=`CONSTANT_ATTRIBUTES`in i,this.ATTRIBUTES_ITEMS_COUNT=Cn(this.ATTRIBUTES),this.STRIDE=this.VERTICES*this.ATTRIBUTES_ITEMS_COUNT,this.renderer=r,this.normalProgram=this.getProgramInfo(`normal`,t,i.VERTEX_SHADER_SOURCE,i.FRAGMENT_SHADER_SOURCE,null),this.pickProgram=n?this.getProgramInfo(`pick`,t,kn+i.VERTEX_SHADER_SOURCE,kn+i.FRAGMENT_SHADER_SOURCE,n):null,this.isInstanced){var a=Cn(this.CONSTANT_ATTRIBUTES);if(this.CONSTANT_DATA.length!==this.VERTICES)throw Error(`Program: error while getting constant data (expected ${this.VERTICES} items, received ${this.CONSTANT_DATA.length} instead)`);this.constantArray=new Float32Array(this.CONSTANT_DATA.length*a);for(var o=0;o<this.CONSTANT_DATA.length;o++){var s=this.CONSTANT_DATA[o];if(s.length!==a)throw Error(`Program: error while getting constant data (one vector has ${s.length} items instead of ${a})`);for(var c=0;c<s.length;c++)this.constantArray[o*a+c]=s[c]}this.STRIDE=this.ATTRIBUTES_ITEMS_COUNT}}return Ht(e,[{key:`kill`,value:function(){On(this.normalProgram),this.pickProgram&&=(On(this.pickProgram),null)}},{key:`getProgramInfo`,value:function(e,t,n,r,i){var a=this.getDefinition(),o=t.createBuffer();if(o===null)throw Error(`Program: error while creating the WebGL buffer.`);var s=Tn(t,n),c=En(t,r),l=Dn(t,[s,c]),u={};a.UNIFORMS.forEach(function(e){var n=t.getUniformLocation(l,e);n&&(u[e]=n)});var d={};a.ATTRIBUTES.forEach(function(e){d[e.name]=t.getAttribLocation(l,e.name)});var f;if(`CONSTANT_ATTRIBUTES`in a&&(a.CONSTANT_ATTRIBUTES.forEach(function(e){d[e.name]=t.getAttribLocation(l,e.name)}),f=t.createBuffer(),f===null))throw Error(`Program: error while creating the WebGL constant buffer.`);return{name:e,program:l,gl:t,frameBuffer:i,buffer:o,constantBuffer:f||{},uniformLocations:u,attributeLocations:d,isPicking:e===`pick`,vertexShader:s,fragmentShader:c}}},{key:`bindProgram`,value:function(e){var t=this,n=0,r=e.gl,i=e.buffer;this.isInstanced?(r.bindBuffer(r.ARRAY_BUFFER,e.constantBuffer),n=0,this.CONSTANT_ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n,!1)}),r.bufferData(r.ARRAY_BUFFER,this.constantArray,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,e.buffer),n=0,this.ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n,!0)}),r.bufferData(r.ARRAY_BUFFER,this.array,r.DYNAMIC_DRAW)):(r.bindBuffer(r.ARRAY_BUFFER,i),n=0,this.ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n)}),r.bufferData(r.ARRAY_BUFFER,this.array,r.DYNAMIC_DRAW)),r.bindBuffer(r.ARRAY_BUFFER,null)}},{key:`unbindProgram`,value:function(e){var t=this;this.isInstanced?(this.CONSTANT_ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e,!1)}),this.ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e,!0)})):this.ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e)})}},{key:`bindAttribute`,value:function(e,t,n,r){var i=An[e.type];if(typeof i!=`number`)throw Error(`Program.bind: yet unsupported attribute type "${e.type}"`);var a=t.attributeLocations[e.name],o=t.gl;if(a!==-1){o.enableVertexAttribArray(a);var s=this.isInstanced?(r?this.ATTRIBUTES_ITEMS_COUNT:Cn(this.CONSTANT_ATTRIBUTES))*Float32Array.BYTES_PER_ELEMENT:this.ATTRIBUTES_ITEMS_COUNT*Float32Array.BYTES_PER_ELEMENT;if(o.vertexAttribPointer(a,e.size,e.type,e.normalized||!1,s,n),this.isInstanced&&r)if(o instanceof WebGL2RenderingContext)o.vertexAttribDivisor(a,1);else{var c=o.getExtension(`ANGLE_instanced_arrays`);c&&c.vertexAttribDivisorANGLE(a,1)}}return e.size*i}},{key:`unbindAttribute`,value:function(e,t,n){var r=t.attributeLocations[e.name],i=t.gl;if(r!==-1&&(i.disableVertexAttribArray(r),this.isInstanced&&n))if(i instanceof WebGL2RenderingContext)i.vertexAttribDivisor(r,0);else{var a=i.getExtension(`ANGLE_instanced_arrays`);a&&a.vertexAttribDivisorANGLE(r,0)}}},{key:`reallocate`,value:function(e){e!==this.capacity&&(this.capacity=e,this.verticesCount=this.VERTICES*e,this.array=new Float32Array(this.isInstanced?this.capacity*this.ATTRIBUTES_ITEMS_COUNT:this.verticesCount*this.ATTRIBUTES_ITEMS_COUNT))}},{key:`hasNothingToRender`,value:function(){return this.verticesCount===0}},{key:`renderProgram`,value:function(e,t){var n=t.gl,r=t.program;n.enable(n.BLEND),n.useProgram(r),this.setUniforms(e,t),this.drawWebGL(this.METHOD,t)}},{key:`render`,value:function(e){this.hasNothingToRender()||(this.pickProgram&&(this.pickProgram.gl.viewport(0,0,e.width*e.pixelRatio/e.downSizingRatio,e.height*e.pixelRatio/e.downSizingRatio),this.bindProgram(this.pickProgram),this.renderProgram(W(W({},e),{},{pixelRatio:e.pixelRatio/e.downSizingRatio}),this.pickProgram),this.unbindProgram(this.pickProgram)),this.normalProgram.gl.viewport(0,0,e.width*e.pixelRatio,e.height*e.pixelRatio),this.bindProgram(this.normalProgram),this.renderProgram(e,this.normalProgram),this.unbindProgram(this.normalProgram))}},{key:`drawWebGL`,value:function(e,t){var n=t.gl,r=t.frameBuffer;if(n.bindFramebuffer(n.FRAMEBUFFER,r),!this.isInstanced)n.drawArrays(e,0,this.verticesCount);else if(n instanceof WebGL2RenderingContext)n.drawArraysInstanced(e,0,this.VERTICES,this.capacity);else{var i=n.getExtension(`ANGLE_instanced_arrays`);i&&i.drawArraysInstancedANGLE(e,0,this.VERTICES,this.capacity)}}}])}(),Mn=function(e){function t(){return Bt(this,t),qt(this,t,arguments)}return Yt(t,e),Ht(t,[{key:`kill`,value:function(){xn(t,`kill`,this,3)([])}},{key:`process`,value:function(e,t,n){var r=t*this.STRIDE;if(n.hidden){for(var i=r+this.STRIDE;r<i;r++)this.array[r]=0;return}return this.processVisibleItem(hn(e),r,n)}}])}(jn),Nn=function(e){function t(){var e;Bt(this,t);var n=[...arguments];return e=qt(this,t,[].concat(n)),U(e,`drawLabel`,void 0),e}return Yt(t,e),Ht(t,[{key:`kill`,value:function(){xn(t,`kill`,this,3)([])}},{key:`process`,value:function(e,t,n,r,i){var a=t*this.STRIDE;if(i.hidden||n.hidden||r.hidden){for(var o=a+this.STRIDE;a<o;a++)this.array[a]=0;return}return this.processVisibleItem(hn(e),a,n,r,i)}}])}(jn);function Pn(e,t){return function(){function n(r,i,a){Bt(this,n),U(this,`drawLabel`,t),this.programs=e.map(function(e){return new e(r,i,a)})}return Ht(n,[{key:`reallocate`,value:function(e){this.programs.forEach(function(t){return t.reallocate(e)})}},{key:`process`,value:function(e,t,n,r,i){this.programs.forEach(function(a){return a.process(e,t,n,r,i)})}},{key:`render`,value:function(e){this.programs.forEach(function(t){return t.render(e)})}},{key:`kill`,value:function(){this.programs.forEach(function(e){return e.kill()})}}])}()}function Fn(e,t,n,r,i){var a=i.edgeLabelSize,o=i.edgeLabelFont,s=i.edgeLabelWeight,c=i.edgeLabelColor.attribute?t[i.edgeLabelColor.attribute]||i.edgeLabelColor.color||`#000`:i.edgeLabelColor.color,l=t.label;if(l){e.fillStyle=c,e.font=`${s} ${a}px ${o}`;var u=n.size,d=r.size,f=n.x,p=n.y,m=r.x,h=r.y,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=Math.sqrt(v*v+y*y);if(!(b<u+d)){f+=v*u/b,p+=y*u/b,m-=v*d/b,h-=y*d/b,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=Math.sqrt(v*v+y*y);var x=e.measureText(l).width;if(x>b){var S=`…`;for(l+=S,x=e.measureText(l).width;x>b&&l.length>1;)l=l.slice(0,-2)+S,x=e.measureText(l).width;if(l.length<4)return}var C=v>0?y>0?Math.acos(v/b):Math.asin(y/b):y>0?Math.acos(v/b)+Math.PI:Math.asin(v/b)+Math.PI/2;e.save(),e.translate(g,_),e.rotate(C),e.fillText(l,-x/2,t.size/2+a),e.restore()}}}function In(e,t,n){if(t.label){var r=n.labelSize,i=n.labelFont,a=n.labelWeight;e.fillStyle=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||`#000`:n.labelColor.color,e.font=`${a} ${r}px ${i}`,e.fillText(t.label,t.x+t.size+3,t.y+r/3)}}function Ln(e,t,n){var r=n.labelSize,i=n.labelFont;e.font=`${n.labelWeight} ${r}px ${i}`,e.fillStyle=`#FFF`,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor=`#000`;var a=2;if(typeof t.label==`string`){var o=e.measureText(t.label).width,s=Math.round(o+5),c=Math.round(r+2*a),l=Math.max(t.size,r/2)+a,u=Math.asin(c/2/l),d=Math.sqrt(Math.abs(l**2-(c/2)**2));e.beginPath(),e.moveTo(t.x+d,t.y+c/2),e.lineTo(t.x+l+s,t.y+c/2),e.lineTo(t.x+l+s,t.y-c/2),e.lineTo(t.x+d,t.y-c/2),e.arc(t.x,t.y,l,u,-u),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+a,0,Math.PI*2),e.closePath(),e.fill();e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,In(e,t,n)}var Rn=`
14
14
  precision highp float;
15
15
 
@@ -317,7 +317,7 @@ void main() {
317
317
  v_color.a *= bias;
318
318
  }
319
319
  `,ur=WebGLRenderingContext,dr=ur.UNSIGNED_BYTE,fr=ur.FLOAT,pr=[`u_matrix`,`u_zoomRatio`,`u_sizeRatio`,`u_correctionRatio`,`u_pixelRatio`,`u_feather`,`u_minEdgeThickness`],mr=function(e){function t(){return Bt(this,t),qt(this,t,arguments)}return Yt(t,e),Ht(t,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:lr,FRAGMENT_SHADER_SOURCE:$n,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:pr,ATTRIBUTES:[{name:`a_positionStart`,size:2,type:fr},{name:`a_positionEnd`,size:2,type:fr},{name:`a_normal`,size:2,type:fr},{name:`a_color`,size:4,type:dr,normalized:!0},{name:`a_id`,size:4,type:dr,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_positionCoef`,size:1,type:fr},{name:`a_normalCoef`,size:1,type:fr}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:`processVisibleItem`,value:function(e,t,n,r,i){var a=i.size||1,o=n.x,s=n.y,c=r.x,l=r.y,u=pn(i.color),d=c-o,f=l-s,p=d*d+f*f,m=0,h=0;p&&(p=1/Math.sqrt(p),m=-f*p*a,h=d*p*a);var g=this.array;g[t++]=o,g[t++]=s,g[t++]=c,g[t++]=l,g[t++]=m,g[t++]=h,g[t++]=u,g[t++]=e}},{key:`setUniforms`,value:function(e,t){var n=t.gl,r=t.uniformLocations,i=r.u_matrix,a=r.u_zoomRatio,o=r.u_feather,s=r.u_pixelRatio,c=r.u_correctionRatio,l=r.u_sizeRatio,u=r.u_minEdgeThickness;n.uniformMatrix3fv(i,!1,e.matrix),n.uniform1f(a,e.zoomRatio),n.uniform1f(l,e.sizeRatio),n.uniform1f(c,e.correctionRatio),n.uniform1f(s,e.pixelRatio),n.uniform1f(o,e.antiAliasingFeather),n.uniform1f(u,e.minEdgeThickness)}}])}(Nn),hr=function(e){function t(){var e;return Bt(this,t),e=qt(this,t),e.rawEmitter=e,e}return Yt(t,e),Ht(t)}(k.EventEmitter),gr=o(((e,t)=>{t.exports=function(e){return typeof e==`object`&&!!e&&typeof e.addUndirectedEdgeWithKey==`function`&&typeof e.dropNode==`function`&&typeof e.multi==`boolean`}})),_r=c(gr()),vr={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},yr={easing:`quadraticInOut`,duration:150};function br(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function xr(e,t,n){return e[0]=t,e[4]=typeof n==`number`?n:t,e}function Sr(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[3]=-n,e[4]=r,e}function Cr(e,t,n){return e[6]=t,e[7]=n,e}function wr(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=t[0],f=t[1],p=t[2],m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],y=t[8];return e[0]=d*n+f*a+p*c,e[1]=d*r+f*o+p*l,e[2]=d*i+f*s+p*u,e[3]=m*n+h*a+g*c,e[4]=m*r+h*o+g*l,e[5]=m*i+h*s+g*u,e[6]=_*n+v*a+y*c,e[7]=_*r+v*o+y*l,e[8]=_*i+v*s+y*u,e}function Tr(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=e[0],i=e[1],a=e[3],o=e[4],s=e[6],c=e[7],l=t.x,u=t.y;return{x:l*r+u*a+s*n,y:l*i+u*o+c*n}}function Er(e,t){var n=e.height/e.width,r=t.height/t.width;return n<1&&r>1||n>1&&r<1?1:Math.min(Math.max(r,1/r),Math.max(1/n,n))}function Dr(e,t,n,r,i){var a=e.angle,o=e.ratio,s=e.x,c=e.y,l=t.width,u=t.height,d=br(),f=Math.min(l,u)-2*r,p=Er(t,n);return i?(wr(d,Cr(br(),s,c)),wr(d,xr(br(),o)),wr(d,Sr(br(),a)),wr(d,xr(br(),l/f/2/p,u/f/2/p))):(wr(d,xr(br(),f/l*2*p,f/u*2*p)),wr(d,Sr(br(),-a)),wr(d,xr(br(),1/o)),wr(d,Cr(br(),-s,-c))),d}function Or(e,t,n){var r=Tr(e,{x:Math.cos(t.angle),y:Math.sin(t.angle)},0),i=r.x,a=r.y;return 1/Math.sqrt(i**2+a**2)/n.width}function kr(e){if(!e.order)return{x:[0,1],y:[0,1]};var t=1/0,n=-1/0,r=1/0,i=-1/0;return e.forEachNode(function(e,a){var o=a.x,s=a.y;o<t&&(t=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)}),{x:[t,n],y:[r,i]}}function Ar(e){if(!(0,_r.default)(e))throw Error(`Sigma: invalid graph instance.`);e.forEachNode(function(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw Error(`Sigma: Coordinates of node ${e} are invalid. A node must have a numeric 'x' and 'y' attribute.`)})}function jr(e,t,n){var r=document.createElement(e);if(t)for(var i in t)r.style[i]=t[i];if(n)for(var a in n)r.setAttribute(a,n[a]);return r}function Mr(){return window.devicePixelRatio===void 0?1:window.devicePixelRatio}function Nr(e,t,n){return n.sort(function(e,n){var r=t(e)||0,i=t(n)||0;return r<i?-1:+(r>i)})}function Pr(e){var t=tn(e.x,2),n=t[0],r=t[1],i=tn(e.y,2),a=i[0],o=i[1],s=Math.max(r-n,o-a),c=(r+n)/2,l=(o+a)/2;(s===0||Math.abs(s)===1/0||isNaN(s))&&(s=1),isNaN(c)&&(c=0),isNaN(l)&&(l=0);var u=function(e){return{x:.5+(e.x-c)/s,y:.5+(e.y-l)/s}};return u.applyTo=function(e){e.x=.5+(e.x-c)/s,e.y=.5+(e.y-l)/s},u.inverse=function(e){return{x:c+s*(e.x-.5),y:l+s*(e.y-.5)}},u.ratio=s,u}function Fr(e){"@babel/helpers - typeof";return Fr=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Fr(e)}function Ir(e,t){var n=t.size;if(n!==0){var r=e.length;e.length+=n;var i=0;t.forEach(function(t){e[r+i]=t,i++})}}function Lr(e){e||={};for(var t=0,n=arguments.length<=1?0:arguments.length-1;t<n;t++){var r=t+1<1||arguments.length<=t+1?void 0:arguments[t+1];r&&Object.assign(e,r)}return e}var Rr={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:`#999`,defaultNodeType:`circle`,defaultEdgeColor:`#ccc`,defaultEdgeType:`line`,labelFont:`Arial`,labelSize:14,labelWeight:`normal`,labelColor:{color:`#000`},edgeLabelFont:`Arial`,edgeLabelSize:14,edgeLabelWeight:`normal`,edgeLabelColor:{attribute:`color`},stagePadding:30,defaultDrawEdgeLabel:Fn,defaultDrawNodeLabel:In,defaultDrawNodeHover:Ln,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:`screen`,autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},zr={circle:Wn},Br={arrow:cr,line:mr};function Vr(e){if(typeof e.labelDensity!=`number`||e.labelDensity<0)throw Error("Settings: invalid `labelDensity`. Expecting a positive number.");var t=e.minCameraRatio,n=e.maxCameraRatio;if(typeof t==`number`&&typeof n==`number`&&n<t)throw Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function Hr(e){var t=Lr({},Rr,e);return t.nodeProgramClasses=Lr({},zr,t.nodeProgramClasses),t.edgeProgramClasses=Lr({},Br,t.edgeProgramClasses),t}var Ur=1.5,Wr=function(e){function t(){var e;return Bt(this,t),e=qt(this,t),U(e,`x`,.5),U(e,`y`,.5),U(e,`angle`,0),U(e,`ratio`,1),U(e,`minRatio`,null),U(e,`maxRatio`,null),U(e,`enabledZooming`,!0),U(e,`enabledPanning`,!0),U(e,`enabledRotation`,!0),U(e,`clean`,null),U(e,`nextFrame`,null),U(e,`previousState`,null),U(e,`enabled`,!0),e.previousState=e.getState(),e}return Yt(t,e),Ht(t,[{key:`enable`,value:function(){return this.enabled=!0,this}},{key:`disable`,value:function(){return this.enabled=!1,this}},{key:`getState`,value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:`hasState`,value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:`getPreviousState`,value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:`getBoundedRatio`,value:function(e){var t=e;return typeof this.minRatio==`number`&&(t=Math.max(t,this.minRatio)),typeof this.maxRatio==`number`&&(t=Math.min(t,this.maxRatio)),t}},{key:`validateState`,value:function(e){var t={};return this.enabledPanning&&typeof e.x==`number`&&(t.x=e.x),this.enabledPanning&&typeof e.y==`number`&&(t.y=e.y),this.enabledZooming&&typeof e.ratio==`number`&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle==`number`&&(t.angle=e.angle),this.clean?this.clean(W(W({},this.getState()),t)):t}},{key:`isAnimated`,value:function(){return!!this.nextFrame}},{key:`setState`,value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return typeof t.x==`number`&&(this.x=t.x),typeof t.y==`number`&&(this.y=t.y),typeof t.ratio==`number`&&(this.ratio=t.ratio),typeof t.angle==`number`&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit(`updated`,this.getState()),this}},{key:`updateState`,value:function(e){return this.setState(e(this.getState())),this}},{key:`animate`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!r)return new Promise(function(r){return t.animate(e,n,r)});if(this.enabled){var i=W(W({},yr),n),a=this.validateState(e),o=typeof i.easing==`function`?i.easing:vr[i.easing],s=Date.now(),c=this.getState(),l=function(){var e=(Date.now()-s)/i.duration;if(e>=1){t.nextFrame=null,t.setState(a),t.animationCallback&&=(t.animationCallback.call(null),void 0);return}var n=o(e),r={};typeof a.x==`number`&&(r.x=c.x+(a.x-c.x)*n),typeof a.y==`number`&&(r.y=c.y+(a.y-c.y)*n),t.enabledRotation&&typeof a.angle==`number`&&(r.angle=c.angle+(a.angle-c.angle)*n),typeof a.ratio==`number`&&(r.ratio=c.ratio+(a.ratio-c.ratio)*n),t.setState(r),t.nextFrame=requestAnimationFrame(l)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(l)):l(),this.animationCallback=r}}},{key:`animatedZoom`,value:function(e){return e?typeof e==`number`?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||Ur)},e):this.animate({ratio:this.ratio/Ur})}},{key:`animatedUnzoom`,value:function(e){return e?typeof e==`number`?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||Ur)},e):this.animate({ratio:this.ratio*Ur})}},{key:`animatedReset`,value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:`copy`,value:function(){return t.from(this.getState())}}],[{key:`from`,value:function(e){return new t().setState(e)}}])}(hr);function Gr(e,t){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Kr(e,t){var n=W(W({},Gr(e,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0},original:e});return n}function qr(e){var t=`x`in e?e:W(W({},e.touches[0]||e.previousTouches[0]),{},{original:e.original,sigmaDefaultPrevented:e.sigmaDefaultPrevented,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0,t.sigmaDefaultPrevented=!0}});return t}function Jr(e,t){return W(W({},Kr(e,t)),{},{delta:Qr(e)})}var Yr=2;function Xr(e){for(var t=[],n=0,r=Math.min(e.length,Yr);n<r;n++)t.push(e[n]);return t}function Zr(e,t,n){var r={touches:Xr(e.touches).map(function(e){return Gr(e,n)}),previousTouches:t.map(function(e){return Gr(e,n)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){r.sigmaDefaultPrevented=!0},original:e};return r}function Qr(e){if(e.deltaY!==void 0)return e.deltaY*-3/360;if(e.detail!==void 0)return e.detail/-9;throw Error(`Captor: could not extract delta from event.`)}var $r=function(e){function t(e,n){var r;return Bt(this,t),r=qt(this,t),r.container=e,r.renderer=n,r}return Yt(t,e),Ht(t)}(hr),ei=[`doubleClickTimeout`,`doubleClickZoomingDuration`,`doubleClickZoomingRatio`,`dragTimeout`,`draggedEventsTolerance`,`inertiaDuration`,`inertiaRatio`,`zoomDuration`,`zoomingRatio`].reduce(function(e,t){return W(W({},e),{},U({},t,Rr[t]))},{}),ti=function(e){function t(e,n){var r;return Bt(this,t),r=qt(this,t,[e,n]),U(r,`enabled`,!0),U(r,`draggedEvents`,0),U(r,`downStartTime`,null),U(r,`lastMouseX`,null),U(r,`lastMouseY`,null),U(r,`isMouseDown`,!1),U(r,`isMoving`,!1),U(r,`movingTimeout`,null),U(r,`startCameraState`,null),U(r,`clicks`,0),U(r,`doubleClickTimeout`,null),U(r,`currentWheelDirection`,0),U(r,`settings`,ei),r.handleClick=r.handleClick.bind(r),r.handleRightClick=r.handleRightClick.bind(r),r.handleDown=r.handleDown.bind(r),r.handleUp=r.handleUp.bind(r),r.handleMove=r.handleMove.bind(r),r.handleWheel=r.handleWheel.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleEnter=r.handleEnter.bind(r),e.addEventListener(`click`,r.handleClick,{capture:!1}),e.addEventListener(`contextmenu`,r.handleRightClick,{capture:!1}),e.addEventListener(`mousedown`,r.handleDown,{capture:!1}),e.addEventListener(`wheel`,r.handleWheel,{capture:!1}),e.addEventListener(`mouseleave`,r.handleLeave,{capture:!1}),e.addEventListener(`mouseenter`,r.handleEnter,{capture:!1}),document.addEventListener(`mousemove`,r.handleMove,{capture:!1}),document.addEventListener(`mouseup`,r.handleUp,{capture:!1}),r}return Yt(t,e),Ht(t,[{key:`kill`,value:function(){var e=this.container;e.removeEventListener(`click`,this.handleClick),e.removeEventListener(`contextmenu`,this.handleRightClick),e.removeEventListener(`mousedown`,this.handleDown),e.removeEventListener(`wheel`,this.handleWheel),e.removeEventListener(`mouseleave`,this.handleLeave),e.removeEventListener(`mouseenter`,this.handleEnter),document.removeEventListener(`mousemove`,this.handleMove),document.removeEventListener(`mouseup`,this.handleUp)}},{key:`handleClick`,value:function(e){var t=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout==`number`&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit(`click`,Kr(e,this.container))}}},{key:`handleRightClick`,value:function(e){this.enabled&&this.emit(`rightClick`,Kr(e,this.container))}},{key:`handleDoubleClick`,value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=Kr(e,this.container);if(this.emit(`doubleClick`,t),!t.sigmaDefaultPrevented){var n=this.renderer.getCamera(),r=n.getBoundedRatio(n.getState().ratio/this.settings.doubleClickZoomingRatio);n.animate(this.renderer.getViewportZoomedState(Gr(e,this.container),r),{easing:`quadraticInOut`,duration:this.settings.doubleClickZoomingDuration})}}}},{key:`handleDown`,value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var t=Gr(e,this.container),n=t.x,r=t.y;this.lastMouseX=n,this.lastMouseY=r,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit(`mousedown`,Kr(e,this.container))}}},{key:`handleUp`,value:function(e){var t=this;if(!(!this.enabled||!this.isMouseDown)){var n=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout==`number`&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=Gr(e,this.container),i=r.x,a=r.y,o=n.getState(),s=n.getPreviousState()||{x:0,y:0};this.isMoving?n.animate({x:o.x+this.settings.inertiaRatio*(o.x-s.x),y:o.y+this.settings.inertiaRatio*(o.y-s.y)},{duration:this.settings.inertiaDuration,easing:`quadraticOut`}):(this.lastMouseX!==i||this.lastMouseY!==a)&&n.setState({x:o.x,y:o.y}),this.isMoving=!1,setTimeout(function(){var e=t.draggedEvents>0;t.draggedEvents=0,e&&t.renderer.getSetting(`hideEdgesOnMove`)&&t.renderer.refresh()},0),this.emit(`mouseup`,Kr(e,this.container))}}},{key:`handleMove`,value:function(e){var t=this;if(this.enabled){var n=Kr(e,this.container);if(this.emit(`mousemovebody`,n),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit(`mousemove`,n),!n.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout==`number`&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},this.settings.dragTimeout);var r=this.renderer.getCamera(),i=Gr(e,this.container),a=i.x,o=i.y,s=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),c=this.renderer.viewportToFramedGraph({x:a,y:o}),l=s.x-c.x,u=s.y-c.y,d=r.getState(),f=d.x+l,p=d.y+u;r.setState({x:f,y:p}),this.lastMouseX=a,this.lastMouseY=o,e.preventDefault(),e.stopPropagation()}}}},{key:`handleLeave`,value:function(e){this.emit(`mouseleave`,Kr(e,this.container))}},{key:`handleEnter`,value:function(e){this.emit(`mouseenter`,Kr(e,this.container))}},{key:`handleWheel`,value:function(e){var t=this,n=this.renderer.getCamera();if(!(!this.enabled||!n.enabledZooming)){var r=Qr(e);if(r){var i=Jr(e,this.container);if(this.emit(`wheel`,i),i.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var a=n.getState().ratio,o=r>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,s=n.getBoundedRatio(a*o),c=r>0?1:-1,l=Date.now();a!==s&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===c&&this.lastWheelTriggerTime&&l-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(n.animate(this.renderer.getViewportZoomedState(Gr(e,this.container),s),{easing:`quadraticOut`,duration:this.settings.zoomDuration},function(){t.currentWheelDirection=0}),this.currentWheelDirection=c,this.lastWheelTriggerTime=l))}}}},{key:`setSettings`,value:function(e){this.settings=e}}])}($r),ni=[`dragTimeout`,`inertiaDuration`,`inertiaRatio`,`doubleClickTimeout`,`doubleClickZoomingRatio`,`doubleClickZoomingDuration`,`tapMoveTolerance`].reduce(function(e,t){return W(W({},e),{},U({},t,Rr[t]))},{}),ri=function(e){function t(e,n){var r;return Bt(this,t),r=qt(this,t,[e,n]),U(r,`enabled`,!0),U(r,`isMoving`,!1),U(r,`hasMoved`,!1),U(r,`touchMode`,0),U(r,`startTouchesPositions`,[]),U(r,`lastTouches`,[]),U(r,`lastTap`,null),U(r,`settings`,ni),r.handleStart=r.handleStart.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleMove=r.handleMove.bind(r),e.addEventListener(`touchstart`,r.handleStart,{capture:!1}),e.addEventListener(`touchcancel`,r.handleLeave,{capture:!1}),document.addEventListener(`touchend`,r.handleLeave,{capture:!1,passive:!1}),document.addEventListener(`touchmove`,r.handleMove,{capture:!1,passive:!1}),r}return Yt(t,e),Ht(t,[{key:`kill`,value:function(){var e=this.container;e.removeEventListener(`touchstart`,this.handleStart),e.removeEventListener(`touchcancel`,this.handleLeave),document.removeEventListener(`touchend`,this.handleLeave),document.removeEventListener(`touchmove`,this.handleMove)}},{key:`getDimensions`,value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:`handleStart`,value:function(e){var t=this;if(this.enabled){e.preventDefault();var n=Xr(e.touches);if(this.touchMode=n.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=n.map(function(e){return Gr(e,t.container)}),this.touchMode===2){var r=tn(this.startTouchesPositions,2),i=r[0],a=i.x,o=i.y,s=r[1],c=s.x,l=s.y;this.startTouchesAngle=Math.atan2(l-o,c-a),this.startTouchesDistance=Math.sqrt((c-a)**2+(l-o)**2)}this.emit(`touchdown`,Zr(e,this.lastTouches,this.container)),this.lastTouches=n,this.lastTouchesPositions=this.startTouchesPositions}}},{key:`handleLeave`,value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),n=t.getState(),r=t.getPreviousState()||{x:0,y:0};t.animate({x:n.x+this.settings.inertiaRatio*(n.x-r.x),y:n.y+this.settings.inertiaRatio*(n.y-r.y)},{duration:this.settings.inertiaDuration,easing:`quadraticOut`})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0;break}if(this.emit(`touchup`,Zr(e,this.lastTouches,this.container)),!e.touches.length){var i=Gr(this.lastTouches[0],this.container),a=this.startTouchesPositions[0],o=(i.x-a.x)**2+(i.y-a.y)**2;if(!e.touches.length&&o<this.settings.tapMoveTolerance**2)if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var s=Zr(e,this.lastTouches,this.container);if(this.emit(`doubletap`,s),this.lastTap=null,!s.sigmaDefaultPrevented){var c=this.renderer.getCamera(),l=c.getBoundedRatio(c.getState().ratio/this.settings.doubleClickZoomingRatio);c.animate(this.renderer.getViewportZoomedState(i,l),{easing:`quadraticInOut`,duration:this.settings.doubleClickZoomingDuration})}}else{var u=Zr(e,this.lastTouches,this.container);this.emit(`tap`,u),this.lastTap={time:Date.now(),position:u.touches[0]||u.previousTouches[0]}}}this.lastTouches=Xr(e.touches),this.startTouchesPositions=[]}}},{key:`handleMove`,value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var n=Xr(e.touches),r=n.map(function(e){return Gr(e,t.container)}),i=this.lastTouches;this.lastTouches=n,this.lastTouchesPositions=r;var a=Zr(e,i,this.container);if(this.emit(`touchmove`,a),!a.sigmaDefaultPrevented&&(this.hasMoved||=r.some(function(e,n){var r=t.startTouchesPositions[n];return r&&(e.x!==r.x||e.y!==r.y)}),this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.isMoving=!1},this.settings.dragTimeout);var o=this.renderer.getCamera(),s=this.startCameraState,c=this.renderer.getSetting(`stagePadding`);switch(this.touchMode){case 1:var l=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),u=l.x,d=l.y,f=this.renderer.viewportToFramedGraph(r[0]),p=f.x,m=f.y;o.setState({x:s.x+u-p,y:s.y+d-m});break;case 2:var h={x:.5,y:.5,angle:0,ratio:1},g=r[0],_=g.x,v=g.y,y=r[1],b=y.x,x=y.y,S=Math.atan2(x-v,b-_)-this.startTouchesAngle,C=Math.hypot(x-v,b-_)/this.startTouchesDistance,w=o.getBoundedRatio(s.ratio/C);h.ratio=w,h.angle=s.angle+S;var ee=this.getDimensions(),T=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:s}),E=Math.min(ee.width,ee.height)-2*c,te=E/ee.width,ne=E/ee.height,re=w/E,D=_-E/2/te,O=v-E/2/ne,k=[D*Math.cos(-h.angle)-O*Math.sin(-h.angle),O*Math.cos(-h.angle)+D*Math.sin(-h.angle)];D=k[0],O=k[1],h.x=T.x-D*re,h.y=T.y+O*re,o.setState(h);break}}}}},{key:`setSettings`,value:function(e){this.settings=e}}])}($r);function ii(e){if(Array.isArray(e))return Qt(e)}function ai(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function oi(){throw TypeError(`Invalid attempt to spread non-iterable instance.
320
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function si(e){return ii(e)||ai(e)||$t(e)||oi()}function ci(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function li(e,t){if(e==null)return{};var n,r,i=ci(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var ui=function(){function e(t,n){Bt(this,e),this.key=t,this.size=n}return Ht(e,null,[{key:`compare`,value:function(e,t){return e.size>t.size?-1:e.size<t.size||e.key>t.key?1:-1}}])}(),di=function(){function e(){Bt(this,e),U(this,`width`,0),U(this,`height`,0),U(this,`cellSize`,0),U(this,`columns`,0),U(this,`rows`,0),U(this,`cells`,{})}return Ht(e,[{key:`resizeAndClear`,value:function(e,t){this.width=e.width,this.height=e.height,this.cellSize=t,this.columns=Math.ceil(e.width/t),this.rows=Math.ceil(e.height/t),this.cells={}}},{key:`getIndex`,value:function(e){var t=Math.floor(e.x/this.cellSize);return Math.floor(e.y/this.cellSize)*this.columns+t}},{key:`add`,value:function(e,t,n){var r=new ui(e,t),i=this.getIndex(n),a=this.cells[i];a||(a=[],this.cells[i]=a),a.push(r)}},{key:`organize`,value:function(){for(var e in this.cells)this.cells[e].sort(ui.compare)}},{key:`getLabelsToDisplay`,value:function(e,t){var n=this.cellSize*this.cellSize,r=n/e/e*t/n,i=Math.ceil(r),a=[];for(var o in this.cells)for(var s=this.cells[o],c=0;c<Math.min(i,s.length);c++)a.push(s[c].key);return a}}])}();function fi(e){var t=e.graph,n=e.hoveredNode,r=e.highlightedNodes,i=e.displayedNodeLabels,a=[];return t.forEachEdge(function(e,t,o,s){(o===n||s===n||r.has(o)||r.has(s)||i.has(o)&&i.has(s))&&a.push(e)}),a}var pi=150,mi=50,hi=Object.prototype.hasOwnProperty;function gi(e,t,n){if(!hi.call(n,`x`)||!hi.call(n,`y`))throw Error(`Sigma: could not find a valid position (x, y) for node "${t}". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?`);return n.color||=e.defaultNodeColor,!n.label&&n.label!==``&&(n.label=null),n.label!==void 0&&n.label!==null?n.label=``+n.label:n.label=null,n.size||=2,hi.call(n,`hidden`)||(n.hidden=!1),hi.call(n,`highlighted`)||(n.highlighted=!1),hi.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultNodeType),n.zIndex||=0,n}function _i(e,t,n){return n.color||=e.defaultEdgeColor,n.label||=``,n.size||=.5,hi.call(n,`hidden`)||(n.hidden=!1),hi.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultEdgeType),n.zIndex||=0,n}var vi=function(e){function t(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Bt(this,t),r=qt(this,t),U(r,`elements`,{}),U(r,`canvasContexts`,{}),U(r,`webGLContexts`,{}),U(r,`pickingLayers`,new Set),U(r,`textures`,{}),U(r,`frameBuffers`,{}),U(r,`activeListeners`,{}),U(r,`labelGrid`,new di),U(r,`nodeDataCache`,{}),U(r,`edgeDataCache`,{}),U(r,`nodeProgramIndex`,{}),U(r,`edgeProgramIndex`,{}),U(r,`nodesWithForcedLabels`,new Set),U(r,`edgesWithForcedLabels`,new Set),U(r,`nodeExtent`,{x:[0,1],y:[0,1]}),U(r,`nodeZExtent`,[1/0,-1/0]),U(r,`edgeZExtent`,[1/0,-1/0]),U(r,`matrix`,br()),U(r,`invMatrix`,br()),U(r,`correctionRatio`,1),U(r,`customBBox`,null),U(r,`normalizationFunction`,Pr({x:[0,1],y:[0,1]})),U(r,`graphToViewportRatio`,1),U(r,`itemIDsIndex`,{}),U(r,`nodeIndices`,{}),U(r,`edgeIndices`,{}),U(r,`width`,0),U(r,`height`,0),U(r,`pixelRatio`,Mr()),U(r,`pickingDownSizingRatio`,2*r.pixelRatio),U(r,`displayedNodeLabels`,new Set),U(r,`displayedEdgeLabels`,new Set),U(r,`highlightedNodes`,new Set),U(r,`hoveredNode`,null),U(r,`hoveredEdge`,null),U(r,`renderFrame`,null),U(r,`renderHighlightedNodesFrame`,null),U(r,`needToProcess`,!1),U(r,`checkEdgesEventsFrame`,null),U(r,`nodePrograms`,{}),U(r,`nodeHoverPrograms`,{}),U(r,`edgePrograms`,{}),r.settings=Hr(i),Vr(r.settings),Ar(e),!(n instanceof HTMLElement))throw Error(`Sigma: container should be an html element.`);for(var a in r.graph=e,r.container=n,r.createWebGLContext(`edges`,{picking:i.enableEdgeEvents}),r.createCanvasContext(`edgeLabels`),r.createWebGLContext(`nodes`,{picking:!0}),r.createCanvasContext(`labels`),r.createCanvasContext(`hovers`),r.createWebGLContext(`hoverNodes`),r.createCanvasContext(`mouse`,{style:{touchAction:`none`,userSelect:`none`}}),r.resize(),r.settings.nodeProgramClasses)r.registerNodeProgram(a,r.settings.nodeProgramClasses[a],r.settings.nodeHoverProgramClasses[a]);for(var o in r.settings.edgeProgramClasses)r.registerEdgeProgram(o,r.settings.edgeProgramClasses[o]);return r.camera=new Wr,r.bindCameraHandlers(),r.mouseCaptor=new ti(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new ri(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return Yt(t,e),Ht(t,[{key:`registerNodeProgram`,value:function(e,t,n){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(n||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:`registerEdgeProgram`,value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:`unregisterNodeProgram`,value:function(e){if(this.nodePrograms[e]){var t=this.nodePrograms,n=t[e],r=li(t,[e].map(zt));n.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[e]){var i=this.nodeHoverPrograms,a=i[e],o=li(i,[e].map(zt));a.kill(),this.nodePrograms=o}return this}},{key:`unregisterEdgeProgram`,value:function(e){if(this.edgePrograms[e]){var t=this.edgePrograms,n=t[e],r=li(t,[e].map(zt));n.kill(),this.edgePrograms=r}return this}},{key:`resetWebGLTexture`,value:function(e){var t=this.webGLContexts[e],n=this.frameBuffers[e],r=this.textures[e];r&&t.deleteTexture(r);var i=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,n),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),this.textures[e]=i,this}},{key:`bindCameraHandlers`,value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on(`updated`,this.activeListeners.camera),this}},{key:`unbindCameraHandlers`,value:function(){return this.camera.removeListener(`updated`,this.activeListeners.camera),this}},{key:`getNodeAtPosition`,value:function(e){var t=e.x,n=e.y,r=_n(this.webGLContexts.nodes,this.frameBuffers.nodes,t,n,this.pixelRatio,this.pickingDownSizingRatio),i=gn.apply(void 0,si(r)),a=this.itemIDsIndex[i];return a&&a.type===`node`?a.id:null}},{key:`bindEventHandlers`,value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener(`resize`,this.activeListeners.handleResize),this.activeListeners.handleMove=function(t){var n=qr(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}},i=e.getNodeAtPosition(n);if(i&&e.hoveredNode!==i&&!e.nodeDataCache[i].hidden){e.hoveredNode&&e.emit(`leaveNode`,W(W({},r),{},{node:e.hoveredNode})),e.hoveredNode=i,e.emit(`enterNode`,W(W({},r),{},{node:i})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(n)!==e.hoveredNode){var a=e.hoveredNode;e.hoveredNode=null,e.emit(`leaveNode`,W(W({},r),{},{node:a})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var o=e.hoveredNode?null:e.getEdgeAtPoint(r.event.x,r.event.y);o!==e.hoveredEdge&&(e.hoveredEdge&&e.emit(`leaveEdge`,W(W({},r),{},{edge:e.hoveredEdge})),o&&e.emit(`enterEdge`,W(W({},r),{},{edge:o})),e.hoveredEdge=o)}},this.activeListeners.handleMoveBody=function(t){var n=qr(t);e.emit(`moveBody`,{event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(t){var n=qr(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.hoveredNode&&(e.emit(`leaveNode`,W(W({},r),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit(`leaveEdge`,W(W({},r),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit(`leaveStage`,W({},r))},this.activeListeners.handleEnter=function(t){var n=qr(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.emit(`enterStage`,W({},r))};var t=function(t){return function(n){var r=qr(n),i={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}},a=e.getNodeAtPosition(r);if(a)return e.emit(`${t}Node`,W(W({},i),{},{node:a}));if(e.settings.enableEdgeEvents){var o=e.getEdgeAtPoint(r.x,r.y);if(o)return e.emit(`${t}Edge`,W(W({},i),{},{edge:o}))}return e.emit(`${t}Stage`,i)}};return this.activeListeners.handleClick=t(`click`),this.activeListeners.handleRightClick=t(`rightClick`),this.activeListeners.handleDoubleClick=t(`doubleClick`),this.activeListeners.handleWheel=t(`wheel`),this.activeListeners.handleDown=t(`down`),this.activeListeners.handleUp=t(`up`),this.mouseCaptor.on(`mousemove`,this.activeListeners.handleMove),this.mouseCaptor.on(`mousemovebody`,this.activeListeners.handleMoveBody),this.mouseCaptor.on(`click`,this.activeListeners.handleClick),this.mouseCaptor.on(`rightClick`,this.activeListeners.handleRightClick),this.mouseCaptor.on(`doubleClick`,this.activeListeners.handleDoubleClick),this.mouseCaptor.on(`wheel`,this.activeListeners.handleWheel),this.mouseCaptor.on(`mousedown`,this.activeListeners.handleDown),this.mouseCaptor.on(`mouseup`,this.activeListeners.handleUp),this.mouseCaptor.on(`mouseleave`,this.activeListeners.handleLeave),this.mouseCaptor.on(`mouseenter`,this.activeListeners.handleEnter),this.touchCaptor.on(`touchdown`,this.activeListeners.handleDown),this.touchCaptor.on(`touchdown`,this.activeListeners.handleMove),this.touchCaptor.on(`touchup`,this.activeListeners.handleUp),this.touchCaptor.on(`touchmove`,this.activeListeners.handleMove),this.touchCaptor.on(`tap`,this.activeListeners.handleClick),this.touchCaptor.on(`doubletap`,this.activeListeners.handleDoubleClick),this.touchCaptor.on(`touchmove`,this.activeListeners.handleMoveBody),this}},{key:`bindGraphHandlers`,value:function(){var e=this,t=this.graph,n=new Set([`x`,`y`,`zIndex`,`type`]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(r){var i=r.hints?.attributes;e.graph.forEachNode(function(t){return e.updateNode(t)});var a=!i||i.some(function(e){return n.has(e)});e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!a,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(n){var r=n.hints?.attributes;e.graph.forEachEdge(function(t){return e.updateEdge(t)});var i=r&&[`zIndex`,`type`].some(function(e){return r?.includes(e)});e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!i,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(t){var n=t.key;e.addNode(n),e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(t){var n=t.key;e.removeNode(n),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(t){var n=t.key;e.addEdge(n),e.refresh({partialGraph:{edges:[n]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{edges:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(t){var n=t.key;e.removeEdge(n),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on(`nodeAdded`,this.activeListeners.addNodeGraphUpdate),t.on(`nodeDropped`,this.activeListeners.dropNodeGraphUpdate),t.on(`nodeAttributesUpdated`,this.activeListeners.updateNodeGraphUpdate),t.on(`eachNodeAttributesUpdated`,this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on(`edgeAdded`,this.activeListeners.addEdgeGraphUpdate),t.on(`edgeDropped`,this.activeListeners.dropEdgeGraphUpdate),t.on(`edgeAttributesUpdated`,this.activeListeners.updateEdgeGraphUpdate),t.on(`eachEdgeAttributesUpdated`,this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on(`edgesCleared`,this.activeListeners.clearEdgesGraphUpdate),t.on(`cleared`,this.activeListeners.clearGraphUpdate),this}},{key:`unbindGraphHandlers`,value:function(){var e=this.graph;e.removeListener(`nodeAdded`,this.activeListeners.addNodeGraphUpdate),e.removeListener(`nodeDropped`,this.activeListeners.dropNodeGraphUpdate),e.removeListener(`nodeAttributesUpdated`,this.activeListeners.updateNodeGraphUpdate),e.removeListener(`eachNodeAttributesUpdated`,this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener(`edgeAdded`,this.activeListeners.addEdgeGraphUpdate),e.removeListener(`edgeDropped`,this.activeListeners.dropEdgeGraphUpdate),e.removeListener(`edgeAttributesUpdated`,this.activeListeners.updateEdgeGraphUpdate),e.removeListener(`eachEdgeAttributesUpdated`,this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener(`edgesCleared`,this.activeListeners.clearEdgesGraphUpdate),e.removeListener(`cleared`,this.activeListeners.clearGraphUpdate)}},{key:`getEdgeAtPoint`,value:function(e,t){var n=_n(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),r=gn.apply(void 0,si(n)),i=this.itemIDsIndex[r];return i&&i.type===`edge`?i.id:null}},{key:`process`,value:function(){var e=this;this.emit(`beforeProcess`);var t=this.graph,n=this.settings,r=this.getDimensions();if(this.nodeExtent=kr(this.graph),!this.settings.autoRescale){var i=r.width,a=r.height,o=this.nodeExtent,s=o.x,c=o.y;this.nodeExtent={x:[(s[0]+s[1])/2-i/2,(s[0]+s[1])/2+i/2],y:[(c[0]+c[1])/2-a/2,(c[0]+c[1])/2+a/2]}}this.normalizationFunction=Pr(this.customBBox||this.nodeExtent);var l=Dr(new Wr().getState(),r,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(r,n.labelGridCellSize);for(var u={},d={},f={},p={},m=1,h=t.nodes(),g=0,_=h.length;g<_;g++){var v=h[g],y=this.nodeDataCache[v],b=t.getNodeAttributes(v);y.x=b.x,y.y=b.y,this.normalizationFunction.applyTo(y),typeof y.label==`string`&&!y.hidden&&this.labelGrid.add(v,y.size,this.framedGraphToViewport(y,{matrix:l})),u[y.type]=(u[y.type]||0)+1}for(var x in this.labelGrid.organize(),this.nodePrograms){if(!hi.call(this.nodePrograms,x))throw Error(`Sigma: could not find a suitable program for node type "${x}"!`);this.nodePrograms[x].reallocate(u[x]||0),u[x]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(h=Nr(this.nodeZExtent,function(t){return e.nodeDataCache[t].zIndex},h));for(var S=0,C=h.length;S<C;S++){var w=h[S];d[w]=m,p[d[w]]={type:`node`,id:w},m++;var ee=this.nodeDataCache[w];this.addNodeToProgram(w,d[w],u[ee.type]++)}for(var T={},E=t.edges(),te=0,ne=E.length;te<ne;te++){var re=E[te],D=this.edgeDataCache[re];T[D.type]=(T[D.type]||0)+1}for(var O in this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(E=Nr(this.edgeZExtent,function(t){return e.edgeDataCache[t].zIndex},E)),this.edgePrograms){if(!hi.call(this.edgePrograms,O))throw Error(`Sigma: could not find a suitable program for edge type "${O}"!`);this.edgePrograms[O].reallocate(T[O]||0),T[O]=0}for(var k=0,A=E.length;k<A;k++){var j=E[k];f[j]=m,p[f[j]]={type:`edge`,id:j},m++;var M=this.edgeDataCache[j];this.addEdgeToProgram(j,f[j],T[M.type]++)}return this.itemIDsIndex=p,this.nodeIndices=d,this.edgeIndices=f,this.emit(`afterProcess`),this}},{key:`handleSettingsUpdate`,value:function(e){var t=this,n=this.settings;if(this.camera.minRatio=n.minCameraRatio,this.camera.maxRatio=n.maxCameraRatio,this.camera.enabledZooming=n.enableCameraZooming,this.camera.enabledPanning=n.enableCameraPanning,this.camera.enabledRotation=n.enableCameraRotation,n.cameraPanBoundaries?this.camera.clean=function(e){return t.cleanCameraState(e,n.cameraPanBoundaries&&Fr(n.cameraPanBoundaries)===`object`?n.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==n.edgeProgramClasses){for(var r in n.edgeProgramClasses)n.edgeProgramClasses[r]!==e.edgeProgramClasses[r]&&this.registerEdgeProgram(r,n.edgeProgramClasses[r]);for(var i in e.edgeProgramClasses)n.edgeProgramClasses[i]||this.unregisterEdgeProgram(i)}if(e.nodeProgramClasses!==n.nodeProgramClasses||e.nodeHoverProgramClasses!==n.nodeHoverProgramClasses){for(var a in n.nodeProgramClasses)(n.nodeProgramClasses[a]!==e.nodeProgramClasses[a]||n.nodeHoverProgramClasses[a]!==e.nodeHoverProgramClasses[a])&&this.registerNodeProgram(a,n.nodeProgramClasses[a],n.nodeHoverProgramClasses[a]);for(var o in e.nodeProgramClasses)n.nodeProgramClasses[o]||this.unregisterNodeProgram(o)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:`cleanCameraState`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.tolerance,r=n===void 0?0:n,i=t.boundaries,a=W({},e),o=i||this.nodeExtent,s=tn(o.x,2),c=s[0],l=s[1],u=tn(o.y,2),d=u[0],f=u[1],p=[this.graphToViewport({x:c,y:d},{cameraState:e}),this.graphToViewport({x:l,y:d},{cameraState:e}),this.graphToViewport({x:c,y:f},{cameraState:e}),this.graphToViewport({x:l,y:f},{cameraState:e})],m=1/0,h=-1/0,g=1/0,_=-1/0;p.forEach(function(e){var t=e.x,n=e.y;m=Math.min(m,t),h=Math.max(h,t),g=Math.min(g,n),_=Math.max(_,n)});var v=h-m,y=_-g,b=this.getDimensions(),x=b.width,S=b.height,C=0,w=0;if(v>=x?h<x-r?C=h-(x-r):m>r&&(C=m-r):h>x+r?C=h-(x+r):m<-r&&(C=m+r),y>=S?_<S-r?w=_-(S-r):g>r&&(w=g-r):_>S+r?w=_-(S+r):g<-r&&(w=g+r),C||w){var ee=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),T=this.viewportToFramedGraph({x:C,y:w},{cameraState:e});C=T.x-ee.x,w=T.y-ee.y,a.x+=C,a.y+=w}return a}},{key:`renderLabels`,value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);Ir(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var n=this.canvasContexts.labels,r=0,i=t.length;r<i;r++){var a=t[r],o=this.nodeDataCache[a];if(!this.displayedNodeLabels.has(a)&&!o.hidden){var s=this.framedGraphToViewport(o),c=s.x,l=s.y,u=this.scaleSize(o.size);if(!(!o.forceLabel&&u<this.settings.labelRenderedSizeThreshold)&&!(c<-pi||c>this.width+pi||l<-mi||l>this.height+mi)){this.displayedNodeLabels.add(a);var d=this.settings.defaultDrawNodeLabel;(this.nodePrograms[o.type]?.drawLabel||d)(n,W(W({key:a},o),{},{size:u,x:c,y:l}),this.settings)}}}return this}},{key:`renderEdgeLabels`,value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t=fi({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});Ir(t,this.edgesWithForcedLabels);for(var n=new Set,r=0,i=t.length;r<i;r++){var a=t[r],o=this.graph.extremities(a),s=this.nodeDataCache[o[0]],c=this.nodeDataCache[o[1]],l=this.edgeDataCache[a];if(!n.has(a)&&!(l.hidden||s.hidden||c.hidden)){var u=this.settings.defaultDrawEdgeLabel;(this.edgePrograms[l.type]?.drawLabel||u)(e,W(W({key:a},l),{},{size:this.scaleSize(l.size)}),W(W(W({key:o[0]},s),this.framedGraphToViewport(s)),{},{size:this.scaleSize(s.size)}),W(W(W({key:o[1]},c),this.framedGraphToViewport(c)),{},{size:this.scaleSize(c.size)}),this.settings),n.add(a)}}return this.displayedEdgeLabels=n,this}},{key:`renderHighlightedNodes`,value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var n=function(n){var r=e.nodeDataCache[n],i=e.framedGraphToViewport(r),a=i.x,o=i.y,s=e.scaleSize(r.size),c=e.settings.defaultDrawNodeHover;(e.nodePrograms[r.type]?.drawHover||c)(t,W(W({key:n},r),{},{size:s,x:a,y:o}),e.settings)},r=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&r.push(this.hoveredNode),this.highlightedNodes.forEach(function(t){t!==e.hoveredNode&&r.push(t)}),r.forEach(function(e){return n(e)});var i={};for(var a in r.forEach(function(t){var n=e.nodeDataCache[t].type;i[n]=(i[n]||0)+1}),this.nodeHoverPrograms)this.nodeHoverPrograms[a].reallocate(i[a]||0),i[a]=0;r.forEach(function(t){var n=e.nodeDataCache[t];e.nodeHoverPrograms[n.type].process(0,i[n.type]++,n)}),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var o=this.getRenderParams();for(var s in this.nodeHoverPrograms)this.nodeHoverPrograms[s].render(o)}},{key:`scheduleHighlightedNodesRender`,value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()}))}},{key:`render`,value:function(){var e=this;this.emit(`beforeRender`);var t=function(){return e.emit(`afterRender`),e};if(this.renderFrame&&=(cancelAnimationFrame(this.renderFrame),null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach(function(t){return e.resetWebGLTexture(t)}),!this.graph.order)return t();var n=this.mouseCaptor,r=this.camera.isAnimated()||n.isMoving||n.draggedEvents||n.currentWheelDirection,i=this.camera.getState(),a=this.getDimensions(),o=this.getGraphDimensions(),s=this.getStagePadding();this.matrix=Dr(i,a,o,s),this.invMatrix=Dr(i,a,o,s,!0),this.correctionRatio=Or(this.matrix,i,a),this.graphToViewportRatio=this.getGraphToViewportRatio();var c=this.getRenderParams();for(var l in this.nodePrograms)this.nodePrograms[l].render(c);if(!this.settings.hideEdgesOnMove||!r)for(var u in this.edgePrograms)this.edgePrograms[u].render(c);return this.settings.hideLabelsOnMove&&r?t():(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes(),t())}},{key:`addNode`,value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var n=gi(this.settings,e,t);this.nodeDataCache[e]=n,this.nodesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),n.highlighted&&!n.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(n.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=n.zIndex),n.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=n.zIndex))}},{key:`updateNode`,value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:`removeNode`,value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:`addEdge`,value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var n=_i(this.settings,e,t);this.edgeDataCache[e]=n,this.edgesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(n.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=n.zIndex),n.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=n.zIndex))}},{key:`updateEdge`,value:function(e){this.addEdge(e)}},{key:`removeEdge`,value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:`clearNodeIndices`,value:function(){this.labelGrid=new di,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:`clearEdgeIndices`,value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:`clearIndices`,value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:`clearNodeState`,value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:`clearEdgeState`,value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:`clearState`,value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:`addNodeToProgram`,value:function(e,t,n){var r=this.nodeDataCache[e],i=this.nodePrograms[r.type];if(!i)throw Error(`Sigma: could not find a suitable program for node type "${r.type}"!`);i.process(t,n,r),this.nodeProgramIndex[e]=n}},{key:`addEdgeToProgram`,value:function(e,t,n){var r=this.edgeDataCache[e],i=this.edgePrograms[r.type];if(!i)throw Error(`Sigma: could not find a suitable program for edge type "${r.type}"!`);var a=this.graph.extremities(e),o=this.nodeDataCache[a[0]],s=this.nodeDataCache[a[1]];i.process(t,n,o,s,r),this.edgeProgramIndex[e]=n}},{key:`getRenderParams`,value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:`getStagePadding`,value:function(){var e=this.settings,t=e.stagePadding;return e.autoRescale&&t||0}},{key:`createLayer`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw Error(`Sigma: a layer named "${e}" already exists`);var r=jr(t,{position:`absolute`},{class:`sigma-${e}`});return n.style&&Object.assign(r.style,n.style),this.elements[e]=r,`beforeLayer`in n&&n.beforeLayer?this.elements[n.beforeLayer].before(r):`afterLayer`in n&&n.afterLayer?this.elements[n.afterLayer].after(r):this.container.appendChild(r),r}},{key:`createCanvas`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,`canvas`,t)}},{key:`createCanvasContext`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.createCanvas(e,t),r={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=n.getContext(`2d`,r),this}},{key:`createWebGLContext`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t?.canvas||this.createCanvas(e,t);t.hidden&&n.remove();var r=W({preserveDrawingBuffer:!1,antialias:!1},t),i=n.getContext(`webgl2`,r);i||=n.getContext(`webgl`,r),i||=n.getContext(`experimental-webgl`,r);var a=i;if(this.webGLContexts[e]=a,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var o=a.createFramebuffer();if(!o)throw Error(`Sigma: cannot create a new frame buffer for layer ${e}`);this.frameBuffers[e]=o}return a}},{key:`killLayer`,value:function(e){var t=this.elements[e];if(!t)throw Error(`Sigma: cannot kill layer ${e}, which does not exist`);if(this.webGLContexts[e]){var n;(n=this.webGLContexts[e].getExtension(`WEBGL_lose_context`))==null||n.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return t.remove(),delete this.elements[e],this}},{key:`getCamera`,value:function(){return this.camera}},{key:`setCamera`,value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:`getContainer`,value:function(){return this.container}},{key:`getGraph`,value:function(){return this.graph}},{key:`setGraph`,value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:`getMouseCaptor`,value:function(){return this.mouseCaptor}},{key:`getTouchCaptor`,value:function(){return this.touchCaptor}},{key:`getDimensions`,value:function(){return{width:this.width,height:this.height}}},{key:`getGraphDimensions`,value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:`getNodeDisplayData`,value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:`getEdgeDisplayData`,value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:`getNodeDisplayedLabels`,value:function(){return new Set(this.displayedNodeLabels)}},{key:`getEdgeDisplayedLabels`,value:function(){return new Set(this.displayedEdgeLabels)}},{key:`getSettings`,value:function(){return W({},this.settings)}},{key:`getSetting`,value:function(e){return this.settings[e]}},{key:`setSetting`,value:function(e,t){var n=W({},this.settings);return this.settings[e]=t,Vr(this.settings),this.handleSettingsUpdate(n),this.scheduleRefresh(),this}},{key:`updateSetting`,value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:`setSettings`,value:function(e){var t=W({},this.settings);return this.settings=W(W({},this.settings),e),Vr(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:`resize`,value:function(e){var t=this.width,n=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=Mr(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw Error(`Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.`);if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw Error(`Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.`);if(!e&&t===this.width&&n===this.height)return this;for(var r in this.elements){var i=this.elements[r];i.style.width=this.width+`px`,i.style.height=this.height+`px`}for(var a in this.canvasContexts)this.elements[a].setAttribute(`width`,this.width*this.pixelRatio+`px`),this.elements[a].setAttribute(`height`,this.height*this.pixelRatio+`px`),this.pixelRatio!==1&&this.canvasContexts[a].scale(this.pixelRatio,this.pixelRatio);for(var o in this.webGLContexts){this.elements[o].setAttribute(`width`,this.width*this.pixelRatio+`px`),this.elements[o].setAttribute(`height`,this.height*this.pixelRatio+`px`);var s=this.webGLContexts[o];if(s.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(o)){var c=this.textures[o];c&&s.deleteTexture(c)}}return this.emit(`resize`),this}},{key:`clear`,value:function(){return this.emit(`beforeClear`),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit(`afterClear`),this}},{key:`refresh`,value:function(e){var t=this,n=e?.skipIndexation===void 0?!1:e?.skipIndexation,r=e?.schedule===void 0?!1:e.schedule,i=!e||!e.partialGraph;if(i)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(e){return t.addNode(e)}),this.graph.forEachEdge(function(e){return t.addEdge(e)});else{for(var a,o=e.partialGraph?.nodes||[],s=0,c=o?.length||0;s<c;s++){var l=o[s];if(this.updateNode(l),n){var u=this.nodeProgramIndex[l];if(u===void 0)throw Error(`Sigma: node "${l}" can't be repaint`);this.addNodeToProgram(l,this.nodeIndices[l],u)}}for(var d=(e==null||(a=e.partialGraph)==null?void 0:a.edges)||[],f=0,p=d.length;f<p;f++){var m=d[f];if(this.updateEdge(m),n){var h=this.edgeProgramIndex[m];if(h===void 0)throw Error(`Sigma: edge "${m}" can't be repaint`);this.addEdgeToProgram(m,this.edgeIndices[m],h)}}}return(i||!n)&&(this.needToProcess=!0),r?this.scheduleRender():this.render(),this}},{key:`scheduleRender`,value:function(){var e=this;return this.renderFrame||=requestAnimationFrame(function(){e.render()}),this}},{key:`scheduleRefresh`,value:function(e){return this.refresh(W(W({},e),{},{schedule:!0}))}},{key:`getViewportZoomedState`,value:function(e,t){var n=this.camera.getState(),r=n.ratio,i=n.angle,a=n.x,o=n.y,s=this.settings,c=s.minCameraRatio,l=s.maxCameraRatio;typeof l==`number`&&(t=Math.min(t,l)),typeof c==`number`&&(t=Math.max(t,c));var u=t/r,d={x:this.width/2,y:this.height/2},f=this.viewportToFramedGraph(e),p=this.viewportToFramedGraph(d);return{angle:i,x:(f.x-p.x)*(1-u)+a,y:(f.y-p.y)*(1-u)+o,ratio:t}}},{key:`viewRectangle`,value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),n=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-n.y}}},{key:`framedGraphToViewport`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,r=Tr(t.matrix?t.matrix:n?Dr(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,e);return{x:(1+r.x)*this.width/2,y:(1-r.y)*this.height/2}}},{key:`viewportToFramedGraph`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,r=Tr(t.matrix?t.matrix:n?Dr(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(r.x)&&(r.x=0),isNaN(r.y)&&(r.y=0),r}},{key:`viewportToGraph`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:`graphToViewport`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:`getGraphToViewportRatio`,value:function(){var e={x:0,y:0},t={x:1,y:1},n=Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),r=this.graphToViewport(e),i=this.graphToViewport(t);return Math.sqrt((r.x-i.x)**2+(r.y-i.y)**2)/n}},{key:`getBBox`,value:function(){return this.nodeExtent}},{key:`getCustomBBox`,value:function(){return this.customBBox}},{key:`setCustomBBox`,value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:`kill`,value:function(){this.emit(`kill`),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener(`resize`,this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&=(cancelAnimationFrame(this.renderFrame),null),this.renderHighlightedNodesFrame&&=(cancelAnimationFrame(this.renderHighlightedNodesFrame),null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.nodePrograms)this.nodePrograms[t].kill();for(var n in this.nodeHoverPrograms)this.nodeHoverPrograms[n].kill();for(var r in this.edgePrograms)this.edgePrograms[r].kill();for(var i in this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={},this.elements)this.killLayer(i);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:`scaleSize`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*(this.getSetting(`itemSizesReference`)===`positions`?t*this.graphToViewportRatio:1)}},{key:`getCanvases`,value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])}(hr),yi=o((e=>{function t(e){return typeof e!=`number`||isNaN(e)?1:e}function n(e,t){var n={},r=function(e){return e===void 0?t:e};typeof t==`function`&&(r=t);var i=function(t){return r(t[e])},a=function(){return r(void 0)};return typeof e==`string`?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getNodeAttributes(t))},n.fromEntry=function(e,t){return i(t)}):typeof e==`function`?(n.fromAttributes=function(){throw Error(`graphology-utils/getters/createNodeValueGetter: irrelevant usage.`)},n.fromGraph=function(t,n){return r(e(n,t.getNodeAttributes(n)))},n.fromEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=a,n.fromGraph=a,n.fromEntry=a),n}function r(e,t){var n={},r=function(e){return e===void 0?t:e};typeof t==`function`&&(r=t);var i=function(t){return r(t[e])},a=function(){return r(void 0)};return typeof e==`string`?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return i(t)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):typeof e==`function`?(n.fromAttributes=function(){throw Error(`graphology-utils/getters/createEdgeValueGetter: irrelevant usage.`)},n.fromGraph=function(t,n){var i=t.extremities(n);return r(e(n,t.getEdgeAttributes(n),i[0],i[1],t.getNodeAttributes(i[0]),t.getNodeAttributes(i[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,i,a,o,s,c){return r(e(t,n,i,a,o,s,c))},n.fromPartialEntry=function(t,n,i,a){return r(e(t,n,i,a))},n.fromMinimalEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=a,n.fromGraph=a,n.fromEntry=a,n.fromMinimalEntry=a),n}e.createNodeValueGetter=n,e.createEdgeValueGetter=r,e.createEdgeWeightGetter=function(e){return r(e,t)}})),bi=o(((e,t)=>{var n=0,r=1,i=2,a=3,o=4,s=5,c=6,l=7,u=8,d=9,f=0,p=1,m=2,h=0,g=1,_=2,v=3,y=4,b=5,x=6,S=7,C=8,w=3,ee=10,T=3,E=9,te=10;t.exports=function(e,t,ne){var re,D,O,k,A,j,M,N,P,ie,ae=t.length,oe=ne.length,se=e.adjustSizes,F=e.barnesHutTheta*e.barnesHutTheta,ce,I,L,R,z,B,V,H=[];for(O=0;O<ae;O+=ee)t[O+o]=t[O+i],t[O+s]=t[O+a],t[O+i]=0,t[O+a]=0;if(e.outboundAttractionDistribution){for(ce=0,O=0;O<ae;O+=ee)ce+=t[O+c];ce/=ae/ee}if(e.barnesHutOptimize){var le=1/0,ue=-1/0,de=1/0,fe=-1/0,pe,me,he;for(O=0;O<ae;O+=ee)le=Math.min(le,t[O+n]),ue=Math.max(ue,t[O+n]),de=Math.min(de,t[O+r]),fe=Math.max(fe,t[O+r]);var ge=ue-le,_e=fe-de;for(ge>_e?(de-=(ge-_e)/2,fe=de+ge):(le-=(_e-ge)/2,ue=le+_e),H[0+h]=-1,H[0+g]=(le+ue)/2,H[0+_]=(de+fe)/2,H[0+v]=Math.max(ue-le,fe-de),H[0+y]=-1,H[0+b]=-1,H[0+x]=0,H[0+S]=0,H[0+C]=0,re=1,O=0;O<ae;O+=ee)for(D=0,he=w;;)if(H[D+b]>=0){pe=t[O+n]<H[D+g]?t[O+r]<H[D+_]?H[D+b]:H[D+b]+E:t[O+r]<H[D+_]?H[D+b]+E*2:H[D+b]+E*3,H[D+S]=(H[D+S]*H[D+x]+t[O+n]*t[O+c])/(H[D+x]+t[O+c]),H[D+C]=(H[D+C]*H[D+x]+t[O+r]*t[O+c])/(H[D+x]+t[O+c]),H[D+x]+=t[O+c],D=pe;continue}else if(H[D+h]<0){H[D+h]=O;break}else{if(H[D+b]=re*E,N=H[D+v]/2,P=H[D+b],H[P+h]=-1,H[P+g]=H[D+g]-N,H[P+_]=H[D+_]-N,H[P+v]=N,H[P+y]=P+E,H[P+b]=-1,H[P+x]=0,H[P+S]=0,H[P+C]=0,P+=E,H[P+h]=-1,H[P+g]=H[D+g]-N,H[P+_]=H[D+_]+N,H[P+v]=N,H[P+y]=P+E,H[P+b]=-1,H[P+x]=0,H[P+S]=0,H[P+C]=0,P+=E,H[P+h]=-1,H[P+g]=H[D+g]+N,H[P+_]=H[D+_]-N,H[P+v]=N,H[P+y]=P+E,H[P+b]=-1,H[P+x]=0,H[P+S]=0,H[P+C]=0,P+=E,H[P+h]=-1,H[P+g]=H[D+g]+N,H[P+_]=H[D+_]+N,H[P+v]=N,H[P+y]=H[D+y],H[P+b]=-1,H[P+x]=0,H[P+S]=0,H[P+C]=0,re+=4,pe=t[H[D+h]+n]<H[D+g]?t[H[D+h]+r]<H[D+_]?H[D+b]:H[D+b]+E:t[H[D+h]+r]<H[D+_]?H[D+b]+E*2:H[D+b]+E*3,H[D+x]=t[H[D+h]+c],H[D+S]=t[H[D+h]+n],H[D+C]=t[H[D+h]+r],H[pe+h]=H[D+h],H[D+h]=-1,me=t[O+n]<H[D+g]?t[O+r]<H[D+_]?H[D+b]:H[D+b]+E:t[O+r]<H[D+_]?H[D+b]+E*2:H[D+b]+E*3,pe===me)if(he--){D=pe;continue}else{he=w;break}H[me+h]=O;break}}if(e.barnesHutOptimize)for(I=e.scalingRatio,O=0;O<ae;O+=ee)for(D=0;;)if(H[D+b]>=0)if(B=(t[O+n]-H[D+S])**2+(t[O+r]-H[D+C])**2,ie=H[D+v],4*ie*ie/B<F){if(L=t[O+n]-H[D+S],R=t[O+r]-H[D+C],se===!0?B>0?(V=I*t[O+c]*H[D+x]/B,t[O+i]+=L*V,t[O+a]+=R*V):B<0&&(V=-I*t[O+c]*H[D+x]/Math.sqrt(B),t[O+i]+=L*V,t[O+a]+=R*V):B>0&&(V=I*t[O+c]*H[D+x]/B,t[O+i]+=L*V,t[O+a]+=R*V),D=H[D+y],D<0)break;continue}else{D=H[D+b];continue}else{if(j=H[D+h],j>=0&&j!==O&&(L=t[O+n]-t[j+n],R=t[O+r]-t[j+r],B=L*L+R*R,se===!0?B>0?(V=I*t[O+c]*t[j+c]/B,t[O+i]+=L*V,t[O+a]+=R*V):B<0&&(V=-I*t[O+c]*t[j+c]/Math.sqrt(B),t[O+i]+=L*V,t[O+a]+=R*V):B>0&&(V=I*t[O+c]*t[j+c]/B,t[O+i]+=L*V,t[O+a]+=R*V)),D=H[D+y],D<0)break;continue}else for(I=e.scalingRatio,k=0;k<ae;k+=ee)for(A=0;A<k;A+=ee)L=t[k+n]-t[A+n],R=t[k+r]-t[A+r],se===!0?(B=Math.sqrt(L*L+R*R)-t[k+u]-t[A+u],B>0?(V=I*t[k+c]*t[A+c]/B/B,t[k+i]+=L*V,t[k+a]+=R*V,t[A+i]-=L*V,t[A+a]-=R*V):B<0&&(V=100*I*t[k+c]*t[A+c],t[k+i]+=L*V,t[k+a]+=R*V,t[A+i]-=L*V,t[A+a]-=R*V)):(B=Math.sqrt(L*L+R*R),B>0&&(V=I*t[k+c]*t[A+c]/B/B,t[k+i]+=L*V,t[k+a]+=R*V,t[A+i]-=L*V,t[A+a]-=R*V));for(P=e.gravity/e.scalingRatio,I=e.scalingRatio,O=0;O<ae;O+=ee)V=0,L=t[O+n],R=t[O+r],B=Math.sqrt(L**2+R**2),e.strongGravityMode?B>0&&(V=I*t[O+c]*P):B>0&&(V=I*t[O+c]*P/B),t[O+i]-=L*V,t[O+a]-=R*V;for(I=1*(e.outboundAttractionDistribution?ce:1),M=0;M<oe;M+=T)k=ne[M+f],A=ne[M+p],N=ne[M+m],z=N**+e.edgeWeightInfluence,L=t[k+n]-t[A+n],R=t[k+r]-t[A+r],se===!0?(B=Math.sqrt(L*L+R*R)-t[k+u]-t[A+u],e.linLogMode?e.outboundAttractionDistribution?B>0&&(V=-I*z*Math.log(1+B)/B/t[k+c]):B>0&&(V=-I*z*Math.log(1+B)/B):e.outboundAttractionDistribution?B>0&&(V=-I*z/t[k+c]):B>0&&(V=-I*z)):(B=Math.sqrt(L**2+R**2),e.linLogMode?e.outboundAttractionDistribution?B>0&&(V=-I*z*Math.log(1+B)/B/t[k+c]):B>0&&(V=-I*z*Math.log(1+B)/B):e.outboundAttractionDistribution?(B=1,V=-I*z/t[k+c]):(B=1,V=-I*z)),B>0&&(t[k+i]+=L*V,t[k+a]+=R*V,t[A+i]-=L*V,t[A+a]-=R*V);var ve,ye,be,xe,Se,Ce;if(se===!0)for(O=0;O<ae;O+=ee)t[O+d]!==1&&(ve=Math.sqrt(t[O+i]**2+t[O+a]**2),ve>te&&(t[O+i]=t[O+i]*te/ve,t[O+a]=t[O+a]*te/ve),ye=t[O+c]*Math.sqrt((t[O+o]-t[O+i])*(t[O+o]-t[O+i])+(t[O+s]-t[O+a])*(t[O+s]-t[O+a])),be=Math.sqrt((t[O+o]+t[O+i])*(t[O+o]+t[O+i])+(t[O+s]+t[O+a])*(t[O+s]+t[O+a]))/2,xe=.1*Math.log(1+be)/(1+Math.sqrt(ye)),Se=t[O+n]+t[O+i]*(xe/e.slowDown),t[O+n]=Se,Ce=t[O+r]+t[O+a]*(xe/e.slowDown),t[O+r]=Ce);else for(O=0;O<ae;O+=ee)t[O+d]!==1&&(ye=t[O+c]*Math.sqrt((t[O+o]-t[O+i])*(t[O+o]-t[O+i])+(t[O+s]-t[O+a])*(t[O+s]-t[O+a])),be=Math.sqrt((t[O+o]+t[O+i])*(t[O+o]+t[O+i])+(t[O+s]+t[O+a])*(t[O+s]+t[O+a]))/2,xe=t[O+l]*Math.log(1+be)/(1+Math.sqrt(ye)),t[O+l]=Math.min(1,Math.sqrt(xe*(t[O+i]**2+t[O+a]**2)/(1+Math.sqrt(ye)))),Se=t[O+n]+t[O+i]*(xe/e.slowDown),t[O+n]=Se,Ce=t[O+r]+t[O+a]*(xe/e.slowDown),t[O+r]=Ce);return{}}})),xi=o((e=>{var t=10,n=3;e.assign=function(e){e||={};var t=Array.prototype.slice.call(arguments).slice(1),n,r,i;for(n=0,i=t.length;n<i;n++)if(t[n])for(r in t[n])e[r]=t[n][r];return e},e.validateSettings=function(e){return`linLogMode`in e&&typeof e.linLogMode!=`boolean`?{message:"the `linLogMode` setting should be a boolean."}:`outboundAttractionDistribution`in e&&typeof e.outboundAttractionDistribution!=`boolean`?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:`adjustSizes`in e&&typeof e.adjustSizes!=`boolean`?{message:"the `adjustSizes` setting should be a boolean."}:`edgeWeightInfluence`in e&&typeof e.edgeWeightInfluence!=`number`?{message:"the `edgeWeightInfluence` setting should be a number."}:`scalingRatio`in e&&!(typeof e.scalingRatio==`number`&&e.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:`strongGravityMode`in e&&typeof e.strongGravityMode!=`boolean`?{message:"the `strongGravityMode` setting should be a boolean."}:`gravity`in e&&!(typeof e.gravity==`number`&&e.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:`slowDown`in e&&!(typeof e.slowDown==`number`||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:`barnesHutOptimize`in e&&typeof e.barnesHutOptimize!=`boolean`?{message:"the `barnesHutOptimize` setting should be a boolean."}:`barnesHutTheta`in e&&!(typeof e.barnesHutTheta==`number`&&e.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},e.graphToByteArrays=function(e,r){var i=e.order,a=e.size,o={},s,c=new Float32Array(i*t),l=new Float32Array(a*n);return s=0,e.forEachNode(function(e,n){o[e]=s,c[s]=n.x,c[s+1]=n.y,c[s+2]=0,c[s+3]=0,c[s+4]=0,c[s+5]=0,c[s+6]=1,c[s+7]=1,c[s+8]=n.size||1,c[s+9]=+!!n.fixed,s+=t}),s=0,e.forEachEdge(function(e,t,i,a,u,d,f){var p=o[i],m=o[a],h=r(e,t,i,a,u,d,f);c[p+6]+=h,c[m+6]+=h,l[s]=p,l[s+1]=m,l[s+2]=h,s+=n}),{nodes:c,edges:l}},e.assignLayoutChanges=function(e,n,r){var i=0;e.updateEachNodeAttributes(function(e,a){return a.x=n[i],a.y=n[i+1],i+=t,r?r(e,a):a})},e.readGraphPositions=function(e,n){var r=0;e.forEachNode(function(e,i){n[r]=i.x,n[r+1]=i.y,r+=t})},e.collectLayoutChanges=function(e,n,r){for(var i=e.nodes(),a={},o=0,s=0,c=n.length;o<c;o+=t){if(r){var l=Object.assign({},e.getNodeAttributes(i[s]));l.x=n[o],l.y=n[o+1],l=r(i[s],l),a[i[s]]={x:l.x,y:l.y}}else a[i[s]]={x:n[o],y:n[o+1]};s++}return a},e.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),r=t.createObjectURL(new Blob([`(`+n+`).call(this);`],{type:`text/javascript`})),i=new Worker(r);return t.revokeObjectURL(r),i}})),Si=o(((e,t)=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}})),Ci=c(o(((e,t)=>{var n=gr(),r=yi().createEdgeWeightGetter,i=bi(),a=xi(),o=Si();function s(e,t,s){if(!n(t))throw Error(`graphology-layout-forceatlas2: the given graph is not a valid graphology instance.`);typeof s==`number`&&(s={iterations:s});var c=s.iterations;if(typeof c!=`number`)throw Error(`graphology-layout-forceatlas2: invalid number of iterations.`);if(c<=0)throw Error(`graphology-layout-forceatlas2: you should provide a positive number of iterations.`);var l=r(`getEdgeWeight`in s?s.getEdgeWeight:`weight`).fromEntry,u=typeof s.outputReducer==`function`?s.outputReducer:null,d=a.assign({},o,s.settings),f=a.validateSettings(d);if(f)throw Error(`graphology-layout-forceatlas2: `+f.message);var p=a.graphToByteArrays(t,l),m;for(m=0;m<c;m++)i(d,p.nodes,p.edges);if(e){a.assignLayoutChanges(t,p.nodes,u);return}return a.collectLayoutChanges(t,p.nodes)}function c(e){var t=typeof e==`number`?e:e.order;return{barnesHutOptimize:t>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(t)}}var l=s.bind(null,!1);l.assign=s.bind(null,!0),l.inferSettings=c,t.exports=l}))(),1),wi={function:`#22D3EE`,file:`#FB923C`,class:`#4ADE80`,interface:`#A78BFA`,enum:`#6366F1`,constant:`#FACC15`,type_alias:`#FB7185`,flow:`#14B8A6`,method:`#38BDF8`,constructor:`#06B6D4`,struct:`#86EFAC`,trait:`#C4B5FD`,variable:`#FDE68A`,property:`#FCA5A5`,namespace:`#818CF8`,module:`#E879F9`,route:`#F87171`,cluster:`#64748B`,directory:`#475569`},Ti={contains:`#334155`,calls:`#38bdf8`,imports:`#64748b`,extends:`#4ade80`,implements:`#f97316`,has_member:`#facc15`,accesses:`#06b6d4`,overrides:`#ef4444`,belongs_to:`#475569`,step_of:`#fb923c`,handles:`#fb7185`},Ei={contains:.08,calls:.55,imports:.25,extends:.5,implements:.45,has_member:.18,accesses:.3,overrides:.45,belongs_to:.1,step_of:.35,handles:.4};function Di(e,t){return`${e}${Math.round(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,`0`)}`}function Oi(e,t){let n=new Set([e]);for(let r of t)r.source===e?n.add(r.target):r.target===e&&n.add(r.source);return n}function G(e,t,n){let r=n.labelSize;if(e.font=`${n.labelWeight} ${r}px ${n.labelFont}`,typeof t.label==`string`&&t.label.length>0){let n=e.measureText(t.label).width,i=Math.round(n+6+6),a=Math.round(r+6),o=Math.max(t.size,r/2)+3,s=Math.asin(a/2/o),c=Math.sqrt(Math.abs(o**2-(a/2)**2));e.shadowOffsetX=0,e.shadowOffsetY=2,e.shadowBlur=12,e.shadowColor=`rgba(0,0,0,0.8)`,e.fillStyle=`#0c101f`,e.strokeStyle=`rgba(255,255,255,0.08)`,e.lineWidth=.8,e.beginPath(),e.moveTo(t.x+c,t.y+a/2),e.lineTo(t.x+o+i-4,t.y+a/2),e.quadraticCurveTo(t.x+o+i,t.y+a/2,t.x+o+i,t.y+a/2-4),e.lineTo(t.x+o+i,t.y-a/2+4),e.quadraticCurveTo(t.x+o+i,t.y-a/2,t.x+o+i-4,t.y-a/2),e.lineTo(t.x+c,t.y-a/2),e.arc(t.x,t.y,o,s,-s),e.closePath(),e.fill(),e.stroke(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0;let l=Math.max(t.size,r/2)+3;e.fillStyle=`#e2e8f0`,e.fillText(t.label,t.x+l+3+2,t.y+r/2-1)}else e.fillStyle=`#0c101f`,e.beginPath(),e.arc(t.x,t.y,t.size+3,0,Math.PI*2),e.closePath(),e.fill()}function ki(){let{state:e,dispatch:t}=T(),n=(0,b.useRef)(e);n.current=e;let r=(0,b.useRef)(t);r.current=t;let i=(0,b.useRef)(new jt({multi:!1,type:`directed`})),a=(0,b.useRef)(null),o=(0,b.useRef)(null),[s,c]=(0,b.useState)({nodes:0,edges:0}),l=(0,b.useRef)({nodeCount:-1,edgeCount:-1});return(0,b.useEffect)(()=>{if(e.nodes.length===0||l.current.nodeCount===e.nodes.length&&l.current.edgeCount===e.edges.length)return;l.current={nodeCount:e.nodes.length,edgeCount:e.edges.length};let t=i.current;t.clear();let r=0;for(let n of e.nodes){let i=r++/Math.max(1,e.nodes.length)*Math.PI*2,a=200+Math.random()*300;try{t.addNode(n.id,{label:n.name,baseLabel:n.name,x:Math.cos(i)*a+(Math.random()-.5)*50,y:Math.sin(i)*a+(Math.random()-.5)*50,size:Pi(n.kind),color:wi[n.kind]??`#6b7280`,nodeKind:n.kind})}catch{}}for(let n of e.edges)if(!(!t.hasNode(n.source)||!t.hasNode(n.target)||n.source===n.target))try{let e=Di(Ti[n.kind]??`#4b5563`,Ei[n.kind]??.25);t.addEdge(n.source,n.target,{color:e,baseColor:e,size:n.kind===`calls`?.8:n.kind===`imports`?.5:.4,type:`arrow`,edgeKind:n.kind})}catch{}if(t.order>0){let e=Ci.default.inferSettings(t);Ci.default.assign(t,{iterations:t.order>500?80:150,settings:{...e,gravity:1,scalingRatio:8,slowDown:5,barnesHutOptimize:t.order>200,adjustSizes:!0}})}let o=new Map;t.forEachNode(e=>o.set(e,t.degree(e)));let s=[...o.values()].sort((e,t)=>t-e);if(t._degreeMap=o,t._topNThreshold=s[Math.min(30,s.length-1)]??0,a.current){Ai(a.current,t,n.current,null,null),a.current.refresh();let e=0,r=0;t.forEachNode((t,n)=>{n.hidden||e++}),t.forEachEdge((e,t)=>{t.hidden||r++}),c({nodes:e,edges:r})}},[e.nodes,e.edges]),(0,b.useEffect)(()=>{if(!o.current||a.current)return;let e=i.current,t=new vi(e,o.current,{allowInvalidContainer:!0,renderEdgeLabels:!1,defaultEdgeType:`arrow`,labelRenderedSizeThreshold:4,labelFont:`"Inter", "SF Pro Display", system-ui, sans-serif`,labelColor:{color:`#e2e8f0`},labelSize:11,labelWeight:`600`,defaultDrawNodeHover:G});a.current=t,Ai(t,e,n.current,null,null),t.refresh();let s=!1;t.on(`clickNode`,({node:e})=>{s=!0;let t=n.current.nodes.find(t=>t.id===e);t&&r.current({type:`SELECT_NODE`,node:t}),setTimeout(()=>{s=!1},50)}),t.on(`clickStage`,()=>{s||r.current({type:`SELECT_NODE`,node:null})}),t.on(`enterNode`,({node:e})=>r.current({type:`HOVER_NODE`,nodeId:e})),t.on(`leaveNode`,()=>r.current({type:`HOVER_NODE`,nodeId:null}));let c=e=>{let n=e.detail,r=t.getCamera();n===0?r.animatedReset():r.animate({ratio:r.getState().ratio*n},{duration:200})};return window.addEventListener(`graph-zoom`,c),()=>{window.removeEventListener(`graph-zoom`,c),t.kill(),a.current=null}},[]),(0,b.useEffect)(()=>{let t=a.current;if(!t)return;Ai(t,i.current,e,e.hoveredNodeId,e.selectedNode?.id??null),t.refresh();let n=0,r=0;i.current.forEachNode((e,t)=>{t.hidden||n++}),i.current.forEachEdge((e,t)=>{t.hidden||r++}),c({nodes:n,edges:r})},[e.filters,e.hoveredNodeId,e.selectedNode]),(0,b.useEffect)(()=>{let t=a.current;if(!t||!e.selectedNode)return;let n=t.getNodeDisplayData(e.selectedNode.id);n&&t.getCamera().animate({x:n.x,y:n.y,ratio:Math.min(t.getCamera().getState().ratio,.5)},{duration:400,easing:`quadraticInOut`})},[e.selectedNode?.id]),(0,x.jsxs)(`div`,{className:`relative w-full h-full bg-[#040812]`,children:[(0,x.jsx)(`div`,{ref:o,className:`absolute inset-0`}),(0,x.jsxs)(`div`,{className:`absolute top-3 left-3 flex items-center gap-2 bg-gray-950/90 backdrop-blur border border-gray-800/60 rounded-lg px-3 py-1.5 text-[10px] text-gray-400 font-mono pointer-events-none shadow-lg`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-green-400 animate-pulse`}),(0,x.jsx)(`span`,{className:`text-gray-200`,children:s.nodes}),(0,x.jsx)(`span`,{className:`text-gray-600`,children:`nodes`}),(0,x.jsx)(`span`,{className:`text-gray-700`,children:`·`}),(0,x.jsx)(`span`,{className:`text-gray-200`,children:s.edges}),(0,x.jsx)(`span`,{className:`text-gray-600`,children:`edges`})]}),(0,x.jsx)(Mi,{}),(0,x.jsx)(Ni,{})]})}function Ai(e,t,n,r,i){let a=t._topNThreshold??0,o=t._degreeMap??new Map,s=r??i,c=s?Oi(s,n.edges):null,l=n.filters.hiddenNodeKinds,u=n.filters.hiddenEdgeKinds,d=null;i&&n.filters.focusDepth!==`all`&&typeof n.filters.focusDepth==`number`&&(d=ji(i,n.edges,n.filters.focusDepth)),e.setSetting(`nodeReducer`,(e,t)=>{let n=t.nodeKind;if(l.has(n)||d&&!d.has(e))return{...t,hidden:!0};let r=wi[n]??t.color,i=(o.get(e)??0)>=a?t.baseLabel??t.label:``;return c?c.has(e)?{...t,hidden:!1,color:r,label:t.baseLabel??t.label,zIndex:2,size:e===s?(t.size??5)*1.8:(t.size??5)*1.1,highlighted:e===s}:{...t,hidden:!1,color:Di(r,.08),label:``,zIndex:0,size:(t.size??3)*.7}:{...t,hidden:!1,color:r,label:i}}),e.setSetting(`edgeReducer`,(n,r)=>{let i=r.edgeKind,a=e.getGraph().extremities(n),o=t.getNodeAttribute(a[0],`nodeKind`),s=t.getNodeAttribute(a[1],`nodeKind`);return u.has(i)||l.has(o)||l.has(s)||d&&(!d.has(a[0])||!d.has(a[1]))?{...r,hidden:!0}:c?c.has(a[0])&&c.has(a[1])?{...r,hidden:!1,color:Di(Ti[i]??`#9ca3af`,.95),size:1.5,zIndex:1}:{...r,hidden:!1,color:`#0f172a30`,size:.3,zIndex:0}:{...r,hidden:!1,color:r.baseColor??r.color}})}function ji(e,t,n){let r=new Set([e]),i=new Map;for(let e of t)(i.get(e.source)??(i.set(e.source,[]),i.get(e.source))).push(e.target),(i.get(e.target)??(i.set(e.target,[]),i.get(e.target))).push(e.source);let a=[{id:e,depth:0}];for(;a.length>0;){let{id:e,depth:t}=a.shift();if(!(t>=n))for(let n of i.get(e)??[])r.has(n)||(r.add(n),a.push({id:n,depth:t+1}))}return r}function Mi(){let[e,t]=b.useState(!0);return(0,x.jsxs)(`div`,{className:`absolute bottom-14 right-3 bg-gray-950/90 backdrop-blur border border-gray-800/60 rounded-lg shadow-xl overflow-hidden`,children:[(0,x.jsxs)(`button`,{onClick:()=>t(e=>!e),className:`flex items-center gap-2 px-3 py-1.5 text-[10px] text-gray-400 hover:text-gray-200 w-full`,children:[(0,x.jsx)(`span`,{children:`◉`}),(0,x.jsx)(`span`,{className:`font-medium`,children:`Legend`}),(0,x.jsx)(`span`,{className:`ml-auto`,children:e?`▸`:`▾`})]}),!e&&(0,x.jsxs)(`div`,{className:`px-3 pb-2.5 space-y-1`,children:[[`function`,`class`,`interface`,`file`,`method`,`enum`].map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-gray-400`,children:[(0,x.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:wi[e]}}),(0,x.jsx)(`span`,{className:`capitalize`,children:e})]},e)),(0,x.jsx)(`div`,{className:`border-t border-gray-800 mt-1 pt-1 space-y-1`,children:[`calls`,`imports`,`extends`].map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-gray-400`,children:[(0,x.jsx)(`span`,{className:`w-4 h-px flex-shrink-0`,style:{backgroundColor:Ti[e]}}),(0,x.jsx)(`span`,{children:e})]},e))})]})]})}function Ni(){let e=e=>window.dispatchEvent(new CustomEvent(`graph-zoom`,{detail:e}));return(0,x.jsxs)(`div`,{className:`absolute bottom-3 right-3 flex flex-col gap-1 bg-gray-950/90 backdrop-blur border border-gray-800/60 rounded-lg p-1 shadow-lg`,children:[(0,x.jsx)(`button`,{className:`w-7 h-7 text-gray-300 hover:bg-gray-800 hover:text-white rounded text-sm font-bold transition`,onClick:()=>e(.7),title:`Zoom in`,children:`+`}),(0,x.jsx)(`button`,{className:`w-7 h-7 text-gray-300 hover:bg-gray-800 hover:text-white rounded text-sm font-bold transition`,onClick:()=>e(1.4),title:`Zoom out`,children:`−`}),(0,x.jsx)(`div`,{className:`h-px bg-gray-800 mx-1`}),(0,x.jsx)(`button`,{className:`w-7 h-7 text-gray-400 hover:bg-gray-800 hover:text-white rounded text-xs transition`,onClick:()=>e(0),title:`Fit to view`,children:`⌖`})]})}function Pi(e){return{cluster:9,class:8,file:7,module:7,struct:7,interface:6,trait:6,namespace:6,function:5,enum:5,route:5,method:4,constructor:4,type_alias:4,flow:4,constant:3,variable:3,property:3,directory:3}[e]??3}function Fi({node:e,onClose:t}){let{state:n,dispatch:r}=T(),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(`overview`);(0,b.useEffect)(()=>{let t=!1;return a(null),s(null),l(!0),new E(n.serverUrl).inspectNode(e.id).then(e=>{t||a(e)}).catch(()=>void 0).finally(()=>{t||l(!1)}),()=>{t=!0}},[e.id,n.serverUrl]);let m=async()=>{if(!(o||u)){d(!0);try{s(await new E(n.serverUrl).blastRadius(e.id,`both`,3))}catch{}finally{d(!1)}}};(0,b.useEffect)(()=>{f===`impact`&&m()},[f]);let h=e=>{if(!e)return;let t=n.nodes.find(t=>t.id===e);t&&r({type:`SELECT_NODE`,node:t})},g=({kind:e,name:t,id:n,depth:r})=>(0,x.jsxs)(`button`,{onClick:()=>h(n),className:`inline-flex items-center gap-1.5 border rounded px-2 py-0.5 text-xs text-gray-200 max-w-full truncate hover:brightness-125 transition ${r===1?`border-red-700 bg-red-900/20`:r===2?`border-yellow-700 bg-yellow-900/20`:`border-gray-700 bg-gray-800`}`,title:n,children:[e&&(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{backgroundColor:wi[e]??`#666`}}),(0,x.jsx)(`span`,{className:`truncate`,children:t??`(unknown)`}),r!=null&&(0,x.jsxs)(`span`,{className:`text-[9px] text-gray-500 ml-0.5`,children:[`d`,r]})]}),_=[`overview`,`connections`,`impact`,`source`],v=i?i.callers.length+i.callees.length+i.imports.length:0,y=o?.affectedCount??0;return(0,x.jsxs)(`div`,{className:`h-72 bg-[#080b14] border-t border-gray-800 flex flex-col overflow-hidden shadow-2xl`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-gray-800/80 bg-[#0a0d18]`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,x.jsx)(`span`,{className:`w-3 h-3 rounded-full flex-shrink-0 ring-2 ring-offset-1 ring-offset-[#0a0d18]`,style:{backgroundColor:wi[e.kind]??`#666`}}),(0,x.jsx)(`h3`,{className:`font-semibold text-white truncate`,children:e.name}),(0,x.jsx)(`span`,{className:`text-[10px] uppercase bg-gray-800/80 text-gray-400 px-1.5 py-0.5 rounded font-mono border border-gray-700/50`,children:e.kind}),e.exported&&(0,x.jsx)(`span`,{className:`text-[10px] bg-emerald-900/40 text-emerald-400 px-1.5 py-0.5 rounded border border-emerald-800/40`,children:`exported`}),i?.callers&&i.callers.length===0&&[`function`,`method`].includes(e.kind)&&(0,x.jsx)(`span`,{className:`text-[10px] bg-blue-900/30 text-blue-400 px-1.5 py-0.5 rounded border border-blue-800/40`,children:`entry point`})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 font-mono mr-2`,children:e.filePath?.split(`/`).slice(-2).join(`/`)}),(0,x.jsx)(`button`,{onClick:t,className:`text-gray-600 hover:text-white text-lg px-2 transition leading-none`,children:`×`})]})]}),(0,x.jsx)(`div`,{className:`flex border-b border-gray-800/60 px-2 bg-[#090c16]`,children:_.map(e=>(0,x.jsxs)(`button`,{onClick:()=>p(e),className:`px-3 py-1.5 text-xs capitalize font-medium transition relative ${f===e?`text-cyan-400 border-b-2 border-cyan-500 bg-cyan-500/5`:`text-gray-500 hover:text-gray-300`}`,children:[e,e===`connections`&&v>0&&(0,x.jsx)(`span`,{className:`ml-1 text-[9px] text-gray-600 bg-gray-800 px-1 rounded-full`,children:v}),e===`impact`&&y>0&&(0,x.jsx)(`span`,{className:`ml-1 text-[9px] px-1 rounded-full ${y>10?`text-red-300 bg-red-900/40`:`text-yellow-300 bg-yellow-900/30`}`,children:y})]},e))}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3 text-sm`,children:[f===`overview`&&(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-xs`,children:[(0,x.jsx)(Ii,{label:`File`,value:e.filePath,mono:!0}),(0,x.jsx)(Ii,{label:`Lines`,value:e.startLine?`${e.startLine}${e.endLine?`–${e.endLine}`:``}`:`—`}),i?.cluster&&(0,x.jsx)(Ii,{label:`Cluster`,value:i.cluster}),(0,x.jsx)(Ii,{label:`ID`,value:e.id,mono:!0,tiny:!0})]}),i&&(0,x.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[[{label:`Callers`,count:i.callers.length,color:`text-red-400`,bg:`bg-red-900/20 border-red-800/40`},{label:`Callees`,count:i.callees.length,color:`text-sky-400`,bg:`bg-sky-900/20 border-sky-800/40`},{label:`Imports`,count:i.imports.length,color:`text-purple-400`,bg:`bg-purple-900/20 border-purple-800/40`},{label:`Members`,count:i.members.length,color:`text-green-400`,bg:`bg-green-900/20 border-green-800/40`}].filter(e=>e.count>0).map(e=>(0,x.jsxs)(`button`,{onClick:()=>p(`connections`),className:`flex items-center gap-1.5 text-[11px] border rounded px-2 py-1 ${e.bg} transition hover:brightness-125`,children:[(0,x.jsx)(`span`,{className:`font-bold ${e.color}`,children:e.count}),(0,x.jsx)(`span`,{className:`text-gray-400`,children:e.label})]},e.label)),(0,x.jsxs)(`button`,{onClick:()=>p(`impact`),className:`flex items-center gap-1.5 text-[11px] border rounded px-2 py-1 bg-orange-900/20 border-orange-800/40 transition hover:brightness-125`,children:[(0,x.jsx)(`span`,{className:`font-bold text-orange-400`,children:`⚡`}),(0,x.jsx)(`span`,{className:`text-gray-400`,children:`Impact`})]})]}),!!e.metadata?.signature&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-[10px] uppercase mb-1`,children:`Signature`}),(0,x.jsx)(`pre`,{className:`text-xs text-cyan-300 bg-gray-950 rounded p-2 overflow-x-auto border border-gray-800`,children:String(e.metadata?.signature)})]})]}),f===`connections`&&(0,x.jsxs)(`div`,{className:`space-y-3`,children:[c&&(0,x.jsx)(`p`,{className:`text-gray-500 text-xs animate-pulse`,children:`Loading connections…`}),i&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Li,{label:`Callers`,hint:`Functions that call this`,accent:`text-red-400`,items:i.callers.map(e=>({id:e.id,name:e.name,kind:`function`})),Pill:g}),(0,x.jsx)(Li,{label:`Callees`,hint:`Functions called by this`,accent:`text-sky-400`,items:i.callees.map(e=>({id:e.id,name:e.name,kind:`function`})),Pill:g}),(0,x.jsx)(Li,{label:`Imports`,items:i.imports.map(e=>({id:e.id,name:e.name,kind:`module`})),Pill:g}),(0,x.jsx)(Li,{label:`Imported By`,items:i.importedBy.map(e=>({id:e.id,name:e.name,kind:`module`})),Pill:g}),(0,x.jsx)(Li,{label:`Extends`,items:i.extends.map(e=>({id:e.id,name:e.name,kind:`class`})),Pill:g}),(0,x.jsx)(Li,{label:`Implements`,items:i.implementsEdges.map(e=>({id:e.id,name:e.name,kind:`interface`})),Pill:g}),(0,x.jsx)(Li,{label:`Members`,items:i.members.map(e=>({id:e.id,name:e.name,kind:e.kind})),Pill:g})]}),i&&v===0&&(0,x.jsx)(`p`,{className:`text-gray-500 text-xs italic`,children:`No connections recorded.`})]}),f===`impact`&&(0,x.jsxs)(`div`,{className:`space-y-3`,children:[u&&(0,x.jsx)(`p`,{className:`text-gray-500 text-xs animate-pulse`,children:`Calculating blast radius…`}),!u&&!o&&(0,x.jsx)(`p`,{className:`text-gray-500 text-xs italic`,children:`No impact data.`}),o&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,x.jsx)(`div`,{className:`text-2xl font-bold font-mono ${o.affectedCount>10?`text-red-400`:o.affectedCount>5?`text-yellow-400`:`text-green-400`}`,children:o.affectedCount}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-xs text-gray-300`,children:`affected symbols`}),(0,x.jsx)(`p`,{className:`text-[10px] text-gray-600`,children:o.affectedCount>10?`⚠ HIGH blast radius`:o.affectedCount>5?`⚡ MEDIUM blast radius`:`✓ LOW blast radius`})]})]}),[1,2,3].map(e=>{let t=o.affected.filter(t=>t.depth===e);return t.length===0?null:(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,x.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-wider ${e===1?`text-red-400`:e===2?`text-yellow-400`:`text-gray-400`}`,children:[`d=`,e,` `,e===1?`· WILL BREAK`:e===2?`· LIKELY AFFECTED`:`· MAY NEED TESTING`]}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600`,children:t.length})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[t.slice(0,20).map((t,n)=>(0,x.jsx)(g,{id:t.id,name:t.name,kind:t.kind,depth:e},`${t.id}-${n}`)),t.length>20&&(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-600 self-center`,children:[`+`,t.length-20]})]})]},e)})]})]}),f===`source`&&(0,x.jsx)(`div`,{children:e.content?(0,x.jsx)(`pre`,{className:`text-xs text-gray-300 bg-gray-950 rounded p-3 overflow-x-auto border border-gray-800 leading-relaxed`,children:(0,x.jsx)(`code`,{children:e.content})}):(0,x.jsx)(`p`,{className:`text-gray-500 text-xs italic`,children:`No source preview available.`})})]})]})}function Ii({label:e,value:t,mono:n,tiny:r}){return(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-[10px] uppercase mb-0.5`,children:e}),(0,x.jsx)(`p`,{className:`text-gray-200 truncate ${n?`font-mono`:``} ${r?`text-[10px]`:`text-xs`}`,title:t,children:t})]})}function Li({label:e,hint:t,accent:n=`text-gray-500`,items:r,Pill:i}){return r.length===0?null:(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-baseline gap-2 mb-1.5`,children:[(0,x.jsx)(`h4`,{className:`text-[10px] font-bold uppercase tracking-wider ${n}`,children:e}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 bg-gray-800/60 px-1 rounded-full`,children:r.length}),t&&(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-700`,children:[`— `,t]})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[r.slice(0,50).map((e,t)=>(0,x.jsx)(i,{...e},`${e.id}-${t}`)),r.length>50&&(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-600 self-center`,children:[`+`,r.length-50,` more`]})]})]})}var Ri=`modulepreload`,zi=function(e){return`/`+e},Bi={},Vi=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=zi(t,n),t in Bi)return;Bi[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ri,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Hi=null;async function Ui(){if(Hi)return Hi;try{return Hi=(await Vi(()=>import(`./es-CnPQcqTr.js`),[])).default,Hi}catch{return null}}var Wi=`code-intel:source-panel-size`,Gi=420;function Ki({file:e,startLine:t,endLine:n,onClose:r}){let{state:i}=T(),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(()=>{try{let e=localStorage.getItem(Wi);return e?parseInt(e,10):Gi}catch{return Gi}}),_=(0,b.useRef)(!1),v=(0,b.useRef)(0),y=(0,b.useRef)(0),S=e=>{_.current=!0,v.current=e.clientY,y.current=h,e.preventDefault()};(0,b.useEffect)(()=>{let e=e=>{if(!_.current)return;let t=v.current-e.clientY;g(Math.max(180,Math.min(800,y.current+t)))},t=()=>{if(_.current){_.current=!1;try{localStorage.setItem(Wi,String(h))}catch{}}};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[h]),(0,b.useEffect)(()=>{let r=!1;return o(null),f(null),u(null),c(!0),new E(i.serverUrl).sourcePreview(e,t,n).then(async e=>{if(r)return;o(e);let t=await Ui();if(!r&&t)try{let n=t.getLanguage(e.language)?e.language:`plaintext`;f(t.highlight(e.content,{language:n}).value)}catch{f(null)}}).catch(e=>{r||u(e instanceof Error?e.message:`Failed to load source`)}).finally(()=>{r||c(!1)}),()=>{r=!0}},[e,t,n,i.serverUrl]);let C=(0,b.useCallback)(async()=>{try{await navigator.clipboard.writeText(`${e}:${t}`),m(!0),setTimeout(()=>m(!1),2e3)}catch{}},[e,t]),w=e.split(`/`).slice(-3).join(`/`);return(0,x.jsxs)(`div`,{className:`bg-[#080b14] border-t border-gray-800 flex flex-col overflow-hidden shadow-2xl`,style:{height:h},children:[(0,x.jsx)(`div`,{className:`h-1 cursor-row-resize bg-gray-800 hover:bg-cyan-500/50 transition-colors flex-shrink-0`,onMouseDown:S,title:`Drag to resize`}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-gray-800/80 bg-[#0a0d18] flex-shrink-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,x.jsx)(`span`,{className:`text-[10px] font-bold tracking-wider text-cyan-500/80 uppercase`,children:`Source`}),(0,x.jsx)(`span`,{className:`text-xs text-gray-400 font-mono truncate`,title:e,children:w}),(a||s)&&(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-600 font-mono`,children:[`:`,t,n===t?``:`–${n}`]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[(0,x.jsx)(`a`,{href:`vscode://file/${e}:${t}`,className:`text-[10px] text-gray-400 hover:text-white border border-gray-700/50 hover:border-gray-500 rounded px-2 py-0.5 transition font-mono`,title:`Open in VS Code`,children:`⎈ VS Code`}),(0,x.jsx)(`button`,{onClick:C,className:`text-[10px] border rounded px-2 py-0.5 transition font-mono ${p?`text-green-400 border-green-700/50 bg-green-900/20`:`text-gray-400 hover:text-white border-gray-700/50 hover:border-gray-500`}`,title:`Copy ${e}:${t} to clipboard`,children:p?`✓ copied`:`⎘ copy`}),(0,x.jsx)(`button`,{onClick:r,className:`text-gray-600 hover:text-white text-lg px-2 transition leading-none ml-1`,children:`×`})]})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-auto`,children:[s&&(0,x.jsx)(qi,{}),l&&(0,x.jsx)(`div`,{className:`p-4`,children:(0,x.jsxs)(`div`,{className:`flex items-center gap-2 bg-red-900/20 border border-red-800/40 rounded-lg px-3 py-2`,children:[(0,x.jsx)(`span`,{className:`text-red-400 text-sm`,children:`⚠`}),(0,x.jsx)(`span`,{className:`text-red-300 text-xs`,children:l})]})}),a&&!s&&(0,x.jsx)(Ji,{data:a,highlightedHtml:d,focusStartLine:t,focusEndLine:n})]})]})}function qi(){return(0,x.jsx)(`div`,{className:`p-4 space-y-1.5 animate-pulse`,children:Array.from({length:12}).map((e,t)=>(0,x.jsxs)(`div`,{className:`flex gap-4`,children:[(0,x.jsx)(`div`,{className:`w-8 h-3 bg-gray-800 rounded flex-shrink-0`}),(0,x.jsx)(`div`,{className:`h-3 bg-gray-800 rounded`,style:{width:`${40+Math.random()*50}%`}})]},t))})}function Ji({data:e,highlightedHtml:t,focusStartLine:n,focusEndLine:r}){let i=e.content.split(`
320
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function si(e){return ii(e)||ai(e)||$t(e)||oi()}function ci(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function li(e,t){if(e==null)return{};var n,r,i=ci(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var ui=function(){function e(t,n){Bt(this,e),this.key=t,this.size=n}return Ht(e,null,[{key:`compare`,value:function(e,t){return e.size>t.size?-1:e.size<t.size||e.key>t.key?1:-1}}])}(),di=function(){function e(){Bt(this,e),U(this,`width`,0),U(this,`height`,0),U(this,`cellSize`,0),U(this,`columns`,0),U(this,`rows`,0),U(this,`cells`,{})}return Ht(e,[{key:`resizeAndClear`,value:function(e,t){this.width=e.width,this.height=e.height,this.cellSize=t,this.columns=Math.ceil(e.width/t),this.rows=Math.ceil(e.height/t),this.cells={}}},{key:`getIndex`,value:function(e){var t=Math.floor(e.x/this.cellSize);return Math.floor(e.y/this.cellSize)*this.columns+t}},{key:`add`,value:function(e,t,n){var r=new ui(e,t),i=this.getIndex(n),a=this.cells[i];a||(a=[],this.cells[i]=a),a.push(r)}},{key:`organize`,value:function(){for(var e in this.cells)this.cells[e].sort(ui.compare)}},{key:`getLabelsToDisplay`,value:function(e,t){var n=this.cellSize*this.cellSize,r=n/e/e*t/n,i=Math.ceil(r),a=[];for(var o in this.cells)for(var s=this.cells[o],c=0;c<Math.min(i,s.length);c++)a.push(s[c].key);return a}}])}();function fi(e){var t=e.graph,n=e.hoveredNode,r=e.highlightedNodes,i=e.displayedNodeLabels,a=[];return t.forEachEdge(function(e,t,o,s){(o===n||s===n||r.has(o)||r.has(s)||i.has(o)&&i.has(s))&&a.push(e)}),a}var pi=150,mi=50,hi=Object.prototype.hasOwnProperty;function gi(e,t,n){if(!hi.call(n,`x`)||!hi.call(n,`y`))throw Error(`Sigma: could not find a valid position (x, y) for node "${t}". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?`);return n.color||=e.defaultNodeColor,!n.label&&n.label!==``&&(n.label=null),n.label!==void 0&&n.label!==null?n.label=``+n.label:n.label=null,n.size||=2,hi.call(n,`hidden`)||(n.hidden=!1),hi.call(n,`highlighted`)||(n.highlighted=!1),hi.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultNodeType),n.zIndex||=0,n}function _i(e,t,n){return n.color||=e.defaultEdgeColor,n.label||=``,n.size||=.5,hi.call(n,`hidden`)||(n.hidden=!1),hi.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultEdgeType),n.zIndex||=0,n}var vi=function(e){function t(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Bt(this,t),r=qt(this,t),U(r,`elements`,{}),U(r,`canvasContexts`,{}),U(r,`webGLContexts`,{}),U(r,`pickingLayers`,new Set),U(r,`textures`,{}),U(r,`frameBuffers`,{}),U(r,`activeListeners`,{}),U(r,`labelGrid`,new di),U(r,`nodeDataCache`,{}),U(r,`edgeDataCache`,{}),U(r,`nodeProgramIndex`,{}),U(r,`edgeProgramIndex`,{}),U(r,`nodesWithForcedLabels`,new Set),U(r,`edgesWithForcedLabels`,new Set),U(r,`nodeExtent`,{x:[0,1],y:[0,1]}),U(r,`nodeZExtent`,[1/0,-1/0]),U(r,`edgeZExtent`,[1/0,-1/0]),U(r,`matrix`,br()),U(r,`invMatrix`,br()),U(r,`correctionRatio`,1),U(r,`customBBox`,null),U(r,`normalizationFunction`,Pr({x:[0,1],y:[0,1]})),U(r,`graphToViewportRatio`,1),U(r,`itemIDsIndex`,{}),U(r,`nodeIndices`,{}),U(r,`edgeIndices`,{}),U(r,`width`,0),U(r,`height`,0),U(r,`pixelRatio`,Mr()),U(r,`pickingDownSizingRatio`,2*r.pixelRatio),U(r,`displayedNodeLabels`,new Set),U(r,`displayedEdgeLabels`,new Set),U(r,`highlightedNodes`,new Set),U(r,`hoveredNode`,null),U(r,`hoveredEdge`,null),U(r,`renderFrame`,null),U(r,`renderHighlightedNodesFrame`,null),U(r,`needToProcess`,!1),U(r,`checkEdgesEventsFrame`,null),U(r,`nodePrograms`,{}),U(r,`nodeHoverPrograms`,{}),U(r,`edgePrograms`,{}),r.settings=Hr(i),Vr(r.settings),Ar(e),!(n instanceof HTMLElement))throw Error(`Sigma: container should be an html element.`);for(var a in r.graph=e,r.container=n,r.createWebGLContext(`edges`,{picking:i.enableEdgeEvents}),r.createCanvasContext(`edgeLabels`),r.createWebGLContext(`nodes`,{picking:!0}),r.createCanvasContext(`labels`),r.createCanvasContext(`hovers`),r.createWebGLContext(`hoverNodes`),r.createCanvasContext(`mouse`,{style:{touchAction:`none`,userSelect:`none`}}),r.resize(),r.settings.nodeProgramClasses)r.registerNodeProgram(a,r.settings.nodeProgramClasses[a],r.settings.nodeHoverProgramClasses[a]);for(var o in r.settings.edgeProgramClasses)r.registerEdgeProgram(o,r.settings.edgeProgramClasses[o]);return r.camera=new Wr,r.bindCameraHandlers(),r.mouseCaptor=new ti(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new ri(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return Yt(t,e),Ht(t,[{key:`registerNodeProgram`,value:function(e,t,n){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(n||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:`registerEdgeProgram`,value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:`unregisterNodeProgram`,value:function(e){if(this.nodePrograms[e]){var t=this.nodePrograms,n=t[e],r=li(t,[e].map(zt));n.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[e]){var i=this.nodeHoverPrograms,a=i[e],o=li(i,[e].map(zt));a.kill(),this.nodePrograms=o}return this}},{key:`unregisterEdgeProgram`,value:function(e){if(this.edgePrograms[e]){var t=this.edgePrograms,n=t[e],r=li(t,[e].map(zt));n.kill(),this.edgePrograms=r}return this}},{key:`resetWebGLTexture`,value:function(e){var t=this.webGLContexts[e],n=this.frameBuffers[e],r=this.textures[e];r&&t.deleteTexture(r);var i=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,n),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),this.textures[e]=i,this}},{key:`bindCameraHandlers`,value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on(`updated`,this.activeListeners.camera),this}},{key:`unbindCameraHandlers`,value:function(){return this.camera.removeListener(`updated`,this.activeListeners.camera),this}},{key:`getNodeAtPosition`,value:function(e){var t=e.x,n=e.y,r=_n(this.webGLContexts.nodes,this.frameBuffers.nodes,t,n,this.pixelRatio,this.pickingDownSizingRatio),i=gn.apply(void 0,si(r)),a=this.itemIDsIndex[i];return a&&a.type===`node`?a.id:null}},{key:`bindEventHandlers`,value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener(`resize`,this.activeListeners.handleResize),this.activeListeners.handleMove=function(t){var n=qr(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}},i=e.getNodeAtPosition(n);if(i&&e.hoveredNode!==i&&!e.nodeDataCache[i].hidden){e.hoveredNode&&e.emit(`leaveNode`,W(W({},r),{},{node:e.hoveredNode})),e.hoveredNode=i,e.emit(`enterNode`,W(W({},r),{},{node:i})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(n)!==e.hoveredNode){var a=e.hoveredNode;e.hoveredNode=null,e.emit(`leaveNode`,W(W({},r),{},{node:a})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var o=e.hoveredNode?null:e.getEdgeAtPoint(r.event.x,r.event.y);o!==e.hoveredEdge&&(e.hoveredEdge&&e.emit(`leaveEdge`,W(W({},r),{},{edge:e.hoveredEdge})),o&&e.emit(`enterEdge`,W(W({},r),{},{edge:o})),e.hoveredEdge=o)}},this.activeListeners.handleMoveBody=function(t){var n=qr(t);e.emit(`moveBody`,{event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(t){var n=qr(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.hoveredNode&&(e.emit(`leaveNode`,W(W({},r),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit(`leaveEdge`,W(W({},r),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit(`leaveStage`,W({},r))},this.activeListeners.handleEnter=function(t){var n=qr(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.emit(`enterStage`,W({},r))};var t=function(t){return function(n){var r=qr(n),i={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}},a=e.getNodeAtPosition(r);if(a)return e.emit(`${t}Node`,W(W({},i),{},{node:a}));if(e.settings.enableEdgeEvents){var o=e.getEdgeAtPoint(r.x,r.y);if(o)return e.emit(`${t}Edge`,W(W({},i),{},{edge:o}))}return e.emit(`${t}Stage`,i)}};return this.activeListeners.handleClick=t(`click`),this.activeListeners.handleRightClick=t(`rightClick`),this.activeListeners.handleDoubleClick=t(`doubleClick`),this.activeListeners.handleWheel=t(`wheel`),this.activeListeners.handleDown=t(`down`),this.activeListeners.handleUp=t(`up`),this.mouseCaptor.on(`mousemove`,this.activeListeners.handleMove),this.mouseCaptor.on(`mousemovebody`,this.activeListeners.handleMoveBody),this.mouseCaptor.on(`click`,this.activeListeners.handleClick),this.mouseCaptor.on(`rightClick`,this.activeListeners.handleRightClick),this.mouseCaptor.on(`doubleClick`,this.activeListeners.handleDoubleClick),this.mouseCaptor.on(`wheel`,this.activeListeners.handleWheel),this.mouseCaptor.on(`mousedown`,this.activeListeners.handleDown),this.mouseCaptor.on(`mouseup`,this.activeListeners.handleUp),this.mouseCaptor.on(`mouseleave`,this.activeListeners.handleLeave),this.mouseCaptor.on(`mouseenter`,this.activeListeners.handleEnter),this.touchCaptor.on(`touchdown`,this.activeListeners.handleDown),this.touchCaptor.on(`touchdown`,this.activeListeners.handleMove),this.touchCaptor.on(`touchup`,this.activeListeners.handleUp),this.touchCaptor.on(`touchmove`,this.activeListeners.handleMove),this.touchCaptor.on(`tap`,this.activeListeners.handleClick),this.touchCaptor.on(`doubletap`,this.activeListeners.handleDoubleClick),this.touchCaptor.on(`touchmove`,this.activeListeners.handleMoveBody),this}},{key:`bindGraphHandlers`,value:function(){var e=this,t=this.graph,n=new Set([`x`,`y`,`zIndex`,`type`]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(r){var i=r.hints?.attributes;e.graph.forEachNode(function(t){return e.updateNode(t)});var a=!i||i.some(function(e){return n.has(e)});e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!a,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(n){var r=n.hints?.attributes;e.graph.forEachEdge(function(t){return e.updateEdge(t)});var i=r&&[`zIndex`,`type`].some(function(e){return r?.includes(e)});e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!i,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(t){var n=t.key;e.addNode(n),e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(t){var n=t.key;e.removeNode(n),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(t){var n=t.key;e.addEdge(n),e.refresh({partialGraph:{edges:[n]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{edges:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(t){var n=t.key;e.removeEdge(n),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on(`nodeAdded`,this.activeListeners.addNodeGraphUpdate),t.on(`nodeDropped`,this.activeListeners.dropNodeGraphUpdate),t.on(`nodeAttributesUpdated`,this.activeListeners.updateNodeGraphUpdate),t.on(`eachNodeAttributesUpdated`,this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on(`edgeAdded`,this.activeListeners.addEdgeGraphUpdate),t.on(`edgeDropped`,this.activeListeners.dropEdgeGraphUpdate),t.on(`edgeAttributesUpdated`,this.activeListeners.updateEdgeGraphUpdate),t.on(`eachEdgeAttributesUpdated`,this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on(`edgesCleared`,this.activeListeners.clearEdgesGraphUpdate),t.on(`cleared`,this.activeListeners.clearGraphUpdate),this}},{key:`unbindGraphHandlers`,value:function(){var e=this.graph;e.removeListener(`nodeAdded`,this.activeListeners.addNodeGraphUpdate),e.removeListener(`nodeDropped`,this.activeListeners.dropNodeGraphUpdate),e.removeListener(`nodeAttributesUpdated`,this.activeListeners.updateNodeGraphUpdate),e.removeListener(`eachNodeAttributesUpdated`,this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener(`edgeAdded`,this.activeListeners.addEdgeGraphUpdate),e.removeListener(`edgeDropped`,this.activeListeners.dropEdgeGraphUpdate),e.removeListener(`edgeAttributesUpdated`,this.activeListeners.updateEdgeGraphUpdate),e.removeListener(`eachEdgeAttributesUpdated`,this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener(`edgesCleared`,this.activeListeners.clearEdgesGraphUpdate),e.removeListener(`cleared`,this.activeListeners.clearGraphUpdate)}},{key:`getEdgeAtPoint`,value:function(e,t){var n=_n(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),r=gn.apply(void 0,si(n)),i=this.itemIDsIndex[r];return i&&i.type===`edge`?i.id:null}},{key:`process`,value:function(){var e=this;this.emit(`beforeProcess`);var t=this.graph,n=this.settings,r=this.getDimensions();if(this.nodeExtent=kr(this.graph),!this.settings.autoRescale){var i=r.width,a=r.height,o=this.nodeExtent,s=o.x,c=o.y;this.nodeExtent={x:[(s[0]+s[1])/2-i/2,(s[0]+s[1])/2+i/2],y:[(c[0]+c[1])/2-a/2,(c[0]+c[1])/2+a/2]}}this.normalizationFunction=Pr(this.customBBox||this.nodeExtent);var l=Dr(new Wr().getState(),r,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(r,n.labelGridCellSize);for(var u={},d={},f={},p={},m=1,h=t.nodes(),g=0,_=h.length;g<_;g++){var v=h[g],y=this.nodeDataCache[v],b=t.getNodeAttributes(v);y.x=b.x,y.y=b.y,this.normalizationFunction.applyTo(y),typeof y.label==`string`&&!y.hidden&&this.labelGrid.add(v,y.size,this.framedGraphToViewport(y,{matrix:l})),u[y.type]=(u[y.type]||0)+1}for(var x in this.labelGrid.organize(),this.nodePrograms){if(!hi.call(this.nodePrograms,x))throw Error(`Sigma: could not find a suitable program for node type "${x}"!`);this.nodePrograms[x].reallocate(u[x]||0),u[x]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(h=Nr(this.nodeZExtent,function(t){return e.nodeDataCache[t].zIndex},h));for(var S=0,C=h.length;S<C;S++){var w=h[S];d[w]=m,p[d[w]]={type:`node`,id:w},m++;var ee=this.nodeDataCache[w];this.addNodeToProgram(w,d[w],u[ee.type]++)}for(var T={},E=t.edges(),te=0,ne=E.length;te<ne;te++){var re=E[te],D=this.edgeDataCache[re];T[D.type]=(T[D.type]||0)+1}for(var O in this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(E=Nr(this.edgeZExtent,function(t){return e.edgeDataCache[t].zIndex},E)),this.edgePrograms){if(!hi.call(this.edgePrograms,O))throw Error(`Sigma: could not find a suitable program for edge type "${O}"!`);this.edgePrograms[O].reallocate(T[O]||0),T[O]=0}for(var k=0,A=E.length;k<A;k++){var j=E[k];f[j]=m,p[f[j]]={type:`edge`,id:j},m++;var M=this.edgeDataCache[j];this.addEdgeToProgram(j,f[j],T[M.type]++)}return this.itemIDsIndex=p,this.nodeIndices=d,this.edgeIndices=f,this.emit(`afterProcess`),this}},{key:`handleSettingsUpdate`,value:function(e){var t=this,n=this.settings;if(this.camera.minRatio=n.minCameraRatio,this.camera.maxRatio=n.maxCameraRatio,this.camera.enabledZooming=n.enableCameraZooming,this.camera.enabledPanning=n.enableCameraPanning,this.camera.enabledRotation=n.enableCameraRotation,n.cameraPanBoundaries?this.camera.clean=function(e){return t.cleanCameraState(e,n.cameraPanBoundaries&&Fr(n.cameraPanBoundaries)===`object`?n.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==n.edgeProgramClasses){for(var r in n.edgeProgramClasses)n.edgeProgramClasses[r]!==e.edgeProgramClasses[r]&&this.registerEdgeProgram(r,n.edgeProgramClasses[r]);for(var i in e.edgeProgramClasses)n.edgeProgramClasses[i]||this.unregisterEdgeProgram(i)}if(e.nodeProgramClasses!==n.nodeProgramClasses||e.nodeHoverProgramClasses!==n.nodeHoverProgramClasses){for(var a in n.nodeProgramClasses)(n.nodeProgramClasses[a]!==e.nodeProgramClasses[a]||n.nodeHoverProgramClasses[a]!==e.nodeHoverProgramClasses[a])&&this.registerNodeProgram(a,n.nodeProgramClasses[a],n.nodeHoverProgramClasses[a]);for(var o in e.nodeProgramClasses)n.nodeProgramClasses[o]||this.unregisterNodeProgram(o)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:`cleanCameraState`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.tolerance,r=n===void 0?0:n,i=t.boundaries,a=W({},e),o=i||this.nodeExtent,s=tn(o.x,2),c=s[0],l=s[1],u=tn(o.y,2),d=u[0],f=u[1],p=[this.graphToViewport({x:c,y:d},{cameraState:e}),this.graphToViewport({x:l,y:d},{cameraState:e}),this.graphToViewport({x:c,y:f},{cameraState:e}),this.graphToViewport({x:l,y:f},{cameraState:e})],m=1/0,h=-1/0,g=1/0,_=-1/0;p.forEach(function(e){var t=e.x,n=e.y;m=Math.min(m,t),h=Math.max(h,t),g=Math.min(g,n),_=Math.max(_,n)});var v=h-m,y=_-g,b=this.getDimensions(),x=b.width,S=b.height,C=0,w=0;if(v>=x?h<x-r?C=h-(x-r):m>r&&(C=m-r):h>x+r?C=h-(x+r):m<-r&&(C=m+r),y>=S?_<S-r?w=_-(S-r):g>r&&(w=g-r):_>S+r?w=_-(S+r):g<-r&&(w=g+r),C||w){var ee=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),T=this.viewportToFramedGraph({x:C,y:w},{cameraState:e});C=T.x-ee.x,w=T.y-ee.y,a.x+=C,a.y+=w}return a}},{key:`renderLabels`,value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);Ir(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var n=this.canvasContexts.labels,r=0,i=t.length;r<i;r++){var a=t[r],o=this.nodeDataCache[a];if(!this.displayedNodeLabels.has(a)&&!o.hidden){var s=this.framedGraphToViewport(o),c=s.x,l=s.y,u=this.scaleSize(o.size);if(!(!o.forceLabel&&u<this.settings.labelRenderedSizeThreshold)&&!(c<-pi||c>this.width+pi||l<-mi||l>this.height+mi)){this.displayedNodeLabels.add(a);var d=this.settings.defaultDrawNodeLabel;(this.nodePrograms[o.type]?.drawLabel||d)(n,W(W({key:a},o),{},{size:u,x:c,y:l}),this.settings)}}}return this}},{key:`renderEdgeLabels`,value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t=fi({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});Ir(t,this.edgesWithForcedLabels);for(var n=new Set,r=0,i=t.length;r<i;r++){var a=t[r],o=this.graph.extremities(a),s=this.nodeDataCache[o[0]],c=this.nodeDataCache[o[1]],l=this.edgeDataCache[a];if(!n.has(a)&&!(l.hidden||s.hidden||c.hidden)){var u=this.settings.defaultDrawEdgeLabel;(this.edgePrograms[l.type]?.drawLabel||u)(e,W(W({key:a},l),{},{size:this.scaleSize(l.size)}),W(W(W({key:o[0]},s),this.framedGraphToViewport(s)),{},{size:this.scaleSize(s.size)}),W(W(W({key:o[1]},c),this.framedGraphToViewport(c)),{},{size:this.scaleSize(c.size)}),this.settings),n.add(a)}}return this.displayedEdgeLabels=n,this}},{key:`renderHighlightedNodes`,value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var n=function(n){var r=e.nodeDataCache[n],i=e.framedGraphToViewport(r),a=i.x,o=i.y,s=e.scaleSize(r.size),c=e.settings.defaultDrawNodeHover;(e.nodePrograms[r.type]?.drawHover||c)(t,W(W({key:n},r),{},{size:s,x:a,y:o}),e.settings)},r=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&r.push(this.hoveredNode),this.highlightedNodes.forEach(function(t){t!==e.hoveredNode&&r.push(t)}),r.forEach(function(e){return n(e)});var i={};for(var a in r.forEach(function(t){var n=e.nodeDataCache[t].type;i[n]=(i[n]||0)+1}),this.nodeHoverPrograms)this.nodeHoverPrograms[a].reallocate(i[a]||0),i[a]=0;r.forEach(function(t){var n=e.nodeDataCache[t];e.nodeHoverPrograms[n.type].process(0,i[n.type]++,n)}),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var o=this.getRenderParams();for(var s in this.nodeHoverPrograms)this.nodeHoverPrograms[s].render(o)}},{key:`scheduleHighlightedNodesRender`,value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()}))}},{key:`render`,value:function(){var e=this;this.emit(`beforeRender`);var t=function(){return e.emit(`afterRender`),e};if(this.renderFrame&&=(cancelAnimationFrame(this.renderFrame),null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach(function(t){return e.resetWebGLTexture(t)}),!this.graph.order)return t();var n=this.mouseCaptor,r=this.camera.isAnimated()||n.isMoving||n.draggedEvents||n.currentWheelDirection,i=this.camera.getState(),a=this.getDimensions(),o=this.getGraphDimensions(),s=this.getStagePadding();this.matrix=Dr(i,a,o,s),this.invMatrix=Dr(i,a,o,s,!0),this.correctionRatio=Or(this.matrix,i,a),this.graphToViewportRatio=this.getGraphToViewportRatio();var c=this.getRenderParams();for(var l in this.nodePrograms)this.nodePrograms[l].render(c);if(!this.settings.hideEdgesOnMove||!r)for(var u in this.edgePrograms)this.edgePrograms[u].render(c);return this.settings.hideLabelsOnMove&&r?t():(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes(),t())}},{key:`addNode`,value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var n=gi(this.settings,e,t);this.nodeDataCache[e]=n,this.nodesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),n.highlighted&&!n.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(n.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=n.zIndex),n.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=n.zIndex))}},{key:`updateNode`,value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:`removeNode`,value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:`addEdge`,value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var n=_i(this.settings,e,t);this.edgeDataCache[e]=n,this.edgesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(n.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=n.zIndex),n.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=n.zIndex))}},{key:`updateEdge`,value:function(e){this.addEdge(e)}},{key:`removeEdge`,value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:`clearNodeIndices`,value:function(){this.labelGrid=new di,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:`clearEdgeIndices`,value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:`clearIndices`,value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:`clearNodeState`,value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:`clearEdgeState`,value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:`clearState`,value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:`addNodeToProgram`,value:function(e,t,n){var r=this.nodeDataCache[e],i=this.nodePrograms[r.type];if(!i)throw Error(`Sigma: could not find a suitable program for node type "${r.type}"!`);i.process(t,n,r),this.nodeProgramIndex[e]=n}},{key:`addEdgeToProgram`,value:function(e,t,n){var r=this.edgeDataCache[e],i=this.edgePrograms[r.type];if(!i)throw Error(`Sigma: could not find a suitable program for edge type "${r.type}"!`);var a=this.graph.extremities(e),o=this.nodeDataCache[a[0]],s=this.nodeDataCache[a[1]];i.process(t,n,o,s,r),this.edgeProgramIndex[e]=n}},{key:`getRenderParams`,value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:`getStagePadding`,value:function(){var e=this.settings,t=e.stagePadding;return e.autoRescale&&t||0}},{key:`createLayer`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw Error(`Sigma: a layer named "${e}" already exists`);var r=jr(t,{position:`absolute`},{class:`sigma-${e}`});return n.style&&Object.assign(r.style,n.style),this.elements[e]=r,`beforeLayer`in n&&n.beforeLayer?this.elements[n.beforeLayer].before(r):`afterLayer`in n&&n.afterLayer?this.elements[n.afterLayer].after(r):this.container.appendChild(r),r}},{key:`createCanvas`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,`canvas`,t)}},{key:`createCanvasContext`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.createCanvas(e,t),r={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=n.getContext(`2d`,r),this}},{key:`createWebGLContext`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t?.canvas||this.createCanvas(e,t);t.hidden&&n.remove();var r=W({preserveDrawingBuffer:!1,antialias:!1},t),i=n.getContext(`webgl2`,r);i||=n.getContext(`webgl`,r),i||=n.getContext(`experimental-webgl`,r);var a=i;if(this.webGLContexts[e]=a,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var o=a.createFramebuffer();if(!o)throw Error(`Sigma: cannot create a new frame buffer for layer ${e}`);this.frameBuffers[e]=o}return a}},{key:`killLayer`,value:function(e){var t=this.elements[e];if(!t)throw Error(`Sigma: cannot kill layer ${e}, which does not exist`);if(this.webGLContexts[e]){var n;(n=this.webGLContexts[e].getExtension(`WEBGL_lose_context`))==null||n.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return t.remove(),delete this.elements[e],this}},{key:`getCamera`,value:function(){return this.camera}},{key:`setCamera`,value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:`getContainer`,value:function(){return this.container}},{key:`getGraph`,value:function(){return this.graph}},{key:`setGraph`,value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:`getMouseCaptor`,value:function(){return this.mouseCaptor}},{key:`getTouchCaptor`,value:function(){return this.touchCaptor}},{key:`getDimensions`,value:function(){return{width:this.width,height:this.height}}},{key:`getGraphDimensions`,value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:`getNodeDisplayData`,value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:`getEdgeDisplayData`,value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:`getNodeDisplayedLabels`,value:function(){return new Set(this.displayedNodeLabels)}},{key:`getEdgeDisplayedLabels`,value:function(){return new Set(this.displayedEdgeLabels)}},{key:`getSettings`,value:function(){return W({},this.settings)}},{key:`getSetting`,value:function(e){return this.settings[e]}},{key:`setSetting`,value:function(e,t){var n=W({},this.settings);return this.settings[e]=t,Vr(this.settings),this.handleSettingsUpdate(n),this.scheduleRefresh(),this}},{key:`updateSetting`,value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:`setSettings`,value:function(e){var t=W({},this.settings);return this.settings=W(W({},this.settings),e),Vr(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:`resize`,value:function(e){var t=this.width,n=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=Mr(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw Error(`Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.`);if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw Error(`Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.`);if(!e&&t===this.width&&n===this.height)return this;for(var r in this.elements){var i=this.elements[r];i.style.width=this.width+`px`,i.style.height=this.height+`px`}for(var a in this.canvasContexts)this.elements[a].setAttribute(`width`,this.width*this.pixelRatio+`px`),this.elements[a].setAttribute(`height`,this.height*this.pixelRatio+`px`),this.pixelRatio!==1&&this.canvasContexts[a].scale(this.pixelRatio,this.pixelRatio);for(var o in this.webGLContexts){this.elements[o].setAttribute(`width`,this.width*this.pixelRatio+`px`),this.elements[o].setAttribute(`height`,this.height*this.pixelRatio+`px`);var s=this.webGLContexts[o];if(s.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(o)){var c=this.textures[o];c&&s.deleteTexture(c)}}return this.emit(`resize`),this}},{key:`clear`,value:function(){return this.emit(`beforeClear`),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit(`afterClear`),this}},{key:`refresh`,value:function(e){var t=this,n=e?.skipIndexation===void 0?!1:e?.skipIndexation,r=e?.schedule===void 0?!1:e.schedule,i=!e||!e.partialGraph;if(i)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(e){return t.addNode(e)}),this.graph.forEachEdge(function(e){return t.addEdge(e)});else{for(var a,o=e.partialGraph?.nodes||[],s=0,c=o?.length||0;s<c;s++){var l=o[s];if(this.updateNode(l),n){var u=this.nodeProgramIndex[l];if(u===void 0)throw Error(`Sigma: node "${l}" can't be repaint`);this.addNodeToProgram(l,this.nodeIndices[l],u)}}for(var d=(e==null||(a=e.partialGraph)==null?void 0:a.edges)||[],f=0,p=d.length;f<p;f++){var m=d[f];if(this.updateEdge(m),n){var h=this.edgeProgramIndex[m];if(h===void 0)throw Error(`Sigma: edge "${m}" can't be repaint`);this.addEdgeToProgram(m,this.edgeIndices[m],h)}}}return(i||!n)&&(this.needToProcess=!0),r?this.scheduleRender():this.render(),this}},{key:`scheduleRender`,value:function(){var e=this;return this.renderFrame||=requestAnimationFrame(function(){e.render()}),this}},{key:`scheduleRefresh`,value:function(e){return this.refresh(W(W({},e),{},{schedule:!0}))}},{key:`getViewportZoomedState`,value:function(e,t){var n=this.camera.getState(),r=n.ratio,i=n.angle,a=n.x,o=n.y,s=this.settings,c=s.minCameraRatio,l=s.maxCameraRatio;typeof l==`number`&&(t=Math.min(t,l)),typeof c==`number`&&(t=Math.max(t,c));var u=t/r,d={x:this.width/2,y:this.height/2},f=this.viewportToFramedGraph(e),p=this.viewportToFramedGraph(d);return{angle:i,x:(f.x-p.x)*(1-u)+a,y:(f.y-p.y)*(1-u)+o,ratio:t}}},{key:`viewRectangle`,value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),n=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-n.y}}},{key:`framedGraphToViewport`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,r=Tr(t.matrix?t.matrix:n?Dr(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,e);return{x:(1+r.x)*this.width/2,y:(1-r.y)*this.height/2}}},{key:`viewportToFramedGraph`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,r=Tr(t.matrix?t.matrix:n?Dr(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(r.x)&&(r.x=0),isNaN(r.y)&&(r.y=0),r}},{key:`viewportToGraph`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:`graphToViewport`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:`getGraphToViewportRatio`,value:function(){var e={x:0,y:0},t={x:1,y:1},n=Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),r=this.graphToViewport(e),i=this.graphToViewport(t);return Math.sqrt((r.x-i.x)**2+(r.y-i.y)**2)/n}},{key:`getBBox`,value:function(){return this.nodeExtent}},{key:`getCustomBBox`,value:function(){return this.customBBox}},{key:`setCustomBBox`,value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:`kill`,value:function(){this.emit(`kill`),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener(`resize`,this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&=(cancelAnimationFrame(this.renderFrame),null),this.renderHighlightedNodesFrame&&=(cancelAnimationFrame(this.renderHighlightedNodesFrame),null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.nodePrograms)this.nodePrograms[t].kill();for(var n in this.nodeHoverPrograms)this.nodeHoverPrograms[n].kill();for(var r in this.edgePrograms)this.edgePrograms[r].kill();for(var i in this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={},this.elements)this.killLayer(i);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:`scaleSize`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*(this.getSetting(`itemSizesReference`)===`positions`?t*this.graphToViewportRatio:1)}},{key:`getCanvases`,value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])}(hr),yi=o((e=>{function t(e){return typeof e!=`number`||isNaN(e)?1:e}function n(e,t){var n={},r=function(e){return e===void 0?t:e};typeof t==`function`&&(r=t);var i=function(t){return r(t[e])},a=function(){return r(void 0)};return typeof e==`string`?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getNodeAttributes(t))},n.fromEntry=function(e,t){return i(t)}):typeof e==`function`?(n.fromAttributes=function(){throw Error(`graphology-utils/getters/createNodeValueGetter: irrelevant usage.`)},n.fromGraph=function(t,n){return r(e(n,t.getNodeAttributes(n)))},n.fromEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=a,n.fromGraph=a,n.fromEntry=a),n}function r(e,t){var n={},r=function(e){return e===void 0?t:e};typeof t==`function`&&(r=t);var i=function(t){return r(t[e])},a=function(){return r(void 0)};return typeof e==`string`?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return i(t)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):typeof e==`function`?(n.fromAttributes=function(){throw Error(`graphology-utils/getters/createEdgeValueGetter: irrelevant usage.`)},n.fromGraph=function(t,n){var i=t.extremities(n);return r(e(n,t.getEdgeAttributes(n),i[0],i[1],t.getNodeAttributes(i[0]),t.getNodeAttributes(i[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,i,a,o,s,c){return r(e(t,n,i,a,o,s,c))},n.fromPartialEntry=function(t,n,i,a){return r(e(t,n,i,a))},n.fromMinimalEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=a,n.fromGraph=a,n.fromEntry=a,n.fromMinimalEntry=a),n}e.createNodeValueGetter=n,e.createEdgeValueGetter=r,e.createEdgeWeightGetter=function(e){return r(e,t)}})),bi=o(((e,t)=>{var n=0,r=1,i=2,a=3,o=4,s=5,c=6,l=7,u=8,d=9,f=0,p=1,m=2,h=0,g=1,_=2,v=3,y=4,b=5,x=6,S=7,C=8,w=3,ee=10,T=3,E=9,te=10;t.exports=function(e,t,ne){var re,D,O,k,A,j,M,N,P,ie,ae=t.length,oe=ne.length,se=e.adjustSizes,F=e.barnesHutTheta*e.barnesHutTheta,ce,I,L,R,z,B,V,H=[];for(O=0;O<ae;O+=ee)t[O+o]=t[O+i],t[O+s]=t[O+a],t[O+i]=0,t[O+a]=0;if(e.outboundAttractionDistribution){for(ce=0,O=0;O<ae;O+=ee)ce+=t[O+c];ce/=ae/ee}if(e.barnesHutOptimize){var le=1/0,ue=-1/0,de=1/0,fe=-1/0,pe,me,he;for(O=0;O<ae;O+=ee)le=Math.min(le,t[O+n]),ue=Math.max(ue,t[O+n]),de=Math.min(de,t[O+r]),fe=Math.max(fe,t[O+r]);var ge=ue-le,_e=fe-de;for(ge>_e?(de-=(ge-_e)/2,fe=de+ge):(le-=(_e-ge)/2,ue=le+_e),H[0+h]=-1,H[0+g]=(le+ue)/2,H[0+_]=(de+fe)/2,H[0+v]=Math.max(ue-le,fe-de),H[0+y]=-1,H[0+b]=-1,H[0+x]=0,H[0+S]=0,H[0+C]=0,re=1,O=0;O<ae;O+=ee)for(D=0,he=w;;)if(H[D+b]>=0){pe=t[O+n]<H[D+g]?t[O+r]<H[D+_]?H[D+b]:H[D+b]+E:t[O+r]<H[D+_]?H[D+b]+E*2:H[D+b]+E*3,H[D+S]=(H[D+S]*H[D+x]+t[O+n]*t[O+c])/(H[D+x]+t[O+c]),H[D+C]=(H[D+C]*H[D+x]+t[O+r]*t[O+c])/(H[D+x]+t[O+c]),H[D+x]+=t[O+c],D=pe;continue}else if(H[D+h]<0){H[D+h]=O;break}else{if(H[D+b]=re*E,N=H[D+v]/2,P=H[D+b],H[P+h]=-1,H[P+g]=H[D+g]-N,H[P+_]=H[D+_]-N,H[P+v]=N,H[P+y]=P+E,H[P+b]=-1,H[P+x]=0,H[P+S]=0,H[P+C]=0,P+=E,H[P+h]=-1,H[P+g]=H[D+g]-N,H[P+_]=H[D+_]+N,H[P+v]=N,H[P+y]=P+E,H[P+b]=-1,H[P+x]=0,H[P+S]=0,H[P+C]=0,P+=E,H[P+h]=-1,H[P+g]=H[D+g]+N,H[P+_]=H[D+_]-N,H[P+v]=N,H[P+y]=P+E,H[P+b]=-1,H[P+x]=0,H[P+S]=0,H[P+C]=0,P+=E,H[P+h]=-1,H[P+g]=H[D+g]+N,H[P+_]=H[D+_]+N,H[P+v]=N,H[P+y]=H[D+y],H[P+b]=-1,H[P+x]=0,H[P+S]=0,H[P+C]=0,re+=4,pe=t[H[D+h]+n]<H[D+g]?t[H[D+h]+r]<H[D+_]?H[D+b]:H[D+b]+E:t[H[D+h]+r]<H[D+_]?H[D+b]+E*2:H[D+b]+E*3,H[D+x]=t[H[D+h]+c],H[D+S]=t[H[D+h]+n],H[D+C]=t[H[D+h]+r],H[pe+h]=H[D+h],H[D+h]=-1,me=t[O+n]<H[D+g]?t[O+r]<H[D+_]?H[D+b]:H[D+b]+E:t[O+r]<H[D+_]?H[D+b]+E*2:H[D+b]+E*3,pe===me)if(he--){D=pe;continue}else{he=w;break}H[me+h]=O;break}}if(e.barnesHutOptimize)for(I=e.scalingRatio,O=0;O<ae;O+=ee)for(D=0;;)if(H[D+b]>=0)if(B=(t[O+n]-H[D+S])**2+(t[O+r]-H[D+C])**2,ie=H[D+v],4*ie*ie/B<F){if(L=t[O+n]-H[D+S],R=t[O+r]-H[D+C],se===!0?B>0?(V=I*t[O+c]*H[D+x]/B,t[O+i]+=L*V,t[O+a]+=R*V):B<0&&(V=-I*t[O+c]*H[D+x]/Math.sqrt(B),t[O+i]+=L*V,t[O+a]+=R*V):B>0&&(V=I*t[O+c]*H[D+x]/B,t[O+i]+=L*V,t[O+a]+=R*V),D=H[D+y],D<0)break;continue}else{D=H[D+b];continue}else{if(j=H[D+h],j>=0&&j!==O&&(L=t[O+n]-t[j+n],R=t[O+r]-t[j+r],B=L*L+R*R,se===!0?B>0?(V=I*t[O+c]*t[j+c]/B,t[O+i]+=L*V,t[O+a]+=R*V):B<0&&(V=-I*t[O+c]*t[j+c]/Math.sqrt(B),t[O+i]+=L*V,t[O+a]+=R*V):B>0&&(V=I*t[O+c]*t[j+c]/B,t[O+i]+=L*V,t[O+a]+=R*V)),D=H[D+y],D<0)break;continue}else for(I=e.scalingRatio,k=0;k<ae;k+=ee)for(A=0;A<k;A+=ee)L=t[k+n]-t[A+n],R=t[k+r]-t[A+r],se===!0?(B=Math.sqrt(L*L+R*R)-t[k+u]-t[A+u],B>0?(V=I*t[k+c]*t[A+c]/B/B,t[k+i]+=L*V,t[k+a]+=R*V,t[A+i]-=L*V,t[A+a]-=R*V):B<0&&(V=100*I*t[k+c]*t[A+c],t[k+i]+=L*V,t[k+a]+=R*V,t[A+i]-=L*V,t[A+a]-=R*V)):(B=Math.sqrt(L*L+R*R),B>0&&(V=I*t[k+c]*t[A+c]/B/B,t[k+i]+=L*V,t[k+a]+=R*V,t[A+i]-=L*V,t[A+a]-=R*V));for(P=e.gravity/e.scalingRatio,I=e.scalingRatio,O=0;O<ae;O+=ee)V=0,L=t[O+n],R=t[O+r],B=Math.sqrt(L**2+R**2),e.strongGravityMode?B>0&&(V=I*t[O+c]*P):B>0&&(V=I*t[O+c]*P/B),t[O+i]-=L*V,t[O+a]-=R*V;for(I=1*(e.outboundAttractionDistribution?ce:1),M=0;M<oe;M+=T)k=ne[M+f],A=ne[M+p],N=ne[M+m],z=N**+e.edgeWeightInfluence,L=t[k+n]-t[A+n],R=t[k+r]-t[A+r],se===!0?(B=Math.sqrt(L*L+R*R)-t[k+u]-t[A+u],e.linLogMode?e.outboundAttractionDistribution?B>0&&(V=-I*z*Math.log(1+B)/B/t[k+c]):B>0&&(V=-I*z*Math.log(1+B)/B):e.outboundAttractionDistribution?B>0&&(V=-I*z/t[k+c]):B>0&&(V=-I*z)):(B=Math.sqrt(L**2+R**2),e.linLogMode?e.outboundAttractionDistribution?B>0&&(V=-I*z*Math.log(1+B)/B/t[k+c]):B>0&&(V=-I*z*Math.log(1+B)/B):e.outboundAttractionDistribution?(B=1,V=-I*z/t[k+c]):(B=1,V=-I*z)),B>0&&(t[k+i]+=L*V,t[k+a]+=R*V,t[A+i]-=L*V,t[A+a]-=R*V);var ve,ye,be,xe,Se,Ce;if(se===!0)for(O=0;O<ae;O+=ee)t[O+d]!==1&&(ve=Math.sqrt(t[O+i]**2+t[O+a]**2),ve>te&&(t[O+i]=t[O+i]*te/ve,t[O+a]=t[O+a]*te/ve),ye=t[O+c]*Math.sqrt((t[O+o]-t[O+i])*(t[O+o]-t[O+i])+(t[O+s]-t[O+a])*(t[O+s]-t[O+a])),be=Math.sqrt((t[O+o]+t[O+i])*(t[O+o]+t[O+i])+(t[O+s]+t[O+a])*(t[O+s]+t[O+a]))/2,xe=.1*Math.log(1+be)/(1+Math.sqrt(ye)),Se=t[O+n]+t[O+i]*(xe/e.slowDown),t[O+n]=Se,Ce=t[O+r]+t[O+a]*(xe/e.slowDown),t[O+r]=Ce);else for(O=0;O<ae;O+=ee)t[O+d]!==1&&(ye=t[O+c]*Math.sqrt((t[O+o]-t[O+i])*(t[O+o]-t[O+i])+(t[O+s]-t[O+a])*(t[O+s]-t[O+a])),be=Math.sqrt((t[O+o]+t[O+i])*(t[O+o]+t[O+i])+(t[O+s]+t[O+a])*(t[O+s]+t[O+a]))/2,xe=t[O+l]*Math.log(1+be)/(1+Math.sqrt(ye)),t[O+l]=Math.min(1,Math.sqrt(xe*(t[O+i]**2+t[O+a]**2)/(1+Math.sqrt(ye)))),Se=t[O+n]+t[O+i]*(xe/e.slowDown),t[O+n]=Se,Ce=t[O+r]+t[O+a]*(xe/e.slowDown),t[O+r]=Ce);return{}}})),xi=o((e=>{var t=10,n=3;e.assign=function(e){e||={};var t=Array.prototype.slice.call(arguments).slice(1),n,r,i;for(n=0,i=t.length;n<i;n++)if(t[n])for(r in t[n])e[r]=t[n][r];return e},e.validateSettings=function(e){return`linLogMode`in e&&typeof e.linLogMode!=`boolean`?{message:"the `linLogMode` setting should be a boolean."}:`outboundAttractionDistribution`in e&&typeof e.outboundAttractionDistribution!=`boolean`?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:`adjustSizes`in e&&typeof e.adjustSizes!=`boolean`?{message:"the `adjustSizes` setting should be a boolean."}:`edgeWeightInfluence`in e&&typeof e.edgeWeightInfluence!=`number`?{message:"the `edgeWeightInfluence` setting should be a number."}:`scalingRatio`in e&&!(typeof e.scalingRatio==`number`&&e.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:`strongGravityMode`in e&&typeof e.strongGravityMode!=`boolean`?{message:"the `strongGravityMode` setting should be a boolean."}:`gravity`in e&&!(typeof e.gravity==`number`&&e.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:`slowDown`in e&&!(typeof e.slowDown==`number`||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:`barnesHutOptimize`in e&&typeof e.barnesHutOptimize!=`boolean`?{message:"the `barnesHutOptimize` setting should be a boolean."}:`barnesHutTheta`in e&&!(typeof e.barnesHutTheta==`number`&&e.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},e.graphToByteArrays=function(e,r){var i=e.order,a=e.size,o={},s,c=new Float32Array(i*t),l=new Float32Array(a*n);return s=0,e.forEachNode(function(e,n){o[e]=s,c[s]=n.x,c[s+1]=n.y,c[s+2]=0,c[s+3]=0,c[s+4]=0,c[s+5]=0,c[s+6]=1,c[s+7]=1,c[s+8]=n.size||1,c[s+9]=+!!n.fixed,s+=t}),s=0,e.forEachEdge(function(e,t,i,a,u,d,f){var p=o[i],m=o[a],h=r(e,t,i,a,u,d,f);c[p+6]+=h,c[m+6]+=h,l[s]=p,l[s+1]=m,l[s+2]=h,s+=n}),{nodes:c,edges:l}},e.assignLayoutChanges=function(e,n,r){var i=0;e.updateEachNodeAttributes(function(e,a){return a.x=n[i],a.y=n[i+1],i+=t,r?r(e,a):a})},e.readGraphPositions=function(e,n){var r=0;e.forEachNode(function(e,i){n[r]=i.x,n[r+1]=i.y,r+=t})},e.collectLayoutChanges=function(e,n,r){for(var i=e.nodes(),a={},o=0,s=0,c=n.length;o<c;o+=t){if(r){var l=Object.assign({},e.getNodeAttributes(i[s]));l.x=n[o],l.y=n[o+1],l=r(i[s],l),a[i[s]]={x:l.x,y:l.y}}else a[i[s]]={x:n[o],y:n[o+1]};s++}return a},e.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),r=t.createObjectURL(new Blob([`(`+n+`).call(this);`],{type:`text/javascript`})),i=new Worker(r);return t.revokeObjectURL(r),i}})),Si=o(((e,t)=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}})),Ci=c(o(((e,t)=>{var n=gr(),r=yi().createEdgeWeightGetter,i=bi(),a=xi(),o=Si();function s(e,t,s){if(!n(t))throw Error(`graphology-layout-forceatlas2: the given graph is not a valid graphology instance.`);typeof s==`number`&&(s={iterations:s});var c=s.iterations;if(typeof c!=`number`)throw Error(`graphology-layout-forceatlas2: invalid number of iterations.`);if(c<=0)throw Error(`graphology-layout-forceatlas2: you should provide a positive number of iterations.`);var l=r(`getEdgeWeight`in s?s.getEdgeWeight:`weight`).fromEntry,u=typeof s.outputReducer==`function`?s.outputReducer:null,d=a.assign({},o,s.settings),f=a.validateSettings(d);if(f)throw Error(`graphology-layout-forceatlas2: `+f.message);var p=a.graphToByteArrays(t,l),m;for(m=0;m<c;m++)i(d,p.nodes,p.edges);if(e){a.assignLayoutChanges(t,p.nodes,u);return}return a.collectLayoutChanges(t,p.nodes)}function c(e){var t=typeof e==`number`?e:e.order;return{barnesHutOptimize:t>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(t)}}var l=s.bind(null,!1);l.assign=s.bind(null,!0),l.inferSettings=c,t.exports=l}))(),1),wi={function:`#22D3EE`,file:`#FB923C`,class:`#4ADE80`,interface:`#A78BFA`,enum:`#6366F1`,constant:`#FACC15`,type_alias:`#FB7185`,flow:`#14B8A6`,method:`#38BDF8`,constructor:`#06B6D4`,struct:`#86EFAC`,trait:`#C4B5FD`,variable:`#FDE68A`,property:`#FCA5A5`,namespace:`#818CF8`,module:`#E879F9`,route:`#F87171`,cluster:`#64748B`,directory:`#475569`},Ti={contains:`#334155`,calls:`#38bdf8`,imports:`#64748b`,extends:`#4ade80`,implements:`#f97316`,has_member:`#facc15`,accesses:`#06b6d4`,overrides:`#ef4444`,belongs_to:`#475569`,step_of:`#fb923c`,handles:`#fb7185`},Ei={contains:.08,calls:.55,imports:.25,extends:.5,implements:.45,has_member:.18,accesses:.3,overrides:.45,belongs_to:.1,step_of:.35,handles:.4};function Di(e,t){return`${e}${Math.round(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,`0`)}`}function Oi(e,t){let n=new Set([e]);for(let r of t)r.source===e?n.add(r.target):r.target===e&&n.add(r.source);return n}function G(e,t,n){let r=n.labelSize;if(e.font=`${n.labelWeight} ${r}px ${n.labelFont}`,typeof t.label==`string`&&t.label.length>0){let n=e.measureText(t.label).width,i=Math.round(n+6+6),a=Math.round(r+6),o=Math.max(t.size,r/2)+3,s=Math.asin(a/2/o),c=Math.sqrt(Math.abs(o**2-(a/2)**2));e.shadowOffsetX=0,e.shadowOffsetY=2,e.shadowBlur=12,e.shadowColor=`rgba(0,0,0,0.8)`,e.fillStyle=`#0c101f`,e.strokeStyle=`rgba(255,255,255,0.08)`,e.lineWidth=.8,e.beginPath(),e.moveTo(t.x+c,t.y+a/2),e.lineTo(t.x+o+i-4,t.y+a/2),e.quadraticCurveTo(t.x+o+i,t.y+a/2,t.x+o+i,t.y+a/2-4),e.lineTo(t.x+o+i,t.y-a/2+4),e.quadraticCurveTo(t.x+o+i,t.y-a/2,t.x+o+i-4,t.y-a/2),e.lineTo(t.x+c,t.y-a/2),e.arc(t.x,t.y,o,s,-s),e.closePath(),e.fill(),e.stroke(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0;let l=Math.max(t.size,r/2)+3;e.fillStyle=`#e2e8f0`,e.fillText(t.label,t.x+l+3+2,t.y+r/2-1)}else e.fillStyle=`#0c101f`,e.beginPath(),e.arc(t.x,t.y,t.size+3,0,Math.PI*2),e.closePath(),e.fill()}function ki(){let{state:e,dispatch:t}=T(),n=(0,b.useRef)(e);n.current=e;let r=(0,b.useRef)(t);r.current=t;let i=(0,b.useRef)(new jt({multi:!1,type:`directed`})),a=(0,b.useRef)(null),o=(0,b.useRef)(null),[s,c]=(0,b.useState)({nodes:0,edges:0}),l=(0,b.useRef)({nodeCount:-1,edgeCount:-1});return(0,b.useEffect)(()=>{if(e.nodes.length===0||l.current.nodeCount===e.nodes.length&&l.current.edgeCount===e.edges.length)return;l.current={nodeCount:e.nodes.length,edgeCount:e.edges.length};let t=i.current;t.clear();let r=0;for(let n of e.nodes){let i=r++/Math.max(1,e.nodes.length)*Math.PI*2,a=200+Math.random()*300;try{t.addNode(n.id,{label:n.name,baseLabel:n.name,x:Math.cos(i)*a+(Math.random()-.5)*50,y:Math.sin(i)*a+(Math.random()-.5)*50,size:Pi(n.kind),color:wi[n.kind]??`#6b7280`,nodeKind:n.kind})}catch{}}for(let n of e.edges)if(!(!t.hasNode(n.source)||!t.hasNode(n.target)||n.source===n.target))try{let e=Di(Ti[n.kind]??`#4b5563`,Ei[n.kind]??.25);t.addEdge(n.source,n.target,{color:e,baseColor:e,size:n.kind===`calls`?.8:n.kind===`imports`?.5:.4,type:`arrow`,edgeKind:n.kind})}catch{}if(t.order>0){let e=Ci.default.inferSettings(t);Ci.default.assign(t,{iterations:t.order>500?80:150,settings:{...e,gravity:1,scalingRatio:8,slowDown:5,barnesHutOptimize:t.order>200,adjustSizes:!0}})}let o=new Map;t.forEachNode(e=>o.set(e,t.degree(e)));let s=[...o.values()].sort((e,t)=>t-e);if(t._degreeMap=o,t._topNThreshold=s[Math.min(30,s.length-1)]??0,a.current){Ai(a.current,t,n.current,null,null),a.current.refresh();let e=0,r=0;t.forEachNode((t,n)=>{n.hidden||e++}),t.forEachEdge((e,t)=>{t.hidden||r++}),c({nodes:e,edges:r})}},[e.nodes,e.edges]),(0,b.useEffect)(()=>{if(!o.current||a.current)return;let e=i.current,t=new vi(e,o.current,{allowInvalidContainer:!0,renderEdgeLabels:!1,defaultEdgeType:`arrow`,labelRenderedSizeThreshold:4,labelFont:`"Inter", "SF Pro Display", system-ui, sans-serif`,labelColor:{color:`#e2e8f0`},labelSize:11,labelWeight:`600`,defaultDrawNodeHover:G});a.current=t,Ai(t,e,n.current,null,null),t.refresh();let s=!1;t.on(`clickNode`,({node:e})=>{s=!0;let t=n.current.nodes.find(t=>t.id===e);t&&r.current({type:`SELECT_NODE`,node:t}),setTimeout(()=>{s=!1},50)}),t.on(`clickStage`,()=>{s||r.current({type:`SELECT_NODE`,node:null})}),t.on(`enterNode`,({node:e})=>r.current({type:`HOVER_NODE`,nodeId:e})),t.on(`leaveNode`,()=>r.current({type:`HOVER_NODE`,nodeId:null}));let c=e=>{let n=e.detail,r=t.getCamera();n===0?r.animatedReset():r.animate({ratio:r.getState().ratio*n},{duration:200})};return window.addEventListener(`graph-zoom`,c),()=>{window.removeEventListener(`graph-zoom`,c),t.kill(),a.current=null}},[]),(0,b.useEffect)(()=>{let t=a.current;if(!t)return;Ai(t,i.current,e,e.hoveredNodeId,e.selectedNode?.id??null),t.refresh();let n=0,r=0;i.current.forEachNode((e,t)=>{t.hidden||n++}),i.current.forEachEdge((e,t)=>{t.hidden||r++}),c({nodes:n,edges:r})},[e.filters,e.hoveredNodeId,e.selectedNode]),(0,b.useEffect)(()=>{let t=a.current;if(!t||!e.selectedNode)return;let n=t.getNodeDisplayData(e.selectedNode.id);n&&t.getCamera().animate({x:n.x,y:n.y,ratio:Math.min(t.getCamera().getState().ratio,.5)},{duration:400,easing:`quadraticInOut`})},[e.selectedNode?.id]),(0,x.jsxs)(`div`,{className:`relative w-full h-full bg-[#040812]`,children:[(0,x.jsx)(`div`,{ref:o,className:`absolute inset-0`}),(0,x.jsxs)(`div`,{className:`absolute top-3 left-3 flex items-center gap-2 bg-gray-950/90 backdrop-blur border border-gray-800/60 rounded-lg px-3 py-1.5 text-[10px] text-gray-400 font-mono pointer-events-none shadow-lg`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-green-400 animate-pulse`}),(0,x.jsx)(`span`,{className:`text-gray-200`,children:s.nodes}),(0,x.jsx)(`span`,{className:`text-gray-600`,children:`nodes`}),(0,x.jsx)(`span`,{className:`text-gray-700`,children:`·`}),(0,x.jsx)(`span`,{className:`text-gray-200`,children:s.edges}),(0,x.jsx)(`span`,{className:`text-gray-600`,children:`edges`})]}),(0,x.jsx)(Mi,{}),(0,x.jsx)(Ni,{})]})}function Ai(e,t,n,r,i){let a=t._topNThreshold??0,o=t._degreeMap??new Map,s=r??i,c=s?Oi(s,n.edges):null,l=n.filters.hiddenNodeKinds,u=n.filters.hiddenEdgeKinds,d=null;i&&n.filters.focusDepth!==`all`&&typeof n.filters.focusDepth==`number`&&(d=ji(i,n.edges,n.filters.focusDepth)),e.setSetting(`nodeReducer`,(e,t)=>{let n=t.nodeKind;if(l.has(n)||d&&!d.has(e))return{...t,hidden:!0};let r=wi[n]??t.color,i=(o.get(e)??0)>=a?t.baseLabel??t.label:``;return c?c.has(e)?{...t,hidden:!1,color:r,label:t.baseLabel??t.label,zIndex:2,size:e===s?(t.size??5)*1.8:(t.size??5)*1.1,highlighted:e===s}:{...t,hidden:!1,color:Di(r,.08),label:``,zIndex:0,size:(t.size??3)*.7}:{...t,hidden:!1,color:r,label:i}}),e.setSetting(`edgeReducer`,(n,r)=>{let i=r.edgeKind,a=e.getGraph().extremities(n),o=t.getNodeAttribute(a[0],`nodeKind`),s=t.getNodeAttribute(a[1],`nodeKind`);return u.has(i)||l.has(o)||l.has(s)||d&&(!d.has(a[0])||!d.has(a[1]))?{...r,hidden:!0}:c?c.has(a[0])&&c.has(a[1])?{...r,hidden:!1,color:Di(Ti[i]??`#9ca3af`,.95),size:1.5,zIndex:1}:{...r,hidden:!1,color:`#0f172a30`,size:.3,zIndex:0}:{...r,hidden:!1,color:r.baseColor??r.color}})}function ji(e,t,n){let r=new Set([e]),i=new Map;for(let e of t)(i.get(e.source)??(i.set(e.source,[]),i.get(e.source))).push(e.target),(i.get(e.target)??(i.set(e.target,[]),i.get(e.target))).push(e.source);let a=[{id:e,depth:0}];for(;a.length>0;){let{id:e,depth:t}=a.shift();if(!(t>=n))for(let n of i.get(e)??[])r.has(n)||(r.add(n),a.push({id:n,depth:t+1}))}return r}function Mi(){let[e,t]=b.useState(!0);return(0,x.jsxs)(`div`,{className:`absolute bottom-14 right-3 bg-gray-950/90 backdrop-blur border border-gray-800/60 rounded-lg shadow-xl overflow-hidden`,children:[(0,x.jsxs)(`button`,{onClick:()=>t(e=>!e),className:`flex items-center gap-2 px-3 py-1.5 text-[10px] text-gray-400 hover:text-gray-200 w-full`,children:[(0,x.jsx)(`span`,{children:`◉`}),(0,x.jsx)(`span`,{className:`font-medium`,children:`Legend`}),(0,x.jsx)(`span`,{className:`ml-auto`,children:e?`▸`:`▾`})]}),!e&&(0,x.jsxs)(`div`,{className:`px-3 pb-2.5 space-y-1`,children:[[`function`,`class`,`interface`,`file`,`method`,`enum`].map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-gray-400`,children:[(0,x.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:wi[e]}}),(0,x.jsx)(`span`,{className:`capitalize`,children:e})]},e)),(0,x.jsx)(`div`,{className:`border-t border-gray-800 mt-1 pt-1 space-y-1`,children:[`calls`,`imports`,`extends`].map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-gray-400`,children:[(0,x.jsx)(`span`,{className:`w-4 h-px flex-shrink-0`,style:{backgroundColor:Ti[e]}}),(0,x.jsx)(`span`,{children:e})]},e))})]})]})}function Ni(){let e=e=>window.dispatchEvent(new CustomEvent(`graph-zoom`,{detail:e}));return(0,x.jsxs)(`div`,{className:`absolute bottom-3 right-3 flex flex-col gap-1 bg-gray-950/90 backdrop-blur border border-gray-800/60 rounded-lg p-1 shadow-lg`,children:[(0,x.jsx)(`button`,{className:`w-7 h-7 text-gray-300 hover:bg-gray-800 hover:text-white rounded text-sm font-bold transition`,onClick:()=>e(.7),title:`Zoom in`,children:`+`}),(0,x.jsx)(`button`,{className:`w-7 h-7 text-gray-300 hover:bg-gray-800 hover:text-white rounded text-sm font-bold transition`,onClick:()=>e(1.4),title:`Zoom out`,children:`−`}),(0,x.jsx)(`div`,{className:`h-px bg-gray-800 mx-1`}),(0,x.jsx)(`button`,{className:`w-7 h-7 text-gray-400 hover:bg-gray-800 hover:text-white rounded text-xs transition`,onClick:()=>e(0),title:`Fit to view`,children:`⌖`})]})}function Pi(e){return{cluster:9,class:8,file:7,module:7,struct:7,interface:6,trait:6,namespace:6,function:5,enum:5,route:5,method:4,constructor:4,type_alias:4,flow:4,constant:3,variable:3,property:3,directory:3}[e]??3}function Fi({node:e,onClose:t}){let{state:n,dispatch:r}=T(),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(`overview`);(0,b.useEffect)(()=>{let t=!1;return a(null),s(null),l(!0),new E(n.serverUrl).inspectNode(e.id).then(e=>{t||a(e)}).catch(()=>void 0).finally(()=>{t||l(!1)}),()=>{t=!0}},[e.id,n.serverUrl]);let m=async()=>{if(!(o||u)){d(!0);try{s(await new E(n.serverUrl).blastRadius(e.id,`both`,3))}catch{}finally{d(!1)}}};(0,b.useEffect)(()=>{f===`impact`&&m()},[f]);let h=e=>{if(!e)return;let t=n.nodes.find(t=>t.id===e);t&&r({type:`SELECT_NODE`,node:t})},g=({kind:e,name:t,id:n,depth:r})=>(0,x.jsxs)(`button`,{onClick:()=>h(n),className:`inline-flex items-center gap-1.5 border rounded px-2 py-0.5 text-xs text-gray-200 max-w-full truncate hover:brightness-125 transition ${r===1?`border-red-700 bg-red-900/20`:r===2?`border-yellow-700 bg-yellow-900/20`:`border-gray-700 bg-gray-800`}`,title:n,children:[e&&(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{backgroundColor:wi[e]??`#666`}}),(0,x.jsx)(`span`,{className:`truncate`,children:t??`(unknown)`}),r!=null&&(0,x.jsxs)(`span`,{className:`text-[9px] text-gray-500 ml-0.5`,children:[`d`,r]})]}),_=[`overview`,`connections`,`impact`,`source`],v=i?i.callers.length+i.callees.length+i.imports.length:0,y=o?.affectedCount??0;return(0,x.jsxs)(`div`,{className:`h-72 bg-[#080b14] border-t border-gray-800 flex flex-col overflow-hidden shadow-2xl`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-gray-800/80 bg-[#0a0d18]`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,x.jsx)(`span`,{className:`w-3 h-3 rounded-full flex-shrink-0 ring-2 ring-offset-1 ring-offset-[#0a0d18]`,style:{backgroundColor:wi[e.kind]??`#666`}}),(0,x.jsx)(`h3`,{className:`font-semibold text-white truncate`,children:e.name}),(0,x.jsx)(`span`,{className:`text-[10px] uppercase bg-gray-800/80 text-gray-400 px-1.5 py-0.5 rounded font-mono border border-gray-700/50`,children:e.kind}),e.exported&&(0,x.jsx)(`span`,{className:`text-[10px] bg-emerald-900/40 text-emerald-400 px-1.5 py-0.5 rounded border border-emerald-800/40`,children:`exported`}),i?.callers&&i.callers.length===0&&[`function`,`method`].includes(e.kind)&&(0,x.jsx)(`span`,{className:`text-[10px] bg-blue-900/30 text-blue-400 px-1.5 py-0.5 rounded border border-blue-800/40`,children:`entry point`})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 font-mono mr-2`,children:e.filePath?.split(`/`).slice(-2).join(`/`)}),(0,x.jsx)(`button`,{onClick:t,className:`text-gray-600 hover:text-white text-lg px-2 transition leading-none`,children:`×`})]})]}),(0,x.jsx)(`div`,{className:`flex border-b border-gray-800/60 px-2 bg-[#090c16]`,children:_.map(e=>(0,x.jsxs)(`button`,{onClick:()=>p(e),className:`px-3 py-1.5 text-xs capitalize font-medium transition relative ${f===e?`text-cyan-400 border-b-2 border-cyan-500 bg-cyan-500/5`:`text-gray-500 hover:text-gray-300`}`,children:[e,e===`connections`&&v>0&&(0,x.jsx)(`span`,{className:`ml-1 text-[9px] text-gray-600 bg-gray-800 px-1 rounded-full`,children:v}),e===`impact`&&y>0&&(0,x.jsx)(`span`,{className:`ml-1 text-[9px] px-1 rounded-full ${y>10?`text-red-300 bg-red-900/40`:`text-yellow-300 bg-yellow-900/30`}`,children:y})]},e))}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3 text-sm`,children:[f===`overview`&&(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-xs`,children:[(0,x.jsx)(Ii,{label:`File`,value:e.filePath,mono:!0}),(0,x.jsx)(Ii,{label:`Lines`,value:e.startLine?`${e.startLine}${e.endLine?`–${e.endLine}`:``}`:`—`}),i?.cluster&&(0,x.jsx)(Ii,{label:`Cluster`,value:i.cluster}),(0,x.jsx)(Ii,{label:`ID`,value:e.id,mono:!0,tiny:!0})]}),i&&(0,x.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[[{label:`Callers`,count:i.callers.length,color:`text-red-400`,bg:`bg-red-900/20 border-red-800/40`},{label:`Callees`,count:i.callees.length,color:`text-sky-400`,bg:`bg-sky-900/20 border-sky-800/40`},{label:`Imports`,count:i.imports.length,color:`text-purple-400`,bg:`bg-purple-900/20 border-purple-800/40`},{label:`Members`,count:i.members.length,color:`text-green-400`,bg:`bg-green-900/20 border-green-800/40`}].filter(e=>e.count>0).map(e=>(0,x.jsxs)(`button`,{onClick:()=>p(`connections`),className:`flex items-center gap-1.5 text-[11px] border rounded px-2 py-1 ${e.bg} transition hover:brightness-125`,children:[(0,x.jsx)(`span`,{className:`font-bold ${e.color}`,children:e.count}),(0,x.jsx)(`span`,{className:`text-gray-400`,children:e.label})]},e.label)),(0,x.jsxs)(`button`,{onClick:()=>p(`impact`),className:`flex items-center gap-1.5 text-[11px] border rounded px-2 py-1 bg-orange-900/20 border-orange-800/40 transition hover:brightness-125`,children:[(0,x.jsx)(`span`,{className:`font-bold text-orange-400`,children:`⚡`}),(0,x.jsx)(`span`,{className:`text-gray-400`,children:`Impact`})]})]}),!!e.metadata?.signature&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-[10px] uppercase mb-1`,children:`Signature`}),(0,x.jsx)(`pre`,{className:`text-xs text-cyan-300 bg-gray-950 rounded p-2 overflow-x-auto border border-gray-800`,children:String(e.metadata?.signature)})]})]}),f===`connections`&&(0,x.jsxs)(`div`,{className:`space-y-3`,children:[c&&(0,x.jsx)(`p`,{className:`text-gray-500 text-xs animate-pulse`,children:`Loading connections…`}),i&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Li,{label:`Callers`,hint:`Functions that call this`,accent:`text-red-400`,items:i.callers.map(e=>({id:e.id,name:e.name,kind:`function`})),Pill:g}),(0,x.jsx)(Li,{label:`Callees`,hint:`Functions called by this`,accent:`text-sky-400`,items:i.callees.map(e=>({id:e.id,name:e.name,kind:`function`})),Pill:g}),(0,x.jsx)(Li,{label:`Imports`,items:i.imports.map(e=>({id:e.id,name:e.name,kind:`module`})),Pill:g}),(0,x.jsx)(Li,{label:`Imported By`,items:i.importedBy.map(e=>({id:e.id,name:e.name,kind:`module`})),Pill:g}),(0,x.jsx)(Li,{label:`Extends`,items:i.extends.map(e=>({id:e.id,name:e.name,kind:`class`})),Pill:g}),(0,x.jsx)(Li,{label:`Implements`,items:i.implementsEdges.map(e=>({id:e.id,name:e.name,kind:`interface`})),Pill:g}),(0,x.jsx)(Li,{label:`Members`,items:i.members.map(e=>({id:e.id,name:e.name,kind:e.kind})),Pill:g})]}),i&&v===0&&(0,x.jsx)(`p`,{className:`text-gray-500 text-xs italic`,children:`No connections recorded.`})]}),f===`impact`&&(0,x.jsxs)(`div`,{className:`space-y-3`,children:[u&&(0,x.jsx)(`p`,{className:`text-gray-500 text-xs animate-pulse`,children:`Calculating blast radius…`}),!u&&!o&&(0,x.jsx)(`p`,{className:`text-gray-500 text-xs italic`,children:`No impact data.`}),o&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,x.jsx)(`div`,{className:`text-2xl font-bold font-mono ${o.affectedCount>10?`text-red-400`:o.affectedCount>5?`text-yellow-400`:`text-green-400`}`,children:o.affectedCount}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-xs text-gray-300`,children:`affected symbols`}),(0,x.jsx)(`p`,{className:`text-[10px] text-gray-600`,children:o.affectedCount>10?`⚠ HIGH blast radius`:o.affectedCount>5?`⚡ MEDIUM blast radius`:`✓ LOW blast radius`})]})]}),[1,2,3].map(e=>{let t=o.affected.filter(t=>t.depth===e);return t.length===0?null:(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,x.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-wider ${e===1?`text-red-400`:e===2?`text-yellow-400`:`text-gray-400`}`,children:[`d=`,e,` `,e===1?`· WILL BREAK`:e===2?`· LIKELY AFFECTED`:`· MAY NEED TESTING`]}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600`,children:t.length})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[t.slice(0,20).map((t,n)=>(0,x.jsx)(g,{id:t.id,name:t.name,kind:t.kind,depth:e},`${t.id}-${n}`)),t.length>20&&(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-600 self-center`,children:[`+`,t.length-20]})]})]},e)})]})]}),f===`source`&&(0,x.jsx)(`div`,{children:e.content?(0,x.jsx)(`pre`,{className:`text-xs text-gray-300 bg-gray-950 rounded p-3 overflow-x-auto border border-gray-800 leading-relaxed`,children:(0,x.jsx)(`code`,{children:e.content})}):(0,x.jsx)(`p`,{className:`text-gray-500 text-xs italic`,children:`No source preview available.`})})]})]})}function Ii({label:e,value:t,mono:n,tiny:r}){return(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-[10px] uppercase mb-0.5`,children:e}),(0,x.jsx)(`p`,{className:`text-gray-200 truncate ${n?`font-mono`:``} ${r?`text-[10px]`:`text-xs`}`,title:t,children:t})]})}function Li({label:e,hint:t,accent:n=`text-gray-500`,items:r,Pill:i}){return r.length===0?null:(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-baseline gap-2 mb-1.5`,children:[(0,x.jsx)(`h4`,{className:`text-[10px] font-bold uppercase tracking-wider ${n}`,children:e}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 bg-gray-800/60 px-1 rounded-full`,children:r.length}),t&&(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-700`,children:[`— `,t]})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[r.slice(0,50).map((e,t)=>(0,x.jsx)(i,{...e},`${e.id}-${t}`)),r.length>50&&(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-600 self-center`,children:[`+`,r.length-50,` more`]})]})]})}var Ri=`modulepreload`,zi=function(e){return`/`+e},Bi={},Vi=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=zi(t,n),t in Bi)return;Bi[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ri,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Hi=null;async function Ui(){if(Hi)return Hi;try{return Hi=(await Vi(()=>import(`./es-yDTUrrnL.js`),[])).default,Hi}catch{return null}}var Wi=`code-intel:source-panel-size`,Gi=420;function Ki({file:e,startLine:t,endLine:n,onClose:r}){let{state:i}=T(),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(()=>{try{let e=localStorage.getItem(Wi);return e?parseInt(e,10):Gi}catch{return Gi}}),_=(0,b.useRef)(!1),v=(0,b.useRef)(0),y=(0,b.useRef)(0),S=e=>{_.current=!0,v.current=e.clientY,y.current=h,e.preventDefault()};(0,b.useEffect)(()=>{let e=e=>{if(!_.current)return;let t=v.current-e.clientY;g(Math.max(180,Math.min(800,y.current+t)))},t=()=>{if(_.current){_.current=!1;try{localStorage.setItem(Wi,String(h))}catch{}}};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[h]),(0,b.useEffect)(()=>{let r=!1;return o(null),f(null),u(null),c(!0),new E(i.serverUrl).sourcePreview(e,t,n).then(async e=>{if(r)return;o(e);let t=await Ui();if(!r&&t)try{let n=t.getLanguage(e.language)?e.language:`plaintext`;f(t.highlight(e.content,{language:n}).value)}catch{f(null)}}).catch(e=>{r||u(e instanceof Error?e.message:`Failed to load source`)}).finally(()=>{r||c(!1)}),()=>{r=!0}},[e,t,n,i.serverUrl]);let C=(0,b.useCallback)(async()=>{try{await navigator.clipboard.writeText(`${e}:${t}`),m(!0),setTimeout(()=>m(!1),2e3)}catch{}},[e,t]),w=e.split(`/`).slice(-3).join(`/`);return(0,x.jsxs)(`div`,{className:`bg-[#080b14] border-t border-gray-800 flex flex-col overflow-hidden shadow-2xl`,style:{height:h},children:[(0,x.jsx)(`div`,{className:`h-1 cursor-row-resize bg-gray-800 hover:bg-cyan-500/50 transition-colors flex-shrink-0`,onMouseDown:S,title:`Drag to resize`}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-gray-800/80 bg-[#0a0d18] flex-shrink-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,x.jsx)(`span`,{className:`text-[10px] font-bold tracking-wider text-cyan-500/80 uppercase`,children:`Source`}),(0,x.jsx)(`span`,{className:`text-xs text-gray-400 font-mono truncate`,title:e,children:w}),(a||s)&&(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-600 font-mono`,children:[`:`,t,n===t?``:`–${n}`]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[(0,x.jsx)(`a`,{href:`vscode://file/${e}:${t}`,className:`text-[10px] text-gray-400 hover:text-white border border-gray-700/50 hover:border-gray-500 rounded px-2 py-0.5 transition font-mono`,title:`Open in VS Code`,children:`⎈ VS Code`}),(0,x.jsx)(`button`,{onClick:C,className:`text-[10px] border rounded px-2 py-0.5 transition font-mono ${p?`text-green-400 border-green-700/50 bg-green-900/20`:`text-gray-400 hover:text-white border-gray-700/50 hover:border-gray-500`}`,title:`Copy ${e}:${t} to clipboard`,children:p?`✓ copied`:`⎘ copy`}),(0,x.jsx)(`button`,{onClick:r,className:`text-gray-600 hover:text-white text-lg px-2 transition leading-none ml-1`,children:`×`})]})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-auto`,children:[s&&(0,x.jsx)(qi,{}),l&&(0,x.jsx)(`div`,{className:`p-4`,children:(0,x.jsxs)(`div`,{className:`flex items-center gap-2 bg-red-900/20 border border-red-800/40 rounded-lg px-3 py-2`,children:[(0,x.jsx)(`span`,{className:`text-red-400 text-sm`,children:`⚠`}),(0,x.jsx)(`span`,{className:`text-red-300 text-xs`,children:l})]})}),a&&!s&&(0,x.jsx)(Ji,{data:a,highlightedHtml:d,focusStartLine:t,focusEndLine:n})]})]})}function qi(){return(0,x.jsx)(`div`,{className:`p-4 space-y-1.5 animate-pulse`,children:Array.from({length:12}).map((e,t)=>(0,x.jsxs)(`div`,{className:`flex gap-4`,children:[(0,x.jsx)(`div`,{className:`w-8 h-3 bg-gray-800 rounded flex-shrink-0`}),(0,x.jsx)(`div`,{className:`h-3 bg-gray-800 rounded`,style:{width:`${40+Math.random()*50}%`}})]},t))})}function Ji({data:e,highlightedHtml:t,focusStartLine:n,focusEndLine:r}){let i=e.content.split(`
321
321
  `),a=t?Yi(t):null;return(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(Zi,{}),(0,x.jsx)(`table`,{className:`w-full text-xs font-mono border-collapse`,children:(0,x.jsx)(`tbody`,{children:i.map((t,i)=>{let o=e.startLine+i,s=o>=n&&o<=r,c=a?a[i]??``:null;return(0,x.jsxs)(`tr`,{className:s?`bg-amber-900/30`:`hover:bg-gray-800/30`,children:[(0,x.jsx)(`td`,{className:`select-none w-10 text-right pr-3 pl-2 py-0.5 border-r text-[10px] align-top flex-shrink-0 ${s?`text-amber-400 border-amber-700/40 bg-amber-900/20`:`text-gray-700 border-gray-800/60`}`,style:{userSelect:`none`,minWidth:`2.5rem`},children:o}),(0,x.jsx)(`td`,{className:`pl-4 pr-4 py-0.5 whitespace-pre align-top leading-5`,style:{color:s&&!c?`#fbbf24`:void 0},children:c===null?(0,x.jsx)(`span`,{className:s?`text-amber-200`:`text-gray-300`,children:t||` `}):(0,x.jsx)(`span`,{dangerouslySetInnerHTML:{__html:c||` `}})})]},o)})})})]})}function Yi(e){return e.split(`
322
322
  `)}var Xi=!1;function Zi(){return(0,b.useEffect)(()=>{if(Xi)return;Xi=!0;let e=document.createElement(`style`);e.textContent=`
323
323
  /* highlight.js minimal dark theme */
@@ -345,4 +345,4 @@ _Use **inspect <symbol>** to dive deeper, or **impact <symbol>** to see blast ra
345
345
  `;for(let e of d.callees.slice(0,8))p+=`- \`${e.name??e.id}\`\n`;p+=`
346
346
  `}d.extends.length&&(p+=`**Extends:** ${d.extends.map(e=>`\`${e.name}\``).join(`, `)}\n\n`),d.implementsEdges.length&&(p+=`**Implements:** ${d.implementsEdges.map(e=>`\`${e.name}\``).join(`, `)}\n\n`),d.members.length&&(p+=`**Members:** ${d.members.length} (${[...new Set(d.members.map(e=>e.kind))].join(`, `)})\n`),n({type:`final`,text:p,citations:i})}var na=[{label:`Architecture`,items:[`Explain the project architecture`,`What are the main modules?`]},{label:`Search`,items:[`Find code about HTTP server`,`Who calls runPipeline`]},{label:`Inspect`,items:[`Inspect KnowledgeGraph`,`Impact of textSearch`]}];function ra(){let{state:e,dispatch:t}=T(),[n,r]=(0,b.useState)(``),i=(0,b.useRef)(null);(0,b.useEffect)(()=>{i.current?.scrollTo({top:i.current.scrollHeight,behavior:`smooth`})},[e.chat.messages]);let a=async n=>{let i=n.trim();if(!i||e.chat.loading)return;r(``),t({type:`ADD_CHAT_MESSAGE`,message:{role:`user`,content:i,timestamp:Date.now()}}),t({type:`SET_CHAT_LOADING`,loading:!0}),t({type:`ADD_CHAT_MESSAGE`,message:{role:`assistant`,content:``,timestamp:Date.now(),toolCalls:[],citations:[]}});let a=new E(e.serverUrl),o=[];try{await ta(i,a,e=>{if(e.type===`tool-start`&&e.toolCall)o.push(e.toolCall),t({type:`UPDATE_LAST_CHAT_MESSAGE`,message:{toolCalls:[...o]}});else if(e.type===`tool-end`&&e.toolCall){let n=o.findIndex(t=>t.tool===e.toolCall.tool&&t.status===`running`);n>=0?o[n]=e.toolCall:o.push(e.toolCall),t({type:`UPDATE_LAST_CHAT_MESSAGE`,message:{toolCalls:[...o]}})}else e.type===`final`&&t({type:`UPDATE_LAST_CHAT_MESSAGE`,message:{content:e.text??``,citations:e.citations??[]}})})}catch(e){t({type:`UPDATE_LAST_CHAT_MESSAGE`,message:{content:`Error: ${e instanceof Error?e.message:`unknown`}`}})}finally{t({type:`SET_CHAT_LOADING`,loading:!1})}},o=n=>{if(n.nodeId){let r=e.nodes.find(e=>e.id===n.nodeId);if(r){t({type:`SELECT_NODE`,node:r});return}}let r=e.nodes.find(e=>e.kind===`file`&&e.filePath===n.filePath);r&&t({type:`SELECT_NODE`,node:r})};return(0,x.jsxs)(`div`,{className:`flex flex-col h-full bg-gray-900`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2.5 border-b border-gray-800/50 bg-gray-950/50`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`text-purple-400`,children:`✦`}),(0,x.jsx)(`h3`,{className:`text-sm font-semibold text-gray-100`,children:`Code AI`}),(0,x.jsx)(`span`,{className:`text-[10px] bg-purple-900/40 text-purple-300 px-1.5 py-0.5 rounded-full border border-purple-800/30`,children:`Grounded`})]}),(0,x.jsx)(`button`,{onClick:()=>t({type:`CLEAR_CHAT`}),className:`text-[10px] text-gray-600 hover:text-gray-300 px-2 py-1 rounded hover:bg-gray-800/50 transition`,children:`Clear`})]}),(0,x.jsxs)(`div`,{ref:i,className:`flex-1 overflow-y-auto p-3 space-y-3`,children:[e.chat.messages.length===0&&(0,x.jsxs)(`div`,{className:`mt-4 px-2`,children:[(0,x.jsx)(`p`,{className:`text-gray-500 text-xs mb-3 leading-relaxed text-center`,children:`Ask grounded questions. Every answer cites source files.`}),(0,x.jsx)(`div`,{className:`space-y-3`,children:na.map(({label:e,items:t})=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[10px] font-bold tracking-wider text-gray-600 uppercase mb-1 px-1`,children:e}),(0,x.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,x.jsx)(`button`,{onClick:()=>a(e),className:`block w-full text-left px-2.5 py-1.5 text-xs bg-gray-800/40 hover:bg-gray-800/80 text-gray-300 hover:text-white rounded-lg border border-gray-800/50 hover:border-gray-700 transition`,children:e},e))})]},e))})]}),e.chat.messages.map((e,t)=>(0,x.jsx)(ia,{message:e,onCitationClick:o},t)),e.chat.loading&&(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-500 text-xs`,children:[(0,x.jsx)(`div`,{className:`animate-spin w-3 h-3 border-2 border-gray-700 border-t-purple-400 rounded-full`}),`Thinking…`]})]}),(0,x.jsx)(`div`,{className:`p-2 border-t border-gray-800 bg-gray-950`,children:(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[(0,x.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>e.key===`Enter`&&a(n),disabled:e.chat.loading,className:`flex-1 bg-gray-800 border border-gray-700 rounded-lg px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-purple-500 focus:outline-none disabled:opacity-50`,placeholder:`Ask about the codebase…`}),(0,x.jsx)(`button`,{onClick:()=>a(n),disabled:e.chat.loading||!n.trim(),className:`bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 disabled:opacity-40 rounded-lg px-3 py-1.5 text-sm text-white`,children:`➤`})]})})]})}function ia({message:e,onCitationClick:t}){return e.role===`user`?(0,x.jsx)(`div`,{className:`flex justify-end`,children:(0,x.jsx)(`div`,{className:`max-w-[90%] bg-blue-600/20 border border-blue-700/40 text-blue-100 rounded-lg px-3 py-1.5 text-sm`,children:e.content})}):(0,x.jsxs)(`div`,{className:`space-y-2`,children:[e.toolCalls&&e.toolCalls.length>0&&(0,x.jsx)(`div`,{className:`space-y-1`,children:e.toolCalls.map((e,t)=>(0,x.jsx)(aa,{tc:e},t))}),e.content&&(0,x.jsx)(`div`,{className:`bg-gray-800/60 border border-gray-800 rounded-lg p-3 text-sm text-gray-200`,children:(0,x.jsx)(oa,{text:e.content,onCitationClick:t})})]})}function aa({tc:e}){return(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 rounded border bg-gray-900/60 text-xs ${e.status===`done`?`border-green-700/40 text-green-400`:e.status===`error`?`border-red-700/40 text-red-400`:`border-gray-700 text-gray-400 animate-pulse`}`,children:[(0,x.jsx)(`span`,{className:`font-mono`,children:`⚙`}),(0,x.jsx)(`span`,{className:`font-mono font-medium`,children:e.tool}),(0,x.jsx)(`span`,{className:`text-gray-500 truncate flex-1`,children:e.resultSummary??Object.values(e.input).slice(0,1).join(` `)}),(0,x.jsx)(`span`,{className:`text-[10px]`,children:e.status===`running`?`…`:e.status===`done`?`✓`:`✗`})]})}function oa({text:e,onCitationClick:t}){return(0,x.jsx)(x.Fragment,{children:e.split(`
347
347
  `).map((e,n)=>(0,x.jsx)(`div`,{className:`leading-relaxed`,children:da(e,t)},n))})}var sa=/\[\[([^\]]+)\]\]/g,ca=/^(#{1,4})\s+(.*)$/,la=/\*\*([^*]+)\*\*/g,ua=/`([^`]+)`/g;function da(e,t){let n=e.match(ca);if(n){let e=n[1].length,r=n[2];return(0,x.jsx)(`h${Math.min(4,e+1)}`,{className:e<=2?`text-base font-bold text-white mt-2`:e===3?`text-sm font-semibold text-gray-100 mt-2`:`text-xs font-semibold text-gray-300 mt-1`,children:fa(r,t)})}return e.startsWith(`- `)?(0,x.jsxs)(`div`,{className:`ml-3`,children:[`• `,fa(e.slice(2),t)]}):e.trim()===``?(0,x.jsx)(`div`,{className:`h-1`}):(0,x.jsx)(`span`,{children:fa(e,t)})}function fa(e,t){let n=[],r=0;sa.lastIndex=0;let i;for(;(i=sa.exec(e))!==null;){i.index>r&&n.push((0,x.jsx)(b.Fragment,{children:ha(e.slice(r,i.index))},`t-${r}`));let a=i[1],o=pa(a);n.push((0,x.jsxs)(`button`,{onClick:()=>t(o),className:`inline-flex items-center gap-0.5 mx-0.5 px-1.5 py-0.5 text-[10px] font-mono bg-cyan-900/40 hover:bg-cyan-900/70 text-cyan-300 rounded border border-cyan-700/30 align-baseline`,title:o.filePath,children:[ma(o.filePath),o.startLine?`:${o.startLine}`:``]},`c-${i.index}`)),r=i.index+i[0].length}return r<e.length&&n.push((0,x.jsx)(b.Fragment,{children:ha(e.slice(r))},`t-${r}`)),n}function pa(e){let t=e.lastIndexOf(`:`);if(t>0&&/^\d/.test(e.slice(t+1))){let n=e.slice(0,t),[r,i]=e.slice(t+1).split(`-`).map(e=>parseInt(e,10));return{filePath:n,startLine:r,endLine:i}}return{filePath:e}}function ma(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function ha(e){let t=[],n=0;for(;n<e.length;){la.lastIndex=n,ua.lastIndex=n;let r=la.exec(e),i=ua.exec(e),a=null;if(r&&i?a=r.index<i.index?{match:r,type:`b`}:{match:i,type:`c`}:r?a={match:r,type:`b`}:i&&(a={match:i,type:`c`}),!a){t.push(e.slice(n));break}a.match.index>n&&t.push(e.slice(n,a.match.index)),a.type===`b`?t.push((0,x.jsx)(`strong`,{className:`text-white`,children:a.match[1]},`b-${a.match.index}`)):t.push((0,x.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-gray-950 text-cyan-300 font-mono text-[11px]`,children:a.match[1]},`c-${a.match.index}`)),n=a.match.index+a.match[0].length}return(0,x.jsx)(x.Fragment,{children:t})}function ga(e){let t={name:``,path:``,children:new Map,files:[]};for(let n of e){let e=n.split(`/`),r=t;for(let t=0;t<e.length-1;t++){let n=e[t];r.children.has(n)||r.children.set(n,{name:n,path:e.slice(0,t+1).join(`/`),children:new Map,files:[]}),r=r.children.get(n)}r.files.push(n)}return t}function _a(e){let t=e.files.length;for(let n of e.children.values())t+=_a(n);return t}function va({node:e,depth:t,onFileClick:n,selectedPath:r}){let i=[...e.children.entries()].sort((e,t)=>e[0].localeCompare(t[0])),a=[...e.files].sort(),o=_a(e),s=t*12,[c,l]=(0,b.useState)(t<=1||e.children.size===1);return t===0?(0,x.jsxs)(x.Fragment,{children:[i.map(([,e])=>(0,x.jsx)(va,{node:e,depth:t+1,onFileClick:n,selectedPath:r},e.path)),a.map(e=>(0,x.jsx)(ya,{fp:e,indent:s,selected:e===r,onClick:()=>n(e)},e))]}):(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1 py-0.5 pr-2 cursor-pointer hover:bg-gray-800/50 rounded-sm group transition select-none`,style:{paddingLeft:`${s+6}px`},onClick:()=>l(e=>!e),children:[(0,x.jsx)(`span`,{className:`text-gray-500 text-[10px] w-3 flex-shrink-0 text-center`,children:i.length>0||a.length>0?c?`▾`:`▸`:` `}),(0,x.jsx)(`span`,{className:`text-[13px] mr-1`,children:c?`📂`:`📁`}),(0,x.jsx)(`span`,{className:`text-xs text-gray-200 font-medium truncate flex-1 group-hover:text-white`,children:e.name}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 font-mono ml-1 flex-shrink-0`,children:o})]}),c&&(0,x.jsxs)(`div`,{children:[i.map(([,e])=>(0,x.jsx)(va,{node:e,depth:t+1,onFileClick:n,selectedPath:r},e.path)),a.map(e=>(0,x.jsx)(ya,{fp:e,indent:s+16,selected:e===r,onClick:()=>n(e)},e))]})]})}function ya({fp:e,indent:t,selected:n,onClick:r}){let i=e.split(`/`).pop(),a=ba[i.split(`.`).pop()??``]??`📄`;return(0,x.jsxs)(`div`,{className:`flex items-center gap-1 py-0.5 pr-2 cursor-pointer rounded-sm transition select-none ${n?`bg-cyan-500/15 text-cyan-300`:`hover:bg-gray-800/50 text-gray-400 hover:text-gray-200`}`,style:{paddingLeft:`${t+6}px`},onClick:r,title:e,children:[(0,x.jsx)(`span`,{className:`text-[11px] mr-1 flex-shrink-0`,children:a}),(0,x.jsx)(`span`,{className:`text-xs truncate`,children:i})]})}var ba={ts:`🔷`,tsx:`⚛️`,js:`🟨`,jsx:`⚛️`,json:`📋`,md:`📝`,py:`🐍`,go:`🐹`,rs:`🦀`,java:`☕`,cs:`🔵`,css:`🎨`,html:`🌐`,yaml:`⚙️`,yml:`⚙️`,toml:`⚙️`,sh:`🐚`,txt:`📄`,gitignore:`🚫`};function xa(){let{state:e,dispatch:t}=T(),[n,r]=(0,b.useState)(``),i=(0,b.useMemo)(()=>e.nodes.filter(e=>e.kind===`file`).map(e=>e.filePath).sort(),[e.nodes]),a=(0,b.useMemo)(()=>{if(!n.trim())return i;let e=n.toLowerCase();return i.filter(t=>t.toLowerCase().includes(e))},[i,n]),o=(0,b.useMemo)(()=>ga(a),[a]),s=e.selectedNode?.kind===`file`?e.selectedNode.filePath:void 0;return(0,x.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,x.jsx)(`div`,{className:`p-2 border-b border-gray-800/50`,children:(0,x.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),placeholder:`Filter files…`,className:`w-full bg-gray-900/60 border border-gray-700/50 rounded-md px-2.5 py-1.5 text-xs text-gray-200 placeholder-gray-600 focus:border-cyan-600 focus:outline-none`})}),(0,x.jsx)(`div`,{className:`flex-1 overflow-y-auto py-1 text-sm`,children:a.length===0?(0,x.jsx)(`p`,{className:`text-center text-gray-600 text-xs mt-4`,children:`No files match`}):(0,x.jsx)(va,{node:o,depth:0,onFileClick:n=>{let r=e.nodes.find(e=>e.filePath===n&&e.kind===`file`);r&&t({type:`SELECT_NODE`,node:r})},selectedPath:s})}),(0,x.jsxs)(`div`,{className:`px-3 py-1.5 border-t border-gray-800/50 text-[10px] text-gray-600 font-mono`,children:[a.length,` file`,a.length===1?``:`s`]})]})}var Sa={directory:`Folder`,file:`File`,class:`Class`,function:`Function`,method:`Method`,variable:`Variable`,interface:`Interface`,module:`Module`,struct:`Struct`,enum:`Enum`,trait:`Trait`,namespace:`Namespace`,type_alias:`Type Alias`,constant:`Constant`,property:`Property`,constructor:`Constructor`,route:`Route`,cluster:`Cluster`,flow:`Flow`},Ca={contains:`Contains`,calls:`Calls`,imports:`Imports`,extends:`Extends`,implements:`Implements`,has_member:`Has Member`,accesses:`Accesses`,overrides:`Overrides`,belongs_to:`Belongs To`,step_of:`Step Of`,handles:`Handles`},wa=[`all`,1,2,3,5];function Ta(){let{state:e,dispatch:t}=T(),{nodeKindCounts:n,edgeKindCounts:r}=(0,b.useMemo)(()=>{let t=new Map,n=new Map;for(let n of e.nodes)t.set(n.kind,(t.get(n.kind)??0)+1);for(let t of e.edges)n.set(t.kind,(n.get(t.kind)??0)+1);return{nodeKindCounts:t,edgeKindCounts:n}},[e.nodes,e.edges]),i=[...n.entries()].sort((e,t)=>t[1]-e[1]),a=[...r.entries()].sort((e,t)=>t[1]-e[1]);return(0,x.jsxs)(`div`,{className:`overflow-y-auto h-full text-sm`,children:[(0,x.jsx)(Ea,{title:`Node Types`,subtitle:`Toggle visibility of node types in the graph`,children:(0,x.jsx)(`div`,{className:`space-y-1`,children:i.map(([n,r])=>{let i=e.filters.hiddenNodeKinds.has(n);return(0,x.jsxs)(`button`,{onClick:()=>t({type:`TOGGLE_NODE_KIND`,kind:n}),className:`w-full flex items-center gap-2 px-2 py-1 rounded hover:bg-gray-800/60 text-left`,children:[(0,x.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full flex-shrink-0`,style:{backgroundColor:wi[n]??`#666`,opacity:i?.25:1}}),(0,x.jsx)(`span`,{className:`flex-1 text-xs ${i?`text-gray-600 line-through`:`text-gray-200`}`,children:Sa[n]??n}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-500 font-mono`,children:r}),(0,x.jsx)(`span`,{className:`w-4 h-4 rounded flex items-center justify-center text-[10px] ${i?`bg-gray-800 text-gray-600`:`bg-blue-600/30 text-blue-300`}`,children:i?`+`:`✓`})]},n)})})}),(0,x.jsx)(Ea,{title:`Edge Types`,subtitle:`Toggle visibility of relationship types`,children:(0,x.jsx)(`div`,{className:`space-y-1`,children:a.map(([n,r])=>{let i=e.filters.hiddenEdgeKinds.has(n);return(0,x.jsxs)(`button`,{onClick:()=>t({type:`TOGGLE_EDGE_KIND`,kind:n}),className:`w-full flex items-center gap-2 px-2 py-1 rounded hover:bg-gray-800/60 text-left`,children:[(0,x.jsx)(`span`,{className:`w-4 h-0.5 flex-shrink-0`,style:{backgroundColor:Ti[n]??`#666`,opacity:i?.25:1}}),(0,x.jsx)(`span`,{className:`flex-1 text-xs ${i?`text-gray-600 line-through`:`text-gray-200`}`,children:Ca[n]??n}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-500 font-mono`,children:r}),(0,x.jsx)(`span`,{className:`w-4 h-4 rounded flex items-center justify-center text-[10px] ${i?`bg-gray-800 text-gray-600`:`bg-blue-600/30 text-blue-300`}`,children:i?`+`:`✓`})]},n)})})}),(0,x.jsxs)(Ea,{title:`Focus Depth`,subtitle:`Show nodes within N hops of selection`,children:[(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:wa.map(n=>(0,x.jsx)(`button`,{onClick:()=>t({type:`SET_FOCUS_DEPTH`,depth:n}),className:`px-2.5 py-1 rounded text-xs font-medium ${e.filters.focusDepth===n?`bg-cyan-500 text-gray-900`:`bg-gray-800 text-gray-400 hover:bg-gray-700`}`,children:n===`all`?`All`:`${n} hop${n===1?``:`s`}`},String(n)))}),!e.selectedNode&&e.filters.focusDepth!==`all`&&(0,x.jsx)(`p`,{className:`text-[10px] text-amber-400 mt-2`,children:`Select a node to apply focus depth.`})]}),(0,x.jsx)(`div`,{className:`px-3 pb-4`,children:(0,x.jsx)(`button`,{onClick:()=>t({type:`RESET_FILTERS`}),className:`w-full px-2 py-1.5 text-xs bg-gray-800 hover:bg-gray-700 text-gray-300 rounded`,children:`Reset filters`})})]})}function Ea({title:e,subtitle:t,children:n}){return(0,x.jsxs)(`div`,{className:`px-3 py-3 border-b border-gray-800`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-0.5`,children:e}),t&&(0,x.jsx)(`p`,{className:`text-[10px] text-gray-600 mb-2`,children:t}),n]})}var Da=`code-intel:query-history`,Oa=20,ka=[`FIND function WHERE name CONTAINS "auth"`,`FIND * WHERE kind IN [function, method] LIMIT 20`,`TRAVERSE CALLS FROM "main" DEPTH 3`,`COUNT function GROUP BY cluster`,`FIND function WHERE exported = true LIMIT 30`],Aa=/\b(FIND|TRAVERSE|PATH|COUNT|WHERE|FROM|TO|DEPTH|LIMIT|OFFSET|GROUP|BY|AND|IN|CONTAINS|STARTS_WITH)\b/g;function ja(){try{return JSON.parse(localStorage.getItem(Da)??`[]`)}catch{return[]}}function Ma(e){localStorage.setItem(Da,JSON.stringify(e.slice(0,Oa)))}function Na(e){let t=ja().filter(t=>t!==e);t.unshift(e),Ma(t)}function Pa(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Fa(e){return Pa(e).replace(Aa,`<span style="color:#7dd3fc;font-weight:600">$1</span>`)}function Ia({nodes:e,onSelectNode:t}){let[n,r]=(0,b.useState)({column:`name`,direction:`asc`}),i=e=>{r(t=>t.column===e?{column:e,direction:t.direction===`asc`?`desc`:`asc`}:{column:e,direction:`asc`})},a=[...e].sort((e,t)=>{let r=String(e[n.column]??``),i=String(t[n.column]??``),a=r.localeCompare(i);return n.direction===`asc`?a:-a}),o=[{key:`name`,label:`Name`},{key:`kind`,label:`Kind`},{key:`filePath`,label:`File`}],s=e=>n.column===e?(0,x.jsx)(`span`,{className:`text-cyan-400 ml-1`,children:n.direction===`asc`?`↑`:`↓`}):(0,x.jsx)(`span`,{className:`text-gray-600 ml-1`,children:`↕`});return(0,x.jsx)(`div`,{className:`overflow-auto max-h-64 rounded-md border border-gray-700/50`,children:(0,x.jsxs)(`table`,{className:`w-full text-[11px] font-mono border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 bg-[#0d1117] z-10`,children:(0,x.jsx)(`tr`,{children:o.map(e=>(0,x.jsxs)(`th`,{onClick:()=>i(e.key),className:`px-2 py-1.5 text-left text-gray-400 font-semibold cursor-pointer hover:text-gray-200 select-none border-b border-gray-700/50 whitespace-nowrap`,children:[e.label,s(e.key)]},e.key))})}),(0,x.jsx)(`tbody`,{children:a.map((e,n)=>(0,x.jsxs)(`tr`,{onClick:()=>t(e),className:`cursor-pointer hover:bg-cyan-500/10 transition-colors`,children:[(0,x.jsx)(`td`,{className:`px-2 py-1 text-cyan-300 truncate max-w-[120px]`,title:e.name,children:e.name}),(0,x.jsx)(`td`,{className:`px-2 py-1 text-purple-300`,children:e.kind}),(0,x.jsx)(`td`,{className:`px-2 py-1 text-gray-400 truncate max-w-[180px]`,title:e.filePath??``,children:e.filePath??`—`})]},e.id??n))})]})})}function La({groups:e}){let t=[...e].sort((e,t)=>t.count-e.count);return(0,x.jsx)(`div`,{className:`overflow-auto max-h-48 rounded-md border border-gray-700/50`,children:(0,x.jsxs)(`table`,{className:`w-full text-[11px] font-mono border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 bg-[#0d1117] z-10`,children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{className:`px-2 py-1.5 text-left text-gray-400 font-semibold border-b border-gray-700/50`,children:`Group`}),(0,x.jsx)(`th`,{className:`px-2 py-1.5 text-left text-gray-400 font-semibold border-b border-gray-700/50`,children:`Count`})]})}),(0,x.jsx)(`tbody`,{children:t.map(({key:e,count:t})=>(0,x.jsxs)(`tr`,{className:`hover:bg-gray-800/40 transition-colors`,children:[(0,x.jsx)(`td`,{className:`px-2 py-1 text-cyan-300`,children:e}),(0,x.jsx)(`td`,{className:`px-2 py-1 text-white font-bold`,children:t})]},e))})]})})}function Ra(){let{state:e,dispatch:t}=T(),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(()=>ja()),f=(0,b.useRef)(null),p=(0,b.useRef)(null);(0,b.useEffect)(()=>{p.current&&(p.current.innerHTML=Fa(n)+`
348
- `)},[n]);let m=(0,b.useCallback)(()=>{f.current&&p.current&&(p.current.scrollTop=f.current.scrollTop,p.current.scrollLeft=f.current.scrollLeft)},[]),h=(0,b.useCallback)(async()=>{let t=n.trim();if(!(!t||i)){a(!0),l(null),s(null);try{s(await new E(e.serverUrl).queryGQL(t)),Na(t),d(ja())}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(!1)}}},[n,i,e.serverUrl]),g=(0,b.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),h())},[h]),_=(0,b.useCallback)(e=>{t({type:`SELECT_NODE`,node:e})},[t]),v=e=>{let t=e.target.value;t&&(r(t),e.target.value=``)},y=e=>{let t=e.target.value;t&&(r(t),e.target.value=``)},S=o&&o.nodes.length>0,C=o&&o.groups&&o.groups.length>0;return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden text-sm`,children:[(0,x.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-800/50 flex-shrink-0`,children:(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-cyan-500/80 uppercase`,children:`GQL Query Console`})}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-3 py-2 space-y-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-[10px] text-gray-500 mb-1 font-semibold uppercase tracking-wider`,children:`Examples`}),(0,x.jsxs)(`select`,{onChange:v,defaultValue:``,className:`w-full bg-[#0d1117] border border-gray-700/60 rounded text-[11px] text-gray-300 px-2 py-1 focus:outline-none focus:border-cyan-700 cursor-pointer`,children:[(0,x.jsx)(`option`,{value:``,disabled:!0,children:`— pick an example —`}),ka.map(e=>(0,x.jsx)(`option`,{value:e,children:e},e))]})]}),u.length>0&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-[10px] text-gray-500 mb-1 font-semibold uppercase tracking-wider`,children:`History`}),(0,x.jsxs)(`select`,{onChange:y,defaultValue:``,className:`w-full bg-[#0d1117] border border-gray-700/60 rounded text-[11px] text-gray-300 px-2 py-1 focus:outline-none focus:border-cyan-700 cursor-pointer`,children:[(0,x.jsx)(`option`,{value:``,disabled:!0,children:`— recent queries —`}),u.map((e,t)=>(0,x.jsx)(`option`,{value:e,children:e.length>60?e.slice(0,57)+`…`:e},t))]})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`label`,{className:`block text-[10px] text-gray-500 mb-1 font-semibold uppercase tracking-wider`,children:[`Query `,(0,x.jsx)(`span`,{className:`text-gray-600 normal-case font-normal`,children:`(Ctrl+Enter to run)`})]}),(0,x.jsxs)(`div`,{className:`relative`,style:{height:`100px`},children:[(0,x.jsx)(`div`,{ref:p,"aria-hidden":`true`,className:`absolute inset-0 m-0 overflow-hidden whitespace-pre-wrap break-words pointer-events-none rounded-md border border-transparent`,style:{fontFamily:`ui-monospace, "Cascadia Code", "Fira Code", monospace`,fontSize:`11px`,lineHeight:`1.5`,padding:`6px 8px`,color:`transparent`,background:`#0d1117`,wordBreak:`break-word`,zIndex:0}}),(0,x.jsx)(`textarea`,{ref:f,value:n,onChange:e=>r(e.target.value),onKeyDown:g,onScroll:m,spellCheck:!1,placeholder:`FIND function WHERE name CONTAINS "auth"`,className:`absolute inset-0 w-full h-full resize-none rounded-md border border-gray-700/60 focus:outline-none focus:border-cyan-600 placeholder-gray-700`,style:{fontFamily:`ui-monospace, "Cascadia Code", "Fira Code", monospace`,fontSize:`11px`,lineHeight:`1.5`,padding:`6px 8px`,background:`transparent`,color:`white`,caretColor:`white`,zIndex:1}})]})]}),(0,x.jsx)(`button`,{onClick:()=>void h(),disabled:i||!n.trim(),className:`w-full py-1.5 rounded-md text-xs font-semibold tracking-wide transition flex items-center justify-center gap-2 bg-cyan-700/80 hover:bg-cyan-600 text-white disabled:opacity-40 disabled:cursor-not-allowed`,children:i?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`svg`,{className:`animate-spin h-3.5 w-3.5 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,x.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,x.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`})]}),`Running…`]}):(0,x.jsx)(x.Fragment,{children:`▶ Run`})}),c&&(0,x.jsxs)(`div`,{className:`rounded-md border border-red-700/60 bg-red-900/20 px-3 py-2`,children:[(0,x.jsx)(`p`,{className:`text-[10px] font-bold text-red-400 uppercase tracking-wider mb-0.5`,children:`Error`}),(0,x.jsx)(`p`,{className:`text-[11px] text-red-300 font-mono break-words`,children:c})]}),o&&(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-gray-500`,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-white font-semibold`,children:o.totalCount}),` result`,o.totalCount===1?``:`s`]}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-white font-semibold`,children:o.executionTimeMs}),` ms`]}),o.truncated&&(0,x.jsx)(`span`,{className:`text-yellow-400 font-semibold`,children:`⚠ truncated`})]}),S&&(0,x.jsx)(Ia,{nodes:o.nodes,onSelectNode:_}),C&&o.groups&&(0,x.jsx)(La,{groups:o.groups}),o.edges&&o.edges.length>0&&(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-500`,children:[`+ `,(0,x.jsx)(`span`,{className:`text-white`,children:o.edges.length}),` edge`,o.edges.length===1?``:`s`,` in result`]}),!S&&!C&&(0,x.jsx)(`p`,{className:`text-[11px] text-gray-500 italic`,children:`No results.`})]})]})]})}function za(){let{state:e}=T(),[t,n]=(0,b.useState)(`unknown`),[r,i]=(0,b.useState)(!1),a=(0,b.useRef)(null),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),u=(0,b.useRef)(null),d=e=>{l(e),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>l(null),4e3)};(0,b.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),(0,b.useEffect)(()=>{if(!e.connected||!e.currentUser)return;let t=e.serverUrl.replace(/^http/,`ws`)+`/ws`,n=null,r=null,i=!1;function a(){if(!i)try{n=new WebSocket(t),n.onopen=()=>s(!0),n.onclose=()=>{if(s(!1),!i){let e=Math.random()*500;r=setTimeout(a,3e3+e)}},n.onerror=()=>{},n.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.type===`graph:updated`){let e=t.changedFiles?.length??0;d(`Graph updated — ${e} file${e===1?``:`s`} changed`)}}catch{}}}catch{}}return a(),()=>{i=!0,r&&clearTimeout(r),n?.close(),s(!1)}},[e.connected,e.currentUser,e.serverUrl]);let f=(0,b.useCallback)(async()=>{if(!e.connected)return;let t=new E(e.serverUrl);try{let e=await t.vectorStatus();if(e.ready){n(`ready`),i(!1),a.current&&clearTimeout(a.current);return}e.building?(n(`building`),i(!0)):(n(`unknown`),i(!1))}catch{n(`unknown`),i(!1)}a.current=setTimeout(()=>void f(),5e3)},[e.connected,e.serverUrl]);(0,b.useEffect)(()=>(a.current&&clearTimeout(a.current),n(`unknown`),i(!1),e.connected&&f(),()=>{a.current&&clearTimeout(a.current)}),[e.connected,e.serverUrl]);let p=e.connected?`bg-green-500`:`bg-gray-500`,m;m=t===`building`?(0,x.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-400`,children:[(0,x.jsx)(`span`,{className:`inline-block`,style:{animation:r?`spin 1s linear infinite`:`none`},children:`⟳`}),(0,x.jsx)(`span`,{children:`vec building…`})]}):t===`ready`?(0,x.jsx)(`span`,{className:`text-green-400`,children:`⚡ vec ready`}):(0,x.jsx)(`span`,{className:`text-gray-600`,children:`vec –`});let h=e.selectedNode;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`style`,{children:`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}),c&&(0,x.jsxs)(`div`,{className:`fixed bottom-10 left-1/2 -translate-x-1/2 z-50 bg-cyan-900/90 border border-cyan-500/50 text-cyan-200 text-xs px-4 py-2 rounded-lg shadow-lg flex items-center gap-2 pointer-events-none`,children:[(0,x.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-cyan-400 animate-pulse`}),c]}),(0,x.jsxs)(`div`,{className:`h-7 bg-[#050810] border-t border-gray-800 flex items-center px-3 text-xs text-gray-500 shrink-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`span`,{className:`w-2 h-2 rounded-full ${p}`}),(0,x.jsx)(`span`,{className:e.connected?`text-gray-400`:`text-gray-600`,children:e.connected?e.serverUrl:`Disconnected`})]}),e.connected&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`text-gray-700`,children:`·`}),(0,x.jsxs)(`span`,{className:`flex items-center gap-1`,title:o?`Live updates active`:`Live updates disconnected`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${o?`bg-green-400`:`bg-gray-600`}`}),(0,x.jsx)(`span`,{className:o?`text-green-400`:`text-gray-600`,children:`live`})]})]}),(0,x.jsx)(`span`,{className:`text-gray-700`,children:`·`}),m,e.nodes.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`text-gray-700`,children:`·`}),(0,x.jsxs)(`span`,{className:`text-gray-500`,children:[e.nodes.length.toLocaleString(),` nodes  / `,e.edges.length.toLocaleString(),` edges`]})]})]}),(0,x.jsx)(`div`,{className:`flex-1`}),h&&(0,x.jsx)(`span`,{className:`max-w-[30ch] truncate px-2 py-0.5 rounded-full bg-gray-800 text-gray-300 border border-gray-700 font-mono`,title:h.name,children:h.name})]})]})}var Ba={admin:`text-red-400 border-red-700/50 bg-red-900/20`,analyst:`text-cyan-400 border-cyan-700/50 bg-cyan-900/20`,viewer:`text-gray-400 border-gray-700/50 bg-gray-800/30`,"repo-owner":`text-indigo-400 border-indigo-700/50 bg-indigo-900/20`};function Va({onToggleAI:e,aiOpen:t}){let{state:n,dispatch:r}=T(),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(null),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(!1),v=(0,b.useRef)(null),y=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(!n.connected)return;let e=async()=>{try{let t=await new E(n.serverUrl).vectorStatus();d(t.ready),!t.ready&&t.building&&setTimeout(e,3e3)}catch{}};e()},[n.connected,n.serverUrl]),(0,b.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),v.current?.focus(),s(!0)),e.key===`Escape`&&(s(!1),h(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,b.useEffect)(()=>{let e=e=>{y.current&&!y.current.contains(e.target)&&h(!1)};return m&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]);let S=async e=>{if(!e.trim()){s(!1);return}p(!0);try{let t=new E(n.serverUrl);if(c&&u){let{results:n,source:i}=await t.vectorSearch(e,12);r({type:`SET_SEARCH`,query:e,results:n}),console.log(`[search] vector source:`,i)}else{let{results:n}=await t.search(e,12);r({type:`SET_SEARCH`,query:e,results:n})}s(!0)}catch(e){console.error(e)}finally{p(!1)}},C=async()=>{_(!0);try{await new E(n.serverUrl).logout()}catch{}finally{r({type:`SET_CURRENT_USER`,user:null}),r({type:`SET_CONNECTED`,connected:!1}),r({type:`SET_GRAPH`,nodes:[],edges:[]}),r({type:`SET_VIEW`,view:`login`}),_(!1),h(!1)}},w=n.currentUser;return(0,x.jsxs)(`div`,{className:`h-12 bg-[#0a0a0f] border-b border-gray-800 flex items-center px-4 gap-4 relative z-30`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`div`,{className:`w-7 h-7 rounded-md bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white font-bold text-sm`,children:`◈`}),(0,x.jsx)(`span`,{className:`text-white font-semibold tracking-tight`,children:`Code Intel`}),n.repoName&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`text-gray-600`,children:`·`}),n.mode===`group`?(0,x.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`text-xs bg-indigo-900/50 text-indigo-300 border border-indigo-700/50 rounded px-1.5 py-0.5 font-mono`,children:`group`}),(0,x.jsx)(`span`,{className:`text-cyan-400 text-sm font-mono`,children:n.repoName})]}):(0,x.jsx)(`span`,{className:`text-cyan-400 text-sm font-mono`,children:n.repoName})]})]}),(0,x.jsxs)(`div`,{className:`flex-1 max-w-2xl mx-auto relative`,children:[(0,x.jsxs)(`div`,{className:`relative flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-gray-500 text-sm z-10`,children:f?(0,x.jsx)(`span`,{className:`animate-spin inline-block`,children:`⟳`}):`⌕`}),(0,x.jsx)(`input`,{ref:v,type:`text`,value:i,onChange:e=>a(e.target.value),onFocus:()=>s(n.search.results.length>0||i.length>0),onBlur:()=>setTimeout(()=>s(!1),150),onKeyDown:e=>{e.key===`Enter`&&S(i),e.key===`Escape`&&(s(!1),v.current?.blur())},placeholder:c&&u?`Semantic search…`:`Search nodes…`,className:`w-full bg-gray-900/80 border border-gray-700 rounded-lg pl-9 pr-28 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-500 focus:outline-none`}),(0,x.jsx)(`button`,{onClick:()=>l(e=>!e),title:u?c?`Switch to keyword search`:`Switch to vector/semantic search`:`Vector index building…`,className:`absolute right-14 top-1/2 -translate-y-1/2 text-[10px] px-1.5 py-0.5 rounded border font-mono transition-all ${u===null?`text-gray-600 border-gray-700`:u&&c?`text-purple-300 border-purple-600 bg-purple-900/30`:u?`text-gray-400 border-gray-700 hover:border-purple-600 hover:text-purple-300`:`text-yellow-600 border-yellow-800 animate-pulse`}`,children:u===null?`…`:u?c?`⚡ vec`:`vec`:`⟳ vec`}),(0,x.jsx)(`span`,{className:`absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 text-xs border border-gray-700 rounded px-1.5 py-0.5 font-mono bg-gray-800/60`,children:`⌘K`})]}),o&&n.search.results.length>0&&(0,x.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 bg-gray-900 border border-gray-700 rounded-lg shadow-2xl max-h-96 overflow-y-auto`,children:n.search.results.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 hover:bg-gray-800 cursor-pointer border-b border-gray-800/60 last:border-0`,onMouseDown:t=>{t.preventDefault();let i=n.nodes.find(t=>t.id===e.nodeId);i&&(r({type:`SELECT_NODE`,node:i}),s(!1))},children:[(0,x.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:wi[e.kind]??`#666`}}),(0,x.jsx)(`span`,{className:`text-sm text-white font-medium truncate`,children:e.name}),(0,x.jsx)(`span`,{className:`text-xs text-gray-500 ml-auto truncate max-w-xs`,children:e.filePath})]},e.nodeId))})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-gray-400 font-mono`,children:[(0,x.jsxs)(`span`,{children:[n.nodes.length.toLocaleString(),` nodes`]}),(0,x.jsx)(`span`,{children:`·`}),(0,x.jsxs)(`span`,{children:[n.edges.length.toLocaleString(),` edges`]})]}),(0,x.jsxs)(`button`,{onClick:e,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition ${t?`bg-gradient-to-r from-indigo-600 to-purple-600 text-white`:`bg-gray-800 hover:bg-gray-700 text-gray-200 border border-gray-700`}`,children:[(0,x.jsx)(`span`,{children:`✦`}),`Code AI`]}),w&&(0,x.jsxs)(`div`,{className:`relative`,ref:y,children:[(0,x.jsxs)(`button`,{onClick:()=>h(e=>!e),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg hover:bg-gray-800 border border-gray-700/60 transition`,children:[(0,x.jsx)(`div`,{className:`w-6 h-6 rounded-full bg-gradient-to-br from-cyan-600 to-blue-600 flex items-center justify-center text-white text-xs font-bold select-none`,children:w.username.charAt(0).toUpperCase()}),(0,x.jsx)(`span`,{className:`text-sm text-gray-200 max-w-[80px] truncate`,children:w.username}),(0,x.jsx)(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded border font-mono ${Ba[w.role]??Ba.viewer}`,children:w.role}),(0,x.jsx)(`svg`,{className:`w-3 h-3 text-gray-500 transition-transform ${m?`rotate-180`:``}`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 9l-7 7-7-7`})})]}),m&&(0,x.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-52 bg-gray-900 border border-gray-700 rounded-xl shadow-2xl py-1 z-50`,children:[(0,x.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-gray-800`,children:[(0,x.jsx)(`p`,{className:`text-sm text-white font-semibold`,children:w.username}),(0,x.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5 capitalize`,children:w.role})]}),(0,x.jsxs)(`button`,{onClick:()=>{h(!1),r({type:`SET_CONNECTED`,connected:!1}),r({type:`SET_VIEW`,view:`connect`})},className:`w-full text-left px-4 py-2 text-sm text-gray-300 hover:bg-gray-800 hover:text-white transition flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`text-gray-500`,children:`⬡`}),`Switch Repository`]}),(0,x.jsxs)(`button`,{onClick:C,disabled:g,className:`w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-red-950/30 hover:text-red-300 transition flex items-center gap-2 disabled:opacity-50`,children:[g?(0,x.jsx)(`span`,{className:`animate-spin inline-block text-xs`,children:`⟳`}):(0,x.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1`})}),g?`Signing out…`:`Sign out`]})]})]})]})}var Ha=[{title:`Navigation`,shortcuts:[{keys:[`Esc`],description:`Close panel / Deselect node`},{keys:[`Tab`],description:`Cycle through NodeDetail tabs`},{keys:[`←`,`→`],description:`Navigate search results`}]},{title:`Search`,shortcuts:[{keys:[`⌘K`,`Ctrl+K`],description:`Focus search`},{keys:[`?`],description:`Toggle shortcuts panel`}]},{title:`Graph`,shortcuts:[{keys:[`F`],description:`Fit graph to view`},{keys:[`G`],description:`Jump to graph`}]}];function Ua({open:e,onClose:t}){let n=(0,b.useRef)(null);if((0,b.useEffect)(()=>{if(!e)return;function n(e){e.key===`Escape`&&t()}return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;function r(e){e.target===n.current&&t()}return(0,x.jsx)(`div`,{ref:n,onClick:r,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,children:(0,x.jsxs)(`div`,{className:`w-full max-w-sm bg-[#0c0f1e] border border-gray-800 rounded-xl shadow-2xl overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-gray-800`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-gray-100 tracking-wide`,children:`Keyboard Shortcuts`}),(0,x.jsx)(`button`,{onClick:t,className:`text-gray-500 hover:text-gray-200 transition text-base leading-none`,"aria-label":`Close shortcuts panel`,children:`×`})]}),(0,x.jsx)(`div`,{className:`p-4 space-y-5`,children:Ha.map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[10px] font-bold tracking-widest text-cyan-500/70 uppercase mb-2`,children:e.title}),(0,x.jsx)(`div`,{className:`space-y-2`,children:e.shortcuts.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:e.keys.map(e=>(0,x.jsx)(`span`,{className:`bg-gray-800 border border-gray-700 text-gray-300 font-mono text-xs rounded px-1.5 py-0.5`,children:e},e))}),(0,x.jsx)(`span`,{className:`text-gray-400 text-xs text-right`,children:e.description})]},e.description))})]},e.title))})]})})}function Wa(){let{state:e,dispatch:t}=T(),[n,r]=(0,b.useState)(`explorer`),[i,a]=(0,b.useState)(!0),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{function e(e){let t=e.target,n=t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable;e.key===`?`&&!n&&s(e=>!e)}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,b.useEffect)(()=>{e.selectedNode&&e.selectedNode.filePath&&e.selectedNode.startLine?l(!0):l(!1)},[e.selectedNode?.id]),(0,x.jsxs)(`div`,{className:`flex flex-col h-screen bg-[#040812] text-white`,children:[(0,x.jsx)(Va,{onToggleAI:()=>a(e=>!e),aiOpen:i}),(0,x.jsx)(Ua,{open:o,onClose:()=>s(!1)}),(0,x.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`w-72 bg-[#080b14] border-r border-gray-800/50 flex flex-col`,children:[(0,x.jsx)(`div`,{className:`flex border-b border-gray-800/50`,children:[`explorer`,`filters`,`files`,`query`].concat(e.mode===`group`?[`group`]:[]).map(e=>(0,x.jsx)(`button`,{onClick:()=>r(e),className:`flex-1 px-3 py-2.5 text-xs font-semibold capitalize tracking-wide transition ${n===e?`text-cyan-400 border-b-2 border-cyan-500 bg-cyan-500/5`:`text-gray-500 hover:text-gray-300 hover:bg-gray-800/30`}`,children:e===`group`?`⬢ group`:e},e))}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[n===`explorer`&&(0,x.jsx)(Ga,{}),n===`filters`&&(0,x.jsx)(Ta,{}),n===`files`&&(0,x.jsx)(xa,{}),n===`query`&&(0,x.jsx)(Ra,{}),n===`group`&&e.mode===`group`&&(0,x.jsx)(Ka,{})]})]}),(0,x.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,x.jsx)(`div`,{className:`flex-1 relative`,children:(0,x.jsx)(ki,{})}),e.selectedNode&&(0,x.jsx)(Fi,{node:e.selectedNode,onClose:()=>t({type:`SELECT_NODE`,node:null})}),c&&e.selectedNode?.filePath&&e.selectedNode?.startLine&&(0,x.jsx)(Ki,{file:e.selectedNode.filePath,startLine:e.selectedNode.startLine,endLine:e.selectedNode.endLine??e.selectedNode.startLine,onClose:()=>{l(!1)}})]}),i&&(0,x.jsx)(`div`,{className:`w-96 border-l border-gray-800/50 flex flex-col`,children:(0,x.jsx)(ra,{})})]}),(0,x.jsx)(za,{})]})}function Ga(){let{state:e,dispatch:t}=T(),n=new Map;for(let t of e.nodes)n.set(t.kind,(n.get(t.kind)??0)+1);let r=[...n.entries()].sort((e,t)=>t[1]-e[1]).slice(0,10),i=r[0]?.[1]??1;return(0,x.jsxs)(`div`,{className:`overflow-y-auto h-full text-sm`,children:[e.search.results.length>0&&(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-cyan-500/80 uppercase`,children:`Search Results`}),(0,x.jsx)(`span`,{className:`text-[10px] bg-cyan-900/30 text-cyan-400 px-1.5 py-0.5 rounded-full font-mono`,children:e.search.results.length})]}),(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-500 mb-2 truncate`,children:[`"`,e.search.query,`"`]}),(0,x.jsx)(`div`,{className:`space-y-0.5`,children:e.search.results.map(n=>(0,x.jsxs)(`button`,{onClick:()=>{let r=e.nodes.find(e=>e.id===n.nodeId);r&&t({type:`SELECT_NODE`,node:r})},className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-800/50 text-left group transition`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{backgroundColor:wi[n.kind]??`#6b7280`}}),(0,x.jsx)(`span`,{className:`text-xs text-gray-200 font-medium truncate flex-1 group-hover:text-white`,children:n.name}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 font-mono`,children:n.kind})]},n.nodeId))})]}),(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-3`,children:`Graph Composition`}),(0,x.jsx)(`div`,{className:`space-y-2`,children:r.map(([e,t])=>{let n=wi[e]??`#6b7280`,r=t/i*100;return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] mb-0.5`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{backgroundColor:n}}),(0,x.jsx)(`span`,{className:`text-gray-300`,children:e})]}),(0,x.jsx)(`span`,{className:`text-gray-500 font-mono tabular-nums`,children:t})]}),(0,x.jsx)(`div`,{className:`h-1 bg-gray-800/80 rounded-full overflow-hidden`,children:(0,x.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${r}%`,backgroundColor:n,opacity:.7}})})]},e)})})]}),(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-2`,children:`Overview`}),(0,x.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[{label:`Nodes`,value:e.nodes.length,color:`text-cyan-400`},{label:`Edges`,value:e.edges.length,color:`text-purple-400`},{label:`Files`,value:n.get(`file`)??0,color:`text-blue-400`},{label:`Functions`,value:n.get(`function`)??0,color:`text-sky-400`}].map(({label:e,value:t,color:n})=>(0,x.jsxs)(`div`,{className:`bg-gray-900/50 rounded-lg p-2 border border-gray-800/50`,children:[(0,x.jsx)(`p`,{className:`text-base font-bold font-mono ${n}`,children:t}),(0,x.jsx)(`p`,{className:`text-[10px] text-gray-500`,children:e})]},e))})]}),(0,x.jsx)(`div`,{className:`p-3`,children:(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-600 leading-relaxed`,children:[(0,x.jsx)(`span`,{className:`text-gray-400 font-mono`,children:`⌘K`}),` to search. Click nodes to inspect. Toggle `,(0,x.jsx)(`span`,{className:`text-cyan-500`,children:`⚡ vec`}),` for semantic search. Use `,(0,x.jsx)(`span`,{className:`text-gray-400`,children:`Filters`}),` to show/hide node types.`]})})]})}function Ka(){let{state:e,dispatch:t}=T(),[n,r]=(0,b.useState)(!1),[i,a]=(0,b.useState)(``);return(0,x.jsxs)(`div`,{className:`overflow-y-auto h-full text-sm`,children:[(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-indigo-400/80 uppercase`,children:[`⬢ `,e.groupName]}),(0,x.jsx)(`button`,{onClick:async()=>{r(!0),a(``);try{let n=await new E(e.serverUrl).syncGroup(e.groupName);t({type:`SET_GROUP_CONTRACTS`,contracts:n.contracts,links:n.links,syncedAt:n.syncedAt})}catch(e){a(e instanceof Error?e.message:`Sync failed`)}finally{r(!1)}},disabled:n,className:`text-[10px] text-indigo-400 hover:text-indigo-300 border border-indigo-800/50 hover:border-indigo-600 rounded px-1.5 py-0.5 transition disabled:opacity-50`,children:n?`⟳ syncing…`:`↻ sync`})]}),i&&(0,x.jsx)(`p`,{className:`text-red-400 text-[10px] mt-1`,children:i}),e.groupSyncedAt&&(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-600`,children:[`Last sync: `,new Date(e.groupSyncedAt).toLocaleString()]})]}),(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-2`,children:[`Members (`,e.groupMembers.length,`)`]}),(0,x.jsx)(`div`,{className:`space-y-1`,children:e.groupMembers.map(e=>(0,x.jsxs)(`div`,{className:`bg-gray-900/40 rounded-md px-2 py-1.5 border border-gray-800/30`,children:[(0,x.jsx)(`div`,{className:`text-[10px] text-gray-500 font-mono truncate`,children:e.groupPath}),(0,x.jsx)(`div`,{className:`text-xs text-cyan-400 font-medium truncate`,children:e.registryName})]},e.groupPath))})]}),e.groupContracts.length>0&&(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-2`,children:[`Contracts (`,e.groupContracts.length,`)`]}),(0,x.jsx)(`div`,{className:`space-y-0.5 max-h-40 overflow-y-auto`,children:e.groupContracts.slice(0,30).map((e,t)=>(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 py-0.5`,children:[(0,x.jsx)(`span`,{className:`text-[9px] px-1 rounded font-mono ${e.kind===`export`?`bg-cyan-900/40 text-cyan-400`:e.kind===`route`?`bg-green-900/40 text-green-400`:e.kind===`event`?`bg-purple-900/40 text-purple-400`:`bg-yellow-900/40 text-yellow-400`}`,children:e.kind}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-300 truncate`,children:e.name}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 ml-auto shrink-0`,children:e.repoName})]},t))})]}),e.groupLinks.length>0&&(0,x.jsxs)(`div`,{className:`p-3`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-2`,children:[`Cross-repo Links (`,e.groupLinks.length,`)`]}),(0,x.jsx)(`div`,{className:`space-y-1 max-h-48 overflow-y-auto`,children:e.groupLinks.filter(e=>e.confidence>=.7).slice(0,20).map((e,t)=>(0,x.jsxs)(`div`,{className:`bg-gray-900/40 rounded-md px-2 py-1.5 border border-gray-800/30 text-[10px]`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1 mb-0.5`,children:[(0,x.jsx)(`span`,{className:`text-green-400 font-mono`,children:e.providerRepo}),(0,x.jsx)(`span`,{className:`text-gray-600`,children:`∷`}),(0,x.jsx)(`span`,{className:`text-white truncate`,children:e.providerContract})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`text-gray-600 pl-3`,children:`↔`}),(0,x.jsx)(`span`,{className:`text-indigo-400 font-mono`,children:e.consumerRepo}),(0,x.jsx)(`span`,{className:`text-gray-600`,children:`∷`}),(0,x.jsx)(`span`,{className:`text-white truncate`,children:e.consumerContract}),(0,x.jsxs)(`span`,{className:`ml-auto text-gray-600`,children:[(e.confidence*100).toFixed(0),`%`]})]})]},t))})]}),e.groupContracts.length===0&&e.groupMembers.length>0&&(0,x.jsxs)(`div`,{className:`p-3 text-center`,children:[(0,x.jsx)(`p`,{className:`text-[10px] text-gray-600`,children:`No contract data yet.`}),(0,x.jsx)(`p`,{className:`text-[10px] text-gray-600 mt-1`,children:`Click ↻ sync to extract contracts.`})]})]})}function qa(){let{state:e}=T();switch(e.view){case`login`:return(0,x.jsx)(te,{});case`connect`:return(0,x.jsx)(re,{});case`loading`:return(0,x.jsx)(O,{});case`exploring`:return(0,x.jsx)(Wa,{})}}function Ja(){return(0,x.jsx)(ee,{children:(0,x.jsx)(qa,{})})}y.createRoot(document.getElementById(`root`)).render((0,x.jsx)(b.StrictMode,{children:(0,x.jsx)(Ja,{})}));export{c as n,o as t};
348
+ `)},[n]);let m=(0,b.useCallback)(()=>{f.current&&p.current&&(p.current.scrollTop=f.current.scrollTop,p.current.scrollLeft=f.current.scrollLeft)},[]),h=(0,b.useCallback)(async()=>{let t=n.trim();if(!(!t||i)){a(!0),l(null),s(null);try{s(await new E(e.serverUrl).queryGQL(t)),Na(t),d(ja())}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(!1)}}},[n,i,e.serverUrl]),g=(0,b.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),h())},[h]),_=(0,b.useCallback)(e=>{t({type:`SELECT_NODE`,node:e})},[t]),v=e=>{let t=e.target.value;t&&(r(t),e.target.value=``)},y=e=>{let t=e.target.value;t&&(r(t),e.target.value=``)},S=o&&o.nodes.length>0,C=o&&o.groups&&o.groups.length>0;return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden text-sm`,children:[(0,x.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-800/50 flex-shrink-0`,children:(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-cyan-500/80 uppercase`,children:`GQL Query Console`})}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-3 py-2 space-y-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-[10px] text-gray-500 mb-1 font-semibold uppercase tracking-wider`,children:`Examples`}),(0,x.jsxs)(`select`,{onChange:v,defaultValue:``,className:`w-full bg-[#0d1117] border border-gray-700/60 rounded text-[11px] text-gray-300 px-2 py-1 focus:outline-none focus:border-cyan-700 cursor-pointer`,children:[(0,x.jsx)(`option`,{value:``,disabled:!0,children:`— pick an example —`}),ka.map(e=>(0,x.jsx)(`option`,{value:e,children:e},e))]})]}),u.length>0&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`label`,{className:`block text-[10px] text-gray-500 mb-1 font-semibold uppercase tracking-wider`,children:`History`}),(0,x.jsxs)(`select`,{onChange:y,defaultValue:``,className:`w-full bg-[#0d1117] border border-gray-700/60 rounded text-[11px] text-gray-300 px-2 py-1 focus:outline-none focus:border-cyan-700 cursor-pointer`,children:[(0,x.jsx)(`option`,{value:``,disabled:!0,children:`— recent queries —`}),u.map((e,t)=>(0,x.jsx)(`option`,{value:e,children:e.length>60?e.slice(0,57)+`…`:e},t))]})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`label`,{className:`block text-[10px] text-gray-500 mb-1 font-semibold uppercase tracking-wider`,children:[`Query `,(0,x.jsx)(`span`,{className:`text-gray-600 normal-case font-normal`,children:`(Ctrl+Enter to run)`})]}),(0,x.jsxs)(`div`,{className:`relative`,style:{height:`100px`},children:[(0,x.jsx)(`div`,{ref:p,"aria-hidden":`true`,className:`absolute inset-0 m-0 overflow-hidden whitespace-pre-wrap break-words pointer-events-none rounded-md border border-transparent`,style:{fontFamily:`ui-monospace, "Cascadia Code", "Fira Code", monospace`,fontSize:`11px`,lineHeight:`1.5`,padding:`6px 8px`,color:`transparent`,background:`#0d1117`,wordBreak:`break-word`,zIndex:0}}),(0,x.jsx)(`textarea`,{ref:f,value:n,onChange:e=>r(e.target.value),onKeyDown:g,onScroll:m,spellCheck:!1,placeholder:`FIND function WHERE name CONTAINS "auth"`,className:`absolute inset-0 w-full h-full resize-none rounded-md border border-gray-700/60 focus:outline-none focus:border-cyan-600 placeholder-gray-700`,style:{fontFamily:`ui-monospace, "Cascadia Code", "Fira Code", monospace`,fontSize:`11px`,lineHeight:`1.5`,padding:`6px 8px`,background:`transparent`,color:`white`,caretColor:`white`,zIndex:1}})]})]}),(0,x.jsx)(`button`,{onClick:()=>void h(),disabled:i||!n.trim(),className:`w-full py-1.5 rounded-md text-xs font-semibold tracking-wide transition flex items-center justify-center gap-2 bg-cyan-700/80 hover:bg-cyan-600 text-white disabled:opacity-40 disabled:cursor-not-allowed`,children:i?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`svg`,{className:`animate-spin h-3.5 w-3.5 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,x.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,x.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8v8H4z`})]}),`Running…`]}):(0,x.jsx)(x.Fragment,{children:`▶ Run`})}),c&&(0,x.jsxs)(`div`,{className:`rounded-md border border-red-700/60 bg-red-900/20 px-3 py-2`,children:[(0,x.jsx)(`p`,{className:`text-[10px] font-bold text-red-400 uppercase tracking-wider mb-0.5`,children:`Error`}),(0,x.jsx)(`p`,{className:`text-[11px] text-red-300 font-mono break-words`,children:c})]}),o&&(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-gray-500`,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-white font-semibold`,children:o.totalCount}),` result`,o.totalCount===1?``:`s`]}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-white font-semibold`,children:o.executionTimeMs}),` ms`]}),o.truncated&&(0,x.jsx)(`span`,{className:`text-yellow-400 font-semibold`,children:`⚠ truncated`})]}),S&&(0,x.jsx)(Ia,{nodes:o.nodes,onSelectNode:_}),C&&o.groups&&(0,x.jsx)(La,{groups:o.groups}),o.edges&&o.edges.length>0&&(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-500`,children:[`+ `,(0,x.jsx)(`span`,{className:`text-white`,children:o.edges.length}),` edge`,o.edges.length===1?``:`s`,` in result`]}),!S&&!C&&(0,x.jsx)(`p`,{className:`text-[11px] text-gray-500 italic`,children:`No results.`})]})]})]})}function za(e){return e>=.8?`#22c55e`:e>=.5?`#eab308`:`#ef4444`}function Ba(e){return e>=.8?`border-green-500`:e>=.5?`border-yellow-500`:`border-red-500`}function Va(){let{state:e}=T(),[t,n]=(0,b.useState)([]),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(null),[h,g]=(0,b.useState)(null);(0,b.useEffect)(()=>{let t=new E(e.serverUrl);i(!0),o(``),t.listGroups().then(n).catch(e=>o(e instanceof Error?e.message:`Failed to load groups`)).finally(()=>i(!1))},[e.serverUrl]);let _=async t=>{let n=new E(e.serverUrl);f(!0),m(t),u(null),g(null);try{u(await n.getGroupTopology(t))}catch{u({repos:[],edges:[]})}finally{f(!1)}};return r?(0,x.jsx)(`div`,{className:`p-4 text-sm text-gray-500`,children:`Loading groups…`}):a?(0,x.jsx)(`div`,{className:`p-4 text-sm text-red-400`,children:a}):t.length===0?(0,x.jsxs)(`div`,{className:`p-4 text-sm text-gray-600`,children:[(0,x.jsx)(`p`,{children:`No groups configured.`}),(0,x.jsxs)(`p`,{className:`mt-1`,children:[`Use `,(0,x.jsx)(`span`,{className:`font-mono text-gray-400`,children:`code-intel group create <name>`}),` to create one.`]})]}):(0,x.jsxs)(`div`,{className:`overflow-y-auto h-full text-sm`,children:[(0,x.jsx)(`div`,{className:`p-3 border-b border-gray-800/50`,children:(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-indigo-400/80 uppercase mb-1`,children:[`⬡ Groups (`,t.length,`)`]})}),(0,x.jsx)(`div`,{className:`space-y-0`,children:t.map(e=>(0,x.jsxs)(`div`,{className:`border-b border-gray-800/30`,children:[(0,x.jsxs)(`div`,{className:`px-3 py-2 flex items-center justify-between`,children:[(0,x.jsxs)(`button`,{className:`flex items-center gap-1.5 text-left flex-1 min-w-0`,onClick:()=>c(s===e.name?null:e.name),children:[(0,x.jsx)(`span`,{className:`text-[10px] text-gray-500 shrink-0`,children:s===e.name?`▾`:`▸`}),(0,x.jsx)(`span`,{className:`text-xs font-semibold text-indigo-300 truncate`,children:e.name}),(0,x.jsxs)(`span`,{className:`text-[10px] text-gray-600 shrink-0`,children:[`(`,e.memberCount,`)`]})]}),(0,x.jsx)(`button`,{onClick:()=>_(e.name),className:`text-[10px] text-cyan-400 hover:text-cyan-300 border border-cyan-900/40 hover:border-cyan-700 rounded px-1.5 py-0.5 transition ml-2 shrink-0`,children:`topology`})]}),e.lastSync&&(0,x.jsx)(`div`,{className:`px-3 pb-1`,children:(0,x.jsxs)(`p`,{className:`text-[9px] text-gray-600`,children:[`Synced: `,new Date(e.lastSync).toLocaleString()]})})]},e.name))}),p&&(0,x.jsxs)(`div`,{className:`border-t border-gray-800/50 mt-2`,children:[(0,x.jsxs)(`div`,{className:`px-3 py-2 flex items-center justify-between`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-cyan-500/80 uppercase`,children:[`Topology: `,p]}),(0,x.jsx)(`button`,{onClick:()=>{m(null),u(null),g(null)},className:`text-[10px] text-gray-500 hover:text-gray-300`,children:`✕`})]}),d&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-[10px] text-gray-500`,children:`Loading topology…`}),l&&!d&&(0,x.jsxs)(`div`,{className:`px-3 pb-3`,children:[(0,x.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-3`,children:l.repos.map(e=>{let t=l.edges.filter(t=>t.source===e.name||t.target===e.name),n=t.reduce((e,t)=>Math.max(e,t.confidence),0);return(0,x.jsxs)(`div`,{className:`border rounded-md px-2 py-1.5 bg-gray-900/50 cursor-pointer hover:bg-gray-800/60 transition ${t.length>0?Ba(n):`border-gray-700`}`,title:`${e.groupPath}\n${e.nodeCount} nodes · ${e.edgeCount} edges`,children:[(0,x.jsx)(`div`,{className:`text-[10px] font-semibold text-white truncate max-w-[120px]`,children:e.name}),(0,x.jsxs)(`div`,{className:`text-[9px] text-gray-500 font-mono`,children:[e.nodeCount,`n · `,e.edgeCount,`e`]})]},e.name)})}),l.edges.length>0&&(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`h4`,{className:`text-[9px] font-bold tracking-wider text-gray-600 uppercase mb-1`,children:[`Cross-repo edges (`,l.edges.length,`)`]}),(0,x.jsx)(`div`,{className:`space-y-0.5 max-h-48 overflow-y-auto`,children:l.edges.map((e,t)=>(0,x.jsxs)(`button`,{className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded hover:bg-gray-800/50 transition`,onClick:()=>g(h?.edge===e?null:{edge:e}),children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{backgroundColor:za(e.confidence)}}),(0,x.jsx)(`span`,{className:`text-[10px] text-green-400 font-mono truncate`,children:e.source}),(0,x.jsx)(`span`,{className:`text-[9px] text-gray-600`,children:`→`}),(0,x.jsx)(`span`,{className:`text-[10px] text-indigo-400 font-mono truncate`,children:e.target}),(0,x.jsxs)(`span`,{className:`text-[9px] text-gray-600 ml-auto shrink-0`,children:[(e.confidence*100).toFixed(0),`%`]})]},t))})]}),l.edges.length===0&&(0,x.jsx)(`p`,{className:`text-[10px] text-gray-600`,children:`No cross-repo edges. Run group sync first.`})]})]}),h&&(0,x.jsxs)(`div`,{className:`mx-3 mb-3 bg-gray-900/80 border border-gray-700/60 rounded-md p-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,x.jsx)(`h4`,{className:`text-[9px] font-bold tracking-wider text-gray-400 uppercase`,children:`Edge Detail`}),(0,x.jsx)(`button`,{onClick:()=>g(null),className:`text-[10px] text-gray-600 hover:text-gray-400`,children:`✕`})]}),(0,x.jsxs)(`div`,{className:`space-y-0.5 text-[10px]`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`span`,{className:`text-gray-500`,children:`Contract:`}),` `,(0,x.jsx)(`span`,{className:`text-white font-mono`,children:h.edge.contractName})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`span`,{className:`text-gray-500`,children:`Provider:`}),` `,(0,x.jsx)(`span`,{className:`text-green-400 font-mono`,children:h.edge.source})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`span`,{className:`text-gray-500`,children:`Consumer:`}),` `,(0,x.jsx)(`span`,{className:`text-indigo-400 font-mono`,children:h.edge.target})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`span`,{className:`text-gray-500`,children:`Confidence:`}),` `,(0,x.jsxs)(`span`,{style:{color:za(h.edge.confidence)},className:`font-mono`,children:[(h.edge.confidence*100).toFixed(1),`%`]})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`span`,{className:`text-gray-500`,children:`Kind:`}),` `,(0,x.jsx)(`span`,{className:`text-gray-300`,children:h.edge.kind})]})]})]})]})}function Ha(){let{state:e}=T(),[t,n]=(0,b.useState)(`unknown`),[r,i]=(0,b.useState)(!1),a=(0,b.useRef)(null),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),u=(0,b.useRef)(null),d=e=>{l(e),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>l(null),4e3)};(0,b.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),(0,b.useEffect)(()=>{if(!e.connected||!e.currentUser)return;let t=e.serverUrl.replace(/^http/,`ws`)+`/ws`,n=null,r=null,i=!1;function a(){if(!i)try{n=new WebSocket(t),n.onopen=()=>s(!0),n.onclose=()=>{if(s(!1),!i){let e=Math.random()*500;r=setTimeout(a,3e3+e)}},n.onerror=()=>{},n.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.type===`graph:updated`){let e=t.changedFiles?.length??0;d(`Graph updated — ${e} file${e===1?``:`s`} changed`)}}catch{}}}catch{}}return a(),()=>{i=!0,r&&clearTimeout(r),n?.close(),s(!1)}},[e.connected,e.currentUser,e.serverUrl]);let f=(0,b.useCallback)(async()=>{if(!e.connected)return;let t=new E(e.serverUrl);try{let e=await t.vectorStatus();if(e.ready){n(`ready`),i(!1),a.current&&clearTimeout(a.current);return}e.building?(n(`building`),i(!0)):(n(`unknown`),i(!1))}catch{n(`unknown`),i(!1)}a.current=setTimeout(()=>void f(),5e3)},[e.connected,e.serverUrl]);(0,b.useEffect)(()=>(a.current&&clearTimeout(a.current),n(`unknown`),i(!1),e.connected&&f(),()=>{a.current&&clearTimeout(a.current)}),[e.connected,e.serverUrl]);let p=e.connected?`bg-green-500`:`bg-gray-500`,m;m=t===`building`?(0,x.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-400`,children:[(0,x.jsx)(`span`,{className:`inline-block`,style:{animation:r?`spin 1s linear infinite`:`none`},children:`⟳`}),(0,x.jsx)(`span`,{children:`vec building…`})]}):t===`ready`?(0,x.jsx)(`span`,{className:`text-green-400`,children:`⚡ vec ready`}):(0,x.jsx)(`span`,{className:`text-gray-600`,children:`vec –`});let h=e.selectedNode;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`style`,{children:`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}),c&&(0,x.jsxs)(`div`,{className:`fixed bottom-10 left-1/2 -translate-x-1/2 z-50 bg-cyan-900/90 border border-cyan-500/50 text-cyan-200 text-xs px-4 py-2 rounded-lg shadow-lg flex items-center gap-2 pointer-events-none`,children:[(0,x.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-cyan-400 animate-pulse`}),c]}),(0,x.jsxs)(`div`,{className:`h-7 bg-[#050810] border-t border-gray-800 flex items-center px-3 text-xs text-gray-500 shrink-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`span`,{className:`w-2 h-2 rounded-full ${p}`}),(0,x.jsx)(`span`,{className:e.connected?`text-gray-400`:`text-gray-600`,children:e.connected?e.serverUrl:`Disconnected`})]}),e.connected&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`text-gray-700`,children:`·`}),(0,x.jsxs)(`span`,{className:`flex items-center gap-1`,title:o?`Live updates active`:`Live updates disconnected`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${o?`bg-green-400`:`bg-gray-600`}`}),(0,x.jsx)(`span`,{className:o?`text-green-400`:`text-gray-600`,children:`live`})]})]}),(0,x.jsx)(`span`,{className:`text-gray-700`,children:`·`}),m,e.nodes.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`text-gray-700`,children:`·`}),(0,x.jsxs)(`span`,{className:`text-gray-500`,children:[e.nodes.length.toLocaleString(),` nodes  / `,e.edges.length.toLocaleString(),` edges`]})]})]}),(0,x.jsx)(`div`,{className:`flex-1`}),h&&(0,x.jsx)(`span`,{className:`max-w-[30ch] truncate px-2 py-0.5 rounded-full bg-gray-800 text-gray-300 border border-gray-700 font-mono mr-3`,title:h.name,children:h.name}),(0,x.jsxs)(`span`,{className:`font-mono text-gray-700 text-[10px] select-none`,children:[`v`,`0.7.0`]})]})]})}var Ua={admin:`text-red-400 border-red-700/50 bg-red-900/20`,analyst:`text-cyan-400 border-cyan-700/50 bg-cyan-900/20`,viewer:`text-gray-400 border-gray-700/50 bg-gray-800/30`,"repo-owner":`text-indigo-400 border-indigo-700/50 bg-indigo-900/20`};function Wa({onToggleAI:e,aiOpen:t}){let{state:n,dispatch:r}=T(),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(null),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(!1),v=(0,b.useRef)(null),y=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(!n.connected)return;let e=async()=>{try{let t=await new E(n.serverUrl).vectorStatus();d(t.ready),!t.ready&&t.building&&setTimeout(e,3e3)}catch{}};e()},[n.connected,n.serverUrl]),(0,b.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),v.current?.focus(),s(!0)),e.key===`Escape`&&(s(!1),h(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,b.useEffect)(()=>{let e=e=>{y.current&&!y.current.contains(e.target)&&h(!1)};return m&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]);let S=async e=>{if(!e.trim()){s(!1);return}p(!0);try{let t=new E(n.serverUrl);if(c&&u){let{results:n,source:i}=await t.vectorSearch(e,12);r({type:`SET_SEARCH`,query:e,results:n}),console.log(`[search] vector source:`,i)}else{let{results:n}=await t.search(e,12);r({type:`SET_SEARCH`,query:e,results:n})}s(!0)}catch(e){console.error(e)}finally{p(!1)}},C=async()=>{_(!0);try{await new E(n.serverUrl).logout()}catch{}finally{r({type:`SET_CURRENT_USER`,user:null}),r({type:`SET_CONNECTED`,connected:!1}),r({type:`SET_GRAPH`,nodes:[],edges:[]}),r({type:`SET_VIEW`,view:`login`}),_(!1),h(!1)}},w=n.currentUser;return(0,x.jsxs)(`div`,{className:`h-12 bg-[#0a0a0f] border-b border-gray-800 flex items-center px-4 gap-4 relative z-30`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`div`,{className:`w-7 h-7 rounded-md bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-white font-bold text-sm`,children:`◈`}),(0,x.jsx)(`span`,{className:`text-white font-semibold tracking-tight`,children:`Code Intel`}),n.repoName&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`text-gray-600`,children:`·`}),n.mode===`group`?(0,x.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`text-xs bg-indigo-900/50 text-indigo-300 border border-indigo-700/50 rounded px-1.5 py-0.5 font-mono`,children:`group`}),(0,x.jsx)(`span`,{className:`text-cyan-400 text-sm font-mono`,children:n.repoName})]}):(0,x.jsx)(`span`,{className:`text-cyan-400 text-sm font-mono`,children:n.repoName})]})]}),(0,x.jsxs)(`div`,{className:`flex-1 max-w-2xl mx-auto relative`,children:[(0,x.jsxs)(`div`,{className:`relative flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-gray-500 text-sm z-10`,children:f?(0,x.jsx)(`span`,{className:`animate-spin inline-block`,children:`⟳`}):`⌕`}),(0,x.jsx)(`input`,{ref:v,type:`text`,value:i,onChange:e=>a(e.target.value),onFocus:()=>s(n.search.results.length>0||i.length>0),onBlur:()=>setTimeout(()=>s(!1),150),onKeyDown:e=>{e.key===`Enter`&&S(i),e.key===`Escape`&&(s(!1),v.current?.blur())},placeholder:c&&u?`Semantic search…`:`Search nodes…`,className:`w-full bg-gray-900/80 border border-gray-700 rounded-lg pl-9 pr-28 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-500 focus:outline-none`}),(0,x.jsx)(`button`,{onClick:()=>l(e=>!e),title:u?c?`Switch to keyword search`:`Switch to vector/semantic search`:`Vector index building…`,className:`absolute right-14 top-1/2 -translate-y-1/2 text-[10px] px-1.5 py-0.5 rounded border font-mono transition-all ${u===null?`text-gray-600 border-gray-700`:u&&c?`text-purple-300 border-purple-600 bg-purple-900/30`:u?`text-gray-400 border-gray-700 hover:border-purple-600 hover:text-purple-300`:`text-yellow-600 border-yellow-800 animate-pulse`}`,children:u===null?`…`:u?c?`⚡ vec`:`vec`:`⟳ vec`}),(0,x.jsx)(`span`,{className:`absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 text-xs border border-gray-700 rounded px-1.5 py-0.5 font-mono bg-gray-800/60`,children:`⌘K`})]}),o&&n.search.results.length>0&&(0,x.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 bg-gray-900 border border-gray-700 rounded-lg shadow-2xl max-h-96 overflow-y-auto`,children:n.search.results.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 hover:bg-gray-800 cursor-pointer border-b border-gray-800/60 last:border-0`,onMouseDown:t=>{t.preventDefault();let i=n.nodes.find(t=>t.id===e.nodeId);i&&(r({type:`SELECT_NODE`,node:i}),s(!1))},children:[(0,x.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:wi[e.kind]??`#666`}}),(0,x.jsx)(`span`,{className:`text-sm text-white font-medium truncate`,children:e.name}),(0,x.jsx)(`span`,{className:`text-xs text-gray-500 ml-auto truncate max-w-xs`,children:e.filePath})]},e.nodeId))})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-gray-400 font-mono`,children:[(0,x.jsxs)(`span`,{children:[n.nodes.length.toLocaleString(),` nodes`]}),(0,x.jsx)(`span`,{children:`·`}),(0,x.jsxs)(`span`,{children:[n.edges.length.toLocaleString(),` edges`]})]}),(0,x.jsxs)(`button`,{onClick:e,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition ${t?`bg-gradient-to-r from-indigo-600 to-purple-600 text-white`:`bg-gray-800 hover:bg-gray-700 text-gray-200 border border-gray-700`}`,children:[(0,x.jsx)(`span`,{children:`✦`}),`Code AI`]}),w&&(0,x.jsxs)(`div`,{className:`relative`,ref:y,children:[(0,x.jsxs)(`button`,{onClick:()=>h(e=>!e),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg hover:bg-gray-800 border border-gray-700/60 transition`,children:[(0,x.jsx)(`div`,{className:`w-6 h-6 rounded-full bg-gradient-to-br from-cyan-600 to-blue-600 flex items-center justify-center text-white text-xs font-bold select-none`,children:w.username.charAt(0).toUpperCase()}),(0,x.jsx)(`span`,{className:`text-sm text-gray-200 max-w-[80px] truncate`,children:w.username}),(0,x.jsx)(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded border font-mono ${Ua[w.role]??Ua.viewer}`,children:w.role}),(0,x.jsx)(`svg`,{className:`w-3 h-3 text-gray-500 transition-transform ${m?`rotate-180`:``}`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 9l-7 7-7-7`})})]}),m&&(0,x.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-52 bg-gray-900 border border-gray-700 rounded-xl shadow-2xl py-1 z-50`,children:[(0,x.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-gray-800`,children:[(0,x.jsx)(`p`,{className:`text-sm text-white font-semibold`,children:w.username}),(0,x.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5 capitalize`,children:w.role})]}),(0,x.jsxs)(`button`,{onClick:()=>{h(!1),r({type:`SET_CONNECTED`,connected:!1}),r({type:`SET_VIEW`,view:`connect`})},className:`w-full text-left px-4 py-2 text-sm text-gray-300 hover:bg-gray-800 hover:text-white transition flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`text-gray-500`,children:`⬡`}),`Switch Repository`]}),(0,x.jsxs)(`button`,{onClick:C,disabled:g,className:`w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-red-950/30 hover:text-red-300 transition flex items-center gap-2 disabled:opacity-50`,children:[g?(0,x.jsx)(`span`,{className:`animate-spin inline-block text-xs`,children:`⟳`}):(0,x.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,x.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1`})}),g?`Signing out…`:`Sign out`]})]})]})]})}var Ga=[{title:`Navigation`,shortcuts:[{keys:[`Esc`],description:`Close panel / Deselect node`},{keys:[`Tab`],description:`Cycle through NodeDetail tabs`},{keys:[`←`,`→`],description:`Navigate search results`}]},{title:`Search`,shortcuts:[{keys:[`⌘K`,`Ctrl+K`],description:`Focus search`},{keys:[`?`],description:`Toggle shortcuts panel`}]},{title:`Graph`,shortcuts:[{keys:[`F`],description:`Fit graph to view`},{keys:[`G`],description:`Jump to graph`}]}];function Ka({open:e,onClose:t}){let n=(0,b.useRef)(null);if((0,b.useEffect)(()=>{if(!e)return;function n(e){e.key===`Escape`&&t()}return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;function r(e){e.target===n.current&&t()}return(0,x.jsx)(`div`,{ref:n,onClick:r,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,children:(0,x.jsxs)(`div`,{className:`w-full max-w-sm bg-[#0c0f1e] border border-gray-800 rounded-xl shadow-2xl overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-gray-800`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-gray-100 tracking-wide`,children:`Keyboard Shortcuts`}),(0,x.jsx)(`button`,{onClick:t,className:`text-gray-500 hover:text-gray-200 transition text-base leading-none`,"aria-label":`Close shortcuts panel`,children:`×`})]}),(0,x.jsx)(`div`,{className:`p-4 space-y-5`,children:Ga.map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[10px] font-bold tracking-widest text-cyan-500/70 uppercase mb-2`,children:e.title}),(0,x.jsx)(`div`,{className:`space-y-2`,children:e.shortcuts.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:e.keys.map(e=>(0,x.jsx)(`span`,{className:`bg-gray-800 border border-gray-700 text-gray-300 font-mono text-xs rounded px-1.5 py-0.5`,children:e},e))}),(0,x.jsx)(`span`,{className:`text-gray-400 text-xs text-right`,children:e.description})]},e.description))})]},e.title))})]})})}function qa(){let{state:e,dispatch:t}=T(),[n,r]=(0,b.useState)(`explorer`),[i,a]=(0,b.useState)(!0),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{function e(e){let t=e.target,n=t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable;e.key===`?`&&!n&&s(e=>!e)}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,b.useEffect)(()=>{e.selectedNode&&e.selectedNode.filePath&&e.selectedNode.startLine?l(!0):l(!1)},[e.selectedNode?.id]),(0,x.jsxs)(`div`,{className:`flex flex-col h-screen bg-[#040812] text-white`,children:[(0,x.jsx)(Wa,{onToggleAI:()=>a(e=>!e),aiOpen:i}),(0,x.jsx)(Ka,{open:o,onClose:()=>s(!1)}),(0,x.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`w-72 bg-[#080b14] border-r border-gray-800/50 flex flex-col`,children:[(0,x.jsx)(`div`,{className:`flex border-b border-gray-800/50`,children:[`explorer`,`filters`,`files`,`query`].concat(e.mode===`group`?[`group`]:[],[`groups`]).map(e=>(0,x.jsx)(`button`,{onClick:()=>r(e),className:`flex-1 px-3 py-2.5 text-xs font-semibold capitalize tracking-wide transition ${n===e?`text-cyan-400 border-b-2 border-cyan-500 bg-cyan-500/5`:`text-gray-500 hover:text-gray-300 hover:bg-gray-800/30`}`,children:e===`group`?`⬢ group`:e===`groups`?`⬡ groups`:e},e))}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[n===`explorer`&&(0,x.jsx)(Ja,{}),n===`filters`&&(0,x.jsx)(Ta,{}),n===`files`&&(0,x.jsx)(xa,{}),n===`query`&&(0,x.jsx)(Ra,{}),n===`group`&&e.mode===`group`&&(0,x.jsx)(Ya,{}),n===`groups`&&(0,x.jsx)(Va,{})]})]}),(0,x.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,x.jsx)(`div`,{className:`flex-1 relative`,children:(0,x.jsx)(ki,{})}),e.selectedNode&&(0,x.jsx)(Fi,{node:e.selectedNode,onClose:()=>t({type:`SELECT_NODE`,node:null})}),c&&e.selectedNode?.filePath&&e.selectedNode?.startLine&&(0,x.jsx)(Ki,{file:e.selectedNode.filePath,startLine:e.selectedNode.startLine,endLine:e.selectedNode.endLine??e.selectedNode.startLine,onClose:()=>{l(!1)}})]}),i&&(0,x.jsx)(`div`,{className:`w-96 border-l border-gray-800/50 flex flex-col`,children:(0,x.jsx)(ra,{})})]}),(0,x.jsx)(Ha,{})]})}function Ja(){let{state:e,dispatch:t}=T(),n=new Map;for(let t of e.nodes)n.set(t.kind,(n.get(t.kind)??0)+1);let r=[...n.entries()].sort((e,t)=>t[1]-e[1]).slice(0,10),i=r[0]?.[1]??1;return(0,x.jsxs)(`div`,{className:`overflow-y-auto h-full text-sm`,children:[e.search.results.length>0&&(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-cyan-500/80 uppercase`,children:`Search Results`}),(0,x.jsx)(`span`,{className:`text-[10px] bg-cyan-900/30 text-cyan-400 px-1.5 py-0.5 rounded-full font-mono`,children:e.search.results.length})]}),(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-500 mb-2 truncate`,children:[`"`,e.search.query,`"`]}),(0,x.jsx)(`div`,{className:`space-y-0.5`,children:e.search.results.map(n=>(0,x.jsxs)(`button`,{onClick:()=>{let r=e.nodes.find(e=>e.id===n.nodeId);r&&t({type:`SELECT_NODE`,node:r})},className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-800/50 text-left group transition`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{backgroundColor:wi[n.kind]??`#6b7280`}}),(0,x.jsx)(`span`,{className:`text-xs text-gray-200 font-medium truncate flex-1 group-hover:text-white`,children:n.name}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 font-mono`,children:n.kind})]},n.nodeId))})]}),(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-3`,children:`Graph Composition`}),(0,x.jsx)(`div`,{className:`space-y-2`,children:r.map(([e,t])=>{let n=wi[e]??`#6b7280`,r=t/i*100;return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] mb-0.5`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:{backgroundColor:n}}),(0,x.jsx)(`span`,{className:`text-gray-300`,children:e})]}),(0,x.jsx)(`span`,{className:`text-gray-500 font-mono tabular-nums`,children:t})]}),(0,x.jsx)(`div`,{className:`h-1 bg-gray-800/80 rounded-full overflow-hidden`,children:(0,x.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${r}%`,backgroundColor:n,opacity:.7}})})]},e)})})]}),(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-2`,children:`Overview`}),(0,x.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[{label:`Nodes`,value:e.nodes.length,color:`text-cyan-400`},{label:`Edges`,value:e.edges.length,color:`text-purple-400`},{label:`Files`,value:n.get(`file`)??0,color:`text-blue-400`},{label:`Functions`,value:n.get(`function`)??0,color:`text-sky-400`}].map(({label:e,value:t,color:n})=>(0,x.jsxs)(`div`,{className:`bg-gray-900/50 rounded-lg p-2 border border-gray-800/50`,children:[(0,x.jsx)(`p`,{className:`text-base font-bold font-mono ${n}`,children:t}),(0,x.jsx)(`p`,{className:`text-[10px] text-gray-500`,children:e})]},e))})]}),(0,x.jsx)(`div`,{className:`p-3`,children:(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-600 leading-relaxed`,children:[(0,x.jsx)(`span`,{className:`text-gray-400 font-mono`,children:`⌘K`}),` to search. Click nodes to inspect. Toggle `,(0,x.jsx)(`span`,{className:`text-cyan-500`,children:`⚡ vec`}),` for semantic search. Use `,(0,x.jsx)(`span`,{className:`text-gray-400`,children:`Filters`}),` to show/hide node types.`]})})]})}function Ya(){let{state:e,dispatch:t}=T(),[n,r]=(0,b.useState)(!1),[i,a]=(0,b.useState)(``);return(0,x.jsxs)(`div`,{className:`overflow-y-auto h-full text-sm`,children:[(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-indigo-400/80 uppercase`,children:[`⬢ `,e.groupName]}),(0,x.jsx)(`button`,{onClick:async()=>{r(!0),a(``);try{let n=await new E(e.serverUrl).syncGroup(e.groupName);t({type:`SET_GROUP_CONTRACTS`,contracts:n.contracts,links:n.links,syncedAt:n.syncedAt})}catch(e){a(e instanceof Error?e.message:`Sync failed`)}finally{r(!1)}},disabled:n,className:`text-[10px] text-indigo-400 hover:text-indigo-300 border border-indigo-800/50 hover:border-indigo-600 rounded px-1.5 py-0.5 transition disabled:opacity-50`,children:n?`⟳ syncing…`:`↻ sync`})]}),i&&(0,x.jsx)(`p`,{className:`text-red-400 text-[10px] mt-1`,children:i}),e.groupSyncedAt&&(0,x.jsxs)(`p`,{className:`text-[10px] text-gray-600`,children:[`Last sync: `,new Date(e.groupSyncedAt).toLocaleString()]})]}),(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-2`,children:[`Members (`,e.groupMembers.length,`)`]}),(0,x.jsx)(`div`,{className:`space-y-1`,children:e.groupMembers.map(e=>(0,x.jsxs)(`div`,{className:`bg-gray-900/40 rounded-md px-2 py-1.5 border border-gray-800/30`,children:[(0,x.jsx)(`div`,{className:`text-[10px] text-gray-500 font-mono truncate`,children:e.groupPath}),(0,x.jsx)(`div`,{className:`text-xs text-cyan-400 font-medium truncate`,children:e.registryName})]},e.groupPath))})]}),e.groupContracts.length>0&&(0,x.jsxs)(`div`,{className:`p-3 border-b border-gray-800/50`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-2`,children:[`Contracts (`,e.groupContracts.length,`)`]}),(0,x.jsx)(`div`,{className:`space-y-0.5 max-h-40 overflow-y-auto`,children:e.groupContracts.slice(0,30).map((e,t)=>(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 py-0.5`,children:[(0,x.jsx)(`span`,{className:`text-[9px] px-1 rounded font-mono ${e.kind===`export`?`bg-cyan-900/40 text-cyan-400`:e.kind===`route`?`bg-green-900/40 text-green-400`:e.kind===`event`?`bg-purple-900/40 text-purple-400`:`bg-yellow-900/40 text-yellow-400`}`,children:e.kind}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-300 truncate`,children:e.name}),(0,x.jsx)(`span`,{className:`text-[10px] text-gray-600 ml-auto shrink-0`,children:e.repoName})]},t))})]}),e.groupLinks.length>0&&(0,x.jsxs)(`div`,{className:`p-3`,children:[(0,x.jsxs)(`h3`,{className:`text-[10px] font-bold tracking-wider text-gray-500 uppercase mb-2`,children:[`Cross-repo Links (`,e.groupLinks.length,`)`]}),(0,x.jsx)(`div`,{className:`space-y-1 max-h-48 overflow-y-auto`,children:e.groupLinks.filter(e=>e.confidence>=.7).slice(0,20).map((e,t)=>(0,x.jsxs)(`div`,{className:`bg-gray-900/40 rounded-md px-2 py-1.5 border border-gray-800/30 text-[10px]`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1 mb-0.5`,children:[(0,x.jsx)(`span`,{className:`text-green-400 font-mono`,children:e.providerRepo}),(0,x.jsx)(`span`,{className:`text-gray-600`,children:`∷`}),(0,x.jsx)(`span`,{className:`text-white truncate`,children:e.providerContract})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`text-gray-600 pl-3`,children:`↔`}),(0,x.jsx)(`span`,{className:`text-indigo-400 font-mono`,children:e.consumerRepo}),(0,x.jsx)(`span`,{className:`text-gray-600`,children:`∷`}),(0,x.jsx)(`span`,{className:`text-white truncate`,children:e.consumerContract}),(0,x.jsxs)(`span`,{className:`ml-auto text-gray-600`,children:[(e.confidence*100).toFixed(0),`%`]})]})]},t))})]}),e.groupContracts.length===0&&e.groupMembers.length>0&&(0,x.jsxs)(`div`,{className:`p-3 text-center`,children:[(0,x.jsx)(`p`,{className:`text-[10px] text-gray-600`,children:`No contract data yet.`}),(0,x.jsx)(`p`,{className:`text-[10px] text-gray-600 mt-1`,children:`Click ↻ sync to extract contracts.`})]})]})}function Xa(){let{state:e}=T();switch(e.view){case`login`:return(0,x.jsx)(te,{});case`connect`:return(0,x.jsx)(re,{});case`loading`:return(0,x.jsx)(O,{});case`exploring`:return(0,x.jsx)(qa,{})}}function Za(){return(0,x.jsx)(ee,{children:(0,x.jsx)(Xa,{})})}y.createRoot(document.getElementById(`root`)).render((0,x.jsx)(b.StrictMode,{children:(0,x.jsx)(Za,{})}));export{c as n,o as t};