@typicalday/firegraph 0.10.0 → 0.11.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.
Files changed (40) hide show
  1. package/README.md +93 -90
  2. package/bin/firegraph.mjs +21 -7
  3. package/dist/{backend-BrqFkbid.d.ts → backend-U-MLShlg.d.ts} +1 -1
  4. package/dist/{backend-73p5Blx7.d.cts → backend-np4gEVhB.d.cts} +1 -1
  5. package/dist/backend.d.cts +3 -3
  6. package/dist/backend.d.ts +3 -3
  7. package/dist/{chunk-LZOIQHYN.js → chunk-6SB34IPQ.js} +20 -7
  8. package/dist/chunk-6SB34IPQ.js.map +1 -0
  9. package/dist/{chunk-SU4FNLC3.js → chunk-EEKWRX5E.js} +1 -1
  10. package/dist/{chunk-SU4FNLC3.js.map → chunk-EEKWRX5E.js.map} +1 -1
  11. package/dist/{chunk-YLGXLEUE.js → chunk-GJVVRTQT.js} +5 -14
  12. package/dist/chunk-GJVVRTQT.js.map +1 -0
  13. package/dist/cloudflare/index.cjs +151 -27
  14. package/dist/cloudflare/index.cjs.map +1 -1
  15. package/dist/cloudflare/index.d.cts +78 -3
  16. package/dist/cloudflare/index.d.ts +78 -3
  17. package/dist/cloudflare/index.js +135 -23
  18. package/dist/cloudflare/index.js.map +1 -1
  19. package/dist/codegen/index.cjs +4 -13
  20. package/dist/codegen/index.cjs.map +1 -1
  21. package/dist/codegen/index.d.cts +1 -1
  22. package/dist/codegen/index.d.ts +1 -1
  23. package/dist/codegen/index.js +1 -1
  24. package/dist/index.cjs +89 -132
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +106 -21
  27. package/dist/index.d.ts +106 -21
  28. package/dist/index.js +70 -116
  29. package/dist/index.js.map +1 -1
  30. package/dist/query-client/index.cjs.map +1 -1
  31. package/dist/query-client/index.js +1 -1
  32. package/dist/{types-DOemdlVA.d.ts → types-BGWxcpI_.d.cts} +75 -1
  33. package/dist/{types-DOemdlVA.d.cts → types-BGWxcpI_.d.ts} +75 -1
  34. package/package.json +35 -27
  35. package/dist/chunk-LZOIQHYN.js.map +0 -1
  36. package/dist/chunk-YLGXLEUE.js.map +0 -1
  37. package/dist/editor/client/assets/index-Bq2bfzeY.js +0 -411
  38. package/dist/editor/client/assets/index-CJ4m_EOL.css +0 -1
  39. package/dist/editor/client/index.html +0 -16
  40. package/dist/editor/server/index.mjs +0 -51566
@@ -1,411 +0,0 @@
1
- var t4=Object.defineProperty;var Y1=t=>{throw TypeError(t)};var r4=(t,e,r)=>e in t?t4(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var kp=(t,e,r)=>r4(t,typeof e!="symbol"?e+"":e,r),Dp=(t,e,r)=>e.has(t)||Y1("Cannot "+r);var W=(t,e,r)=>(Dp(t,e,"read from private field"),r?r.call(t):e.get(t)),qe=(t,e,r)=>e.has(t)?Y1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Me=(t,e,r,a)=>(Dp(t,e,"write to private field"),a?a.call(t,r):e.set(t,r),r),at=(t,e,r)=>(Dp(t,e,"access private method"),r);var Kd=(t,e,r,a)=>({set _(i){Me(t,e,i,r)},get _(){return W(t,e,a)}});function a4(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(a,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&a(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();function PE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Op={exports:{}},Mu={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var K1;function n4(){if(K1)return Mu;K1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(a,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var u in i)u!=="key"&&(s[u]=i[u])}else s=i;return i=s.ref,{$$typeof:t,type:a,key:o,ref:i!==void 0?i:null,props:s}}return Mu.Fragment=e,Mu.jsx=r,Mu.jsxs=r,Mu}var X1;function i4(){return X1||(X1=1,Op.exports=n4()),Op.exports}var g=i4(),nl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},s4={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},zi,mm,TE,l4=(TE=class{constructor(){qe(this,zi,s4);qe(this,mm,!1)}setTimeoutProvider(t){Me(this,zi,t)}setTimeout(t,e){return W(this,zi).setTimeout(t,e)}clearTimeout(t){W(this,zi).clearTimeout(t)}setInterval(t,e){return W(this,zi).setInterval(t,e)}clearInterval(t){W(this,zi).clearInterval(t)}},zi=new WeakMap,mm=new WeakMap,TE),Us=new l4;function o4(t){setTimeout(t,0)}var Xs=typeof window>"u"||"Deno"in globalThis;function Kr(){}function u4(t,e){return typeof t=="function"?t(e):t}function wg(t){return typeof t=="number"&&t>=0&&t!==1/0}function zE(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Zi(t,e){return typeof t=="function"?t(e):t}function Ya(t,e){return typeof t=="function"?t(e):t}function Z1(t,e){const{type:r="all",exact:a,fetchStatus:i,predicate:s,queryKey:o,stale:u}=t;if(o){if(a){if(e.queryHash!==ym(o,e.options))return!1}else if(!$u(e.queryKey,o))return!1}if(r!=="all"){const d=e.isActive();if(r==="active"&&!d||r==="inactive"&&d)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||s&&!s(e))}function W1(t,e){const{exact:r,status:a,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(ts(e.options.mutationKey)!==ts(s))return!1}else if(!$u(e.options.mutationKey,s))return!1}return!(a&&e.state.status!==a||i&&!i(e))}function ym(t,e){return((e==null?void 0:e.queryKeyHashFn)||ts)(t)}function ts(t){return JSON.stringify(t,(e,r)=>Sg(r)?Object.keys(r).sort().reduce((a,i)=>(a[i]=r[i],a),{}):r)}function $u(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>$u(t[r],e[r])):!1}var c4=Object.prototype.hasOwnProperty;function xm(t,e,r=0){if(t===e)return t;if(r>500)return e;const a=J1(t)&&J1(e);if(!a&&!(Sg(t)&&Sg(e)))return e;const s=(a?t:Object.keys(t)).length,o=a?e:Object.keys(e),u=o.length,d=a?new Array(u):{};let f=0;for(let h=0;h<u;h++){const p=a?h:o[h],m=t[p],y=e[p];if(m===y){d[p]=m,(a?h<s:c4.call(t,p))&&f++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){d[p]=y;continue}const x=xm(m,y,r+1);d[p]=x,x===m&&f++}return s===u&&f===s?t:d}function Yu(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function J1(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Sg(t){if(!e2(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!e2(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function e2(t){return Object.prototype.toString.call(t)==="[object Object]"}function d4(t){return new Promise(e=>{Us.setTimeout(e,t)})}function Eg(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?xm(t,e):e}function f4(t,e,r=0){const a=[...t,e];return r&&a.length>r?a.slice(1):a}function h4(t,e,r=0){const a=[e,...t];return r&&a.length>r?a.slice(0,-1):a}var ka=Symbol();function _E(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===ka?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function bm(t,e){return typeof t=="function"?t(...e):!!t}function v4(t,e,r){let a=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),a||(a=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),t}var Is,_i,ho,CE,p4=(CE=class extends nl{constructor(){super();qe(this,Is);qe(this,_i);qe(this,ho);Me(this,ho,e=>{if(!Xs&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){W(this,_i)||this.setEventListener(W(this,ho))}onUnsubscribe(){var e;this.hasListeners()||((e=W(this,_i))==null||e.call(this),Me(this,_i,void 0))}setEventListener(e){var r;Me(this,ho,e),(r=W(this,_i))==null||r.call(this),Me(this,_i,e(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(e){W(this,Is)!==e&&(Me(this,Is,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof W(this,Is)=="boolean"?W(this,Is):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Is=new WeakMap,_i=new WeakMap,ho=new WeakMap,CE),wm=new p4;function Tg(){let t,e;const r=new Promise((i,s)=>{t=i,e=s});r.status="pending",r.catch(()=>{});function a(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{a({status:"fulfilled",value:i}),t(i)},r.reject=i=>{a({status:"rejected",reason:i}),e(i)},r}var g4=o4;function m4(){let t=[],e=0,r=u=>{u()},a=u=>{u()},i=g4;const s=u=>{e?t.push(u):i(()=>{r(u)})},o=()=>{const u=t;t=[],u.length&&i(()=>{a(()=>{u.forEach(d=>{r(d)})})})};return{batch:u=>{let d;e++;try{d=u()}finally{e--,e||o()}return d},batchCalls:u=>(...d)=>{s(()=>{u(...d)})},schedule:s,setNotifyFunction:u=>{r=u},setBatchNotifyFunction:u=>{a=u},setScheduler:u=>{i=u}}}var ar=m4(),vo,Ui,po,NE,y4=(NE=class extends nl{constructor(){super();qe(this,vo,!0);qe(this,Ui);qe(this,po);Me(this,po,e=>{if(!Xs&&window.addEventListener){const r=()=>e(!0),a=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}})}onSubscribe(){W(this,Ui)||this.setEventListener(W(this,po))}onUnsubscribe(){var e;this.hasListeners()||((e=W(this,Ui))==null||e.call(this),Me(this,Ui,void 0))}setEventListener(e){var r;Me(this,po,e),(r=W(this,Ui))==null||r.call(this),Me(this,Ui,e(this.setOnline.bind(this)))}setOnline(e){W(this,vo)!==e&&(Me(this,vo,e),this.listeners.forEach(a=>{a(e)}))}isOnline(){return W(this,vo)}},vo=new WeakMap,Ui=new WeakMap,po=new WeakMap,NE),Df=new y4;function x4(t){return Math.min(1e3*2**t,3e4)}function UE(t){return(t??"online")==="online"?Df.isOnline():!0}var Cg=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function qE(t){let e=!1,r=0,a;const i=Tg(),s=()=>i.status!=="pending",o=E=>{var w;if(!s()){const T=new Cg(E);m(T),(w=t.onCancel)==null||w.call(t,T)}},u=()=>{e=!0},d=()=>{e=!1},f=()=>wm.isFocused()&&(t.networkMode==="always"||Df.isOnline())&&t.canRun(),h=()=>UE(t.networkMode)&&t.canRun(),p=E=>{s()||(a==null||a(),i.resolve(E))},m=E=>{s()||(a==null||a(),i.reject(E))},y=()=>new Promise(E=>{var w;a=T=>{(s()||f())&&E(T)},(w=t.onPause)==null||w.call(t)}).then(()=>{var E;a=void 0,s()||(E=t.onContinue)==null||E.call(t)}),x=()=>{if(s())return;let E;const w=r===0?t.initialPromise:void 0;try{E=w??t.fn()}catch(T){E=Promise.reject(T)}Promise.resolve(E).then(p).catch(T=>{var M;if(s())return;const C=t.retry??(Xs?0:3),N=t.retryDelay??x4,A=typeof N=="function"?N(r,T):N,D=C===!0||typeof C=="number"&&r<C||typeof C=="function"&&C(r,T);if(e||!D){m(T);return}r++,(M=t.onFail)==null||M.call(t,r,T),d4(A).then(()=>f()?void 0:y()).then(()=>{e?m(T):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(a==null||a(),i),cancelRetry:u,continueRetry:d,canStart:h,start:()=>(h()?x():y().then(x),i)}}var Vs,jE,IE=(jE=class{constructor(){qe(this,Vs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wg(this.gcTime)&&Me(this,Vs,Us.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Xs?1/0:300*1e3))}clearGcTimeout(){W(this,Vs)&&(Us.clearTimeout(W(this,Vs)),Me(this,Vs,void 0))}},Vs=new WeakMap,jE),Fs,go,Qa,Hs,Dr,uc,Gs,en,Gn,AE,b4=(AE=class extends IE{constructor(e){super();qe(this,en);qe(this,Fs);qe(this,go);qe(this,Qa);qe(this,Hs);qe(this,Dr);qe(this,uc);qe(this,Gs);Me(this,Gs,!1),Me(this,uc,e.defaultOptions),this.setOptions(e.options),this.observers=[],Me(this,Hs,e.client),Me(this,Qa,W(this,Hs).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Me(this,Fs,r2(this.options)),this.state=e.state??W(this,Fs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=W(this,Dr))==null?void 0:e.promise}setOptions(e){if(this.options={...W(this,uc),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=r2(this.options);r.data!==void 0&&(this.setState(t2(r.data,r.dataUpdatedAt)),Me(this,Fs,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&W(this,Qa).remove(this)}setData(e,r){const a=Eg(this.state.data,e,this.options);return at(this,en,Gn).call(this,{data:a,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),a}setState(e,r){at(this,en,Gn).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var a,i;const r=(a=W(this,Dr))==null?void 0:a.promise;return(i=W(this,Dr))==null||i.cancel(e),r?r.then(Kr).catch(Kr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(W(this,Fs))}isActive(){return this.observers.some(e=>Ya(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ka||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Zi(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!zE(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(a=>a.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=W(this,Dr))==null||r.continue()}onOnline(){var r;const e=this.observers.find(a=>a.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=W(this,Dr))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),W(this,Qa).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(W(this,Dr)&&(W(this,Gs)?W(this,Dr).cancel({revert:!0}):W(this,Dr).cancelRetry()),this.scheduleGc()),W(this,Qa).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||at(this,en,Gn).call(this,{type:"invalidate"})}async fetch(e,r){var d,f,h,p,m,y,x,E,w,T,C,N;if(this.state.fetchStatus!=="idle"&&((d=W(this,Dr))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(W(this,Dr))return W(this,Dr).continueRetry(),W(this,Dr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const A=this.observers.find(D=>D.options.queryFn);A&&this.setOptions(A.options)}const a=new AbortController,i=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(Me(this,Gs,!0),a.signal)})},s=()=>{const A=_E(this.options,r),M=(()=>{const j={client:W(this,Hs),queryKey:this.queryKey,meta:this.meta};return i(j),j})();return Me(this,Gs,!1),this.options.persister?this.options.persister(A,M,this):A(M)},u=(()=>{const A={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:W(this,Hs),state:this.state,fetchFn:s};return i(A),A})();(f=this.options.behavior)==null||f.onFetch(u,this),Me(this,go,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=u.fetchOptions)==null?void 0:h.meta))&&at(this,en,Gn).call(this,{type:"fetch",meta:(p=u.fetchOptions)==null?void 0:p.meta}),Me(this,Dr,qE({initialPromise:r==null?void 0:r.initialPromise,fn:u.fetchFn,onCancel:A=>{A instanceof Cg&&A.revert&&this.setState({...W(this,go),fetchStatus:"idle"}),a.abort()},onFail:(A,D)=>{at(this,en,Gn).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{at(this,en,Gn).call(this,{type:"pause"})},onContinue:()=>{at(this,en,Gn).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const A=await W(this,Dr).start();if(A===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(A),(y=(m=W(this,Qa).config).onSuccess)==null||y.call(m,A,this),(E=(x=W(this,Qa).config).onSettled)==null||E.call(x,A,this.state.error,this),A}catch(A){if(A instanceof Cg){if(A.silent)return W(this,Dr).promise;if(A.revert){if(this.state.data===void 0)throw A;return this.state.data}}throw at(this,en,Gn).call(this,{type:"error",error:A}),(T=(w=W(this,Qa).config).onError)==null||T.call(w,A,this),(N=(C=W(this,Qa).config).onSettled)==null||N.call(C,this.state.data,A,this),A}finally{this.scheduleGc()}}},Fs=new WeakMap,go=new WeakMap,Qa=new WeakMap,Hs=new WeakMap,Dr=new WeakMap,uc=new WeakMap,Gs=new WeakMap,en=new WeakSet,Gn=function(e){const r=a=>{switch(e.type){case"failed":return{...a,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...VE(a.data,this.options),fetchMeta:e.meta??null};case"success":const i={...a,...t2(e.data,e.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Me(this,go,e.manual?i:void 0),i;case"error":const s=e.error;return{...a,error:s,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...e.state}}};this.state=r(this.state),ar.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),W(this,Qa).notify({query:this,type:"updated",action:e})})},AE);function VE(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:UE(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function t2(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function r2(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,a=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var va,yt,cc,ea,Qs,mo,$n,qi,dc,yo,xo,$s,Ys,Ii,bo,Mt,Uu,Ng,jg,Ag,Mg,kg,Dg,Og,FE,ME,yc=(ME=class extends nl{constructor(e,r){super();qe(this,Mt);qe(this,va);qe(this,yt);qe(this,cc);qe(this,ea);qe(this,Qs);qe(this,mo);qe(this,$n);qe(this,qi);qe(this,dc);qe(this,yo);qe(this,xo);qe(this,$s);qe(this,Ys);qe(this,Ii);qe(this,bo,new Set);this.options=r,Me(this,va,e),Me(this,qi,null),Me(this,$n,Tg()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(W(this,yt).addObserver(this),a2(W(this,yt),this.options)?at(this,Mt,Uu).call(this):this.updateResult(),at(this,Mt,Mg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Rg(W(this,yt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Rg(W(this,yt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,at(this,Mt,kg).call(this),at(this,Mt,Dg).call(this),W(this,yt).removeObserver(this)}setOptions(e){const r=this.options,a=W(this,yt);if(this.options=W(this,va).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ya(this.options.enabled,W(this,yt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");at(this,Mt,Og).call(this),W(this,yt).setOptions(this.options),r._defaulted&&!Yu(this.options,r)&&W(this,va).getQueryCache().notify({type:"observerOptionsUpdated",query:W(this,yt),observer:this});const i=this.hasListeners();i&&n2(W(this,yt),a,this.options,r)&&at(this,Mt,Uu).call(this),this.updateResult(),i&&(W(this,yt)!==a||Ya(this.options.enabled,W(this,yt))!==Ya(r.enabled,W(this,yt))||Zi(this.options.staleTime,W(this,yt))!==Zi(r.staleTime,W(this,yt)))&&at(this,Mt,Ng).call(this);const s=at(this,Mt,jg).call(this);i&&(W(this,yt)!==a||Ya(this.options.enabled,W(this,yt))!==Ya(r.enabled,W(this,yt))||s!==W(this,Ii))&&at(this,Mt,Ag).call(this,s)}getOptimisticResult(e){const r=W(this,va).getQueryCache().build(W(this,va),e),a=this.createResult(r,e);return S4(this,a)&&(Me(this,ea,a),Me(this,mo,this.options),Me(this,Qs,W(this,yt).state)),a}getCurrentResult(){return W(this,ea)}trackResult(e,r){return new Proxy(e,{get:(a,i)=>(this.trackProp(i),r==null||r(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&W(this,$n).status==="pending"&&W(this,$n).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,i))})}trackProp(e){W(this,bo).add(e)}getCurrentQuery(){return W(this,yt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=W(this,va).defaultQueryOptions(e),a=W(this,va).getQueryCache().build(W(this,va),r);return a.fetch().then(()=>this.createResult(a,r))}fetch(e){return at(this,Mt,Uu).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),W(this,ea)))}createResult(e,r){var R;const a=W(this,yt),i=this.options,s=W(this,ea),o=W(this,Qs),u=W(this,mo),f=e!==a?e.state:W(this,cc),{state:h}=e;let p={...h},m=!1,y;if(r._optimisticResults){const z=this.hasListeners(),B=!z&&a2(e,r),L=z&&n2(e,a,r,i);(B||L)&&(p={...p,...VE(h.data,e.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:E,status:w}=p;y=p.data;let T=!1;if(r.placeholderData!==void 0&&y===void 0&&w==="pending"){let z;s!=null&&s.isPlaceholderData&&r.placeholderData===(u==null?void 0:u.placeholderData)?(z=s.data,T=!0):z=typeof r.placeholderData=="function"?r.placeholderData((R=W(this,xo))==null?void 0:R.state.data,W(this,xo)):r.placeholderData,z!==void 0&&(w="success",y=Eg(s==null?void 0:s.data,z,r),m=!0)}if(r.select&&y!==void 0&&!T)if(s&&y===(o==null?void 0:o.data)&&r.select===W(this,dc))y=W(this,yo);else try{Me(this,dc,r.select),y=r.select(y),y=Eg(s==null?void 0:s.data,y,r),Me(this,yo,y),Me(this,qi,null)}catch(z){Me(this,qi,z)}W(this,qi)&&(x=W(this,qi),y=W(this,yo),E=Date.now(),w="error");const C=p.fetchStatus==="fetching",N=w==="pending",A=w==="error",D=N&&C,M=y!==void 0,k={status:w,fetchStatus:p.fetchStatus,isPending:N,isSuccess:w==="success",isError:A,isInitialLoading:D,isLoading:D,data:y,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:E,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:C,isRefetching:C&&!N,isLoadingError:A&&!M,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:A&&M,isStale:Sm(e,r),refetch:this.refetch,promise:W(this,$n),isEnabled:Ya(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const z=k.data!==void 0,B=k.status==="error"&&!z,L=Q=>{B?Q.reject(k.error):z&&Q.resolve(k.data)},q=()=>{const Q=Me(this,$n,k.promise=Tg());L(Q)},I=W(this,$n);switch(I.status){case"pending":e.queryHash===a.queryHash&&L(I);break;case"fulfilled":(B||k.data!==I.value)&&q();break;case"rejected":(!B||k.error!==I.reason)&&q();break}}return k}updateResult(){const e=W(this,ea),r=this.createResult(W(this,yt),this.options);if(Me(this,Qs,W(this,yt).state),Me(this,mo,this.options),W(this,Qs).data!==void 0&&Me(this,xo,W(this,yt)),Yu(r,e))return;Me(this,ea,r);const a=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!W(this,bo).size)return!0;const o=new Set(s??W(this,bo));return this.options.throwOnError&&o.add("error"),Object.keys(W(this,ea)).some(u=>{const d=u;return W(this,ea)[d]!==e[d]&&o.has(d)})};at(this,Mt,FE).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&at(this,Mt,Mg).call(this)}},va=new WeakMap,yt=new WeakMap,cc=new WeakMap,ea=new WeakMap,Qs=new WeakMap,mo=new WeakMap,$n=new WeakMap,qi=new WeakMap,dc=new WeakMap,yo=new WeakMap,xo=new WeakMap,$s=new WeakMap,Ys=new WeakMap,Ii=new WeakMap,bo=new WeakMap,Mt=new WeakSet,Uu=function(e){at(this,Mt,Og).call(this);let r=W(this,yt).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(Kr)),r},Ng=function(){at(this,Mt,kg).call(this);const e=Zi(this.options.staleTime,W(this,yt));if(Xs||W(this,ea).isStale||!wg(e))return;const a=zE(W(this,ea).dataUpdatedAt,e)+1;Me(this,$s,Us.setTimeout(()=>{W(this,ea).isStale||this.updateResult()},a))},jg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(W(this,yt)):this.options.refetchInterval)??!1},Ag=function(e){at(this,Mt,Dg).call(this),Me(this,Ii,e),!(Xs||Ya(this.options.enabled,W(this,yt))===!1||!wg(W(this,Ii))||W(this,Ii)===0)&&Me(this,Ys,Us.setInterval(()=>{(this.options.refetchIntervalInBackground||wm.isFocused())&&at(this,Mt,Uu).call(this)},W(this,Ii)))},Mg=function(){at(this,Mt,Ng).call(this),at(this,Mt,Ag).call(this,at(this,Mt,jg).call(this))},kg=function(){W(this,$s)&&(Us.clearTimeout(W(this,$s)),Me(this,$s,void 0))},Dg=function(){W(this,Ys)&&(Us.clearInterval(W(this,Ys)),Me(this,Ys,void 0))},Og=function(){const e=W(this,va).getQueryCache().build(W(this,va),this.options);if(e===W(this,yt))return;const r=W(this,yt);Me(this,yt,e),Me(this,cc,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},FE=function(e){ar.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(W(this,ea))}),W(this,va).getQueryCache().notify({query:W(this,yt),type:"observerResultsUpdated"})})},ME);function w4(t,e){return Ya(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function a2(t,e){return w4(t,e)||t.state.data!==void 0&&Rg(t,e,e.refetchOnMount)}function Rg(t,e,r){if(Ya(e.enabled,t)!==!1&&Zi(e.staleTime,t)!=="static"){const a=typeof r=="function"?r(t):r;return a==="always"||a!==!1&&Sm(t,e)}return!1}function n2(t,e,r,a){return(t!==e||Ya(a.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&Sm(t,r)}function Sm(t,e){return Ya(e.enabled,t)!==!1&&t.isStaleByTime(Zi(e.staleTime,t))}function S4(t,e){return!Yu(t.getCurrentResult(),e)}function Of(t){return{onFetch:(e,r)=>{var h,p,m,y,x;const a=e.options,i=(m=(p=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let u={pages:[],pageParams:[]},d=0;const f=async()=>{let E=!1;const w=N=>{v4(N,()=>e.signal,()=>E=!0)},T=_E(e.options,e.fetchOptions),C=async(N,A,D)=>{if(E)return Promise.reject();if(A==null&&N.pages.length)return Promise.resolve(N);const j=(()=>{const B={client:e.client,queryKey:e.queryKey,pageParam:A,direction:D?"backward":"forward",meta:e.options.meta};return w(B),B})(),k=await T(j),{maxPages:R}=e.options,z=D?h4:f4;return{pages:z(N.pages,k,R),pageParams:z(N.pageParams,A,R)}};if(i&&s.length){const N=i==="backward",A=N?HE:Bg,D={pages:s,pageParams:o},M=A(a,D);u=await C(D,M,N)}else{const N=t??s.length;do{const A=d===0?o[0]??a.initialPageParam:Bg(a,u);if(d>0&&A==null)break;u=await C(u,A),d++}while(d<N)}return u};e.options.persister?e.fetchFn=()=>{var E,w;return(w=(E=e.options).persister)==null?void 0:w.call(E,f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=f}}}function Bg(t,{pages:e,pageParams:r}){const a=e.length-1;return e.length>0?t.getNextPageParam(e[a],e,r[a],r):void 0}function HE(t,{pages:e,pageParams:r}){var a;return e.length>0?(a=t.getPreviousPageParam)==null?void 0:a.call(t,e[0],e,r[0],r):void 0}function E4(t,e){return e?Bg(t,e)!=null:!1}function T4(t,e){return!e||!t.getPreviousPageParam?!1:HE(t,e)!=null}var GE=class extends yc{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Of()})}getOptimisticResult(t){return t.behavior=Of(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var x,E;const{state:r}=t,a=super.createResult(t,e),{isFetching:i,isRefetching:s,isError:o,isRefetchError:u}=a,d=(E=(x=r.fetchMeta)==null?void 0:x.fetchMore)==null?void 0:E.direction,f=o&&d==="forward",h=i&&d==="forward",p=o&&d==="backward",m=i&&d==="backward";return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:E4(e,r.data),hasPreviousPage:T4(e,r.data),isFetchNextPageError:f,isFetchingNextPage:h,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:u&&!f&&!p,isRefetching:s&&!h&&!m}}},fc,xn,Yr,Ks,bn,Bi,kE,C4=(kE=class extends IE{constructor(e){super();qe(this,bn);qe(this,fc);qe(this,xn);qe(this,Yr);qe(this,Ks);Me(this,fc,e.client),this.mutationId=e.mutationId,Me(this,Yr,e.mutationCache),Me(this,xn,[]),this.state=e.state||QE(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){W(this,xn).includes(e)||(W(this,xn).push(e),this.clearGcTimeout(),W(this,Yr).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Me(this,xn,W(this,xn).filter(r=>r!==e)),this.scheduleGc(),W(this,Yr).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){W(this,xn).length||(this.state.status==="pending"?this.scheduleGc():W(this,Yr).remove(this))}continue(){var e;return((e=W(this,Ks))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,u,d,f,h,p,m,y,x,E,w,T,C,N,A,D,M,j;const r=()=>{at(this,bn,Bi).call(this,{type:"continue"})},a={client:W(this,fc),meta:this.options.meta,mutationKey:this.options.mutationKey};Me(this,Ks,qE({fn:()=>this.options.mutationFn?this.options.mutationFn(e,a):Promise.reject(new Error("No mutationFn found")),onFail:(k,R)=>{at(this,bn,Bi).call(this,{type:"failed",failureCount:k,error:R})},onPause:()=>{at(this,bn,Bi).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>W(this,Yr).canRun(this)}));const i=this.state.status==="pending",s=!W(this,Ks).canStart();try{if(i)r();else{at(this,bn,Bi).call(this,{type:"pending",variables:e,isPaused:s}),W(this,Yr).config.onMutate&&await W(this,Yr).config.onMutate(e,this,a);const R=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,e,a));R!==this.state.context&&at(this,bn,Bi).call(this,{type:"pending",context:R,variables:e,isPaused:s})}const k=await W(this,Ks).start();return await((f=(d=W(this,Yr).config).onSuccess)==null?void 0:f.call(d,k,e,this.state.context,this,a)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,k,e,this.state.context,a)),await((y=(m=W(this,Yr).config).onSettled)==null?void 0:y.call(m,k,null,this.state.variables,this.state.context,this,a)),await((E=(x=this.options).onSettled)==null?void 0:E.call(x,k,null,e,this.state.context,a)),at(this,bn,Bi).call(this,{type:"success",data:k}),k}catch(k){try{await((T=(w=W(this,Yr).config).onError)==null?void 0:T.call(w,k,e,this.state.context,this,a))}catch(R){Promise.reject(R)}try{await((N=(C=this.options).onError)==null?void 0:N.call(C,k,e,this.state.context,a))}catch(R){Promise.reject(R)}try{await((D=(A=W(this,Yr).config).onSettled)==null?void 0:D.call(A,void 0,k,this.state.variables,this.state.context,this,a))}catch(R){Promise.reject(R)}try{await((j=(M=this.options).onSettled)==null?void 0:j.call(M,void 0,k,e,this.state.context,a))}catch(R){Promise.reject(R)}throw at(this,bn,Bi).call(this,{type:"error",error:k}),k}finally{W(this,Yr).runNext(this)}}},fc=new WeakMap,xn=new WeakMap,Yr=new WeakMap,Ks=new WeakMap,bn=new WeakSet,Bi=function(e){const r=a=>{switch(e.type){case"failed":return{...a,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...a,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:e.error,failureCount:a.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),ar.batch(()=>{W(this,xn).forEach(a=>{a.onMutationUpdate(e)}),W(this,Yr).notify({mutation:this,type:"updated",action:e})})},kE);function QE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yn,tn,hc,DE,N4=(DE=class extends nl{constructor(e={}){super();qe(this,Yn);qe(this,tn);qe(this,hc);this.config=e,Me(this,Yn,new Set),Me(this,tn,new Map),Me(this,hc,0)}build(e,r,a){const i=new C4({client:e,mutationCache:this,mutationId:++Kd(this,hc)._,options:e.defaultMutationOptions(r),state:a});return this.add(i),i}add(e){W(this,Yn).add(e);const r=Xd(e);if(typeof r=="string"){const a=W(this,tn).get(r);a?a.push(e):W(this,tn).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(W(this,Yn).delete(e)){const r=Xd(e);if(typeof r=="string"){const a=W(this,tn).get(r);if(a)if(a.length>1){const i=a.indexOf(e);i!==-1&&a.splice(i,1)}else a[0]===e&&W(this,tn).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Xd(e);if(typeof r=="string"){const a=W(this,tn).get(r),i=a==null?void 0:a.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var a;const r=Xd(e);if(typeof r=="string"){const i=(a=W(this,tn).get(r))==null?void 0:a.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ar.batch(()=>{W(this,Yn).forEach(e=>{this.notify({type:"removed",mutation:e})}),W(this,Yn).clear(),W(this,tn).clear()})}getAll(){return Array.from(W(this,Yn))}find(e){const r={exact:!0,...e};return this.getAll().find(a=>W1(r,a))}findAll(e={}){return this.getAll().filter(r=>W1(e,r))}notify(e){ar.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return ar.batch(()=>Promise.all(e.map(r=>r.continue().catch(Kr))))}},Yn=new WeakMap,tn=new WeakMap,hc=new WeakMap,DE);function Xd(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Kn,Vi,pa,Xn,Wn,gf,Lg,OE,j4=(OE=class extends nl{constructor(r,a){super();qe(this,Wn);qe(this,Kn);qe(this,Vi);qe(this,pa);qe(this,Xn);Me(this,Kn,r),this.setOptions(a),this.bindMethods(),at(this,Wn,gf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var i;const a=this.options;this.options=W(this,Kn).defaultMutationOptions(r),Yu(this.options,a)||W(this,Kn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:W(this,pa),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&ts(a.mutationKey)!==ts(this.options.mutationKey)?this.reset():((i=W(this,pa))==null?void 0:i.state.status)==="pending"&&W(this,pa).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=W(this,pa))==null||r.removeObserver(this)}onMutationUpdate(r){at(this,Wn,gf).call(this),at(this,Wn,Lg).call(this,r)}getCurrentResult(){return W(this,Vi)}reset(){var r;(r=W(this,pa))==null||r.removeObserver(this),Me(this,pa,void 0),at(this,Wn,gf).call(this),at(this,Wn,Lg).call(this)}mutate(r,a){var i;return Me(this,Xn,a),(i=W(this,pa))==null||i.removeObserver(this),Me(this,pa,W(this,Kn).getMutationCache().build(W(this,Kn),this.options)),W(this,pa).addObserver(this),W(this,pa).execute(r)}},Kn=new WeakMap,Vi=new WeakMap,pa=new WeakMap,Xn=new WeakMap,Wn=new WeakSet,gf=function(){var a;const r=((a=W(this,pa))==null?void 0:a.state)??QE();Me(this,Vi,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Lg=function(r){ar.batch(()=>{var a,i,s,o,u,d,f,h;if(W(this,Xn)&&this.hasListeners()){const p=W(this,Vi).variables,m=W(this,Vi).context,y={client:W(this,Kn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(i=(a=W(this,Xn)).onSuccess)==null||i.call(a,r.data,p,m,y)}catch(x){Promise.reject(x)}try{(o=(s=W(this,Xn)).onSettled)==null||o.call(s,r.data,null,p,m,y)}catch(x){Promise.reject(x)}}else if((r==null?void 0:r.type)==="error"){try{(d=(u=W(this,Xn)).onError)==null||d.call(u,r.error,p,m,y)}catch(x){Promise.reject(x)}try{(h=(f=W(this,Xn)).onSettled)==null||h.call(f,void 0,r.error,p,m,y)}catch(x){Promise.reject(x)}}}this.listeners.forEach(p=>{p(W(this,Vi))})})},OE);function i2(t,e){const r=new Set(e);return t.filter(a=>!r.has(a))}function A4(t,e,r){const a=t.slice(0);return a[e]=r,a}var wo,Ma,So,Eo,$a,Fi,vc,pc,gc,mc,Vr,Pg,zg,_g,Ug,qg,RE,M4=(RE=class extends nl{constructor(e,r,a){super();qe(this,Vr);qe(this,wo);qe(this,Ma);qe(this,So);qe(this,Eo);qe(this,$a);qe(this,Fi);qe(this,vc);qe(this,pc);qe(this,gc);qe(this,mc,[]);Me(this,wo,e),Me(this,Eo,a),Me(this,So,[]),Me(this,$a,[]),Me(this,Ma,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&W(this,$a).forEach(e=>{e.subscribe(r=>{at(this,Vr,Ug).call(this,e,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,W(this,$a).forEach(e=>{e.destroy()})}setQueries(e,r){Me(this,So,e),Me(this,Eo,r),ar.batch(()=>{const a=W(this,$a),i=at(this,Vr,_g).call(this,W(this,So));i.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const s=i.map(p=>p.observer),o=s.map(p=>p.getCurrentResult()),u=a.length!==s.length,d=s.some((p,m)=>p!==a[m]),f=u||d,h=f?!0:o.some((p,m)=>{const y=W(this,Ma)[m];return!y||!Yu(p,y)});!f&&!h||(f&&(Me(this,mc,i),Me(this,$a,s)),Me(this,Ma,o),this.hasListeners()&&(f&&(i2(a,s).forEach(p=>{p.destroy()}),i2(s,a).forEach(p=>{p.subscribe(m=>{at(this,Vr,Ug).call(this,p,m)})})),at(this,Vr,qg).call(this)))})}getCurrentResult(){return W(this,Ma)}getQueries(){return W(this,$a).map(e=>e.getCurrentQuery())}getObservers(){return W(this,$a)}getOptimisticResult(e,r){const a=at(this,Vr,_g).call(this,e),i=a.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=a.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>at(this,Vr,zg).call(this,o??i,r,s),()=>at(this,Vr,Pg).call(this,i,a)]}},wo=new WeakMap,Ma=new WeakMap,So=new WeakMap,Eo=new WeakMap,$a=new WeakMap,Fi=new WeakMap,vc=new WeakMap,pc=new WeakMap,gc=new WeakMap,mc=new WeakMap,Vr=new WeakSet,Pg=function(e,r){return r.map((a,i)=>{const s=e[i];return a.defaultedQueryOptions.notifyOnChangeProps?s:a.observer.trackResult(s,o=>{r.forEach(u=>{u.observer.trackProp(o)})})})},zg=function(e,r,a){if(r){const i=W(this,gc),s=a!==void 0&&i!==void 0&&(i.length!==a.length||a.some((o,u)=>o!==i[u]));return(!W(this,Fi)||W(this,Ma)!==W(this,pc)||s||r!==W(this,vc))&&(Me(this,vc,r),Me(this,pc,W(this,Ma)),a!==void 0&&Me(this,gc,a),Me(this,Fi,xm(W(this,Fi),r(e)))),W(this,Fi)}return e},_g=function(e){const r=new Map;W(this,$a).forEach(i=>{const s=i.options.queryHash;if(!s)return;const o=r.get(s);o?o.push(i):r.set(s,[i])});const a=[];return e.forEach(i=>{var d;const s=W(this,wo).defaultQueryOptions(i),u=((d=r.get(s.queryHash))==null?void 0:d.shift())??new yc(W(this,wo),s);a.push({defaultedQueryOptions:s,observer:u})}),a},Ug=function(e,r){const a=W(this,$a).indexOf(e);a!==-1&&(Me(this,Ma,A4(W(this,Ma),a,r)),at(this,Vr,qg).call(this))},qg=function(){var e;if(this.hasListeners()){const r=W(this,Fi),a=at(this,Vr,Pg).call(this,W(this,Ma),W(this,mc)),i=at(this,Vr,zg).call(this,a,(e=W(this,Eo))==null?void 0:e.combine);r!==i&&ar.batch(()=>{this.listeners.forEach(s=>{s(W(this,Ma))})})}},RE),wn,BE,k4=(BE=class extends nl{constructor(e={}){super();qe(this,wn);this.config=e,Me(this,wn,new Map)}build(e,r,a){const i=r.queryKey,s=r.queryHash??ym(i,r);let o=this.get(s);return o||(o=new b4({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(r),state:a,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){W(this,wn).has(e.queryHash)||(W(this,wn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=W(this,wn).get(e.queryHash);r&&(e.destroy(),r===e&&W(this,wn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ar.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return W(this,wn).get(e)}getAll(){return[...W(this,wn).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(a=>Z1(r,a))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(a=>Z1(e,a)):r}notify(e){ar.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){ar.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ar.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},wn=new WeakMap,BE),rr,Hi,Gi,To,Co,Qi,No,jo,LE,D4=(LE=class{constructor(t={}){qe(this,rr);qe(this,Hi);qe(this,Gi);qe(this,To);qe(this,Co);qe(this,Qi);qe(this,No);qe(this,jo);Me(this,rr,t.queryCache||new k4),Me(this,Hi,t.mutationCache||new N4),Me(this,Gi,t.defaultOptions||{}),Me(this,To,new Map),Me(this,Co,new Map),Me(this,Qi,0)}mount(){Kd(this,Qi)._++,W(this,Qi)===1&&(Me(this,No,wm.subscribe(async t=>{t&&(await this.resumePausedMutations(),W(this,rr).onFocus())})),Me(this,jo,Df.subscribe(async t=>{t&&(await this.resumePausedMutations(),W(this,rr).onOnline())})))}unmount(){var t,e;Kd(this,Qi)._--,W(this,Qi)===0&&((t=W(this,No))==null||t.call(this),Me(this,No,void 0),(e=W(this,jo))==null||e.call(this),Me(this,jo,void 0))}isFetching(t){return W(this,rr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return W(this,Hi).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=W(this,rr).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=W(this,rr).build(this,e),a=r.state.data;return a===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Zi(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(a))}getQueriesData(t){return W(this,rr).findAll(t).map(({queryKey:e,state:r})=>{const a=r.data;return[e,a]})}setQueryData(t,e,r){const a=this.defaultQueryOptions({queryKey:t}),i=W(this,rr).get(a.queryHash),s=i==null?void 0:i.state.data,o=u4(e,s);if(o!==void 0)return W(this,rr).build(this,a).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return ar.batch(()=>W(this,rr).findAll(t).map(({queryKey:a})=>[a,this.setQueryData(a,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=W(this,rr).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=W(this,rr);ar.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=W(this,rr);return ar.batch(()=>(r.findAll(t).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},a=ar.batch(()=>W(this,rr).findAll(t).map(i=>i.cancel(r)));return Promise.all(a).then(Kr).catch(Kr)}invalidateQueries(t,e={}){return ar.batch(()=>(W(this,rr).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},a=ar.batch(()=>W(this,rr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,r);return r.throwOnError||(s=s.catch(Kr)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(a).then(Kr)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=W(this,rr).build(this,e);return r.isStaleByTime(Zi(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Kr).catch(Kr)}fetchInfiniteQuery(t){return t.behavior=Of(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Kr).catch(Kr)}ensureInfiniteQueryData(t){return t.behavior=Of(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Df.isOnline()?W(this,Hi).resumePausedMutations():Promise.resolve()}getQueryCache(){return W(this,rr)}getMutationCache(){return W(this,Hi)}getDefaultOptions(){return W(this,Gi)}setDefaultOptions(t){Me(this,Gi,t)}setQueryDefaults(t,e){W(this,To).set(ts(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...W(this,To).values()],r={};return e.forEach(a=>{$u(t,a.queryKey)&&Object.assign(r,a.defaultOptions)}),r}setMutationDefaults(t,e){W(this,Co).set(ts(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...W(this,Co).values()],r={};return e.forEach(a=>{$u(t,a.mutationKey)&&Object.assign(r,a.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...W(this,Gi).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ym(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===ka&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...W(this,Gi).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){W(this,rr).clear(),W(this,Hi).clear()}},rr=new WeakMap,Hi=new WeakMap,Gi=new WeakMap,To=new WeakMap,Co=new WeakMap,Qi=new WeakMap,No=new WeakMap,jo=new WeakMap,LE),Rp={exports:{}},lt={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var s2;function O4(){if(s2)return lt;s2=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function y(P){return P===null||typeof P!="object"?null:(P=m&&P[m]||P["@@iterator"],typeof P=="function"?P:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,w={};function T(P,G,Z){this.props=P,this.context=G,this.refs=w,this.updater=Z||x}T.prototype.isReactComponent={},T.prototype.setState=function(P,G){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,G,"setState")},T.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function C(){}C.prototype=T.prototype;function N(P,G,Z){this.props=P,this.context=G,this.refs=w,this.updater=Z||x}var A=N.prototype=new C;A.constructor=N,E(A,T.prototype),A.isPureReactComponent=!0;var D=Array.isArray;function M(){}var j={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function R(P,G,Z){var J=Z.ref;return{$$typeof:t,type:P,key:G,ref:J!==void 0?J:null,props:Z}}function z(P,G){return R(P.type,G,P.props)}function B(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function L(P){var G={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(Z){return G[Z]})}var q=/\/+/g;function I(P,G){return typeof P=="object"&&P!==null&&P.key!=null?L(""+P.key):G.toString(36)}function Q(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(M,M):(P.status="pending",P.then(function(G){P.status==="pending"&&(P.status="fulfilled",P.value=G)},function(G){P.status==="pending"&&(P.status="rejected",P.reason=G)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function _(P,G,Z,J,X){var Y=typeof P;(Y==="undefined"||Y==="boolean")&&(P=null);var le=!1;if(P===null)le=!0;else switch(Y){case"bigint":case"string":case"number":le=!0;break;case"object":switch(P.$$typeof){case t:case e:le=!0;break;case h:return le=P._init,_(le(P._payload),G,Z,J,X)}}if(le)return X=X(P),le=J===""?"."+I(P,0):J,D(X)?(Z="",le!=null&&(Z=le.replace(q,"$&/")+"/"),_(X,G,Z,"",function(ae){return ae})):X!=null&&(B(X)&&(X=z(X,Z+(X.key==null||P&&P.key===X.key?"":(""+X.key).replace(q,"$&/")+"/")+le)),G.push(X)),1;le=0;var me=J===""?".":J+":";if(D(P))for(var oe=0;oe<P.length;oe++)J=P[oe],Y=me+I(J,oe),le+=_(J,G,Z,Y,X);else if(oe=y(P),typeof oe=="function")for(P=oe.call(P),oe=0;!(J=P.next()).done;)J=J.value,Y=me+I(J,oe++),le+=_(J,G,Z,Y,X);else if(Y==="object"){if(typeof P.then=="function")return _(Q(P),G,Z,J,X);throw G=String(P),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return le}function V(P,G,Z){if(P==null)return P;var J=[],X=0;return _(P,J,"","",function(Y){return G.call(Z,Y,X++)}),J}function F(P){if(P._status===-1){var G=P._result;G=G(),G.then(function(Z){(P._status===0||P._status===-1)&&(P._status=1,P._result=Z)},function(Z){(P._status===0||P._status===-1)&&(P._status=2,P._result=Z)}),P._status===-1&&(P._status=0,P._result=G)}if(P._status===1)return P._result.default;throw P._result}var K=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},ee={map:V,forEach:function(P,G,Z){V(P,function(){G.apply(this,arguments)},Z)},count:function(P){var G=0;return V(P,function(){G++}),G},toArray:function(P){return V(P,function(G){return G})||[]},only:function(P){if(!B(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return lt.Activity=p,lt.Children=ee,lt.Component=T,lt.Fragment=r,lt.Profiler=i,lt.PureComponent=N,lt.StrictMode=a,lt.Suspense=d,lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,lt.__COMPILER_RUNTIME={__proto__:null,c:function(P){return j.H.useMemoCache(P)}},lt.cache=function(P){return function(){return P.apply(null,arguments)}},lt.cacheSignal=function(){return null},lt.cloneElement=function(P,G,Z){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var J=E({},P.props),X=P.key;if(G!=null)for(Y in G.key!==void 0&&(X=""+G.key),G)!k.call(G,Y)||Y==="key"||Y==="__self"||Y==="__source"||Y==="ref"&&G.ref===void 0||(J[Y]=G[Y]);var Y=arguments.length-2;if(Y===1)J.children=Z;else if(1<Y){for(var le=Array(Y),me=0;me<Y;me++)le[me]=arguments[me+2];J.children=le}return R(P.type,X,J)},lt.createContext=function(P){return P={$$typeof:o,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:s,_context:P},P},lt.createElement=function(P,G,Z){var J,X={},Y=null;if(G!=null)for(J in G.key!==void 0&&(Y=""+G.key),G)k.call(G,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(X[J]=G[J]);var le=arguments.length-2;if(le===1)X.children=Z;else if(1<le){for(var me=Array(le),oe=0;oe<le;oe++)me[oe]=arguments[oe+2];X.children=me}if(P&&P.defaultProps)for(J in le=P.defaultProps,le)X[J]===void 0&&(X[J]=le[J]);return R(P,Y,X)},lt.createRef=function(){return{current:null}},lt.forwardRef=function(P){return{$$typeof:u,render:P}},lt.isValidElement=B,lt.lazy=function(P){return{$$typeof:h,_payload:{_status:-1,_result:P},_init:F}},lt.memo=function(P,G){return{$$typeof:f,type:P,compare:G===void 0?null:G}},lt.startTransition=function(P){var G=j.T,Z={};j.T=Z;try{var J=P(),X=j.S;X!==null&&X(Z,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(M,K)}catch(Y){K(Y)}finally{G!==null&&Z.types!==null&&(G.types=Z.types),j.T=G}},lt.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},lt.use=function(P){return j.H.use(P)},lt.useActionState=function(P,G,Z){return j.H.useActionState(P,G,Z)},lt.useCallback=function(P,G){return j.H.useCallback(P,G)},lt.useContext=function(P){return j.H.useContext(P)},lt.useDebugValue=function(){},lt.useDeferredValue=function(P,G){return j.H.useDeferredValue(P,G)},lt.useEffect=function(P,G){return j.H.useEffect(P,G)},lt.useEffectEvent=function(P){return j.H.useEffectEvent(P)},lt.useId=function(){return j.H.useId()},lt.useImperativeHandle=function(P,G,Z){return j.H.useImperativeHandle(P,G,Z)},lt.useInsertionEffect=function(P,G){return j.H.useInsertionEffect(P,G)},lt.useLayoutEffect=function(P,G){return j.H.useLayoutEffect(P,G)},lt.useMemo=function(P,G){return j.H.useMemo(P,G)},lt.useOptimistic=function(P,G){return j.H.useOptimistic(P,G)},lt.useReducer=function(P,G,Z){return j.H.useReducer(P,G,Z)},lt.useRef=function(P){return j.H.useRef(P)},lt.useState=function(P){return j.H.useState(P)},lt.useSyncExternalStore=function(P,G,Z){return j.H.useSyncExternalStore(P,G,Z)},lt.useTransition=function(){return j.H.useTransition()},lt.version="19.2.4",lt}var l2;function Em(){return l2||(l2=1,Rp.exports=O4()),Rp.exports}var U=Em();const $E=PE(U),YE=a4({__proto__:null,default:$E},[U]);var KE=U.createContext(void 0),xc=t=>{const e=U.useContext(KE);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},R4=({client:t,children:e})=>(U.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(KE.Provider,{value:t,children:e})),XE=U.createContext(!1),ZE=()=>U.useContext(XE);XE.Provider;function B4(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var L4=U.createContext(B4()),WE=()=>U.useContext(L4),JE=(t,e,r)=>{const a=r!=null&&r.state.error&&typeof t.throwOnError=="function"?bm(t.throwOnError,[r.state.error,r]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||a)&&(e.isReset()||(t.retryOnMount=!1))},eT=t=>{U.useEffect(()=>{t.clearReset()},[t])},tT=({result:t,errorResetBoundary:e,throwOnError:r,query:a,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&a&&(i&&t.data===void 0||bm(r,[t.error,a])),Tm=(t,e)=>e.state.data===void 0,rT=t=>{if(t.suspense){const r=i=>i==="static"?i:Math.max(i??1e3,1e3),a=t.staleTime;t.staleTime=typeof a=="function"?(...i)=>r(a(...i)):r(a),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},P4=(t,e)=>t.isLoading&&t.isFetching&&!e,Ig=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Vg=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function aT({queries:t,...e},r){const a=xc(r),i=ZE(),s=WE(),o=U.useMemo(()=>t.map(E=>{const w=a.defaultQueryOptions(E);return w._optimisticResults=i?"isRestoring":"optimistic",w}),[t,a,i]);o.forEach(E=>{rT(E);const w=a.getQueryCache().get(E.queryHash);JE(E,s,w)}),eT(s);const[u]=U.useState(()=>new M4(a,o,e)),[d,f,h]=u.getOptimisticResult(o,e.combine),p=!i&&e.subscribed!==!1;U.useSyncExternalStore(U.useCallback(E=>p?u.subscribe(ar.batchCalls(E)):Kr,[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),U.useEffect(()=>{u.setQueries(o,e)},[o,e,u]);const y=d.some((E,w)=>Ig(o[w],E))?d.flatMap((E,w)=>{const T=o[w];if(T&&Ig(T,E)){const C=new yc(a,T);return Vg(T,C,s)}return[]}):[];if(y.length>0)throw Promise.all(y);const x=d.find((E,w)=>{const T=o[w];return T&&tT({result:E,errorResetBoundary:s,throwOnError:T.throwOnError,query:a.getQueryCache().get(T.queryHash),suspense:T.suspense})});if(x!=null&&x.error)throw x.error;return f(h())}function Xf(t,e,r){var m,y,x,E;const a=ZE(),i=WE(),s=xc(r),o=s.defaultQueryOptions(t);(y=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||y.call(m,o);const u=s.getQueryCache().get(o.queryHash);o._optimisticResults=a?"isRestoring":"optimistic",rT(o),JE(o,i,u),eT(i);const d=!s.getQueryCache().get(o.queryHash),[f]=U.useState(()=>new e(s,o)),h=f.getOptimisticResult(o),p=!a&&t.subscribed!==!1;if(U.useSyncExternalStore(U.useCallback(w=>{const T=p?f.subscribe(ar.batchCalls(w)):Kr;return f.updateResult(),T},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),U.useEffect(()=>{f.setOptions(o)},[o,f]),Ig(o,h))throw Vg(o,f,i);if(tT({result:h,errorResetBoundary:i,throwOnError:o.throwOnError,query:u,suspense:o.suspense}))throw h.error;if((E=(x=s.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||E.call(x,o,h),o.experimental_prefetchInRender&&!Xs&&P4(h,a)){const w=d?Vg(o,f,i):u==null?void 0:u.promise;w==null||w.catch(Kr).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?h:f.trackResult(h)}function z4(t,e){return Xf(t,yc,e)}function _4(t,e){return Xf({...t,enabled:!0,suspense:!0,throwOnError:Tm,placeholderData:void 0},yc,e)}function U4(t,e){return Xf({...t,enabled:!0,suspense:!0,throwOnError:Tm},GE,e)}function q4(t,e){return aT({...t,queries:t.queries.map(r=>({...r,suspense:!0,throwOnError:Tm,enabled:!0,placeholderData:void 0}))},e)}function I4(t,e){const r=xc(e);r.getQueryState(t.queryKey)||r.prefetchQuery(t)}function V4(t,e){const r=xc(e);r.getQueryState(t.queryKey)||r.prefetchInfiniteQuery(t)}function F4(t,e){const r=xc(e),[a]=U.useState(()=>new j4(r,t));U.useEffect(()=>{a.setOptions(t)},[a,t]);const i=U.useSyncExternalStore(U.useCallback(o=>a.subscribe(ar.batchCalls(o)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),s=U.useCallback((o,u)=>{a.mutate(o,u).catch(Kr)},[a]);if(i.error&&bm(a.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function H4(t,e){return Xf(t,GE,e)}var G4=Object.create,nT=Object.defineProperty,Q4=Object.getOwnPropertyDescriptor,iT=Object.getOwnPropertyNames,$4=Object.getPrototypeOf,Y4=Object.prototype.hasOwnProperty,Tn=(t,e)=>function(){return e||(0,t[iT(t)[0]])((e={exports:{}}).exports,e),e.exports},K4=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=iT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!Y4.call(t,u)&&u!==r&&nT(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(a=Q4(e,u))||a.enumerable});return t},cr=(t,e,r)=>(r=t!=null?G4($4(t)):{},K4(e||!t||!t.__esModule?nT(r,"default",{value:t,enumerable:!0}):r,t)),sT=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),X4=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=sT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),Z4=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=sT().default,a=X4();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),il=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=Z4();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),on=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=il();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(d){r(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}});function Zf(t){const e={subscribe(r){let a=null,i=!1,s=!1,o=!1;function u(){if(a===null){o=!0;return}s||(s=!0,typeof a=="function"?a():a&&a.unsubscribe())}return a=t({next(d){var f;i||(f=r.next)===null||f===void 0||f.call(r,d)},error(d){var f;i||(i=!0,(f=r.error)===null||f===void 0||f.call(r,d),u())},complete(){var d;i||(i=!0,(d=r.complete)===null||d===void 0||d.call(r),u())}}),o&&u(),{unsubscribe:u}},pipe(...r){return r.reduce(W4,e)}};return e}function W4(t,e){return e(t)}function J4(t){const e=new AbortController;return new Promise((a,i)=>{let s=!1;function o(){s||(s=!0,u.unsubscribe())}e.signal.addEventListener("abort",()=>{i(e.signal.reason)});const u=t.subscribe({next(d){s=!0,a(d),o()},error(d){i(d)},complete(){e.abort(),o()}})})}function eA(t){return e=>{let r=0,a=null;const i=[];function s(){a||(a=e.subscribe({next(u){for(const f of i){var d;(d=f.next)===null||d===void 0||d.call(f,u)}},error(u){for(const f of i){var d;(d=f.error)===null||d===void 0||d.call(f,u)}},complete(){for(const d of i){var u;(u=d.complete)===null||u===void 0||u.call(d)}}}))}function o(){if(r===0&&a){const u=a;a=null,u.unsubscribe()}}return Zf(u=>(r++,i.push(u),s(),{unsubscribe(){r--,o();const d=i.findIndex(f=>f===u);d>-1&&i.splice(d,1)}}))}}function tA(t){let e=t;const r=[],a=o=>{e!==void 0&&o.next(e),r.push(o)},i=o=>{r.splice(r.indexOf(o),1)},s=Zf(o=>(a(o),()=>{i(o)}));return s.next=o=>{if(e!==o){e=o;for(const u of r)u.next(o)}},s.get=()=>e,s}function rA(t){return Zf(e=>{function r(i=0,s=t.op){const o=t.links[i];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:s,next(d){return r(i+1,d)}})}return r().subscribe(e)})}function Zs(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function aA(){return Object.create(null)}const nA=typeof Symbol=="function"&&!!Symbol.asyncIterator;function lT(t){return nA&&Zs(t)&&Symbol.asyncIterator in t}var iA=Object.create,oT=Object.defineProperty,sA=Object.getOwnPropertyDescriptor,uT=Object.getOwnPropertyNames,lA=Object.getPrototypeOf,oA=Object.prototype.hasOwnProperty,bc=(t,e)=>function(){return e||(0,t[uT(t)[0]])((e={exports:{}}).exports,e),e.exports},uA=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=uT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!oA.call(t,u)&&u!==r&&oT(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(a=sA(e,u))||a.enumerable});return t},Wf=(t,e,r)=>(r=t!=null?iA(lA(t)):{},uA(oT(r,"default",{value:t,enumerable:!0}),t));const cT=()=>{},o2=t=>{Object.freeze&&Object.freeze(t)};function dT(t,e,r){var a;const i=e.join(".");return(a=r[i])!==null&&a!==void 0||(r[i]=new Proxy(cT,{get(s,o){if(!(typeof o!="string"||o==="then"))return dT(t,[...e,o],r)},apply(s,o,u){const d=e[e.length-1];let f={args:u,path:e};return d==="call"?f={args:u.length>=2?[u[1]]:[],path:e.slice(0,-1)}:d==="apply"&&(f={args:u.length>=2?u[1]:[],path:e.slice(0,-1)}),o2(f.args),o2(f.path),t(f)}})),r[i]}const Jf=t=>dT(t,[],aA()),Cm=t=>new Proxy(cT,{get(e,r){if(r!=="then")return t(r)}});var fT=bc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),cA=bc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=fT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),dA=bc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=fT().default,a=cA();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),hT=bc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=dA();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),Nm=bc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=hT();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(d){r(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}});Wf(Nm());Wf(hT());var Zd=Wf(Nm());function fA(t,e){if("error"in t){const a=e.deserialize(t.error);return{ok:!1,error:(0,Zd.default)((0,Zd.default)({},t),{},{error:a})}}return{ok:!0,result:(0,Zd.default)((0,Zd.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var Bp=class extends Error{constructor(){super("Unable to transform response from server")}};function hA(t,e){let r;try{r=fA(t,e)}catch{throw new Bp}if(!r.ok&&(!Zs(r.error.error)||typeof r.error.error.code!="number"))throw new Bp;if(r.ok&&!Zs(r.result))throw new Bp;return r}Wf(Nm());var Wd=cr(il(),1),Ql=cr(on(),1);function vA(t){return t instanceof Rf}function pA(t){return Zs(t)&&Zs(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function gA(t,e){return typeof t=="string"?t:Zs(t)&&typeof t.message=="string"?t.message:e}var Rf=class mf extends Error{constructor(e,r){var a,i;const s=r==null?void 0:r.cause;super(e,{cause:s}),(0,Wd.default)(this,"cause",void 0),(0,Wd.default)(this,"shape",void 0),(0,Wd.default)(this,"data",void 0),(0,Wd.default)(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=s,this.shape=r==null||(a=r.result)===null||a===void 0?void 0:a.error,this.data=r==null||(i=r.result)===null||i===void 0?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,mf.prototype)}static from(e,r={}){const a=e;return vA(a)?(r.meta&&(a.meta=(0,Ql.default)((0,Ql.default)({},a.meta),r.meta)),a):pA(a)?new mf(a.error.message,(0,Ql.default)((0,Ql.default)({},r),{},{result:a,cause:r.cause})):new mf(gA(a,"Unknown error"),(0,Ql.default)((0,Ql.default)({},r),{},{cause:a}))}};function mA(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}const u2=t=>typeof t=="function";function yA(t){if(t)return t;if(typeof window<"u"&&u2(window.fetch))return window.fetch;if(typeof globalThis<"u"&&u2(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var Fu=cr(on());function xA(t){return{url:t.url.toString(),fetch:t.fetch,transformer:mA(t.transformer),methodOverride:t.methodOverride}}function bA(t){const e={};for(let r=0;r<t.length;r++){const a=t[r];e[r]=a}return e}const wA={query:"GET",mutation:"POST",subscription:"PATCH"};function vT(t){return"input"in t?t.transformer.input.serialize(t.input):bA(t.inputs.map(e=>t.transformer.input.serialize(e)))}const pT=t=>{const e=t.url.split("?");let a=e[0].replace(/\/$/,"")+"/"+t.path;const i=[];if(e[1]&&i.push(e[1]),"inputs"in t&&i.push("batch=1"),t.type==="query"||t.type==="subscription"){const s=vT(t);s!==void 0&&t.methodOverride!=="POST"&&i.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return i.length&&(a+="?"+i.join("&")),a},SA=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=vT(t);return e!==void 0?JSON.stringify(e):void 0},EA=t=>jA((0,Fu.default)((0,Fu.default)({},t),{},{contentTypeHeader:"application/json",getUrl:pT,getBody:SA}));var TA=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const CA=t=>{var e;if(t!=null&&t.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new TA};async function NA(t){var e;CA(t.signal);const r=t.getUrl(t),a=t.getBody(t),i=(e=t.methodOverride)!==null&&e!==void 0?e:wA[t.type],s=await(async()=>{const u=await t.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),o=(0,Fu.default)((0,Fu.default)((0,Fu.default)({},t.contentTypeHeader&&i!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),s);return yA(t.fetch)(r,{method:i,signal:t.signal,body:a,headers:o})}async function jA(t){const e={},r=await NA(t);e.response=r;const a=await r.json();return e.responseJSON=a,{json:a,meta:e}}cr(on(),1);const c2=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function d2(t){let e=null,r=null;const a=()=>{clearTimeout(r),r=null,e=null};function i(u){const d=[[]];let f=0;for(;;){const m=u[f];if(!m)break;const y=d[d.length-1];if(m.aborted){var h;(h=m.reject)===null||h===void 0||h.call(m,new Error("Aborted")),f++;continue}if(t.validate(y.concat(m).map(E=>E.key))){y.push(m),f++;continue}if(y.length===0){var p;(p=m.reject)===null||p===void 0||p.call(m,new Error("Input is too big for a single dispatch")),f++;continue}d.push([])}return d}function s(){const u=i(e);a();for(const d of u){if(!d.length)continue;const f={items:d};for(const p of d)p.batch=f;t.fetch(f.items.map(p=>p.key)).then(async p=>{await Promise.all(p.map(async(y,x)=>{const E=f.items[x];try{var w;const C=await Promise.resolve(y);(w=E.resolve)===null||w===void 0||w.call(E,C)}catch(C){var T;(T=E.reject)===null||T===void 0||T.call(E,C)}E.batch=null,E.reject=null,E.resolve=null}));for(const y of f.items){var m;(m=y.reject)===null||m===void 0||m.call(y,new Error("Missing result")),y.batch=null}}).catch(p=>{for(const y of f.items){var m;(m=y.reject)===null||m===void 0||m.call(y,p),y.batch=null}})}}function o(u){var d;const f={aborted:!1,key:u,batch:null,resolve:c2,reject:c2},h=new Promise((p,m)=>{var y;f.reject=m,f.resolve=p,(y=e)!==null&&y!==void 0||(e=[]),e.push(f)});return(d=r)!==null&&d!==void 0||(r=setTimeout(s)),h}return{load:o}}function AA(...t){const e=new AbortController,r=t.length;let a=0;const i=()=>{++a===r&&e.abort()};for(const s of t)s!=null&&s.aborted?i():s==null||s.addEventListener("abort",i,{once:!0});return e.signal}var Jd=cr(on(),1);function MA(t){var e,r;const a=xA(t),i=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,s=(r=t.maxItems)!==null&&r!==void 0?r:1/0;return()=>{const o=h=>({validate(p){if(i===1/0&&s===1/0)return!0;if(p.length>s)return!1;const m=p.map(E=>E.path).join(","),y=p.map(E=>E.input);return pT((0,Jd.default)((0,Jd.default)({},a),{},{type:h,path:m,inputs:y,signal:null})).length<=i},async fetch(p){const m=p.map(C=>C.path).join(","),y=p.map(C=>C.input),x=AA(...p.map(C=>C.signal)),E=await EA((0,Jd.default)((0,Jd.default)({},a),{},{path:m,inputs:y,type:h,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:p}):t.headers:{}},signal:x}));return(Array.isArray(E.json)?E.json:p.map(()=>E.json)).map(C=>({meta:E.meta,json:C}))}}),u=d2(o("query")),d=d2(o("mutation")),f={query:u,mutation:d};return({op:h})=>Zf(p=>{/* istanbul ignore if -- @preserve */if(h.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const y=f[h.type].load(h);let x;return y.then(E=>{x=E;const w=hA(E.json,a.transformer.output);if(!w.ok){p.error(Rf.from(w.error,{meta:E.meta}));return}p.next({context:E.meta,result:w.result}),p.complete()}).catch(E=>{p.error(Rf.from(E,{meta:x==null?void 0:x.meta}))}),()=>{}})}}cr(on(),1);const gT=(t,...e)=>typeof t=="function"?t(...e):t;cr(il(),1);function kA(){let t,e;return{promise:new Promise((a,i)=>{t=a,e=i}),resolve:t,reject:e}}async function DA(t){const e=await gT(t.url);if(!t.connectionParams)return e;const a=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+a}async function OA(t,e){const r={method:"connectionParams",data:await gT(t)};return e.encode(r)}cr(il(),1);var Li=cr(il(),1);function RA(t){const{promise:e,resolve:r,reject:a}=kA();return t.addEventListener("open",()=>{t.removeEventListener("error",a),r()}),t.addEventListener("error",a),e}function BA(t,{intervalMs:e,pongTimeoutMs:r}){let a,i;function s(){a=setTimeout(()=>{t.send("PING"),i=setTimeout(()=>{t.close()},r)},e)}function o(){clearTimeout(a),s()}function u(){clearTimeout(i),o()}t.addEventListener("open",s),t.addEventListener("message",({data:d})=>{clearTimeout(a),s(),d==="PONG"&&u()}),t.addEventListener("close",()=>{clearTimeout(a),clearTimeout(i)})}var LA=class Fg{constructor(e){var r;if((0,Li.default)(this,"id",++Fg.connectCount),(0,Li.default)(this,"WebSocketPonyfill",void 0),(0,Li.default)(this,"urlOptions",void 0),(0,Li.default)(this,"keepAliveOpts",void 0),(0,Li.default)(this,"encoder",void 0),(0,Li.default)(this,"wsObservable",tA(null)),(0,Li.default)(this,"openPromise",null),this.WebSocketPonyfill=(r=e.WebSocketPonyfill)!==null&&r!==void 0?r:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive,this.encoder=e.encoder}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++Fg.connectCount;const r=DA(e.urlOptions).then(a=>new e.WebSocketPonyfill(a));e.openPromise=r.then(async a=>{e.ws=a,a.binaryType="arraybuffer",a.addEventListener("message",function({data:i}){i==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&BA(a,e.keepAliveOpts),a.addEventListener("close",()=>{e.ws===a&&(e.ws=null)}),await RA(a),e.urlOptions.connectionParams&&a.send(await OA(e.urlOptions.connectionParams,e.encoder))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var r;(r=e.ws)===null||r===void 0||r.close()}}};(0,Li.default)(LA,"connectCount",0);cr(il(),1);cr(on(),1);var Lp=cr(il(),1),f2=cr(on(),1),eh=class{constructor(t){(0,Lp.default)(this,"links",void 0),(0,Lp.default)(this,"runtime",void 0),(0,Lp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return rA({links:this.links,op:(0,f2.default)((0,f2.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(eA())}async requestAsPromise(t){var e=this;try{const r=e.$request(t);return(await J4(r)).result.data}catch(r){throw Rf.from(r)}}query(t,e,r){return this.requestAsPromise({type:"query",path:t,input:e,context:r==null?void 0:r.context,signal:r==null?void 0:r.signal})}mutation(t,e,r){return this.requestAsPromise({type:"mutation",path:t,input:e,context:r==null?void 0:r.context,signal:r==null?void 0:r.signal})}subscription(t,e,r){return this.$request({type:"subscription",path:t,input:e,context:r.context,signal:r.signal}).subscribe({next(i){switch(i.result.type){case"state":{var s;(s=r.onConnectionStateChange)===null||s===void 0||s.call(r,i.result);break}case"started":{var o;(o=r.onStarted)===null||o===void 0||o.call(r,{context:i.context});break}case"stopped":{var u;(u=r.onStopped)===null||u===void 0||u.call(r);break}case"data":case void 0:{var d;(d=r.onData)===null||d===void 0||d.call(r,i.result.data);break}}},error(i){var s;(s=r.onError)===null||s===void 0||s.call(r,i)},complete(){var i;(i=r.onComplete)===null||i===void 0||i.call(r)}})}};const mT=Symbol.for("trpc_untypedClient"),PA={query:"query",mutate:"mutation",subscribe:"subscription"},zA=t=>PA[t];function yT(t){const e=Jf(({path:r,args:a})=>{const i=[...r],s=zA(i.pop()),o=i.join(".");return t[s](o,...a)});return Cm(r=>r===mT?t:e[r])}function _A(t){const e=new eh(t);return yT(e)}function jm(t){return t[mT]}cr(on(),1);cr(on(),1);var UA=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(i){var s,o,u,d=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,u=Symbol.iterator);d--;){if(o&&(s=i[o])!=null)return s.call(i);if(u&&(s=i[u])!=null)return new a(s.call(i));o="@@asyncIterator",u="@@iterator"}throw new TypeError("Object is not async iterable")}function a(i){function s(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var u=o.done;return Promise.resolve(o.value).then(function(d){return{value:d,done:u}})}return a=function(u){this.s=u,this.n=u.next},a.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(u){var d=this.s.return;return d===void 0?Promise.resolve({value:u,done:!0}):s(d.apply(this.s,arguments))},throw:function(u){var d=this.s.return;return d===void 0?Promise.reject(u):s(d.apply(this.s,arguments))}},new a(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});cr(UA(),1);cr(on(),1);var qA=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function r(){var a=typeof SuppressedError=="function"?SuppressedError:function(u,d){var f=Error();return f.name="SuppressedError",f.error=u,f.suppressed=d,f},i={},s=[];function o(u,d){if(d!=null){if(Object(d)!==d)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(u)var f=d[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(f===void 0&&(f=d[Symbol.dispose||Symbol.for("Symbol.dispose")],u))var h=f;if(typeof f!="function")throw new TypeError("Object is not disposable.");h&&(f=function(){try{h.call(d)}catch(m){return Promise.reject(m)}}),s.push({v:d,d:f,a:u})}else u&&s.push({d,a:u});return d}return{e:i,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var d,f=this.e,h=0;function p(){for(;d=s.pop();)try{if(!d.a&&h===1)return h=0,s.push(d),Promise.resolve().then(p);if(d.d){var y=d.d.call(d.v);if(d.a)return h|=2,Promise.resolve(y).then(p,m)}else h|=1}catch(x){return m(x)}if(h===1)return f!==i?Promise.reject(f):Promise.resolve();if(f!==i)throw f}function m(y){return f=f!==i?new a(y,f):y,p()}return p()}}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),xT=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function r(a,i){this.v=a,this.k=i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),IA=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var r=xT();function a(i){return new r(i,0)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),VA=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var r=xT();function a(s){return function(){return new i(s.apply(this,arguments))}}function i(s){var o,u;function d(h,p){try{var m=s[h](p),y=m.value,x=y instanceof r;Promise.resolve(x?y.v:y).then(function(E){if(x){var w=h==="return"?"return":"next";if(!y.k||E.done)return d(w,E);E=s[w](E).value}f(m.done?"return":"normal",E)},function(E){d("throw",E)})}catch(E){f("throw",E)}}function f(h,p){switch(h){case"return":o.resolve({value:p,done:!0});break;case"throw":o.reject(p);break;default:o.resolve({value:p,done:!1})}(o=o.next)?d(o.key,o.arg):u=null}this._invoke=function(h,p){return new Promise(function(m,y){var x={key:h,arg:p,resolve:m,reject:y,next:null};u?u=u.next=x:(o=u=x,d(h,p))})},typeof s.return!="function"&&(this.return=void 0)}i.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},i.prototype.next=function(s){return this._invoke("next",s)},i.prototype.throw=function(s){return this._invoke("throw",s)},i.prototype.return=function(s){return this._invoke("return",s)},e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}});cr(qA(),1);cr(IA(),1);cr(VA(),1);cr(on(),1);var Pp={exports:{}},ku={},zp={exports:{}},_p={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var h2;function FA(){return h2||(h2=1,(function(t){function e(_,V){var F=_.length;_.push(V);e:for(;0<F;){var K=F-1>>>1,ee=_[K];if(0<i(ee,V))_[K]=V,_[F]=ee,F=K;else break e}}function r(_){return _.length===0?null:_[0]}function a(_){if(_.length===0)return null;var V=_[0],F=_.pop();if(F!==V){_[0]=F;e:for(var K=0,ee=_.length,P=ee>>>1;K<P;){var G=2*(K+1)-1,Z=_[G],J=G+1,X=_[J];if(0>i(Z,F))J<ee&&0>i(X,Z)?(_[K]=X,_[J]=F,K=J):(_[K]=Z,_[G]=F,K=G);else if(J<ee&&0>i(X,F))_[K]=X,_[J]=F,K=J;else break e}}return V}function i(_,V){var F=_.sortIndex-V.sortIndex;return F!==0?F:_.id-V.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,u=o.now();t.unstable_now=function(){return o.now()-u}}var d=[],f=[],h=1,p=null,m=3,y=!1,x=!1,E=!1,w=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function A(_){for(var V=r(f);V!==null;){if(V.callback===null)a(f);else if(V.startTime<=_)a(f),V.sortIndex=V.expirationTime,e(d,V);else break;V=r(f)}}function D(_){if(E=!1,A(_),!x)if(r(d)!==null)x=!0,M||(M=!0,L());else{var V=r(f);V!==null&&Q(D,V.startTime-_)}}var M=!1,j=-1,k=5,R=-1;function z(){return w?!0:!(t.unstable_now()-R<k)}function B(){if(w=!1,M){var _=t.unstable_now();R=_;var V=!0;try{e:{x=!1,E&&(E=!1,C(j),j=-1),y=!0;var F=m;try{t:{for(A(_),p=r(d);p!==null&&!(p.expirationTime>_&&z());){var K=p.callback;if(typeof K=="function"){p.callback=null,m=p.priorityLevel;var ee=K(p.expirationTime<=_);if(_=t.unstable_now(),typeof ee=="function"){p.callback=ee,A(_),V=!0;break t}p===r(d)&&a(d),A(_)}else a(d);p=r(d)}if(p!==null)V=!0;else{var P=r(f);P!==null&&Q(D,P.startTime-_),V=!1}}break e}finally{p=null,m=F,y=!1}V=void 0}}finally{V?L():M=!1}}}var L;if(typeof N=="function")L=function(){N(B)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,I=q.port2;q.port1.onmessage=B,L=function(){I.postMessage(null)}}else L=function(){T(B,0)};function Q(_,V){j=T(function(){_(t.unstable_now())},V)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(_){_.callback=null},t.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<_?Math.floor(1e3/_):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(_){switch(m){case 1:case 2:case 3:var V=3;break;default:V=m}var F=m;m=V;try{return _()}finally{m=F}},t.unstable_requestPaint=function(){w=!0},t.unstable_runWithPriority=function(_,V){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var F=m;m=_;try{return V()}finally{m=F}},t.unstable_scheduleCallback=function(_,V,F){var K=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?K+F:K):F=K,_){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=F+ee,_={id:h++,callback:V,priorityLevel:_,startTime:F,expirationTime:ee,sortIndex:-1},F>K?(_.sortIndex=F,e(f,_),r(d)===null&&_===r(f)&&(E?(C(j),j=-1):E=!0,Q(D,F-K))):(_.sortIndex=ee,e(d,_),x||y||(x=!0,M||(M=!0,L()))),_},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(_){var V=m;return function(){var F=m;m=V;try{return _.apply(this,arguments)}finally{m=F}}}})(_p)),_p}var v2;function HA(){return v2||(v2=1,zp.exports=FA()),zp.exports}var Up={exports:{}},$r={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var p2;function GA(){if(p2)return $r;p2=1;var t=Em();function e(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(e(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(d,f,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:d,containerInfo:f,implementation:h}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return $r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,$r.createPortal=function(d,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(d,f,null,h)},$r.flushSync=function(d){var f=o.T,h=a.p;try{if(o.T=null,a.p=2,d)return d()}finally{o.T=f,a.p=h,a.d.f()}},$r.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,a.d.C(d,f))},$r.prefetchDNS=function(d){typeof d=="string"&&a.d.D(d)},$r.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var h=f.as,p=u(h,f.crossOrigin),m=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?a.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:p,integrity:m,fetchPriority:y}):h==="script"&&a.d.X(d,{crossOrigin:p,integrity:m,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},$r.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=u(f.as,f.crossOrigin);a.d.M(d,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&a.d.M(d)},$r.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,p=u(h,f.crossOrigin);a.d.L(d,h,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},$r.preloadModule=function(d,f){if(typeof d=="string")if(f){var h=u(f.as,f.crossOrigin);a.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else a.d.m(d)},$r.requestFormReset=function(d){a.d.r(d)},$r.unstable_batchedUpdates=function(d,f){return d(f)},$r.useFormState=function(d,f,h){return o.H.useFormState(d,f,h)},$r.useFormStatus=function(){return o.H.useHostTransitionStatus()},$r.version="19.2.4",$r}var g2;function bT(){if(g2)return Up.exports;g2=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Up.exports=GA(),Up.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var m2;function QA(){if(m2)return ku;m2=1;var t=HA(),e=Em(),r=bT();function a(n){var l="https://react.dev/errors/"+n;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)l+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+n+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function s(n){var l=n,c=n;if(n.alternate)for(;l.return;)l=l.return;else{n=l;do l=n,(l.flags&4098)!==0&&(c=l.return),n=l.return;while(n)}return l.tag===3?c:null}function o(n){if(n.tag===13){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function u(n){if(n.tag===31){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function d(n){if(s(n)!==n)throw Error(a(188))}function f(n){var l=n.alternate;if(!l){if(l=s(n),l===null)throw Error(a(188));return l!==n?null:n}for(var c=n,v=l;;){var b=c.return;if(b===null)break;var S=b.alternate;if(S===null){if(v=b.return,v!==null){c=v;continue}break}if(b.child===S.child){for(S=b.child;S;){if(S===c)return d(b),n;if(S===v)return d(b),l;S=S.sibling}throw Error(a(188))}if(c.return!==v.return)c=b,v=S;else{for(var O=!1,H=b.child;H;){if(H===c){O=!0,c=b,v=S;break}if(H===v){O=!0,v=b,c=S;break}H=H.sibling}if(!O){for(H=S.child;H;){if(H===c){O=!0,c=S,v=b;break}if(H===v){O=!0,v=S,c=b;break}H=H.sibling}if(!O)throw Error(a(189))}}if(c.alternate!==v)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?n:l}function h(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n;for(n=n.child;n!==null;){if(l=h(n),l!==null)return l;n=n.sibling}return null}var p=Object.assign,m=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),N=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function L(n){return n===null||typeof n!="object"?null:(n=B&&n[B]||n["@@iterator"],typeof n=="function"?n:null)}var q=Symbol.for("react.client.reference");function I(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===q?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case E:return"Fragment";case T:return"Profiler";case w:return"StrictMode";case D:return"Suspense";case M:return"SuspenseList";case R:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case x:return"Portal";case N:return n.displayName||"Context";case C:return(n._context.displayName||"Context")+".Consumer";case A:var l=n.render;return n=n.displayName,n||(n=l.displayName||l.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case j:return l=n.displayName||null,l!==null?l:I(n.type)||"Memo";case k:l=n._payload,n=n._init;try{return I(n(l))}catch{}}return null}var Q=Array.isArray,_=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},K=[],ee=-1;function P(n){return{current:n}}function G(n){0>ee||(n.current=K[ee],K[ee]=null,ee--)}function Z(n,l){ee++,K[ee]=n.current,n.current=l}var J=P(null),X=P(null),Y=P(null),le=P(null);function me(n,l){switch(Z(Y,l),Z(X,n),Z(J,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?m1(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=m1(l),n=y1(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}G(J),Z(J,n)}function oe(){G(J),G(X),G(Y)}function ae(n){n.memoizedState!==null&&Z(le,n);var l=J.current,c=y1(l,n.type);l!==c&&(Z(X,n),Z(J,c))}function re(n){X.current===n&&(G(J),G(X)),le.current===n&&(G(le),Cu._currentValue=F)}var se,ie;function Ne(n){if(se===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);se=l&&l[1]||"",ie=-1<c.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+se+n+ie}var Ae=!1;function Ze(n,l){if(!n||Ae)return"";Ae=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(l){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(ge){var he=ge}Reflect.construct(n,[],Ce)}else{try{Ce.call()}catch(ge){he=ge}n.call(Ce.prototype)}}else{try{throw Error()}catch(ge){he=ge}(Ce=n())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(ge){if(ge&&he&&typeof ge.stack=="string")return[ge.stack,he.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=v.DetermineComponentFrameRoot(),O=S[0],H=S[1];if(O&&H){var te=O.split(`
44
- `),fe=H.split(`
45
- `);for(b=v=0;v<te.length&&!te[v].includes("DetermineComponentFrameRoot");)v++;for(;b<fe.length&&!fe[b].includes("DetermineComponentFrameRoot");)b++;if(v===te.length||b===fe.length)for(v=te.length-1,b=fe.length-1;1<=v&&0<=b&&te[v]!==fe[b];)b--;for(;1<=v&&0<=b;v--,b--)if(te[v]!==fe[b]){if(v!==1||b!==1)do if(v--,b--,0>b||te[v]!==fe[b]){var be=`
46
- `+te[v].replace(" at new "," at ");return n.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",n.displayName)),be}while(1<=v&&0<=b);break}}}finally{Ae=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?Ne(c):""}function Qe(n,l){switch(n.tag){case 26:case 27:case 5:return Ne(n.type);case 16:return Ne("Lazy");case 13:return n.child!==l&&l!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return Ze(n.type,!1);case 11:return Ze(n.type.render,!1);case 1:return Ze(n.type,!0);case 31:return Ne("Activity");default:return""}}function Se(n){try{var l="",c=null;do l+=Qe(n,c),c=n,n=n.return;while(n);return l}catch(v){return`
47
- Error generating stack: `+v.message+`
48
- `+v.stack}}var Oe=Object.prototype.hasOwnProperty,ke=t.unstable_scheduleCallback,Pe=t.unstable_cancelCallback,Ge=t.unstable_shouldYield,Je=t.unstable_requestPaint,Be=t.unstable_now,nt=t.unstable_getCurrentPriorityLevel,ye=t.unstable_ImmediatePriority,$e=t.unstable_UserBlockingPriority,et=t.unstable_NormalPriority,xe=t.unstable_LowPriority,ze=t.unstable_IdlePriority,Re=t.log,we=t.unstable_setDisableYieldValue,$=null,ce=null;function pe(n){if(typeof Re=="function"&&we(n),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode($,n)}catch{}}var ve=Math.clz32?Math.clz32:je,Ee=Math.log,Ue=Math.LN2;function je(n){return n>>>=0,n===0?32:31-(Ee(n)/Ue|0)|0}var He=256,_e=262144,Ke=4194304;function it(n){var l=n&42;if(l!==0)return l;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function st(n,l,c){var v=n.pendingLanes;if(v===0)return 0;var b=0,S=n.suspendedLanes,O=n.pingedLanes;n=n.warmLanes;var H=v&134217727;return H!==0?(v=H&~S,v!==0?b=it(v):(O&=H,O!==0?b=it(O):c||(c=H&~n,c!==0&&(b=it(c))))):(H=v&~S,H!==0?b=it(H):O!==0?b=it(O):c||(c=v&~n,c!==0&&(b=it(c)))),b===0?0:l!==0&&l!==b&&(l&S)===0&&(S=b&-b,c=l&-l,S>=c||S===32&&(c&4194048)!==0)?l:b}function Ve(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function dt(n,l){switch(n){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 ut(){var n=Ke;return Ke<<=1,(Ke&62914560)===0&&(Ke=4194304),n}function Yt(n){for(var l=[],c=0;31>c;c++)l.push(n);return l}function Ot(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Lr(n,l,c,v,b,S){var O=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var H=n.entanglements,te=n.expirationTimes,fe=n.hiddenUpdates;for(c=O&~c;0<c;){var be=31-ve(c),Ce=1<<be;H[be]=0,te[be]=-1;var he=fe[be];if(he!==null)for(fe[be]=null,be=0;be<he.length;be++){var ge=he[be];ge!==null&&(ge.lane&=-536870913)}c&=~Ce}v!==0&&Kt(n,v,0),S!==0&&b===0&&n.tag!==0&&(n.suspendedLanes|=S&~(O&~l))}function Kt(n,l,c){n.pendingLanes|=l,n.suspendedLanes&=~l;var v=31-ve(l);n.entangledLanes|=l,n.entanglements[v]=n.entanglements[v]|1073741824|c&261930}function sr(n,l){var c=n.entangledLanes|=l;for(n=n.entanglements;c;){var v=31-ve(c),b=1<<v;b&l|n[v]&l&&(n[v]|=l),c&=~b}}function Jt(n,l){var c=l&-l;return c=(c&42)!==0?1:lr(c),(c&(n.suspendedLanes|l))!==0?0:c}function lr(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Ra(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Xt(){var n=V.p;return n!==0?n:(n=window.event,n===void 0?32:I1(n.type))}function Ba(n,l){var c=V.p;try{return V.p=n,l()}finally{V.p=c}}var Cr=Math.random().toString(36).slice(2),Ht="__reactFiber$"+Cr,xr="__reactProps$"+Cr,sa="__reactContainer$"+Cr,Nr="__reactEvents$"+Cr,jr="__reactListeners$"+Cr,Gr="__reactHandles$"+Cr,ni="__reactResources$"+Cr,Ar="__reactMarker$"+Cr;function dl(n){delete n[Ht],delete n[xr],delete n[Nr],delete n[jr],delete n[Gr]}function ii(n){var l=n[Ht];if(l)return l;for(var c=n.parentNode;c;){if(l=c[sa]||c[Ht]){if(c=l.alternate,l.child!==null||c!==null&&c.child!==null)for(n=C1(n);n!==null;){if(c=n[Ht])return c;n=C1(n)}return l}n=c,c=n.parentNode}return null}function si(n){if(n=n[Ht]||n[sa]){var l=n.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return n}return null}function ps(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n.stateNode;throw Error(a(33))}function li(n){var l=n[ni];return l||(l=n[ni]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function dr(n){n[Ar]=!0}var Lc=new Set,Pc={};function wa(n,l){cn(n,l),cn(n+"Capture",l)}function cn(n,l){for(Pc[n]=l,n=0;n<l.length;n++)Lc.add(l[n])}var fl=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]*$"),qo={},Io={};function Sh(n){return Oe.call(Io,n)?!0:Oe.call(qo,n)?!1:fl.test(n)?Io[n]=!0:(qo[n]=!0,!1)}function Qr(n,l,c){if(Sh(l))if(c===null)n.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(l);return;case"boolean":var v=l.toLowerCase().slice(0,5);if(v!=="data-"&&v!=="aria-"){n.removeAttribute(l);return}}n.setAttribute(l,""+c)}}function oi(n,l,c){if(c===null)n.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttribute(l,""+c)}}function La(n,l,c,v){if(v===null)n.removeAttribute(c);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(l,c,""+v)}}function Mr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function la(n){var l=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Eh(n,l,c){var v=Object.getOwnPropertyDescriptor(n.constructor.prototype,l);if(!n.hasOwnProperty(l)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var b=v.get,S=v.set;return Object.defineProperty(n,l,{configurable:!0,get:function(){return b.call(this)},set:function(O){c=""+O,S.call(this,O)}}),Object.defineProperty(n,l,{enumerable:v.enumerable}),{getValue:function(){return c},setValue:function(O){c=""+O},stopTracking:function(){n._valueTracker=null,delete n[l]}}}}function zc(n){if(!n._valueTracker){var l=la(n)?"checked":"value";n._valueTracker=Eh(n,l,""+n[l])}}function _c(n){if(!n)return!1;var l=n._valueTracker;if(!l)return!0;var c=l.getValue(),v="";return n&&(v=la(n)?n.checked?"true":"false":n.value),n=v,n!==c?(l.setValue(n),!0):!1}function Uc(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var KN=/[\n"\\]/g;function Pa(n){return n.replace(KN,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Th(n,l,c,v,b,S,O,H){n.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?n.type=O:n.removeAttribute("type"),l!=null?O==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+Mr(l)):n.value!==""+Mr(l)&&(n.value=""+Mr(l)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),l!=null?Ch(n,O,Mr(l)):c!=null?Ch(n,O,Mr(c)):v!=null&&n.removeAttribute("value"),b==null&&S!=null&&(n.defaultChecked=!!S),b!=null&&(n.checked=b&&typeof b!="function"&&typeof b!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?n.name=""+Mr(H):n.removeAttribute("name")}function dy(n,l,c,v,b,S,O,H){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(n.type=S),l!=null||c!=null){if(!(S!=="submit"&&S!=="reset"||l!=null)){zc(n);return}c=c!=null?""+Mr(c):"",l=l!=null?""+Mr(l):c,H||l===n.value||(n.value=l),n.defaultValue=l}v=v??b,v=typeof v!="function"&&typeof v!="symbol"&&!!v,n.checked=H?n.checked:!!v,n.defaultChecked=!!v,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(n.name=O),zc(n)}function Ch(n,l,c){l==="number"&&Uc(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function hl(n,l,c,v){if(n=n.options,l){l={};for(var b=0;b<c.length;b++)l["$"+c[b]]=!0;for(c=0;c<n.length;c++)b=l.hasOwnProperty("$"+n[c].value),n[c].selected!==b&&(n[c].selected=b),b&&v&&(n[c].defaultSelected=!0)}else{for(c=""+Mr(c),l=null,b=0;b<n.length;b++){if(n[b].value===c){n[b].selected=!0,v&&(n[b].defaultSelected=!0);return}l!==null||n[b].disabled||(l=n[b])}l!==null&&(l.selected=!0)}}function fy(n,l,c){if(l!=null&&(l=""+Mr(l),l!==n.value&&(n.value=l),c==null)){n.defaultValue!==l&&(n.defaultValue=l);return}n.defaultValue=c!=null?""+Mr(c):""}function hy(n,l,c,v){if(l==null){if(v!=null){if(c!=null)throw Error(a(92));if(Q(v)){if(1<v.length)throw Error(a(93));v=v[0]}c=v}c==null&&(c=""),l=c}c=Mr(l),n.defaultValue=c,v=n.textContent,v===c&&v!==""&&v!==null&&(n.value=v),zc(n)}function vl(n,l){if(l){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=l;return}}n.textContent=l}var XN=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 vy(n,l,c){var v=l.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?v?n.setProperty(l,""):l==="float"?n.cssFloat="":n[l]="":v?n.setProperty(l,c):typeof c!="number"||c===0||XN.has(l)?l==="float"?n.cssFloat=c:n[l]=(""+c).trim():n[l]=c+"px"}function py(n,l,c){if(l!=null&&typeof l!="object")throw Error(a(62));if(n=n.style,c!=null){for(var v in c)!c.hasOwnProperty(v)||l!=null&&l.hasOwnProperty(v)||(v.indexOf("--")===0?n.setProperty(v,""):v==="float"?n.cssFloat="":n[v]="");for(var b in l)v=l[b],l.hasOwnProperty(b)&&c[b]!==v&&vy(n,b,v)}else for(var S in l)l.hasOwnProperty(S)&&vy(n,S,l[S])}function Nh(n){if(n.indexOf("-")===-1)return!1;switch(n){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 ZN=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"]]),WN=/^[\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 qc(n){return WN.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function jn(){}var jh=null;function Ah(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var pl=null,gl=null;function gy(n){var l=si(n);if(l&&(n=l.stateNode)){var c=n[xr]||null;e:switch(n=l.stateNode,l.type){case"input":if(Th(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),l=c.name,c.type==="radio"&&l!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Pa(""+l)+'"][type="radio"]'),l=0;l<c.length;l++){var v=c[l];if(v!==n&&v.form===n.form){var b=v[xr]||null;if(!b)throw Error(a(90));Th(v,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(l=0;l<c.length;l++)v=c[l],v.form===n.form&&_c(v)}break e;case"textarea":fy(n,c.value,c.defaultValue);break e;case"select":l=c.value,l!=null&&hl(n,!!c.multiple,l,!1)}}}var Mh=!1;function my(n,l,c){if(Mh)return n(l,c);Mh=!0;try{var v=n(l);return v}finally{if(Mh=!1,(pl!==null||gl!==null)&&(jd(),pl&&(l=pl,n=gl,gl=pl=null,gy(l),n)))for(l=0;l<n.length;l++)gy(n[l])}}function Vo(n,l){var c=n.stateNode;if(c===null)return null;var v=c[xr]||null;if(v===null)return null;c=v[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(n=n.type,v=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!v;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(a(231,l,typeof c));return c}var An=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kh=!1;if(An)try{var Fo={};Object.defineProperty(Fo,"passive",{get:function(){kh=!0}}),window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,Fo)}catch{kh=!1}var ui=null,Dh=null,Ic=null;function yy(){if(Ic)return Ic;var n,l=Dh,c=l.length,v,b="value"in ui?ui.value:ui.textContent,S=b.length;for(n=0;n<c&&l[n]===b[n];n++);var O=c-n;for(v=1;v<=O&&l[c-v]===b[S-v];v++);return Ic=b.slice(n,1<v?1-v:void 0)}function Vc(n){var l=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&l===13&&(n=13)):n=l,n===10&&(n=13),32<=n||n===13?n:0}function Fc(){return!0}function xy(){return!1}function oa(n){function l(c,v,b,S,O){this._reactName=c,this._targetInst=b,this.type=v,this.nativeEvent=S,this.target=O,this.currentTarget=null;for(var H in n)n.hasOwnProperty(H)&&(c=n[H],this[H]=c?c(S):S[H]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Fc:xy,this.isPropagationStopped=xy,this}return p(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Fc)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Fc)},persist:function(){},isPersistent:Fc}),l}var gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hc=oa(gs),Ho=p({},gs,{view:0,detail:0}),JN=oa(Ho),Oh,Rh,Go,Gc=p({},Ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lh,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Go&&(Go&&n.type==="mousemove"?(Oh=n.screenX-Go.screenX,Rh=n.screenY-Go.screenY):Rh=Oh=0,Go=n),Oh)},movementY:function(n){return"movementY"in n?n.movementY:Rh}}),by=oa(Gc),ej=p({},Gc,{dataTransfer:0}),tj=oa(ej),rj=p({},Ho,{relatedTarget:0}),Bh=oa(rj),aj=p({},gs,{animationName:0,elapsedTime:0,pseudoElement:0}),nj=oa(aj),ij=p({},gs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),sj=oa(ij),lj=p({},gs,{data:0}),wy=oa(lj),oj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uj={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"},cj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dj(n){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(n):(n=cj[n])?!!l[n]:!1}function Lh(){return dj}var fj=p({},Ho,{key:function(n){if(n.key){var l=oj[n.key]||n.key;if(l!=="Unidentified")return l}return n.type==="keypress"?(n=Vc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?uj[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lh,charCode:function(n){return n.type==="keypress"?Vc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Vc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),hj=oa(fj),vj=p({},Gc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sy=oa(vj),pj=p({},Ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lh}),gj=oa(pj),mj=p({},gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),yj=oa(mj),xj=p({},Gc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),bj=oa(xj),wj=p({},gs,{newState:0,oldState:0}),Sj=oa(wj),Ej=[9,13,27,32],Ph=An&&"CompositionEvent"in window,Qo=null;An&&"documentMode"in document&&(Qo=document.documentMode);var Tj=An&&"TextEvent"in window&&!Qo,Ey=An&&(!Ph||Qo&&8<Qo&&11>=Qo),Ty=" ",Cy=!1;function Ny(n,l){switch(n){case"keyup":return Ej.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ml=!1;function Cj(n,l){switch(n){case"compositionend":return jy(l);case"keypress":return l.which!==32?null:(Cy=!0,Ty);case"textInput":return n=l.data,n===Ty&&Cy?null:n;default:return null}}function Nj(n,l){if(ml)return n==="compositionend"||!Ph&&Ny(n,l)?(n=yy(),Ic=Dh=ui=null,ml=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Ey&&l.locale!=="ko"?null:l.data;default:return null}}var jj={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 Ay(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l==="input"?!!jj[n.type]:l==="textarea"}function My(n,l,c,v){pl?gl?gl.push(v):gl=[v]:pl=v,l=Bd(l,"onChange"),0<l.length&&(c=new Hc("onChange","change",null,c,v),n.push({event:c,listeners:l}))}var $o=null,Yo=null;function Aj(n){d1(n,0)}function Qc(n){var l=ps(n);if(_c(l))return n}function ky(n,l){if(n==="change")return l}var Dy=!1;if(An){var zh;if(An){var _h="oninput"in document;if(!_h){var Oy=document.createElement("div");Oy.setAttribute("oninput","return;"),_h=typeof Oy.oninput=="function"}zh=_h}else zh=!1;Dy=zh&&(!document.documentMode||9<document.documentMode)}function Ry(){$o&&($o.detachEvent("onpropertychange",By),Yo=$o=null)}function By(n){if(n.propertyName==="value"&&Qc(Yo)){var l=[];My(l,Yo,n,Ah(n)),my(Aj,l)}}function Mj(n,l,c){n==="focusin"?(Ry(),$o=l,Yo=c,$o.attachEvent("onpropertychange",By)):n==="focusout"&&Ry()}function kj(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Qc(Yo)}function Dj(n,l){if(n==="click")return Qc(l)}function Oj(n,l){if(n==="input"||n==="change")return Qc(l)}function Rj(n,l){return n===l&&(n!==0||1/n===1/l)||n!==n&&l!==l}var Sa=typeof Object.is=="function"?Object.is:Rj;function Ko(n,l){if(Sa(n,l))return!0;if(typeof n!="object"||n===null||typeof l!="object"||l===null)return!1;var c=Object.keys(n),v=Object.keys(l);if(c.length!==v.length)return!1;for(v=0;v<c.length;v++){var b=c[v];if(!Oe.call(l,b)||!Sa(n[b],l[b]))return!1}return!0}function Ly(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Py(n,l){var c=Ly(n);n=0;for(var v;c;){if(c.nodeType===3){if(v=n+c.textContent.length,n<=l&&v>=l)return{node:c,offset:l-n};n=v}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Ly(c)}}function zy(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?zy(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function _y(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=Uc(n.document);l instanceof n.HTMLIFrameElement;){try{var c=typeof l.contentWindow.location.href=="string"}catch{c=!1}if(c)n=l.contentWindow;else break;l=Uc(n.document)}return l}function Uh(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}var Bj=An&&"documentMode"in document&&11>=document.documentMode,yl=null,qh=null,Xo=null,Ih=!1;function Uy(n,l,c){var v=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ih||yl==null||yl!==Uc(v)||(v=yl,"selectionStart"in v&&Uh(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),Xo&&Ko(Xo,v)||(Xo=v,v=Bd(qh,"onSelect"),0<v.length&&(l=new Hc("onSelect","select",null,l,c),n.push({event:l,listeners:v}),l.target=yl)))}function ms(n,l){var c={};return c[n.toLowerCase()]=l.toLowerCase(),c["Webkit"+n]="webkit"+l,c["Moz"+n]="moz"+l,c}var xl={animationend:ms("Animation","AnimationEnd"),animationiteration:ms("Animation","AnimationIteration"),animationstart:ms("Animation","AnimationStart"),transitionrun:ms("Transition","TransitionRun"),transitionstart:ms("Transition","TransitionStart"),transitioncancel:ms("Transition","TransitionCancel"),transitionend:ms("Transition","TransitionEnd")},Vh={},qy={};An&&(qy=document.createElement("div").style,"AnimationEvent"in window||(delete xl.animationend.animation,delete xl.animationiteration.animation,delete xl.animationstart.animation),"TransitionEvent"in window||delete xl.transitionend.transition);function ys(n){if(Vh[n])return Vh[n];if(!xl[n])return n;var l=xl[n],c;for(c in l)if(l.hasOwnProperty(c)&&c in qy)return Vh[n]=l[c];return n}var Iy=ys("animationend"),Vy=ys("animationiteration"),Fy=ys("animationstart"),Lj=ys("transitionrun"),Pj=ys("transitionstart"),zj=ys("transitioncancel"),Hy=ys("transitionend"),Gy=new Map,Fh="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(" ");Fh.push("scrollEnd");function Za(n,l){Gy.set(n,l),wa(l,[n])}var $c=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},za=[],bl=0,Hh=0;function Yc(){for(var n=bl,l=Hh=bl=0;l<n;){var c=za[l];za[l++]=null;var v=za[l];za[l++]=null;var b=za[l];za[l++]=null;var S=za[l];if(za[l++]=null,v!==null&&b!==null){var O=v.pending;O===null?b.next=b:(b.next=O.next,O.next=b),v.pending=b}S!==0&&Qy(c,b,S)}}function Kc(n,l,c,v){za[bl++]=n,za[bl++]=l,za[bl++]=c,za[bl++]=v,Hh|=v,n.lanes|=v,n=n.alternate,n!==null&&(n.lanes|=v)}function Gh(n,l,c,v){return Kc(n,l,c,v),Xc(n)}function xs(n,l){return Kc(n,null,null,l),Xc(n)}function Qy(n,l,c){n.lanes|=c;var v=n.alternate;v!==null&&(v.lanes|=c);for(var b=!1,S=n.return;S!==null;)S.childLanes|=c,v=S.alternate,v!==null&&(v.childLanes|=c),S.tag===22&&(n=S.stateNode,n===null||n._visibility&1||(b=!0)),n=S,S=S.return;return n.tag===3?(S=n.stateNode,b&&l!==null&&(b=31-ve(c),n=S.hiddenUpdates,v=n[b],v===null?n[b]=[l]:v.push(l),l.lane=c|536870912),S):null}function Xc(n){if(50<yu)throw yu=0,ep=null,Error(a(185));for(var l=n.return;l!==null;)n=l,l=n.return;return n.tag===3?n.stateNode:null}var wl={};function _j(n,l,c,v){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ea(n,l,c,v){return new _j(n,l,c,v)}function Qh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Mn(n,l){var c=n.alternate;return c===null?(c=Ea(n.tag,l,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=l,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,l=n.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function $y(n,l){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=l,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,l=c.dependencies,n.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),n}function Zc(n,l,c,v,b,S){var O=0;if(v=n,typeof n=="function")Qh(n)&&(O=1);else if(typeof n=="string")O=F5(n,c,J.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case R:return n=Ea(31,c,l,b),n.elementType=R,n.lanes=S,n;case E:return bs(c.children,b,S,l);case w:O=8,b|=24;break;case T:return n=Ea(12,c,l,b|2),n.elementType=T,n.lanes=S,n;case D:return n=Ea(13,c,l,b),n.elementType=D,n.lanes=S,n;case M:return n=Ea(19,c,l,b),n.elementType=M,n.lanes=S,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:O=10;break e;case C:O=9;break e;case A:O=11;break e;case j:O=14;break e;case k:O=16,v=null;break e}O=29,c=Error(a(130,n===null?"null":typeof n,"")),v=null}return l=Ea(O,c,l,b),l.elementType=n,l.type=v,l.lanes=S,l}function bs(n,l,c,v){return n=Ea(7,n,v,l),n.lanes=c,n}function $h(n,l,c){return n=Ea(6,n,null,l),n.lanes=c,n}function Yy(n){var l=Ea(18,null,null,0);return l.stateNode=n,l}function Yh(n,l,c){return l=Ea(4,n.children!==null?n.children:[],n.key,l),l.lanes=c,l.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},l}var Ky=new WeakMap;function _a(n,l){if(typeof n=="object"&&n!==null){var c=Ky.get(n);return c!==void 0?c:(l={value:n,source:l,stack:Se(l)},Ky.set(n,l),l)}return{value:n,source:l,stack:Se(l)}}var Sl=[],El=0,Wc=null,Zo=0,Ua=[],qa=0,ci=null,dn=1,fn="";function kn(n,l){Sl[El++]=Zo,Sl[El++]=Wc,Wc=n,Zo=l}function Xy(n,l,c){Ua[qa++]=dn,Ua[qa++]=fn,Ua[qa++]=ci,ci=n;var v=dn;n=fn;var b=32-ve(v)-1;v&=~(1<<b),c+=1;var S=32-ve(l)+b;if(30<S){var O=b-b%5;S=(v&(1<<O)-1).toString(32),v>>=O,b-=O,dn=1<<32-ve(l)+b|c<<b|v,fn=S+n}else dn=1<<S|c<<b|v,fn=n}function Kh(n){n.return!==null&&(kn(n,1),Xy(n,1,0))}function Xh(n){for(;n===Wc;)Wc=Sl[--El],Sl[El]=null,Zo=Sl[--El],Sl[El]=null;for(;n===ci;)ci=Ua[--qa],Ua[qa]=null,fn=Ua[--qa],Ua[qa]=null,dn=Ua[--qa],Ua[qa]=null}function Zy(n,l){Ua[qa++]=dn,Ua[qa++]=fn,Ua[qa++]=ci,dn=l.id,fn=l.overflow,ci=n}var Pr=null,It=null,mt=!1,di=null,Ia=!1,Zh=Error(a(519));function fi(n){var l=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wo(_a(l,n)),Zh}function Wy(n){var l=n.stateNode,c=n.type,v=n.memoizedProps;switch(l[Ht]=n,l[xr]=v,c){case"dialog":vt("cancel",l),vt("close",l);break;case"iframe":case"object":case"embed":vt("load",l);break;case"video":case"audio":for(c=0;c<bu.length;c++)vt(bu[c],l);break;case"source":vt("error",l);break;case"img":case"image":case"link":vt("error",l),vt("load",l);break;case"details":vt("toggle",l);break;case"input":vt("invalid",l),dy(l,v.value,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name,!0);break;case"select":vt("invalid",l);break;case"textarea":vt("invalid",l),hy(l,v.value,v.defaultValue,v.children)}c=v.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||l.textContent===""+c||v.suppressHydrationWarning===!0||p1(l.textContent,c)?(v.popover!=null&&(vt("beforetoggle",l),vt("toggle",l)),v.onScroll!=null&&vt("scroll",l),v.onScrollEnd!=null&&vt("scrollend",l),v.onClick!=null&&(l.onclick=jn),l=!0):l=!1,l||fi(n,!0)}function Jy(n){for(Pr=n.return;Pr;)switch(Pr.tag){case 5:case 31:case 13:Ia=!1;return;case 27:case 3:Ia=!0;return;default:Pr=Pr.return}}function Tl(n){if(n!==Pr)return!1;if(!mt)return Jy(n),mt=!0,!1;var l=n.tag,c;if((c=l!==3&&l!==27)&&((c=l===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||pp(n.type,n.memoizedProps)),c=!c),c&&It&&fi(n),Jy(n),l===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));It=T1(n)}else if(l===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));It=T1(n)}else l===27?(l=It,Ni(n.type)?(n=bp,bp=null,It=n):It=l):It=Pr?Fa(n.stateNode.nextSibling):null;return!0}function ws(){It=Pr=null,mt=!1}function Wh(){var n=di;return n!==null&&(fa===null?fa=n:fa.push.apply(fa,n),di=null),n}function Wo(n){di===null?di=[n]:di.push(n)}var Jh=P(null),Ss=null,Dn=null;function hi(n,l,c){Z(Jh,l._currentValue),l._currentValue=c}function On(n){n._currentValue=Jh.current,G(Jh)}function ev(n,l,c){for(;n!==null;){var v=n.alternate;if((n.childLanes&l)!==l?(n.childLanes|=l,v!==null&&(v.childLanes|=l)):v!==null&&(v.childLanes&l)!==l&&(v.childLanes|=l),n===c)break;n=n.return}}function tv(n,l,c,v){var b=n.child;for(b!==null&&(b.return=n);b!==null;){var S=b.dependencies;if(S!==null){var O=b.child;S=S.firstContext;e:for(;S!==null;){var H=S;S=b;for(var te=0;te<l.length;te++)if(H.context===l[te]){S.lanes|=c,H=S.alternate,H!==null&&(H.lanes|=c),ev(S.return,c,n),v||(O=null);break e}S=H.next}}else if(b.tag===18){if(O=b.return,O===null)throw Error(a(341));O.lanes|=c,S=O.alternate,S!==null&&(S.lanes|=c),ev(O,c,n),O=null}else O=b.child;if(O!==null)O.return=b;else for(O=b;O!==null;){if(O===n){O=null;break}if(b=O.sibling,b!==null){b.return=O.return,O=b;break}O=O.return}b=O}}function Cl(n,l,c,v){n=null;for(var b=l,S=!1;b!==null;){if(!S){if((b.flags&524288)!==0)S=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var O=b.alternate;if(O===null)throw Error(a(387));if(O=O.memoizedProps,O!==null){var H=b.type;Sa(b.pendingProps.value,O.value)||(n!==null?n.push(H):n=[H])}}else if(b===le.current){if(O=b.alternate,O===null)throw Error(a(387));O.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(n!==null?n.push(Cu):n=[Cu])}b=b.return}n!==null&&tv(l,n,c,v),l.flags|=262144}function Jc(n){for(n=n.firstContext;n!==null;){if(!Sa(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Es(n){Ss=n,Dn=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function zr(n){return ex(Ss,n)}function ed(n,l){return Ss===null&&Es(n),ex(n,l)}function ex(n,l){var c=l._currentValue;if(l={context:l,memoizedValue:c,next:null},Dn===null){if(n===null)throw Error(a(308));Dn=l,n.dependencies={lanes:0,firstContext:l},n.flags|=524288}else Dn=Dn.next=l;return c}var Uj=typeof AbortController<"u"?AbortController:function(){var n=[],l=this.signal={aborted:!1,addEventListener:function(c,v){n.push(v)}};this.abort=function(){l.aborted=!0,n.forEach(function(c){return c()})}},qj=t.unstable_scheduleCallback,Ij=t.unstable_NormalPriority,fr={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function rv(){return{controller:new Uj,data:new Map,refCount:0}}function Jo(n){n.refCount--,n.refCount===0&&qj(Ij,function(){n.controller.abort()})}var eu=null,av=0,Nl=0,jl=null;function Vj(n,l){if(eu===null){var c=eu=[];av=0,Nl=sp(),jl={status:"pending",value:void 0,then:function(v){c.push(v)}}}return av++,l.then(tx,tx),l}function tx(){if(--av===0&&eu!==null){jl!==null&&(jl.status="fulfilled");var n=eu;eu=null,Nl=0,jl=null;for(var l=0;l<n.length;l++)(0,n[l])()}}function Fj(n,l){var c=[],v={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return n.then(function(){v.status="fulfilled",v.value=l;for(var b=0;b<c.length;b++)(0,c[b])(l)},function(b){for(v.status="rejected",v.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),v}var rx=_.S;_.S=function(n,l){Ub=Be(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&Vj(n,l),rx!==null&&rx(n,l)};var Ts=P(null);function nv(){var n=Ts.current;return n!==null?n:zt.pooledCache}function td(n,l){l===null?Z(Ts,Ts.current):Z(Ts,l.pool)}function ax(){var n=nv();return n===null?null:{parent:fr._currentValue,pool:n}}var Al=Error(a(460)),iv=Error(a(474)),rd=Error(a(542)),ad={then:function(){}};function nx(n){return n=n.status,n==="fulfilled"||n==="rejected"}function ix(n,l,c){switch(c=n[c],c===void 0?n.push(l):c!==l&&(l.then(jn,jn),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,lx(n),n;default:if(typeof l.status=="string")l.then(jn,jn);else{if(n=zt,n!==null&&100<n.shellSuspendCounter)throw Error(a(482));n=l,n.status="pending",n.then(function(v){if(l.status==="pending"){var b=l;b.status="fulfilled",b.value=v}},function(v){if(l.status==="pending"){var b=l;b.status="rejected",b.reason=v}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,lx(n),n}throw Ns=l,Al}}function Cs(n){try{var l=n._init;return l(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ns=c,Al):c}}var Ns=null;function sx(){if(Ns===null)throw Error(a(459));var n=Ns;return Ns=null,n}function lx(n){if(n===Al||n===rd)throw Error(a(483))}var Ml=null,tu=0;function nd(n){var l=tu;return tu+=1,Ml===null&&(Ml=[]),ix(Ml,n,l)}function ru(n,l){l=l.props.ref,n.ref=l!==void 0?l:null}function id(n,l){throw l.$$typeof===m?Error(a(525)):(n=Object.prototype.toString.call(l),Error(a(31,n==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":n)))}function ox(n){function l(ue,ne){if(n){var de=ue.deletions;de===null?(ue.deletions=[ne],ue.flags|=16):de.push(ne)}}function c(ue,ne){if(!n)return null;for(;ne!==null;)l(ue,ne),ne=ne.sibling;return null}function v(ue){for(var ne=new Map;ue!==null;)ue.key!==null?ne.set(ue.key,ue):ne.set(ue.index,ue),ue=ue.sibling;return ne}function b(ue,ne){return ue=Mn(ue,ne),ue.index=0,ue.sibling=null,ue}function S(ue,ne,de){return ue.index=de,n?(de=ue.alternate,de!==null?(de=de.index,de<ne?(ue.flags|=67108866,ne):de):(ue.flags|=67108866,ne)):(ue.flags|=1048576,ne)}function O(ue){return n&&ue.alternate===null&&(ue.flags|=67108866),ue}function H(ue,ne,de,Te){return ne===null||ne.tag!==6?(ne=$h(de,ue.mode,Te),ne.return=ue,ne):(ne=b(ne,de),ne.return=ue,ne)}function te(ue,ne,de,Te){var We=de.type;return We===E?be(ue,ne,de.props.children,Te,de.key):ne!==null&&(ne.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===k&&Cs(We)===ne.type)?(ne=b(ne,de.props),ru(ne,de),ne.return=ue,ne):(ne=Zc(de.type,de.key,de.props,null,ue.mode,Te),ru(ne,de),ne.return=ue,ne)}function fe(ue,ne,de,Te){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==de.containerInfo||ne.stateNode.implementation!==de.implementation?(ne=Yh(de,ue.mode,Te),ne.return=ue,ne):(ne=b(ne,de.children||[]),ne.return=ue,ne)}function be(ue,ne,de,Te,We){return ne===null||ne.tag!==7?(ne=bs(de,ue.mode,Te,We),ne.return=ue,ne):(ne=b(ne,de),ne.return=ue,ne)}function Ce(ue,ne,de){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=$h(""+ne,ue.mode,de),ne.return=ue,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case y:return de=Zc(ne.type,ne.key,ne.props,null,ue.mode,de),ru(de,ne),de.return=ue,de;case x:return ne=Yh(ne,ue.mode,de),ne.return=ue,ne;case k:return ne=Cs(ne),Ce(ue,ne,de)}if(Q(ne)||L(ne))return ne=bs(ne,ue.mode,de,null),ne.return=ue,ne;if(typeof ne.then=="function")return Ce(ue,nd(ne),de);if(ne.$$typeof===N)return Ce(ue,ed(ue,ne),de);id(ue,ne)}return null}function he(ue,ne,de,Te){var We=ne!==null?ne.key:null;if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return We!==null?null:H(ue,ne,""+de,Te);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case y:return de.key===We?te(ue,ne,de,Te):null;case x:return de.key===We?fe(ue,ne,de,Te):null;case k:return de=Cs(de),he(ue,ne,de,Te)}if(Q(de)||L(de))return We!==null?null:be(ue,ne,de,Te,null);if(typeof de.then=="function")return he(ue,ne,nd(de),Te);if(de.$$typeof===N)return he(ue,ne,ed(ue,de),Te);id(ue,de)}return null}function ge(ue,ne,de,Te,We){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return ue=ue.get(de)||null,H(ne,ue,""+Te,We);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case y:return ue=ue.get(Te.key===null?de:Te.key)||null,te(ne,ue,Te,We);case x:return ue=ue.get(Te.key===null?de:Te.key)||null,fe(ne,ue,Te,We);case k:return Te=Cs(Te),ge(ue,ne,de,Te,We)}if(Q(Te)||L(Te))return ue=ue.get(de)||null,be(ne,ue,Te,We,null);if(typeof Te.then=="function")return ge(ue,ne,de,nd(Te),We);if(Te.$$typeof===N)return ge(ue,ne,de,ed(ne,Te),We);id(ne,Te)}return null}function Fe(ue,ne,de,Te){for(var We=null,St=null,Ye=ne,ct=ne=0,gt=null;Ye!==null&&ct<de.length;ct++){Ye.index>ct?(gt=Ye,Ye=null):gt=Ye.sibling;var Et=he(ue,Ye,de[ct],Te);if(Et===null){Ye===null&&(Ye=gt);break}n&&Ye&&Et.alternate===null&&l(ue,Ye),ne=S(Et,ne,ct),St===null?We=Et:St.sibling=Et,St=Et,Ye=gt}if(ct===de.length)return c(ue,Ye),mt&&kn(ue,ct),We;if(Ye===null){for(;ct<de.length;ct++)Ye=Ce(ue,de[ct],Te),Ye!==null&&(ne=S(Ye,ne,ct),St===null?We=Ye:St.sibling=Ye,St=Ye);return mt&&kn(ue,ct),We}for(Ye=v(Ye);ct<de.length;ct++)gt=ge(Ye,ue,ct,de[ct],Te),gt!==null&&(n&&gt.alternate!==null&&Ye.delete(gt.key===null?ct:gt.key),ne=S(gt,ne,ct),St===null?We=gt:St.sibling=gt,St=gt);return n&&Ye.forEach(function(Di){return l(ue,Di)}),mt&&kn(ue,ct),We}function rt(ue,ne,de,Te){if(de==null)throw Error(a(151));for(var We=null,St=null,Ye=ne,ct=ne=0,gt=null,Et=de.next();Ye!==null&&!Et.done;ct++,Et=de.next()){Ye.index>ct?(gt=Ye,Ye=null):gt=Ye.sibling;var Di=he(ue,Ye,Et.value,Te);if(Di===null){Ye===null&&(Ye=gt);break}n&&Ye&&Di.alternate===null&&l(ue,Ye),ne=S(Di,ne,ct),St===null?We=Di:St.sibling=Di,St=Di,Ye=gt}if(Et.done)return c(ue,Ye),mt&&kn(ue,ct),We;if(Ye===null){for(;!Et.done;ct++,Et=de.next())Et=Ce(ue,Et.value,Te),Et!==null&&(ne=S(Et,ne,ct),St===null?We=Et:St.sibling=Et,St=Et);return mt&&kn(ue,ct),We}for(Ye=v(Ye);!Et.done;ct++,Et=de.next())Et=ge(Ye,ue,ct,Et.value,Te),Et!==null&&(n&&Et.alternate!==null&&Ye.delete(Et.key===null?ct:Et.key),ne=S(Et,ne,ct),St===null?We=Et:St.sibling=Et,St=Et);return n&&Ye.forEach(function(e4){return l(ue,e4)}),mt&&kn(ue,ct),We}function Lt(ue,ne,de,Te){if(typeof de=="object"&&de!==null&&de.type===E&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case y:e:{for(var We=de.key;ne!==null;){if(ne.key===We){if(We=de.type,We===E){if(ne.tag===7){c(ue,ne.sibling),Te=b(ne,de.props.children),Te.return=ue,ue=Te;break e}}else if(ne.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===k&&Cs(We)===ne.type){c(ue,ne.sibling),Te=b(ne,de.props),ru(Te,de),Te.return=ue,ue=Te;break e}c(ue,ne);break}else l(ue,ne);ne=ne.sibling}de.type===E?(Te=bs(de.props.children,ue.mode,Te,de.key),Te.return=ue,ue=Te):(Te=Zc(de.type,de.key,de.props,null,ue.mode,Te),ru(Te,de),Te.return=ue,ue=Te)}return O(ue);case x:e:{for(We=de.key;ne!==null;){if(ne.key===We)if(ne.tag===4&&ne.stateNode.containerInfo===de.containerInfo&&ne.stateNode.implementation===de.implementation){c(ue,ne.sibling),Te=b(ne,de.children||[]),Te.return=ue,ue=Te;break e}else{c(ue,ne);break}else l(ue,ne);ne=ne.sibling}Te=Yh(de,ue.mode,Te),Te.return=ue,ue=Te}return O(ue);case k:return de=Cs(de),Lt(ue,ne,de,Te)}if(Q(de))return Fe(ue,ne,de,Te);if(L(de)){if(We=L(de),typeof We!="function")throw Error(a(150));return de=We.call(de),rt(ue,ne,de,Te)}if(typeof de.then=="function")return Lt(ue,ne,nd(de),Te);if(de.$$typeof===N)return Lt(ue,ne,ed(ue,de),Te);id(ue,de)}return typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint"?(de=""+de,ne!==null&&ne.tag===6?(c(ue,ne.sibling),Te=b(ne,de),Te.return=ue,ue=Te):(c(ue,ne),Te=$h(de,ue.mode,Te),Te.return=ue,ue=Te),O(ue)):c(ue,ne)}return function(ue,ne,de,Te){try{tu=0;var We=Lt(ue,ne,de,Te);return Ml=null,We}catch(Ye){if(Ye===Al||Ye===rd)throw Ye;var St=Ea(29,Ye,null,ue.mode);return St.lanes=Te,St.return=ue,St}finally{}}}var js=ox(!0),ux=ox(!1),vi=!1;function sv(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lv(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function pi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function gi(n,l,c){var v=n.updateQueue;if(v===null)return null;if(v=v.shared,(Nt&2)!==0){var b=v.pending;return b===null?l.next=l:(l.next=b.next,b.next=l),v.pending=l,l=Xc(n),Qy(n,null,c),l}return Kc(n,v,l,c),Xc(n)}function au(n,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194048)!==0)){var v=l.lanes;v&=n.pendingLanes,c|=v,l.lanes=c,sr(n,c)}}function ov(n,l){var c=n.updateQueue,v=n.alternate;if(v!==null&&(v=v.updateQueue,c===v)){var b=null,S=null;if(c=c.firstBaseUpdate,c!==null){do{var O={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};S===null?b=S=O:S=S.next=O,c=c.next}while(c!==null);S===null?b=S=l:S=S.next=l}else b=S=l;c={baseState:v.baseState,firstBaseUpdate:b,lastBaseUpdate:S,shared:v.shared,callbacks:v.callbacks},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=l:n.next=l,c.lastBaseUpdate=l}var uv=!1;function nu(){if(uv){var n=jl;if(n!==null)throw n}}function iu(n,l,c,v){uv=!1;var b=n.updateQueue;vi=!1;var S=b.firstBaseUpdate,O=b.lastBaseUpdate,H=b.shared.pending;if(H!==null){b.shared.pending=null;var te=H,fe=te.next;te.next=null,O===null?S=fe:O.next=fe,O=te;var be=n.alternate;be!==null&&(be=be.updateQueue,H=be.lastBaseUpdate,H!==O&&(H===null?be.firstBaseUpdate=fe:H.next=fe,be.lastBaseUpdate=te))}if(S!==null){var Ce=b.baseState;O=0,be=fe=te=null,H=S;do{var he=H.lane&-536870913,ge=he!==H.lane;if(ge?(pt&he)===he:(v&he)===he){he!==0&&he===Nl&&(uv=!0),be!==null&&(be=be.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Fe=n,rt=H;he=l;var Lt=c;switch(rt.tag){case 1:if(Fe=rt.payload,typeof Fe=="function"){Ce=Fe.call(Lt,Ce,he);break e}Ce=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=rt.payload,he=typeof Fe=="function"?Fe.call(Lt,Ce,he):Fe,he==null)break e;Ce=p({},Ce,he);break e;case 2:vi=!0}}he=H.callback,he!==null&&(n.flags|=64,ge&&(n.flags|=8192),ge=b.callbacks,ge===null?b.callbacks=[he]:ge.push(he))}else ge={lane:he,tag:H.tag,payload:H.payload,callback:H.callback,next:null},be===null?(fe=be=ge,te=Ce):be=be.next=ge,O|=he;if(H=H.next,H===null){if(H=b.shared.pending,H===null)break;ge=H,H=ge.next,ge.next=null,b.lastBaseUpdate=ge,b.shared.pending=null}}while(!0);be===null&&(te=Ce),b.baseState=te,b.firstBaseUpdate=fe,b.lastBaseUpdate=be,S===null&&(b.shared.lanes=0),wi|=O,n.lanes=O,n.memoizedState=Ce}}function cx(n,l){if(typeof n!="function")throw Error(a(191,n));n.call(l)}function dx(n,l){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)cx(c[n],l)}var kl=P(null),sd=P(0);function fx(n,l){n=In,Z(sd,n),Z(kl,l),In=n|l.baseLanes}function cv(){Z(sd,In),Z(kl,kl.current)}function dv(){In=sd.current,G(kl),G(sd)}var Ta=P(null),Va=null;function mi(n){var l=n.alternate;Z(or,or.current&1),Z(Ta,n),Va===null&&(l===null||kl.current!==null||l.memoizedState!==null)&&(Va=n)}function fv(n){Z(or,or.current),Z(Ta,n),Va===null&&(Va=n)}function hx(n){n.tag===22?(Z(or,or.current),Z(Ta,n),Va===null&&(Va=n)):yi()}function yi(){Z(or,or.current),Z(Ta,Ta.current)}function Ca(n){G(Ta),Va===n&&(Va=null),G(or)}var or=P(0);function ld(n){for(var l=n;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||yp(c)||xp(c)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Rn=0,ot=null,Rt=null,hr=null,od=!1,Dl=!1,As=!1,ud=0,su=0,Ol=null,Hj=0;function er(){throw Error(a(321))}function hv(n,l){if(l===null)return!1;for(var c=0;c<l.length&&c<n.length;c++)if(!Sa(n[c],l[c]))return!1;return!0}function vv(n,l,c,v,b,S){return Rn=S,ot=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,_.H=n===null||n.memoizedState===null?Xx:Mv,As=!1,S=c(v,b),As=!1,Dl&&(S=px(l,c,v,b)),vx(n),S}function vx(n){_.H=uu;var l=Rt!==null&&Rt.next!==null;if(Rn=0,hr=Rt=ot=null,od=!1,su=0,Ol=null,l)throw Error(a(300));n===null||vr||(n=n.dependencies,n!==null&&Jc(n)&&(vr=!0))}function px(n,l,c,v){ot=n;var b=0;do{if(Dl&&(Ol=null),su=0,Dl=!1,25<=b)throw Error(a(301));if(b+=1,hr=Rt=null,n.updateQueue!=null){var S=n.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}_.H=Zx,S=l(c,v)}while(Dl);return S}function Gj(){var n=_.H,l=n.useState()[0];return l=typeof l.then=="function"?lu(l):l,n=n.useState()[0],(Rt!==null?Rt.memoizedState:null)!==n&&(ot.flags|=1024),l}function pv(){var n=ud!==0;return ud=0,n}function gv(n,l,c){l.updateQueue=n.updateQueue,l.flags&=-2053,n.lanes&=~c}function mv(n){if(od){for(n=n.memoizedState;n!==null;){var l=n.queue;l!==null&&(l.pending=null),n=n.next}od=!1}Rn=0,hr=Rt=ot=null,Dl=!1,su=ud=0,Ol=null}function Jr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hr===null?ot.memoizedState=hr=n:hr=hr.next=n,hr}function ur(){if(Rt===null){var n=ot.alternate;n=n!==null?n.memoizedState:null}else n=Rt.next;var l=hr===null?ot.memoizedState:hr.next;if(l!==null)hr=l,Rt=n;else{if(n===null)throw ot.alternate===null?Error(a(467)):Error(a(310));Rt=n,n={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},hr===null?ot.memoizedState=hr=n:hr=hr.next=n}return hr}function cd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lu(n){var l=su;return su+=1,Ol===null&&(Ol=[]),n=ix(Ol,n,l),l=ot,(hr===null?l.memoizedState:hr.next)===null&&(l=l.alternate,_.H=l===null||l.memoizedState===null?Xx:Mv),n}function dd(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return lu(n);if(n.$$typeof===N)return zr(n)}throw Error(a(438,String(n)))}function yv(n){var l=null,c=ot.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var v=ot.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(l={data:v.data.map(function(b){return b.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=cd(),ot.updateQueue=c),c.memoCache=l,c=l.data[l.index],c===void 0)for(c=l.data[l.index]=Array(n),v=0;v<n;v++)c[v]=z;return l.index++,c}function Bn(n,l){return typeof l=="function"?l(n):l}function fd(n){var l=ur();return xv(l,Rt,n)}function xv(n,l,c){var v=n.queue;if(v===null)throw Error(a(311));v.lastRenderedReducer=c;var b=n.baseQueue,S=v.pending;if(S!==null){if(b!==null){var O=b.next;b.next=S.next,S.next=O}l.baseQueue=b=S,v.pending=null}if(S=n.baseState,b===null)n.memoizedState=S;else{l=b.next;var H=O=null,te=null,fe=l,be=!1;do{var Ce=fe.lane&-536870913;if(Ce!==fe.lane?(pt&Ce)===Ce:(Rn&Ce)===Ce){var he=fe.revertLane;if(he===0)te!==null&&(te=te.next={lane:0,revertLane:0,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),Ce===Nl&&(be=!0);else if((Rn&he)===he){fe=fe.next,he===Nl&&(be=!0);continue}else Ce={lane:0,revertLane:fe.revertLane,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},te===null?(H=te=Ce,O=S):te=te.next=Ce,ot.lanes|=he,wi|=he;Ce=fe.action,As&&c(S,Ce),S=fe.hasEagerState?fe.eagerState:c(S,Ce)}else he={lane:Ce,revertLane:fe.revertLane,gesture:fe.gesture,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},te===null?(H=te=he,O=S):te=te.next=he,ot.lanes|=Ce,wi|=Ce;fe=fe.next}while(fe!==null&&fe!==l);if(te===null?O=S:te.next=H,!Sa(S,n.memoizedState)&&(vr=!0,be&&(c=jl,c!==null)))throw c;n.memoizedState=S,n.baseState=O,n.baseQueue=te,v.lastRenderedState=S}return b===null&&(v.lanes=0),[n.memoizedState,v.dispatch]}function bv(n){var l=ur(),c=l.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=n;var v=c.dispatch,b=c.pending,S=l.memoizedState;if(b!==null){c.pending=null;var O=b=b.next;do S=n(S,O.action),O=O.next;while(O!==b);Sa(S,l.memoizedState)||(vr=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),c.lastRenderedState=S}return[S,v]}function gx(n,l,c){var v=ot,b=ur(),S=mt;if(S){if(c===void 0)throw Error(a(407));c=c()}else c=l();var O=!Sa((Rt||b).memoizedState,c);if(O&&(b.memoizedState=c,vr=!0),b=b.queue,Ev(xx.bind(null,v,b,n),[n]),b.getSnapshot!==l||O||hr!==null&&hr.memoizedState.tag&1){if(v.flags|=2048,Rl(9,{destroy:void 0},yx.bind(null,v,b,c,l),null),zt===null)throw Error(a(349));S||(Rn&127)!==0||mx(v,l,c)}return c}function mx(n,l,c){n.flags|=16384,n={getSnapshot:l,value:c},l=ot.updateQueue,l===null?(l=cd(),ot.updateQueue=l,l.stores=[n]):(c=l.stores,c===null?l.stores=[n]:c.push(n))}function yx(n,l,c,v){l.value=c,l.getSnapshot=v,bx(l)&&wx(n)}function xx(n,l,c){return c(function(){bx(l)&&wx(n)})}function bx(n){var l=n.getSnapshot;n=n.value;try{var c=l();return!Sa(n,c)}catch{return!0}}function wx(n){var l=xs(n,2);l!==null&&ha(l,n,2)}function wv(n){var l=Jr();if(typeof n=="function"){var c=n;if(n=c(),As){pe(!0);try{c()}finally{pe(!1)}}}return l.memoizedState=l.baseState=n,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:n},l}function Sx(n,l,c,v){return n.baseState=c,xv(n,Rt,typeof v=="function"?v:Bn)}function Qj(n,l,c,v,b){if(pd(n))throw Error(a(485));if(n=l.action,n!==null){var S={payload:b,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){S.listeners.push(O)}};_.T!==null?c(!0):S.isTransition=!1,v(S),c=l.pending,c===null?(S.next=l.pending=S,Ex(l,S)):(S.next=c.next,l.pending=c.next=S)}}function Ex(n,l){var c=l.action,v=l.payload,b=n.state;if(l.isTransition){var S=_.T,O={};_.T=O;try{var H=c(b,v),te=_.S;te!==null&&te(O,H),Tx(n,l,H)}catch(fe){Sv(n,l,fe)}finally{S!==null&&O.types!==null&&(S.types=O.types),_.T=S}}else try{S=c(b,v),Tx(n,l,S)}catch(fe){Sv(n,l,fe)}}function Tx(n,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(v){Cx(n,l,v)},function(v){return Sv(n,l,v)}):Cx(n,l,c)}function Cx(n,l,c){l.status="fulfilled",l.value=c,Nx(l),n.state=c,l=n.pending,l!==null&&(c=l.next,c===l?n.pending=null:(c=c.next,l.next=c,Ex(n,c)))}function Sv(n,l,c){var v=n.pending;if(n.pending=null,v!==null){v=v.next;do l.status="rejected",l.reason=c,Nx(l),l=l.next;while(l!==v)}n.action=null}function Nx(n){n=n.listeners;for(var l=0;l<n.length;l++)(0,n[l])()}function jx(n,l){return l}function Ax(n,l){if(mt){var c=zt.formState;if(c!==null){e:{var v=ot;if(mt){if(It){t:{for(var b=It,S=Ia;b.nodeType!==8;){if(!S){b=null;break t}if(b=Fa(b.nextSibling),b===null){b=null;break t}}S=b.data,b=S==="F!"||S==="F"?b:null}if(b){It=Fa(b.nextSibling),v=b.data==="F!";break e}}fi(v)}v=!1}v&&(l=c[0])}}return c=Jr(),c.memoizedState=c.baseState=l,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jx,lastRenderedState:l},c.queue=v,c=$x.bind(null,ot,v),v.dispatch=c,v=wv(!1),S=Av.bind(null,ot,!1,v.queue),v=Jr(),b={state:l,dispatch:null,action:n,pending:null},v.queue=b,c=Qj.bind(null,ot,b,S,c),b.dispatch=c,v.memoizedState=n,[l,c,!1]}function Mx(n){var l=ur();return kx(l,Rt,n)}function kx(n,l,c){if(l=xv(n,l,jx)[0],n=fd(Bn)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var v=lu(l)}catch(O){throw O===Al?rd:O}else v=l;l=ur();var b=l.queue,S=b.dispatch;return c!==l.memoizedState&&(ot.flags|=2048,Rl(9,{destroy:void 0},$j.bind(null,b,c),null)),[v,S,n]}function $j(n,l){n.action=l}function Dx(n){var l=ur(),c=Rt;if(c!==null)return kx(l,c,n);ur(),l=l.memoizedState,c=ur();var v=c.queue.dispatch;return c.memoizedState=n,[l,v,!1]}function Rl(n,l,c,v){return n={tag:n,create:c,deps:v,inst:l,next:null},l=ot.updateQueue,l===null&&(l=cd(),ot.updateQueue=l),c=l.lastEffect,c===null?l.lastEffect=n.next=n:(v=c.next,c.next=n,n.next=v,l.lastEffect=n),n}function Ox(){return ur().memoizedState}function hd(n,l,c,v){var b=Jr();ot.flags|=n,b.memoizedState=Rl(1|l,{destroy:void 0},c,v===void 0?null:v)}function vd(n,l,c,v){var b=ur();v=v===void 0?null:v;var S=b.memoizedState.inst;Rt!==null&&v!==null&&hv(v,Rt.memoizedState.deps)?b.memoizedState=Rl(l,S,c,v):(ot.flags|=n,b.memoizedState=Rl(1|l,S,c,v))}function Rx(n,l){hd(8390656,8,n,l)}function Ev(n,l){vd(2048,8,n,l)}function Yj(n){ot.flags|=4;var l=ot.updateQueue;if(l===null)l=cd(),ot.updateQueue=l,l.events=[n];else{var c=l.events;c===null?l.events=[n]:c.push(n)}}function Bx(n){var l=ur().memoizedState;return Yj({ref:l,nextImpl:n}),function(){if((Nt&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}function Lx(n,l){return vd(4,2,n,l)}function Px(n,l){return vd(4,4,n,l)}function zx(n,l){if(typeof l=="function"){n=n();var c=l(n);return function(){typeof c=="function"?c():l(null)}}if(l!=null)return n=n(),l.current=n,function(){l.current=null}}function _x(n,l,c){c=c!=null?c.concat([n]):null,vd(4,4,zx.bind(null,l,n),c)}function Tv(){}function Ux(n,l){var c=ur();l=l===void 0?null:l;var v=c.memoizedState;return l!==null&&hv(l,v[1])?v[0]:(c.memoizedState=[n,l],n)}function qx(n,l){var c=ur();l=l===void 0?null:l;var v=c.memoizedState;if(l!==null&&hv(l,v[1]))return v[0];if(v=n(),As){pe(!0);try{n()}finally{pe(!1)}}return c.memoizedState=[v,l],v}function Cv(n,l,c){return c===void 0||(Rn&1073741824)!==0&&(pt&261930)===0?n.memoizedState=l:(n.memoizedState=c,n=Ib(),ot.lanes|=n,wi|=n,c)}function Ix(n,l,c,v){return Sa(c,l)?c:kl.current!==null?(n=Cv(n,c,v),Sa(n,l)||(vr=!0),n):(Rn&42)===0||(Rn&1073741824)!==0&&(pt&261930)===0?(vr=!0,n.memoizedState=c):(n=Ib(),ot.lanes|=n,wi|=n,l)}function Vx(n,l,c,v,b){var S=V.p;V.p=S!==0&&8>S?S:8;var O=_.T,H={};_.T=H,Av(n,!1,l,c);try{var te=b(),fe=_.S;if(fe!==null&&fe(H,te),te!==null&&typeof te=="object"&&typeof te.then=="function"){var be=Fj(te,v);ou(n,l,be,Aa(n))}else ou(n,l,v,Aa(n))}catch(Ce){ou(n,l,{then:function(){},status:"rejected",reason:Ce},Aa())}finally{V.p=S,O!==null&&H.types!==null&&(O.types=H.types),_.T=O}}function Kj(){}function Nv(n,l,c,v){if(n.tag!==5)throw Error(a(476));var b=Fx(n).queue;Vx(n,b,l,F,c===null?Kj:function(){return Hx(n),c(v)})}function Fx(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:F},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:c},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function Hx(n){var l=Fx(n);l.next===null&&(l=n.alternate.memoizedState),ou(n,l.next.queue,{},Aa())}function jv(){return zr(Cu)}function Gx(){return ur().memoizedState}function Qx(){return ur().memoizedState}function Xj(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var c=Aa();n=pi(c);var v=gi(l,n,c);v!==null&&(ha(v,l,c),au(v,l,c)),l={cache:rv()},n.payload=l;return}l=l.return}}function Zj(n,l,c){var v=Aa();c={lane:v,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},pd(n)?Yx(l,c):(c=Gh(n,l,c,v),c!==null&&(ha(c,n,v),Kx(c,l,v)))}function $x(n,l,c){var v=Aa();ou(n,l,c,v)}function ou(n,l,c,v){var b={lane:v,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(pd(n))Yx(l,b);else{var S=n.alternate;if(n.lanes===0&&(S===null||S.lanes===0)&&(S=l.lastRenderedReducer,S!==null))try{var O=l.lastRenderedState,H=S(O,c);if(b.hasEagerState=!0,b.eagerState=H,Sa(H,O))return Kc(n,l,b,0),zt===null&&Yc(),!1}catch{}finally{}if(c=Gh(n,l,b,v),c!==null)return ha(c,n,v),Kx(c,l,v),!0}return!1}function Av(n,l,c,v){if(v={lane:2,revertLane:sp(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},pd(n)){if(l)throw Error(a(479))}else l=Gh(n,c,v,2),l!==null&&ha(l,n,2)}function pd(n){var l=n.alternate;return n===ot||l!==null&&l===ot}function Yx(n,l){Dl=od=!0;var c=n.pending;c===null?l.next=l:(l.next=c.next,c.next=l),n.pending=l}function Kx(n,l,c){if((c&4194048)!==0){var v=l.lanes;v&=n.pendingLanes,c|=v,l.lanes=c,sr(n,c)}}var uu={readContext:zr,use:dd,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};uu.useEffectEvent=er;var Xx={readContext:zr,use:dd,useCallback:function(n,l){return Jr().memoizedState=[n,l===void 0?null:l],n},useContext:zr,useEffect:Rx,useImperativeHandle:function(n,l,c){c=c!=null?c.concat([n]):null,hd(4194308,4,zx.bind(null,l,n),c)},useLayoutEffect:function(n,l){return hd(4194308,4,n,l)},useInsertionEffect:function(n,l){hd(4,2,n,l)},useMemo:function(n,l){var c=Jr();l=l===void 0?null:l;var v=n();if(As){pe(!0);try{n()}finally{pe(!1)}}return c.memoizedState=[v,l],v},useReducer:function(n,l,c){var v=Jr();if(c!==void 0){var b=c(l);if(As){pe(!0);try{c(l)}finally{pe(!1)}}}else b=l;return v.memoizedState=v.baseState=b,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:b},v.queue=n,n=n.dispatch=Zj.bind(null,ot,n),[v.memoizedState,n]},useRef:function(n){var l=Jr();return n={current:n},l.memoizedState=n},useState:function(n){n=wv(n);var l=n.queue,c=$x.bind(null,ot,l);return l.dispatch=c,[n.memoizedState,c]},useDebugValue:Tv,useDeferredValue:function(n,l){var c=Jr();return Cv(c,n,l)},useTransition:function(){var n=wv(!1);return n=Vx.bind(null,ot,n.queue,!0,!1),Jr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,c){var v=ot,b=Jr();if(mt){if(c===void 0)throw Error(a(407));c=c()}else{if(c=l(),zt===null)throw Error(a(349));(pt&127)!==0||mx(v,l,c)}b.memoizedState=c;var S={value:c,getSnapshot:l};return b.queue=S,Rx(xx.bind(null,v,S,n),[n]),v.flags|=2048,Rl(9,{destroy:void 0},yx.bind(null,v,S,c,l),null),c},useId:function(){var n=Jr(),l=zt.identifierPrefix;if(mt){var c=fn,v=dn;c=(v&~(1<<32-ve(v)-1)).toString(32)+c,l="_"+l+"R_"+c,c=ud++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=Hj++,l="_"+l+"r_"+c.toString(32)+"_";return n.memoizedState=l},useHostTransitionStatus:jv,useFormState:Ax,useActionState:Ax,useOptimistic:function(n){var l=Jr();l.memoizedState=l.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=Av.bind(null,ot,!0,c),c.dispatch=l,[n,l]},useMemoCache:yv,useCacheRefresh:function(){return Jr().memoizedState=Xj.bind(null,ot)},useEffectEvent:function(n){var l=Jr(),c={impl:n};return l.memoizedState=c,function(){if((Nt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},Mv={readContext:zr,use:dd,useCallback:Ux,useContext:zr,useEffect:Ev,useImperativeHandle:_x,useInsertionEffect:Lx,useLayoutEffect:Px,useMemo:qx,useReducer:fd,useRef:Ox,useState:function(){return fd(Bn)},useDebugValue:Tv,useDeferredValue:function(n,l){var c=ur();return Ix(c,Rt.memoizedState,n,l)},useTransition:function(){var n=fd(Bn)[0],l=ur().memoizedState;return[typeof n=="boolean"?n:lu(n),l]},useSyncExternalStore:gx,useId:Gx,useHostTransitionStatus:jv,useFormState:Mx,useActionState:Mx,useOptimistic:function(n,l){var c=ur();return Sx(c,Rt,n,l)},useMemoCache:yv,useCacheRefresh:Qx};Mv.useEffectEvent=Bx;var Zx={readContext:zr,use:dd,useCallback:Ux,useContext:zr,useEffect:Ev,useImperativeHandle:_x,useInsertionEffect:Lx,useLayoutEffect:Px,useMemo:qx,useReducer:bv,useRef:Ox,useState:function(){return bv(Bn)},useDebugValue:Tv,useDeferredValue:function(n,l){var c=ur();return Rt===null?Cv(c,n,l):Ix(c,Rt.memoizedState,n,l)},useTransition:function(){var n=bv(Bn)[0],l=ur().memoizedState;return[typeof n=="boolean"?n:lu(n),l]},useSyncExternalStore:gx,useId:Gx,useHostTransitionStatus:jv,useFormState:Dx,useActionState:Dx,useOptimistic:function(n,l){var c=ur();return Rt!==null?Sx(c,Rt,n,l):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:yv,useCacheRefresh:Qx};Zx.useEffectEvent=Bx;function kv(n,l,c,v){l=n.memoizedState,c=c(v,l),c=c==null?l:p({},l,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var Dv={enqueueSetState:function(n,l,c){n=n._reactInternals;var v=Aa(),b=pi(v);b.payload=l,c!=null&&(b.callback=c),l=gi(n,b,v),l!==null&&(ha(l,n,v),au(l,n,v))},enqueueReplaceState:function(n,l,c){n=n._reactInternals;var v=Aa(),b=pi(v);b.tag=1,b.payload=l,c!=null&&(b.callback=c),l=gi(n,b,v),l!==null&&(ha(l,n,v),au(l,n,v))},enqueueForceUpdate:function(n,l){n=n._reactInternals;var c=Aa(),v=pi(c);v.tag=2,l!=null&&(v.callback=l),l=gi(n,v,c),l!==null&&(ha(l,n,c),au(l,n,c))}};function Wx(n,l,c,v,b,S,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(v,S,O):l.prototype&&l.prototype.isPureReactComponent?!Ko(c,v)||!Ko(b,S):!0}function Jx(n,l,c,v){n=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,v),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,v),l.state!==n&&Dv.enqueueReplaceState(l,l.state,null)}function Ms(n,l){var c=l;if("ref"in l){c={};for(var v in l)v!=="ref"&&(c[v]=l[v])}if(n=n.defaultProps){c===l&&(c=p({},c));for(var b in n)c[b]===void 0&&(c[b]=n[b])}return c}function eb(n){$c(n)}function tb(n){console.error(n)}function rb(n){$c(n)}function gd(n,l){try{var c=n.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(v){setTimeout(function(){throw v})}}function ab(n,l,c){try{var v=n.onCaughtError;v(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Ov(n,l,c){return c=pi(c),c.tag=3,c.payload={element:null},c.callback=function(){gd(n,l)},c}function nb(n){return n=pi(n),n.tag=3,n}function ib(n,l,c,v){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var S=v.value;n.payload=function(){return b(S)},n.callback=function(){ab(l,c,v)}}var O=c.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){ab(l,c,v),typeof b!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var H=v.stack;this.componentDidCatch(v.value,{componentStack:H!==null?H:""})})}function Wj(n,l,c,v,b){if(c.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(l=c.alternate,l!==null&&Cl(l,c,b,!0),c=Ta.current,c!==null){switch(c.tag){case 31:case 13:return Va===null?Ad():c.alternate===null&&tr===0&&(tr=3),c.flags&=-257,c.flags|=65536,c.lanes=b,v===ad?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([v]):l.add(v),ap(n,v,b)),!1;case 22:return c.flags|=65536,v===ad?c.flags|=16384:(l=c.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([v])},c.updateQueue=l):(c=l.retryQueue,c===null?l.retryQueue=new Set([v]):c.add(v)),ap(n,v,b)),!1}throw Error(a(435,c.tag))}return ap(n,v,b),Ad(),!1}if(mt)return l=Ta.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=b,v!==Zh&&(n=Error(a(422),{cause:v}),Wo(_a(n,c)))):(v!==Zh&&(l=Error(a(423),{cause:v}),Wo(_a(l,c))),n=n.current.alternate,n.flags|=65536,b&=-b,n.lanes|=b,v=_a(v,c),b=Ov(n.stateNode,v,b),ov(n,b),tr!==4&&(tr=2)),!1;var S=Error(a(520),{cause:v});if(S=_a(S,c),mu===null?mu=[S]:mu.push(S),tr!==4&&(tr=2),l===null)return!0;v=_a(v,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,n=b&-b,c.lanes|=n,n=Ov(c.stateNode,v,n),ov(c,n),!1;case 1:if(l=c.type,S=c.stateNode,(c.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Si===null||!Si.has(S))))return c.flags|=65536,b&=-b,c.lanes|=b,b=nb(b),ib(b,n,c,v),ov(c,b),!1}c=c.return}while(c!==null);return!1}var Rv=Error(a(461)),vr=!1;function _r(n,l,c,v){l.child=n===null?ux(l,null,c,v):js(l,n.child,c,v)}function sb(n,l,c,v,b){c=c.render;var S=l.ref;if("ref"in v){var O={};for(var H in v)H!=="ref"&&(O[H]=v[H])}else O=v;return Es(l),v=vv(n,l,c,O,S,b),H=pv(),n!==null&&!vr?(gv(n,l,b),Ln(n,l,b)):(mt&&H&&Kh(l),l.flags|=1,_r(n,l,v,b),l.child)}function lb(n,l,c,v,b){if(n===null){var S=c.type;return typeof S=="function"&&!Qh(S)&&S.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=S,ob(n,l,S,v,b)):(n=Zc(c.type,null,v,l,l.mode,b),n.ref=l.ref,n.return=l,l.child=n)}if(S=n.child,!Iv(n,b)){var O=S.memoizedProps;if(c=c.compare,c=c!==null?c:Ko,c(O,v)&&n.ref===l.ref)return Ln(n,l,b)}return l.flags|=1,n=Mn(S,v),n.ref=l.ref,n.return=l,l.child=n}function ob(n,l,c,v,b){if(n!==null){var S=n.memoizedProps;if(Ko(S,v)&&n.ref===l.ref)if(vr=!1,l.pendingProps=v=S,Iv(n,b))(n.flags&131072)!==0&&(vr=!0);else return l.lanes=n.lanes,Ln(n,l,b)}return Bv(n,l,c,v,b)}function ub(n,l,c,v){var b=v.children,S=n!==null?n.memoizedState:null;if(n===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.mode==="hidden"){if((l.flags&128)!==0){if(S=S!==null?S.baseLanes|c:c,n!==null){for(v=l.child=n.child,b=0;v!==null;)b=b|v.lanes|v.childLanes,v=v.sibling;v=b&~S}else v=0,l.child=null;return cb(n,l,S,c,v)}if((c&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},n!==null&&td(l,S!==null?S.cachePool:null),S!==null?fx(l,S):cv(),hx(l);else return v=l.lanes=536870912,cb(n,l,S!==null?S.baseLanes|c:c,c,v)}else S!==null?(td(l,S.cachePool),fx(l,S),yi(),l.memoizedState=null):(n!==null&&td(l,null),cv(),yi());return _r(n,l,b,c),l.child}function cu(n,l){return n!==null&&n.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function cb(n,l,c,v,b){var S=nv();return S=S===null?null:{parent:fr._currentValue,pool:S},l.memoizedState={baseLanes:c,cachePool:S},n!==null&&td(l,null),cv(),hx(l),n!==null&&Cl(n,l,v,!0),l.childLanes=b,null}function md(n,l){return l=xd({mode:l.mode,children:l.children},n.mode),l.ref=n.ref,n.child=l,l.return=n,l}function db(n,l,c){return js(l,n.child,null,c),n=md(l,l.pendingProps),n.flags|=2,Ca(l),l.memoizedState=null,n}function Jj(n,l,c){var v=l.pendingProps,b=(l.flags&128)!==0;if(l.flags&=-129,n===null){if(mt){if(v.mode==="hidden")return n=md(l,v),l.lanes=536870912,cu(null,n);if(fv(l),(n=It)?(n=E1(n,Ia),n=n!==null&&n.data==="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:ci!==null?{id:dn,overflow:fn}:null,retryLane:536870912,hydrationErrors:null},c=Yy(n),c.return=l,l.child=c,Pr=l,It=null)):n=null,n===null)throw fi(l);return l.lanes=536870912,null}return md(l,v)}var S=n.memoizedState;if(S!==null){var O=S.dehydrated;if(fv(l),b)if(l.flags&256)l.flags&=-257,l=db(n,l,c);else if(l.memoizedState!==null)l.child=n.child,l.flags|=128,l=null;else throw Error(a(558));else if(vr||Cl(n,l,c,!1),b=(c&n.childLanes)!==0,vr||b){if(v=zt,v!==null&&(O=Jt(v,c),O!==0&&O!==S.retryLane))throw S.retryLane=O,xs(n,O),ha(v,n,O),Rv;Ad(),l=db(n,l,c)}else n=S.treeContext,It=Fa(O.nextSibling),Pr=l,mt=!0,di=null,Ia=!1,n!==null&&Zy(l,n),l=md(l,v),l.flags|=4096;return l}return n=Mn(n.child,{mode:v.mode,children:v.children}),n.ref=l.ref,l.child=n,n.return=l,n}function yd(n,l){var c=l.ref;if(c===null)n!==null&&n.ref!==null&&(l.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(n===null||n.ref!==c)&&(l.flags|=4194816)}}function Bv(n,l,c,v,b){return Es(l),c=vv(n,l,c,v,void 0,b),v=pv(),n!==null&&!vr?(gv(n,l,b),Ln(n,l,b)):(mt&&v&&Kh(l),l.flags|=1,_r(n,l,c,b),l.child)}function fb(n,l,c,v,b,S){return Es(l),l.updateQueue=null,c=px(l,v,c,b),vx(n),v=pv(),n!==null&&!vr?(gv(n,l,S),Ln(n,l,S)):(mt&&v&&Kh(l),l.flags|=1,_r(n,l,c,S),l.child)}function hb(n,l,c,v,b){if(Es(l),l.stateNode===null){var S=wl,O=c.contextType;typeof O=="object"&&O!==null&&(S=zr(O)),S=new c(v,S),l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Dv,l.stateNode=S,S._reactInternals=l,S=l.stateNode,S.props=v,S.state=l.memoizedState,S.refs={},sv(l),O=c.contextType,S.context=typeof O=="object"&&O!==null?zr(O):wl,S.state=l.memoizedState,O=c.getDerivedStateFromProps,typeof O=="function"&&(kv(l,c,O,v),S.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(O=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),O!==S.state&&Dv.enqueueReplaceState(S,S.state,null),iu(l,v,S,b),nu(),S.state=l.memoizedState),typeof S.componentDidMount=="function"&&(l.flags|=4194308),v=!0}else if(n===null){S=l.stateNode;var H=l.memoizedProps,te=Ms(c,H);S.props=te;var fe=S.context,be=c.contextType;O=wl,typeof be=="object"&&be!==null&&(O=zr(be));var Ce=c.getDerivedStateFromProps;be=typeof Ce=="function"||typeof S.getSnapshotBeforeUpdate=="function",H=l.pendingProps!==H,be||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(H||fe!==O)&&Jx(l,S,v,O),vi=!1;var he=l.memoizedState;S.state=he,iu(l,v,S,b),nu(),fe=l.memoizedState,H||he!==fe||vi?(typeof Ce=="function"&&(kv(l,c,Ce,v),fe=l.memoizedState),(te=vi||Wx(l,c,te,v,he,fe,O))?(be||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(l.flags|=4194308)):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=v,l.memoizedState=fe),S.props=v,S.state=fe,S.context=O,v=te):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),v=!1)}else{S=l.stateNode,lv(n,l),O=l.memoizedProps,be=Ms(c,O),S.props=be,Ce=l.pendingProps,he=S.context,fe=c.contextType,te=wl,typeof fe=="object"&&fe!==null&&(te=zr(fe)),H=c.getDerivedStateFromProps,(fe=typeof H=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(O!==Ce||he!==te)&&Jx(l,S,v,te),vi=!1,he=l.memoizedState,S.state=he,iu(l,v,S,b),nu();var ge=l.memoizedState;O!==Ce||he!==ge||vi||n!==null&&n.dependencies!==null&&Jc(n.dependencies)?(typeof H=="function"&&(kv(l,c,H,v),ge=l.memoizedState),(be=vi||Wx(l,c,be,v,he,ge,te)||n!==null&&n.dependencies!==null&&Jc(n.dependencies))?(fe||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(v,ge,te),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(v,ge,te)),typeof S.componentDidUpdate=="function"&&(l.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof S.componentDidUpdate!="function"||O===n.memoizedProps&&he===n.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&he===n.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=ge),S.props=v,S.state=ge,S.context=te,v=be):(typeof S.componentDidUpdate!="function"||O===n.memoizedProps&&he===n.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&he===n.memoizedState||(l.flags|=1024),v=!1)}return S=v,yd(n,l),v=(l.flags&128)!==0,S||v?(S=l.stateNode,c=v&&typeof c.getDerivedStateFromError!="function"?null:S.render(),l.flags|=1,n!==null&&v?(l.child=js(l,n.child,null,b),l.child=js(l,null,c,b)):_r(n,l,c,b),l.memoizedState=S.state,n=l.child):n=Ln(n,l,b),n}function vb(n,l,c,v){return ws(),l.flags|=256,_r(n,l,c,v),l.child}var Lv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pv(n){return{baseLanes:n,cachePool:ax()}}function zv(n,l,c){return n=n!==null?n.childLanes&~c:0,l&&(n|=ja),n}function pb(n,l,c){var v=l.pendingProps,b=!1,S=(l.flags&128)!==0,O;if((O=S)||(O=n!==null&&n.memoizedState===null?!1:(or.current&2)!==0),O&&(b=!0,l.flags&=-129),O=(l.flags&32)!==0,l.flags&=-33,n===null){if(mt){if(b?mi(l):yi(),(n=It)?(n=E1(n,Ia),n=n!==null&&n.data!=="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:ci!==null?{id:dn,overflow:fn}:null,retryLane:536870912,hydrationErrors:null},c=Yy(n),c.return=l,l.child=c,Pr=l,It=null)):n=null,n===null)throw fi(l);return xp(n)?l.lanes=32:l.lanes=536870912,null}var H=v.children;return v=v.fallback,b?(yi(),b=l.mode,H=xd({mode:"hidden",children:H},b),v=bs(v,b,c,null),H.return=l,v.return=l,H.sibling=v,l.child=H,v=l.child,v.memoizedState=Pv(c),v.childLanes=zv(n,O,c),l.memoizedState=Lv,cu(null,v)):(mi(l),_v(l,H))}var te=n.memoizedState;if(te!==null&&(H=te.dehydrated,H!==null)){if(S)l.flags&256?(mi(l),l.flags&=-257,l=Uv(n,l,c)):l.memoizedState!==null?(yi(),l.child=n.child,l.flags|=128,l=null):(yi(),H=v.fallback,b=l.mode,v=xd({mode:"visible",children:v.children},b),H=bs(H,b,c,null),H.flags|=2,v.return=l,H.return=l,v.sibling=H,l.child=v,js(l,n.child,null,c),v=l.child,v.memoizedState=Pv(c),v.childLanes=zv(n,O,c),l.memoizedState=Lv,l=cu(null,v));else if(mi(l),xp(H)){if(O=H.nextSibling&&H.nextSibling.dataset,O)var fe=O.dgst;O=fe,v=Error(a(419)),v.stack="",v.digest=O,Wo({value:v,source:null,stack:null}),l=Uv(n,l,c)}else if(vr||Cl(n,l,c,!1),O=(c&n.childLanes)!==0,vr||O){if(O=zt,O!==null&&(v=Jt(O,c),v!==0&&v!==te.retryLane))throw te.retryLane=v,xs(n,v),ha(O,n,v),Rv;yp(H)||Ad(),l=Uv(n,l,c)}else yp(H)?(l.flags|=192,l.child=n.child,l=null):(n=te.treeContext,It=Fa(H.nextSibling),Pr=l,mt=!0,di=null,Ia=!1,n!==null&&Zy(l,n),l=_v(l,v.children),l.flags|=4096);return l}return b?(yi(),H=v.fallback,b=l.mode,te=n.child,fe=te.sibling,v=Mn(te,{mode:"hidden",children:v.children}),v.subtreeFlags=te.subtreeFlags&65011712,fe!==null?H=Mn(fe,H):(H=bs(H,b,c,null),H.flags|=2),H.return=l,v.return=l,v.sibling=H,l.child=v,cu(null,v),v=l.child,H=n.child.memoizedState,H===null?H=Pv(c):(b=H.cachePool,b!==null?(te=fr._currentValue,b=b.parent!==te?{parent:te,pool:te}:b):b=ax(),H={baseLanes:H.baseLanes|c,cachePool:b}),v.memoizedState=H,v.childLanes=zv(n,O,c),l.memoizedState=Lv,cu(n.child,v)):(mi(l),c=n.child,n=c.sibling,c=Mn(c,{mode:"visible",children:v.children}),c.return=l,c.sibling=null,n!==null&&(O=l.deletions,O===null?(l.deletions=[n],l.flags|=16):O.push(n)),l.child=c,l.memoizedState=null,c)}function _v(n,l){return l=xd({mode:"visible",children:l},n.mode),l.return=n,n.child=l}function xd(n,l){return n=Ea(22,n,null,l),n.lanes=0,n}function Uv(n,l,c){return js(l,n.child,null,c),n=_v(l,l.pendingProps.children),n.flags|=2,l.memoizedState=null,n}function gb(n,l,c){n.lanes|=l;var v=n.alternate;v!==null&&(v.lanes|=l),ev(n.return,l,c)}function qv(n,l,c,v,b,S){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:c,tailMode:b,treeForkCount:S}:(O.isBackwards=l,O.rendering=null,O.renderingStartTime=0,O.last=v,O.tail=c,O.tailMode=b,O.treeForkCount=S)}function mb(n,l,c){var v=l.pendingProps,b=v.revealOrder,S=v.tail;v=v.children;var O=or.current,H=(O&2)!==0;if(H?(O=O&1|2,l.flags|=128):O&=1,Z(or,O),_r(n,l,v,c),v=mt?Zo:0,!H&&n!==null&&(n.flags&128)!==0)e:for(n=l.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&gb(n,c,l);else if(n.tag===19)gb(n,c,l);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===l)break e;for(;n.sibling===null;){if(n.return===null||n.return===l)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(b){case"forwards":for(c=l.child,b=null;c!==null;)n=c.alternate,n!==null&&ld(n)===null&&(b=c),c=c.sibling;c=b,c===null?(b=l.child,l.child=null):(b=c.sibling,c.sibling=null),qv(l,!1,b,c,S,v);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=l.child,l.child=null;b!==null;){if(n=b.alternate,n!==null&&ld(n)===null){l.child=b;break}n=b.sibling,b.sibling=c,c=b,b=n}qv(l,!0,c,null,S,v);break;case"together":qv(l,!1,null,null,void 0,v);break;default:l.memoizedState=null}return l.child}function Ln(n,l,c){if(n!==null&&(l.dependencies=n.dependencies),wi|=l.lanes,(c&l.childLanes)===0)if(n!==null){if(Cl(n,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(n!==null&&l.child!==n.child)throw Error(a(153));if(l.child!==null){for(n=l.child,c=Mn(n,n.pendingProps),l.child=c,c.return=l;n.sibling!==null;)n=n.sibling,c=c.sibling=Mn(n,n.pendingProps),c.return=l;c.sibling=null}return l.child}function Iv(n,l){return(n.lanes&l)!==0?!0:(n=n.dependencies,!!(n!==null&&Jc(n)))}function e5(n,l,c){switch(l.tag){case 3:me(l,l.stateNode.containerInfo),hi(l,fr,n.memoizedState.cache),ws();break;case 27:case 5:ae(l);break;case 4:me(l,l.stateNode.containerInfo);break;case 10:hi(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,fv(l),null;break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(mi(l),l.flags|=128,null):(c&l.child.childLanes)!==0?pb(n,l,c):(mi(l),n=Ln(n,l,c),n!==null?n.sibling:null);mi(l);break;case 19:var b=(n.flags&128)!==0;if(v=(c&l.childLanes)!==0,v||(Cl(n,l,c,!1),v=(c&l.childLanes)!==0),b){if(v)return mb(n,l,c);l.flags|=128}if(b=l.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),Z(or,or.current),v)break;return null;case 22:return l.lanes=0,ub(n,l,c,l.pendingProps);case 24:hi(l,fr,n.memoizedState.cache)}return Ln(n,l,c)}function yb(n,l,c){if(n!==null)if(n.memoizedProps!==l.pendingProps)vr=!0;else{if(!Iv(n,c)&&(l.flags&128)===0)return vr=!1,e5(n,l,c);vr=(n.flags&131072)!==0}else vr=!1,mt&&(l.flags&1048576)!==0&&Xy(l,Zo,l.index);switch(l.lanes=0,l.tag){case 16:e:{var v=l.pendingProps;if(n=Cs(l.elementType),l.type=n,typeof n=="function")Qh(n)?(v=Ms(n,v),l.tag=1,l=hb(null,l,n,v,c)):(l.tag=0,l=Bv(null,l,n,v,c));else{if(n!=null){var b=n.$$typeof;if(b===A){l.tag=11,l=sb(null,l,n,v,c);break e}else if(b===j){l.tag=14,l=lb(null,l,n,v,c);break e}}throw l=I(n)||n,Error(a(306,l,""))}}return l;case 0:return Bv(n,l,l.type,l.pendingProps,c);case 1:return v=l.type,b=Ms(v,l.pendingProps),hb(n,l,v,b,c);case 3:e:{if(me(l,l.stateNode.containerInfo),n===null)throw Error(a(387));v=l.pendingProps;var S=l.memoizedState;b=S.element,lv(n,l),iu(l,v,null,c);var O=l.memoizedState;if(v=O.cache,hi(l,fr,v),v!==S.cache&&tv(l,[fr],c,!0),nu(),v=O.element,S.isDehydrated)if(S={element:v,isDehydrated:!1,cache:O.cache},l.updateQueue.baseState=S,l.memoizedState=S,l.flags&256){l=vb(n,l,v,c);break e}else if(v!==b){b=_a(Error(a(424)),l),Wo(b),l=vb(n,l,v,c);break e}else{switch(n=l.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(It=Fa(n.firstChild),Pr=l,mt=!0,di=null,Ia=!0,c=ux(l,null,v,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ws(),v===b){l=Ln(n,l,c);break e}_r(n,l,v,c)}l=l.child}return l;case 26:return yd(n,l),n===null?(c=M1(l.type,null,l.pendingProps,null))?l.memoizedState=c:mt||(c=l.type,n=l.pendingProps,v=Ld(Y.current).createElement(c),v[Ht]=l,v[xr]=n,Ur(v,c,n),dr(v),l.stateNode=v):l.memoizedState=M1(l.type,n.memoizedProps,l.pendingProps,n.memoizedState),null;case 27:return ae(l),n===null&&mt&&(v=l.stateNode=N1(l.type,l.pendingProps,Y.current),Pr=l,Ia=!0,b=It,Ni(l.type)?(bp=b,It=Fa(v.firstChild)):It=b),_r(n,l,l.pendingProps.children,c),yd(n,l),n===null&&(l.flags|=4194304),l.child;case 5:return n===null&&mt&&((b=v=It)&&(v=k5(v,l.type,l.pendingProps,Ia),v!==null?(l.stateNode=v,Pr=l,It=Fa(v.firstChild),Ia=!1,b=!0):b=!1),b||fi(l)),ae(l),b=l.type,S=l.pendingProps,O=n!==null?n.memoizedProps:null,v=S.children,pp(b,S)?v=null:O!==null&&pp(b,O)&&(l.flags|=32),l.memoizedState!==null&&(b=vv(n,l,Gj,null,null,c),Cu._currentValue=b),yd(n,l),_r(n,l,v,c),l.child;case 6:return n===null&&mt&&((n=c=It)&&(c=D5(c,l.pendingProps,Ia),c!==null?(l.stateNode=c,Pr=l,It=null,n=!0):n=!1),n||fi(l)),null;case 13:return pb(n,l,c);case 4:return me(l,l.stateNode.containerInfo),v=l.pendingProps,n===null?l.child=js(l,null,v,c):_r(n,l,v,c),l.child;case 11:return sb(n,l,l.type,l.pendingProps,c);case 7:return _r(n,l,l.pendingProps,c),l.child;case 8:return _r(n,l,l.pendingProps.children,c),l.child;case 12:return _r(n,l,l.pendingProps.children,c),l.child;case 10:return v=l.pendingProps,hi(l,l.type,v.value),_r(n,l,v.children,c),l.child;case 9:return b=l.type._context,v=l.pendingProps.children,Es(l),b=zr(b),v=v(b),l.flags|=1,_r(n,l,v,c),l.child;case 14:return lb(n,l,l.type,l.pendingProps,c);case 15:return ob(n,l,l.type,l.pendingProps,c);case 19:return mb(n,l,c);case 31:return Jj(n,l,c);case 22:return ub(n,l,c,l.pendingProps);case 24:return Es(l),v=zr(fr),n===null?(b=nv(),b===null&&(b=zt,S=rv(),b.pooledCache=S,S.refCount++,S!==null&&(b.pooledCacheLanes|=c),b=S),l.memoizedState={parent:v,cache:b},sv(l),hi(l,fr,b)):((n.lanes&c)!==0&&(lv(n,l),iu(l,null,null,c),nu()),b=n.memoizedState,S=l.memoizedState,b.parent!==v?(b={parent:v,cache:v},l.memoizedState=b,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=b),hi(l,fr,v)):(v=S.cache,hi(l,fr,v),v!==b.cache&&tv(l,[fr],c,!0))),_r(n,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(a(156,l.tag))}function Pn(n){n.flags|=4}function Vv(n,l,c,v,b){if((l=(n.mode&32)!==0)&&(l=!1),l){if(n.flags|=16777216,(b&335544128)===b)if(n.stateNode.complete)n.flags|=8192;else if(Gb())n.flags|=8192;else throw Ns=ad,iv}else n.flags&=-16777217}function xb(n,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!B1(l))if(Gb())n.flags|=8192;else throw Ns=ad,iv}function bd(n,l){l!==null&&(n.flags|=4),n.flags&16384&&(l=n.tag!==22?ut():536870912,n.lanes|=l,zl|=l)}function du(n,l){if(!mt)switch(n.tailMode){case"hidden":l=n.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var v=null;c!==null;)c.alternate!==null&&(v=c),c=c.sibling;v===null?l||n.tail===null?n.tail=null:n.tail.sibling=null:v.sibling=null}}function Vt(n){var l=n.alternate!==null&&n.alternate.child===n.child,c=0,v=0;if(l)for(var b=n.child;b!==null;)c|=b.lanes|b.childLanes,v|=b.subtreeFlags&65011712,v|=b.flags&65011712,b.return=n,b=b.sibling;else for(b=n.child;b!==null;)c|=b.lanes|b.childLanes,v|=b.subtreeFlags,v|=b.flags,b.return=n,b=b.sibling;return n.subtreeFlags|=v,n.childLanes=c,l}function t5(n,l,c){var v=l.pendingProps;switch(Xh(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(l),null;case 1:return Vt(l),null;case 3:return c=l.stateNode,v=null,n!==null&&(v=n.memoizedState.cache),l.memoizedState.cache!==v&&(l.flags|=2048),On(fr),oe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(Tl(l)?Pn(l):n===null||n.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Wh())),Vt(l),null;case 26:var b=l.type,S=l.memoizedState;return n===null?(Pn(l),S!==null?(Vt(l),xb(l,S)):(Vt(l),Vv(l,b,null,v,c))):S?S!==n.memoizedState?(Pn(l),Vt(l),xb(l,S)):(Vt(l),l.flags&=-16777217):(n=n.memoizedProps,n!==v&&Pn(l),Vt(l),Vv(l,b,n,v,c)),null;case 27:if(re(l),c=Y.current,b=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==v&&Pn(l);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Vt(l),null}n=J.current,Tl(l)?Wy(l):(n=N1(b,v,c),l.stateNode=n,Pn(l))}return Vt(l),null;case 5:if(re(l),b=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==v&&Pn(l);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Vt(l),null}if(S=J.current,Tl(l))Wy(l);else{var O=Ld(Y.current);switch(S){case 1:S=O.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:S=O.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":S=O.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":S=O.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":S=O.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof v.is=="string"?O.createElement("select",{is:v.is}):O.createElement("select"),v.multiple?S.multiple=!0:v.size&&(S.size=v.size);break;default:S=typeof v.is=="string"?O.createElement(b,{is:v.is}):O.createElement(b)}}S[Ht]=l,S[xr]=v;e:for(O=l.child;O!==null;){if(O.tag===5||O.tag===6)S.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===l)break e;for(;O.sibling===null;){if(O.return===null||O.return===l)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}l.stateNode=S;e:switch(Ur(S,b,v),b){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Pn(l)}}return Vt(l),Vv(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,c),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==v&&Pn(l);else{if(typeof v!="string"&&l.stateNode===null)throw Error(a(166));if(n=Y.current,Tl(l)){if(n=l.stateNode,c=l.memoizedProps,v=null,b=Pr,b!==null)switch(b.tag){case 27:case 5:v=b.memoizedProps}n[Ht]=l,n=!!(n.nodeValue===c||v!==null&&v.suppressHydrationWarning===!0||p1(n.nodeValue,c)),n||fi(l,!0)}else n=Ld(n).createTextNode(v),n[Ht]=l,l.stateNode=n}return Vt(l),null;case 31:if(c=l.memoizedState,n===null||n.memoizedState!==null){if(v=Tl(l),c!==null){if(n===null){if(!v)throw Error(a(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(557));n[Ht]=l}else ws(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vt(l),n=!1}else c=Wh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return l.flags&256?(Ca(l),l):(Ca(l),null);if((l.flags&128)!==0)throw Error(a(558))}return Vt(l),null;case 13:if(v=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(b=Tl(l),v!==null&&v.dehydrated!==null){if(n===null){if(!b)throw Error(a(318));if(b=l.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(a(317));b[Ht]=l}else ws(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vt(l),b=!1}else b=Wh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=b),b=!0;if(!b)return l.flags&256?(Ca(l),l):(Ca(l),null)}return Ca(l),(l.flags&128)!==0?(l.lanes=c,l):(c=v!==null,n=n!==null&&n.memoizedState!==null,c&&(v=l.child,b=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(b=v.alternate.memoizedState.cachePool.pool),S=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(S=v.memoizedState.cachePool.pool),S!==b&&(v.flags|=2048)),c!==n&&c&&(l.child.flags|=8192),bd(l,l.updateQueue),Vt(l),null);case 4:return oe(),n===null&&cp(l.stateNode.containerInfo),Vt(l),null;case 10:return On(l.type),Vt(l),null;case 19:if(G(or),v=l.memoizedState,v===null)return Vt(l),null;if(b=(l.flags&128)!==0,S=v.rendering,S===null)if(b)du(v,!1);else{if(tr!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(S=ld(n),S!==null){for(l.flags|=128,du(v,!1),n=S.updateQueue,l.updateQueue=n,bd(l,n),l.subtreeFlags=0,n=c,c=l.child;c!==null;)$y(c,n),c=c.sibling;return Z(or,or.current&1|2),mt&&kn(l,v.treeForkCount),l.child}n=n.sibling}v.tail!==null&&Be()>Cd&&(l.flags|=128,b=!0,du(v,!1),l.lanes=4194304)}else{if(!b)if(n=ld(S),n!==null){if(l.flags|=128,b=!0,n=n.updateQueue,l.updateQueue=n,bd(l,n),du(v,!0),v.tail===null&&v.tailMode==="hidden"&&!S.alternate&&!mt)return Vt(l),null}else 2*Be()-v.renderingStartTime>Cd&&c!==536870912&&(l.flags|=128,b=!0,du(v,!1),l.lanes=4194304);v.isBackwards?(S.sibling=l.child,l.child=S):(n=v.last,n!==null?n.sibling=S:l.child=S,v.last=S)}return v.tail!==null?(n=v.tail,v.rendering=n,v.tail=n.sibling,v.renderingStartTime=Be(),n.sibling=null,c=or.current,Z(or,b?c&1|2:c&1),mt&&kn(l,v.treeForkCount),n):(Vt(l),null);case 22:case 23:return Ca(l),dv(),v=l.memoizedState!==null,n!==null?n.memoizedState!==null!==v&&(l.flags|=8192):v&&(l.flags|=8192),v?(c&536870912)!==0&&(l.flags&128)===0&&(Vt(l),l.subtreeFlags&6&&(l.flags|=8192)):Vt(l),c=l.updateQueue,c!==null&&bd(l,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),v=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(v=l.memoizedState.cachePool.pool),v!==c&&(l.flags|=2048),n!==null&&G(Ts),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),On(fr),Vt(l),null;case 25:return null;case 30:return null}throw Error(a(156,l.tag))}function r5(n,l){switch(Xh(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return On(fr),oe(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return re(l),null;case 31:if(l.memoizedState!==null){if(Ca(l),l.alternate===null)throw Error(a(340));ws()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Ca(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(a(340));ws()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return G(or),null;case 4:return oe(),null;case 10:return On(l.type),null;case 22:case 23:return Ca(l),dv(),n!==null&&G(Ts),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return On(fr),null;case 25:return null;default:return null}}function bb(n,l){switch(Xh(l),l.tag){case 3:On(fr),oe();break;case 26:case 27:case 5:re(l);break;case 4:oe();break;case 31:l.memoizedState!==null&&Ca(l);break;case 13:Ca(l);break;case 19:G(or);break;case 10:On(l.type);break;case 22:case 23:Ca(l),dv(),n!==null&&G(Ts);break;case 24:On(fr)}}function fu(n,l){try{var c=l.updateQueue,v=c!==null?c.lastEffect:null;if(v!==null){var b=v.next;c=b;do{if((c.tag&n)===n){v=void 0;var S=c.create,O=c.inst;v=S(),O.destroy=v}c=c.next}while(c!==b)}}catch(H){Dt(l,l.return,H)}}function xi(n,l,c){try{var v=l.updateQueue,b=v!==null?v.lastEffect:null;if(b!==null){var S=b.next;v=S;do{if((v.tag&n)===n){var O=v.inst,H=O.destroy;if(H!==void 0){O.destroy=void 0,b=l;var te=c,fe=H;try{fe()}catch(be){Dt(b,te,be)}}}v=v.next}while(v!==S)}}catch(be){Dt(l,l.return,be)}}function wb(n){var l=n.updateQueue;if(l!==null){var c=n.stateNode;try{dx(l,c)}catch(v){Dt(n,n.return,v)}}}function Sb(n,l,c){c.props=Ms(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(v){Dt(n,l,v)}}function hu(n,l){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var v=n.stateNode;break;case 30:v=n.stateNode;break;default:v=n.stateNode}typeof c=="function"?n.refCleanup=c(v):c.current=v}}catch(b){Dt(n,l,b)}}function hn(n,l){var c=n.ref,v=n.refCleanup;if(c!==null)if(typeof v=="function")try{v()}catch(b){Dt(n,l,b)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){Dt(n,l,b)}else c.current=null}function Eb(n){var l=n.type,c=n.memoizedProps,v=n.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":c.autoFocus&&v.focus();break e;case"img":c.src?v.src=c.src:c.srcSet&&(v.srcset=c.srcSet)}}catch(b){Dt(n,n.return,b)}}function Fv(n,l,c){try{var v=n.stateNode;T5(v,n.type,c,l),v[xr]=l}catch(b){Dt(n,n.return,b)}}function Tb(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ni(n.type)||n.tag===4}function Hv(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Tb(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Ni(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Gv(n,l,c){var v=n.tag;if(v===5||v===6)n=n.stateNode,l?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,l):(l=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,l.appendChild(n),c=c._reactRootContainer,c!=null||l.onclick!==null||(l.onclick=jn));else if(v!==4&&(v===27&&Ni(n.type)&&(c=n.stateNode,l=null),n=n.child,n!==null))for(Gv(n,l,c),n=n.sibling;n!==null;)Gv(n,l,c),n=n.sibling}function wd(n,l,c){var v=n.tag;if(v===5||v===6)n=n.stateNode,l?c.insertBefore(n,l):c.appendChild(n);else if(v!==4&&(v===27&&Ni(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(wd(n,l,c),n=n.sibling;n!==null;)wd(n,l,c),n=n.sibling}function Cb(n){var l=n.stateNode,c=n.memoizedProps;try{for(var v=n.type,b=l.attributes;b.length;)l.removeAttributeNode(b[0]);Ur(l,v,c),l[Ht]=n,l[xr]=c}catch(S){Dt(n,n.return,S)}}var zn=!1,pr=!1,Qv=!1,Nb=typeof WeakSet=="function"?WeakSet:Set,kr=null;function a5(n,l){if(n=n.containerInfo,hp=Vd,n=_y(n),Uh(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var v=c.getSelection&&c.getSelection();if(v&&v.rangeCount!==0){c=v.anchorNode;var b=v.anchorOffset,S=v.focusNode;v=v.focusOffset;try{c.nodeType,S.nodeType}catch{c=null;break e}var O=0,H=-1,te=-1,fe=0,be=0,Ce=n,he=null;t:for(;;){for(var ge;Ce!==c||b!==0&&Ce.nodeType!==3||(H=O+b),Ce!==S||v!==0&&Ce.nodeType!==3||(te=O+v),Ce.nodeType===3&&(O+=Ce.nodeValue.length),(ge=Ce.firstChild)!==null;)he=Ce,Ce=ge;for(;;){if(Ce===n)break t;if(he===c&&++fe===b&&(H=O),he===S&&++be===v&&(te=O),(ge=Ce.nextSibling)!==null)break;Ce=he,he=Ce.parentNode}Ce=ge}c=H===-1||te===-1?null:{start:H,end:te}}else c=null}c=c||{start:0,end:0}}else c=null;for(vp={focusedElem:n,selectionRange:c},Vd=!1,kr=l;kr!==null;)if(l=kr,n=l.child,(l.subtreeFlags&1028)!==0&&n!==null)n.return=l,kr=n;else for(;kr!==null;){switch(l=kr,S=l.alternate,n=l.flags,l.tag){case 0:if((n&4)!==0&&(n=l.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)b=n[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&S!==null){n=void 0,c=l,b=S.memoizedProps,S=S.memoizedState,v=c.stateNode;try{var Fe=Ms(c.type,b);n=v.getSnapshotBeforeUpdate(Fe,S),v.__reactInternalSnapshotBeforeUpdate=n}catch(rt){Dt(c,c.return,rt)}}break;case 3:if((n&1024)!==0){if(n=l.stateNode.containerInfo,c=n.nodeType,c===9)mp(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":mp(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(a(163))}if(n=l.sibling,n!==null){n.return=l.return,kr=n;break}kr=l.return}}function jb(n,l,c){var v=c.flags;switch(c.tag){case 0:case 11:case 15:Un(n,c),v&4&&fu(5,c);break;case 1:if(Un(n,c),v&4)if(n=c.stateNode,l===null)try{n.componentDidMount()}catch(O){Dt(c,c.return,O)}else{var b=Ms(c.type,l.memoizedProps);l=l.memoizedState;try{n.componentDidUpdate(b,l,n.__reactInternalSnapshotBeforeUpdate)}catch(O){Dt(c,c.return,O)}}v&64&&wb(c),v&512&&hu(c,c.return);break;case 3:if(Un(n,c),v&64&&(n=c.updateQueue,n!==null)){if(l=null,c.child!==null)switch(c.child.tag){case 27:case 5:l=c.child.stateNode;break;case 1:l=c.child.stateNode}try{dx(n,l)}catch(O){Dt(c,c.return,O)}}break;case 27:l===null&&v&4&&Cb(c);case 26:case 5:Un(n,c),l===null&&v&4&&Eb(c),v&512&&hu(c,c.return);break;case 12:Un(n,c);break;case 31:Un(n,c),v&4&&kb(n,c);break;case 13:Un(n,c),v&4&&Db(n,c),v&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=f5.bind(null,c),O5(n,c))));break;case 22:if(v=c.memoizedState!==null||zn,!v){l=l!==null&&l.memoizedState!==null||pr,b=zn;var S=pr;zn=v,(pr=l)&&!S?qn(n,c,(c.subtreeFlags&8772)!==0):Un(n,c),zn=b,pr=S}break;case 30:break;default:Un(n,c)}}function Ab(n){var l=n.alternate;l!==null&&(n.alternate=null,Ab(l)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(l=n.stateNode,l!==null&&dl(l)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Gt=null,ua=!1;function _n(n,l,c){for(c=c.child;c!==null;)Mb(n,l,c),c=c.sibling}function Mb(n,l,c){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount($,c)}catch{}switch(c.tag){case 26:pr||hn(c,l),_n(n,l,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:pr||hn(c,l);var v=Gt,b=ua;Ni(c.type)&&(Gt=c.stateNode,ua=!1),_n(n,l,c),Su(c.stateNode),Gt=v,ua=b;break;case 5:pr||hn(c,l);case 6:if(v=Gt,b=ua,Gt=null,_n(n,l,c),Gt=v,ua=b,Gt!==null)if(ua)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(c.stateNode)}catch(S){Dt(c,l,S)}else try{Gt.removeChild(c.stateNode)}catch(S){Dt(c,l,S)}break;case 18:Gt!==null&&(ua?(n=Gt,w1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),Gl(n)):w1(Gt,c.stateNode));break;case 4:v=Gt,b=ua,Gt=c.stateNode.containerInfo,ua=!0,_n(n,l,c),Gt=v,ua=b;break;case 0:case 11:case 14:case 15:xi(2,c,l),pr||xi(4,c,l),_n(n,l,c);break;case 1:pr||(hn(c,l),v=c.stateNode,typeof v.componentWillUnmount=="function"&&Sb(c,l,v)),_n(n,l,c);break;case 21:_n(n,l,c);break;case 22:pr=(v=pr)||c.memoizedState!==null,_n(n,l,c),pr=v;break;default:_n(n,l,c)}}function kb(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Gl(n)}catch(c){Dt(l,l.return,c)}}}function Db(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Gl(n)}catch(c){Dt(l,l.return,c)}}function n5(n){switch(n.tag){case 31:case 13:case 19:var l=n.stateNode;return l===null&&(l=n.stateNode=new Nb),l;case 22:return n=n.stateNode,l=n._retryCache,l===null&&(l=n._retryCache=new Nb),l;default:throw Error(a(435,n.tag))}}function Sd(n,l){var c=n5(n);l.forEach(function(v){if(!c.has(v)){c.add(v);var b=h5.bind(null,n,v);v.then(b,b)}})}function ca(n,l){var c=l.deletions;if(c!==null)for(var v=0;v<c.length;v++){var b=c[v],S=n,O=l,H=O;e:for(;H!==null;){switch(H.tag){case 27:if(Ni(H.type)){Gt=H.stateNode,ua=!1;break e}break;case 5:Gt=H.stateNode,ua=!1;break e;case 3:case 4:Gt=H.stateNode.containerInfo,ua=!0;break e}H=H.return}if(Gt===null)throw Error(a(160));Mb(S,O,b),Gt=null,ua=!1,S=b.alternate,S!==null&&(S.return=null),b.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)Ob(l,n),l=l.sibling}var Wa=null;function Ob(n,l){var c=n.alternate,v=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ca(l,n),da(n),v&4&&(xi(3,n,n.return),fu(3,n),xi(5,n,n.return));break;case 1:ca(l,n),da(n),v&512&&(pr||c===null||hn(c,c.return)),v&64&&zn&&(n=n.updateQueue,n!==null&&(v=n.callbacks,v!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?v:c.concat(v))));break;case 26:var b=Wa;if(ca(l,n),da(n),v&512&&(pr||c===null||hn(c,c.return)),v&4){var S=c!==null?c.memoizedState:null;if(v=n.memoizedState,c===null)if(v===null)if(n.stateNode===null){e:{v=n.type,c=n.memoizedProps,b=b.ownerDocument||b;t:switch(v){case"title":S=b.getElementsByTagName("title")[0],(!S||S[Ar]||S[Ht]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=b.createElement(v),b.head.insertBefore(S,b.querySelector("head > title"))),Ur(S,v,c),S[Ht]=n,dr(S),v=S;break e;case"link":var O=O1("link","href",b).get(v+(c.href||""));if(O){for(var H=0;H<O.length;H++)if(S=O[H],S.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&S.getAttribute("rel")===(c.rel==null?null:c.rel)&&S.getAttribute("title")===(c.title==null?null:c.title)&&S.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){O.splice(H,1);break t}}S=b.createElement(v),Ur(S,v,c),b.head.appendChild(S);break;case"meta":if(O=O1("meta","content",b).get(v+(c.content||""))){for(H=0;H<O.length;H++)if(S=O[H],S.getAttribute("content")===(c.content==null?null:""+c.content)&&S.getAttribute("name")===(c.name==null?null:c.name)&&S.getAttribute("property")===(c.property==null?null:c.property)&&S.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&S.getAttribute("charset")===(c.charSet==null?null:c.charSet)){O.splice(H,1);break t}}S=b.createElement(v),Ur(S,v,c),b.head.appendChild(S);break;default:throw Error(a(468,v))}S[Ht]=n,dr(S),v=S}n.stateNode=v}else R1(b,n.type,n.stateNode);else n.stateNode=D1(b,v,n.memoizedProps);else S!==v?(S===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):S.count--,v===null?R1(b,n.type,n.stateNode):D1(b,v,n.memoizedProps)):v===null&&n.stateNode!==null&&Fv(n,n.memoizedProps,c.memoizedProps)}break;case 27:ca(l,n),da(n),v&512&&(pr||c===null||hn(c,c.return)),c!==null&&v&4&&Fv(n,n.memoizedProps,c.memoizedProps);break;case 5:if(ca(l,n),da(n),v&512&&(pr||c===null||hn(c,c.return)),n.flags&32){b=n.stateNode;try{vl(b,"")}catch(Fe){Dt(n,n.return,Fe)}}v&4&&n.stateNode!=null&&(b=n.memoizedProps,Fv(n,b,c!==null?c.memoizedProps:b)),v&1024&&(Qv=!0);break;case 6:if(ca(l,n),da(n),v&4){if(n.stateNode===null)throw Error(a(162));v=n.memoizedProps,c=n.stateNode;try{c.nodeValue=v}catch(Fe){Dt(n,n.return,Fe)}}break;case 3:if(_d=null,b=Wa,Wa=Pd(l.containerInfo),ca(l,n),Wa=b,da(n),v&4&&c!==null&&c.memoizedState.isDehydrated)try{Gl(l.containerInfo)}catch(Fe){Dt(n,n.return,Fe)}Qv&&(Qv=!1,Rb(n));break;case 4:v=Wa,Wa=Pd(n.stateNode.containerInfo),ca(l,n),da(n),Wa=v;break;case 12:ca(l,n),da(n);break;case 31:ca(l,n),da(n),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,Sd(n,v)));break;case 13:ca(l,n),da(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Td=Be()),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,Sd(n,v)));break;case 22:b=n.memoizedState!==null;var te=c!==null&&c.memoizedState!==null,fe=zn,be=pr;if(zn=fe||b,pr=be||te,ca(l,n),pr=be,zn=fe,da(n),v&8192)e:for(l=n.stateNode,l._visibility=b?l._visibility&-2:l._visibility|1,b&&(c===null||te||zn||pr||ks(n)),c=null,l=n;;){if(l.tag===5||l.tag===26){if(c===null){te=c=l;try{if(S=te.stateNode,b)O=S.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{H=te.stateNode;var Ce=te.memoizedProps.style,he=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;H.style.display=he==null||typeof he=="boolean"?"":(""+he).trim()}}catch(Fe){Dt(te,te.return,Fe)}}}else if(l.tag===6){if(c===null){te=l;try{te.stateNode.nodeValue=b?"":te.memoizedProps}catch(Fe){Dt(te,te.return,Fe)}}}else if(l.tag===18){if(c===null){te=l;try{var ge=te.stateNode;b?S1(ge,!0):S1(te.stateNode,!1)}catch(Fe){Dt(te,te.return,Fe)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===n)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break e;for(;l.sibling===null;){if(l.return===null||l.return===n)break e;c===l&&(c=null),l=l.return}c===l&&(c=null),l.sibling.return=l.return,l=l.sibling}v&4&&(v=n.updateQueue,v!==null&&(c=v.retryQueue,c!==null&&(v.retryQueue=null,Sd(n,c))));break;case 19:ca(l,n),da(n),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,Sd(n,v)));break;case 30:break;case 21:break;default:ca(l,n),da(n)}}function da(n){var l=n.flags;if(l&2){try{for(var c,v=n.return;v!==null;){if(Tb(v)){c=v;break}v=v.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var b=c.stateNode,S=Hv(n);wd(n,S,b);break;case 5:var O=c.stateNode;c.flags&32&&(vl(O,""),c.flags&=-33);var H=Hv(n);wd(n,H,O);break;case 3:case 4:var te=c.stateNode.containerInfo,fe=Hv(n);Gv(n,fe,te);break;default:throw Error(a(161))}}catch(be){Dt(n,n.return,be)}n.flags&=-3}l&4096&&(n.flags&=-4097)}function Rb(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var l=n;Rb(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),n=n.sibling}}function Un(n,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)jb(n,l.alternate,l),l=l.sibling}function ks(n){for(n=n.child;n!==null;){var l=n;switch(l.tag){case 0:case 11:case 14:case 15:xi(4,l,l.return),ks(l);break;case 1:hn(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&Sb(l,l.return,c),ks(l);break;case 27:Su(l.stateNode);case 26:case 5:hn(l,l.return),ks(l);break;case 22:l.memoizedState===null&&ks(l);break;case 30:ks(l);break;default:ks(l)}n=n.sibling}}function qn(n,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var v=l.alternate,b=n,S=l,O=S.flags;switch(S.tag){case 0:case 11:case 15:qn(b,S,c),fu(4,S);break;case 1:if(qn(b,S,c),v=S,b=v.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(fe){Dt(v,v.return,fe)}if(v=S,b=v.updateQueue,b!==null){var H=v.stateNode;try{var te=b.shared.hiddenCallbacks;if(te!==null)for(b.shared.hiddenCallbacks=null,b=0;b<te.length;b++)cx(te[b],H)}catch(fe){Dt(v,v.return,fe)}}c&&O&64&&wb(S),hu(S,S.return);break;case 27:Cb(S);case 26:case 5:qn(b,S,c),c&&v===null&&O&4&&Eb(S),hu(S,S.return);break;case 12:qn(b,S,c);break;case 31:qn(b,S,c),c&&O&4&&kb(b,S);break;case 13:qn(b,S,c),c&&O&4&&Db(b,S);break;case 22:S.memoizedState===null&&qn(b,S,c),hu(S,S.return);break;case 30:break;default:qn(b,S,c)}l=l.sibling}}function $v(n,l){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(n=l.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&Jo(c))}function Yv(n,l){n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&Jo(n))}function Ja(n,l,c,v){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Bb(n,l,c,v),l=l.sibling}function Bb(n,l,c,v){var b=l.flags;switch(l.tag){case 0:case 11:case 15:Ja(n,l,c,v),b&2048&&fu(9,l);break;case 1:Ja(n,l,c,v);break;case 3:Ja(n,l,c,v),b&2048&&(n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&Jo(n)));break;case 12:if(b&2048){Ja(n,l,c,v),n=l.stateNode;try{var S=l.memoizedProps,O=S.id,H=S.onPostCommit;typeof H=="function"&&H(O,l.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(te){Dt(l,l.return,te)}}else Ja(n,l,c,v);break;case 31:Ja(n,l,c,v);break;case 13:Ja(n,l,c,v);break;case 23:break;case 22:S=l.stateNode,O=l.alternate,l.memoizedState!==null?S._visibility&2?Ja(n,l,c,v):vu(n,l):S._visibility&2?Ja(n,l,c,v):(S._visibility|=2,Bl(n,l,c,v,(l.subtreeFlags&10256)!==0||!1)),b&2048&&$v(O,l);break;case 24:Ja(n,l,c,v),b&2048&&Yv(l.alternate,l);break;default:Ja(n,l,c,v)}}function Bl(n,l,c,v,b){for(b=b&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var S=n,O=l,H=c,te=v,fe=O.flags;switch(O.tag){case 0:case 11:case 15:Bl(S,O,H,te,b),fu(8,O);break;case 23:break;case 22:var be=O.stateNode;O.memoizedState!==null?be._visibility&2?Bl(S,O,H,te,b):vu(S,O):(be._visibility|=2,Bl(S,O,H,te,b)),b&&fe&2048&&$v(O.alternate,O);break;case 24:Bl(S,O,H,te,b),b&&fe&2048&&Yv(O.alternate,O);break;default:Bl(S,O,H,te,b)}l=l.sibling}}function vu(n,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=n,v=l,b=v.flags;switch(v.tag){case 22:vu(c,v),b&2048&&$v(v.alternate,v);break;case 24:vu(c,v),b&2048&&Yv(v.alternate,v);break;default:vu(c,v)}l=l.sibling}}var pu=8192;function Ll(n,l,c){if(n.subtreeFlags&pu)for(n=n.child;n!==null;)Lb(n,l,c),n=n.sibling}function Lb(n,l,c){switch(n.tag){case 26:Ll(n,l,c),n.flags&pu&&n.memoizedState!==null&&H5(c,Wa,n.memoizedState,n.memoizedProps);break;case 5:Ll(n,l,c);break;case 3:case 4:var v=Wa;Wa=Pd(n.stateNode.containerInfo),Ll(n,l,c),Wa=v;break;case 22:n.memoizedState===null&&(v=n.alternate,v!==null&&v.memoizedState!==null?(v=pu,pu=16777216,Ll(n,l,c),pu=v):Ll(n,l,c));break;default:Ll(n,l,c)}}function Pb(n){var l=n.alternate;if(l!==null&&(n=l.child,n!==null)){l.child=null;do l=n.sibling,n.sibling=null,n=l;while(n!==null)}}function gu(n){var l=n.deletions;if((n.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var v=l[c];kr=v,_b(v,n)}Pb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)zb(n),n=n.sibling}function zb(n){switch(n.tag){case 0:case 11:case 15:gu(n),n.flags&2048&&xi(9,n,n.return);break;case 3:gu(n);break;case 12:gu(n);break;case 22:var l=n.stateNode;n.memoizedState!==null&&l._visibility&2&&(n.return===null||n.return.tag!==13)?(l._visibility&=-3,Ed(n)):gu(n);break;default:gu(n)}}function Ed(n){var l=n.deletions;if((n.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var v=l[c];kr=v,_b(v,n)}Pb(n)}for(n=n.child;n!==null;){switch(l=n,l.tag){case 0:case 11:case 15:xi(8,l,l.return),Ed(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,Ed(l));break;default:Ed(l)}n=n.sibling}}function _b(n,l){for(;kr!==null;){var c=kr;switch(c.tag){case 0:case 11:case 15:xi(8,c,l);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var v=c.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:Jo(c.memoizedState.cache)}if(v=c.child,v!==null)v.return=c,kr=v;else e:for(c=n;kr!==null;){v=kr;var b=v.sibling,S=v.return;if(Ab(v),v===c){kr=null;break e}if(b!==null){b.return=S,kr=b;break e}kr=S}}}var i5={getCacheForType:function(n){var l=zr(fr),c=l.data.get(n);return c===void 0&&(c=n(),l.data.set(n,c)),c},cacheSignal:function(){return zr(fr).controller.signal}},s5=typeof WeakMap=="function"?WeakMap:Map,Nt=0,zt=null,ht=null,pt=0,kt=0,Na=null,bi=!1,Pl=!1,Kv=!1,In=0,tr=0,wi=0,Ds=0,Xv=0,ja=0,zl=0,mu=null,fa=null,Zv=!1,Td=0,Ub=0,Cd=1/0,Nd=null,Si=null,br=0,Ei=null,_l=null,Vn=0,Wv=0,Jv=null,qb=null,yu=0,ep=null;function Aa(){return(Nt&2)!==0&&pt!==0?pt&-pt:_.T!==null?sp():Xt()}function Ib(){if(ja===0)if((pt&536870912)===0||mt){var n=_e;_e<<=1,(_e&3932160)===0&&(_e=262144),ja=n}else ja=536870912;return n=Ta.current,n!==null&&(n.flags|=32),ja}function ha(n,l,c){(n===zt&&(kt===2||kt===9)||n.cancelPendingCommit!==null)&&(Ul(n,0),Ti(n,pt,ja,!1)),Ot(n,c),((Nt&2)===0||n!==zt)&&(n===zt&&((Nt&2)===0&&(Ds|=c),tr===4&&Ti(n,pt,ja,!1)),vn(n))}function Vb(n,l,c){if((Nt&6)!==0)throw Error(a(327));var v=!c&&(l&127)===0&&(l&n.expiredLanes)===0||Ve(n,l),b=v?u5(n,l):rp(n,l,!0),S=v;do{if(b===0){Pl&&!v&&Ti(n,l,0,!1);break}else{if(c=n.current.alternate,S&&!l5(c)){b=rp(n,l,!1),S=!1;continue}if(b===2){if(S=l,n.errorRecoveryDisabledLanes&S)var O=0;else O=n.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){l=O;e:{var H=n;b=mu;var te=H.current.memoizedState.isDehydrated;if(te&&(Ul(H,O).flags|=256),O=rp(H,O,!1),O!==2){if(Kv&&!te){H.errorRecoveryDisabledLanes|=S,Ds|=S,b=4;break e}S=fa,fa=b,S!==null&&(fa===null?fa=S:fa.push.apply(fa,S))}b=O}if(S=!1,b!==2)continue}}if(b===1){Ul(n,0),Ti(n,l,0,!0);break}e:{switch(v=n,S=b,S){case 0:case 1:throw Error(a(345));case 4:if((l&4194048)!==l)break;case 6:Ti(v,l,ja,!bi);break e;case 2:fa=null;break;case 3:case 5:break;default:throw Error(a(329))}if((l&62914560)===l&&(b=Td+300-Be(),10<b)){if(Ti(v,l,ja,!bi),st(v,0,!0)!==0)break e;Vn=l,v.timeoutHandle=x1(Fb.bind(null,v,c,fa,Nd,Zv,l,ja,Ds,zl,bi,S,"Throttled",-0,0),b);break e}Fb(v,c,fa,Nd,Zv,l,ja,Ds,zl,bi,S,null,-0,0)}}break}while(!0);vn(n)}function Fb(n,l,c,v,b,S,O,H,te,fe,be,Ce,he,ge){if(n.timeoutHandle=-1,Ce=l.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:jn},Lb(l,S,Ce);var Fe=(S&62914560)===S?Td-Be():(S&4194048)===S?Ub-Be():0;if(Fe=G5(Ce,Fe),Fe!==null){Vn=S,n.cancelPendingCommit=Fe(Zb.bind(null,n,l,S,c,v,b,O,H,te,be,Ce,null,he,ge)),Ti(n,S,O,!fe);return}}Zb(n,l,S,c,v,b,O,H,te)}function l5(n){for(var l=n;;){var c=l.tag;if((c===0||c===11||c===15)&&l.flags&16384&&(c=l.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var v=0;v<c.length;v++){var b=c[v],S=b.getSnapshot;b=b.value;try{if(!Sa(S(),b))return!1}catch{return!1}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ti(n,l,c,v){l&=~Xv,l&=~Ds,n.suspendedLanes|=l,n.pingedLanes&=~l,v&&(n.warmLanes|=l),v=n.expirationTimes;for(var b=l;0<b;){var S=31-ve(b),O=1<<S;v[S]=-1,b&=~O}c!==0&&Kt(n,c,l)}function jd(){return(Nt&6)===0?(xu(0),!1):!0}function tp(){if(ht!==null){if(kt===0)var n=ht.return;else n=ht,Dn=Ss=null,mv(n),Ml=null,tu=0,n=ht;for(;n!==null;)bb(n.alternate,n),n=n.return;ht=null}}function Ul(n,l){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,j5(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),Vn=0,tp(),zt=n,ht=c=Mn(n.current,null),pt=l,kt=0,Na=null,bi=!1,Pl=Ve(n,l),Kv=!1,zl=ja=Xv=Ds=wi=tr=0,fa=mu=null,Zv=!1,(l&8)!==0&&(l|=l&32);var v=n.entangledLanes;if(v!==0)for(n=n.entanglements,v&=l;0<v;){var b=31-ve(v),S=1<<b;l|=n[b],v&=~S}return In=l,Yc(),c}function Hb(n,l){ot=null,_.H=uu,l===Al||l===rd?(l=sx(),kt=3):l===iv?(l=sx(),kt=4):kt=l===Rv?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Na=l,ht===null&&(tr=1,gd(n,_a(l,n.current)))}function Gb(){var n=Ta.current;return n===null?!0:(pt&4194048)===pt?Va===null:(pt&62914560)===pt||(pt&536870912)!==0?n===Va:!1}function Qb(){var n=_.H;return _.H=uu,n===null?uu:n}function $b(){var n=_.A;return _.A=i5,n}function Ad(){tr=4,bi||(pt&4194048)!==pt&&Ta.current!==null||(Pl=!0),(wi&134217727)===0&&(Ds&134217727)===0||zt===null||Ti(zt,pt,ja,!1)}function rp(n,l,c){var v=Nt;Nt|=2;var b=Qb(),S=$b();(zt!==n||pt!==l)&&(Nd=null,Ul(n,l)),l=!1;var O=tr;e:do try{if(kt!==0&&ht!==null){var H=ht,te=Na;switch(kt){case 8:tp(),O=6;break e;case 3:case 2:case 9:case 6:Ta.current===null&&(l=!0);var fe=kt;if(kt=0,Na=null,ql(n,H,te,fe),c&&Pl){O=0;break e}break;default:fe=kt,kt=0,Na=null,ql(n,H,te,fe)}}o5(),O=tr;break}catch(be){Hb(n,be)}while(!0);return l&&n.shellSuspendCounter++,Dn=Ss=null,Nt=v,_.H=b,_.A=S,ht===null&&(zt=null,pt=0,Yc()),O}function o5(){for(;ht!==null;)Yb(ht)}function u5(n,l){var c=Nt;Nt|=2;var v=Qb(),b=$b();zt!==n||pt!==l?(Nd=null,Cd=Be()+500,Ul(n,l)):Pl=Ve(n,l);e:do try{if(kt!==0&&ht!==null){l=ht;var S=Na;t:switch(kt){case 1:kt=0,Na=null,ql(n,l,S,1);break;case 2:case 9:if(nx(S)){kt=0,Na=null,Kb(l);break}l=function(){kt!==2&&kt!==9||zt!==n||(kt=7),vn(n)},S.then(l,l);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:nx(S)?(kt=0,Na=null,Kb(l)):(kt=0,Na=null,ql(n,l,S,7));break;case 5:var O=null;switch(ht.tag){case 26:O=ht.memoizedState;case 5:case 27:var H=ht;if(O?B1(O):H.stateNode.complete){kt=0,Na=null;var te=H.sibling;if(te!==null)ht=te;else{var fe=H.return;fe!==null?(ht=fe,Md(fe)):ht=null}break t}}kt=0,Na=null,ql(n,l,S,5);break;case 6:kt=0,Na=null,ql(n,l,S,6);break;case 8:tp(),tr=6;break e;default:throw Error(a(462))}}c5();break}catch(be){Hb(n,be)}while(!0);return Dn=Ss=null,_.H=v,_.A=b,Nt=c,ht!==null?0:(zt=null,pt=0,Yc(),tr)}function c5(){for(;ht!==null&&!Ge();)Yb(ht)}function Yb(n){var l=yb(n.alternate,n,In);n.memoizedProps=n.pendingProps,l===null?Md(n):ht=l}function Kb(n){var l=n,c=l.alternate;switch(l.tag){case 15:case 0:l=fb(c,l,l.pendingProps,l.type,void 0,pt);break;case 11:l=fb(c,l,l.pendingProps,l.type.render,l.ref,pt);break;case 5:mv(l);default:bb(c,l),l=ht=$y(l,In),l=yb(c,l,In)}n.memoizedProps=n.pendingProps,l===null?Md(n):ht=l}function ql(n,l,c,v){Dn=Ss=null,mv(l),Ml=null,tu=0;var b=l.return;try{if(Wj(n,b,l,c,pt)){tr=1,gd(n,_a(c,n.current)),ht=null;return}}catch(S){if(b!==null)throw ht=b,S;tr=1,gd(n,_a(c,n.current)),ht=null;return}l.flags&32768?(mt||v===1?n=!0:Pl||(pt&536870912)!==0?n=!1:(bi=n=!0,(v===2||v===9||v===3||v===6)&&(v=Ta.current,v!==null&&v.tag===13&&(v.flags|=16384))),Xb(l,n)):Md(l)}function Md(n){var l=n;do{if((l.flags&32768)!==0){Xb(l,bi);return}n=l.return;var c=t5(l.alternate,l,In);if(c!==null){ht=c;return}if(l=l.sibling,l!==null){ht=l;return}ht=l=n}while(l!==null);tr===0&&(tr=5)}function Xb(n,l){do{var c=r5(n.alternate,n);if(c!==null){c.flags&=32767,ht=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!l&&(n=n.sibling,n!==null)){ht=n;return}ht=n=c}while(n!==null);tr=6,ht=null}function Zb(n,l,c,v,b,S,O,H,te){n.cancelPendingCommit=null;do kd();while(br!==0);if((Nt&6)!==0)throw Error(a(327));if(l!==null){if(l===n.current)throw Error(a(177));if(S=l.lanes|l.childLanes,S|=Hh,Lr(n,c,S,O,H,te),n===zt&&(ht=zt=null,pt=0),_l=l,Ei=n,Vn=c,Wv=S,Jv=b,qb=v,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,v5(et,function(){return r1(),null})):(n.callbackNode=null,n.callbackPriority=0),v=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||v){v=_.T,_.T=null,b=V.p,V.p=2,O=Nt,Nt|=4;try{a5(n,l,c)}finally{Nt=O,V.p=b,_.T=v}}br=1,Wb(),Jb(),e1()}}function Wb(){if(br===1){br=0;var n=Ei,l=_l,c=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||c){c=_.T,_.T=null;var v=V.p;V.p=2;var b=Nt;Nt|=4;try{Ob(l,n);var S=vp,O=_y(n.containerInfo),H=S.focusedElem,te=S.selectionRange;if(O!==H&&H&&H.ownerDocument&&zy(H.ownerDocument.documentElement,H)){if(te!==null&&Uh(H)){var fe=te.start,be=te.end;if(be===void 0&&(be=fe),"selectionStart"in H)H.selectionStart=fe,H.selectionEnd=Math.min(be,H.value.length);else{var Ce=H.ownerDocument||document,he=Ce&&Ce.defaultView||window;if(he.getSelection){var ge=he.getSelection(),Fe=H.textContent.length,rt=Math.min(te.start,Fe),Lt=te.end===void 0?rt:Math.min(te.end,Fe);!ge.extend&&rt>Lt&&(O=Lt,Lt=rt,rt=O);var ue=Py(H,rt),ne=Py(H,Lt);if(ue&&ne&&(ge.rangeCount!==1||ge.anchorNode!==ue.node||ge.anchorOffset!==ue.offset||ge.focusNode!==ne.node||ge.focusOffset!==ne.offset)){var de=Ce.createRange();de.setStart(ue.node,ue.offset),ge.removeAllRanges(),rt>Lt?(ge.addRange(de),ge.extend(ne.node,ne.offset)):(de.setEnd(ne.node,ne.offset),ge.addRange(de))}}}}for(Ce=[],ge=H;ge=ge.parentNode;)ge.nodeType===1&&Ce.push({element:ge,left:ge.scrollLeft,top:ge.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<Ce.length;H++){var Te=Ce[H];Te.element.scrollLeft=Te.left,Te.element.scrollTop=Te.top}}Vd=!!hp,vp=hp=null}finally{Nt=b,V.p=v,_.T=c}}n.current=l,br=2}}function Jb(){if(br===2){br=0;var n=Ei,l=_l,c=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||c){c=_.T,_.T=null;var v=V.p;V.p=2;var b=Nt;Nt|=4;try{jb(n,l.alternate,l)}finally{Nt=b,V.p=v,_.T=c}}br=3}}function e1(){if(br===4||br===3){br=0,Je();var n=Ei,l=_l,c=Vn,v=qb;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?br=5:(br=0,_l=Ei=null,t1(n,n.pendingLanes));var b=n.pendingLanes;if(b===0&&(Si=null),Ra(c),l=l.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot($,l,void 0,(l.current.flags&128)===128)}catch{}if(v!==null){l=_.T,b=V.p,V.p=2,_.T=null;try{for(var S=n.onRecoverableError,O=0;O<v.length;O++){var H=v[O];S(H.value,{componentStack:H.stack})}}finally{_.T=l,V.p=b}}(Vn&3)!==0&&kd(),vn(n),b=n.pendingLanes,(c&261930)!==0&&(b&42)!==0?n===ep?yu++:(yu=0,ep=n):yu=0,xu(0)}}function t1(n,l){(n.pooledCacheLanes&=l)===0&&(l=n.pooledCache,l!=null&&(n.pooledCache=null,Jo(l)))}function kd(){return Wb(),Jb(),e1(),r1()}function r1(){if(br!==5)return!1;var n=Ei,l=Wv;Wv=0;var c=Ra(Vn),v=_.T,b=V.p;try{V.p=32>c?32:c,_.T=null,c=Jv,Jv=null;var S=Ei,O=Vn;if(br=0,_l=Ei=null,Vn=0,(Nt&6)!==0)throw Error(a(331));var H=Nt;if(Nt|=4,zb(S.current),Bb(S,S.current,O,c),Nt=H,xu(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot($,S)}catch{}return!0}finally{V.p=b,_.T=v,t1(n,l)}}function a1(n,l,c){l=_a(c,l),l=Ov(n.stateNode,l,2),n=gi(n,l,2),n!==null&&(Ot(n,2),vn(n))}function Dt(n,l,c){if(n.tag===3)a1(n,n,c);else for(;l!==null;){if(l.tag===3){a1(l,n,c);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Si===null||!Si.has(v))){n=_a(c,n),c=nb(2),v=gi(l,c,2),v!==null&&(ib(c,v,l,n),Ot(v,2),vn(v));break}}l=l.return}}function ap(n,l,c){var v=n.pingCache;if(v===null){v=n.pingCache=new s5;var b=new Set;v.set(l,b)}else b=v.get(l),b===void 0&&(b=new Set,v.set(l,b));b.has(c)||(Kv=!0,b.add(c),n=d5.bind(null,n,l,c),l.then(n,n))}function d5(n,l,c){var v=n.pingCache;v!==null&&v.delete(l),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,zt===n&&(pt&c)===c&&(tr===4||tr===3&&(pt&62914560)===pt&&300>Be()-Td?(Nt&2)===0&&Ul(n,0):Xv|=c,zl===pt&&(zl=0)),vn(n)}function n1(n,l){l===0&&(l=ut()),n=xs(n,l),n!==null&&(Ot(n,l),vn(n))}function f5(n){var l=n.memoizedState,c=0;l!==null&&(c=l.retryLane),n1(n,c)}function h5(n,l){var c=0;switch(n.tag){case 31:case 13:var v=n.stateNode,b=n.memoizedState;b!==null&&(c=b.retryLane);break;case 19:v=n.stateNode;break;case 22:v=n.stateNode._retryCache;break;default:throw Error(a(314))}v!==null&&v.delete(l),n1(n,c)}function v5(n,l){return ke(n,l)}var Dd=null,Il=null,np=!1,Od=!1,ip=!1,Ci=0;function vn(n){n!==Il&&n.next===null&&(Il===null?Dd=Il=n:Il=Il.next=n),Od=!0,np||(np=!0,g5())}function xu(n,l){if(!ip&&Od){ip=!0;do for(var c=!1,v=Dd;v!==null;){if(n!==0){var b=v.pendingLanes;if(b===0)var S=0;else{var O=v.suspendedLanes,H=v.pingedLanes;S=(1<<31-ve(42|n)+1)-1,S&=b&~(O&~H),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(c=!0,o1(v,S))}else S=pt,S=st(v,v===zt?S:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(S&3)===0||Ve(v,S)||(c=!0,o1(v,S));v=v.next}while(c);ip=!1}}function p5(){i1()}function i1(){Od=np=!1;var n=0;Ci!==0&&N5()&&(n=Ci);for(var l=Be(),c=null,v=Dd;v!==null;){var b=v.next,S=s1(v,l);S===0?(v.next=null,c===null?Dd=b:c.next=b,b===null&&(Il=c)):(c=v,(n!==0||(S&3)!==0)&&(Od=!0)),v=b}br!==0&&br!==5||xu(n),Ci!==0&&(Ci=0)}function s1(n,l){for(var c=n.suspendedLanes,v=n.pingedLanes,b=n.expirationTimes,S=n.pendingLanes&-62914561;0<S;){var O=31-ve(S),H=1<<O,te=b[O];te===-1?((H&c)===0||(H&v)!==0)&&(b[O]=dt(H,l)):te<=l&&(n.expiredLanes|=H),S&=~H}if(l=zt,c=pt,c=st(n,n===l?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),v=n.callbackNode,c===0||n===l&&(kt===2||kt===9)||n.cancelPendingCommit!==null)return v!==null&&v!==null&&Pe(v),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||Ve(n,c)){if(l=c&-c,l===n.callbackPriority)return l;switch(v!==null&&Pe(v),Ra(c)){case 2:case 8:c=$e;break;case 32:c=et;break;case 268435456:c=ze;break;default:c=et}return v=l1.bind(null,n),c=ke(c,v),n.callbackPriority=l,n.callbackNode=c,l}return v!==null&&v!==null&&Pe(v),n.callbackPriority=2,n.callbackNode=null,2}function l1(n,l){if(br!==0&&br!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(kd()&&n.callbackNode!==c)return null;var v=pt;return v=st(n,n===zt?v:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),v===0?null:(Vb(n,v,l),s1(n,Be()),n.callbackNode!=null&&n.callbackNode===c?l1.bind(null,n):null)}function o1(n,l){if(kd())return null;Vb(n,l,!0)}function g5(){A5(function(){(Nt&6)!==0?ke(ye,p5):i1()})}function sp(){if(Ci===0){var n=Nl;n===0&&(n=He,He<<=1,(He&261888)===0&&(He=256)),Ci=n}return Ci}function u1(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:qc(""+n)}function c1(n,l){var c=l.ownerDocument.createElement("input");return c.name=l.name,c.value=l.value,n.id&&c.setAttribute("form",n.id),l.parentNode.insertBefore(c,l),n=new FormData(n),c.parentNode.removeChild(c),n}function m5(n,l,c,v,b){if(l==="submit"&&c&&c.stateNode===b){var S=u1((b[xr]||null).action),O=v.submitter;O&&(l=(l=O[xr]||null)?u1(l.formAction):O.getAttribute("formAction"),l!==null&&(S=l,O=null));var H=new Hc("action","action",null,v,b);n.push({event:H,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if(Ci!==0){var te=O?c1(b,O):new FormData(b);Nv(c,{pending:!0,data:te,method:b.method,action:S},null,te)}}else typeof S=="function"&&(H.preventDefault(),te=O?c1(b,O):new FormData(b),Nv(c,{pending:!0,data:te,method:b.method,action:S},S,te))},currentTarget:b}]})}}for(var lp=0;lp<Fh.length;lp++){var op=Fh[lp],y5=op.toLowerCase(),x5=op[0].toUpperCase()+op.slice(1);Za(y5,"on"+x5)}Za(Iy,"onAnimationEnd"),Za(Vy,"onAnimationIteration"),Za(Fy,"onAnimationStart"),Za("dblclick","onDoubleClick"),Za("focusin","onFocus"),Za("focusout","onBlur"),Za(Lj,"onTransitionRun"),Za(Pj,"onTransitionStart"),Za(zj,"onTransitionCancel"),Za(Hy,"onTransitionEnd"),cn("onMouseEnter",["mouseout","mouseover"]),cn("onMouseLeave",["mouseout","mouseover"]),cn("onPointerEnter",["pointerout","pointerover"]),cn("onPointerLeave",["pointerout","pointerover"]),wa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),wa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),wa("onBeforeInput",["compositionend","keypress","textInput","paste"]),wa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),wa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),wa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bu="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(" "),b5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bu));function d1(n,l){l=(l&4)!==0;for(var c=0;c<n.length;c++){var v=n[c],b=v.event;v=v.listeners;e:{var S=void 0;if(l)for(var O=v.length-1;0<=O;O--){var H=v[O],te=H.instance,fe=H.currentTarget;if(H=H.listener,te!==S&&b.isPropagationStopped())break e;S=H,b.currentTarget=fe;try{S(b)}catch(be){$c(be)}b.currentTarget=null,S=te}else for(O=0;O<v.length;O++){if(H=v[O],te=H.instance,fe=H.currentTarget,H=H.listener,te!==S&&b.isPropagationStopped())break e;S=H,b.currentTarget=fe;try{S(b)}catch(be){$c(be)}b.currentTarget=null,S=te}}}}function vt(n,l){var c=l[Nr];c===void 0&&(c=l[Nr]=new Set);var v=n+"__bubble";c.has(v)||(f1(l,n,2,!1),c.add(v))}function up(n,l,c){var v=0;l&&(v|=4),f1(c,n,v,l)}var Rd="_reactListening"+Math.random().toString(36).slice(2);function cp(n){if(!n[Rd]){n[Rd]=!0,Lc.forEach(function(c){c!=="selectionchange"&&(b5.has(c)||up(c,!1,n),up(c,!0,n))});var l=n.nodeType===9?n:n.ownerDocument;l===null||l[Rd]||(l[Rd]=!0,up("selectionchange",!1,l))}}function f1(n,l,c,v){switch(I1(l)){case 2:var b=Y5;break;case 8:b=K5;break;default:b=Cp}c=b.bind(null,l,c,n),b=void 0,!kh||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(b=!0),v?b!==void 0?n.addEventListener(l,c,{capture:!0,passive:b}):n.addEventListener(l,c,!0):b!==void 0?n.addEventListener(l,c,{passive:b}):n.addEventListener(l,c,!1)}function dp(n,l,c,v,b){var S=v;if((l&1)===0&&(l&2)===0&&v!==null)e:for(;;){if(v===null)return;var O=v.tag;if(O===3||O===4){var H=v.stateNode.containerInfo;if(H===b)break;if(O===4)for(O=v.return;O!==null;){var te=O.tag;if((te===3||te===4)&&O.stateNode.containerInfo===b)return;O=O.return}for(;H!==null;){if(O=ii(H),O===null)return;if(te=O.tag,te===5||te===6||te===26||te===27){v=S=O;continue e}H=H.parentNode}}v=v.return}my(function(){var fe=S,be=Ah(c),Ce=[];e:{var he=Gy.get(n);if(he!==void 0){var ge=Hc,Fe=n;switch(n){case"keypress":if(Vc(c)===0)break e;case"keydown":case"keyup":ge=hj;break;case"focusin":Fe="focus",ge=Bh;break;case"focusout":Fe="blur",ge=Bh;break;case"beforeblur":case"afterblur":ge=Bh;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ge=by;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ge=tj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ge=gj;break;case Iy:case Vy:case Fy:ge=nj;break;case Hy:ge=yj;break;case"scroll":case"scrollend":ge=JN;break;case"wheel":ge=bj;break;case"copy":case"cut":case"paste":ge=sj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ge=Sy;break;case"toggle":case"beforetoggle":ge=Sj}var rt=(l&4)!==0,Lt=!rt&&(n==="scroll"||n==="scrollend"),ue=rt?he!==null?he+"Capture":null:he;rt=[];for(var ne=fe,de;ne!==null;){var Te=ne;if(de=Te.stateNode,Te=Te.tag,Te!==5&&Te!==26&&Te!==27||de===null||ue===null||(Te=Vo(ne,ue),Te!=null&&rt.push(wu(ne,Te,de))),Lt)break;ne=ne.return}0<rt.length&&(he=new ge(he,Fe,null,c,be),Ce.push({event:he,listeners:rt}))}}if((l&7)===0){e:{if(he=n==="mouseover"||n==="pointerover",ge=n==="mouseout"||n==="pointerout",he&&c!==jh&&(Fe=c.relatedTarget||c.fromElement)&&(ii(Fe)||Fe[sa]))break e;if((ge||he)&&(he=be.window===be?be:(he=be.ownerDocument)?he.defaultView||he.parentWindow:window,ge?(Fe=c.relatedTarget||c.toElement,ge=fe,Fe=Fe?ii(Fe):null,Fe!==null&&(Lt=s(Fe),rt=Fe.tag,Fe!==Lt||rt!==5&&rt!==27&&rt!==6)&&(Fe=null)):(ge=null,Fe=fe),ge!==Fe)){if(rt=by,Te="onMouseLeave",ue="onMouseEnter",ne="mouse",(n==="pointerout"||n==="pointerover")&&(rt=Sy,Te="onPointerLeave",ue="onPointerEnter",ne="pointer"),Lt=ge==null?he:ps(ge),de=Fe==null?he:ps(Fe),he=new rt(Te,ne+"leave",ge,c,be),he.target=Lt,he.relatedTarget=de,Te=null,ii(be)===fe&&(rt=new rt(ue,ne+"enter",Fe,c,be),rt.target=de,rt.relatedTarget=Lt,Te=rt),Lt=Te,ge&&Fe)t:{for(rt=w5,ue=ge,ne=Fe,de=0,Te=ue;Te;Te=rt(Te))de++;Te=0;for(var We=ne;We;We=rt(We))Te++;for(;0<de-Te;)ue=rt(ue),de--;for(;0<Te-de;)ne=rt(ne),Te--;for(;de--;){if(ue===ne||ne!==null&&ue===ne.alternate){rt=ue;break t}ue=rt(ue),ne=rt(ne)}rt=null}else rt=null;ge!==null&&h1(Ce,he,ge,rt,!1),Fe!==null&&Lt!==null&&h1(Ce,Lt,Fe,rt,!0)}}e:{if(he=fe?ps(fe):window,ge=he.nodeName&&he.nodeName.toLowerCase(),ge==="select"||ge==="input"&&he.type==="file")var St=ky;else if(Ay(he))if(Dy)St=Oj;else{St=kj;var Ye=Mj}else ge=he.nodeName,!ge||ge.toLowerCase()!=="input"||he.type!=="checkbox"&&he.type!=="radio"?fe&&Nh(fe.elementType)&&(St=ky):St=Dj;if(St&&(St=St(n,fe))){My(Ce,St,c,be);break e}Ye&&Ye(n,he,fe),n==="focusout"&&fe&&he.type==="number"&&fe.memoizedProps.value!=null&&Ch(he,"number",he.value)}switch(Ye=fe?ps(fe):window,n){case"focusin":(Ay(Ye)||Ye.contentEditable==="true")&&(yl=Ye,qh=fe,Xo=null);break;case"focusout":Xo=qh=yl=null;break;case"mousedown":Ih=!0;break;case"contextmenu":case"mouseup":case"dragend":Ih=!1,Uy(Ce,c,be);break;case"selectionchange":if(Bj)break;case"keydown":case"keyup":Uy(Ce,c,be)}var ct;if(Ph)e:{switch(n){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else ml?Ny(n,c)&&(gt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(gt="onCompositionStart");gt&&(Ey&&c.locale!=="ko"&&(ml||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&ml&&(ct=yy()):(ui=be,Dh="value"in ui?ui.value:ui.textContent,ml=!0)),Ye=Bd(fe,gt),0<Ye.length&&(gt=new wy(gt,n,null,c,be),Ce.push({event:gt,listeners:Ye}),ct?gt.data=ct:(ct=jy(c),ct!==null&&(gt.data=ct)))),(ct=Tj?Cj(n,c):Nj(n,c))&&(gt=Bd(fe,"onBeforeInput"),0<gt.length&&(Ye=new wy("onBeforeInput","beforeinput",null,c,be),Ce.push({event:Ye,listeners:gt}),Ye.data=ct)),m5(Ce,n,fe,c,be)}d1(Ce,l)})}function wu(n,l,c){return{instance:n,listener:l,currentTarget:c}}function Bd(n,l){for(var c=l+"Capture",v=[];n!==null;){var b=n,S=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||S===null||(b=Vo(n,c),b!=null&&v.unshift(wu(n,b,S)),b=Vo(n,l),b!=null&&v.push(wu(n,b,S))),n.tag===3)return v;n=n.return}return[]}function w5(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function h1(n,l,c,v,b){for(var S=l._reactName,O=[];c!==null&&c!==v;){var H=c,te=H.alternate,fe=H.stateNode;if(H=H.tag,te!==null&&te===v)break;H!==5&&H!==26&&H!==27||fe===null||(te=fe,b?(fe=Vo(c,S),fe!=null&&O.unshift(wu(c,fe,te))):b||(fe=Vo(c,S),fe!=null&&O.push(wu(c,fe,te)))),c=c.return}O.length!==0&&n.push({event:l,listeners:O})}var S5=/\r\n?/g,E5=/\u0000|\uFFFD/g;function v1(n){return(typeof n=="string"?n:""+n).replace(S5,`
49
- `).replace(E5,"")}function p1(n,l){return l=v1(l),v1(n)===l}function Bt(n,l,c,v,b,S){switch(c){case"children":typeof v=="string"?l==="body"||l==="textarea"&&v===""||vl(n,v):(typeof v=="number"||typeof v=="bigint")&&l!=="body"&&vl(n,""+v);break;case"className":oi(n,"class",v);break;case"tabIndex":oi(n,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":oi(n,c,v);break;case"style":py(n,v,S);break;case"data":if(l!=="object"){oi(n,"data",v);break}case"src":case"href":if(v===""&&(l!=="a"||c!=="href")){n.removeAttribute(c);break}if(v==null||typeof v=="function"||typeof v=="symbol"||typeof v=="boolean"){n.removeAttribute(c);break}v=qc(""+v),n.setAttribute(c,v);break;case"action":case"formAction":if(typeof v=="function"){n.setAttribute(c,"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 S=="function"&&(c==="formAction"?(l!=="input"&&Bt(n,l,"name",b.name,b,null),Bt(n,l,"formEncType",b.formEncType,b,null),Bt(n,l,"formMethod",b.formMethod,b,null),Bt(n,l,"formTarget",b.formTarget,b,null)):(Bt(n,l,"encType",b.encType,b,null),Bt(n,l,"method",b.method,b,null),Bt(n,l,"target",b.target,b,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){n.removeAttribute(c);break}v=qc(""+v),n.setAttribute(c,v);break;case"onClick":v!=null&&(n.onclick=jn);break;case"onScroll":v!=null&&vt("scroll",n);break;case"onScrollEnd":v!=null&&vt("scrollend",n);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(a(61));if(c=v.__html,c!=null){if(b.children!=null)throw Error(a(60));n.innerHTML=c}}break;case"multiple":n.multiple=v&&typeof v!="function"&&typeof v!="symbol";break;case"muted":n.muted=v&&typeof v!="function"&&typeof v!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(v==null||typeof v=="function"||typeof v=="boolean"||typeof v=="symbol"){n.removeAttribute("xlink:href");break}c=qc(""+v),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":v!=null&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,""+v):n.removeAttribute(c);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":v&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":v===!0?n.setAttribute(c,""):v!==!1&&v!=null&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,v):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":v!=null&&typeof v!="function"&&typeof v!="symbol"&&!isNaN(v)&&1<=v?n.setAttribute(c,v):n.removeAttribute(c);break;case"rowSpan":case"start":v==null||typeof v=="function"||typeof v=="symbol"||isNaN(v)?n.removeAttribute(c):n.setAttribute(c,v);break;case"popover":vt("beforetoggle",n),vt("toggle",n),Qr(n,"popover",v);break;case"xlinkActuate":La(n,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":La(n,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":La(n,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":La(n,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":La(n,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":La(n,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":La(n,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":La(n,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":La(n,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":Qr(n,"is",v);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=ZN.get(c)||c,Qr(n,c,v))}}function fp(n,l,c,v,b,S){switch(c){case"style":py(n,v,S);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(a(61));if(c=v.__html,c!=null){if(b.children!=null)throw Error(a(60));n.innerHTML=c}}break;case"children":typeof v=="string"?vl(n,v):(typeof v=="number"||typeof v=="bigint")&&vl(n,""+v);break;case"onScroll":v!=null&&vt("scroll",n);break;case"onScrollEnd":v!=null&&vt("scrollend",n);break;case"onClick":v!=null&&(n.onclick=jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pc.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),l=c.slice(2,b?c.length-7:void 0),S=n[xr]||null,S=S!=null?S[c]:null,typeof S=="function"&&n.removeEventListener(l,S,b),typeof v=="function")){typeof S!="function"&&S!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(l,v,b);break e}c in n?n[c]=v:v===!0?n.setAttribute(c,""):Qr(n,c,v)}}}function Ur(n,l,c){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",n),vt("load",n);var v=!1,b=!1,S;for(S in c)if(c.hasOwnProperty(S)){var O=c[S];if(O!=null)switch(S){case"src":v=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,l));default:Bt(n,l,S,O,c,null)}}b&&Bt(n,l,"srcSet",c.srcSet,c,null),v&&Bt(n,l,"src",c.src,c,null);return;case"input":vt("invalid",n);var H=S=O=b=null,te=null,fe=null;for(v in c)if(c.hasOwnProperty(v)){var be=c[v];if(be!=null)switch(v){case"name":b=be;break;case"type":O=be;break;case"checked":te=be;break;case"defaultChecked":fe=be;break;case"value":S=be;break;case"defaultValue":H=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(a(137,l));break;default:Bt(n,l,v,be,c,null)}}dy(n,S,H,te,fe,O,b,!1);return;case"select":vt("invalid",n),v=O=S=null;for(b in c)if(c.hasOwnProperty(b)&&(H=c[b],H!=null))switch(b){case"value":S=H;break;case"defaultValue":O=H;break;case"multiple":v=H;default:Bt(n,l,b,H,c,null)}l=S,c=O,n.multiple=!!v,l!=null?hl(n,!!v,l,!1):c!=null&&hl(n,!!v,c,!0);return;case"textarea":vt("invalid",n),S=b=v=null;for(O in c)if(c.hasOwnProperty(O)&&(H=c[O],H!=null))switch(O){case"value":v=H;break;case"defaultValue":b=H;break;case"children":S=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(a(91));break;default:Bt(n,l,O,H,c,null)}hy(n,v,b,S);return;case"option":for(te in c)if(c.hasOwnProperty(te)&&(v=c[te],v!=null))switch(te){case"selected":n.selected=v&&typeof v!="function"&&typeof v!="symbol";break;default:Bt(n,l,te,v,c,null)}return;case"dialog":vt("beforetoggle",n),vt("toggle",n),vt("cancel",n),vt("close",n);break;case"iframe":case"object":vt("load",n);break;case"video":case"audio":for(v=0;v<bu.length;v++)vt(bu[v],n);break;case"image":vt("error",n),vt("load",n);break;case"details":vt("toggle",n);break;case"embed":case"source":case"link":vt("error",n),vt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(fe in c)if(c.hasOwnProperty(fe)&&(v=c[fe],v!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,l));default:Bt(n,l,fe,v,c,null)}return;default:if(Nh(l)){for(be in c)c.hasOwnProperty(be)&&(v=c[be],v!==void 0&&fp(n,l,be,v,c,void 0));return}}for(H in c)c.hasOwnProperty(H)&&(v=c[H],v!=null&&Bt(n,l,H,v,c,null))}function T5(n,l,c,v){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,S=null,O=null,H=null,te=null,fe=null,be=null;for(ge in c){var Ce=c[ge];if(c.hasOwnProperty(ge)&&Ce!=null)switch(ge){case"checked":break;case"value":break;case"defaultValue":te=Ce;default:v.hasOwnProperty(ge)||Bt(n,l,ge,null,v,Ce)}}for(var he in v){var ge=v[he];if(Ce=c[he],v.hasOwnProperty(he)&&(ge!=null||Ce!=null))switch(he){case"type":S=ge;break;case"name":b=ge;break;case"checked":fe=ge;break;case"defaultChecked":be=ge;break;case"value":O=ge;break;case"defaultValue":H=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(a(137,l));break;default:ge!==Ce&&Bt(n,l,he,ge,v,Ce)}}Th(n,O,H,te,fe,be,S,b);return;case"select":ge=O=H=he=null;for(S in c)if(te=c[S],c.hasOwnProperty(S)&&te!=null)switch(S){case"value":break;case"multiple":ge=te;default:v.hasOwnProperty(S)||Bt(n,l,S,null,v,te)}for(b in v)if(S=v[b],te=c[b],v.hasOwnProperty(b)&&(S!=null||te!=null))switch(b){case"value":he=S;break;case"defaultValue":H=S;break;case"multiple":O=S;default:S!==te&&Bt(n,l,b,S,v,te)}l=H,c=O,v=ge,he!=null?hl(n,!!c,he,!1):!!v!=!!c&&(l!=null?hl(n,!!c,l,!0):hl(n,!!c,c?[]:"",!1));return;case"textarea":ge=he=null;for(H in c)if(b=c[H],c.hasOwnProperty(H)&&b!=null&&!v.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:Bt(n,l,H,null,v,b)}for(O in v)if(b=v[O],S=c[O],v.hasOwnProperty(O)&&(b!=null||S!=null))switch(O){case"value":he=b;break;case"defaultValue":ge=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:b!==S&&Bt(n,l,O,b,v,S)}fy(n,he,ge);return;case"option":for(var Fe in c)if(he=c[Fe],c.hasOwnProperty(Fe)&&he!=null&&!v.hasOwnProperty(Fe))switch(Fe){case"selected":n.selected=!1;break;default:Bt(n,l,Fe,null,v,he)}for(te in v)if(he=v[te],ge=c[te],v.hasOwnProperty(te)&&he!==ge&&(he!=null||ge!=null))switch(te){case"selected":n.selected=he&&typeof he!="function"&&typeof he!="symbol";break;default:Bt(n,l,te,he,v,ge)}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 rt in c)he=c[rt],c.hasOwnProperty(rt)&&he!=null&&!v.hasOwnProperty(rt)&&Bt(n,l,rt,null,v,he);for(fe in v)if(he=v[fe],ge=c[fe],v.hasOwnProperty(fe)&&he!==ge&&(he!=null||ge!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(a(137,l));break;default:Bt(n,l,fe,he,v,ge)}return;default:if(Nh(l)){for(var Lt in c)he=c[Lt],c.hasOwnProperty(Lt)&&he!==void 0&&!v.hasOwnProperty(Lt)&&fp(n,l,Lt,void 0,v,he);for(be in v)he=v[be],ge=c[be],!v.hasOwnProperty(be)||he===ge||he===void 0&&ge===void 0||fp(n,l,be,he,v,ge);return}}for(var ue in c)he=c[ue],c.hasOwnProperty(ue)&&he!=null&&!v.hasOwnProperty(ue)&&Bt(n,l,ue,null,v,he);for(Ce in v)he=v[Ce],ge=c[Ce],!v.hasOwnProperty(Ce)||he===ge||he==null&&ge==null||Bt(n,l,Ce,he,v,ge)}function g1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function C5(){if(typeof performance.getEntriesByType=="function"){for(var n=0,l=0,c=performance.getEntriesByType("resource"),v=0;v<c.length;v++){var b=c[v],S=b.transferSize,O=b.initiatorType,H=b.duration;if(S&&H&&g1(O)){for(O=0,H=b.responseEnd,v+=1;v<c.length;v++){var te=c[v],fe=te.startTime;if(fe>H)break;var be=te.transferSize,Ce=te.initiatorType;be&&g1(Ce)&&(te=te.responseEnd,O+=be*(te<H?1:(H-fe)/(te-fe)))}if(--v,l+=8*(S+O)/(b.duration/1e3),n++,10<n)break}}if(0<n)return l/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var hp=null,vp=null;function Ld(n){return n.nodeType===9?n:n.ownerDocument}function m1(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function y1(n,l){if(n===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&l==="foreignObject"?0:n}function pp(n,l){return n==="textarea"||n==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var gp=null;function N5(){var n=window.event;return n&&n.type==="popstate"?n===gp?!1:(gp=n,!0):(gp=null,!1)}var x1=typeof setTimeout=="function"?setTimeout:void 0,j5=typeof clearTimeout=="function"?clearTimeout:void 0,b1=typeof Promise=="function"?Promise:void 0,A5=typeof queueMicrotask=="function"?queueMicrotask:typeof b1<"u"?function(n){return b1.resolve(null).then(n).catch(M5)}:x1;function M5(n){setTimeout(function(){throw n})}function Ni(n){return n==="head"}function w1(n,l){var c=l,v=0;do{var b=c.nextSibling;if(n.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(v===0){n.removeChild(b),Gl(l);return}v--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")v++;else if(c==="html")Su(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,Su(c);for(var S=c.firstChild;S;){var O=S.nextSibling,H=S.nodeName;S[Ar]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&S.rel.toLowerCase()==="stylesheet"||c.removeChild(S),S=O}}else c==="body"&&Su(n.ownerDocument.body);c=b}while(c);Gl(l)}function S1(n,l){var c=n;n=0;do{var v=c.nextSibling;if(c.nodeType===1?l?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(l?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),v&&v.nodeType===8)if(c=v.data,c==="/$"){if(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=v}while(c)}function mp(n){var l=n.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var c=l;switch(l=l.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":mp(c),dl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function k5(n,l,c,v){for(;n.nodeType===1;){var b=c;if(n.nodeName.toLowerCase()!==l.toLowerCase()){if(!v&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(v){if(!n[Ar])switch(l){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(S=n.getAttribute("rel"),S==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(S!==b.rel||n.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||n.getAttribute("title")!==(b.title==null?null:b.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(S=n.getAttribute("src"),(S!==(b.src==null?null:b.src)||n.getAttribute("type")!==(b.type==null?null:b.type)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&S&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(l==="input"&&n.type==="hidden"){var S=b.name==null?null:""+b.name;if(b.type==="hidden"&&n.getAttribute("name")===S)return n}else return n;if(n=Fa(n.nextSibling),n===null)break}return null}function D5(n,l,c){if(l==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=Fa(n.nextSibling),n===null))return null;return n}function E1(n,l){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=Fa(n.nextSibling),n===null))return null;return n}function yp(n){return n.data==="$?"||n.data==="$~"}function xp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function O5(n,l){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=l;else if(n.data!=="$?"||c.readyState!=="loading")l();else{var v=function(){l(),c.removeEventListener("DOMContentLoaded",v)};c.addEventListener("DOMContentLoaded",v),n._reactRetry=v}}function Fa(n){for(;n!=null;n=n.nextSibling){var l=n.nodeType;if(l===1||l===3)break;if(l===8){if(l=n.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return n}var bp=null;function T1(n){n=n.nextSibling;for(var l=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(l===0)return Fa(n.nextSibling);l--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||l++}n=n.nextSibling}return null}function C1(n){n=n.previousSibling;for(var l=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(l===0)return n;l--}else c!=="/$"&&c!=="/&"||l++}n=n.previousSibling}return null}function N1(n,l,c){switch(l=Ld(c),n){case"html":if(n=l.documentElement,!n)throw Error(a(452));return n;case"head":if(n=l.head,!n)throw Error(a(453));return n;case"body":if(n=l.body,!n)throw Error(a(454));return n;default:throw Error(a(451))}}function Su(n){for(var l=n.attributes;l.length;)n.removeAttributeNode(l[0]);dl(n)}var Ha=new Map,j1=new Set;function Pd(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Fn=V.d;V.d={f:R5,r:B5,D:L5,C:P5,L:z5,m:_5,X:q5,S:U5,M:I5};function R5(){var n=Fn.f(),l=jd();return n||l}function B5(n){var l=si(n);l!==null&&l.tag===5&&l.type==="form"?Hx(l):Fn.r(n)}var Vl=typeof document>"u"?null:document;function A1(n,l,c){var v=Vl;if(v&&typeof l=="string"&&l){var b=Pa(l);b='link[rel="'+n+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),j1.has(b)||(j1.add(b),n={rel:n,crossOrigin:c,href:l},v.querySelector(b)===null&&(l=v.createElement("link"),Ur(l,"link",n),dr(l),v.head.appendChild(l)))}}function L5(n){Fn.D(n),A1("dns-prefetch",n,null)}function P5(n,l){Fn.C(n,l),A1("preconnect",n,l)}function z5(n,l,c){Fn.L(n,l,c);var v=Vl;if(v&&n&&l){var b='link[rel="preload"][as="'+Pa(l)+'"]';l==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+Pa(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+Pa(c.imageSizes)+'"]')):b+='[href="'+Pa(n)+'"]';var S=b;switch(l){case"style":S=Fl(n);break;case"script":S=Hl(n)}Ha.has(S)||(n=p({rel:"preload",href:l==="image"&&c&&c.imageSrcSet?void 0:n,as:l},c),Ha.set(S,n),v.querySelector(b)!==null||l==="style"&&v.querySelector(Eu(S))||l==="script"&&v.querySelector(Tu(S))||(l=v.createElement("link"),Ur(l,"link",n),dr(l),v.head.appendChild(l)))}}function _5(n,l){Fn.m(n,l);var c=Vl;if(c&&n){var v=l&&typeof l.as=="string"?l.as:"script",b='link[rel="modulepreload"][as="'+Pa(v)+'"][href="'+Pa(n)+'"]',S=b;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Hl(n)}if(!Ha.has(S)&&(n=p({rel:"modulepreload",href:n},l),Ha.set(S,n),c.querySelector(b)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Tu(S)))return}v=c.createElement("link"),Ur(v,"link",n),dr(v),c.head.appendChild(v)}}}function U5(n,l,c){Fn.S(n,l,c);var v=Vl;if(v&&n){var b=li(v).hoistableStyles,S=Fl(n);l=l||"default";var O=b.get(S);if(!O){var H={loading:0,preload:null};if(O=v.querySelector(Eu(S)))H.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":l},c),(c=Ha.get(S))&&wp(n,c);var te=O=v.createElement("link");dr(te),Ur(te,"link",n),te._p=new Promise(function(fe,be){te.onload=fe,te.onerror=be}),te.addEventListener("load",function(){H.loading|=1}),te.addEventListener("error",function(){H.loading|=2}),H.loading|=4,zd(O,l,v)}O={type:"stylesheet",instance:O,count:1,state:H},b.set(S,O)}}}function q5(n,l){Fn.X(n,l);var c=Vl;if(c&&n){var v=li(c).hoistableScripts,b=Hl(n),S=v.get(b);S||(S=c.querySelector(Tu(b)),S||(n=p({src:n,async:!0},l),(l=Ha.get(b))&&Sp(n,l),S=c.createElement("script"),dr(S),Ur(S,"link",n),c.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},v.set(b,S))}}function I5(n,l){Fn.M(n,l);var c=Vl;if(c&&n){var v=li(c).hoistableScripts,b=Hl(n),S=v.get(b);S||(S=c.querySelector(Tu(b)),S||(n=p({src:n,async:!0,type:"module"},l),(l=Ha.get(b))&&Sp(n,l),S=c.createElement("script"),dr(S),Ur(S,"link",n),c.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},v.set(b,S))}}function M1(n,l,c,v){var b=(b=Y.current)?Pd(b):null;if(!b)throw Error(a(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(l=Fl(c.href),c=li(b).hoistableStyles,v=c.get(l),v||(v={type:"style",instance:null,count:0,state:null},c.set(l,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){n=Fl(c.href);var S=li(b).hoistableStyles,O=S.get(n);if(O||(b=b.ownerDocument||b,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(n,O),(S=b.querySelector(Eu(n)))&&!S._p&&(O.instance=S,O.state.loading=5),Ha.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ha.set(n,c),S||V5(b,n,c,O.state))),l&&v===null)throw Error(a(528,""));return O}if(l&&v!==null)throw Error(a(529,""));return null;case"script":return l=c.async,c=c.src,typeof c=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Hl(c),c=li(b).hoistableScripts,v=c.get(l),v||(v={type:"script",instance:null,count:0,state:null},c.set(l,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,n))}}function Fl(n){return'href="'+Pa(n)+'"'}function Eu(n){return'link[rel="stylesheet"]['+n+"]"}function k1(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function V5(n,l,c,v){n.querySelector('link[rel="preload"][as="style"]['+l+"]")?v.loading=1:(l=n.createElement("link"),v.preload=l,l.addEventListener("load",function(){return v.loading|=1}),l.addEventListener("error",function(){return v.loading|=2}),Ur(l,"link",c),dr(l),n.head.appendChild(l))}function Hl(n){return'[src="'+Pa(n)+'"]'}function Tu(n){return"script[async]"+n}function D1(n,l,c){if(l.count++,l.instance===null)switch(l.type){case"style":var v=n.querySelector('style[data-href~="'+Pa(c.href)+'"]');if(v)return l.instance=v,dr(v),v;var b=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return v=(n.ownerDocument||n).createElement("style"),dr(v),Ur(v,"style",b),zd(v,c.precedence,n),l.instance=v;case"stylesheet":b=Fl(c.href);var S=n.querySelector(Eu(b));if(S)return l.state.loading|=4,l.instance=S,dr(S),S;v=k1(c),(b=Ha.get(b))&&wp(v,b),S=(n.ownerDocument||n).createElement("link"),dr(S);var O=S;return O._p=new Promise(function(H,te){O.onload=H,O.onerror=te}),Ur(S,"link",v),l.state.loading|=4,zd(S,c.precedence,n),l.instance=S;case"script":return S=Hl(c.src),(b=n.querySelector(Tu(S)))?(l.instance=b,dr(b),b):(v=c,(b=Ha.get(S))&&(v=p({},c),Sp(v,b)),n=n.ownerDocument||n,b=n.createElement("script"),dr(b),Ur(b,"link",v),n.head.appendChild(b),l.instance=b);case"void":return null;default:throw Error(a(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(v=l.instance,l.state.loading|=4,zd(v,c.precedence,n));return l.instance}function zd(n,l,c){for(var v=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=v.length?v[v.length-1]:null,S=b,O=0;O<v.length;O++){var H=v[O];if(H.dataset.precedence===l)S=H;else if(S!==b)break}S?S.parentNode.insertBefore(n,S.nextSibling):(l=c.nodeType===9?c.head:c,l.insertBefore(n,l.firstChild))}function wp(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.title==null&&(n.title=l.title)}function Sp(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.integrity==null&&(n.integrity=l.integrity)}var _d=null;function O1(n,l,c){if(_d===null){var v=new Map,b=_d=new Map;b.set(c,v)}else b=_d,v=b.get(c),v||(v=new Map,b.set(c,v));if(v.has(n))return v;for(v.set(n,null),c=c.getElementsByTagName(n),b=0;b<c.length;b++){var S=c[b];if(!(S[Ar]||S[Ht]||n==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var O=S.getAttribute(l)||"";O=n+O;var H=v.get(O);H?H.push(S):v.set(O,[S])}}return v}function R1(n,l,c){n=n.ownerDocument||n,n.head.insertBefore(c,l==="title"?n.querySelector("head > title"):null)}function F5(n,l,c){if(c===1||l.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return n=l.disabled,typeof l.precedence=="string"&&n==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function B1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function H5(n,l,c,v){if(c.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=Fl(v.href),S=l.querySelector(Eu(b));if(S){l=S._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Ud.bind(n),l.then(n,n)),c.state.loading|=4,c.instance=S,dr(S);return}S=l.ownerDocument||l,v=k1(v),(b=Ha.get(b))&&wp(v,b),S=S.createElement("link"),dr(S);var O=S;O._p=new Promise(function(H,te){O.onload=H,O.onerror=te}),Ur(S,"link",v),c.instance=S}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,l),(l=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=Ud.bind(n),l.addEventListener("load",c),l.addEventListener("error",c))}}var Ep=0;function G5(n,l){return n.stylesheets&&n.count===0&&Id(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var v=setTimeout(function(){if(n.stylesheets&&Id(n,n.stylesheets),n.unsuspend){var S=n.unsuspend;n.unsuspend=null,S()}},6e4+l);0<n.imgBytes&&Ep===0&&(Ep=62500*C5());var b=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Id(n,n.stylesheets),n.unsuspend)){var S=n.unsuspend;n.unsuspend=null,S()}},(n.imgBytes>Ep?50:800)+l);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(v),clearTimeout(b)}}:null}function Ud(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Id(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var qd=null;function Id(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,qd=new Map,l.forEach(Q5,n),qd=null,Ud.call(n))}function Q5(n,l){if(!(l.state.loading&4)){var c=qd.get(n);if(c)var v=c.get(null);else{c=new Map,qd.set(n,c);for(var b=n.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<b.length;S++){var O=b[S];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(c.set(O.dataset.precedence,O),v=O)}v&&c.set(null,v)}b=l.instance,O=b.getAttribute("data-precedence"),S=c.get(O)||v,S===v&&c.set(null,b),c.set(O,b),this.count++,v=Ud.bind(this),b.addEventListener("load",v),b.addEventListener("error",v),S?S.parentNode.insertBefore(b,S.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(b,n.firstChild)),l.state.loading|=4}}var Cu={$$typeof:N,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function $5(n,l,c,v,b,S,O,H,te){this.tag=1,this.containerInfo=n,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=Yt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yt(0),this.hiddenUpdates=Yt(null),this.identifierPrefix=v,this.onUncaughtError=b,this.onCaughtError=S,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=te,this.incompleteTransitions=new Map}function L1(n,l,c,v,b,S,O,H,te,fe,be,Ce){return n=new $5(n,l,c,O,te,fe,be,Ce,H),l=1,S===!0&&(l|=24),S=Ea(3,null,null,l),n.current=S,S.stateNode=n,l=rv(),l.refCount++,n.pooledCache=l,l.refCount++,S.memoizedState={element:v,isDehydrated:c,cache:l},sv(S),n}function P1(n){return n?(n=wl,n):wl}function z1(n,l,c,v,b,S){b=P1(b),v.context===null?v.context=b:v.pendingContext=b,v=pi(l),v.payload={element:c},S=S===void 0?null:S,S!==null&&(v.callback=S),c=gi(n,v,l),c!==null&&(ha(c,n,l),au(c,n,l))}function _1(n,l){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<l?c:l}}function Tp(n,l){_1(n,l),(n=n.alternate)&&_1(n,l)}function U1(n){if(n.tag===13||n.tag===31){var l=xs(n,67108864);l!==null&&ha(l,n,67108864),Tp(n,67108864)}}function q1(n){if(n.tag===13||n.tag===31){var l=Aa();l=lr(l);var c=xs(n,l);c!==null&&ha(c,n,l),Tp(n,l)}}var Vd=!0;function Y5(n,l,c,v){var b=_.T;_.T=null;var S=V.p;try{V.p=2,Cp(n,l,c,v)}finally{V.p=S,_.T=b}}function K5(n,l,c,v){var b=_.T;_.T=null;var S=V.p;try{V.p=8,Cp(n,l,c,v)}finally{V.p=S,_.T=b}}function Cp(n,l,c,v){if(Vd){var b=Np(v);if(b===null)dp(n,l,v,Fd,c),V1(n,v);else if(Z5(b,n,l,c,v))v.stopPropagation();else if(V1(n,v),l&4&&-1<X5.indexOf(n)){for(;b!==null;){var S=si(b);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var O=it(S.pendingLanes);if(O!==0){var H=S;for(H.pendingLanes|=2,H.entangledLanes|=2;O;){var te=1<<31-ve(O);H.entanglements[1]|=te,O&=~te}vn(S),(Nt&6)===0&&(Cd=Be()+500,xu(0))}}break;case 31:case 13:H=xs(S,2),H!==null&&ha(H,S,2),jd(),Tp(S,2)}if(S=Np(v),S===null&&dp(n,l,v,Fd,c),S===b)break;b=S}b!==null&&v.stopPropagation()}else dp(n,l,v,null,c)}}function Np(n){return n=Ah(n),jp(n)}var Fd=null;function jp(n){if(Fd=null,n=ii(n),n!==null){var l=s(n);if(l===null)n=null;else{var c=l.tag;if(c===13){if(n=o(l),n!==null)return n;n=null}else if(c===31){if(n=u(l),n!==null)return n;n=null}else if(c===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;n=null}else l!==n&&(n=null)}}return Fd=n,null}function I1(n){switch(n){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(nt()){case ye:return 2;case $e:return 8;case et:case xe:return 32;case ze:return 268435456;default:return 32}default:return 32}}var Ap=!1,ji=null,Ai=null,Mi=null,Nu=new Map,ju=new Map,ki=[],X5="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 V1(n,l){switch(n){case"focusin":case"focusout":ji=null;break;case"dragenter":case"dragleave":Ai=null;break;case"mouseover":case"mouseout":Mi=null;break;case"pointerover":case"pointerout":Nu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":ju.delete(l.pointerId)}}function Au(n,l,c,v,b,S){return n===null||n.nativeEvent!==S?(n={blockedOn:l,domEventName:c,eventSystemFlags:v,nativeEvent:S,targetContainers:[b]},l!==null&&(l=si(l),l!==null&&U1(l)),n):(n.eventSystemFlags|=v,l=n.targetContainers,b!==null&&l.indexOf(b)===-1&&l.push(b),n)}function Z5(n,l,c,v,b){switch(l){case"focusin":return ji=Au(ji,n,l,c,v,b),!0;case"dragenter":return Ai=Au(Ai,n,l,c,v,b),!0;case"mouseover":return Mi=Au(Mi,n,l,c,v,b),!0;case"pointerover":var S=b.pointerId;return Nu.set(S,Au(Nu.get(S)||null,n,l,c,v,b)),!0;case"gotpointercapture":return S=b.pointerId,ju.set(S,Au(ju.get(S)||null,n,l,c,v,b)),!0}return!1}function F1(n){var l=ii(n.target);if(l!==null){var c=s(l);if(c!==null){if(l=c.tag,l===13){if(l=o(c),l!==null){n.blockedOn=l,Ba(n.priority,function(){q1(c)});return}}else if(l===31){if(l=u(c),l!==null){n.blockedOn=l,Ba(n.priority,function(){q1(c)});return}}else if(l===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Hd(n){if(n.blockedOn!==null)return!1;for(var l=n.targetContainers;0<l.length;){var c=Np(n.nativeEvent);if(c===null){c=n.nativeEvent;var v=new c.constructor(c.type,c);jh=v,c.target.dispatchEvent(v),jh=null}else return l=si(c),l!==null&&U1(l),n.blockedOn=c,!1;l.shift()}return!0}function H1(n,l,c){Hd(n)&&c.delete(l)}function W5(){Ap=!1,ji!==null&&Hd(ji)&&(ji=null),Ai!==null&&Hd(Ai)&&(Ai=null),Mi!==null&&Hd(Mi)&&(Mi=null),Nu.forEach(H1),ju.forEach(H1)}function Gd(n,l){n.blockedOn===l&&(n.blockedOn=null,Ap||(Ap=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,W5)))}var Qd=null;function G1(n){Qd!==n&&(Qd=n,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Qd===n&&(Qd=null);for(var l=0;l<n.length;l+=3){var c=n[l],v=n[l+1],b=n[l+2];if(typeof v!="function"){if(jp(v||c)===null)continue;break}var S=si(c);S!==null&&(n.splice(l,3),l-=3,Nv(S,{pending:!0,data:b,method:c.method,action:v},v,b))}}))}function Gl(n){function l(te){return Gd(te,n)}ji!==null&&Gd(ji,n),Ai!==null&&Gd(Ai,n),Mi!==null&&Gd(Mi,n),Nu.forEach(l),ju.forEach(l);for(var c=0;c<ki.length;c++){var v=ki[c];v.blockedOn===n&&(v.blockedOn=null)}for(;0<ki.length&&(c=ki[0],c.blockedOn===null);)F1(c),c.blockedOn===null&&ki.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(v=0;v<c.length;v+=3){var b=c[v],S=c[v+1],O=b[xr]||null;if(typeof S=="function")O||G1(c);else if(O){var H=null;if(S&&S.hasAttribute("formAction")){if(b=S,O=S[xr]||null)H=O.formAction;else if(jp(b)!==null)continue}else H=O.action;typeof H=="function"?c[v+1]=H:(c.splice(v,3),v-=3),G1(c)}}}function Q1(){function n(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(O){return b=O})},focusReset:"manual",scroll:"manual"})}function l(){b!==null&&(b(),b=null),v||setTimeout(c,20)}function c(){if(!v&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var v=!1,b=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(c,100),function(){v=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),b!==null&&(b(),b=null)}}}function Mp(n){this._internalRoot=n}$d.prototype.render=Mp.prototype.render=function(n){var l=this._internalRoot;if(l===null)throw Error(a(409));var c=l.current,v=Aa();z1(c,v,n,l,null,null)},$d.prototype.unmount=Mp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var l=n.containerInfo;z1(n.current,2,null,n,null,null),jd(),l[sa]=null}};function $d(n){this._internalRoot=n}$d.prototype.unstable_scheduleHydration=function(n){if(n){var l=Xt();n={blockedOn:null,target:n,priority:l};for(var c=0;c<ki.length&&l!==0&&l<ki[c].priority;c++);ki.splice(c,0,n),c===0&&F1(n)}};var $1=e.version;if($1!=="19.2.4")throw Error(a(527,$1,"19.2.4"));V.findDOMNode=function(n){var l=n._reactInternals;if(l===void 0)throw typeof n.render=="function"?Error(a(188)):(n=Object.keys(n).join(","),Error(a(268,n)));return n=f(l),n=n!==null?h(n):null,n=n===null?null:n.stateNode,n};var J5={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:_,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yd.isDisabled&&Yd.supportsFiber)try{$=Yd.inject(J5),ce=Yd}catch{}}return ku.createRoot=function(n,l){if(!i(n))throw Error(a(299));var c=!1,v="",b=eb,S=tb,O=rb;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(b=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(O=l.onRecoverableError)),l=L1(n,1,!1,null,null,c,v,null,b,S,O,Q1),n[sa]=l.current,cp(n),new Mp(l)},ku.hydrateRoot=function(n,l,c){if(!i(n))throw Error(a(299));var v=!1,b="",S=eb,O=tb,H=rb,te=null;return c!=null&&(c.unstable_strictMode===!0&&(v=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(S=c.onUncaughtError),c.onCaughtError!==void 0&&(O=c.onCaughtError),c.onRecoverableError!==void 0&&(H=c.onRecoverableError),c.formState!==void 0&&(te=c.formState)),l=L1(n,1,!0,l,c??null,v,b,te,S,O,H,Q1),l.context=P1(null),c=l.current,v=Aa(),v=lr(v),b=pi(v),b.callback=null,gi(c,b,v),c=v,l.current.lanes=c,Ot(l,c),vn(l),n[sa]=l.current,cp(n),new $d(l)},ku.version="19.2.4",ku}var y2;function $A(){if(y2)return Pp.exports;y2=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Pp.exports=QA(),Pp.exports}var YA=$A();const KA=PE(YA);var Ku=bT();/**
50
- * @remix-run/router v1.23.2
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */function Xu(){return Xu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Xu.apply(this,arguments)}var $i;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})($i||($i={}));const x2="popstate";function XA(t){t===void 0&&(t={});function e(a,i){let{pathname:s,search:o,hash:u}=a.location;return Hg("",{pathname:s,search:o,hash:u},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(a,i){return typeof i=="string"?i:Bf(i)}return WA(e,r,null,t)}function yr(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Am(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function ZA(){return Math.random().toString(36).substr(2,8)}function b2(t,e){return{usr:t.state,key:t.key,idx:e}}function Hg(t,e,r,a){return r===void 0&&(r=null),Xu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Oo(e):e,{state:r,key:e&&e.key||a||ZA()})}function Bf(t){let{pathname:e="/",search:r="",hash:a=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function Oo(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let a=t.indexOf("?");a>=0&&(e.search=t.substr(a),t=t.substr(0,a)),t&&(e.pathname=t)}return e}function WA(t,e,r,a){a===void 0&&(a={});let{window:i=document.defaultView,v5Compat:s=!1}=a,o=i.history,u=$i.Pop,d=null,f=h();f==null&&(f=0,o.replaceState(Xu({},o.state,{idx:f}),""));function h(){return(o.state||{idx:null}).idx}function p(){u=$i.Pop;let w=h(),T=w==null?null:w-f;f=w,d&&d({action:u,location:E.location,delta:T})}function m(w,T){u=$i.Push;let C=Hg(E.location,w,T);f=h()+1;let N=b2(C,f),A=E.createHref(C);try{o.pushState(N,"",A)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(A)}s&&d&&d({action:u,location:E.location,delta:1})}function y(w,T){u=$i.Replace;let C=Hg(E.location,w,T);f=h();let N=b2(C,f),A=E.createHref(C);o.replaceState(N,"",A),s&&d&&d({action:u,location:E.location,delta:0})}function x(w){let T=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof w=="string"?w:Bf(w);return C=C.replace(/ $/,"%20"),yr(T,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,T)}let E={get action(){return u},get location(){return t(i,o)},listen(w){if(d)throw new Error("A history only accepts one active listener");return i.addEventListener(x2,p),d=w,()=>{i.removeEventListener(x2,p),d=null}},createHref(w){return e(i,w)},createURL:x,encodeLocation(w){let T=x(w);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:m,replace:y,go(w){return o.go(w)}};return E}var w2;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(w2||(w2={}));function JA(t,e,r){return r===void 0&&(r="/"),eM(t,e,r)}function eM(t,e,r,a){let i=typeof e=="string"?Oo(e):e,s=Mm(i.pathname||"/",r);if(s==null)return null;let o=wT(t);tM(o);let u=null;for(let d=0;u==null&&d<o.length;++d){let f=hM(s);u=cM(o[d],f)}return u}function wT(t,e,r,a){e===void 0&&(e=[]),r===void 0&&(r=[]),a===void 0&&(a="");let i=(s,o,u)=>{let d={relativePath:u===void 0?s.path||"":u,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};d.relativePath.startsWith("/")&&(yr(d.relativePath.startsWith(a),'Absolute route path "'+d.relativePath+'" nested under path '+('"'+a+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),d.relativePath=d.relativePath.slice(a.length));let f=Wi([a,d.relativePath]),h=r.concat(d);s.children&&s.children.length>0&&(yr(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),wT(s.children,e,h,f)),!(s.path==null&&!s.index)&&e.push({path:f,score:oM(f,s.index),routesMeta:h})};return t.forEach((s,o)=>{var u;if(s.path===""||!((u=s.path)!=null&&u.includes("?")))i(s,o);else for(let d of ST(s.path))i(s,o,d)}),e}function ST(t){let e=t.split("/");if(e.length===0)return[];let[r,...a]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(a.length===0)return i?[s,""]:[s];let o=ST(a.join("/")),u=[];return u.push(...o.map(d=>d===""?s:[s,d].join("/"))),i&&u.push(...o),u.map(d=>t.startsWith("/")&&d===""?"/":d)}function tM(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:uM(e.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}const rM=/^:[\w-]+$/,aM=3,nM=2,iM=1,sM=10,lM=-2,S2=t=>t==="*";function oM(t,e){let r=t.split("/"),a=r.length;return r.some(S2)&&(a+=lM),e&&(a+=nM),r.filter(i=>!S2(i)).reduce((i,s)=>i+(rM.test(s)?aM:s===""?iM:sM),a)}function uM(t,e){return t.length===e.length&&t.slice(0,-1).every((a,i)=>a===e[i])?t[t.length-1]-e[e.length-1]:0}function cM(t,e,r){let{routesMeta:a}=t,i={},s="/",o=[];for(let u=0;u<a.length;++u){let d=a[u],f=u===a.length-1,h=s==="/"?e:e.slice(s.length)||"/",p=dM({path:d.relativePath,caseSensitive:d.caseSensitive,end:f},h),m=d.route;if(!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:Wi([s,p.pathname]),pathnameBase:yM(Wi([s,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(s=Wi([s,p.pathnameBase]))}return o}function dM(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,a]=fM(t.path,t.caseSensitive,t.end),i=e.match(r);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),u=i.slice(1);return{params:a.reduce((f,h,p)=>{let{paramName:m,isOptional:y}=h;if(m==="*"){let E=u[p]||"";o=s.slice(0,s.length-E.length).replace(/(.)\/+$/,"$1")}const x=u[p];return y&&!x?f[m]=void 0:f[m]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:s,pathnameBase:o,pattern:t}}function fM(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),Am(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let a=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,u,d)=>(a.push({paramName:u,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(a.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),a]}function hM(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Am(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Mm(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,a=t.charAt(r);return a&&a!=="/"?null:t.slice(r)||"/"}const vM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pM=t=>vM.test(t);function gM(t,e){e===void 0&&(e="/");let{pathname:r,search:a="",hash:i=""}=typeof t=="string"?Oo(t):t,s;if(r)if(pM(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),Am(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=E2(r.substring(1),"/"):s=E2(r,e)}else s=e;return{pathname:s,search:xM(a),hash:bM(i)}}function E2(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function qp(t,e,r,a){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(a)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function mM(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function ET(t,e){let r=mM(t);return e?r.map((a,i)=>i===r.length-1?a.pathname:a.pathnameBase):r.map(a=>a.pathnameBase)}function TT(t,e,r,a){a===void 0&&(a=!1);let i;typeof t=="string"?i=Oo(t):(i=Xu({},t),yr(!i.pathname||!i.pathname.includes("?"),qp("?","pathname","search",i)),yr(!i.pathname||!i.pathname.includes("#"),qp("#","pathname","hash",i)),yr(!i.search||!i.search.includes("#"),qp("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,u;if(o==null)u=r;else{let p=e.length-1;if(!a&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),p-=1;i.pathname=m.join("/")}u=p>=0?e[p]:"/"}let d=gM(i,u),f=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(f||h)&&(d.pathname+="/"),d}const Wi=t=>t.join("/").replace(/\/\/+/g,"/"),yM=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),xM=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,bM=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function wM(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const CT=["post","put","patch","delete"];new Set(CT);const SM=["get",...CT];new Set(SM);/**
59
- * React Router v6.30.3
60
- *
61
- * Copyright (c) Remix Software Inc.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE.md file in the root directory of this source tree.
65
- *
66
- * @license MIT
67
- */function Zu(){return Zu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Zu.apply(this,arguments)}const km=U.createContext(null),EM=U.createContext(null),sl=U.createContext(null),th=U.createContext(null),os=U.createContext({outlet:null,matches:[],isDataRoute:!1}),NT=U.createContext(null);function TM(t,e){let{relative:r}=e===void 0?{}:e;wc()||yr(!1);let{basename:a,navigator:i}=U.useContext(sl),{hash:s,pathname:o,search:u}=AT(t,{relative:r}),d=o;return a!=="/"&&(d=o==="/"?a:Wi([a,o])),i.createHref({pathname:d,search:u,hash:s})}function wc(){return U.useContext(th)!=null}function ll(){return wc()||yr(!1),U.useContext(th).location}function jT(t){U.useContext(sl).static||U.useLayoutEffect(t)}function un(){let{isDataRoute:t}=U.useContext(os);return t?zM():CM()}function CM(){wc()||yr(!1);let t=U.useContext(km),{basename:e,future:r,navigator:a}=U.useContext(sl),{matches:i}=U.useContext(os),{pathname:s}=ll(),o=JSON.stringify(ET(i,r.v7_relativeSplatPath)),u=U.useRef(!1);return jT(()=>{u.current=!0}),U.useCallback(function(f,h){if(h===void 0&&(h={}),!u.current)return;if(typeof f=="number"){a.go(f);return}let p=TT(f,JSON.parse(o),s,h.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:Wi([e,p.pathname])),(h.replace?a.replace:a.push)(p,h.state,h)},[e,a,o,s,t])}function Dm(){let{matches:t}=U.useContext(os),e=t[t.length-1];return e?e.params:{}}function AT(t,e){let{relative:r}=e===void 0?{}:e,{future:a}=U.useContext(sl),{matches:i}=U.useContext(os),{pathname:s}=ll(),o=JSON.stringify(ET(i,a.v7_relativeSplatPath));return U.useMemo(()=>TT(t,JSON.parse(o),s,r==="path"),[t,o,s,r])}function NM(t,e){return jM(t,e)}function jM(t,e,r,a){wc()||yr(!1);let{navigator:i}=U.useContext(sl),{matches:s}=U.useContext(os),o=s[s.length-1],u=o?o.params:{};o&&o.pathname;let d=o?o.pathnameBase:"/";o&&o.route;let f=ll(),h;if(e){var p;let w=typeof e=="string"?Oo(e):e;d==="/"||(p=w.pathname)!=null&&p.startsWith(d)||yr(!1),h=w}else h=f;let m=h.pathname||"/",y=m;if(d!=="/"){let w=d.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(w.length).join("/")}let x=JA(t,{pathname:y}),E=OM(x&&x.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:Wi([d,i.encodeLocation?i.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?d:Wi([d,i.encodeLocation?i.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,r,a);return e&&E?U.createElement(th.Provider,{value:{location:Zu({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:$i.Pop}},E):E}function AM(){let t=PM(),e=wM(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return U.createElement(U.Fragment,null,U.createElement("h2",null,"Unexpected Application Error!"),U.createElement("h3",{style:{fontStyle:"italic"}},e),r?U.createElement("pre",{style:i},r):null,null)}const MM=U.createElement(AM,null);class kM extends U.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?U.createElement(os.Provider,{value:this.props.routeContext},U.createElement(NT.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function DM(t){let{routeContext:e,match:r,children:a}=t,i=U.useContext(km);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),U.createElement(os.Provider,{value:e},a)}function OM(t,e,r,a){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),a===void 0&&(a=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=a)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,u=(i=r)==null?void 0:i.errors;if(u!=null){let h=o.findIndex(p=>p.route.id&&(u==null?void 0:u[p.route.id])!==void 0);h>=0||yr(!1),o=o.slice(0,Math.min(o.length,h+1))}let d=!1,f=-1;if(r&&a&&a.v7_partialHydration)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(f=h),p.route.id){let{loaderData:m,errors:y}=r,x=p.route.loader&&m[p.route.id]===void 0&&(!y||y[p.route.id]===void 0);if(p.route.lazy||x){d=!0,f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}return o.reduceRight((h,p,m)=>{let y,x=!1,E=null,w=null;r&&(y=u&&p.route.id?u[p.route.id]:void 0,E=p.route.errorElement||MM,d&&(f<0&&m===0?(_M("route-fallback"),x=!0,w=null):f===m&&(x=!0,w=p.route.hydrateFallbackElement||null)));let T=e.concat(o.slice(0,m+1)),C=()=>{let N;return y?N=E:x?N=w:p.route.Component?N=U.createElement(p.route.Component,null):p.route.element?N=p.route.element:N=h,U.createElement(DM,{match:p,routeContext:{outlet:h,matches:T,isDataRoute:r!=null},children:N})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?U.createElement(kM,{location:r.location,revalidation:r.revalidation,component:E,error:y,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0}}):C()},null)}var MT=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(MT||{}),kT=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(kT||{});function RM(t){let e=U.useContext(km);return e||yr(!1),e}function BM(t){let e=U.useContext(EM);return e||yr(!1),e}function LM(t){let e=U.useContext(os);return e||yr(!1),e}function DT(t){let e=LM(),r=e.matches[e.matches.length-1];return r.route.id||yr(!1),r.route.id}function PM(){var t;let e=U.useContext(NT),r=BM(),a=DT();return e!==void 0?e:(t=r.errors)==null?void 0:t[a]}function zM(){let{router:t}=RM(MT.UseNavigateStable),e=DT(kT.UseNavigateStable),r=U.useRef(!1);return jT(()=>{r.current=!0}),U.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Zu({fromRouteId:e},s)))},[t,e])}const T2={};function _M(t,e,r){T2[t]||(T2[t]=!0)}function UM(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Gg(t){yr(!1)}function qM(t){let{basename:e="/",children:r=null,location:a,navigationType:i=$i.Pop,navigator:s,static:o=!1,future:u}=t;wc()&&yr(!1);let d=e.replace(/^\/*/,"/"),f=U.useMemo(()=>({basename:d,navigator:s,static:o,future:Zu({v7_relativeSplatPath:!1},u)}),[d,u,s,o]);typeof a=="string"&&(a=Oo(a));let{pathname:h="/",search:p="",hash:m="",state:y=null,key:x="default"}=a,E=U.useMemo(()=>{let w=Mm(h,d);return w==null?null:{location:{pathname:w,search:p,hash:m,state:y,key:x},navigationType:i}},[d,h,p,m,y,x,i]);return E==null?null:U.createElement(sl.Provider,{value:f},U.createElement(th.Provider,{children:r,value:E}))}function IM(t){let{children:e,location:r}=t;return NM(Qg(e),r)}new Promise(()=>{});function Qg(t,e){e===void 0&&(e=[]);let r=[];return U.Children.forEach(t,(a,i)=>{if(!U.isValidElement(a))return;let s=[...e,i];if(a.type===U.Fragment){r.push.apply(r,Qg(a.props.children,s));return}a.type!==Gg&&yr(!1),!a.props.index||!a.props.children||yr(!1);let o={id:a.props.id||s.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,loader:a.props.loader,action:a.props.action,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(o.children=Qg(a.props.children,s)),r.push(o)}),r}/**
68
- * React Router DOM v6.30.3
69
- *
70
- * Copyright (c) Remix Software Inc.
71
- *
72
- * This source code is licensed under the MIT license found in the
73
- * LICENSE.md file in the root directory of this source tree.
74
- *
75
- * @license MIT
76
- */function $g(){return $g=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},$g.apply(this,arguments)}function VM(t,e){if(t==null)return{};var r={},a=Object.keys(t),i,s;for(s=0;s<a.length;s++)i=a[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function FM(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function HM(t,e){return t.button===0&&(!e||e==="_self")&&!FM(t)}const GM=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],QM="6";try{window.__reactRouterVersion=QM}catch{}const $M="startTransition",C2=YE[$M];function YM(t){let{basename:e,children:r,future:a,window:i}=t,s=U.useRef();s.current==null&&(s.current=XA({window:i,v5Compat:!0}));let o=s.current,[u,d]=U.useState({action:o.action,location:o.location}),{v7_startTransition:f}=a||{},h=U.useCallback(p=>{f&&C2?C2(()=>d(p)):d(p)},[d,f]);return U.useLayoutEffect(()=>o.listen(h),[o,h]),U.useEffect(()=>UM(a),[a]),U.createElement(qM,{basename:e,children:r,location:u.location,navigationType:u.action,navigator:o,future:a})}const KM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",XM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qt=U.forwardRef(function(e,r){let{onClick:a,relative:i,reloadDocument:s,replace:o,state:u,target:d,to:f,preventScrollReset:h,viewTransition:p}=e,m=VM(e,GM),{basename:y}=U.useContext(sl),x,E=!1;if(typeof f=="string"&&XM.test(f)&&(x=f,KM))try{let N=new URL(window.location.href),A=f.startsWith("//")?new URL(N.protocol+f):new URL(f),D=Mm(A.pathname,y);A.origin===N.origin&&D!=null?f=D+A.search+A.hash:E=!0}catch{}let w=TM(f,{relative:i}),T=ZM(f,{replace:o,state:u,target:d,preventScrollReset:h,relative:i,viewTransition:p});function C(N){a&&a(N),N.defaultPrevented||T(N)}return U.createElement("a",$g({},m,{href:x||w,onClick:E||s?a:C,ref:r,target:d}))});var N2;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(N2||(N2={}));var j2;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(j2||(j2={}));function ZM(t,e){let{target:r,replace:a,state:i,preventScrollReset:s,relative:o,viewTransition:u}=e===void 0?{}:e,d=un(),f=ll(),h=AT(t,{relative:o});return U.useCallback(p=>{if(HM(p,r)){p.preventDefault();let m=a!==void 0?a:Bf(f)===Bf(h);d(t,{replace:m,state:i,preventScrollReset:s,relative:o,viewTransition:u})}},[f,d,h,a,i,r,t,s,o,u])}const OT=U.createContext(null);function WM({children:t}){const[e,r]=U.useState(null),a=U.useCallback(s=>{r(s)},[]),i=U.useCallback(()=>{r(null)},[]);return g.jsx(OT.Provider,{value:{activeArtifact:e,showArtifact:a,dismissArtifact:i},children:t})}function JM(){const t=U.useContext(OT);if(!t)throw new Error("useArtifact must be used within ArtifactProvider");return t}const RT=U.createContext(null);function ek({children:t}){const[e,r]=U.useState("collapsed"),a=U.useCallback(()=>r("expanded"),[]),i=U.useCallback(()=>r("collapsed"),[]);return g.jsx(RT.Provider,{value:{mode:e,expand:a,collapse:i},children:t})}function tk(){const t=U.useContext(RT);if(!t)throw new Error("useChatBar must be used within ChatBarProvider");return t}class rk{constructor(e){kp(this,"baseUrl");this.baseUrl=e??""}async request(e){const r=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`HTTP ${r.status}`)}const{requestId:a}=await r.json();return new ak(this.baseUrl,a)}async status(){const e=await fetch(`${this.baseUrl}/api/chat/status`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async health(){try{const e=await fetch(`${this.baseUrl}/api/chat/status`,{signal:AbortSignal.timeout(3e3)});return e.ok?(await e.json()).enabled:!1}catch{return!1}}}class ak{constructor(e,r){this.baseUrl=e,this.requestId=r}async*stream(){const e=`${this.baseUrl}/api/chat/stream?requestId=${this.requestId}`,r=await fetch(e,{headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body)throw new Error("Failed to open SSE stream");const a=r.body.getReader(),i=new TextDecoder;let s="",o=null;try{for(;;){const{value:u,done:d}=await a.read();if(d)break;s+=i.decode(u,{stream:!0});const f=s.split(`
77
-
78
- `);s=f.pop()??"";for(const h of f){const p=h.split(`
79
- `);let m="",y="";for(const x of p)x.startsWith("event: ")?m=x.slice(7):x.startsWith("data: ")&&(y=x.slice(6));if(m==="chunk"&&y)yield{kind:"text",text:JSON.parse(y).text};else if(m==="artifact"&&y)yield{kind:"artifact",artifact:JSON.parse(y)};else if(m==="tool_start"&&y)yield{kind:"tool_start",command:JSON.parse(y).command};else if(m==="session"&&y)o=JSON.parse(y).sessionId;else{if(m==="done")return{sessionId:o};if(m==="error"&&y)throw new Error(JSON.parse(y).message)}}}}finally{a.cancel()}return{sessionId:o}}}const BT=U.createContext(null),Om="fg-chat-history",Ip="fg-chat-session";function A2(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function nk(){try{const t=sessionStorage.getItem(Om);if(t)return JSON.parse(t).map(r=>({...r,streaming:!1,activeToolCall:null}))}catch{}return[]}function ik(t){try{sessionStorage.setItem(Om,JSON.stringify(t))}catch{}}function sk({chatEnabled:t,children:e}){const[r,a]=U.useState(nk),[i,s]=U.useState(t?"checking":"disconnected"),[o,u]=U.useState(!1),[d,f]=U.useState(()=>{try{return sessionStorage.getItem(Ip)}catch{return null}}),h=U.useRef(null);U.useEffect(()=>{t?(h.current=new rk,s("checking")):(h.current=null,s("disconnected"))},[t]),U.useEffect(()=>{ik(r)},[r]),U.useEffect(()=>{try{d?sessionStorage.setItem(Ip,d):sessionStorage.removeItem(Ip)}catch{}},[d]),U.useEffect(()=>{if(!h.current)return;let y=!0;const x=h.current,E=async()=>{const T=await x.health();y&&s(T?"connected":"disconnected")};E();const w=setInterval(E,3e4);return()=>{y=!1,clearInterval(w)}},[t]);const p=U.useCallback(async(y,x)=>{var N;const E=h.current;if(!E||o)return;const w={id:A2(),role:"user",content:y,timestamp:new Date().toISOString()},T=A2(),C={id:T,role:"assistant",content:"",timestamp:new Date().toISOString(),streaming:!0};a(A=>[...A,w,C]),u(!0);try{const D=(await E.request({prompt:y,context:x,sessionId:d??void 0})).stream();let M=await D.next();for(;!M.done;){const j=M.value;j.kind==="text"?a(k=>k.map(R=>R.id===T?{...R,content:R.content+j.text}:R)):j.kind==="artifact"?a(k=>k.map(R=>R.id===T?{...R,artifacts:[...R.artifacts??[],j.artifact],activeToolCall:null}:R)):j.kind==="tool_start"&&a(k=>k.map(R=>R.id===T?{...R,activeToolCall:j.command}:R)),M=await D.next()}(N=M.value)!=null&&N.sessionId&&f(M.value.sessionId),a(j=>j.map(k=>k.id===T?{...k,streaming:!1,activeToolCall:null}:k))}catch(A){const D=A instanceof Error?A.message:"Unknown error";a(M=>M.map(j=>j.id===T?{...j,role:"error",content:D,streaming:!1}:j))}finally{u(!1)}},[o,d]),m=U.useCallback(()=>{a([]),sessionStorage.removeItem(Om),f(null)},[]);return g.jsx(BT.Provider,{value:{messages:r,status:i,isStreaming:o,sendMessage:p,clearHistory:m,chatEnabled:t},children:e})}function lk(){const t=U.useContext(BT);if(!t)throw new Error("useChat must be used within ChatProvider");return t}var ok=Object.create,LT=Object.defineProperty,uk=Object.getOwnPropertyDescriptor,PT=Object.getOwnPropertyNames,ck=Object.getPrototypeOf,dk=Object.prototype.hasOwnProperty,us=(t,e)=>function(){return e||(0,t[PT(t)[0]])((e={exports:{}}).exports,e),e.exports},fk=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=PT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!dk.call(t,u)&&u!==r&&LT(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(a=uk(e,u))||a.enumerable});return t},ol=(t,e,r)=>(r=t!=null?ok(ck(t)):{},fk(e||!t||!t.__esModule?LT(r,"default",{value:t,enumerable:!0}):r,t)),hk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(t,e){function r(a,i){if(a==null)return{};var s={};for(var o in a)if({}.hasOwnProperty.call(a,o)){if(i.includes(o))continue;s[o]=a[o]}return s}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),vk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(t,e){var r=hk();function a(i,s){if(i==null)return{};var o,u,d=r(i,s);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(i);for(u=0;u<f.length;u++)o=f[u],s.includes(o)||{}.propertyIsEnumerable.call(i,o)&&(d[o]=i[o])}return d}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),zT=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),pk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=zT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),gk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=zT().default,a=pk();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),mk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=gk();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),Sc=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=mk();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(d){r(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),yk=ol(vk(),1),M2=ol(Sc(),1);const xk=["cursor","direction"];function yn(t,e,r){const a=t.flatMap(i=>i.split("."));if(!e&&(!r||r==="any"))return a.length?[a]:[];if(r==="infinite"&&Zs(e)&&("direction"in e||"cursor"in e)){const{cursor:i,direction:s}=e,o=(0,yk.default)(e,xk);return[a,{input:o,type:"infinite"}]}return[a,(0,M2.default)((0,M2.default)({},typeof e<"u"&&e!==ka&&{input:e}),r&&r!=="any"&&{type:r})]}function yf(t){return yn(t,void 0,"any")}function bk(t){return Jf(({path:e,args:r})=>{var a;const i=[...e],s=i.pop();if(s==="useMutation")return t[s](i,...r);if(s==="_def")return{path:i};const[o,...u]=r,d=(a=u[0])!==null&&a!==void 0?a:{};return t[s](i,o,d)})}var Vp;const wk=["client","ssrContext","ssrState","abortOnUnmount"],Sk=(Vp=U.createContext)===null||Vp===void 0?void 0:Vp.call(YE,null),Ek=t=>{switch(t){case"queryOptions":case"fetch":case"ensureData":case"prefetch":case"getData":case"setData":case"setQueriesData":return"query";case"infiniteQueryOptions":case"fetchInfinite":case"prefetchInfinite":case"getInfiniteData":case"setInfiniteData":return"infinite";case"setMutationDefaults":case"getMutationDefaults":case"isMutating":case"cancel":case"invalidate":case"refetch":case"reset":return"any"}};function Tk(t){return Jf(e=>{const r=[...e.path],a=r.pop(),i=[...e.args],s=i.shift(),o=Ek(a),u=yn(r,s,o);return{infiniteQueryOptions:()=>t.infiniteQueryOptions(r,u,i[0]),queryOptions:()=>t.queryOptions(r,u,...i),fetch:()=>t.fetchQuery(u,...i),fetchInfinite:()=>t.fetchInfiniteQuery(u,i[0]),prefetch:()=>t.prefetchQuery(u,...i),prefetchInfinite:()=>t.prefetchInfiniteQuery(u,i[0]),ensureData:()=>t.ensureQueryData(u,...i),invalidate:()=>t.invalidateQueries(u,...i),reset:()=>t.resetQueries(u,...i),refetch:()=>t.refetchQueries(u,...i),cancel:()=>t.cancelQuery(u,...i),setData:()=>{t.setQueryData(u,i[0],i[1])},setQueriesData:()=>t.setQueriesData(u,i[0],i[1],i[2]),setInfiniteData:()=>{t.setInfiniteQueryData(u,i[0],i[1])},getData:()=>t.getQueryData(u),getInfiniteData:()=>t.getInfiniteQueryData(u),setMutationDefaults:()=>t.setMutationDefaults(yf(r),s),getMutationDefaults:()=>t.getMutationDefaults(yf(r)),isMutating:()=>t.isMutating({mutationKey:yf(r)})}[a]()})}function Ck(t){const e=yT(t.client),r=Tk(t);return Cm(a=>{const i=a;return i==="client"?e:wk.includes(i)?t[i]:r[a]})}var Nk=ol(Sc(),1);function k2(t){const e=t instanceof eh?t:jm(t);return Jf(r=>{const a=r.path,i=a.join("."),[s,o]=r.args;return(0,Nk.default)({queryKey:yn(a,s,"query"),queryFn:()=>e.query(i,s,o==null?void 0:o.trpc)},o)})}var Fp=ol(Sc(),1);function ra(t,e,r){var a;const i=t[0];let s=(a=t[1])===null||a===void 0?void 0:a.input;if(r){var o;s=(0,Fp.default)((0,Fp.default)((0,Fp.default)({},(o=s)!==null&&o!==void 0?o:{}),r.pageParam?{cursor:r.pageParam}:{}),{},{direction:r.direction})}return[i.join("."),s,e==null?void 0:e.trpc]}var jk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(i){var s,o,u,d=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,u=Symbol.iterator);d--;){if(o&&(s=i[o])!=null)return s.call(i);if(u&&(s=i[u])!=null)return new a(s.call(i));o="@@asyncIterator",u="@@iterator"}throw new TypeError("Object is not async iterable")}function a(i){function s(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var u=o.done;return Promise.resolve(o.value).then(function(d){return{value:d,done:u}})}return a=function(u){this.s=u,this.n=u.next},a.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(u){var d=this.s.return;return d===void 0?Promise.resolve({value:u,done:!0}):s(d.apply(this.s,arguments))},throw:function(u){var d=this.s.return;return d===void 0?Promise.reject(u):s(d.apply(this.s,arguments))}},new a(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ak=ol(jk(),1);function Yg(t){return{path:t.path.join(".")}}function Du(t){const e=Yg(t);return U.useMemo(()=>e,[e])}async function _T(t,e,r){const i=e.getQueryCache().build(e,{queryKey:r});i.setState({data:[],status:"success"});const s=[];var o=!1,u=!1,d;try{for(var f=(0,Ak.default)(t),h;o=!(h=await f.next()).done;o=!1){const p=h.value;s.push(p),i.setState({data:[...s]})}}catch(p){u=!0,d=p}finally{try{o&&f.return!=null&&await f.return()}finally{if(u)throw d}}return s}var Tt=ol(Sc(),1);function Mk(t){const{client:e,queryClient:r}=t,a=e instanceof eh?e:jm(e);return{infiniteQueryOptions:(i,s,o)=>{var u,d;const f=((u=s[1])===null||u===void 0?void 0:u.input)===ka,h=async p=>{var m;const y=(0,Tt.default)((0,Tt.default)({},o),{},{trpc:(0,Tt.default)((0,Tt.default)({},o==null?void 0:o.trpc),!(o==null||(m=o.trpc)===null||m===void 0)&&m.abortOnUnmount?{signal:p.signal}:{signal:null})});return await a.query(...ra(s,y,{direction:p.direction,pageParam:p.pageParam}))};return Object.assign((0,Tt.default)((0,Tt.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:s,queryFn:f?ka:h,initialPageParam:(d=o==null?void 0:o.initialCursor)!==null&&d!==void 0?d:null}),{trpc:Yg({path:i})})},queryOptions:(i,s,o)=>{var u;const d=((u=s[1])===null||u===void 0?void 0:u.input)===ka,f=async h=>{var p;const m=(0,Tt.default)((0,Tt.default)({},o),{},{trpc:(0,Tt.default)((0,Tt.default)({},o==null?void 0:o.trpc),!(o==null||(p=o.trpc)===null||p===void 0)&&p.abortOnUnmount?{signal:h.signal}:{signal:null})}),y=await a.query(...ra(s,m));return lT(y)?_T(y,r,s):y};return Object.assign((0,Tt.default)((0,Tt.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:s,queryFn:d?ka:f}),{trpc:Yg({path:i})})},fetchQuery:(i,s)=>r.fetchQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ra(i,s))})),fetchInfiniteQuery:(i,s)=>{var o;return r.fetchInfiniteQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:({pageParam:u,direction:d})=>a.query(...ra(i,s,{pageParam:u,direction:d})),initialPageParam:(o=s==null?void 0:s.initialCursor)!==null&&o!==void 0?o:null}))},prefetchQuery:(i,s)=>r.prefetchQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ra(i,s))})),prefetchInfiniteQuery:(i,s)=>{var o;return r.prefetchInfiniteQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:({pageParam:u,direction:d})=>a.query(...ra(i,s,{pageParam:u,direction:d})),initialPageParam:(o=s==null?void 0:s.initialCursor)!==null&&o!==void 0?o:null}))},ensureQueryData:(i,s)=>r.ensureQueryData((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ra(i,s))})),invalidateQueries:(i,s,o)=>r.invalidateQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),resetQueries:(i,s,o)=>r.resetQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),refetchQueries:(i,s,o)=>r.refetchQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),cancelQuery:(i,s)=>r.cancelQueries({queryKey:i},s),setQueryData:(i,s,o)=>r.setQueryData(i,s,o),setQueriesData:(i,s,o,u)=>r.setQueriesData((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o,u),getQueryData:i=>r.getQueryData(i),setInfiniteQueryData:(i,s,o)=>r.setQueryData(i,s,o),getInfiniteQueryData:i=>r.getQueryData(i),setMutationDefaults:(i,s)=>{const o=i[0],u=d=>a.mutation(...ra([o,{input:d}],t));return r.setMutationDefaults(i,typeof s=="function"?s({canonicalMutationFn:u}):s)},getMutationDefaults:i=>r.getMutationDefaults(i),isMutating:i=>r.isMutating((0,Tt.default)((0,Tt.default)({},i),{},{exact:!0}))}}var Le=ol(Sc());const D2=(t,e)=>new Proxy(t,{get(a,i){return e(i),a[i]}});function kk(t){var e,r;const a=(e=void 0)!==null&&e!==void 0?e:D=>D.originalFn(),i=(r=void 0)!==null&&r!==void 0?r:Sk,s=_A,o=D=>{var M;const{abortOnUnmount:j=!1,queryClient:k,ssrContext:R}=D,[z,B]=U.useState((M=D.ssrState)!==null&&M!==void 0?M:!1),L=D.client instanceof eh?D.client:jm(D.client),q=U.useMemo(()=>Mk({client:L,queryClient:k}),[L,k]),I=U.useMemo(()=>(0,Le.default)({abortOnUnmount:j,queryClient:k,client:L,ssrContext:R??null,ssrState:z},q),[j,L,q,k,R,z]);return U.useEffect(()=>{B(Q=>Q?"mounted":!1)},[]),g.jsx(i.Provider,{value:I,children:D.children})};function u(){const D=U.useContext(i);if(!D)throw new Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return D}function d(D,M){var j;const{queryClient:k,ssrState:R}=u();return R&&R!=="mounted"&&((j=k.getQueryCache().find({queryKey:D}))===null||j===void 0?void 0:j.state.status)==="error"?(0,Le.default)({retryOnMount:!1},M):M}function f(D,M,j){var k,R,z,B,L;const q=u(),{abortOnUnmount:I,client:Q,ssrState:_,queryClient:V,prefetchQuery:F}=q,K=yn(D,M,"query"),ee=V.getQueryDefaults(K),P=M===ka;typeof window>"u"&&_==="prepass"&&(j==null||(k=j.trpc)===null||k===void 0?void 0:k.ssr)!==!1&&((R=j==null?void 0:j.enabled)!==null&&R!==void 0?R:ee==null?void 0:ee.enabled)!==!1&&!P&&!V.getQueryCache().find({queryKey:K})&&F(K,j);const G=d(K,(0,Le.default)((0,Le.default)({},ee),j)),Z=(z=(B=j==null||(L=j.trpc)===null||L===void 0?void 0:L.abortOnUnmount)!==null&&B!==void 0?B:void 0)!==null&&z!==void 0?z:I,J=z4((0,Le.default)((0,Le.default)({},G),{},{queryKey:K,queryFn:P?M:async X=>{const Y=(0,Le.default)((0,Le.default)({},G),{},{trpc:(0,Le.default)((0,Le.default)({},G==null?void 0:G.trpc),Z?{signal:X.signal}:{signal:null})}),le=await Q.query(...ra(K,Y));return lT(le)?_T(le,V,K):le}}),V);return J.trpc=Du({path:D}),J}function h(D,M,j){var k,R,z;const B=u(),L=yn(D,M,"query"),q=M===ka,I=(k=(R=j==null||(z=j.trpc)===null||z===void 0?void 0:z.abortOnUnmount)!==null&&R!==void 0?R:void 0)!==null&&k!==void 0?k:B.abortOnUnmount;I4((0,Le.default)((0,Le.default)({},j),{},{queryKey:L,queryFn:q?M:Q=>{const _={trpc:(0,Le.default)((0,Le.default)({},j==null?void 0:j.trpc),I?{signal:Q.signal}:{})};return B.client.query(...ra(L,_))}}))}function p(D,M,j){var k,R,z;const B=u(),L=yn(D,M,"query"),q=(k=(R=j==null||(z=j.trpc)===null||z===void 0?void 0:z.abortOnUnmount)!==null&&R!==void 0?R:void 0)!==null&&k!==void 0?k:B.abortOnUnmount,I=_4((0,Le.default)((0,Le.default)({},j),{},{queryKey:L,queryFn:Q=>{const _=(0,Le.default)((0,Le.default)({},j),{},{trpc:(0,Le.default)((0,Le.default)({},j==null?void 0:j.trpc),q?{signal:Q.signal}:{signal:null})});return B.client.query(...ra(L,_))}}),B.queryClient);return I.trpc=Du({path:D}),[I.data,I]}function m(D,M){const{client:j,queryClient:k}=u(),R=yf(D),z=k.defaultMutationOptions(k.getMutationDefaults(R)),B=F4((0,Le.default)((0,Le.default)({},M),{},{mutationKey:R,mutationFn:L=>j.mutation(...ra([D,{input:L}],M)),onSuccess(...L){var q,I;return a({originalFn:()=>{var _,V,F;return(_=M==null||(V=M.onSuccess)===null||V===void 0?void 0:V.call(M,...L))!==null&&_!==void 0?_:z==null||(F=z.onSuccess)===null||F===void 0?void 0:F.call(z,...L)},queryClient:k,meta:(q=(I=M==null?void 0:M.meta)!==null&&I!==void 0?I:z==null?void 0:z.meta)!==null&&q!==void 0?q:{}})}}),k);return B.trpc=Du({path:D}),B}const y={data:void 0,error:null,status:"idle"},x={data:void 0,error:null,status:"connecting"};/* istanbul ignore next -- @preserve */function E(D,M,j){var k;const R=(k=j==null?void 0:j.enabled)!==null&&k!==void 0?k:M!==ka,z=ts(yn(D,M,"any")),{client:B}=u(),L=U.useRef(j);U.useEffect(()=>{L.current=j});const[q]=U.useState(new Set([])),I=U.useCallback(P=>{q.add(P)},[q]),Q=U.useRef(null),_=U.useCallback(P=>{const G=F.current,Z=F.current=P(G);let J=!1;for(const X of q)if(G[X]!==Z[X]){J=!0;break}J&&ee(D2(Z,I))},[I,q]),V=U.useCallback(()=>{var P;if((P=Q.current)===null||P===void 0||P.unsubscribe(),!R){_(()=>(0,Le.default)((0,Le.default)({},y),{},{reset:V}));return}_(()=>(0,Le.default)((0,Le.default)({},x),{},{reset:V}));const G=B.subscription(D.join("."),M??void 0,{onStarted:()=>{var Z,J;(Z=(J=L.current).onStarted)===null||Z===void 0||Z.call(J),_(X=>(0,Le.default)((0,Le.default)({},X),{},{status:"pending",error:null}))},onData:Z=>{var J,X;(J=(X=L.current).onData)===null||J===void 0||J.call(X,Z),_(Y=>(0,Le.default)((0,Le.default)({},Y),{},{status:"pending",data:Z,error:null}))},onError:Z=>{var J,X;(J=(X=L.current).onError)===null||J===void 0||J.call(X,Z),_(Y=>(0,Le.default)((0,Le.default)({},Y),{},{status:"error",error:Z}))},onConnectionStateChange:Z=>{_(J=>{switch(Z.state){case"idle":return(0,Le.default)((0,Le.default)({},J),{},{status:Z.state,error:null,data:void 0});case"connecting":return(0,Le.default)((0,Le.default)({},J),{},{error:Z.error,status:Z.state});case"pending":return J}})},onComplete:()=>{var Z,J;(Z=(J=L.current).onComplete)===null||Z===void 0||Z.call(J),_(X=>(0,Le.default)((0,Le.default)({},X),{},{status:"idle",error:null,data:void 0}))}});Q.current=G},[B,z,R,_]);U.useEffect(()=>(V(),()=>{var P;(P=Q.current)===null||P===void 0||P.unsubscribe()}),[V]);const F=U.useRef(R?(0,Le.default)((0,Le.default)({},x),{},{reset:V}):(0,Le.default)((0,Le.default)({},y),{},{reset:V})),[K,ee]=U.useState(D2(F.current,I));return K}function w(D,M,j){var k,R,z,B,L;const{client:q,ssrState:I,prefetchInfiniteQuery:Q,queryClient:_,abortOnUnmount:V}=u(),F=yn(D,M,"infinite"),K=_.getQueryDefaults(F),ee=M===ka;typeof window>"u"&&I==="prepass"&&(j==null||(k=j.trpc)===null||k===void 0?void 0:k.ssr)!==!1&&((R=j==null?void 0:j.enabled)!==null&&R!==void 0?R:K==null?void 0:K.enabled)!==!1&&!ee&&!_.getQueryCache().find({queryKey:F})&&Q(F,(0,Le.default)((0,Le.default)({},K),j));const P=d(F,(0,Le.default)((0,Le.default)({},K),j)),G=(z=j==null||(B=j.trpc)===null||B===void 0?void 0:B.abortOnUnmount)!==null&&z!==void 0?z:V,Z=H4((0,Le.default)((0,Le.default)({},P),{},{initialPageParam:(L=j.initialCursor)!==null&&L!==void 0?L:null,persister:j.persister,queryKey:F,queryFn:ee?M:J=>{var X;const Y=(0,Le.default)((0,Le.default)({},P),{},{trpc:(0,Le.default)((0,Le.default)({},P==null?void 0:P.trpc),G?{signal:J.signal}:{signal:null})});return q.query(...ra(F,Y,{pageParam:(X=J.pageParam)!==null&&X!==void 0?X:j.initialCursor,direction:J.direction}))}}),_);return Z.trpc=Du({path:D}),Z}function T(D,M,j){var k,R,z;const B=u(),L=yn(D,M,"infinite"),q=B.queryClient.getQueryDefaults(L),I=M===ka,Q=d(L,(0,Le.default)((0,Le.default)({},q),j)),_=(k=j==null||(R=j.trpc)===null||R===void 0?void 0:R.abortOnUnmount)!==null&&k!==void 0?k:B.abortOnUnmount;V4((0,Le.default)((0,Le.default)({},j),{},{initialPageParam:(z=j.initialCursor)!==null&&z!==void 0?z:null,queryKey:L,queryFn:I?M:V=>{var F;const K=(0,Le.default)((0,Le.default)({},Q),{},{trpc:(0,Le.default)((0,Le.default)({},Q==null?void 0:Q.trpc),_?{signal:V.signal}:{})});return B.client.query(...ra(L,K,{pageParam:(F=V.pageParam)!==null&&F!==void 0?F:j.initialCursor,direction:V.direction}))}}))}function C(D,M,j){var k,R,z;const B=u(),L=yn(D,M,"infinite"),q=B.queryClient.getQueryDefaults(L),I=d(L,(0,Le.default)((0,Le.default)({},q),j)),Q=(k=j==null||(R=j.trpc)===null||R===void 0?void 0:R.abortOnUnmount)!==null&&k!==void 0?k:B.abortOnUnmount,_=U4((0,Le.default)((0,Le.default)({},j),{},{initialPageParam:(z=j.initialCursor)!==null&&z!==void 0?z:null,queryKey:L,queryFn:V=>{var F;const K=(0,Le.default)((0,Le.default)({},I),{},{trpc:(0,Le.default)((0,Le.default)({},I==null?void 0:I.trpc),Q?{signal:V.signal}:{})});return B.client.query(...ra(L,K,{pageParam:(F=V.pageParam)!==null&&F!==void 0?F:j.initialCursor,direction:V.direction}))}}),B.queryClient);return _.trpc=Du({path:D}),[_.data,_]}return{Provider:o,createClient:s,useContext:u,useUtils:u,useQuery:f,usePrefetchQuery:h,useSuspenseQuery:p,useQueries:(D,M)=>{const{ssrState:j,queryClient:k,prefetchQuery:R,client:z}=u(),B=k2(z),L=D(B);if(typeof window>"u"&&j==="prepass")for(const I of L){var q;const Q=I;((q=Q.trpc)===null||q===void 0?void 0:q.ssr)!==!1&&!k.getQueryCache().find({queryKey:Q.queryKey})&&R(Q.queryKey,Q)}return aT({queries:L.map(I=>(0,Le.default)((0,Le.default)({},I),{},{queryKey:I.queryKey})),combine:M==null?void 0:M.combine},k)},useSuspenseQueries:D=>{const{queryClient:M,client:j}=u(),k=k2(j),R=D(k),z=q4({queries:R.map(B=>(0,Le.default)((0,Le.default)({},B),{},{queryFn:B.queryFn,queryKey:B.queryKey}))},M);return[z.map(B=>B.data),z]},useMutation:m,useSubscription:E,useInfiniteQuery:w,usePrefetchInfiniteQuery:T,useSuspenseInfiniteQuery:C}}function Dk(t){const e=bk(t);return Cm(r=>r==="useContext"||r==="useUtils"?()=>{const a=t.useUtils();return U.useMemo(()=>Ck(a),[a])}:t.hasOwnProperty(r)?t[r]:e[r])}function Ok(t){const e=kk();return Dk(e)}const xt=Ok(),O2=["bg-blue-500","bg-emerald-500","bg-amber-500","bg-rose-500","bg-violet-500","bg-cyan-500","bg-pink-500","bg-lime-500","bg-teal-500","bg-orange-500"],R2=["bg-blue-500/15 text-blue-400","bg-emerald-500/15 text-emerald-400","bg-amber-500/15 text-amber-400","bg-rose-500/15 text-rose-400","bg-violet-500/15 text-violet-400","bg-cyan-500/15 text-cyan-400","bg-pink-500/15 text-pink-400","bg-lime-500/15 text-lime-400","bg-teal-500/15 text-teal-400","bg-orange-500/15 text-orange-400"],B2=["#3b82f6","#10b981","#f59e0b","#f43f5e","#8b5cf6","#06b6d4","#ec4899","#84cc16","#14b8a6","#f97316"];function Rm(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)|0;return Math.abs(e)}function Rk(t){return O2[Rm(t)%O2.length]}function nr(t){return R2[Rm(t)%R2.length]}function L2(t){return B2[Rm(t)%B2.length]}function so(t){if(!t)return"--";try{return new Date(t).toLocaleString()}catch{return String(t)}}function UT(t,e=80){const r=JSON.stringify(t);return r.length<=e?r:r.slice(0,e)+"..."}function Zt(t){return t?{scope:t}:{}}function xf(t,e,r,a){if(e===t.length&&a===r.length)return!0;if(a===r.length)return!1;const i=r[a];if(i==="**"){if(a===r.length-1)return!0;for(let s=0;s<=t.length-e;s++)if(xf(t,e+s,r,a+1))return!0;return!1}return e===t.length?!1:i==="*"||t[e]===i?xf(t,e+1,r,a+1):!1}function Bk(t,e){if(e==="root")return t==="";if(e==="**")return!0;const r=t===""?[]:t.split("/"),a=e.split("/");return xf(r,0,a,0)}function P2(t,e){return!e||e.length===0?!0:e.some(r=>Bk(t,r))}function qT(t,e){return t&&(!e||e.length===0)?!1:P2(t,e)}function z2(t,e){return e?t.split("/")[0]===e:!0}function ya(t){return t.replace(/\//g,"~2F")}function IT(t){return t.replace(/~2F/g,"/")}function VT(t,e){return e?t===e||t.startsWith(e+"/"):!1}function FT(t,e){return t===e?"":t.slice(e.length+1)}function HT(t){return t?t.split("/").filter((r,a)=>a%2===1).join("/"):""}function _2(t){if(!t)return[];const e=t.split("/"),r=[];for(let a=0;a+1<e.length;a+=2)r.push({parentUid:e[a],subgraphName:e[a+1]});return r}function Kg(t,e){const r=t.split("/"),a=e.split("/");if(r.length!==a.length)return null;const i={};for(let s=0;s<a.length;s++){const o=a[s],u=o.match(/^\{(.+)\}$/);if(u)i[u[1]]=r[s];else if(o!==r[s])return null}return i}function an(t,e){return t.replace(/\{([^}]+)\}/g,(r,a)=>e[a]??`{${a}}`)}function aa(t,e){const r=ya(t);return e?`/${r}/${e}`:`/${r}`}function nn(t,e,r){const a=new Set(e.map(i=>i.viewName));if(!t)return"json";if(r){const i=t[r];if(i&&a.has(i))return i}return t.default&&a.has(t.default)?t.default:"json"}function GT({collectionDef:t,params:e,docId:r}){const a=aa(an(t.path,e)),i=t.path.split("/").filter(Boolean);return g.jsxs("nav",{className:"flex items-center gap-0.5 text-xs flex-wrap",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-amber-500/70 shrink-0 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),i.map((s,o)=>{const u=o===i.length-1,d=s.match(/^\{(.+)\}$/),f=o>0?g.jsx("span",{className:"text-slate-700 mx-0.5",children:"/"}):null;if(d){const h=d[1],p=e[h],m=i.slice(0,o).map(y=>{const x=y.match(/^\{(.+)\}$/);return x?e[x[1]]??y:y}).join("/");return g.jsxs("span",{className:"flex items-center",children:[f,p?g.jsx(Qt,{to:aa(m,`node/${encodeURIComponent(p)}`),className:"text-indigo-400 hover:text-indigo-300 font-mono transition-colors",title:`${h}: ${p}`,children:p.length>16?`${p.slice(0,14)}…`:p}):g.jsx("span",{className:"text-slate-600 font-mono",children:`{${h}}`})]},o)}return u&&r?g.jsxs("span",{className:"flex items-center",children:[f,g.jsx(Qt,{to:a,className:"text-amber-400 hover:text-amber-300 font-medium transition-colors",children:s})]},o):g.jsxs("span",{className:"flex items-center",children:[f,g.jsx("span",{className:"text-slate-500",children:s})]},o)}),r&&g.jsxs("span",{className:"flex items-center",children:[g.jsx("span",{className:"text-slate-700 mx-0.5",children:"/"}),g.jsx("span",{className:"text-slate-300 font-mono",title:r,children:r.length>16?`${r.slice(0,14)}…`:r})]})]})}function Wu({fields:t,values:e,onChange:r,errors:a}){return g.jsx("div",{className:"space-y-4",children:t.map(i=>g.jsx(QT,{field:i,value:e[i.name],error:a==null?void 0:a[i.name],onChange:s=>r({...e,[i.name]:s})},i.name))})}function QT({field:t,value:e,error:r,onChange:a}){const i=`${t.name}${t.required?"":" (optional)"}`;return t.type==="string"?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("input",{type:"text",value:e??"",onChange:s=>a(s.target.value),placeholder:t.pattern?`Pattern: ${t.pattern}`:void 0,minLength:t.minLength,maxLength:t.maxLength,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),t.minLength!==void 0&&g.jsxs("p",{className:"text-[10px] text-slate-600 mt-0.5",children:["Min length: ",t.minLength]}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="number"?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("input",{type:"number",value:e!=null?String(e):"",onChange:s=>{const o=s.target.value;if(o==="")return a(void 0);a(t.isInt?parseInt(o,10):parseFloat(o))},min:t.min,max:t.max,step:t.isInt?1:"any",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="boolean"?g.jsxs("div",{children:[g.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[g.jsx("input",{type:"checkbox",checked:!!e,onChange:s=>a(s.target.checked),className:"w-4 h-4 bg-slate-800 border-slate-700 rounded text-indigo-600 focus:ring-indigo-500"}),g.jsx("span",{className:"text-xs text-slate-400",children:i})]}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="enum"&&t.enumValues?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsxs("select",{value:e??"",onChange:s=>a(s.target.value||void 0),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:[g.jsx("option",{value:"",children:"Select..."}),t.enumValues.map(s=>g.jsx("option",{value:s,children:s},s))]}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="array"&&t.itemMeta?g.jsx(Lk,{field:t,value:e,onChange:a,error:r}):t.type==="object"&&t.fields?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("div",{className:"pl-4 border-l-2 border-slate-700",children:g.jsx(Wu,{fields:t.fields,values:e??{},onChange:s=>a(s)})}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("textarea",{value:e!==void 0?JSON.stringify(e,null,2):"",onChange:s=>{try{a(JSON.parse(s.target.value))}catch{}},rows:3,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors",placeholder:"JSON value"}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]})}function Lk({field:t,value:e,onChange:r,error:a}){const i=Array.isArray(e)?e:[],[s,o]=U.useState(!1),u=()=>{var m,y,x;const p=((m=t.itemMeta)==null?void 0:m.type)==="object"?{}:((y=t.itemMeta)==null?void 0:y.type)==="string"?"":((x=t.itemMeta)==null?void 0:x.type)==="number"?0:null;r([...i,p])},d=p=>{r(i.filter((m,y)=>y!==p))},f=(p,m)=>{r(i.map((y,x)=>x===p?m:y))},h=`${t.name}${t.required?"":" (optional)"}`;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("label",{className:"text-xs text-slate-400",children:h}),g.jsxs("button",{type:"button",onClick:()=>o(!s),className:"text-[10px] text-slate-600 hover:text-slate-400",children:["[",i.length," items] ",s?"+":"-"]})]}),!s&&g.jsxs("div",{className:"pl-4 border-l-2 border-slate-700 space-y-2",children:[i.map((p,m)=>g.jsxs("div",{className:"flex items-start gap-2",children:[g.jsx("span",{className:"text-[10px] text-slate-600 mt-2 w-4 shrink-0",children:m}),g.jsx("div",{className:"flex-1",children:t.itemMeta&&g.jsx(QT,{field:{...t.itemMeta,name:`${t.name}[${m}]`},value:p,onChange:y=>f(m,y)})}),g.jsx("button",{type:"button",onClick:()=>d(m),className:"text-slate-600 hover:text-red-400 transition-colors mt-2",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},m)),g.jsxs("button",{type:"button",onClick:u,className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add item"]})]}),a&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]})}function $T({collectionDef:t,params:e,existingDoc:r,onSaved:a,onCancel:i}){const s=!!r,[o,u]=U.useState((r==null?void 0:r.data)??{}),[d,f]=U.useState(r?JSON.stringify(r.data,null,2):"{}"),[h,p]=U.useState(null),[m,y]=U.useState(null),x=xt.createCollectionDoc.useMutation({onSuccess:N=>a(N.id),onError:N=>y(N.message)}),E=xt.updateCollectionDoc.useMutation({onSuccess:()=>a(r.id),onError:N=>y(N.message)}),w=x.isPending||E.isPending,T=t.hasSchema&&t.fields.length>0,C=()=>{y(null);let N;if(T)N=o;else try{N=JSON.parse(d),p(null)}catch{p("Invalid JSON");return}s?E.mutate({collectionName:t.name,params:e,docId:r.id,data:N}):x.mutate({collectionName:t.name,params:e,data:N})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsx("h2",{className:"text-sm font-semibold mb-1",children:s?`Edit Document: ${r.id}`:`New Document in ${t.name}`}),t.description&&g.jsx("p",{className:"text-xs text-slate-500 mb-4",children:t.description}),g.jsx("div",{className:"mb-5",children:T?g.jsx(Wu,{fields:t.fields,values:o,onChange:u}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:d,onChange:N=>{f(N.target.value),p(null)},rows:10,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs font-mono text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors resize-y",spellCheck:!1}),h&&g.jsx("p",{className:"mt-1 text-xs text-red-400",children:h})]})}),m&&g.jsx("div",{className:"mb-4 px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-400",children:m}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{onClick:C,disabled:w,className:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:w?"Saving...":s?"Save Changes":"Create Document"}),g.jsx("button",{onClick:i,disabled:w,className:"px-4 py-2 bg-slate-800 hover:bg-slate-700 disabled:opacity-50 text-slate-300 rounded-lg text-xs font-medium transition-colors",children:"Cancel"})]})]})}const Bm="firegraph:recents",Pk=20,zk=8;function _k(){try{const t=localStorage.getItem(Bm);return t?JSON.parse(t):[]}catch{return[]}}function Uk(t){try{localStorage.setItem(Bm,JSON.stringify(t))}catch{}}const YT=U.createContext(null);function qk({children:t}){const[e,r]=U.useState(_k),a=U.useCallback(u=>{r(d=>{const f=[{...u,timestamp:Date.now()},...d.filter(h=>h.url!==u.url)].slice(0,Pk);return Uk(f),f})},[]),i=U.useCallback(()=>{r([]);try{localStorage.removeItem(Bm)}catch{}},[]),s=U.useMemo(()=>e.slice(0,zk),[e]),o=U.useMemo(()=>({recents:e,displayRecents:s,addRecent:a,clearRecents:i}),[e,s,a,i]);return g.jsx(YT.Provider,{value:o,children:t})}function rh(){const t=U.useContext(YT);if(!t)throw new Error("useRecents must be used within a RecentsProvider");return t}const Ik=["==","!=","<","<=",">",">="];function Vk(t){if(t==="true")return!0;if(t==="false")return!1;const e=Number(t);return!isNaN(e)&&t!==""?e:t}function Fk({collectionDef:t,params:e,readonly:r}){const a=un(),[i,s]=U.useState(!1),[o,u]=U.useState(void 0),[d,f]=U.useState([]),[h,p]=U.useState(!1),{addRecent:m}=rh(),y=JSON.stringify(e);U.useEffect(()=>{u(void 0)},[t.name,y]),U.useEffect(()=>{f([]),p(!1)},[t.name]),U.useEffect(()=>{u(void 0)},[d]);const x=t.pathParams.filter(k=>!e[k]),[E,w]=U.useState(Object.fromEntries(t.pathParams.map(k=>[k,e[k]??""])));U.useEffect(()=>{w(Object.fromEntries(t.pathParams.map(k=>[k,e[k]??""])))},[t.name]);const T=x.length===0||x.every(k=>{var R;return(R=E[k])==null?void 0:R.trim()}),C={...e,...E},N=d.filter(k=>k.field&&k.value!==""),{data:A,isLoading:D,error:M,refetch:j}=xt.getCollectionDocs.useQuery({collectionName:t.name,params:C,cursor:o,limit:50,...N.length>0?{where:N}:{}},{enabled:T});if(U.useEffect(()=>{T&&m({type:"collection",label:t.name,sublabel:an(t.path,C),url:aa(an(t.path,C))})},[t.name,y]),x.length>0){const k=R=>{if(R.preventDefault(),!x.every(B=>{var L;return(L=E[B])==null?void 0:L.trim()}))return;const z={...e};for(const B of x)z[B]=E[B];a(aa(an(t.path,z)))};return g.jsxs("div",{className:"p-6 max-w-lg",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("h2",{className:"text-sm font-semibold text-slate-200",children:t.name}),t.description&&g.jsx("p",{className:"text-xs text-slate-500 mt-1",children:t.description}),g.jsx("p",{className:"text-xs text-slate-500 mt-1 font-mono",children:t.path})]}),g.jsxs("form",{onSubmit:k,className:"space-y-3",children:[x.map(R=>g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:R}),g.jsx("input",{type:"text",value:E[R]??"",onChange:z=>w(B=>({...B,[R]:z.target.value})),placeholder:`Enter ${R}...`,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-indigo-500 transition-colors"})]},R)),g.jsx("button",{type:"submit",disabled:!x.every(R=>{var z;return(z=E[R])==null?void 0:z.trim()}),className:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:"Browse"})]})]})}return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("div",{className:"mb-1.5",children:g.jsx(GT,{collectionDef:t,params:C})}),g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx("h1",{className:"text-xl font-bold",children:t.name}),g.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-amber-500/15 text-amber-400",children:"collection"}),!r&&!i&&g.jsxs("button",{onClick:()=>s(!0),className:"ml-auto flex items-center gap-1.5 px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"New Document"]})]}),t.description&&g.jsx("p",{className:"text-sm text-slate-400",children:t.description})]}),i&&g.jsx("div",{className:"mb-6",children:g.jsx($T,{collectionDef:t,params:C,onSaved:k=>{s(!1),j(),a(aa(an(t.path,C),`doc/${encodeURIComponent(k)}`))},onCancel:()=>s(!1)})}),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800",children:[g.jsxs("div",{className:"px-5 py-3 border-b border-slate-800",children:[g.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[g.jsxs("button",{onClick:()=>p(!h),className:`px-2 py-1 rounded text-xs flex items-center gap-1.5 transition-colors ${h||d.length>0?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"bg-slate-800 border border-slate-700 text-slate-300 hover:bg-slate-700"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",N.length>0&&g.jsx("span",{className:"bg-indigo-500 text-white text-[10px] w-4 h-4 rounded-full inline-flex items-center justify-center font-bold",children:N.length})]}),N.length>0&&!h&&g.jsxs(g.Fragment,{children:[d.map((k,R)=>!k.field||k.value===""?null:g.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-600/20 text-indigo-300 rounded text-xs",children:[k.field," ",k.op," ",g.jsx("span",{className:"text-indigo-200",children:String(k.value)}),g.jsx("button",{onClick:()=>f(z=>z.filter((B,L)=>L!==R)),className:"ml-0.5 text-indigo-400 hover:text-indigo-200",children:"×"})]},R)),g.jsx("button",{onClick:()=>f([]),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"Clear all"})]})]}),h&&g.jsx("div",{className:"mt-2",children:g.jsx(Hk,{filters:d,onFiltersChange:f,fieldMetas:t.fields})})]}),g.jsxs("div",{className:"overflow-auto",children:[D&&g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"w-6 h-6 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})}),M&&g.jsx("div",{className:"px-5 py-4 text-sm text-red-400",children:M.message}),A&&A.documents.length===0&&g.jsxs("div",{className:"px-5 py-8 text-center text-xs text-slate-500",children:["No documents found",N.length>0&&g.jsx("span",{className:"block mt-1",children:"(try adjusting or clearing filters)"}),t.typeField&&N.length===0&&g.jsxs("span",{className:"block mt-1",children:["(filtered by ",t.typeField," = ",String(t.typeValue),")"]})]}),A&&A.documents.length>0&&g.jsxs("table",{className:"w-full min-w-[480px] text-xs",children:[g.jsx("thead",{className:"sticky top-0 bg-slate-900 border-b border-slate-800",children:g.jsxs("tr",{children:[g.jsx("th",{className:"px-5 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-48",children:"ID"}),t.fields.slice(0,3).map(k=>g.jsx("th",{className:"px-4 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:k.name},k.name)),t.fields.length===0&&g.jsx("th",{className:"px-4 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Data"})]})}),g.jsx("tbody",{className:"divide-y divide-slate-800/50",children:A.documents.map(k=>g.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors cursor-pointer",children:[g.jsx("td",{className:"px-5 py-2.5",children:g.jsx(Qt,{to:aa(an(t.path,C),`doc/${encodeURIComponent(k.id)}`),className:"text-indigo-400 hover:text-indigo-300 font-mono transition-colors",children:k.id.length>16?`${k.id.slice(0,14)}…`:k.id})}),t.fields.slice(0,3).map(R=>g.jsx("td",{className:"px-4 py-2.5 text-slate-400 truncate max-w-xs",children:k.data[R.name]!==void 0?String(k.data[R.name]):g.jsx("span",{className:"text-slate-600",children:"—"})},R.name)),t.fields.length===0&&g.jsx("td",{className:"px-4 py-2.5 text-slate-600 font-mono text-[10px] truncate max-w-xs",children:UT(k.data,60)})]},k.id))})]})]}),(A==null?void 0:A.hasMore)&&g.jsx("div",{className:"px-5 py-3 border-t border-slate-800",children:g.jsx("button",{onClick:()=>u(A.nextCursor??void 0),className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:"Load more →"})})]})]})}function Hk({filters:t,onFiltersChange:e,fieldMetas:r}){const a=r.map(d=>d.name),i=t.filter(d=>d.field&&d.value!=="").length,s=()=>{var p;const d=a[0]??"",f=r.find(m=>m.name===d);let h="";(f==null?void 0:f.type)==="boolean"?h=!0:(f==null?void 0:f.type)==="enum"&&((p=f.enumValues)!=null&&p.length)&&(h=f.enumValues[0]),e([...t,{field:d,op:"==",value:h}])},o=(d,f)=>{const h=[...t];h[d]={...h[d],...f},e(h)},u=d=>{e(t.filter((f,h)=>h!==d))};return g.jsxs("div",{className:"border-t border-slate-700/50 pt-2 space-y-1.5",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Where"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:t.length===0?'No filters — click "Add filter" to start':i>0?`${i} active filter${i>1?"s":""}${t.length>i?` (${t.length-i} incomplete)`:""}`:`${t.length} filter${t.length>1?"s":""} (none active yet)`}),t.length>0&&g.jsx("button",{onClick:()=>e([]),className:"text-[10px] text-red-400/60 hover:text-red-400 transition-colors ml-auto",children:"Clear all"})]}),t.map((d,f)=>g.jsx(Gk,{index:f,clause:d,fieldMetas:r,fieldNames:a,onUpdate:h=>o(f,h),onRemove:()=>u(f)},f)),g.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors py-1",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add filter"]})]})}function Gk({index:t,clause:e,fieldMetas:r,fieldNames:a,onUpdate:i,onRemove:s}){var E;const o=r.find(w=>w.name===e.field),[u,d]=U.useState(String(e.value)),f=U.useRef(null);U.useEffect(()=>{d(String(e.value))},[e.value]);const h=()=>{const w=Vk(u.trim());w!==e.value&&i({value:w})},p=w=>{var N;const T=r.find(A=>A.name===w);let C="";(T==null?void 0:T.type)==="boolean"?C=!0:(T==null?void 0:T.type)==="enum"&&((N=T.enumValues)!=null&&N.length)&&(C=T.enumValues[0]),i({field:w,value:C}),d(String(C))},m=(o==null?void 0:o.type)==="enum"&&((E=o.enumValues)==null?void 0:E.length),y=(o==null?void 0:o.type)==="boolean",x=m||y;return g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-[10px] text-slate-600 w-8 shrink-0 text-right",children:t===0?"":"AND"}),a.length>0?g.jsx("select",{value:e.field,onChange:w=>p(w.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:a.map(w=>g.jsx("option",{value:w,children:w},w))}):g.jsx("input",{type:"text",value:e.field,onChange:w=>i({field:w.target.value}),placeholder:"field",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-28"}),g.jsx("select",{value:e.op,onChange:w=>i({op:w.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500 w-14",children:Ik.map(w=>g.jsx("option",{value:w,children:w},w))}),m?g.jsx("select",{value:String(e.value),onChange:w=>i({value:w.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:o.enumValues.map(w=>g.jsx("option",{value:w,children:w},w))}):y?g.jsxs("select",{value:String(e.value),onChange:w=>i({value:w.target.value==="true"}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"true",children:"true"}),g.jsx("option",{value:"false",children:"false"})]}):g.jsx("input",{ref:f,type:"text",value:u,onChange:w=>d(w.target.value),onBlur:h,onKeyDown:w=>{var T;w.key==="Enter"&&(h(),(T=f.current)==null||T.blur())},placeholder:"value (Enter to apply)",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-36"}),o&&g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:o.type}),!x&&u!==String(e.value)&&u.trim()!==""&&g.jsx("span",{className:"text-[9px] text-amber-500 shrink-0",title:"Press Enter to apply",children:"pending"}),g.jsx("button",{onClick:s,className:"text-slate-600 hover:text-red-400 transition-colors p-0.5 shrink-0",title:"Remove filter",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}function Qk({tagName:t,data:e,className:r,onError:a}){const i=U.useRef(null),s=U.useRef(null),o=U.useRef(a);return o.current=a,U.useEffect(()=>{var d,f;const u=i.current;if(u)try{if(!customElements.get(t)){console.warn(`[CustomView] <${t}> is not registered, falling back to JSON.`),s.current=null,(d=o.current)==null||d.call(o);return}if(!s.current||s.current.tagName.toLowerCase()!==t){u.innerHTML="";const h=document.createElement(t);h.style.display="block",u.appendChild(h),s.current=h}s.current.data=e}catch(h){console.error(`[CustomView] Error rendering <${t}>:`,h),u.innerHTML="",s.current=null,(f=o.current)==null||f.call(o)}},[t,e]),U.useEffect(()=>()=>{i.current&&(i.current.innerHTML=""),s.current=null},[]),g.jsx("div",{ref:i,className:r})}class $k extends U.Component{constructor(){super(...arguments);kp(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r){var a,i;console.error("[CustomView] Boundary caught error:",r),(i=(a=this.props).onError)==null||i.call(a)}render(){return this.state.error?null:this.props.children}}function Jn(t){return g.jsx($k,{...t,children:g.jsx(Qk,{...t})})}function Oa({data:t,defaultExpanded:e=!0,depth:r=0}){const[a,i]=U.useState(e&&r<2);if(t===null)return g.jsx("span",{className:"text-slate-500",children:"null"});if(t===void 0)return g.jsx("span",{className:"text-slate-500",children:"undefined"});if(typeof t=="string")return g.jsxs("span",{className:"text-emerald-400",children:['"',t,'"']});if(typeof t=="number")return g.jsx("span",{className:"text-amber-400",children:t});if(typeof t=="boolean")return g.jsx("span",{className:"text-violet-400",children:String(t)});if(Array.isArray(t))return t.length===0?g.jsx("span",{className:"text-slate-500",children:"[]"}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>i(!a),className:"text-slate-500 hover:text-slate-300 transition-colors",children:a?"[▾":`[▸ ${t.length} items]`}),a&&g.jsx("div",{className:"ml-4 border-l border-slate-800 pl-3",children:t.map((s,o)=>g.jsxs("div",{className:"py-0.5",children:[g.jsx("span",{className:"text-slate-600 text-xs mr-2",children:o}),g.jsx(Oa,{data:s,depth:r+1}),o<t.length-1&&g.jsx("span",{className:"text-slate-600",children:","})]},o))}),a&&g.jsx("span",{className:"text-slate-500",children:"]"})]});if(typeof t=="object"){const s=Object.entries(t);return s.length===0?g.jsx("span",{className:"text-slate-500",children:"{}"}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>i(!a),className:"text-slate-500 hover:text-slate-300 transition-colors",children:a?"{▾":`{▸ ${s.length} keys}`}),a&&g.jsx("div",{className:"ml-4 border-l border-slate-800 pl-3",children:s.map(([o,u],d)=>g.jsxs("div",{className:"py-0.5",children:[g.jsx("span",{className:"text-cyan-400",children:o}),g.jsx("span",{className:"text-slate-600",children:": "}),g.jsx(Oa,{data:u,depth:r+1}),d<s.length-1&&g.jsx("span",{className:"text-slate-600",children:","})]},o))}),a&&g.jsx("span",{className:"text-slate-500",children:"}"})]})}return g.jsx("span",{className:"text-slate-400",children:String(t)})}function Ao({views:t,activeView:e,onSwitch:r}){return t.length===0?null:g.jsxs("select",{value:e,onChange:a=>r(a.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"json",children:"JSON"}),t.map(a=>g.jsx("option",{value:a.tagName,children:a.viewName},a.tagName))]})}function Yk({collectionDef:t,docId:e,params:r,readonly:a,viewRegistry:i}){var N,A;const s=un(),[o,u]=U.useState(!1),[d,f]=U.useState(!1),[h,p]=U.useState("json"),{addRecent:m}=rh();U.useEffect(()=>{p("json")},[e,t.name]);const y=((A=(N=i==null?void 0:i.collections)==null?void 0:N[t.name])==null?void 0:A.views)??[],{data:x,isLoading:E,error:w,refetch:T}=xt.getCollectionDoc.useQuery({collectionName:t.name,params:r,docId:e});U.useEffect(()=>{x&&m({type:"collection-doc",label:e,sublabel:t.name,url:aa(an(t.path,r),`doc/${encodeURIComponent(e)}`)})},[e,t.name]);const C=xt.deleteCollectionDoc.useMutation({onSuccess:()=>{s(aa(an(t.path,r)))},onError:D=>alert(`Delete failed: ${D.message}`)});return E?g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"w-6 h-6 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})}):w?g.jsx("div",{className:"px-6 py-4 text-sm text-red-400",children:w.message}):x?g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("div",{className:"mb-3",children:g.jsx(GT,{collectionDef:t,params:r,docId:e})}),g.jsxs("div",{className:"flex items-start justify-between gap-4",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-amber-500/20 text-amber-400 shrink-0",children:t.name}),g.jsx("h1",{className:"text-xl font-bold font-mono text-slate-200",children:e})]}),g.jsx("p",{className:"text-xs text-slate-500 font-mono",children:an(t.path,r)})]}),!a&&!o&&g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),"Edit"]}),d?g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-xs text-slate-400",children:"Confirm?"}),g.jsx("button",{onClick:()=>C.mutate({collectionName:t.name,params:r,docId:e}),disabled:C.isPending,className:"px-2 py-1 bg-red-600 hover:bg-red-500 disabled:opacity-50 text-white rounded text-xs transition-colors",children:C.isPending?"...":"Yes, delete"}),g.jsx("button",{onClick:()=>f(!1),className:"px-2 py-1 bg-slate-800 hover:bg-slate-700 text-slate-400 rounded text-xs transition-colors",children:"Cancel"})]}):g.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-600/20 hover:bg-red-600/30 text-red-400 rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]})]})]}),o?g.jsx("div",{className:"mb-6",children:g.jsx($T,{collectionDef:t,params:r,existingDoc:{id:x.id,data:x.data},onSaved:()=>{u(!1),T()},onCancel:()=>u(!1)})}):g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsx("h2",{className:"text-sm font-semibold text-slate-200",children:"Data"}),y.length>0&&g.jsx(Ao,{views:y,activeView:h,onSwitch:p})]}),h!=="json"?g.jsx(Jn,{tagName:h,data:x.data,onError:()=>p("json")}):g.jsx(g.Fragment,{children:t.fields.length>0?g.jsxs("div",{children:[t.fields.map(D=>g.jsxs("div",{className:"flex gap-3 py-2 border-b border-slate-800/50",children:[g.jsx("span",{className:"text-xs text-slate-500 w-36 shrink-0 font-mono",children:D.name}),g.jsx("span",{className:"text-xs text-slate-300 break-all",children:x.data[D.name]!==void 0?typeof x.data[D.name]=="object"?g.jsx("code",{className:"text-[10px] font-mono text-slate-400",children:JSON.stringify(x.data[D.name])}):String(x.data[D.name]):g.jsx("span",{className:"text-slate-600",children:"—"})})]},D.name)),Object.entries(x.data).filter(([D])=>!t.fields.some(M=>M.name===D)).map(([D,M])=>g.jsxs("div",{className:"flex gap-3 py-2 border-b border-slate-800/50",children:[g.jsx("span",{className:"text-xs text-slate-600 w-36 shrink-0 font-mono",children:D}),g.jsx("span",{className:"text-xs text-slate-500 break-all",children:typeof M=="object"?g.jsx("code",{className:"text-[10px] font-mono",children:JSON.stringify(M)}):String(M)})]},D))]}):g.jsx(Oa,{data:x.data})})]})]}):null}const U2={edges:[],hasMore:!1,loading:!1},Lm=U.createContext(null);function Kk({children:t}){const[e,r]=U.useState(null),[a,i]=U.useState({out:U2,in:U2}),s=U.useRef(null),o=U.useCallback(p=>{s.current=p},[]),u=U.useCallback(p=>{var m;(m=s.current)==null||m.peek(p)},[]),d=U.useCallback(()=>{var p;(p=s.current)==null||p.clearPeek()},[]),f=U.useCallback((p,m)=>{i(y=>({...y,[p]:m}))},[]),h=U.useMemo(()=>({focused:e,setFocused:r,onPeekNearby:u,onClearPeek:d,registerCallbacks:o,edgeResults:a,setEdgeResults:f}),[e,r,u,d,o,a,f]);return g.jsx(Lm.Provider,{value:h,children:t})}function Xk(){const t=U.useContext(Lm);if(!t)throw new Error("useFocus must be used within a FocusProvider");return t}function Ro(){return U.useContext(Lm)}function q2({title:t,message:e,confirmLabel:r="Delete",onConfirm:a,onCancel:i,loading:s,requireConfirmText:o}){const[u,d]=U.useState(""),f=!o||u===o;return Ku.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:i,children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-sm w-full mx-4 shadow-2xl",onClick:h=>h.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),g.jsx("p",{className:"text-sm text-slate-400 mb-4",children:e}),o&&g.jsxs("div",{className:"mb-4",children:[g.jsxs("p",{className:"text-xs text-slate-500 mb-2",children:["Type ",g.jsx("span",{className:"font-mono text-slate-300",children:o})," to confirm:"]}),g.jsx("input",{type:"text",value:u,onChange:h=>d(h.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono focus:outline-none focus:border-red-500/50 placeholder:text-slate-600",placeholder:o,autoFocus:!0,onKeyDown:h=>{h.key==="Enter"&&f&&!s&&a()}})]}),g.jsxs("div",{className:"flex justify-end gap-3",children:[g.jsx("button",{onClick:i,disabled:s,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"}),g.jsxs("button",{onClick:a,disabled:s||!f,className:"px-4 py-2 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[s&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),r]})]})]})}),document.body)}let Pm=0;function Ps(){return`lane-${++Pm}`}function Lf(t){return{uid:t,nodeType:"",edgeType:"",direction:"out"}}function Zk(t,e){switch(e.type){case"RESET":{Pm=0;const r=Ps();return{lanes:[{id:r,frames:[Lf(e.rootUid)]}],activeLaneId:r,previewLaneId:void 0}}case"EXTEND_LANE":return{lanes:t.lanes.map(r=>r.id===e.laneId?{...r,frames:[...r.frames,e.frame]}:r),activeLaneId:e.laneId};case"EXTEND_PATH":return{lanes:t.lanes.map(r=>r.id===e.laneId?{...r,frames:[...r.frames,...e.frames]}:r),activeLaneId:e.laneId};case"FORK_AND_DRILL":{const r=t.lanes.find(i=>i.id===e.fromLaneId);if(!r)return t;const a={id:e.newLaneId,frames:[...r.frames.slice(0,e.fromIndex+1),e.frame]};return{lanes:[...t.lanes,a],activeLaneId:e.newLaneId}}case"FORK_AND_DRILL_PATH":{const r=t.lanes.find(i=>i.id===e.fromLaneId);if(!r)return t;const a={id:e.newLaneId,frames:[...r.frames.slice(0,e.fromIndex+1),...e.frames]};return{lanes:[...t.lanes,a],activeLaneId:e.newLaneId}}case"CREATE_LANE":return{lanes:[...t.lanes,{id:e.newLaneId,frames:e.frames}],activeLaneId:e.newLaneId};case"POP_TO":return{lanes:t.lanes.map(r=>r.id===e.laneId?{...r,frames:r.frames.slice(0,e.index+1)}:r),activeLaneId:e.laneId};case"CLOSE_LANE":{const r=t.lanes.filter(a=>a.id!==e.laneId);if(r.length===0){const a=Ps();return{lanes:[{id:a,frames:[Lf(e.rootUid)]}],activeLaneId:a}}return{lanes:r,activeLaneId:t.activeLaneId===e.laneId?r[0].id:t.activeLaneId}}case"SWITCH_LANE":return{...t,activeLaneId:e.laneId};case"SET_ROOT_TYPE":return{...t,lanes:t.lanes.map(r=>{var i;if(((i=r.frames[0])==null?void 0:i.nodeType)===e.nodeType)return r;const a=[...r.frames];return a[0]={...a[0],nodeType:e.nodeType},{...r,frames:a}})};case"PREVIEW_FRAME":{let r=t.lanes;t.previewLaneId&&(r=r.map(i=>i.id===t.previewLaneId?{...i,frames:i.frames.slice(0,-1)}:i));const a=r.find(i=>i.id===e.laneId);return a&&a.frames.some(i=>i.uid===e.frame.uid)?{...t,lanes:r,previewLaneId:void 0}:{...t,lanes:r.map(i=>i.id===e.laneId?{...i,frames:[...i.frames,e.frame]}:i),previewLaneId:e.laneId}}case"CLEAR_PREVIEW":return t.previewLaneId?{...t,lanes:t.lanes.map(r=>r.id===t.previewLaneId?{...r,frames:r.frames.slice(0,-1)}:r),previewLaneId:void 0}:t;case"COMMIT_PREVIEW":return{...t,previewLaneId:void 0};default:return t}}const zm=U.createContext(null),_m=U.createContext(null);function Wk({rootUid:t,initialPaths:e,children:r}){const[a,i]=U.useReducer(Zk,{rootUid:t,initialPaths:e},M=>{if(Pm=0,M.initialPaths&&M.initialPaths.length>0){const k=M.initialPaths.map(R=>({id:Ps(),frames:[Lf(M.rootUid),...R]}));return{lanes:k,activeLaneId:k[0].id,previewLaneId:void 0}}const j=Ps();return{lanes:[{id:j,frames:[Lf(M.rootUid)]}],activeLaneId:j,previewLaneId:void 0}}),s=U.useRef(t);U.useEffect(()=>{s.current!==t&&(s.current=t,i({type:"RESET",rootUid:t}))},[t]);const o=U.useMemo(()=>a.lanes.find(M=>M.id===a.activeLaneId)??a.lanes[0],[a.lanes,a.activeLaneId]),u=U.useCallback(M=>{i({type:"EXTEND_LANE",laneId:a.activeLaneId,frame:M})},[a.activeLaneId]),d=U.useCallback(M=>{M.length!==0&&i({type:"EXTEND_PATH",laneId:a.activeLaneId,frames:M})},[a.activeLaneId]),f=U.useCallback((M,j)=>{i({type:"EXTEND_LANE",laneId:M,frame:j})},[]),h=U.useCallback((M,j)=>{j.length!==0&&i({type:"EXTEND_PATH",laneId:M,frames:j})},[]),p=U.useCallback((M,j,k)=>{const R=Ps();i({type:"FORK_AND_DRILL",fromLaneId:M,fromIndex:j,frame:k,newLaneId:R})},[]),m=U.useCallback((M,j,k)=>{if(k.length===0)return;const R=Ps();i({type:"FORK_AND_DRILL_PATH",fromLaneId:M,fromIndex:j,frames:k,newLaneId:R})},[]),y=U.useCallback(M=>{if(M.length===0)return;const j=Ps();i({type:"CREATE_LANE",newLaneId:j,frames:M})},[]),x=U.useCallback((M,j)=>{i({type:"POP_TO",laneId:M,index:j})},[]),E=U.useCallback(M=>{i({type:"CLOSE_LANE",laneId:M,rootUid:t})},[t]),w=U.useCallback(M=>{i({type:"SWITCH_LANE",laneId:M})},[]),T=U.useCallback(M=>{i({type:"SET_ROOT_TYPE",nodeType:M})},[]),C=U.useCallback(M=>{i({type:"PREVIEW_FRAME",laneId:a.activeLaneId,frame:M})},[a.activeLaneId]),N=U.useCallback(()=>{i({type:"CLEAR_PREVIEW"})},[]),A=U.useCallback(()=>{i({type:"COMMIT_PREVIEW"})},[]),D=U.useMemo(()=>({lanes:a.lanes,activeLaneId:a.activeLaneId,activeLane:o,activeIndex:o.frames.length-1,previewLaneId:a.previewLaneId,drillIn:u,drillPath:d,extendLane:f,extendPath:h,forkAndDrill:p,forkAndDrillPath:m,createLane:y,popTo:x,closeLane:E,switchLane:w,setRootType:T,previewFrame:C,clearPreview:N,commitPreview:A}),[a.lanes,a.activeLaneId,a.previewLaneId,o,u,d,f,h,p,m,y,x,E,w,T,C,N,A]);return g.jsx(zm.Provider,{value:D,children:r})}function ah(){const t=U.useContext(zm);if(!t)throw new Error("useDrill must be used within a DrillProvider");const e=U.useContext(_m);return e?{...t,...e}:t}function KT(){const t=U.useContext(zm),e=U.useContext(_m);return t?e?{...t,...e}:t:null}const Um=U.createContext(null);function Jk({children:t,graphCollection:e,collections:r}){const{encodedPath:a}=Dm(),i=un(),s=a??"",o=U.useMemo(()=>IT(s),[s]),u=U.useMemo(()=>{if(r){for(const A of r)if(Kg(o,A.path))return"collection"}return VT(o,e)?"graph":"unknown"},[o,e,r]),d=U.useMemo(()=>u==="graph"&&e?FT(o,e):"",[u,o,e]),f=U.useMemo(()=>HT(d),[d]),h=U.useMemo(()=>_2(d),[d]),p=U.useMemo(()=>{if(u!=="collection"||!r)return null;for(const A of r){const D=Kg(o,A.path);if(D)return{collection:A,params:D}}return null},[u,o,r]),m=U.useMemo(()=>`/${s}`,[s]),y=U.useCallback(A=>{if(!A)return m;const D=A.startsWith("/")?A.slice(1):A;return`${m}/${D}`},[m]),x=U.useCallback((A,D)=>{const M=o+"/"+A+"/"+D;i(`/${ya(M)}`)},[i,o]),E=U.useCallback(()=>{const A=o.split("/");if(A.length<=1){i("/");return}if(u==="graph"&&A.length>=3){const D=A.slice(0,-2).join("/");i(`/${ya(D)}`)}else i("/")},[i,o,u]),w=U.useCallback(()=>{i(e?`/${ya(e)}`:"/")},[i,e]),T=w,C=U.useCallback(A=>{if(!e){i("/");return}if(A===0){i(`/${ya(e)}`);return}const j=_2(d).slice(0,A).map(R=>`${R.parentUid}/${R.subgraphName}`).join("/"),k=j?`${e}/${j}`:e;i(`/${ya(k)}`)},[i,e,d]),N=U.useMemo(()=>({firestorePath:o,encodedPath:s,pathType:u,graphScope:d,scopeNamesPath:f,scopeSegments:h,collectionMatch:p,pathUrl:y,enterSubgraph:x,navigateUp:E,navigateToRoot:w,scopePath:d,isScoped:d!=="",scopedPath:y,scopeUrlPrefix:m,exitToRoot:T,popToDepth:C}),[o,s,u,d,f,h,p,y,x,E,w,m,T,C]);return g.jsx(Um.Provider,{value:N,children:t})}function XT(){const t=U.useContext(Um);if(!t)throw new Error("usePath must be used within a PathProvider");return t}function eD(){return U.useContext(Um)}const ba=XT;function tD(t){if(t.length===0||t[0].frames.length===0)return null;function e(r,a){const i=new Map;for(const s of r){if(a>=s.frames.length)continue;const o=s.frames[a].uid;i.has(o)||i.set(o,[]),i.get(o).push(s)}return Array.from(i.values()).map(s=>({frame:s[0].frames[a],depth:a,laneIds:s.map(o=>o.id),children:e(s,a+1)}))}return{frame:t[0].frames[0],depth:0,laneIds:t.map(r=>r.id),children:e(t,1)}}function rD({peek:t,onPeek:e,schema:r}){const a=un(),{lanes:i,activeLaneId:s,activeIndex:o,previewLaneId:u,popTo:d,closeLane:f,switchLane:h}=ah(),{scopedPath:p}=ba(),m=U.useMemo(()=>{const j={};for(const k of r.edgeTypes)k.inverseLabel&&(j[k.axbType]=k.inverseLabel);return j},[r.edgeTypes]),y=U.useMemo(()=>u?i.map(j=>j.id===u?{...j,frames:j.frames.slice(0,-1)}:j):i,[i,u]),x=U.useMemo(()=>tD(y),[y]);if(!(y.length>1||y.length===1&&y[0].frames.length>1)||!x)return null;const w=y.length>1,T=(t==null?void 0:t.laneId)??s,C=(t==null?void 0:t.frameIndex)??o;function N(j){return j.laneIds.includes(s)?s:j.laneIds[0]}function A(j){return g.jsx("span",{className:"text-slate-600 font-mono mx-0.5 shrink-0",children:j.direction==="out"?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-indigo-500/60",children:j.edgeType}),g.jsx("span",{className:"ml-0.5",children:"→"})]}):m[j.edgeType]?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-amber-500/60 cursor-help",title:`Inverse of: ${j.edgeType}`,children:m[j.edgeType]}),g.jsx("span",{className:"ml-0.5",children:"→"})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"mr-0.5",children:"←"}),g.jsx("span",{className:"text-indigo-500/60",children:j.edgeType})]})})}function D(j){const k=N(j),R=j.laneIds.includes(s)&&j.depth===o,z=j.laneIds.includes(T)&&j.depth===C;return g.jsxs("button",{onClick:()=>{R?a(p(`/node/${encodeURIComponent(j.frame.uid)}`)):(h(k),d(k,j.depth))},onMouseEnter:()=>e(k,j.depth),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors shrink-0 ${z?"bg-slate-800 text-slate-200":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/60"}`,children:[j.frame.nodeType&&g.jsx("span",{className:`px-1 py-px rounded text-[9px] font-mono ${nr(j.frame.nodeType)}`,children:j.frame.nodeType}),g.jsx("span",{className:"font-mono truncate max-w-[120px]",children:j.frame.uid})]})}function M(j,k){const R=[j];let z=j;for(;z.children.length===1;)z=z.children[0],R.push(z);return g.jsxs(g.Fragment,{children:[R.map((B,L)=>g.jsxs(U.Fragment,{children:[(L>0||!k)&&A(B.frame),D(B)]},B.depth)),z.children.length>1&&g.jsx("div",{className:"flex flex-col border-l border-slate-700/50 ml-1.5 my-0.5",children:z.children.map((B,L)=>{const q=B.laneIds.includes(s);return g.jsxs("div",{className:`flex items-center transition-opacity ${!q&&w?"opacity-50 hover:opacity-80":""}`,children:[g.jsx("span",{className:"w-2 h-px bg-slate-700/50 shrink-0"}),M(B,!1)]},L)})}),z.children.length===0&&w&&g.jsx("button",{onClick:B=>{B.stopPropagation(),f(z.laneIds[0])},className:"ml-1 text-slate-600 hover:text-slate-400 transition-colors shrink-0 text-sm leading-none",title:"Close this lane",children:"×"})]})}return g.jsx("nav",{className:"flex items-center px-4 py-2 bg-slate-900/80 border-b border-slate-800 overflow-x-auto overflow-y-auto max-h-32 text-xs",children:M(x,!0)})}function I2(t,e){const r=Math.min(t.length,e.length);for(let a=0;a<r;a++)if(t[a].uid!==e[a].uid)return a;return r}function aD({schema:t,viewRegistry:e,config:r,onDataChanged:a}){var J;const{lanes:i,activeLaneId:s,activeIndex:o,previewLaneId:u,previewFrame:d,clearPreview:f,extendLane:h,extendPath:p,forkAndDrill:m,createLane:y,switchLane:x,popTo:E}=ah(),w=Ro(),[T,C]=U.useState(null),N=U.useRef(null),A=U.useRef(new Set),[,D]=U.useState(0),M=U.useRef(new Map);U.useEffect(()=>{C(null)},[s]);const j=U.useRef(i);j.current=i;const k=U.useRef(s);k.current=s;const R=U.useRef(d);R.current=d;const z=U.useRef(f);z.current=f,U.useEffect(()=>{if(w)return w.registerCallbacks({peek:X=>{for(const Y of j.current){const le=Y.frames.findIndex(me=>me.uid===X.uid);if(le>=0){z.current(),C({laneId:Y.id,frameIndex:le});return}}C(null),R.current(X)},clearPeek:()=>{C(null),z.current()}}),()=>{w.registerCallbacks(null)}},[w]);const B=(T==null?void 0:T.laneId)??s,L=(T==null?void 0:T.frameIndex)??o,q=U.useMemo(()=>i.find(X=>X.id===B)??i[0],[i,B]),I=(J=q==null?void 0:q.frames[L])==null?void 0:J.uid,Q=U.useMemo(()=>{const X=new Set,Y=[];for(const le of i)for(const me of le.frames)X.has(me.uid)||(X.add(me.uid),Y.push(me.uid));return Y},[i]);U.useEffect(()=>{if(!I)return;const X=M.current.get(I);X&&(X.scrollTop=0)},[I]),U.useEffect(()=>{const X=Y=>{Y.key==="Escape"&&(T?C(null):o>0&&E(s,o-1))};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[T,o,s,E]);const _=U.useMemo(()=>{var Y;if(!u)return;const X=i.find(le=>le.id===u);return(Y=X==null?void 0:X.frames[X.frames.length-1])==null?void 0:Y.uid},[u,i]);U.useEffect(()=>{const X=new Set(Q);for(const Y of X)if(!A.current.has(Y)){Y!==_&&(N.current=Y,requestAnimationFrame(()=>{requestAnimationFrame(()=>{N.current=null,D(le=>le+1)})}));break}A.current=X},[Q,_]);const V=U.useCallback(X=>{var le;if(N.current===X)return"drill-frame drill-frame--entering";if(X===I)return"drill-frame drill-frame--active";if(_&&X===_)return"drill-frame drill-frame--behind";const Y=(le=q==null?void 0:q.frames[L+1])==null?void 0:le.uid;return X===Y?"drill-frame drill-frame--behind":"drill-frame drill-frame--hidden"},[I,_,q,L]),F=U.useMemo(()=>{const X=new Map;for(const Y of i)for(let le=0;le<Y.frames.length;le++){const me=Y.frames[le].uid;X.has(me)||X.set(me,{laneId:Y.id,index:le,isDrilled:le>0})}if(q)for(let Y=0;Y<q.frames.length;Y++){const le=q.frames[Y].uid;X.set(le,{laneId:q.id,index:Y,isDrilled:Y>0})}return X},[i,q]),K=U.useCallback(X=>{if(!q)return;const Y=q.frames.findIndex(le=>le.uid===X.uid);if(Y>=0){C({laneId:q.id,frameIndex:Y});return}L<q.frames.length-1?m(B,L,X):(B!==s&&x(B),h(B,X)),C(null)},[q,B,L,s,h,m,x]),ee=U.useCallback(X=>{if(X.length===0||!q)return;const Y=[...q.frames.slice(0,L+1),...X];for(const oe of i)if(I2(oe.frames,Y)>=Y.length){x(oe.id),oe.frames.length>Y.length&&E(oe.id,Y.length-1),C(null);return}let le=null,me=0;for(const oe of i){const ae=I2(oe.frames,Y);ae===oe.frames.length&&ae>me&&(le=oe,me=ae)}if(le){const oe=Y.slice(me);p(le.id,oe)}else y(Y);C(null)},[q,B,L,i,s,p,y,x,E]),P=U.useCallback((X,Y)=>{E(X,Y),C(null)},[E]),G=U.useMemo(()=>({drillIn:K,drillPath:ee,popTo:P}),[K,ee,P]),Z=U.useCallback((X,Y)=>{C({laneId:X,frameIndex:Y})},[]);return g.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[g.jsx(rD,{peek:T,onPeek:Z,schema:t}),g.jsx(_m.Provider,{value:G,children:g.jsx("div",{className:"drill-perspective flex-1",children:Q.map(X=>{const Y=F.get(X);return g.jsx("div",{ref:le=>{le?M.current.set(X,le):M.current.delete(X)},className:V(X),children:g.jsx(iz,{uid:X,schema:t,viewRegistry:e,config:r,onDataChanged:a,isDrilled:Y.isDrilled,drillIndex:Y.index,laneId:Y.laneId})},X)})})})]})}const nD=[10,25,50,100],iD=[{value:"aUid",label:"UID"},{value:"createdAt",label:"Created"},{value:"updatedAt",label:"Updated"}],sD=["==","!=","<","<=",">",">="];function lD(t){if(t==="true")return!0;if(t==="false")return!1;const e=Number(t);return!isNaN(e)&&t!==""?e:t}function ZT({type:t,schema:e,viewRegistry:r,config:a,onPick:i,compact:s=!1}){var oe,ae,re,se;const{scopePath:o,scopedPath:u}=ba(),d=s?10:25,[f,h]=U.useState(d),[p,m]=U.useState("aUid"),[y,x]=U.useState("asc"),[E,w]=U.useState([]),[T,C]=U.useState(!1),[N,A]=U.useState(1),[D,M]=U.useState([]),[j,k]=U.useState(void 0),R=E.filter(ie=>ie.field&&ie.value!==""),z={type:t,limit:f,sortBy:p,sortDir:y,startAfter:j,...R.length>0?{where:R}:{},...Zt(o)},{data:B,isLoading:L,error:q,refetch:I}=xt.getNodes.useQuery(z,{placeholderData:ie=>ie}),Q=(B==null?void 0:B.nodes)??[],_=(B==null?void 0:B.hasMore)??!1,V=(B==null?void 0:B.nextCursor)??null,F=(q==null?void 0:q.message)??null;U.useEffect(()=>{A(1),M([]),k(void 0)},[t,f,p,y,E,o]),U.useEffect(()=>{w([]),m("aUid"),x("asc"),C(!1)},[t]);const K=()=>{V&&(M(ie=>[...ie,V]),A(ie=>ie+1),k(V))},ee=()=>{if(N<=1)return;const ie=[...D];ie.pop();const Ne=ie.length>0?ie[ie.length-1]:void 0;M(ie),A(Ae=>Ae-1),k(Ne)},P=()=>{A(1),M([]),k(void 0),I()},G=(oe=e.nodeSchemas)==null?void 0:oe.find(ie=>ie.aType===t&&ie.isNodeEntry),Z=(G==null?void 0:G.fields)??[],J=Z.map(ie=>ie.name),X=[...iD,...Z.filter(ie=>ie.type==="string"||ie.type==="number"||ie.type==="boolean"||ie.type==="enum").map(ie=>({value:ie.name,label:`data.${ie.name}`}))],Y=((ae=r==null?void 0:r.nodes[t])==null?void 0:ae.views)??[],le=(se=(re=a==null?void 0:a.viewDefaults)==null?void 0:re.nodes)==null?void 0:se[t],me=s?[10,25,50]:nD;return g.jsxs("div",{children:[g.jsxs("div",{className:`bg-slate-900 rounded-xl border border-slate-800 ${s?"p-2":"p-3"} mb-4 space-y-3`,children:[g.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Show"}),g.jsx("select",{value:f,onChange:ie=>h(Number(ie.target.value)),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:me.map(ie=>g.jsx("option",{value:ie,children:ie},ie))})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Sort"}),g.jsx("select",{value:p,onChange:ie=>m(ie.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:X.map(ie=>g.jsx("option",{value:ie.value,children:ie.label},ie.value))}),g.jsx("button",{onClick:()=>x(ie=>ie==="asc"?"desc":"asc"),className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors",title:y==="asc"?"Ascending":"Descending",children:y==="asc"?"↑ Asc":"↓ Desc"})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:ee,disabled:N<=1||L,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Prev"}),g.jsxs("span",{className:"text-xs text-slate-400 px-1",children:["Page ",N]}),g.jsx("button",{onClick:K,disabled:!_||L,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("button",{onClick:()=>C(!T),className:`px-2 py-1 rounded text-xs flex items-center gap-1.5 transition-colors ${T||E.length>0?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"bg-slate-800 border border-slate-700 text-slate-300 hover:bg-slate-700"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",E.length>0&&g.jsx("span",{className:"bg-indigo-500 text-white text-[10px] w-4 h-4 rounded-full inline-flex items-center justify-center font-bold",children:E.length})]}),g.jsx("button",{onClick:P,disabled:L,className:"ml-auto px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-50",title:"Refresh",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),E.length>0&&!T&&g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Active"}),E.map((ie,Ne)=>g.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-600/20 text-indigo-300 rounded text-xs",children:[g.jsx("span",{className:"text-slate-400",children:"data."}),ie.field," ",ie.op," ",g.jsx("span",{className:"text-indigo-200",children:String(ie.value)}),g.jsx("button",{onClick:()=>w(Ae=>Ae.filter((Ze,Qe)=>Qe!==Ne)),className:"ml-0.5 text-indigo-400 hover:text-indigo-200",children:"×"})]},Ne)),g.jsx("button",{onClick:()=>w([]),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"Clear all"})]}),T&&g.jsx(oD,{filters:E,onFiltersChange:w,fieldMetas:Z,fieldNames:J})]}),F&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:F}),L?g.jsxs("div",{className:`flex items-center gap-2 text-slate-400 ${s?"py-6":"py-12"} justify-center`,children:[g.jsx("div",{className:"w-4 h-4 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-sm",children:"Loading nodes..."})]}):Q.length===0?g.jsx("div",{className:`text-center ${s?"py-6":"py-12"} text-slate-500`,children:g.jsxs("p",{children:["No nodes found",E.length>0?" matching filters":` of type "${t}"`]})}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:`bg-slate-900 rounded-xl border border-slate-800 overflow-x-auto ${s?"max-h-64 overflow-y-auto":""}`,children:g.jsxs("table",{className:"w-full min-w-[480px]",children:[g.jsx("thead",{children:g.jsxs("tr",{className:"border-b border-slate-800",children:[g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3",children:"UID"}),g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3",children:"Data"}),!s&&g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3 w-44",children:"Created"})]})}),g.jsx("tbody",{children:Q.map(ie=>g.jsxs("tr",{className:`border-b border-slate-800/50 transition-colors ${i?"hover:bg-indigo-600/10 cursor-pointer":"hover:bg-slate-800/30"}`,onClick:i?()=>i(ie.aUid):void 0,children:[g.jsx("td",{className:"px-4 py-3",children:i?g.jsx("span",{className:"text-sm font-mono text-indigo-400",children:ie.aUid}):g.jsx(Qt,{to:u(`/node/${encodeURIComponent(ie.aUid)}`),className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",children:ie.aUid})}),g.jsx("td",{className:"px-4 py-3",children:g.jsx(cD,{node:ie,views:Y,resolverConfig:le})}),!s&&g.jsx("td",{className:"px-4 py-3 text-xs text-slate-500",children:so(ie.createdAt)})]},ie.aUid))})]})}),!s&&g.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[g.jsxs("span",{className:"text-xs text-slate-500",children:[Q.length," result",Q.length!==1?"s":""," on this page"]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:ee,disabled:N<=1||L,className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Previous"}),g.jsxs("span",{className:"text-xs text-slate-400 px-2",children:["Page ",N]}),g.jsx("button",{onClick:K,disabled:!_||L,className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]})]})]})]})}function oD({filters:t,onFiltersChange:e,fieldMetas:r,fieldNames:a}){const i=()=>{var p;const d=a[0]??"",f=r.find(m=>m.name===d);let h="";(f==null?void 0:f.type)==="boolean"?h=!0:(f==null?void 0:f.type)==="enum"&&((p=f.enumValues)!=null&&p.length)&&(h=f.enumValues[0]),e([...t,{field:d,op:"==",value:h}])},s=d=>{e(t.filter((f,h)=>h!==d))},o=(d,f)=>{const h=[...t];h[d]={...h[d],...f},e(h)},u=d=>r.find(f=>f.name===d);return g.jsxs("div",{className:"border-t border-slate-700/50 pt-3 space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Where"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:t.length===0?'No filters — click "Add filter" to start':`${t.length} active filter${t.length>1?"s":""}`}),t.length>0&&g.jsx("button",{onClick:()=>e([]),className:"text-[10px] text-red-400/60 hover:text-red-400 transition-colors ml-auto",children:"Clear all"})]}),t.map((d,f)=>g.jsx(uD,{index:f,clause:d,fieldNames:a,fieldMeta:u(d.field),allFieldMetas:r,totalFilters:t.length,onUpdate:h=>o(f,h),onRemove:()=>s(f)},f)),g.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors py-1",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add filter"]})]})}function uD({index:t,clause:e,fieldNames:r,fieldMeta:a,allFieldMetas:i,totalFilters:s,onUpdate:o,onRemove:u}){var w;const[d,f]=U.useState(String(e.value)),h=U.useRef(null);U.useEffect(()=>{f(String(e.value))},[e.value]);const p=()=>{const T=lD(d.trim());T!==e.value&&o({value:T})},m=T=>{var A;const C=i.find(D=>D.name===T);let N="";(C==null?void 0:C.type)==="boolean"?N=!0:(C==null?void 0:C.type)==="enum"&&((A=C.enumValues)!=null&&A.length)&&(N=C.enumValues[0]),o({field:T,value:N}),f(String(N))},y=(a==null?void 0:a.type)==="enum"&&((w=a.enumValues)==null?void 0:w.length),x=(a==null?void 0:a.type)==="boolean",E=y||x;return g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-[10px] text-slate-600 w-8 shrink-0 text-right",children:t===0?"":"AND"}),r.length>0?g.jsx("select",{value:e.field,onChange:T=>m(T.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:r.map(T=>g.jsx("option",{value:T,children:T},T))}):g.jsx("input",{type:"text",value:e.field,onChange:T=>o({field:T.target.value}),onBlur:p,placeholder:"field",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-28"}),g.jsx("select",{value:e.op,onChange:T=>o({op:T.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500 w-14",children:sD.map(T=>g.jsx("option",{value:T,children:T},T))}),y?g.jsx("select",{value:String(e.value),onChange:T=>o({value:T.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:a.enumValues.map(T=>g.jsx("option",{value:T,children:T},T))}):x?g.jsxs("select",{value:String(e.value),onChange:T=>o({value:T.target.value==="true"}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"true",children:"true"}),g.jsx("option",{value:"false",children:"false"})]}):g.jsx("input",{ref:h,type:"text",value:d,onChange:T=>f(T.target.value),onBlur:p,onKeyDown:T=>{var C;T.key==="Enter"&&(p(),(C=h.current)==null||C.blur())},placeholder:"value (Enter to apply)",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-36"}),a&&g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:a.type}),!E&&d!==String(e.value)&&d.trim()!==""&&g.jsx("span",{className:"text-[9px] text-amber-500 shrink-0",title:"Press Enter to apply",children:"pending"}),g.jsx("button",{onClick:u,className:"text-slate-600 hover:text-red-400 transition-colors p-0.5 shrink-0",title:"Remove filter",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}function cD({node:t,views:e,resolverConfig:r}){const[a,i]=U.useState(!1);if(!a&&e.length>0){const s=nn(r,e,"listing");if(s!=="json"){const o=e.find(u=>u.viewName===s);if(o)return g.jsx("div",{children:g.jsx(Jn,{tagName:o.tagName,data:t.data,onError:()=>i(!0)})})}}return g.jsx("span",{className:"text-xs text-slate-400 font-mono",children:UT(t.data,100)})}function V2({schema:t,viewRegistry:e,config:r,defaultUid:a,defaultType:i,direction:s="out",onSaved:o,onCancel:u}){var Ne,Ae,Ze,Qe;const{scopePath:d}=ba(),f=t.edgeSchemas??[],h=t.nodeSchemas??[],p=U.useMemo(()=>i?s==="out"?f.filter(Se=>Se.aType===i):f.filter(Se=>Se.bType===i):f,[f,i,s]),[m,y]=U.useState(()=>{const Se=p[0];return Se?`${Se.aType}:${Se.axbType}:${Se.bType}`:""}),[x,E]=U.useState(""),[w,T]=U.useState("create"),[C,N]=U.useState({}),[A,D]=U.useState({}),[M,j]=U.useState(""),[k,R]=U.useState(null),[z,B]=U.useState(""),L=U.useMemo(()=>f.find(Se=>`${Se.aType}:${Se.axbType}:${Se.bType}`===m),[f,m]),q=s==="out"?L==null?void 0:L.bType:L==null?void 0:L.aType,I=U.useMemo(()=>h.find(Se=>Se.aType===q&&Se.isNodeEntry),[h,q]),Q=xt.checkNode.useQuery({uid:z,...Zt(d)},{enabled:!!z&&(w==="existing"||w==="manual")}),_=a&&z?s==="out"?a:z:"",V=a&&z?s==="out"?z:a:"",F=(L==null?void 0:L.axbType)??"",K=xt.checkEdge.useQuery({aUid:_,axbType:F,bUid:V,...Zt(d)},{enabled:!!_&&!!V&&!!F&&(w==="existing"||w==="manual")}),ee=Se=>{E(Se),B(Se)},P=U.useRef(null),G=()=>{const Se=x.trim();Se&&Se!==z&&B(Se)};U.useEffect(()=>{B("")},[w,m]);const Z=xt.createEdge.useMutation({onSuccess:()=>o(),onError:Se=>R(Se.message)}),J=xt.createEdgeWithNode.useMutation({onSuccess:()=>o(),onError:Se=>R(Se.message)}),X=Z.isPending||J.isPending,Y=Se=>{y(Se),N({}),D({}),E(""),j(""),B("")},le=()=>{if(!L||!a)return;R(null);const Se=L.aType,Oe=L.axbType,ke=L.bType,Pe=s==="out"?"b":"a";if(w==="create")J.mutate({aType:Se,axbType:Oe,bType:ke,newNodeSide:Pe,existingUid:a,newNodeUid:M||void 0,edgeData:C,nodeData:A,...Zt(d)});else{if(!x)return;Z.mutate({aType:Se,aUid:s==="out"?a:x,axbType:Oe,bType:ke,bUid:s==="out"?x:a,data:C,...Zt(d)})}},me=z&&((Ne=Q.data)==null?void 0:Ne.exists)===!0,oe=z&&((Ae=Q.data)==null?void 0:Ae.exists)===!1,ae=z&&Q.isLoading,re=z&&((Ze=K.data)==null?void 0:Ze.exists)===!0,se=!L||X?!1:w==="create"?!0:!(!x||oe),ie=q??"target";return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("h2",{className:"text-sm font-semibold mb-4",children:["Create ",s==="out"?"Outgoing":"Incoming"," Edge"]}),p.length>1&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Edge Type"}),g.jsx("select",{value:m,onChange:Se=>Y(Se.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:p.map(Se=>{const Oe=`${Se.aType}:${Se.axbType}:${Se.bType}`;return g.jsxs("option",{value:Oe,children:[Se.aType," —[",Se.axbType,"]→ ",Se.bType,Se.description?` — ${Se.description}`:""]},Oe)})})]}),L&&g.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs font-mono text-slate-400",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded ${nr(L.aType)}`,children:L.aType}),g.jsxs("span",{className:"text-slate-600",children:["—[",L.axbType,"]→"]}),g.jsx("span",{className:`px-1.5 py-0.5 rounded ${nr(L.bType)}`,children:L.bType})]}),g.jsxs("div",{className:"mb-4",children:[g.jsxs("label",{className:"block text-xs text-slate-400 mb-3",children:[s==="out"?"Target":"Source"," Node (",ie,")"]}),g.jsx("div",{className:"flex gap-4 border-b border-slate-700/50 mb-3 pt-1",children:["create","existing","manual"].map(Se=>g.jsxs("button",{onClick:()=>T(Se),className:`pb-2 text-xs transition-colors relative ${w===Se?"text-slate-200":"text-slate-500 hover:text-slate-300"}`,children:[Se==="create"?"Create new":Se==="existing"?"Select existing":"Enter UID",w===Se&&g.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-px bg-indigo-500"})]},Se))}),w==="create"&&q&&g.jsxs("div",{children:[g.jsxs("div",{className:"mb-3",children:[g.jsx("label",{className:"block text-[11px] text-slate-500 mb-1",children:"UID (optional, auto-generated if empty)"}),g.jsx("input",{type:"text",value:M,onChange:Se=>j(Se.target.value),placeholder:"Leave empty to auto-generate",className:"w-full max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),M&&g.jsx("p",{className:"mt-1.5 text-xs text-amber-400",children:"Custom UIDs can cause Firestore hotspots. Recommended to leave empty for auto-generated IDs."})]}),I&&I.fields.length>0?g.jsxs("div",{children:[g.jsxs("label",{className:"block text-[11px] text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:[q," Data"]}),g.jsx(Wu,{fields:I.fields,values:A,onChange:D})]}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:JSON.stringify(A,null,2),onChange:Se=>{try{D(JSON.parse(Se.target.value))}catch{}},rows:4,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]})]}),w==="existing"&&q&&g.jsxs("div",{children:[x&&g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx("span",{className:"text-[11px] text-slate-500",children:"Selected:"}),g.jsx("span",{className:"font-mono text-sm text-indigo-400",children:x}),g.jsx(F2,{checking:!!ae,valid:!!me,invalid:!!oe}),g.jsx("button",{onClick:()=>{E(""),B("")},className:"text-[11px] text-slate-500 hover:text-slate-300 transition-colors",children:"clear"})]}),x&&re&&g.jsx(H2,{}),!x&&g.jsx(ZT,{type:q,schema:t,viewRegistry:e,config:r,onPick:ee,compact:!0})]}),w==="manual"&&g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{ref:P,type:"text",value:x,onChange:Se=>E(Se.target.value),onBlur:G,onKeyDown:Se=>{var Oe;Se.key==="Enter"&&(G(),(Oe=P.current)==null||Oe.blur())},placeholder:`e.g., ${ie}1 (Enter to validate)`,className:"flex-1 max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),g.jsx(F2,{checking:!!ae,valid:!!me,invalid:!!oe})]}),oe&&g.jsxs("p",{className:"mt-1.5 text-xs text-red-400",children:['No node found with UID "',z,'"']}),me&&((Qe=Q.data)==null?void 0:Qe.node)&&Q.data.node.aType!==q&&g.jsxs("p",{className:"mt-1.5 text-xs text-amber-400",children:['Node exists but is type "',Q.data.node.aType,'" (expected "',q,'")']}),re&&g.jsx(H2,{})]})]}),L&&L.fields.length>0&&g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:"Edge Data"}),g.jsx(Wu,{fields:L.fields,values:C,onChange:N})]}),k&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:k}),g.jsxs("div",{className:"flex gap-3",children:[g.jsxs("button",{onClick:le,disabled:!se,className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[X&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),w==="create"?`Create ${ie} + Edge`:re?"Update Edge":"Create Edge"]}),g.jsx("button",{onClick:u,disabled:X,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"})]})]})}function F2({checking:t,valid:e,invalid:r}){return t?g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-slate-500 border-t-transparent rounded-full animate-spin shrink-0"}):e?g.jsx("svg",{className:"w-4 h-4 text-emerald-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):r?g.jsx("svg",{className:"w-4 h-4 text-red-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):null}function H2(){return g.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5 mb-2 text-xs text-amber-400",children:[g.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Edge already exists — submitting will update it"]})}function Xg(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function dD(t){if(Array.isArray(t))return t}function fD(t){if(Array.isArray(t))return Xg(t)}function cs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hD(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,JT(a.key),a)}}function ds(t,e,r){return e&&hD(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function xa(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=qm(t))||e){r&&(t=r);var a=0,i=function(){};return{s:i,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(d){throw d},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
80
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var d=r.next();return o=d.done,d},e:function(d){u=!0,s=d},f:function(){try{o||r.return==null||r.return()}finally{if(u)throw s}}}}function WT(t,e,r){return(e=JT(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vD(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function pD(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,i,s,o,u=[],d=!0,f=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;d=!1}else for(;!(d=(a=s.call(r)).done)&&(u.push(a.value),u.length!==e);d=!0);}catch(h){f=!0,i=h}finally{try{if(!d&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(f)throw i}}return u}}function gD(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
81
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mD(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
82
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mr(t,e){return dD(t)||pD(t,e)||qm(t,e)||gD()}function Pf(t){return fD(t)||vD(t)||qm(t)||mD()}function yD(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function JT(t){var e=yD(t,"string");return typeof e=="symbol"?e:e+""}function Er(t){"@babel/helpers - typeof";return Er=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},Er(t)}function qm(t,e){if(t){if(typeof t=="string")return Xg(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xg(t,e):void 0}}var wr=typeof window>"u"?null:window,G2=wr?wr.navigator:null;wr&&wr.document;var xD=Er(""),eC=Er({}),bD=Er(function(){}),wD=typeof HTMLElement>"u"?"undefined":Er(HTMLElement),Ec=function(e){return e&&e.instanceString&&Wt(e.instanceString)?e.instanceString():null},Xe=function(e){return e!=null&&Er(e)==xD},Wt=function(e){return e!=null&&Er(e)===bD},_t=function(e){return!Da(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},wt=function(e){return e!=null&&Er(e)===eC&&!_t(e)&&e.constructor===Object},SD=function(e){return e!=null&&Er(e)===eC},De=function(e){return e!=null&&Er(e)===Er(1)&&!isNaN(e)},ED=function(e){return De(e)&&Math.floor(e)===e},zf=function(e){if(wD!=="undefined")return e!=null&&e instanceof HTMLElement},Da=function(e){return Tc(e)||tC(e)},Tc=function(e){return Ec(e)==="collection"&&e._private.single},tC=function(e){return Ec(e)==="collection"&&!e._private.single},Im=function(e){return Ec(e)==="core"},rC=function(e){return Ec(e)==="stylesheet"},TD=function(e){return Ec(e)==="event"},rs=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},CD=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},ND=function(e){return wt(e)&&De(e.x1)&&De(e.x2)&&De(e.y1)&&De(e.y2)},jD=function(e){return SD(e)&&Wt(e.then)},AD=function(){return G2&&G2.userAgent.match(/msie|trident|edge/i)},Mo=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var s=[],o=0;o<arguments.length;o++)s.push(arguments[o]);return s.join("$")});var a=function(){var s=this,o=arguments,u,d=r.apply(s,o),f=a.cache;return(u=f[d])||(u=f[d]=e.apply(s,o)),u};return a.cache={},a},Vm=Mo(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),nh=Mo(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),aC=Mo(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),Q2=function(e){return rs(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Yi=function(e,r){return e.slice(-1*r.length)===r},Sr="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",MD="rgb[a]?\\(("+Sr+"[%]?)\\s*,\\s*("+Sr+"[%]?)\\s*,\\s*("+Sr+"[%]?)(?:\\s*,\\s*("+Sr+"))?\\)",kD="rgb[a]?\\((?:"+Sr+"[%]?)\\s*,\\s*(?:"+Sr+"[%]?)\\s*,\\s*(?:"+Sr+"[%]?)(?:\\s*,\\s*(?:"+Sr+"))?\\)",DD="hsl[a]?\\(("+Sr+")\\s*,\\s*("+Sr+"[%])\\s*,\\s*("+Sr+"[%])(?:\\s*,\\s*("+Sr+"))?\\)",OD="hsl[a]?\\((?:"+Sr+")\\s*,\\s*(?:"+Sr+"[%])\\s*,\\s*(?:"+Sr+"[%])(?:\\s*,\\s*(?:"+Sr+"))?\\)",RD="\\#[0-9a-fA-F]{3}",BD="\\#[0-9a-fA-F]{6}",nC=function(e,r){return e<r?-1:e>r?1:0},LD=function(e,r){return-1*nC(e,r)},tt=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s];t[o]=a[o]}}return t},PD=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,i,s,o=16;return r?(a=parseInt(e[1]+e[1],o),i=parseInt(e[2]+e[2],o),s=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),i=parseInt(e[3]+e[4],o),s=parseInt(e[5]+e[6],o)),[a,i,s]}},zD=function(e){var r,a,i,s,o,u,d,f;function h(x,E,w){return w<0&&(w+=1),w>1&&(w-=1),w<1/6?x+(E-x)*6*w:w<1/2?E:w<2/3?x+(E-x)*(2/3-w)*6:x}var p=new RegExp("^"+DD+"$").exec(e);if(p){if(a=parseInt(p[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,i=parseFloat(p[2]),i<0||i>100||(i=i/100,s=parseFloat(p[3]),s<0||s>100)||(s=s/100,o=p[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(i===0)u=d=f=Math.round(s*255);else{var m=s<.5?s*(1+i):s+i-s*i,y=2*s-m;u=Math.round(255*h(y,m,a+1/3)),d=Math.round(255*h(y,m,a)),f=Math.round(255*h(y,m,a-1/3))}r=[u,d,f,o]}return r},_D=function(e){var r,a=new RegExp("^"+MD+"$").exec(e);if(a){r=[];for(var i=[],s=1;s<=3;s++){var o=a[s];if(o[o.length-1]==="%"&&(i[s]=!0),o=parseFloat(o),i[s]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var u=i[1]||i[2]||i[3],d=i[1]&&i[2]&&i[3];if(u&&!d)return;var f=a[4];if(f!==void 0){if(f=parseFloat(f),f<0||f>1)return;r.push(f)}}return r},UD=function(e){return qD[e.toLowerCase()]},iC=function(e){return(_t(e)?e:null)||UD(e)||PD(e)||_D(e)||zD(e)},qD={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},sC=function(e){for(var r=e.map,a=e.keys,i=a.length,s=0;s<i;s++){var o=a[s];if(wt(o))throw Error("Tried to set map with object key");s<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},lC=function(e){for(var r=e.map,a=e.keys,i=a.length,s=0;s<i;s++){var o=a[s];if(wt(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},ef=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hp,$2;function Nc(){if($2)return Hp;$2=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Hp=t,Hp}var Gp,Y2;function ID(){if(Y2)return Gp;Y2=1;var t=typeof ef=="object"&&ef&&ef.Object===Object&&ef;return Gp=t,Gp}var Qp,K2;function ih(){if(K2)return Qp;K2=1;var t=ID(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Qp=r,Qp}var $p,X2;function VD(){if(X2)return $p;X2=1;var t=ih(),e=function(){return t.Date.now()};return $p=e,$p}var Yp,Z2;function FD(){if(Z2)return Yp;Z2=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return Yp=e,Yp}var Kp,W2;function HD(){if(W2)return Kp;W2=1;var t=FD(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return Kp=r,Kp}var Xp,J2;function Fm(){if(J2)return Xp;J2=1;var t=ih(),e=t.Symbol;return Xp=e,Xp}var Zp,ew;function GD(){if(ew)return Zp;ew=1;var t=Fm(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,i=t?t.toStringTag:void 0;function s(o){var u=r.call(o,i),d=o[i];try{o[i]=void 0;var f=!0}catch{}var h=a.call(o);return f&&(u?o[i]=d:delete o[i]),h}return Zp=s,Zp}var Wp,tw;function QD(){if(tw)return Wp;tw=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return Wp=r,Wp}var Jp,rw;function oC(){if(rw)return Jp;rw=1;var t=Fm(),e=GD(),r=QD(),a="[object Null]",i="[object Undefined]",s=t?t.toStringTag:void 0;function o(u){return u==null?u===void 0?i:a:s&&s in Object(u)?e(u):r(u)}return Jp=o,Jp}var e0,aw;function $D(){if(aw)return e0;aw=1;function t(e){return e!=null&&typeof e=="object"}return e0=t,e0}var t0,nw;function jc(){if(nw)return t0;nw=1;var t=oC(),e=$D(),r="[object Symbol]";function a(i){return typeof i=="symbol"||e(i)&&t(i)==r}return t0=a,t0}var r0,iw;function YD(){if(iw)return r0;iw=1;var t=HD(),e=Nc(),r=jc(),a=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(r(f))return a;if(e(f)){var h=typeof f.valueOf=="function"?f.valueOf():f;f=e(h)?h+"":h}if(typeof f!="string")return f===0?f:+f;f=t(f);var p=s.test(f);return p||o.test(f)?u(f.slice(2),p?2:8):i.test(f)?a:+f}return r0=d,r0}var a0,sw;function KD(){if(sw)return a0;sw=1;var t=Nc(),e=VD(),r=YD(),a="Expected a function",i=Math.max,s=Math.min;function o(u,d,f){var h,p,m,y,x,E,w=0,T=!1,C=!1,N=!0;if(typeof u!="function")throw new TypeError(a);d=r(d)||0,t(f)&&(T=!!f.leading,C="maxWait"in f,m=C?i(r(f.maxWait)||0,d):m,N="trailing"in f?!!f.trailing:N);function A(q){var I=h,Q=p;return h=p=void 0,w=q,y=u.apply(Q,I),y}function D(q){return w=q,x=setTimeout(k,d),T?A(q):y}function M(q){var I=q-E,Q=q-w,_=d-I;return C?s(_,m-Q):_}function j(q){var I=q-E,Q=q-w;return E===void 0||I>=d||I<0||C&&Q>=m}function k(){var q=e();if(j(q))return R(q);x=setTimeout(k,M(q))}function R(q){return x=void 0,N&&h?A(q):(h=p=void 0,y)}function z(){x!==void 0&&clearTimeout(x),w=0,h=E=p=x=void 0}function B(){return x===void 0?y:R(e())}function L(){var q=e(),I=j(q);if(h=arguments,p=this,E=q,I){if(x===void 0)return D(E);if(C)return clearTimeout(x),x=setTimeout(k,d),A(E)}return x===void 0&&(x=setTimeout(k,d)),y}return L.cancel=z,L.flush=B,L}return a0=o,a0}var XD=KD(),Ac=Cc(XD),n0=wr?wr.performance:null,uC=n0&&n0.now?function(){return n0.now()}:function(){return Date.now()},ZD=(function(){if(wr){if(wr.requestAnimationFrame)return function(t){wr.requestAnimationFrame(t)};if(wr.mozRequestAnimationFrame)return function(t){wr.mozRequestAnimationFrame(t)};if(wr.webkitRequestAnimationFrame)return function(t){wr.webkitRequestAnimationFrame(t)};if(wr.msRequestAnimationFrame)return function(t){wr.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(uC())},1e3/60)}})(),_f=function(e){return ZD(e)},ei=uC,zs=9261,cC=65599,to=5381,dC=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zs,a=r,i;i=e.next(),!i.done;)a=a*cC+i.value|0;return a},Ju=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zs;return r*cC+e|0},ec=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:to;return(r<<5)+r+e|0},WD=function(e,r){return e*2097152+r},Oi=function(e){return e[0]*2097152+e[1]},tf=function(e,r){return[Ju(e[0],r[0]),ec(e[1],r[1])]},lw=function(e,r){var a={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?a.value=e[i++]:a.done=!0,a}};return dC(o,r)},Ws=function(e,r){var a={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?a.value=e.charCodeAt(i++):a.done=!0,a}};return dC(o,r)},fC=function(){return JD(arguments)},JD=function(e){for(var r,a=0;a<e.length;a++){var i=e[a];a===0?r=Ws(i):r=Ws(i,r)}return r};function eO(t,e,r,a,i){var s=i*Math.PI/180,o=Math.cos(s)*(t-r)-Math.sin(s)*(e-a)+r,u=Math.sin(s)*(t-r)+Math.cos(s)*(e-a)+a;return{x:o,y:u}}var tO=function(e,r,a,i,s,o){return{x:(e-a)*s+a,y:(r-i)*o+i}};function rO(t,e,r){if(r===0)return t;var a=(e.x1+e.x2)/2,i=(e.y1+e.y2)/2,s=e.w/e.h,o=1/s,u=eO(t.x,t.y,a,i,r),d=tO(u.x,u.y,a,i,s,o);return{x:d.x,y:d.y}}var ow=!0,aO=console.warn!=null,nO=console.trace!=null,Hm=Number.MAX_SAFE_INTEGER||9007199254740991,hC=function(){return!0},Uf=function(){return!1},uw=function(){return 0},Gm=function(){},$t=function(e){throw new Error(e)},vC=function(e){if(e!==void 0)ow=!!e;else return ow},At=function(e){vC()&&(aO?console.warn(e):(console.log(e),nO&&console.trace()))},iO=function(e){return tt({},e)},Sn=function(e){return e==null?e:_t(e)?e.slice():wt(e)?iO(e):e},sO=function(e){return e.slice()},pC=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},lO={},gC=function(){return lO},Fr=function(e){var r=Object.keys(e);return function(a){for(var i={},s=0;s<r.length;s++){var o=r[s],u=a==null?void 0:a[o];i[o]=u===void 0?e[o]:u}return i}},as=function(e,r,a){for(var i=e.length-1;i>=0;i--)e[i]===r&&e.splice(i,1)},Qm=function(e){e.splice(0,e.length)},oO=function(e,r){for(var a=0;a<r.length;a++){var i=r[a];e.push(i)}},ga=function(e,r,a){return a&&(r=aC(a,r)),e[r]},Qn=function(e,r,a,i){a&&(r=aC(a,r)),e[r]=i},uO=(function(){function t(){cs(this,t),this._obj={}}return ds(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])})(),Zn=typeof Map<"u"?Map:uO,cO="undefined",dO=(function(){function t(e){if(cs(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return ds(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])})(),Bo=(typeof Set>"u"?"undefined":Er(Set))!==cO?Set:dO,sh=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Im(e)){$t("An element must have a core reference and parameters set");return}var i=r.group;if(i==null&&(r.data&&r.data.source!=null&&r.data.target!=null?i="edges":i="nodes"),i!=="nodes"&&i!=="edges"){$t("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var s=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?i==="edges":!!r.pannable,active:!1,classes:new Bo,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(s.position.x==null&&(s.position.x=0),s.position.y==null&&(s.position.y=0),r.renderedPosition){var o=r.renderedPosition,u=e.pan(),d=e.zoom();s.position={x:(o.x-u.x)/d,y:(o.y-u.y)/d}}var f=[];_t(r.classes)?f=r.classes:Xe(r.classes)&&(f=r.classes.split(/\s+/));for(var h=0,p=f.length;h<p;h++){var m=f[h];!m||m===""||s.classes.add(m)}this.createEmitter(),(a===void 0||a)&&this.restore();var y=r.style||r.css;y&&(At("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(y))},cw=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,i,s){var o;wt(a)&&!Da(a)&&(o=a,a=o.roots||o.root,i=o.visit,s=o.directed),s=arguments.length===2&&!Wt(i)?i:s,i=Wt(i)?i:function(){};for(var u=this._private.cy,d=a=Xe(a)?this.filter(a):a,f=[],h=[],p={},m={},y={},x=0,E,w=this.byGroup(),T=w.nodes,C=w.edges,N=0;N<d.length;N++){var A=d[N],D=A.id();A.isNode()&&(f.unshift(A),e.bfs&&(y[D]=!0,h.push(A)),m[D]=0)}for(var M=function(){var q=e.bfs?f.shift():f.pop(),I=q.id();if(e.dfs){if(y[I])return 0;y[I]=!0,h.push(q)}var Q=m[I],_=p[I],V=_!=null?_.source():null,F=_!=null?_.target():null,K=_==null?void 0:q.same(V)?F[0]:V[0],ee;if(ee=i(q,_,K,x++,Q),ee===!0)return E=q,1;if(ee===!1)return 1;for(var P=q.connectedEdges().filter(function(Y){return(!s||Y.source().same(q))&&C.has(Y)}),G=0;G<P.length;G++){var Z=P[G],J=Z.connectedNodes().filter(function(Y){return!Y.same(q)&&T.has(Y)}),X=J.id();J.length!==0&&!y[X]&&(J=J[0],f.push(J),e.bfs&&(y[X]=!0,h.push(J)),p[X]=Z,m[X]=m[I]+1)}},j;f.length!==0&&(j=M(),!(j!==0&&j===1)););for(var k=u.collection(),R=0;R<h.length;R++){var z=h[R],B=p[z.id()];B!=null&&k.push(B),k.push(z)}return{path:u.collection(k),found:u.collection(E)}}},tc={breadthFirstSearch:cw({bfs:!0}),depthFirstSearch:cw({dfs:!0})};tc.bfs=tc.breadthFirstSearch;tc.dfs=tc.depthFirstSearch;var bf={exports:{}},fO=bf.exports,dw;function hO(){return dw||(dw=1,(function(t,e){(function(){var r,a,i,s,o,u,d,f,h,p,m,y,x,E,w;i=Math.floor,p=Math.min,a=function(T,C){return T<C?-1:T>C?1:0},h=function(T,C,N,A,D){var M;if(N==null&&(N=0),D==null&&(D=a),N<0)throw new Error("lo must be non-negative");for(A==null&&(A=T.length);N<A;)M=i((N+A)/2),D(C,T[M])<0?A=M:N=M+1;return[].splice.apply(T,[N,N-N].concat(C)),C},u=function(T,C,N){return N==null&&(N=a),T.push(C),E(T,0,T.length-1,N)},o=function(T,C){var N,A;return C==null&&(C=a),N=T.pop(),T.length?(A=T[0],T[0]=N,w(T,0,C)):A=N,A},f=function(T,C,N){var A;return N==null&&(N=a),A=T[0],T[0]=C,w(T,0,N),A},d=function(T,C,N){var A;return N==null&&(N=a),T.length&&N(T[0],C)<0&&(A=[T[0],C],C=A[0],T[0]=A[1],w(T,0,N)),C},s=function(T,C){var N,A,D,M,j,k;for(C==null&&(C=a),M=(function(){k=[];for(var R=0,z=i(T.length/2);0<=z?R<z:R>z;0<=z?R++:R--)k.push(R);return k}).apply(this).reverse(),j=[],A=0,D=M.length;A<D;A++)N=M[A],j.push(w(T,N,C));return j},x=function(T,C,N){var A;if(N==null&&(N=a),A=T.indexOf(C),A!==-1)return E(T,0,A,N),w(T,A,N)},m=function(T,C,N){var A,D,M,j,k;if(N==null&&(N=a),D=T.slice(0,C),!D.length)return D;for(s(D,N),k=T.slice(C),M=0,j=k.length;M<j;M++)A=k[M],d(D,A,N);return D.sort(N).reverse()},y=function(T,C,N){var A,D,M,j,k,R,z,B,L;if(N==null&&(N=a),C*10<=T.length){if(M=T.slice(0,C).sort(N),!M.length)return M;for(D=M[M.length-1],z=T.slice(C),j=0,R=z.length;j<R;j++)A=z[j],N(A,D)<0&&(h(M,A,0,null,N),M.pop(),D=M[M.length-1]);return M}for(s(T,N),L=[],k=0,B=p(C,T.length);0<=B?k<B:k>B;0<=B?++k:--k)L.push(o(T,N));return L},E=function(T,C,N,A){var D,M,j;for(A==null&&(A=a),D=T[N];N>C;){if(j=N-1>>1,M=T[j],A(D,M)<0){T[N]=M,N=j;continue}break}return T[N]=D},w=function(T,C,N){var A,D,M,j,k;for(N==null&&(N=a),D=T.length,k=C,M=T[C],A=2*C+1;A<D;)j=A+1,j<D&&!(N(T[A],T[j])<0)&&(A=j),T[C]=T[A],C=A,A=2*C+1;return T[C]=M,E(T,k,C,N)},r=(function(){T.push=u,T.pop=o,T.replace=f,T.pushpop=d,T.heapify=s,T.updateItem=x,T.nlargest=m,T.nsmallest=y;function T(C){this.cmp=C??a,this.nodes=[]}return T.prototype.push=function(C){return u(this.nodes,C,this.cmp)},T.prototype.pop=function(){return o(this.nodes,this.cmp)},T.prototype.peek=function(){return this.nodes[0]},T.prototype.contains=function(C){return this.nodes.indexOf(C)!==-1},T.prototype.replace=function(C){return f(this.nodes,C,this.cmp)},T.prototype.pushpop=function(C){return d(this.nodes,C,this.cmp)},T.prototype.heapify=function(){return s(this.nodes,this.cmp)},T.prototype.updateItem=function(C){return x(this.nodes,C,this.cmp)},T.prototype.clear=function(){return this.nodes=[]},T.prototype.empty=function(){return this.nodes.length===0},T.prototype.size=function(){return this.nodes.length},T.prototype.clone=function(){var C;return C=new T,C.nodes=this.nodes.slice(0),C},T.prototype.toArray=function(){return this.nodes.slice(0)},T.prototype.insert=T.prototype.push,T.prototype.top=T.prototype.peek,T.prototype.front=T.prototype.peek,T.prototype.has=T.prototype.contains,T.prototype.copy=T.prototype.clone,T})(),(function(T,C){return t.exports=C()})(this,function(){return r})}).call(fO)})(bf)),bf.exports}var i0,fw;function vO(){return fw||(fw=1,i0=hO()),i0}var pO=vO(),Mc=Cc(pO),gO=Fr({root:null,weight:function(e){return 1},directed:!1}),mO={dijkstra:function(e){if(!wt(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=gO(e),i=a.root,s=a.weight,o=a.directed,u=this,d=s,f=Xe(i)?this.filter(i)[0]:i[0],h={},p={},m={},y=this.byGroup(),x=y.nodes,E=y.edges;E.unmergeBy(function(Q){return Q.isLoop()});for(var w=function(_){return h[_.id()]},T=function(_,V){h[_.id()]=V,C.updateItem(_)},C=new Mc(function(Q,_){return w(Q)-w(_)}),N=0;N<x.length;N++){var A=x[N];h[A.id()]=A.same(f)?0:1/0,C.push(A)}for(var D=function(_,V){for(var F=(o?_.edgesTo(V):_.edgesWith(V)).intersect(E),K=1/0,ee,P=0;P<F.length;P++){var G=F[P],Z=d(G);(Z<K||!ee)&&(K=Z,ee=G)}return{edge:ee,dist:K}};C.size()>0;){var M=C.pop(),j=w(M),k=M.id();if(m[k]=j,j!==1/0)for(var R=M.neighborhood().intersect(x),z=0;z<R.length;z++){var B=R[z],L=B.id(),q=D(M,B),I=j+q.dist;I<w(B)&&(T(B,I),p[L]={node:M,edge:q.edge})}}return{distanceTo:function(_){var V=Xe(_)?x.filter(_)[0]:_[0];return m[V.id()]},pathTo:function(_){var V=Xe(_)?x.filter(_)[0]:_[0],F=[],K=V,ee=K.id();if(V.length>0)for(F.unshift(V);p[ee];){var P=p[ee];F.unshift(P.edge),F.unshift(P.node),K=P.node,ee=K.id()}return u.spawn(F)}}}},yO={kruskal:function(e){e=e||function(N){return 1};for(var r=this.byGroup(),a=r.nodes,i=r.edges,s=a.length,o=new Array(s),u=a,d=function(A){for(var D=0;D<o.length;D++){var M=o[D];if(M.has(A))return D}},f=0;f<s;f++)o[f]=this.spawn(a[f]);for(var h=i.sort(function(N,A){return e(N)-e(A)}),p=0;p<h.length;p++){var m=h[p],y=m.source()[0],x=m.target()[0],E=d(y),w=d(x),T=o[E],C=o[w];E!==w&&(u.merge(m),T.merge(C),o.splice(w,1))}return u}},xO=Fr({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),bO={aStar:function(e){var r=this.cy(),a=xO(e),i=a.root,s=a.goal,o=a.heuristic,u=a.directed,d=a.weight;i=r.collection(i)[0],s=r.collection(s)[0];var f=i.id(),h=s.id(),p={},m={},y={},x=new Mc(function(ee,P){return m[ee.id()]-m[P.id()]}),E=new Bo,w={},T={},C=function(P,G){x.push(P),E.add(G)},N,A,D=function(){N=x.pop(),A=N.id(),E.delete(A)},M=function(P){return E.has(P)};C(i,f),p[f]=0,m[f]=o(i);for(var j=0;x.size()>0;){if(D(),j++,A===h){for(var k=[],R=s,z=h,B=T[z];k.unshift(R),B!=null&&k.unshift(B),R=w[z],R!=null;)z=R.id(),B=T[z];return{found:!0,distance:p[A],path:this.spawn(k),steps:j}}y[A]=!0;for(var L=N._private.edges,q=0;q<L.length;q++){var I=L[q];if(this.hasElementWithId(I.id())&&!(u&&I.data("source")!==A)){var Q=I.source(),_=I.target(),V=Q.id()!==A?Q:_,F=V.id();if(this.hasElementWithId(F)&&!y[F]){var K=p[A]+d(I);if(!M(F)){p[F]=K,m[F]=K+o(V),C(V,F),w[F]=N,T[F]=I;continue}K<p[F]&&(p[F]=K,m[F]=K+o(V),w[F]=N,T[F]=I)}}}}return{found:!1,distance:void 0,path:void 0,steps:j}}},wO=Fr({weight:function(e){return 1},directed:!1}),SO={floydWarshall:function(e){for(var r=this.cy(),a=wO(e),i=a.weight,s=a.directed,o=i,u=this.byGroup(),d=u.nodes,f=u.edges,h=d.length,p=h*h,m=function(Z){return d.indexOf(Z)},y=function(Z){return d[Z]},x=new Array(p),E=0;E<p;E++){var w=E%h,T=(E-w)/h;T===w?x[E]=0:x[E]=1/0}for(var C=new Array(p),N=new Array(p),A=0;A<f.length;A++){var D=f[A],M=D.source()[0],j=D.target()[0];if(M!==j){var k=m(M),R=m(j),z=k*h+R,B=o(D);if(x[z]>B&&(x[z]=B,C[z]=R,N[z]=D),!s){var L=R*h+k;!s&&x[L]>B&&(x[L]=B,C[L]=k,N[L]=D)}}}for(var q=0;q<h;q++)for(var I=0;I<h;I++)for(var Q=I*h+q,_=0;_<h;_++){var V=I*h+_,F=q*h+_;x[Q]+x[F]<x[V]&&(x[V]=x[Q]+x[F],C[V]=C[Q])}var K=function(Z){return(Xe(Z)?r.filter(Z):Z)[0]},ee=function(Z){return m(K(Z))},P={distance:function(Z,J){var X=ee(Z),Y=ee(J);return x[X*h+Y]},path:function(Z,J){var X=ee(Z),Y=ee(J),le=y(X);if(X===Y)return le.collection();if(C[X*h+Y]==null)return r.collection();var me=r.collection(),oe=X,ae;for(me.merge(le);X!==Y;)oe=X,X=C[X*h+Y],ae=N[oe*h+X],me.merge(ae),me.merge(y(X));return me}};return P}},EO=Fr({weight:function(e){return 1},directed:!1,root:null}),TO={bellmanFord:function(e){var r=this,a=EO(e),i=a.weight,s=a.directed,o=a.root,u=i,d=this,f=this.cy(),h=this.byGroup(),p=h.edges,m=h.nodes,y=m.length,x=new Zn,E=!1,w=[];o=f.collection(o)[0],p.unmergeBy(function(Qe){return Qe.isLoop()});for(var T=p.length,C=function(Se){var Oe=x.get(Se.id());return Oe||(Oe={},x.set(Se.id(),Oe)),Oe},N=function(Se){return(Xe(Se)?f.$(Se):Se)[0]},A=function(Se){return C(N(Se)).dist},D=function(Se){for(var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,ke=N(Se),Pe=[],Ge=ke;;){if(Ge==null)return r.spawn();var Je=C(Ge),Be=Je.edge,nt=Je.pred;if(Pe.unshift(Ge[0]),Ge.same(Oe)&&Pe.length>0)break;Be!=null&&Pe.unshift(Be),Ge=nt}return d.spawn(Pe)},M=0;M<y;M++){var j=m[M],k=C(j);j.same(o)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var R=!1,z=function(Se,Oe,ke,Pe,Ge,Je){var Be=Pe.dist+Je;Be<Ge.dist&&!ke.same(Pe.edge)&&(Ge.dist=Be,Ge.pred=Se,Ge.edge=ke,R=!0)},B=1;B<y;B++){R=!1;for(var L=0;L<T;L++){var q=p[L],I=q.source(),Q=q.target(),_=u(q),V=C(I),F=C(Q);z(I,Q,q,V,F,_),s||z(Q,I,q,F,V,_)}if(!R)break}if(R)for(var K=[],ee=0;ee<T;ee++){var P=p[ee],G=P.source(),Z=P.target(),J=u(P),X=C(G).dist,Y=C(Z).dist;if(X+J<Y||!s&&Y+J<X)if(E||(At("Graph contains a negative weight cycle for Bellman-Ford"),E=!0),e.findNegativeWeightCycles!==!1){var le=[];X+J<Y&&le.push(G),!s&&Y+J<X&&le.push(Z);for(var me=le.length,oe=0;oe<me;oe++){var ae=le[oe],re=[ae];re.push(C(ae).edge);for(var se=C(ae).pred;re.indexOf(se)===-1;)re.push(se),re.push(C(se).edge),se=C(se).pred;re=re.slice(re.indexOf(se));for(var ie=re[0].id(),Ne=0,Ae=2;Ae<re.length;Ae+=2)re[Ae].id()<ie&&(ie=re[Ae].id(),Ne=Ae);re=re.slice(Ne).concat(re.slice(0,Ne)),re.push(re[0]);var Ze=re.map(function(Qe){return Qe.id()}).join(",");K.indexOf(Ze)===-1&&(w.push(d.spawn(re)),K.push(Ze))}}else break}return{distanceTo:A,pathTo:D,hasNegativeWeightCycle:E,negativeWeightCycles:w}}},CO=Math.sqrt(2),NO=function(e,r,a){a.length===0&&$t("Karger-Stein must be run on a connected (sub)graph");for(var i=a[e],s=i[1],o=i[2],u=r[s],d=r[o],f=a,h=f.length-1;h>=0;h--){var p=f[h],m=p[1],y=p[2];(r[m]===u&&r[y]===d||r[m]===d&&r[y]===u)&&f.splice(h,1)}for(var x=0;x<f.length;x++){var E=f[x];E[1]===d?(f[x]=E.slice(),f[x][1]=u):E[2]===d&&(f[x]=E.slice(),f[x][2]=u)}for(var w=0;w<r.length;w++)r[w]===d&&(r[w]=u);return f},s0=function(e,r,a,i){for(;a>i;){var s=Math.floor(Math.random()*r.length);r=NO(s,e,r),a--}return r},jO={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,i=r.edges;i.unmergeBy(function(F){return F.isLoop()});var s=a.length,o=i.length,u=Math.ceil(Math.pow(Math.log(s)/Math.LN2,2)),d=Math.floor(s/CO);if(s<2){$t("At least 2 nodes are required for Karger-Stein algorithm");return}for(var f=[],h=0;h<o;h++){var p=i[h];f.push([h,a.indexOf(p.source()),a.indexOf(p.target())])}for(var m=1/0,y=[],x=new Array(s),E=new Array(s),w=new Array(s),T=function(K,ee){for(var P=0;P<s;P++)ee[P]=K[P]},C=0;C<=u;C++){for(var N=0;N<s;N++)E[N]=N;var A=s0(E,f.slice(),s,d),D=A.slice();T(E,w);var M=s0(E,A,d,2),j=s0(w,D,d,2);M.length<=j.length&&M.length<m?(m=M.length,y=M,T(E,x)):j.length<=M.length&&j.length<m&&(m=j.length,y=j,T(w,x))}for(var k=this.spawn(y.map(function(F){return i[F[0]]})),R=this.spawn(),z=this.spawn(),B=x[0],L=0;L<x.length;L++){var q=x[L],I=a[L];q===B?R.merge(I):z.merge(I)}var Q=function(K){var ee=e.spawn();return K.forEach(function(P){ee.merge(P),P.connectedEdges().forEach(function(G){e.contains(G)&&!k.contains(G)&&ee.merge(G)})}),ee},_=[Q(R),Q(z)],V={cut:k,components:_,partition1:R,partition2:z};return V}},l0,AO=function(e){return{x:e.x,y:e.y}},lh=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},mC=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},ro=function(e){return{x:e[0],y:e[1]}},MO=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=1/0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(i=Math.min(o,i))}return i},kO=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=-1/0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(i=Math.max(o,i))}return i},DO=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=0,s=0,o=r;o<a;o++){var u=e[o];isFinite(u)&&(i+=u,s++)}return i/s},OO=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var u=0,d=e.length-1;d>=0;d--){var f=e[d];o?isFinite(f)||(e[d]=-1/0,u++):e.splice(d,1)}s&&e.sort(function(m,y){return m-y});var h=e.length,p=Math.floor(h/2);return h%2!==0?e[p+1+u]:(e[p-1+u]+e[p+u])/2},RO=function(e){return Math.PI*e/180},rf=function(e,r){return Math.atan2(r,e)-Math.PI/2},$m=Math.log2||function(t){return Math.log(t)/Math.log(2)},Ym=function(e){return e>0?1:e<0?-1:0},Js=function(e,r){return Math.sqrt(Bs(e,r))},Bs=function(e,r){var a=r.x-e.x,i=r.y-e.y;return a*a+i*i},BO=function(e){for(var r=e.length,a=0,i=0;i<r;i++)a+=e[i];for(var s=0;s<r;s++)e[s]=e[s]/a;return e},Or=function(e,r,a,i){return(1-i)*(1-i)*e+2*(1-i)*i*r+i*i*a},lo=function(e,r,a,i){return{x:Or(e.x,r.x,a.x,i),y:Or(e.y,r.y,a.y,i)}},LO=function(e,r,a,i){var s={x:r.x-e.x,y:r.y-e.y},o=Js(e,r),u={x:s.x/o,y:s.y/o};return a=a??0,i=i??a*o,{x:e.x+u.x*i,y:e.y+u.y*i}},rc=function(e,r,a){return Math.max(e,Math.min(a,r))},na=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},PO=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},zO=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},_O=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},yC=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},wf=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Sf=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,i,s,o;if(r.length===1)a=i=s=o=r[0];else if(r.length===2)a=s=r[0],o=i=r[1];else if(r.length===4){var u=mr(r,4);a=u[0],i=u[1],s=u[2],o=u[3]}return e.x1-=o,e.x2+=i,e.y1-=a,e.y2+=s,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},hw=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Km=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},Ki=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},vw=function(e,r){return Ki(e,r.x,r.y)},xC=function(e,r){return Ki(e,r.x1,r.y1)&&Ki(e,r.x2,r.y2)},UO=(l0=Math.hypot)!==null&&l0!==void 0?l0:function(t,e){return Math.sqrt(t*t+e*e)};function qO(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(k,R){return{x:k.x+R.x,y:k.y+R.y}},a=function(k,R){return{x:k.x-R.x,y:k.y-R.y}},i=function(k,R){return{x:k.x*R,y:k.y*R}},s=function(k,R){return k.x*R.y-k.y*R.x},o=function(k){var R=UO(k.x,k.y);return R===0?{x:0,y:0}:{x:k.x/R,y:k.y/R}},u=function(k){for(var R=0,z=0;z<k.length;z++){var B=k[z],L=k[(z+1)%k.length];R+=B.x*L.y-L.x*B.y}return R/2},d=function(k,R,z,B){var L=a(R,k),q=a(B,z),I=s(L,q);if(Math.abs(I)<1e-9)return r(k,i(L,.5));var Q=s(a(z,k),q)/I;return r(k,i(L,Q))},f=t.map(function(j){return{x:j.x,y:j.y}});u(f)<0&&f.reverse();for(var h=f.length,p=[],m=0;m<h;m++){var y=f[m],x=f[(m+1)%h],E=a(x,y),w=o({x:E.y,y:-E.x});p.push(w)}for(var T=p.map(function(j,k){var R=r(f[k],i(j,e)),z=r(f[(k+1)%h],i(j,e));return{p1:R,p2:z}}),C=[],N=0;N<h;N++){var A=T[(N-1+h)%h],D=T[N],M=d(A.p1,A.p2,D.p1,D.p2);C.push(M)}return C}function IO(t,e,r,a,i,s){var o=XO(t,e,r,a,i),u=qO(o,s),d=na();return u.forEach(function(f){return yC(d,f.x,f.y)}),d}var bC=function(e,r,a,i,s,o,u){var d=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",f=d==="auto"?ns(s,o):d,h=s/2,p=o/2;f=Math.min(f,h,p);var m=f!==h,y=f!==p,x;if(m){var E=a-h+f-u,w=i-p-u,T=a+h-f+u,C=w;if(x=Xi(e,r,a,i,E,w,T,C,!1),x.length>0)return x}if(y){var N=a+h+u,A=i-p+f-u,D=N,M=i+p-f+u;if(x=Xi(e,r,a,i,N,A,D,M,!1),x.length>0)return x}if(m){var j=a-h+f-u,k=i+p+u,R=a+h-f+u,z=k;if(x=Xi(e,r,a,i,j,k,R,z,!1),x.length>0)return x}if(y){var B=a-h-u,L=i-p+f-u,q=B,I=i+p-f+u;if(x=Xi(e,r,a,i,B,L,q,I,!1),x.length>0)return x}var Q;{var _=a-h+f,V=i-p+f;if(Q=qu(e,r,a,i,_,V,f+u),Q.length>0&&Q[0]<=_&&Q[1]<=V)return[Q[0],Q[1]]}{var F=a+h-f,K=i-p+f;if(Q=qu(e,r,a,i,F,K,f+u),Q.length>0&&Q[0]>=F&&Q[1]<=K)return[Q[0],Q[1]]}{var ee=a+h-f,P=i+p-f;if(Q=qu(e,r,a,i,ee,P,f+u),Q.length>0&&Q[0]>=ee&&Q[1]>=P)return[Q[0],Q[1]]}{var G=a-h+f,Z=i+p-f;if(Q=qu(e,r,a,i,G,Z,f+u),Q.length>0&&Q[0]<=G&&Q[1]>=Z)return[Q[0],Q[1]]}return[]},VO=function(e,r,a,i,s,o,u){var d=u,f=Math.min(a,s),h=Math.max(a,s),p=Math.min(i,o),m=Math.max(i,o);return f-d<=e&&e<=h+d&&p-d<=r&&r<=m+d},FO=function(e,r,a,i,s,o,u,d,f){var h={x1:Math.min(a,u,s)-f,x2:Math.max(a,u,s)+f,y1:Math.min(i,d,o)-f,y2:Math.max(i,d,o)+f};return!(e<h.x1||e>h.x2||r<h.y1||r>h.y2)},HO=function(e,r,a,i){a-=i;var s=r*r-4*e*a;if(s<0)return[];var o=Math.sqrt(s),u=2*e,d=(-r+o)/u,f=(-r-o)/u;return[d,f]},GO=function(e,r,a,i,s){var o=1e-5;e===0&&(e=o),r/=e,a/=e,i/=e;var u,d,f,h,p,m,y,x;if(d=(3*a-r*r)/9,f=-(27*i)+r*(9*a-2*(r*r)),f/=54,u=d*d*d+f*f,s[1]=0,y=r/3,u>0){p=f+Math.sqrt(u),p=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),m=f-Math.sqrt(u),m=m<0?-Math.pow(-m,1/3):Math.pow(m,1/3),s[0]=-y+p+m,y+=(p+m)/2,s[4]=s[2]=-y,y=Math.sqrt(3)*(-m+p)/2,s[3]=y,s[5]=-y;return}if(s[5]=s[3]=0,u===0){x=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),s[0]=-y+2*x,s[4]=s[2]=-(x+y);return}d=-d,h=d*d*d,h=Math.acos(f/Math.sqrt(h)),x=2*Math.sqrt(d),s[0]=-y+x*Math.cos(h/3),s[2]=-y+x*Math.cos((h+2*Math.PI)/3),s[4]=-y+x*Math.cos((h+4*Math.PI)/3)},QO=function(e,r,a,i,s,o,u,d){var f=1*a*a-4*a*s+2*a*u+4*s*s-4*s*u+u*u+i*i-4*i*o+2*i*d+4*o*o-4*o*d+d*d,h=9*a*s-3*a*a-3*a*u-6*s*s+3*s*u+9*i*o-3*i*i-3*i*d-6*o*o+3*o*d,p=3*a*a-6*a*s+a*u-a*e+2*s*s+2*s*e-u*e+3*i*i-6*i*o+i*d-i*r+2*o*o+2*o*r-d*r,m=1*a*s-a*a+a*e-s*e+i*o-i*i+i*r-o*r,y=[];GO(f,h,p,m,y);for(var x=1e-7,E=[],w=0;w<6;w+=2)Math.abs(y[w+1])<x&&y[w]>=0&&y[w]<=1&&E.push(y[w]);E.push(1),E.push(0);for(var T=-1,C,N,A,D=0;D<E.length;D++)C=Math.pow(1-E[D],2)*a+2*(1-E[D])*E[D]*s+E[D]*E[D]*u,N=Math.pow(1-E[D],2)*i+2*(1-E[D])*E[D]*o+E[D]*E[D]*d,A=Math.pow(C-e,2)+Math.pow(N-r,2),T>=0?A<T&&(T=A):T=A;return T},$O=function(e,r,a,i,s,o){var u=[e-a,r-i],d=[s-a,o-i],f=d[0]*d[0]+d[1]*d[1],h=u[0]*u[0]+u[1]*u[1],p=u[0]*d[0]+u[1]*d[1],m=p*p/f;return p<0?h:m>f?(e-s)*(e-s)+(r-o)*(r-o):h-m},ma=function(e,r,a){for(var i,s,o,u,d,f=0,h=0;h<a.length/2;h++)if(i=a[h*2],s=a[h*2+1],h+1<a.length/2?(o=a[(h+1)*2],u=a[(h+1)*2+1]):(o=a[(h+1-a.length/2)*2],u=a[(h+1-a.length/2)*2+1]),!(i==e&&o==e))if(i>=e&&e>=o||i<=e&&e<=o)d=(e-i)/(o-i)*(u-s)+s,d>r&&f++;else continue;return f%2!==0},ti=function(e,r,a,i,s,o,u,d,f){var h=new Array(a.length),p;d[0]!=null?(p=Math.atan(d[1]/d[0]),d[0]<0?p=p+Math.PI/2:p=-p-Math.PI/2):p=d;for(var m=Math.cos(-p),y=Math.sin(-p),x=0;x<h.length/2;x++)h[x*2]=o/2*(a[x*2]*m-a[x*2+1]*y),h[x*2+1]=u/2*(a[x*2+1]*m+a[x*2]*y),h[x*2]+=i,h[x*2+1]+=s;var E;if(f>0){var w=If(h,-f);E=qf(w)}else E=h;return ma(e,r,E)},YO=function(e,r,a,i,s,o,u,d){for(var f=new Array(a.length*2),h=0;h<d.length;h++){var p=d[h];f[h*4+0]=p.startX,f[h*4+1]=p.startY,f[h*4+2]=p.stopX,f[h*4+3]=p.stopY;var m=Math.pow(p.cx-e,2)+Math.pow(p.cy-r,2);if(m<=Math.pow(p.radius,2))return!0}return ma(e,r,f)},qf=function(e){for(var r=new Array(e.length/2),a,i,s,o,u,d,f,h,p=0;p<e.length/4;p++){a=e[p*4],i=e[p*4+1],s=e[p*4+2],o=e[p*4+3],p<e.length/4-1?(u=e[(p+1)*4],d=e[(p+1)*4+1],f=e[(p+1)*4+2],h=e[(p+1)*4+3]):(u=e[0],d=e[1],f=e[2],h=e[3]);var m=Xi(a,i,s,o,u,d,f,h,!0);r[p*2]=m[0],r[p*2+1]=m[1]}return r},If=function(e,r){for(var a=new Array(e.length*2),i,s,o,u,d=0;d<e.length/2;d++){i=e[d*2],s=e[d*2+1],d<e.length/2-1?(o=e[(d+1)*2],u=e[(d+1)*2+1]):(o=e[0],u=e[1]);var f=u-s,h=-(o-i),p=Math.sqrt(f*f+h*h),m=f/p,y=h/p;a[d*4]=i+m*r,a[d*4+1]=s+y*r,a[d*4+2]=o+m*r,a[d*4+3]=u+y*r}return a},KO=function(e,r,a,i,s,o){var u=a-e,d=i-r;u/=s,d/=o;var f=Math.sqrt(u*u+d*d),h=f-1;if(h<0)return[];var p=h/f;return[(a-e)*p+e,(i-r)*p+r]},qs=function(e,r,a,i,s,o,u){return e-=s,r-=o,e/=a/2+u,r/=i/2+u,e*e+r*r<=1},qu=function(e,r,a,i,s,o,u){var d=[a-e,i-r],f=[e-s,r-o],h=d[0]*d[0]+d[1]*d[1],p=2*(f[0]*d[0]+f[1]*d[1]),m=f[0]*f[0]+f[1]*f[1]-u*u,y=p*p-4*h*m;if(y<0)return[];var x=(-p+Math.sqrt(y))/(2*h),E=(-p-Math.sqrt(y))/(2*h),w=Math.min(x,E),T=Math.max(x,E),C=[];if(w>=0&&w<=1&&C.push(w),T>=0&&T<=1&&C.push(T),C.length===0)return[];var N=C[0]*d[0]+e,A=C[0]*d[1]+r;if(C.length>1){if(C[0]==C[1])return[N,A];var D=C[1]*d[0]+e,M=C[1]*d[1]+r;return[N,A,D,M]}else return[N,A]},o0=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Xi=function(e,r,a,i,s,o,u,d,f){var h=e-s,p=a-e,m=u-s,y=r-o,x=i-r,E=d-o,w=m*y-E*h,T=p*y-x*h,C=E*p-m*x;if(C!==0){var N=w/C,A=T/C,D=.001,M=0-D,j=1+D;return M<=N&&N<=j&&M<=A&&A<=j?[e+N*p,r+N*x]:f?[e+N*p,r+N*x]:[]}else return w===0||T===0?o0(e,a,u)===u?[u,d]:o0(e,a,s)===s?[s,o]:o0(s,u,a)===a?[a,i]:[]:[]},XO=function(e,r,a,i,s){var o=[],u=i/2,d=s/2,f=r,h=a;o.push({x:f+u*e[0],y:h+d*e[1]});for(var p=1;p<e.length/2;p++)o.push({x:f+u*e[p*2],y:h+d*e[p*2+1]});return o},ac=function(e,r,a,i,s,o,u,d){var f=[],h,p=new Array(a.length),m=!0;o==null&&(m=!1);var y;if(m){for(var x=0;x<p.length/2;x++)p[x*2]=a[x*2]*o+i,p[x*2+1]=a[x*2+1]*u+s;if(d>0){var E=If(p,-d);y=qf(E)}else y=p}else y=a;for(var w,T,C,N,A=0;A<y.length/2;A++)w=y[A*2],T=y[A*2+1],A<y.length/2-1?(C=y[(A+1)*2],N=y[(A+1)*2+1]):(C=y[0],N=y[1]),h=Xi(e,r,i,s,w,T,C,N),h.length!==0&&f.push(h[0],h[1]);return f},ZO=function(e,r,a,i,s,o,u,d,f){var h=[],p,m=new Array(a.length*2);f.forEach(function(C,N){N===0?(m[m.length-2]=C.startX,m[m.length-1]=C.startY):(m[N*4-2]=C.startX,m[N*4-1]=C.startY),m[N*4]=C.stopX,m[N*4+1]=C.stopY,p=qu(e,r,i,s,C.cx,C.cy,C.radius),p.length!==0&&h.push(p[0],p[1])});for(var y=0;y<m.length/4;y++)p=Xi(e,r,i,s,m[y*4],m[y*4+1],m[y*4+2],m[y*4+3],!1),p.length!==0&&h.push(p[0],p[1]);if(h.length>2){for(var x=[h[0],h[1]],E=Math.pow(x[0]-e,2)+Math.pow(x[1]-r,2),w=1;w<h.length/2;w++){var T=Math.pow(h[w*2]-e,2)+Math.pow(h[w*2+1]-r,2);T<=E&&(x[0]=h[w*2],x[1]=h[w*2+1],E=T)}return x}return h},af=function(e,r,a){var i=[e[0]-r[0],e[1]-r[1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=(s-a)/s;return o<0&&(o=1e-5),[r[0]+o*i[0],r[1]+o*i[1]]},ta=function(e,r){var a=Zg(e,r);return a=wC(a),a},wC=function(e){for(var r,a,i=e.length/2,s=1/0,o=1/0,u=-1/0,d=-1/0,f=0;f<i;f++)r=e[2*f],a=e[2*f+1],s=Math.min(s,r),u=Math.max(u,r),o=Math.min(o,a),d=Math.max(d,a);for(var h=2/(u-s),p=2/(d-o),m=0;m<i;m++)r=e[2*m]=e[2*m]*h,a=e[2*m+1]=e[2*m+1]*p,s=Math.min(s,r),u=Math.max(u,r),o=Math.min(o,a),d=Math.max(d,a);if(o<-1)for(var y=0;y<i;y++)a=e[2*y+1]=e[2*y+1]+(-1-o);return e},Zg=function(e,r){var a=1/e*2*Math.PI,i=e%2===0?Math.PI/2+a/2:Math.PI/2;i+=r;for(var s=new Array(e*2),o,u=0;u<e;u++)o=u*a+i,s[2*u]=Math.cos(o),s[2*u+1]=Math.sin(-o);return s},ns=function(e,r){return Math.min(e/4,r/4,8)},SC=function(e,r){return Math.min(e/10,r/10,8)},Xm=function(){return 8},WO=function(e,r,a){return[e-2*r+a,2*(r-e),e]},Wg=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function u0(t,e){function r(p){for(var m=[],y=0;y<p.length;y++){var x=p[y],E=p[(y+1)%p.length],w={x:E.x-x.x,y:E.y-x.y},T={x:-w.y,y:w.x},C=Math.sqrt(T.x*T.x+T.y*T.y);m.push({x:T.x/C,y:T.y/C})}return m}function a(p,m){var y=1/0,x=-1/0,E=xa(p),w;try{for(E.s();!(w=E.n()).done;){var T=w.value,C=T.x*m.x+T.y*m.y;y=Math.min(y,C),x=Math.max(x,C)}}catch(N){E.e(N)}finally{E.f()}return{min:y,max:x}}function i(p,m){return!(p.max<m.min||m.max<p.min)}var s=[].concat(Pf(r(t)),Pf(r(e))),o=xa(s),u;try{for(o.s();!(u=o.n()).done;){var d=u.value,f=a(t,d),h=a(e,d);if(!i(f,h))return!1}}catch(p){o.e(p)}finally{o.f()}return!0}var JO=Fr({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),e3={pageRank:function(e){for(var r=JO(e),a=r.dampingFactor,i=r.precision,s=r.iterations,o=r.weight,u=this._private.cy,d=this.byGroup(),f=d.nodes,h=d.edges,p=f.length,m=p*p,y=h.length,x=new Array(m),E=new Array(p),w=(1-a)/p,T=0;T<p;T++){for(var C=0;C<p;C++){var N=T*p+C;x[N]=0}E[T]=0}for(var A=0;A<y;A++){var D=h[A],M=D.data("source"),j=D.data("target");if(M!==j){var k=f.indexOfId(M),R=f.indexOfId(j),z=o(D),B=R*p+k;x[B]+=z,E[k]+=z}}for(var L=1/p+w,q=0;q<p;q++)if(E[q]===0)for(var I=0;I<p;I++){var Q=I*p+q;x[Q]=L}else for(var _=0;_<p;_++){var V=_*p+q;x[V]=x[V]/E[q]+w}for(var F=new Array(p),K=new Array(p),ee,P=0;P<p;P++)F[P]=1;for(var G=0;G<s;G++){for(var Z=0;Z<p;Z++)K[Z]=0;for(var J=0;J<p;J++)for(var X=0;X<p;X++){var Y=J*p+X;K[J]+=x[Y]*F[X]}BO(K),ee=F,F=K,K=ee;for(var le=0,me=0;me<p;me++){var oe=ee[me]-F[me];le+=oe*oe}if(le<i)break}var ae={rank:function(se){return se=u.collection(se)[0],F[f.indexOf(se)]}};return ae}},pw=Fr({root:null,weight:function(e){return 1},directed:!1,alpha:0}),oo={degreeCentralityNormalized:function(e){e=pw(e);var r=this.cy(),a=this.nodes(),i=a.length;if(e.directed){for(var h={},p={},m=0,y=0,x=0;x<i;x++){var E=a[x],w=E.id();e.root=E;var T=this.degreeCentrality(e);m<T.indegree&&(m=T.indegree),y<T.outdegree&&(y=T.outdegree),h[w]=T.indegree,p[w]=T.outdegree}return{indegree:function(N){return m==0?0:(Xe(N)&&(N=r.filter(N)),h[N.id()]/m)},outdegree:function(N){return y===0?0:(Xe(N)&&(N=r.filter(N)),p[N.id()]/y)}}}else{for(var s={},o=0,u=0;u<i;u++){var d=a[u];e.root=d;var f=this.degreeCentrality(e);o<f.degree&&(o=f.degree),s[d.id()]=f.degree}return{degree:function(N){return o===0?0:(Xe(N)&&(N=r.filter(N)),s[N.id()]/o)}}}},degreeCentrality:function(e){e=pw(e);var r=this.cy(),a=this,i=e,s=i.root,o=i.weight,u=i.directed,d=i.alpha;if(s=r.collection(s)[0],u){for(var y=s.connectedEdges(),x=y.filter(function(M){return M.target().same(s)&&a.has(M)}),E=y.filter(function(M){return M.source().same(s)&&a.has(M)}),w=x.length,T=E.length,C=0,N=0,A=0;A<x.length;A++)C+=o(x[A]);for(var D=0;D<E.length;D++)N+=o(E[D]);return{indegree:Math.pow(w,1-d)*Math.pow(C,d),outdegree:Math.pow(T,1-d)*Math.pow(N,d)}}else{for(var f=s.connectedEdges().intersection(a),h=f.length,p=0,m=0;m<f.length;m++)p+=o(f[m]);return{degree:Math.pow(h,1-d)*Math.pow(p,d)}}}};oo.dc=oo.degreeCentrality;oo.dcn=oo.degreeCentralityNormalised=oo.degreeCentralityNormalized;var gw=Fr({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),uo={closenessCentralityNormalized:function(e){for(var r=gw(e),a=r.harmonic,i=r.weight,s=r.directed,o=this.cy(),u={},d=0,f=this.nodes(),h=this.floydWarshall({weight:i,directed:s}),p=0;p<f.length;p++){for(var m=0,y=f[p],x=0;x<f.length;x++)if(p!==x){var E=h.distance(y,f[x]);a?m+=1/E:m+=E}a||(m=1/m),d<m&&(d=m),u[y.id()]=m}return{closeness:function(T){return d==0?0:(Xe(T)?T=o.filter(T)[0].id():T=T.id(),u[T]/d)}}},closenessCentrality:function(e){var r=gw(e),a=r.root,i=r.weight,s=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var u=this.dijkstra({root:a,weight:i,directed:s}),d=0,f=this.nodes(),h=0;h<f.length;h++){var p=f[h];if(!p.same(a)){var m=u.distanceTo(p);o?d+=1/m:d+=m}}return o?d:1/d}};uo.cc=uo.closenessCentrality;uo.ccn=uo.closenessCentralityNormalised=uo.closenessCentralityNormalized;var t3=Fr({weight:null,directed:!1}),Jg={betweennessCentrality:function(e){for(var r=t3(e),a=r.directed,i=r.weight,s=i!=null,o=this.cy(),u=this.nodes(),d={},f={},h=0,p={set:function(N,A){f[N]=A,A>h&&(h=A)},get:function(N){return f[N]}},m=0;m<u.length;m++){var y=u[m],x=y.id();a?d[x]=y.outgoers().nodes():d[x]=y.openNeighborhood().nodes(),p.set(x,0)}for(var E=function(){for(var N=u[w].id(),A=[],D={},M={},j={},k=new Mc(function(J,X){return j[J]-j[X]}),R=0;R<u.length;R++){var z=u[R].id();D[z]=[],M[z]=0,j[z]=1/0}for(M[N]=1,j[N]=0,k.push(N);!k.empty();){var B=k.pop();if(A.push(B),s)for(var L=0;L<d[B].length;L++){var q=d[B][L],I=o.getElementById(B),Q=void 0;I.edgesTo(q).length>0?Q=I.edgesTo(q)[0]:Q=q.edgesTo(I)[0];var _=i(Q);q=q.id(),j[q]>j[B]+_&&(j[q]=j[B]+_,k.nodes.indexOf(q)<0?k.push(q):k.updateItem(q),M[q]=0,D[q]=[]),j[q]==j[B]+_&&(M[q]=M[q]+M[B],D[q].push(B))}else for(var V=0;V<d[B].length;V++){var F=d[B][V].id();j[F]==1/0&&(k.push(F),j[F]=j[B]+1),j[F]==j[B]+1&&(M[F]=M[F]+M[B],D[F].push(B))}}for(var K={},ee=0;ee<u.length;ee++)K[u[ee].id()]=0;for(;A.length>0;){for(var P=A.pop(),G=0;G<D[P].length;G++){var Z=D[P][G];K[Z]=K[Z]+M[Z]/M[P]*(1+K[P])}P!=u[w].id()&&p.set(P,p.get(P)+K[P])}},w=0;w<u.length;w++)E();var T={betweenness:function(N){var A=o.collection(N).id();return p.get(A)},betweennessNormalized:function(N){if(h==0)return 0;var A=o.collection(N).id();return p.get(A)/h}};return T.betweennessNormalised=T.betweennessNormalized,T}};Jg.bc=Jg.betweennessCentrality;var r3=Fr({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),a3=function(e){return r3(e)},n3=function(e,r){for(var a=0,i=0;i<r.length;i++)a+=r[i](e);return a},i3=function(e,r,a){for(var i=0;i<r;i++)e[i*r+i]=a},EC=function(e,r){for(var a,i=0;i<r;i++){a=0;for(var s=0;s<r;s++)a+=e[s*r+i];for(var o=0;o<r;o++)e[o*r+i]=e[o*r+i]/a}},s3=function(e,r,a){for(var i=new Array(a*a),s=0;s<a;s++){for(var o=0;o<a;o++)i[s*a+o]=0;for(var u=0;u<a;u++)for(var d=0;d<a;d++)i[s*a+d]+=e[s*a+u]*r[u*a+d]}return i},l3=function(e,r,a){for(var i=e.slice(0),s=1;s<a;s++)e=s3(e,i,r);return e},o3=function(e,r,a){for(var i=new Array(r*r),s=0;s<r*r;s++)i[s]=Math.pow(e[s],a);return EC(i,r),i},u3=function(e,r,a,i){for(var s=0;s<a;s++){var o=Math.round(e[s]*Math.pow(10,i))/Math.pow(10,i),u=Math.round(r[s]*Math.pow(10,i))/Math.pow(10,i);if(o!==u)return!1}return!0},c3=function(e,r,a,i){for(var s=[],o=0;o<r;o++){for(var u=[],d=0;d<r;d++)Math.round(e[o*r+d]*1e3)/1e3>0&&u.push(a[d]);u.length!==0&&s.push(i.collection(u))}return s},d3=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},f3=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&d3(e[r],e[a])&&e.splice(a,1);return e},mw=function(e){for(var r=this.nodes(),a=this.edges(),i=this.cy(),s=a3(e),o={},u=0;u<r.length;u++)o[r[u].id()]=u;for(var d=r.length,f=d*d,h=new Array(f),p,m=0;m<f;m++)h[m]=0;for(var y=0;y<a.length;y++){var x=a[y],E=o[x.source().id()],w=o[x.target().id()],T=n3(x,s.attributes);h[E*d+w]+=T,h[w*d+E]+=T}i3(h,d,s.multFactor),EC(h,d);for(var C=!0,N=0;C&&N<s.maxIterations;)C=!1,p=l3(h,d,s.expandFactor),h=o3(p,d,s.inflateFactor),u3(h,p,f,4)||(C=!0),N++;var A=c3(h,d,r,i);return A=f3(A),A},h3={markovClustering:mw,mcl:mw},v3=function(e){return e},TC=function(e,r){return Math.abs(r-e)},yw=function(e,r,a){return e+TC(r,a)},xw=function(e,r,a){return e+Math.pow(a-r,2)},p3=function(e){return Math.sqrt(e)},g3=function(e,r,a){return Math.max(e,TC(r,a))},Ou=function(e,r,a,i,s){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:v3,u=i,d,f,h=0;h<e;h++)d=r(h),f=a(h),u=s(u,d,f);return o(u)},ko={euclidean:function(e,r,a){return e>=2?Ou(e,r,a,0,xw,p3):Ou(e,r,a,0,yw)},squaredEuclidean:function(e,r,a){return Ou(e,r,a,0,xw)},manhattan:function(e,r,a){return Ou(e,r,a,0,yw)},max:function(e,r,a){return Ou(e,r,a,-1/0,g3)}};ko["squared-euclidean"]=ko.squaredEuclidean;ko.squaredeuclidean=ko.squaredEuclidean;function oh(t,e,r,a,i,s){var o;return Wt(t)?o=t:o=ko[t]||ko.euclidean,e===0&&Wt(t)?o(i,s):o(e,r,a,i,s)}var m3=Fr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Zm=function(e){return m3(e)},Vf=function(e,r,a,i,s){var o=s!=="kMedoids",u=o?function(p){return a[p]}:function(p){return i[p](a)},d=function(m){return i[m](r)},f=a,h=r;return oh(e,i.length,u,d,f,h)},c0=function(e,r,a){for(var i=a.length,s=new Array(i),o=new Array(i),u=new Array(r),d=null,f=0;f<i;f++)s[f]=e.min(a[f]).value,o[f]=e.max(a[f]).value;for(var h=0;h<r;h++){d=[];for(var p=0;p<i;p++)d[p]=Math.random()*(o[p]-s[p])+s[p];u[h]=d}return u},CC=function(e,r,a,i,s){for(var o=1/0,u=0,d=0;d<r.length;d++){var f=Vf(a,e,r[d],i,s);f<o&&(o=f,u=d)}return u},NC=function(e,r,a){for(var i=[],s=null,o=0;o<r.length;o++)s=r[o],a[s.id()]===e&&i.push(s);return i},y3=function(e,r,a){return Math.abs(r-e)<=a},x3=function(e,r,a){for(var i=0;i<e.length;i++)for(var s=0;s<e[i].length;s++){var o=Math.abs(e[i][s]-r[i][s]);if(o>a)return!1}return!0},b3=function(e,r,a){for(var i=0;i<a;i++)if(e===r[i])return!0;return!1},bw=function(e,r){var a=new Array(r);if(e.length<50)for(var i=0;i<r;i++){for(var s=e[Math.floor(Math.random()*e.length)];b3(s,a,i);)s=e[Math.floor(Math.random()*e.length)];a[i]=s}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},ww=function(e,r,a){for(var i=0,s=0;s<r.length;s++)i+=Vf("manhattan",r[s],e,a,"kMedoids");return i},w3=function(e){var r=this.cy(),a=this.nodes(),i=null,s=Zm(e),o=new Array(s.k),u={},d;s.testMode?typeof s.testCentroids=="number"?(s.testCentroids,d=c0(a,s.k,s.attributes)):Er(s.testCentroids)==="object"?d=s.testCentroids:d=c0(a,s.k,s.attributes):d=c0(a,s.k,s.attributes);for(var f=!0,h=0;f&&h<s.maxIterations;){for(var p=0;p<a.length;p++)i=a[p],u[i.id()]=CC(i,d,s.distance,s.attributes,"kMeans");f=!1;for(var m=0;m<s.k;m++){var y=NC(m,a,u);if(y.length!==0){for(var x=s.attributes.length,E=d[m],w=new Array(x),T=new Array(x),C=0;C<x;C++){T[C]=0;for(var N=0;N<y.length;N++)i=y[N],T[C]+=s.attributes[C](i);w[C]=T[C]/y.length,y3(w[C],E[C],s.sensitivityThreshold)||(f=!0)}d[m]=w,o[m]=r.collection(y)}}h++}return o},S3=function(e){var r=this.cy(),a=this.nodes(),i=null,s=Zm(e),o=new Array(s.k),u,d={},f,h=new Array(s.k);s.testMode?typeof s.testCentroids=="number"||(Er(s.testCentroids)==="object"?u=s.testCentroids:u=bw(a,s.k)):u=bw(a,s.k);for(var p=!0,m=0;p&&m<s.maxIterations;){for(var y=0;y<a.length;y++)i=a[y],d[i.id()]=CC(i,u,s.distance,s.attributes,"kMedoids");p=!1;for(var x=0;x<u.length;x++){var E=NC(x,a,d);if(E.length!==0){h[x]=ww(u[x],E,s.attributes);for(var w=0;w<E.length;w++)f=ww(E[w],E,s.attributes),f<h[x]&&(h[x]=f,u[x]=E[w],p=!0);o[x]=r.collection(E)}}m++}return o},E3=function(e,r,a,i,s){for(var o,u,d=0;d<r.length;d++)for(var f=0;f<e.length;f++)i[d][f]=Math.pow(a[d][f],s.m);for(var h=0;h<e.length;h++)for(var p=0;p<s.attributes.length;p++){o=0,u=0;for(var m=0;m<r.length;m++)o+=i[m][h]*s.attributes[p](r[m]),u+=i[m][h];e[h][p]=o/u}},T3=function(e,r,a,i,s){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var u,d,f,h=2/(s.m-1),p=0;p<a.length;p++)for(var m=0;m<i.length;m++){u=0;for(var y=0;y<a.length;y++)d=Vf(s.distance,i[m],a[p],s.attributes,"cmeans"),f=Vf(s.distance,i[m],a[y],s.attributes,"cmeans"),u+=Math.pow(d/f,h);e[m][p]=1/u}},C3=function(e,r,a,i){for(var s=new Array(a.k),o=0;o<s.length;o++)s[o]=[];for(var u,d,f=0;f<r.length;f++){u=-1/0,d=-1;for(var h=0;h<r[0].length;h++)r[f][h]>u&&(u=r[f][h],d=h);s[d].push(e[f])}for(var p=0;p<s.length;p++)s[p]=i.collection(s[p]);return s},Sw=function(e){var r=this.cy(),a=this.nodes(),i=Zm(e),s,o,u,d,f;d=new Array(a.length);for(var h=0;h<a.length;h++)d[h]=new Array(i.k);u=new Array(a.length);for(var p=0;p<a.length;p++)u[p]=new Array(i.k);for(var m=0;m<a.length;m++){for(var y=0,x=0;x<i.k;x++)u[m][x]=Math.random(),y+=u[m][x];for(var E=0;E<i.k;E++)u[m][E]=u[m][E]/y}o=new Array(i.k);for(var w=0;w<i.k;w++)o[w]=new Array(i.attributes.length);f=new Array(a.length);for(var T=0;T<a.length;T++)f[T]=new Array(i.k);for(var C=!0,N=0;C&&N<i.maxIterations;)C=!1,E3(o,a,u,f,i),T3(u,d,o,a,i),x3(u,d,i.sensitivityThreshold)||(C=!0),N++;return s=C3(a,u,i,r),{clusters:s,degreeOfMembership:u}},N3={kMeans:w3,kMedoids:S3,fuzzyCMeans:Sw,fcm:Sw},j3=Fr({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),A3={single:"min",complete:"max"},M3=function(e){var r=j3(e),a=A3[r.linkage];return a!=null&&(r.linkage=a),r},Ew=function(e,r,a,i,s){for(var o=0,u=1/0,d,f=s.attributes,h=function(R,z){return oh(s.distance,f.length,function(B){return f[B](R)},function(B){return f[B](z)},R,z)},p=0;p<e.length;p++){var m=e[p].key,y=a[m][i[m]];y<u&&(o=m,u=y)}if(s.mode==="threshold"&&u>=s.threshold||s.mode==="dendrogram"&&e.length===1)return!1;var x=r[o],E=r[i[o]],w;s.mode==="dendrogram"?w={left:x,right:E,key:x.key}:w={value:x.value.concat(E.value),key:x.key},e[x.index]=w,e.splice(E.index,1),r[x.key]=w;for(var T=0;T<e.length;T++){var C=e[T];x.key===C.key?d=1/0:s.linkage==="min"?(d=a[x.key][C.key],a[x.key][C.key]>a[E.key][C.key]&&(d=a[E.key][C.key])):s.linkage==="max"?(d=a[x.key][C.key],a[x.key][C.key]<a[E.key][C.key]&&(d=a[E.key][C.key])):s.linkage==="mean"?d=(a[x.key][C.key]*x.size+a[E.key][C.key]*E.size)/(x.size+E.size):s.mode==="dendrogram"?d=h(C.value,x.value):d=h(C.value[0],x.value[0]),a[x.key][C.key]=a[C.key][x.key]=d}for(var N=0;N<e.length;N++){var A=e[N].key;if(i[A]===x.key||i[A]===E.key){for(var D=A,M=0;M<e.length;M++){var j=e[M].key;a[A][j]<a[A][D]&&(D=j)}i[A]=D}e[N].index=N}return x.key=E.key=x.index=E.index=null,!0},ao=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&ao(e.left,r),e.right&&ao(e.right,r)))},em=function(e,r){if(!e)return"";if(e.left&&e.right){var a=em(e.left,r),i=em(e.right,r),s=r.add({group:"nodes",data:{id:a+","+i}});return r.add({group:"edges",data:{source:a,target:s.id()}}),r.add({group:"edges",data:{source:i,target:s.id()}}),s.id()}else if(e.value)return e.value.id()},tm=function(e,r,a){if(!e)return[];var i=[],s=[],o=[];return r===0?(e.left&&ao(e.left,i),e.right&&ao(e.right,s),o=i.concat(s),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&ao(e.left,i),e.right&&ao(e.right,s),[a.collection(i),a.collection(s)]):e.value?[a.collection(e.value)]:(e.left&&(i=tm(e.left,r-1,a)),e.right&&(s=tm(e.right,r-1,a)),i.concat(s))},Tw=function(e){for(var r=this.cy(),a=this.nodes(),i=M3(e),s=i.attributes,o=function(N,A){return oh(i.distance,s.length,function(D){return s[D](N)},function(D){return s[D](A)},N,A)},u=[],d=[],f=[],h=[],p=0;p<a.length;p++){var m={value:i.mode==="dendrogram"?a[p]:[a[p]],key:p,index:p};u[p]=m,h[p]=m,d[p]=[],f[p]=0}for(var y=0;y<u.length;y++)for(var x=0;x<=y;x++){var E=void 0;i.mode==="dendrogram"?E=y===x?1/0:o(u[y].value,u[x].value):E=y===x?1/0:o(u[y].value[0],u[x].value[0]),d[y][x]=E,d[x][y]=E,E<d[y][f[y]]&&(f[y]=x)}for(var w=Ew(u,h,d,f,i);w;)w=Ew(u,h,d,f,i);var T;return i.mode==="dendrogram"?(T=tm(u[0],i.dendrogramDepth,r),i.addDendrogram&&em(u[0],r)):(T=new Array(u.length),u.forEach(function(C,N){C.key=C.index=null,T[N]=r.collection(C.value)})),T},k3={hierarchicalClustering:Tw,hca:Tw},D3=Fr({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),O3=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||$t("Damping must range on [0.5, 1). Got: ".concat(r));var i=["median","mean","min","max"];return i.some(function(s){return s===a})||De(a)||$t("Preference must be one of [".concat(i.map(function(s){return"'".concat(s,"'")}).join(", "),"] or a number. Got: ").concat(a)),D3(e)},R3=function(e,r,a,i){var s=function(u,d){return i[d](u)};return-oh(e,i.length,function(o){return s(r,o)},function(o){return s(a,o)},r,a)},B3=function(e,r){var a=null;return r==="median"?a=OO(e):r==="mean"?a=DO(e):r==="min"?a=MO(e):r==="max"?a=kO(e):a=r,a},L3=function(e,r,a){for(var i=[],s=0;s<e;s++)r[s*e+s]+a[s*e+s]>0&&i.push(s);return i},Cw=function(e,r,a){for(var i=[],s=0;s<e;s++){for(var o=-1,u=-1/0,d=0;d<a.length;d++){var f=a[d];r[s*e+f]>u&&(o=f,u=r[s*e+f])}o>0&&i.push(o)}for(var h=0;h<a.length;h++)i[a[h]]=a[h];return i},P3=function(e,r,a){for(var i=Cw(e,r,a),s=0;s<a.length;s++){for(var o=[],u=0;u<i.length;u++)i[u]===a[s]&&o.push(u);for(var d=-1,f=-1/0,h=0;h<o.length;h++){for(var p=0,m=0;m<o.length;m++)p+=r[o[m]*e+o[h]];p>f&&(d=h,f=p)}a[s]=o[d]}return i=Cw(e,r,a),i},Nw=function(e){for(var r=this.cy(),a=this.nodes(),i=O3(e),s={},o=0;o<a.length;o++)s[a[o].id()]=o;var u,d,f,h,p,m;u=a.length,d=u*u,f=new Array(d);for(var y=0;y<d;y++)f[y]=-1/0;for(var x=0;x<u;x++)for(var E=0;E<u;E++)x!==E&&(f[x*u+E]=R3(i.distance,a[x],a[E],i.attributes));h=B3(f,i.preference);for(var w=0;w<u;w++)f[w*u+w]=h;p=new Array(d);for(var T=0;T<d;T++)p[T]=0;m=new Array(d);for(var C=0;C<d;C++)m[C]=0;for(var N=new Array(u),A=new Array(u),D=new Array(u),M=0;M<u;M++)N[M]=0,A[M]=0,D[M]=0;for(var j=new Array(u*i.minIterations),k=0;k<j.length;k++)j[k]=0;var R;for(R=0;R<i.maxIterations;R++){for(var z=0;z<u;z++){for(var B=-1/0,L=-1/0,q=-1,I=0,Q=0;Q<u;Q++)N[Q]=p[z*u+Q],I=m[z*u+Q]+f[z*u+Q],I>=B?(L=B,B=I,q=Q):I>L&&(L=I);for(var _=0;_<u;_++)p[z*u+_]=(1-i.damping)*(f[z*u+_]-B)+i.damping*N[_];p[z*u+q]=(1-i.damping)*(f[z*u+q]-L)+i.damping*N[q]}for(var V=0;V<u;V++){for(var F=0,K=0;K<u;K++)N[K]=m[K*u+V],A[K]=Math.max(0,p[K*u+V]),F+=A[K];F-=A[V],A[V]=p[V*u+V],F+=A[V];for(var ee=0;ee<u;ee++)m[ee*u+V]=(1-i.damping)*Math.min(0,F-A[ee])+i.damping*N[ee];m[V*u+V]=(1-i.damping)*(F-A[V])+i.damping*N[V]}for(var P=0,G=0;G<u;G++){var Z=m[G*u+G]+p[G*u+G]>0?1:0;j[R%i.minIterations*u+G]=Z,P+=Z}if(P>0&&(R>=i.minIterations-1||R==i.maxIterations-1)){for(var J=0,X=0;X<u;X++){D[X]=0;for(var Y=0;Y<i.minIterations;Y++)D[X]+=j[Y*u+X];(D[X]===0||D[X]===i.minIterations)&&J++}if(J===u)break}}for(var le=L3(u,p,m),me=P3(u,f,le),oe={},ae=0;ae<le.length;ae++)oe[le[ae]]=[];for(var re=0;re<a.length;re++){var se=s[a[re].id()],ie=me[se];ie!=null&&oe[ie].push(a[re])}for(var Ne=new Array(le.length),Ae=0;Ae<le.length;Ae++)Ne[Ae]=r.collection(oe[le[Ae]]);return Ne},z3={affinityPropagation:Nw,ap:Nw},_3=Fr({root:void 0,directed:!1}),U3={hierholzer:function(e){if(!wt(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=_3(e),i=a.root,s=a.directed,o=this,u=!1,d,f,h;i&&(h=Xe(i)?this.filter(i)[0].id():i[0].id());var p={},m={};s?o.forEach(function(C){var N=C.id();if(C.isNode()){var A=C.indegree(!0),D=C.outdegree(!0),M=A-D,j=D-A;M==1?d?u=!0:d=N:j==1?f?u=!0:f=N:(j>1||M>1)&&(u=!0),p[N]=[],C.outgoers().forEach(function(k){k.isEdge()&&p[N].push(k.id())})}else m[N]=[void 0,C.target().id()]}):o.forEach(function(C){var N=C.id();if(C.isNode()){var A=C.degree(!0);A%2&&(d?f?u=!0:f=N:d=N),p[N]=[],C.connectedEdges().forEach(function(D){return p[N].push(D.id())})}else m[N]=[C.source().id(),C.target().id()]});var y={found:!1,trail:void 0};if(u)return y;if(f&&d)if(s){if(h&&f!=h)return y;h=f}else{if(h&&f!=h&&d!=h)return y;h||(h=f)}else h||(h=o[0].id());var x=function(N){for(var A=N,D=[N],M,j,k;p[A].length;)M=p[A].shift(),j=m[M][0],k=m[M][1],A!=k?(p[k]=p[k].filter(function(R){return R!=M}),A=k):!s&&A!=j&&(p[j]=p[j].filter(function(R){return R!=M}),A=j),D.unshift(M),D.unshift(A);return D},E=[],w=[];for(w=x(h);w.length!=1;)p[w[0]].length==0?(E.unshift(o.getElementById(w.shift())),E.unshift(o.getElementById(w.shift()))):w=x(w.shift()).concat(w);E.unshift(o.getElementById(w.shift()));for(var T in p)if(p[T].length)return y;return y.found=!0,y.trail=this.spawn(E,!0),y}},nf=function(){var e=this,r={},a=0,i=0,s=[],o=[],u={},d=function(m,y){for(var x=o.length-1,E=[],w=e.spawn();o[x].x!=m||o[x].y!=y;)E.push(o.pop().edge),x--;E.push(o.pop().edge),E.forEach(function(T){var C=T.connectedNodes().intersection(e);w.merge(T),C.forEach(function(N){var A=N.id(),D=N.connectedEdges().intersection(e);w.merge(N),r[A].cutVertex?w.merge(D.filter(function(M){return M.isLoop()})):w.merge(D)})}),s.push(w)},f=function(m,y,x){m===x&&(i+=1),r[y]={id:a,low:a++,cutVertex:!1};var E=e.getElementById(y).connectedEdges().intersection(e);if(E.size()===0)s.push(e.spawn(e.getElementById(y)));else{var w,T,C,N;E.forEach(function(A){w=A.source().id(),T=A.target().id(),C=w===y?T:w,C!==x&&(N=A.id(),u[N]||(u[N]=!0,o.push({x:y,y:C,edge:A})),C in r?r[y].low=Math.min(r[y].low,r[C].id):(f(m,C,y),r[y].low=Math.min(r[y].low,r[C].low),r[y].id<=r[C].low&&(r[y].cutVertex=!0,d(y,C))))})}};e.forEach(function(p){if(p.isNode()){var m=p.id();m in r||(i=0,f(m,m),r[m].cutVertex=i>1)}});var h=Object.keys(r).filter(function(p){return r[p].cutVertex}).map(function(p){return e.getElementById(p)});return{cut:e.spawn(h),components:s}},q3={hopcroftTarjanBiconnected:nf,htbc:nf,htb:nf,hopcroftTarjanBiconnectedComponents:nf},sf=function(){var e=this,r={},a=0,i=[],s=[],o=e.spawn(e),u=function(f){s.push(f),r[f]={index:a,low:a++,explored:!1};var h=e.getElementById(f).connectedEdges().intersection(e);if(h.forEach(function(E){var w=E.target().id();w!==f&&(w in r||u(w),r[w].explored||(r[f].low=Math.min(r[f].low,r[w].low)))}),r[f].index===r[f].low){for(var p=e.spawn();;){var m=s.pop();if(p.merge(e.getElementById(m)),r[m].low=r[f].index,r[m].explored=!0,m===f)break}var y=p.edgesWith(p),x=p.merge(y);i.push(x),o=o.difference(x)}};return e.forEach(function(d){if(d.isNode()){var f=d.id();f in r||u(f)}}),{cut:o,components:i}},I3={tarjanStronglyConnected:sf,tsc:sf,tscc:sf,tarjanStronglyConnectedComponents:sf},jC={};[tc,mO,yO,bO,SO,TO,jO,e3,oo,uo,Jg,h3,N3,k3,z3,U3,q3,I3].forEach(function(t){tt(jC,t)});/*!
83
- Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
84
- Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
85
- Licensed under The MIT License (http://opensource.org/licenses/MIT)
86
- */var AC=0,MC=1,kC=2,ln=function(e){if(!(this instanceof ln))return new ln(e);this.id="Thenable/1.0.7",this.state=AC,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};ln.prototype={fulfill:function(e){return jw(this,MC,"fulfillValue",e)},reject:function(e){return jw(this,kC,"rejectReason",e)},then:function(e,r){var a=this,i=new ln;return a.onFulfilled.push(Mw(e,i,"fulfill")),a.onRejected.push(Mw(r,i,"reject")),DC(a),i.proxy}};var jw=function(e,r,a,i){return e.state===AC&&(e.state=r,e[a]=i,DC(e)),e},DC=function(e){e.state===MC?Aw(e,"onFulfilled",e.fulfillValue):e.state===kC&&Aw(e,"onRejected",e.rejectReason)},Aw=function(e,r,a){if(e[r].length!==0){var i=e[r];e[r]=[];var s=function(){for(var u=0;u<i.length;u++)i[u](a)};typeof setImmediate=="function"?setImmediate(s):setTimeout(s,0)}},Mw=function(e,r,a){return function(i){if(typeof e!="function")r[a].call(r,i);else{var s;try{s=e(i)}catch(o){r.reject(o);return}OC(r,s)}}},OC=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(Er(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(s){e.reject(s);return}if(typeof a=="function"){var i=!1;try{a.call(r,function(s){i||(i=!0,s===r?e.reject(new TypeError("circular thenable chain")):OC(e,s))},function(s){i||(i=!0,e.reject(s))})}catch(s){i||e.reject(s)}return}e.fulfill(r)};ln.all=function(t){return new ln(function(e,r){for(var a=new Array(t.length),i=0,s=function(d,f){a[d]=f,i++,i===t.length&&e(a)},o=0;o<t.length;o++)(function(u){var d=t[u],f=d!=null&&d.then!=null;if(f)d.then(function(p){s(u,p)},function(p){r(p)});else{var h=d;s(u,h)}})(o)})};ln.resolve=function(t){return new ln(function(e,r){e(t)})};ln.reject=function(t){return new ln(function(e,r){r(t)})};var Lo=typeof Promise<"u"?Promise:ln,rm=function(e,r,a){var i=Im(e),s=!i,o=this._private=tt({duration:1e3},r,a);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&Wt(o.complete)&&o.completes.push(o.complete),s){var u=e.position();o.startPosition=o.startPosition||{x:u.x,y:u.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(i){var d=e.pan();o.startPan={x:d.x,y:d.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},el=rm.prototype;tt(el,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),Da(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(f,h){var p=e[f];p!=null&&(e[f]=e[h],e[h]=p)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var i=0;i<e.style.length;i++){var s=e.style[i],o=s.name,u=e.startStyle[o];e.startStyle[o]=s,e.style[i]=u}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new Lo(function(i,s){a.push(function(){i()})})}});el.complete=el.completed;el.run=el.play;el.running=el.playing;var V3={animated:function(){return function(){var r=this,a=r.length!==void 0,i=a?r:[r],s=this._private.cy||this;if(!s.styleEnabled())return!1;var o=i[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,i=a?r:[r],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var o=0;o<i.length;o++){var u=i[o];u._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var i=this._private.cy||this;return i.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var i=this._private.cy||this;return i.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this,d=!s,f=!d;if(!u.styleEnabled())return this;var h=u.style();r=tt({},r,a);var p=Object.keys(r).length===0;if(p)return new rm(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(f&&(r.style=h.getPropsList(r.style||r.css),r.css=void 0),f&&r.renderedPosition!=null){var m=r.renderedPosition,y=u.pan(),x=u.zoom();r.position=mC(m,x,y)}if(d&&r.panBy!=null){var E=r.panBy,w=u.pan();r.pan={x:w.x+E.x,y:w.y+E.y}}var T=r.center||r.centre;if(d&&T!=null){var C=u.getCenterPan(T.eles,r.zoom);C!=null&&(r.pan=C)}if(d&&r.fit!=null){var N=r.fit,A=u.getFitViewport(N.eles||N.boundingBox,N.padding);A!=null&&(r.pan=A.pan,r.zoom=A.zoom)}if(d&&wt(r.zoom)){var D=u.getZoomedViewport(r.zoom);D!=null?(D.zoomed&&(r.zoom=D.zoom),D.panned&&(r.pan=D.pan)):r.zoom=null}return new rm(o[0],r)}},animate:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this;if(!u.styleEnabled())return this;a&&(r=tt({},r,a));for(var d=0;d<o.length;d++){var f=o[d],h=f.animated()&&(r.queue===void 0||r.queue),p=f.animation(r,h?{queue:!0}:void 0);p.play()}return this}},stop:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this;if(!u.styleEnabled())return this;for(var d=0;d<o.length;d++){for(var f=o[d],h=f._private,p=h.animation.current,m=0;m<p.length;m++){var y=p[m],x=y._private;a&&(x.duration=0)}r&&(h.animation.queue=[]),a||(h.animation.current=[])}return u.notify("draw"),this}}},d0,kw;function uh(){if(kw)return d0;kw=1;var t=Array.isArray;return d0=t,d0}var f0,Dw;function F3(){if(Dw)return f0;Dw=1;var t=uh(),e=jc(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function i(s,o){if(t(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||e(s)?!0:a.test(s)||!r.test(s)||o!=null&&s in Object(o)}return f0=i,f0}var h0,Ow;function H3(){if(Ow)return h0;Ow=1;var t=oC(),e=Nc(),r="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(u){if(!e(u))return!1;var d=t(u);return d==a||d==i||d==r||d==s}return h0=o,h0}var v0,Rw;function G3(){if(Rw)return v0;Rw=1;var t=ih(),e=t["__core-js_shared__"];return v0=e,v0}var p0,Bw;function Q3(){if(Bw)return p0;Bw=1;var t=G3(),e=(function(){var a=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function r(a){return!!e&&e in a}return p0=r,p0}var g0,Lw;function $3(){if(Lw)return g0;Lw=1;var t=Function.prototype,e=t.toString;function r(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return g0=r,g0}var m0,Pw;function Y3(){if(Pw)return m0;Pw=1;var t=H3(),e=Q3(),r=Nc(),a=$3(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,d=o.toString,f=u.hasOwnProperty,h=RegExp("^"+d.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){if(!r(m)||e(m))return!1;var y=t(m)?h:s;return y.test(a(m))}return m0=p,m0}var y0,zw;function K3(){if(zw)return y0;zw=1;function t(e,r){return e==null?void 0:e[r]}return y0=t,y0}var x0,_w;function Wm(){if(_w)return x0;_w=1;var t=Y3(),e=K3();function r(a,i){var s=e(a,i);return t(s)?s:void 0}return x0=r,x0}var b0,Uw;function ch(){if(Uw)return b0;Uw=1;var t=Wm(),e=t(Object,"create");return b0=e,b0}var w0,qw;function X3(){if(qw)return w0;qw=1;var t=ch();function e(){this.__data__=t?t(null):{},this.size=0}return w0=e,w0}var S0,Iw;function Z3(){if(Iw)return S0;Iw=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return S0=t,S0}var E0,Vw;function W3(){if(Vw)return E0;Vw=1;var t=ch(),e="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function i(s){var o=this.__data__;if(t){var u=o[s];return u===e?void 0:u}return a.call(o,s)?o[s]:void 0}return E0=i,E0}var T0,Fw;function J3(){if(Fw)return T0;Fw=1;var t=ch(),e=Object.prototype,r=e.hasOwnProperty;function a(i){var s=this.__data__;return t?s[i]!==void 0:r.call(s,i)}return T0=a,T0}var C0,Hw;function eR(){if(Hw)return C0;Hw=1;var t=ch(),e="__lodash_hash_undefined__";function r(a,i){var s=this.__data__;return this.size+=this.has(a)?0:1,s[a]=t&&i===void 0?e:i,this}return C0=r,C0}var N0,Gw;function tR(){if(Gw)return N0;Gw=1;var t=X3(),e=Z3(),r=W3(),a=J3(),i=eR();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,N0=s,N0}var j0,Qw;function rR(){if(Qw)return j0;Qw=1;function t(){this.__data__=[],this.size=0}return j0=t,j0}var A0,$w;function RC(){if($w)return A0;$w=1;function t(e,r){return e===r||e!==e&&r!==r}return A0=t,A0}var M0,Yw;function dh(){if(Yw)return M0;Yw=1;var t=RC();function e(r,a){for(var i=r.length;i--;)if(t(r[i][0],a))return i;return-1}return M0=e,M0}var k0,Kw;function aR(){if(Kw)return k0;Kw=1;var t=dh(),e=Array.prototype,r=e.splice;function a(i){var s=this.__data__,o=t(s,i);if(o<0)return!1;var u=s.length-1;return o==u?s.pop():r.call(s,o,1),--this.size,!0}return k0=a,k0}var D0,Xw;function nR(){if(Xw)return D0;Xw=1;var t=dh();function e(r){var a=this.__data__,i=t(a,r);return i<0?void 0:a[i][1]}return D0=e,D0}var O0,Zw;function iR(){if(Zw)return O0;Zw=1;var t=dh();function e(r){return t(this.__data__,r)>-1}return O0=e,O0}var R0,Ww;function sR(){if(Ww)return R0;Ww=1;var t=dh();function e(r,a){var i=this.__data__,s=t(i,r);return s<0?(++this.size,i.push([r,a])):i[s][1]=a,this}return R0=e,R0}var B0,Jw;function lR(){if(Jw)return B0;Jw=1;var t=rR(),e=aR(),r=nR(),a=iR(),i=sR();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,B0=s,B0}var L0,eS;function oR(){if(eS)return L0;eS=1;var t=Wm(),e=ih(),r=t(e,"Map");return L0=r,L0}var P0,tS;function uR(){if(tS)return P0;tS=1;var t=tR(),e=lR(),r=oR();function a(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return P0=a,P0}var z0,rS;function cR(){if(rS)return z0;rS=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return z0=t,z0}var _0,aS;function fh(){if(aS)return _0;aS=1;var t=cR();function e(r,a){var i=r.__data__;return t(a)?i[typeof a=="string"?"string":"hash"]:i.map}return _0=e,_0}var U0,nS;function dR(){if(nS)return U0;nS=1;var t=fh();function e(r){var a=t(this,r).delete(r);return this.size-=a?1:0,a}return U0=e,U0}var q0,iS;function fR(){if(iS)return q0;iS=1;var t=fh();function e(r){return t(this,r).get(r)}return q0=e,q0}var I0,sS;function hR(){if(sS)return I0;sS=1;var t=fh();function e(r){return t(this,r).has(r)}return I0=e,I0}var V0,lS;function vR(){if(lS)return V0;lS=1;var t=fh();function e(r,a){var i=t(this,r),s=i.size;return i.set(r,a),this.size+=i.size==s?0:1,this}return V0=e,V0}var F0,oS;function pR(){if(oS)return F0;oS=1;var t=uR(),e=dR(),r=fR(),a=hR(),i=vR();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,F0=s,F0}var H0,uS;function gR(){if(uS)return H0;uS=1;var t=pR(),e="Expected a function";function r(a,i){if(typeof a!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var s=function(){var o=arguments,u=i?i.apply(this,o):o[0],d=s.cache;if(d.has(u))return d.get(u);var f=a.apply(this,o);return s.cache=d.set(u,f)||d,f};return s.cache=new(r.Cache||t),s}return r.Cache=t,H0=r,H0}var G0,cS;function mR(){if(cS)return G0;cS=1;var t=gR(),e=500;function r(a){var i=t(a,function(o){return s.size===e&&s.clear(),o}),s=i.cache;return i}return G0=r,G0}var Q0,dS;function BC(){if(dS)return Q0;dS=1;var t=mR(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=t(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(e,function(o,u,d,f){s.push(d?f.replace(r,"$1"):u||o)}),s});return Q0=a,Q0}var $0,fS;function LC(){if(fS)return $0;fS=1;function t(e,r){for(var a=-1,i=e==null?0:e.length,s=Array(i);++a<i;)s[a]=r(e[a],a,e);return s}return $0=t,$0}var Y0,hS;function yR(){if(hS)return Y0;hS=1;var t=Fm(),e=LC(),r=uh(),a=jc(),i=t?t.prototype:void 0,s=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return e(u,o)+"";if(a(u))return s?s.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Y0=o,Y0}var K0,vS;function PC(){if(vS)return K0;vS=1;var t=yR();function e(r){return r==null?"":t(r)}return K0=e,K0}var X0,pS;function zC(){if(pS)return X0;pS=1;var t=uh(),e=F3(),r=BC(),a=PC();function i(s,o){return t(s)?s:e(s,o)?[s]:r(a(s))}return X0=i,X0}var Z0,gS;function Jm(){if(gS)return Z0;gS=1;var t=jc();function e(r){if(typeof r=="string"||t(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return Z0=e,Z0}var W0,mS;function xR(){if(mS)return W0;mS=1;var t=zC(),e=Jm();function r(a,i){i=t(i,a);for(var s=0,o=i.length;a!=null&&s<o;)a=a[e(i[s++])];return s&&s==o?a:void 0}return W0=r,W0}var J0,yS;function bR(){if(yS)return J0;yS=1;var t=xR();function e(r,a,i){var s=r==null?void 0:t(r,a);return s===void 0?i:s}return J0=e,J0}var wR=bR(),SR=Cc(wR),eg,xS;function ER(){if(xS)return eg;xS=1;var t=Wm(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return eg=e,eg}var tg,bS;function TR(){if(bS)return tg;bS=1;var t=ER();function e(r,a,i){a=="__proto__"&&t?t(r,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[a]=i}return tg=e,tg}var rg,wS;function CR(){if(wS)return rg;wS=1;var t=TR(),e=RC(),r=Object.prototype,a=r.hasOwnProperty;function i(s,o,u){var d=s[o];(!(a.call(s,o)&&e(d,u))||u===void 0&&!(o in s))&&t(s,o,u)}return rg=i,rg}var ag,SS;function NR(){if(SS)return ag;SS=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(a,i){var s=typeof a;return i=i??t,!!i&&(s=="number"||s!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<i}return ag=r,ag}var ng,ES;function jR(){if(ES)return ng;ES=1;var t=CR(),e=zC(),r=NR(),a=Nc(),i=Jm();function s(o,u,d,f){if(!a(o))return o;u=e(u,o);for(var h=-1,p=u.length,m=p-1,y=o;y!=null&&++h<p;){var x=i(u[h]),E=d;if(x==="__proto__"||x==="constructor"||x==="prototype")return o;if(h!=m){var w=y[x];E=f?f(w,x,y):void 0,E===void 0&&(E=a(w)?w:r(u[h+1])?[]:{})}t(y,x,E),y=y[x]}return o}return ng=s,ng}var ig,TS;function AR(){if(TS)return ig;TS=1;var t=jR();function e(r,a,i){return r==null?r:t(r,a,i)}return ig=e,ig}var MR=AR(),kR=Cc(MR),sg,CS;function DR(){if(CS)return sg;CS=1;function t(e,r){var a=-1,i=e.length;for(r||(r=Array(i));++a<i;)r[a]=e[a];return r}return sg=t,sg}var lg,NS;function OR(){if(NS)return lg;NS=1;var t=LC(),e=DR(),r=uh(),a=jc(),i=BC(),s=Jm(),o=PC();function u(d){return r(d)?t(d,s):a(d)?[d]:e(i(o(d)))}return lg=u,lg}var RR=OR(),BR=Cc(RR),LR={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(i){},beforeSet:function(i,s){},onSet:function(i){},canSet:function(i){return!0}};return e=tt({},r,e),function(i,s){var o=e,u=this,d=u.length!==void 0,f=d?u:[u],h=d?u[0]:u;if(Xe(i)){var p=i.indexOf(".")!==-1,m=p&&BR(i);if(o.allowGetting&&s===void 0){var y;return h&&(o.beforeGet(h),m&&h._private[o.field][i]===void 0?y=SR(h._private[o.field],m):y=h._private[o.field][i]),y}else if(o.allowSetting&&s!==void 0){var x=!o.immutableKeys[i];if(x){var E=WT({},i,s);o.beforeSet(u,E);for(var w=0,T=f.length;w<T;w++){var C=f[w];o.canSet(C)&&(m&&h._private[o.field][i]===void 0?kR(C._private[o.field],m,s):C._private[o.field][i]=s)}o.updateStyle&&u.updateStyle(),o.onSet(u),o.settingTriggersEvent&&u[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&wt(i)){var N=i,A,D,M=Object.keys(N);o.beforeSet(u,N);for(var j=0;j<M.length;j++){A=M[j],D=N[A];var k=!o.immutableKeys[A];if(k)for(var R=0;R<f.length;R++){var z=f[R];o.canSet(z)&&(z._private[o.field][A]=D)}}o.updateStyle&&u.updateStyle(),o.onSet(u),o.settingTriggersEvent&&u[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&Wt(i)){var B=i;u.on(o.bindingEvent,B)}else if(o.allowGetting&&i===void 0){var L;return h&&(o.beforeGet(h),L=h._private[o.field]),L}return u}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=tt({},r,e),function(i){var s=e,o=this,u=o.length!==void 0,d=u?o:[o];if(Xe(i)){for(var f=i.split(/\s+/),h=f.length,p=0;p<h;p++){var m=f[p];if(!rs(m)){var y=!s.immutableKeys[m];if(y)for(var x=0,E=d.length;x<E;x++)d[x]._private[s.field][m]=void 0}}s.triggerEvent&&o[s.triggerFnName](s.event)}else if(i===void 0){for(var w=0,T=d.length;w<T;w++)for(var C=d[w]._private[s.field],N=Object.keys(C),A=0;A<N.length;A++){var D=N[A],M=!s.immutableKeys[D];M&&(C[D]=void 0)}s.triggerEvent&&o[s.triggerFnName](s.event)}return o}}},PR={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,i){var s=this,o=Array.prototype.slice.call(arguments,0);return new Lo(function(u,d){var f=function(y){s.off.apply(s,p),u(y)},h=o.concat([f]),p=h.concat([]);s.on.apply(s,h)})}}},jt={};[V3,LR,PR].forEach(function(t){tt(jt,t)});var zR={animate:jt.animate(),animation:jt.animation(),animated:jt.animated(),clearQueue:jt.clearQueue(),delay:jt.delay(),delayAnimation:jt.delayAnimation(),stop:jt.stop()},Ef={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(x){return a.push(x)}),a}else _t(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],s=new Bo(e),o=0;o<r.length;o++){for(var u=r[o],d=u._private,f=d.classes,h=!1,p=0;p<e.length;p++){var m=e[p],y=f.has(m);if(!y){h=!0;break}}h||(h=f.size!==e.length),h&&(d.classes=s,i.push(u))}return i.length>0&&this.spawn(i).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){_t(e)||(e=e.match(/\S+/g)||[]);for(var a=this,i=r===void 0,s=[],o=0,u=a.length;o<u;o++)for(var d=a[o],f=d._private.classes,h=!1,p=0;p<e.length;p++){var m=e[p],y=f.has(m),x=!1;r||i&&!y?(f.add(m),x=!0):(!r||i&&y)&&(f.delete(m),x=!0),!h&&x&&(s.push(d),h=!0)}return s.length>0&&this.spawn(s).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};Ef.className=Ef.classNames=Ef.classes;var bt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Sr,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};bt.variable="(?:[\\w-.]|(?:\\\\"+bt.metaChar+"))+";bt.className="(?:[\\w-]|(?:\\\\"+bt.metaChar+"))+";bt.value=bt.string+"|"+bt.number;bt.id=bt.variable;(function(){var t,e,r;for(t=bt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],bt.comparatorOp+="|@"+e;for(t=bt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(bt.comparatorOp+="|\\!"+e)})();var Pt=function(){return{checks:[]}},Ie={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},am=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return LD(t.selector,e.selector)}),_R=(function(){for(var t={},e,r=0;r<am.length;r++)e=am[r],t[e.selector]=e.matches;return t})(),UR=function(e,r){return _R[e](r)},qR="("+am.map(function(t){return t.selector}).join("|")+")",$l=function(e){return e.replace(new RegExp("\\\\("+bt.metaChar+")","g"),function(r,a){return a})},Ri=function(e,r,a){e[e.length-1]=a},nm=[{name:"group",query:!0,regex:"("+bt.group+")",populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.GROUP,value:s==="*"?s:s+"s"})}},{name:"state",query:!0,regex:qR,populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.STATE,value:s})}},{name:"id",query:!0,regex:"\\#("+bt.id+")",populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.ID,value:$l(s)})}},{name:"className",query:!0,regex:"\\.("+bt.className+")",populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.CLASS,value:$l(s)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+bt.variable+")\\s*\\]",populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.DATA_EXIST,field:$l(s)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+bt.variable+")\\s*("+bt.comparatorOp+")\\s*("+bt.value+")\\s*\\]",populate:function(e,r,a){var i=mr(a,3),s=i[0],o=i[1],u=i[2],d=new RegExp("^"+bt.string+"$").exec(u)!=null;d?u=u.substring(1,u.length-1):u=parseFloat(u),r.checks.push({type:Ie.DATA_COMPARE,field:$l(s),operator:o,value:u})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+bt.boolOp+")\\s*("+bt.variable+")\\s*\\]",populate:function(e,r,a){var i=mr(a,2),s=i[0],o=i[1];r.checks.push({type:Ie.DATA_BOOL,field:$l(o),operator:s})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+bt.meta+")\\s*("+bt.comparatorOp+")\\s*("+bt.number+")\\s*\\]\\]",populate:function(e,r,a){var i=mr(a,3),s=i[0],o=i[1],u=i[2];r.checks.push({type:Ie.META_COMPARE,field:$l(s),operator:o,value:parseFloat(u)})}},{name:"nextQuery",separator:!0,regex:bt.separator,populate:function(e,r){var a=e.currentSubject,i=e.edgeCount,s=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=i,o.compoundCount=s,e.edgeCount=0,e.compoundCount=0;var u=e[e.length++]=Pt();return u}},{name:"directedEdge",separator:!0,regex:bt.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Pt(),i=r,s=Pt();return a.checks.push({type:Ie.DIRECTED_EDGE,source:i,target:s}),Ri(e,r,a),e.edgeCount++,s}else{var o=Pt(),u=r,d=Pt();return o.checks.push({type:Ie.NODE_SOURCE,source:u,target:d}),Ri(e,r,o),e.edgeCount++,d}}},{name:"undirectedEdge",separator:!0,regex:bt.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Pt(),i=r,s=Pt();return a.checks.push({type:Ie.UNDIRECTED_EDGE,nodes:[i,s]}),Ri(e,r,a),e.edgeCount++,s}else{var o=Pt(),u=r,d=Pt();return o.checks.push({type:Ie.NODE_NEIGHBOR,node:u,neighbor:d}),Ri(e,r,o),d}}},{name:"child",separator:!0,regex:bt.child,populate:function(e,r){if(e.currentSubject==null){var a=Pt(),i=Pt(),s=e[e.length-1];return a.checks.push({type:Ie.CHILD,parent:s,child:i}),Ri(e,r,a),e.compoundCount++,i}else if(e.currentSubject===r){var o=Pt(),u=e[e.length-1],d=Pt(),f=Pt(),h=Pt(),p=Pt();return o.checks.push({type:Ie.COMPOUND_SPLIT,left:u,right:d,subject:f}),f.checks=r.checks,r.checks=[{type:Ie.TRUE}],p.checks.push({type:Ie.TRUE}),d.checks.push({type:Ie.PARENT,parent:p,child:h}),Ri(e,u,o),e.currentSubject=f,e.compoundCount++,h}else{var m=Pt(),y=Pt(),x=[{type:Ie.PARENT,parent:m,child:y}];return m.checks=r.checks,r.checks=x,e.compoundCount++,y}}},{name:"descendant",separator:!0,regex:bt.descendant,populate:function(e,r){if(e.currentSubject==null){var a=Pt(),i=Pt(),s=e[e.length-1];return a.checks.push({type:Ie.DESCENDANT,ancestor:s,descendant:i}),Ri(e,r,a),e.compoundCount++,i}else if(e.currentSubject===r){var o=Pt(),u=e[e.length-1],d=Pt(),f=Pt(),h=Pt(),p=Pt();return o.checks.push({type:Ie.COMPOUND_SPLIT,left:u,right:d,subject:f}),f.checks=r.checks,r.checks=[{type:Ie.TRUE}],p.checks.push({type:Ie.TRUE}),d.checks.push({type:Ie.ANCESTOR,ancestor:p,descendant:h}),Ri(e,u,o),e.currentSubject=f,e.compoundCount++,h}else{var m=Pt(),y=Pt(),x=[{type:Ie.ANCESTOR,ancestor:m,descendant:y}];return m.checks=r.checks,r.checks=x,e.compoundCount++,y}}},{name:"subject",modifier:!0,regex:bt.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return At("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],i=a.checks[0],s=i==null?null:i.type;s===Ie.DIRECTED_EDGE?i.type=Ie.NODE_TARGET:s===Ie.UNDIRECTED_EDGE&&(i.type=Ie.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];nm.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var IR=function(e){for(var r,a,i,s=0;s<nm.length;s++){var o=nm[s],u=o.name,d=e.match(o.regexObj);if(d!=null){a=d,r=o,i=u;var f=d[0];e=e.substring(f.length);break}}return{expr:r,match:a,name:i,remaining:e}},VR=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},FR=function(e){var r=this,a=r.inputText=e,i=r[0]=Pt();for(r.length=1,a=VR(a);;){var s=IR(a);if(s.expr==null)return At("The selector `"+e+"`is invalid"),!1;var o=s.match.slice(1),u=s.expr.populate(r,i,o);if(u===!1)return!1;if(u!=null&&(i=u),a=s.remaining,a.match(/^\s*$/))break}var d=r[r.length-1];r.currentSubject!=null&&(d.subject=r.currentSubject),d.edgeCount=r.edgeCount,d.compoundCount=r.compoundCount;for(var f=0;f<r.length;f++){var h=r[f];if(h.compoundCount>0&&h.edgeCount>0)return At("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return At("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;h.edgeCount===1&&At("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},HR=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(h){return h??""},r=function(h){return Xe(h)?'"'+h+'"':e(h)},a=function(h){return" "+h+" "},i=function(h,p){var m=h.type,y=h.value;switch(m){case Ie.GROUP:{var x=e(y);return x.substring(0,x.length-1)}case Ie.DATA_COMPARE:{var E=h.field,w=h.operator;return"["+E+a(e(w))+r(y)+"]"}case Ie.DATA_BOOL:{var T=h.operator,C=h.field;return"["+e(T)+C+"]"}case Ie.DATA_EXIST:{var N=h.field;return"["+N+"]"}case Ie.META_COMPARE:{var A=h.operator,D=h.field;return"[["+D+a(e(A))+r(y)+"]]"}case Ie.STATE:return y;case Ie.ID:return"#"+y;case Ie.CLASS:return"."+y;case Ie.PARENT:case Ie.CHILD:return s(h.parent,p)+a(">")+s(h.child,p);case Ie.ANCESTOR:case Ie.DESCENDANT:return s(h.ancestor,p)+" "+s(h.descendant,p);case Ie.COMPOUND_SPLIT:{var M=s(h.left,p),j=s(h.subject,p),k=s(h.right,p);return M+(M.length>0?" ":"")+j+k}case Ie.TRUE:return""}},s=function(h,p){return h.checks.reduce(function(m,y,x){return m+(p===h&&x===0?"$":"")+i(y,p)},"")},o="",u=0;u<this.length;u++){var d=this[u];o+=s(d,d.subject),this.length>1&&u<this.length-1&&(o+=", ")}return this.toStringCache=o,o},GR={parse:FR,toString:HR},_C=function(e,r,a){var i,s=Xe(e),o=De(e),u=Xe(a),d,f,h=!1,p=!1,m=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),p=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),h=!0),(s||u||h)&&(d=!s&&!o?"":""+e,f=""+a),h&&(e=d=d.toLowerCase(),a=f=f.toLowerCase()),r){case"*=":i=d.indexOf(f)>=0;break;case"$=":i=d.indexOf(f,d.length-f.length)>=0;break;case"^=":i=d.indexOf(f)===0;break;case"=":i=e===a;break;case">":m=!0,i=e>a;break;case">=":m=!0,i=e>=a;break;case"<":m=!0,i=e<a;break;case"<=":m=!0,i=e<=a;break;default:i=!1;break}return p&&(e!=null||!m)&&(i=!i),i},QR=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},$R=function(e){return e!==void 0},ey=function(e,r){return e.data(r)},YR=function(e,r){return e[r]()},ir=[],Ft=function(e,r){return e.checks.every(function(a){return ir[a.type](a,r)})};ir[Ie.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};ir[Ie.STATE]=function(t,e){var r=t.value;return UR(r,e)};ir[Ie.ID]=function(t,e){var r=t.value;return e.id()===r};ir[Ie.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};ir[Ie.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,i=t.value;return _C(YR(e,r),a,i)};ir[Ie.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,i=t.value;return _C(ey(e,r),a,i)};ir[Ie.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return QR(ey(e,r),a)};ir[Ie.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,$R(ey(e,r))};ir[Ie.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],i=e.source(),s=e.target();return Ft(r,i)&&Ft(a,s)||Ft(a,i)&&Ft(r,s)};ir[Ie.NODE_NEIGHBOR]=function(t,e){return Ft(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Ft(t.neighbor,r)})};ir[Ie.DIRECTED_EDGE]=function(t,e){return Ft(t.source,e.source())&&Ft(t.target,e.target())};ir[Ie.NODE_SOURCE]=function(t,e){return Ft(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Ft(t.target,r)})};ir[Ie.NODE_TARGET]=function(t,e){return Ft(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Ft(t.source,r)})};ir[Ie.CHILD]=function(t,e){return Ft(t.child,e)&&Ft(t.parent,e.parent())};ir[Ie.PARENT]=function(t,e){return Ft(t.parent,e)&&e.children().some(function(r){return Ft(t.child,r)})};ir[Ie.DESCENDANT]=function(t,e){return Ft(t.descendant,e)&&e.ancestors().some(function(r){return Ft(t.ancestor,r)})};ir[Ie.ANCESTOR]=function(t,e){return Ft(t.ancestor,e)&&e.descendants().some(function(r){return Ft(t.descendant,r)})};ir[Ie.COMPOUND_SPLIT]=function(t,e){return Ft(t.subject,e)&&Ft(t.left,e)&&Ft(t.right,e)};ir[Ie.TRUE]=function(){return!0};ir[Ie.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};ir[Ie.FILTER]=function(t,e){var r=t.value;return r(e)};var KR=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===Ie.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(s){for(var o=0;o<r.length;o++){var u=r[o];if(Ft(u,s))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},XR=function(e){for(var r=this,a=0;a<r.length;a++){var i=r[a];if(Ft(i,e))return!0}return!1},ZR={matches:XR,filter:KR},is=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||Xe(e)&&e.match(/^\s*$/)||(Da(e)?this.addQuery({checks:[{type:Ie.COLLECTION,value:e.collection()}]}):Wt(e)?this.addQuery({checks:[{type:Ie.FILTER,value:e}]}):Xe(e)?this.parse(e)||(this.invalid=!0):$t("A selector must be created from a string; found "))},ss=is.prototype;[GR,ZR].forEach(function(t){return tt(ss,t)});ss.text=function(){return this.inputText};ss.size=function(){return this.length};ss.eq=function(t){return this[t]};ss.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};ss.addQuery=function(t){this[this.length++]=t};ss.selector=ss.toString;var Ji={allAre:function(e){var r=new is(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new is(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var i=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(i)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var i=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!i)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(i){return e.hasElementWithId(i.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};Ji.allAreNeighbours=Ji.allAreNeighbors;Ji.has=Ji.contains;Ji.equal=Ji.equals=Ji.same;var Xa=function(e,r){return function(i,s,o,u){var d=i,f=this,h;if(d==null?h="":Da(d)&&d.length===1&&(h=d.id()),f.length===1&&h){var p=f[0]._private,m=p.traversalCache=p.traversalCache||{},y=m[r]=m[r]||[],x=Ws(h),E=y[x];return E||(y[x]=e.call(f,i,s,o,u))}else return e.call(f,i,s,o,u)}},Do={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var i=0;i<this.length;i++){var s=this[i],o=s._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var i=0;i<a.length;i++){var s=a[i];r.push(s)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var i=this[a],s=i.parents();r=r||s,r=r.intersect(s)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Xa(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],i=a._private.children,s=0;s<i.length;s++)e.push(i[s]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function a(i){for(var s=0;s<i.length;s++){var o=i[s];r.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function ty(t,e,r,a){for(var i=[],s=new Bo,o=t.cy(),u=o.hasCompoundNodes(),d=0;d<t.length;d++){var f=t[d];r?i.push(f):u&&a(i,s,f)}for(;i.length>0;){var h=i.shift();e(h),s.add(h.id()),u&&a(i,s,h)}return t}function UC(t,e,r){if(r.isParent())for(var a=r._private.children,i=0;i<a.length;i++){var s=a[i];e.has(s.id())||t.push(s)}}Do.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ty(this,t,e,UC)};function qC(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Do.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ty(this,t,e,qC)};function WR(t,e,r){qC(t,e,r),UC(t,e,r)}Do.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ty(this,t,e,WR)};Do.ancestors=Do.parents;var nc,IC;nc=IC={data:jt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:jt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:jt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:jt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:jt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:jt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};nc.attr=nc.data;nc.removeAttr=nc.removeData;var JR=IC,hh={};function og(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,i=r[0],s=i._private.edges,o=0;o<s.length;o++){var u=s[o];!e&&u.isLoop()||(a+=t(i,u))}return a}else return}}tt(hh,{degree:og(function(t,e){return e.source().same(e.target())?2:1}),indegree:og(function(t,e){return e.target().same(t)?1:0}),outdegree:og(function(t,e){return e.source().same(t)?1:0})});function Yl(t,e){return function(r){for(var a,i=this.nodes(),s=0;s<i.length;s++){var o=i[s],u=o[t](r);u!==void 0&&(a===void 0||e(u,a))&&(a=u)}return a}}tt(hh,{minDegree:Yl("degree",function(t,e){return t<e}),maxDegree:Yl("degree",function(t,e){return t>e}),minIndegree:Yl("indegree",function(t,e){return t<e}),maxIndegree:Yl("indegree",function(t,e){return t>e}),minOutdegree:Yl("outdegree",function(t,e){return t<e}),maxOutdegree:Yl("outdegree",function(t,e){return t>e})});tt(hh,{totalDegree:function(e){for(var r=0,a=this.nodes(),i=0;i<a.length;i++)r+=a[i].degree(e);return r}});var sn,VC,FC=function(e,r,a){for(var i=0;i<e.length;i++){var s=e[i];if(!s.locked()){var o=s._private.position,u={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};s.isParent()&&!(u.x===0&&u.y===0)&&s.children().shift(u,a),s.dirtyBoundingBoxCache()}}},jS={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){FC(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};sn=VC={position:jt.data(jS),silentPosition:jt.data(tt({},jS,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){FC(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(wt(e))r?this.silentPosition(e):this.position(e);else if(Wt(e)){var a=e,i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s],u=void 0;(u=a(o,s))&&(r?o.silentPosition(u):o.position(u))}i.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var i;if(wt(e)?(i={x:De(e.x)?e.x:0,y:De(e.y)?e.y:0},a=r):Xe(e)&&De(r)&&(i={x:0,y:0},i[e]=r),i!=null){var s=this.cy();s.startBatch();for(var o=0;o<this.length;o++){var u=this[o];if(!(s.hasCompoundNodes()&&u.isChild()&&u.ancestors().anySame(this))){var d=u.position(),f={x:d.x+i.x,y:d.y+i.y};a?u.silentPosition(f):u.position(f)}}s.endBatch()}return this},silentShift:function(e,r){return wt(e)?this.shift(e,!0):Xe(e)&&De(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],i=this.cy(),s=i.zoom(),o=i.pan(),u=wt(e)?e:void 0,d=u!==void 0||r!==void 0&&Xe(e);if(a&&a.isNode())if(d)for(var f=0;f<this.length;f++){var h=this[f];r!==void 0?h.position(e,(r-o[e])/s):u!==void 0&&h.position(mC(u,s,o))}else{var p=a.position();return u=lh(p,s,o),e===void 0?u:u[e]}else if(!d)return;return this},relativePosition:function(e,r){var a=this[0],i=this.cy(),s=wt(e)?e:void 0,o=s!==void 0||r!==void 0&&Xe(e),u=i.hasCompoundNodes();if(a&&a.isNode())if(o)for(var d=0;d<this.length;d++){var f=this[d],h=u?f.parent():null,p=h&&h.length>0,m=p;p&&(h=h[0]);var y=m?h.position():{x:0,y:0};r!==void 0?f.position(e,r+y[e]):s!==void 0&&f.position({x:s.x+y.x,y:s.y+y.y})}else{var x=a.position(),E=u?a.parent():null,w=E&&E.length>0,T=w;w&&(E=E[0]);var C=T?E.position():{x:0,y:0};return s={x:x.x-C.x,y:x.y-C.y},e===void 0?s:s[e]}else if(!o)return;return this}};sn.modelPosition=sn.point=sn.position;sn.modelPositions=sn.points=sn.positions;sn.renderedPoint=sn.renderedPosition;sn.relativePoint=sn.relativePosition;var eB=VC,co,fs;co=fs={};fs.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),i=r.pan(),s=e.x1*a+i.x,o=e.x2*a+i.x,u=e.y1*a+i.y,d=e.y2*a+i.y;return{x1:s,x2:o,y1:u,y2:d,w:o-s,h:d-u}};fs.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};fs.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var u=o._private,d=o.children(),f=o.pstyle("compound-sizing-wrt-labels").value==="include",h={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},p=d.boundingBox({includeLabels:f,includeOverlays:!1,useCache:!1}),m=u.position;(p.w===0||p.h===0)&&(p={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},p.x1=m.x-p.w/2,p.x2=m.x+p.w/2,p.y1=m.y-p.h/2,p.y2=m.y+p.h/2);function y(R,z,B){var L=0,q=0,I=z+B;return R>0&&I>0&&(L=z/I*R,q=B/I*R),{biasDiff:L,biasComplementDiff:q}}function x(R,z,B,L){if(B.units==="%")switch(L){case"width":return R>0?B.pfValue*R:0;case"height":return z>0?B.pfValue*z:0;case"average":return R>0&&z>0?B.pfValue*(R+z)/2:0;case"min":return R>0&&z>0?R>z?B.pfValue*z:B.pfValue*R:0;case"max":return R>0&&z>0?R>z?B.pfValue*R:B.pfValue*z:0;default:return 0}else return B.units==="px"?B.pfValue:0}var E=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(E=E*100/h.width.val);var w=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(w=w*100/h.width.val);var T=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(T=T*100/h.height.val);var C=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(C=C*100/h.height.val);var N=y(h.width.val-p.w,E,w),A=N.biasDiff,D=N.biasComplementDiff,M=y(h.height.val-p.h,T,C),j=M.biasDiff,k=M.biasComplementDiff;u.autoPadding=x(p.w,p.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),u.autoWidth=Math.max(p.w,h.width.val),m.x=(-A+p.x1+p.x2+D)/2,u.autoHeight=Math.max(p.h,h.height.val),m.y=(-j+p.y1+p.y2+k)/2}for(var a=0;a<this.length;a++){var i=this[a],s=i._private;(!s.compoundBoundsClean||t)&&(r(i),e.batching()||(s.compoundBoundsClean=!0))}return this};var Ka=function(e){return e===1/0||e===-1/0?0:e},rn=function(e,r,a,i,s){i-r===0||s-a===0||r==null||a==null||i==null||s==null||(e.x1=r<e.x1?r:e.x1,e.x2=i>e.x2?i:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=s>e.y2?s:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Pi=function(e,r){return r==null?e:rn(e,r.x1,r.y1,r.x2,r.y2)},Ru=function(e,r,a){return ga(e,r,a)},lf=function(e,r,a){if(!r.cy().headless()){var i=r._private,s=i.rstyle,o=s.arrowWidth/2,u=r.pstyle(a+"-arrow-shape").value,d,f;if(u!=="none"){a==="source"?(d=s.srcX,f=s.srcY):a==="target"?(d=s.tgtX,f=s.tgtY):(d=s.midX,f=s.midY);var h=i.arrowBounds=i.arrowBounds||{},p=h[a]=h[a]||{};p.x1=d-o,p.y1=f-o,p.x2=d+o,p.y2=f+o,p.w=p.x2-p.x1,p.h=p.y2-p.y1,wf(p,1),rn(e,p.x1,p.y1,p.x2,p.y2)}}},ug=function(e,r,a){if(!r.cy().headless()){var i;a?i=a+"-":i="";var s=r._private,o=s.rstyle,u=r.pstyle(i+"label").strValue;if(u){var d=r.pstyle("text-halign"),f=r.pstyle("text-valign"),h=Ru(o,"labelWidth",a),p=Ru(o,"labelHeight",a),m=Ru(o,"labelX",a),y=Ru(o,"labelY",a),x=r.pstyle(i+"text-margin-x").pfValue,E=r.pstyle(i+"text-margin-y").pfValue,w=r.isEdge(),T=r.pstyle(i+"text-rotation"),C=r.pstyle("text-outline-width").pfValue,N=r.pstyle("text-border-width").pfValue,A=N/2,D=r.pstyle("text-background-padding").pfValue,M=2,j=p,k=h,R=k/2,z=j/2,B,L,q,I;if(w)B=m-R,L=m+R,q=y-z,I=y+z;else{switch(d.value){case"left":B=m-k,L=m;break;case"center":B=m-R,L=m+R;break;case"right":B=m,L=m+k;break}switch(f.value){case"top":q=y-j,I=y;break;case"center":q=y-z,I=y+z;break;case"bottom":q=y,I=y+j;break}}var Q=x-Math.max(C,A)-D-M,_=x+Math.max(C,A)+D+M,V=E-Math.max(C,A)-D-M,F=E+Math.max(C,A)+D+M;B+=Q,L+=_,q+=V,I+=F;var K=a||"main",ee=s.labelBounds,P=ee[K]=ee[K]||{};P.x1=B,P.y1=q,P.x2=L,P.y2=I,P.w=L-B,P.h=I-q,P.leftPad=Q,P.rightPad=_,P.topPad=V,P.botPad=F;var G=w&&T.strValue==="autorotate",Z=T.pfValue!=null&&T.pfValue!==0;if(G||Z){var J=G?Ru(s.rstyle,"labelAngle",a):T.pfValue,X=Math.cos(J),Y=Math.sin(J),le=(B+L)/2,me=(q+I)/2;if(!w){switch(d.value){case"left":le=L;break;case"right":le=B;break}switch(f.value){case"top":me=I;break;case"bottom":me=q;break}}var oe=function(Qe,Se){return Qe=Qe-le,Se=Se-me,{x:Qe*X-Se*Y+le,y:Qe*Y+Se*X+me}},ae=oe(B,q),re=oe(B,I),se=oe(L,q),ie=oe(L,I);B=Math.min(ae.x,re.x,se.x,ie.x),L=Math.max(ae.x,re.x,se.x,ie.x),q=Math.min(ae.y,re.y,se.y,ie.y),I=Math.max(ae.y,re.y,se.y,ie.y)}var Ne=K+"Rot",Ae=ee[Ne]=ee[Ne]||{};Ae.x1=B,Ae.y1=q,Ae.x2=L,Ae.y2=I,Ae.w=L-B,Ae.h=I-q,rn(e,B,q,L,I),rn(s.labelBounds.all,B,q,L,I)}return e}},AS=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,s=r.pstyle("outline-offset").value,o=i+s;HC(e,r,a,o,"outside",o/2)}},HC=function(e,r,a,i,s,o){if(!(a===0||i<=0||s==="inside")){var u=r.cy(),d=r.pstyle("shape").value,f=u.renderer().nodeShapes[d],h=r.position(),p=h.x,m=h.y,y=r.width(),x=r.height();if(f.hasMiterBounds){s==="center"&&(i/=2);var E=f.miterBounds(p,m,y,x,i);Pi(e,E)}else o!=null&&o>0&&Sf(e,[o,o,o,o])}},tB=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,s=r.pstyle("border-position").value;HC(e,r,a,i,s)}},rB=function(e,r){var a=e._private.cy,i=a.styleEnabled(),s=a.headless(),o=na(),u=e._private,d=e.isNode(),f=e.isEdge(),h,p,m,y,x,E,w=u.rstyle,T=d&&i?e.pstyle("bounds-expansion").pfValue:[0],C=function(Ze){return Ze.pstyle("display").value!=="none"},N=!i||C(e)&&(!f||C(e.source())&&C(e.target()));if(N){var A=0,D=0;i&&r.includeOverlays&&(A=e.pstyle("overlay-opacity").value,A!==0&&(D=e.pstyle("overlay-padding").value));var M=0,j=0;i&&r.includeUnderlays&&(M=e.pstyle("underlay-opacity").value,M!==0&&(j=e.pstyle("underlay-padding").value));var k=Math.max(D,j),R=0,z=0;if(i&&(R=e.pstyle("width").pfValue,z=R/2),d&&r.includeNodes){var B=e.position();x=B.x,E=B.y;var L=e.outerWidth(),q=L/2,I=e.outerHeight(),Q=I/2;h=x-q,p=x+q,m=E-Q,y=E+Q,rn(o,h,m,p,y),i&&AS(o,e),i&&r.includeOutlines&&!s&&AS(o,e),i&&tB(o,e)}else if(f&&r.includeEdges)if(i&&!s){var _=e.pstyle("curve-style").strValue;if(h=Math.min(w.srcX,w.midX,w.tgtX),p=Math.max(w.srcX,w.midX,w.tgtX),m=Math.min(w.srcY,w.midY,w.tgtY),y=Math.max(w.srcY,w.midY,w.tgtY),h-=z,p+=z,m-=z,y+=z,rn(o,h,m,p,y),_==="haystack"){var V=w.haystackPts;if(V&&V.length===2){if(h=V[0].x,m=V[0].y,p=V[1].x,y=V[1].y,h>p){var F=h;h=p,p=F}if(m>y){var K=m;m=y,y=K}rn(o,h-z,m-z,p+z,y+z)}}else if(_==="bezier"||_==="unbundled-bezier"||Yi(_,"segments")||Yi(_,"taxi")){var ee;switch(_){case"bezier":case"unbundled-bezier":ee=w.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":ee=w.linePts;break}if(ee!=null)for(var P=0;P<ee.length;P++){var G=ee[P];h=G.x-z,p=G.x+z,m=G.y-z,y=G.y+z,rn(o,h,m,p,y)}}}else{var Z=e.source(),J=Z.position(),X=e.target(),Y=X.position();if(h=J.x,p=Y.x,m=J.y,y=Y.y,h>p){var le=h;h=p,p=le}if(m>y){var me=m;m=y,y=me}h-=z,p+=z,m-=z,y+=z,rn(o,h,m,p,y)}if(i&&r.includeEdges&&f&&(lf(o,e,"mid-source"),lf(o,e,"mid-target"),lf(o,e,"source"),lf(o,e,"target")),i){var oe=e.pstyle("ghost").value==="yes";if(oe){var ae=e.pstyle("ghost-offset-x").pfValue,re=e.pstyle("ghost-offset-y").pfValue;rn(o,o.x1+ae,o.y1+re,o.x2+ae,o.y2+re)}}var se=u.bodyBounds=u.bodyBounds||{};hw(se,o),Sf(se,T),wf(se,1),i&&(h=o.x1,p=o.x2,m=o.y1,y=o.y2,rn(o,h-k,m-k,p+k,y+k));var ie=u.overlayBounds=u.overlayBounds||{};hw(ie,o),Sf(ie,T),wf(ie,1);var Ne=u.labelBounds=u.labelBounds||{};Ne.all!=null?zO(Ne.all):Ne.all=na(),i&&r.includeLabels&&(r.includeMainLabels&&ug(o,e,null),f&&(r.includeSourceLabels&&ug(o,e,"source"),r.includeTargetLabels&&ug(o,e,"target")))}return o.x1=Ka(o.x1),o.y1=Ka(o.y1),o.x2=Ka(o.x2),o.y2=Ka(o.y2),o.w=Ka(o.x2-o.x1),o.h=Ka(o.y2-o.y1),o.w>0&&o.h>0&&N&&(Sf(o,T),wf(o,1)),o},GC=function(e){var r=0,a=function(o){return(o?1:0)<<r++},i=0;return i+=a(e.incudeNodes),i+=a(e.includeEdges),i+=a(e.includeLabels),i+=a(e.includeMainLabels),i+=a(e.includeSourceLabels),i+=a(e.includeTargetLabels),i+=a(e.includeOverlays),i+=a(e.includeOutlines),i},QC=function(e){var r=function(u){return Math.round(u)};if(e.isEdge()){var a=e.source().position(),i=e.target().position();return lw([r(a.x),r(a.y),r(i.x),r(i.y)])}else{var s=e.position();return lw([r(s.x),r(s.y)])}},MS=function(e,r){var a=e._private,i,s=e.isEdge(),o=r==null?kS:GC(r),u=o===kS;if(a.bbCache==null?(i=rB(e,ic),a.bbCache=i,a.bbCachePosKey=QC(e)):i=a.bbCache,!u){var d=e.isNode();i=na(),(r.includeNodes&&d||r.includeEdges&&!d)&&(r.includeOverlays?Pi(i,a.overlayBounds):Pi(i,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!s||r.includeSourceLabels&&r.includeTargetLabels)?Pi(i,a.labelBounds.all):(r.includeMainLabels&&Pi(i,a.labelBounds.mainRot),r.includeSourceLabels&&Pi(i,a.labelBounds.sourceRot),r.includeTargetLabels&&Pi(i,a.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},ic={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},kS=GC(ic),DS=Fr(ic);fs.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,a=Mo(function(h){var p=h._private;return p.bbCache==null||p.styleDirty||p.bbCachePosKey!==QC(h)},function(h){return h.id()});if(r&&this.length===1&&!a(this[0]))t===void 0?t=ic:t=DS(t),e=MS(this[0],t);else{e=na(),t=t||ic;var i=DS(t),s=this,o=s.cy(),u=o.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),u&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var d=0;d<s.length;d++){var f=s[d];a(f)&&f.dirtyBoundingBoxCache(),Pi(e,MS(f,i))}}return e.x1=Ka(e.x1),e.y1=Ka(e.y1),e.x2=Ka(e.x2),e.y2=Ka(e.y2),e.w=Ka(e.x2-e.x1),e.h=Ka(e.y2-e.y1),e};fs.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};fs.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),i=r.collection();if(a&&(i=e.filter(function(f){return f.isParent()}),e=e.not(i)),wt(t)){var s=t;t=function(){return s}}var o=function(h,p){return h._private.bbAtOldPos=t(h,p)},u=function(h){return h._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),a&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var d=PO(this.boundingBox({useCache:!1}));return e.silentPositions(u),a&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),d};co.boundingbox=co.bb=co.boundingBox;co.renderedBoundingbox=co.renderedBoundingBox;var aB=fs,Iu,kc;Iu=kc={};var $C=function(e){e.uppercaseName=Q2(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Q2(e.outerName),Iu[e.name]=function(){var a=this[0],i=a._private,s=i.cy,o=s._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),i[e.autoName]||0;var u=a.pstyle(e.name);switch(u.strValue){case"label":return a.recalculateRenderedStyle(),i.rstyle[e.labelName]||0;default:return u.pfValue}}else return 1},Iu["outer"+e.uppercaseName]=function(){var a=this[0],i=a._private,s=i.cy,o=s._private.styleEnabled;if(a)if(o){var u=a[e.name](),d=a.pstyle("border-position").value,f;d==="center"?f=a.pstyle("border-width").pfValue:d==="outside"?f=2*a.pstyle("border-width").pfValue:f=0;var h=2*a.padding();return u+f+h}else return 1},Iu["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var i=a[e.name]();return i*this.cy().zoom()}},Iu["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var i=a[e.outerName]();return i*this.cy().zoom()}}};$C({name:"width"});$C({name:"height"});kc.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};kc.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};kc.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var nB=kc,iB=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},sB=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return lh(r(e),a.zoom(),a.pan())}},lB=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),i=a.pan(),s=a.zoom();return r(e).map(function(o){return lh(o,s,i)})}},oB=function(e){return e.renderer().getControlPoints(e)},uB=function(e){return e.renderer().getSegmentPoints(e)},cB=function(e){return e.renderer().getSourceEndpoint(e)},dB=function(e){return e.renderer().getTargetEndpoint(e)},fB=function(e){return e.renderer().getEdgeMidpoint(e)},OS={controlPoints:{get:oB,mult:!0},segmentPoints:{get:uB,mult:!0},sourceEndpoint:{get:cB},targetEndpoint:{get:dB},midpoint:{get:fB}},hB=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},vB=Object.keys(OS).reduce(function(t,e){var r=OS[e],a=hB(e);return t[e]=function(){return iB(this,r.get)},r.mult?t[a]=function(){return lB(this,r.get)}:t[a]=function(){return sB(this,r.get)},t},{}),pB=tt({},eB,aB,nB,vB);/*!
87
- Event object based on jQuery events, MIT license
88
-
89
- https://jquery.org/license/
90
- https://tldrlegal.com/license/mit-license
91
- https://github.com/jquery/jquery/blob/master/src/event.js
92
- */var YC=function(e,r){this.recycle(e,r)};function Bu(){return!1}function of(){return!0}YC.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Bu,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?of:Bu):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,i=this.cy.zoom(),s=this.cy.pan();this.renderedPosition={x:a.x*i+s.x,y:a.y*i+s.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=of;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=of;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=of,this.stopPropagation()},isDefaultPrevented:Bu,isPropagationStopped:Bu,isImmediatePropagationStopped:Bu};var KC=/^([^.]+)(\.(?:[^.]+))?$/,gB=".*",XC={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},RS=Object.keys(XC),mB={};function vh(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mB,e=arguments.length>1?arguments[1]:void 0,r=0;r<RS.length;r++){var a=RS[r];this[a]=t[a]||XC[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var ls=vh.prototype,ZC=function(e,r,a,i,s,o,u){Wt(i)&&(s=i,i=null),u&&(o==null?o=u:o=tt({},o,u));for(var d=_t(a)?a:a.split(/\s+/),f=0;f<d.length;f++){var h=d[f];if(!rs(h)){var p=h.match(KC);if(p){var m=p[1],y=p[2]?p[2]:null,x=r(e,h,m,y,i,s,o);if(x===!1)break}}}},BS=function(e,r){return e.addEventFields(e.context,r),new YC(r.type,r)},yB=function(e,r,a){if(TD(a)){r(e,a);return}else if(wt(a)){r(e,BS(e,a));return}for(var i=_t(a)?a:a.split(/\s+/),s=0;s<i.length;s++){var o=i[s];if(!rs(o)){var u=o.match(KC);if(u){var d=u[1],f=u[2]?u[2]:null,h=BS(e,{type:d,namespace:f,target:e.context});r(e,h)}}}};ls.on=ls.addListener=function(t,e,r,a,i){return ZC(this,function(s,o,u,d,f,h,p){Wt(h)&&s.listeners.push({event:o,callback:h,type:u,namespace:d,qualifier:f,conf:p})},t,e,r,a,i),this};ls.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};ls.removeListener=ls.off=function(t,e,r,a){var i=this;this.emitting!==0&&(this.listeners=sO(this.listeners));for(var s=this.listeners,o=function(f){var h=s[f];ZC(i,function(p,m,y,x,E,w){if((h.type===y||t==="*")&&(!x&&h.namespace!==".*"||h.namespace===x)&&(!E||p.qualifierCompare(h.qualifier,E))&&(!w||h.callback===w))return s.splice(f,1),!1},t,e,r,a)},u=s.length-1;u>=0;u--)o(u);return this};ls.removeAllListeners=function(){return this.removeListener("*")};ls.emit=ls.trigger=function(t,e,r){var a=this.listeners,i=a.length;return this.emitting++,_t(e)||(e=[e]),yB(this,function(s,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],i=a.length);for(var u=function(){var h=a[d];if(h.type===o.type&&(!h.namespace||h.namespace===o.namespace||h.namespace===gB)&&s.eventMatches(s.context,h,o)){var p=[o];e!=null&&oO(p,e),s.beforeEmit(s.context,h,o),h.conf&&h.conf.one&&(s.listeners=s.listeners.filter(function(x){return x!==h}));var m=s.callbackContext(s.context,h,o),y=h.callback.apply(m,p);s.afterEmit(s.context,h,o),y===!1&&(o.stopPropagation(),o.preventDefault())}},d=0;d<i;d++)u();s.bubble(s.context)&&!o.isPropagationStopped()&&s.parent(s.context).emit(o,e)},t),this.emitting--,this};var xB={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var i=r.qualifier;return i!=null?e!==a.target&&Tc(a.target)&&i.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},uf=function(e){return Xe(e)?new is(e):e},WC={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new vh(xB,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var i=uf(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,a)}return this},removeListener:function(e,r,a){for(var i=uf(r),s=0;s<this.length;s++){var o=this[s];o.emitter().removeListener(e,i,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var i=uf(r),s=0;s<this.length;s++){var o=this[s];o.emitter().one(e,i,a)}return this},once:function(e,r,a){for(var i=uf(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var i=this[a];i.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};jt.eventAliasesOn(WC);var JC={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var i=this[a];i.isNode()?e.push(i):r.push(i)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(Xe(e)||Da(e))return new is(e).filter(this);if(Wt(e)){for(var a=this.spawn(),i=this,s=0;s<i.length;s++){var o=i[s],u=r?e.apply(r,[o,s,i]):e(o,s,i);u&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){Xe(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var i=this[a],s=e.has(i);s||r.push(i)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Xe(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),i=this,s=e,o=this.length<e.length,u=o?i:s,d=o?s:i,f=0;f<u.length;f++){var h=u[f];d.has(h)&&a.push(h)}return a},xor:function(e){var r=this._private.cy;Xe(e)&&(e=r.$(e));var a=this.spawn(),i=this,s=e,o=function(d,f){for(var h=0;h<d.length;h++){var p=d[h],m=p._private.data.id,y=f.hasElementWithId(m);y||a.push(p)}};return o(i,s),o(s,i),a},diff:function(e){var r=this._private.cy;Xe(e)&&(e=r.$(e));var a=this.spawn(),i=this.spawn(),s=this.spawn(),o=this,u=e,d=function(h,p,m){for(var y=0;y<h.length;y++){var x=h[y],E=x._private.data.id,w=p.hasElementWithId(E);w?s.merge(x):m.push(x)}};return d(o,u,a),d(u,o,i),{left:a,right:i,both:s}},add:function(e){var r=this._private.cy;if(!e)return this;if(Xe(e)){var a=e;e=r.mutableElements().filter(a)}for(var i=this.spawnSelf(),s=0;s<e.length;s++){var o=e[s],u=!this.has(o);u&&i.push(o)}return i},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&Xe(e)){var i=e;e=a.mutableElements().filter(i)}for(var s=r.map,o=0;o<e.length;o++){var u=e[o],d=u._private.data.id,f=!s.has(d);if(f){var h=this.length++;this[h]=u,s.set(d,{ele:u,index:h})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),i=this._private,s=i.map;this[e]=void 0,s.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var u=this.length-1,d=this[u],f=d._private.data.id;this[u]=void 0,this[e]=d,s.set(f,{ele:d,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,i=r.map,s=i.get(a);if(!s)return this;var o=s.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&Xe(e)){var a=e;e=r.mutableElements().filter(a)}for(var i=0;i<e.length;i++)this.unmergeOne(e[i]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],i=this,s=0;s<i.length;s++){var o=i[s],u=r?e.apply(r,[o,s,i]):e(o,s,i);a.push(u)}return a},reduce:function(e,r){for(var a=r,i=this,s=0;s<i.length;s++)a=e(a,i[s],s,i);return a},max:function(e,r){for(var a=-1/0,i,s=this,o=0;o<s.length;o++){var u=s[o],d=r?e.apply(r,[u,o,s]):e(u,o,s);d>a&&(a=d,i=u)}return{value:a,ele:i}},min:function(e,r){for(var a=1/0,i,s=this,o=0;o<s.length;o++){var u=s[o],d=r?e.apply(r,[u,o,s]):e(u,o,s);d<a&&(a=d,i=u)}return{value:a,ele:i}}},Ct=JC;Ct.u=Ct["|"]=Ct["+"]=Ct.union=Ct.or=Ct.add;Ct["\\"]=Ct["!"]=Ct["-"]=Ct.difference=Ct.relativeComplement=Ct.subtract=Ct.not;Ct.n=Ct["&"]=Ct["."]=Ct.and=Ct.intersection=Ct.intersect;Ct["^"]=Ct["(+)"]=Ct["(-)"]=Ct.symmetricDifference=Ct.symdiff=Ct.xor;Ct.fnFilter=Ct.filterFn=Ct.stdFilter=Ct.filter;Ct.complement=Ct.abscomp=Ct.absoluteComplement;var bB={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},eN=function(e,r){var a=e.cy(),i=a.hasCompoundNodes();function s(h){var p=h.pstyle("z-compound-depth");return p.value==="auto"?i?h.zDepth():0:p.value==="bottom"?-1:p.value==="top"?Hm:0}var o=s(e)-s(r);if(o!==0)return o;function u(h){var p=h.pstyle("z-index-compare");return p.value==="auto"&&h.isNode()?1:0}var d=u(e)-u(r);if(d!==0)return d;var f=e.pstyle("z-index").value-r.pstyle("z-index").value;return f!==0?f:e.poolIndex()-r.poolIndex()},Ff={forEach:function(e,r){if(Wt(e))for(var a=this.length,i=0;i<a;i++){var s=this[i],o=r?e.apply(r,[s,i,this]):e(s,i,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],i=this.length;r==null&&(r=i),e==null&&(e=0),e<0&&(e=i+e),r<0&&(r=i+r);for(var s=e;s>=0&&s<r&&s<i;s++)a.push(this[s]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Wt(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(eN)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var i=r.data.parent?e.parents().size():0;return e.isParent()?i:Hm-1}else{var s=r.source,o=r.target,u=s.zDepth(),d=o.zDepth();return Math.max(u,d,0)}}}};Ff.each=Ff.forEach;var wB=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":Er(Symbol))!=e&&Er(Symbol.iterator)!=e;r&&(Ff[Symbol.iterator]=function(){var a=this,i={value:void 0,done:!1},s=0,o=this.length;return WT({next:function(){return s<o?i.value=a[s++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};wB();var SB=Fr({nodeDimensionsIncludeLabels:!1}),Tf={layoutDimensions:function(e){e=SB(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var i=this.nodes().filter(function(D){return!D.isParent()}),s=this.cy(),o=r.eles,u=function(M){return M.id()},d=Mo(a,u);e.emit({type:"layoutstart",layout:e}),e.animations=[];var f=function(M,j,k){var R={x:j.x1+j.w/2,y:j.y1+j.h/2},z={x:(k.x-R.x)*M,y:(k.y-R.y)*M};return{x:R.x+z.x,y:R.y+z.y}},h=r.spacingFactor&&r.spacingFactor!==1,p=function(){if(!h)return null;for(var M=na(),j=0;j<i.length;j++){var k=i[j],R=d(k,j);yC(M,R.x,R.y)}return M},m=p(),y=Mo(function(D,M){var j=d(D,M);if(h){var k=Math.abs(r.spacingFactor);j=f(k,m,j)}return r.transform!=null&&(j=r.transform(D,j)),j},u);if(r.animate){for(var x=0;x<i.length;x++){var E=i[x],w=y(E,x),T=r.animateFilter==null||r.animateFilter(E,x);if(T){var C=E.animation({position:w,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(C)}else E.position(w)}if(r.fit){var N=s.animation({fit:{boundingBox:o.boundingBoxAt(y),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(N)}else if(r.zoom!==void 0&&r.pan!==void 0){var A=s.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(A)}e.animations.forEach(function(D){return D.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Lo.all(e.animations.map(function(D){return D.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(y),r.fit&&s.fit(r.eles,r.padding),r.zoom!=null&&s.zoom(r.zoom),r.pan&&s.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(tt({},e,{eles:this}))}};Tf.createLayout=Tf.makeLayout=Tf.layout;function tN(t,e,r){var a=r._private,i=a.styleCache=a.styleCache||[],s;return(s=i[t])!=null||(s=i[t]=e(r)),s}function ph(t,e){return t=Ws(t),function(a){return tN(t,e,a)}}function gh(t,e){t=Ws(t);var r=function(i){return e.call(i)};return function(){var i=this[0];if(i)return tN(t,r,i)}}var qr={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),i=r.styleEnabled();return a&&i&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(s){return s._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(i){r(i),i.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var i=r.hasCompoundNodes(),s=this;e=!!(e||e===void 0),i&&(s=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=s;return e?o.emitAndNotify("style"):o.emit("style"),s.forEach(function(u){return u._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],i=a.cy();if(i.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,i.style().apply(a));var s=a._private.style[e];return s??(r?i.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var i=!1,s=a.style();if(wt(e)){var o=e;s.applyBypass(this,o,i),this.emitAndNotify("style")}else if(Xe(e))if(r===void 0){var u=this[0];return u?s.getStylePropertyValue(u,e):void 0}else s.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var d=this[0];return d?s.getRawStyle(d):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,i=r.style(),s=this;if(e===void 0)for(var o=0;o<s.length;o++){var u=s[o];i.removeAllBypasses(u,a)}else{e=e.split(/\s+/);for(var d=0;d<s.length;d++){var f=s[d];i.removeBypasses(f,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),a=this[0];if(a){var i=a._private,s=a.pstyle("opacity").value;if(!r)return s;var o=i.data.parent?a.parents():null;if(o)for(var u=0;u<o.length;u++){var d=o[u],f=d.pstyle("opacity").value;s=f*s}return s}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function cg(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var i=0;i<a.length;i++){var s=a[i];if(!e(s))return!1}return!0}function ry(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var i=this.cy();if(!i.styleEnabled())return!0;var s=this[0],o=i.hasCompoundNodes();if(s){var u=s._private;if(!e(s))return!1;if(s.isNode())return!o||cg(s,a);var d=u.source,f=u.target;return r(d)&&(!o||cg(d,r))&&(d===f||r(f)&&(!o||cg(f,r)))}}}var Po=ph("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});qr.takesUpSpace=gh("takesUpSpace",ry({ok:Po}));var EB=ph("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Po(t)}),TB=ph("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Po(t)});qr.interactive=gh("interactive",ry({ok:EB,parentOk:TB,edgeOkViaNode:Po}));qr.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var CB=ph("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Po(t)}),NB=Po;qr.visible=gh("visible",ry({ok:CB,edgeOkViaNode:NB}));qr.hidden=function(){var t=this[0];if(t)return!t.visible()};qr.isBundledBezier=gh("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});qr.bypass=qr.css=qr.style;qr.renderedCss=qr.renderedStyle;qr.removeBypass=qr.removeCss=qr.removeStyle;qr.pstyle=qr.parsedStyle;var es={};function LS(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],i=e[1];this.on(t.event,a,i)}else if(e.length===1&&Wt(e[0])){var s=e[0];this.on(t.event,s)}else if(e.length===0||e.length===1&&_t(e[0])){for(var o=e.length===1?e[0]:null,u=0;u<this.length;u++){var d=this[u],f=!t.ableField||d._private[t.ableField],h=d._private[t.field]!=t.value;if(t.overrideAble){var p=t.overrideAble(d);if(p!==void 0&&(f=p,!p))return this}f&&(d._private[t.field]=t.value,h&&r.push(d))}var m=this.spawn(r);m.updateStyle(),m.emit(t.event),o&&m.emit(o)}return this}}function zo(t){es[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},es[t.on]=LS({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),es[t.off]=LS({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}zo({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});zo({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});zo({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});zo({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});es.deselect=es.unselect;es.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};zo({field:"active",on:"activate",off:"unactivate"});zo({field:"pannable",on:"panify",off:"unpanify"});es.inactive=function(){var t=this[0];if(t)return!t._private.active};var Xr={},PS=function(e){return function(a){for(var i=this,s=[],o=0;o<i.length;o++){var u=i[o];if(u.isNode()){for(var d=!1,f=u.connectedEdges(),h=0;h<f.length;h++){var p=f[h],m=p.source(),y=p.target();if(e.noIncomingEdges&&y===u&&m!==u||e.noOutgoingEdges&&m===u&&y!==u){d=!0;break}}d||s.push(u)}}return this.spawn(s,!0).filter(a)}},zS=function(e){return function(r){for(var a=this,i=[],s=0;s<a.length;s++){var o=a[s];if(o.isNode())for(var u=o.connectedEdges(),d=0;d<u.length;d++){var f=u[d],h=f.source(),p=f.target();e.outgoing&&h===o?(i.push(f),i.push(p)):e.incoming&&p===o&&(i.push(f),i.push(h))}}return this.spawn(i,!0).filter(r)}},_S=function(e){return function(r){for(var a=this,i=[],s={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var u=!1,d=0;d<o.length;d++){var f=o[d],h=f.id();s[h]||(s[h]=!0,i.push(f),u=!0)}if(!u)break;a=o}return this.spawn(i,!0).filter(r)}};Xr.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};tt(Xr,{roots:PS({noIncomingEdges:!0}),leaves:PS({noOutgoingEdges:!0}),outgoers:Xa(zS({outgoing:!0}),"outgoers"),successors:_S({outgoing:!0}),incomers:Xa(zS({incoming:!0}),"incomers"),predecessors:_S({})});tt(Xr,{neighborhood:Xa(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var i=r[a],s=i.connectedEdges(),o=0;o<s.length;o++){var u=s[o],d=u.source(),f=u.target(),h=i===d?f:d;h.length>0&&e.push(h[0]),e.push(u[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});Xr.neighbourhood=Xr.neighborhood;Xr.closedNeighbourhood=Xr.closedNeighborhood;Xr.openNeighbourhood=Xr.openNeighborhood;tt(Xr,{source:Xa(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Xa(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:US({attr:"source"}),targets:US({attr:"target"})});function US(t){return function(r){for(var a=[],i=0;i<this.length;i++){var s=this[i],o=s._private[t.attr];o&&a.push(o)}return this.spawn(a,!0).filter(r)}}tt(Xr,{edgesWith:Xa(qS(),"edgesWith"),edgesTo:Xa(qS({thisIsSrc:!0}),"edgesTo")});function qS(t){return function(r){var a=[],i=this._private.cy,s=t||{};Xe(r)&&(r=i.$(r));for(var o=0;o<r.length;o++)for(var u=r[o]._private.edges,d=0;d<u.length;d++){var f=u[d],h=f._private.data,p=this.hasElementWithId(h.source)&&r.hasElementWithId(h.target),m=r.hasElementWithId(h.source)&&this.hasElementWithId(h.target),y=p||m;y&&((s.thisIsSrc||s.thisIsTgt)&&(s.thisIsSrc&&!p||s.thisIsTgt&&!m)||a.push(f))}return this.spawn(a,!0)}}tt(Xr,{connectedEdges:Xa(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var i=r[a];if(i.isNode())for(var s=i._private.edges,o=0;o<s.length;o++){var u=s[o];e.push(u)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Xa(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var i=r[a];i.isEdge()&&(e.push(i.source()[0]),e.push(i.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Xa(IS(),"parallelEdges"),codirectedEdges:Xa(IS({codirected:!0}),"codirectedEdges")});function IS(t){var e={codirected:!1};return t=tt({},e,t),function(a){for(var i=[],s=this.edges(),o=t,u=0;u<s.length;u++)for(var d=s[u],f=d._private,h=f.source,p=h._private.data.id,m=f.data.target,y=h._private.edges,x=0;x<y.length;x++){var E=y[x],w=E._private.data,T=w.target,C=w.source,N=T===m&&C===p,A=p===T&&m===C;(o.codirected&&N||!o.codirected&&(N||A))&&i.push(E)}return this.spawn(i,!0).filter(a)}}tt(Xr,{components:function(e){var r=this,a=r.cy(),i=a.collection(),s=e==null?r.nodes():e.nodes(),o=[];e!=null&&s.empty()&&(s=e.sources());var u=function(h,p){i.merge(h),s.unmerge(h),p.merge(h)};if(s.empty())return r.spawn();var d=function(){var h=a.collection();o.push(h);var p=s[0];u(p,h),r.bfs({directed:!1,roots:p,visit:function(y){return u(y,h)}}),h.forEach(function(m){m.connectedEdges().forEach(function(y){r.has(y)&&h.has(y.source())&&h.has(y.target())&&h.merge(y)})})};do d();while(s.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Xr.componentsOf=Xr.components;var Ir=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){$t("A collection must have a reference to the core");return}var s=new Zn,o=!1;if(!r)r=[];else if(r.length>0&&wt(r[0])&&!Tc(r[0])){o=!0;for(var u=[],d=new Bo,f=0,h=r.length;f<h;f++){var p=r[f];p.data==null&&(p.data={});var m=p.data;if(m.id==null)m.id=pC();else if(e.hasElementWithId(m.id)||d.has(m.id))continue;var y=new sh(e,p,!1);u.push(y),d.add(m.id)}r=u}this.length=0;for(var x=0,E=r.length;x<E;x++){var w=r[x][0];if(w!=null){var T=w._private.data.id;(!a||!s.has(T))&&(a&&s.set(T,{index:this.length,ele:w}),this[this.length]=w,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(C){this.lazyMap=C},rebuildMap:function(){for(var N=this.lazyMap=new Zn,A=this.eles,D=0;D<A.length;D++){var M=A[D];N.set(M.id(),{index:D,ele:M})}}},a&&(this._private.map=s),o&&!i&&this.restore()},qt=sh.prototype=Ir.prototype=Object.create(Array.prototype);qt.instanceString=function(){return"collection"};qt.spawn=function(t,e){return new Ir(this.cy(),t,e)};qt.spawnSelf=function(){return this.spawn(this)};qt.cy=function(){return this._private.cy};qt.renderer=function(){return this._private.cy.renderer()};qt.element=function(){return this[0]};qt.collection=function(){return tC(this)?this:new Ir(this._private.cy,[this])};qt.unique=function(){return new Ir(this._private.cy,this,!0)};qt.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};qt.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new Ir(e)};qt.$id=qt.getElementById;qt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};qt.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};qt.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};qt.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(wt(t)){if(r.startBatch(),t.data){e.data(t.data);var i=a.data;if(e.isEdge()){var s=!1,o={},u=t.data.source,d=t.data.target;u!=null&&u!=i.source&&(o.source=""+u,s=!0),d!=null&&d!=i.target&&(o.target=""+d,s=!0),s&&(e=e.move(o))}else{var f="parent"in t.data,h=t.data.parent;f&&(h!=null||i.parent!=null)&&h!=i.parent&&(h===void 0&&(h=null),h!=null&&(h=""+h),e=e.move({parent:h}))}}t.position&&e.position(t.position);var p=function(E,w,T){var C=t[E];C!=null&&C!==a[E]&&(C?e[w]():e[T]())};return p("removed","remove","restore"),p("selected","select","unselect"),p("selectable","selectify","unselectify"),p("locked","lock","unlock"),p("grabbable","grabify","ungrabify"),p("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var m={data:Sn(a.data),position:Sn(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};m.classes="";var y=0;return a.classes.forEach(function(x){return m.classes+=y++===0?x:" "+x}),m}}};qt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};qt.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],i=a.json(),s=new sh(t,i,!1);e.push(s)}return new Ir(t,e)};qt.copy=qt.clone;qt.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),i=a._private,s=[],o=[],u,d=0,f=r.length;d<f;d++){var h=r[d];e&&!h.removed()||(h.isNode()?s.push(h):o.push(h))}u=s.concat(o);var p,m=function(){u.splice(p,1),p--};for(p=0;p<u.length;p++){var y=u[p],x=y._private,E=x.data;if(y.clearTraversalCache(),!(!e&&!x.removed)){if(E.id===void 0)E.id=pC();else if(De(E.id))E.id=""+E.id;else if(rs(E.id)||!Xe(E.id)){$t("Can not create element with invalid string ID `"+E.id+"`"),m();continue}else if(a.hasElementWithId(E.id)){$t("Can not create second element with ID `"+E.id+"`"),m();continue}}var w=E.id;if(y.isNode()){var T=x.position;T.x==null&&(T.x=0),T.y==null&&(T.y=0)}if(y.isEdge()){for(var C=y,N=["source","target"],A=N.length,D=!1,M=0;M<A;M++){var j=N[M],k=E[j];De(k)&&(k=E[j]=""+E[j]),k==null||k===""?($t("Can not create edge `"+w+"` with unspecified "+j),D=!0):a.hasElementWithId(k)||($t("Can not create edge `"+w+"` with nonexistant "+j+" `"+k+"`"),D=!0)}if(D){m();continue}var R=a.getElementById(E.source),z=a.getElementById(E.target);R.same(z)?R._private.edges.push(C):(R._private.edges.push(C),z._private.edges.push(C)),C._private.source=R,C._private.target=z}x.map=new Zn,x.map.set(w,{ele:y,index:0}),x.removed=!1,e&&a.addToPool(y)}for(var B=0;B<s.length;B++){var L=s[B],q=L._private.data;De(q.parent)&&(q.parent=""+q.parent);var I=q.parent,Q=I!=null;if(Q||L._private.parent){var _=L._private.parent?a.collection().merge(L._private.parent):a.getElementById(I);if(_.empty())q.parent=void 0;else if(_[0].removed())At("Node added with missing parent, reference to parent removed"),q.parent=void 0,L._private.parent=null;else{for(var V=!1,F=_;!F.empty();){if(L.same(F)){V=!0,q.parent=void 0;break}F=F.parent()}V||(_[0]._private.children.push(L),L._private.parent=_[0],i.hasCompoundNodes=!0)}}}if(u.length>0){for(var K=u.length===r.length?r:new Ir(a,u),ee=0;ee<K.length;ee++){var P=K[ee];P.isNode()||(P.parallelEdges().clearTraversalCache(),P.source().clearTraversalCache(),P.target().clearTraversalCache())}var G;i.hasCompoundNodes?G=a.collection().merge(K).merge(K.connectedNodes()).merge(K.parent()):G=K,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?K.emitAndNotify("add"):e&&K.emit("add")}return r};qt.removed=function(){var t=this[0];return t&&t._private.removed};qt.inside=function(){var t=this[0];return t&&!t._private.removed};qt.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],i={},s=r._private.cy;function o(I){for(var Q=I._private.edges,_=0;_<Q.length;_++)d(Q[_])}function u(I){for(var Q=I._private.children,_=0;_<Q.length;_++)d(Q[_])}function d(I){var Q=i[I.id()];e&&I.removed()||Q||(i[I.id()]=!0,I.isNode()?(a.push(I),o(I),u(I)):a.unshift(I))}for(var f=0,h=r.length;f<h;f++){var p=r[f];d(p)}function m(I,Q){var _=I._private.edges;as(_,Q),I.clearTraversalCache()}function y(I){I.clearTraversalCache()}var x=[];x.ids={};function E(I,Q){Q=Q[0],I=I[0];var _=I._private.children,V=I.id();as(_,Q),Q._private.parent=null,x.ids[V]||(x.ids[V]=!0,x.push(I))}r.dirtyCompoundBoundsCache(),e&&s.removeFromPool(a);for(var w=0;w<a.length;w++){var T=a[w];if(T.isEdge()){var C=T.source()[0],N=T.target()[0];m(C,T),m(N,T);for(var A=T.parallelEdges(),D=0;D<A.length;D++){var M=A[D];y(M),M.isBundledBezier()&&M.dirtyBoundingBoxCache()}}else{var j=T.parent();j.length!==0&&E(j,T)}e&&(T._private.removed=!0)}var k=s._private.elements;s._private.hasCompoundNodes=!1;for(var R=0;R<k.length;R++){var z=k[R];if(z.isParent()){s._private.hasCompoundNodes=!0;break}}var B=new Ir(this.cy(),a);B.size()>0&&(t?B.emitAndNotify("remove"):e&&B.emit("remove"));for(var L=0;L<x.length;L++){var q=x[L];(!e||!q.removed())&&q.updateStyle()}return B};qt.move=function(t){var e=this._private.cy,r=this,a=!1,i=!1,s=function(x){return x==null?x:""+x};if(t.source!==void 0||t.target!==void 0){var o=s(t.source),u=s(t.target),d=o!=null&&e.hasElementWithId(o),f=u!=null&&e.hasElementWithId(u);(d||f)&&(e.batch(function(){r.remove(a,i),r.emitAndNotify("moveout");for(var y=0;y<r.length;y++){var x=r[y],E=x._private.data;x.isEdge()&&(d&&(E.source=o),f&&(E.target=u))}r.restore(a,i)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var h=s(t.parent),p=h===null||e.hasElementWithId(h);if(p){var m=h===null?void 0:h;e.batch(function(){var y=r.remove(a,i);y.emitAndNotify("moveout");for(var x=0;x<r.length;x++){var E=r[x],w=E._private.data;E.isNode()&&(w.parent=m)}y.restore(a,i)}),r.emitAndNotify("move")}}return this};[jC,zR,Ef,Ji,Do,JR,hh,pB,WC,JC,bB,Ff,Tf,qr,es,Xr].forEach(function(t){tt(qt,t)});var jB={add:function(e){var r,a=this;if(Da(e)){var i=e;if(i._private.cy===a)r=i.restore();else{for(var s=[],o=0;o<i.length;o++){var u=i[o];s.push(u.json())}r=new Ir(a,s)}}else if(_t(e)){var d=e;r=new Ir(a,d)}else if(wt(e)&&(_t(e.nodes)||_t(e.edges))){for(var f=e,h=[],p=["nodes","edges"],m=0,y=p.length;m<y;m++){var x=p[m],E=f[x];if(_t(E))for(var w=0,T=E.length;w<T;w++){var C=tt({group:x},E[w]);h.push(C)}}r=new Ir(a,h)}else{var N=e;r=new sh(a,N).collection()}return r},remove:function(e){if(!Da(e)){if(Xe(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function AB(t,e,r,a){var i=4,s=.001,o=1e-7,u=10,d=11,f=1/(d-1),h=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var p=0;p<4;++p)if(typeof arguments[p]!="number"||isNaN(arguments[p])||!isFinite(arguments[p]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var m=h?new Float32Array(d):new Array(d);function y(z,B){return 1-3*B+3*z}function x(z,B){return 3*B-6*z}function E(z){return 3*z}function w(z,B,L){return((y(B,L)*z+x(B,L))*z+E(B))*z}function T(z,B,L){return 3*y(B,L)*z*z+2*x(B,L)*z+E(B)}function C(z,B){for(var L=0;L<i;++L){var q=T(B,t,r);if(q===0)return B;var I=w(B,t,r)-z;B-=I/q}return B}function N(){for(var z=0;z<d;++z)m[z]=w(z*f,t,r)}function A(z,B,L){var q,I,Q=0;do I=B+(L-B)/2,q=w(I,t,r)-z,q>0?L=I:B=I;while(Math.abs(q)>o&&++Q<u);return I}function D(z){for(var B=0,L=1,q=d-1;L!==q&&m[L]<=z;++L)B+=f;--L;var I=(z-m[L])/(m[L+1]-m[L]),Q=B+I*f,_=T(Q,t,r);return _>=s?C(z,Q):_===0?Q:A(z,B,B+f)}var M=!1;function j(){M=!0,(t!==e||r!==a)&&N()}var k=function(B){return M||j(),t===e&&r===a?B:B===0?0:B===1?1:w(D(B),e,a)};k.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var R="generateBezier("+[t,e,r,a]+")";return k.toString=function(){return R},k}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var MB=(function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,i,s){var o={x:a.x+s.dx*i,v:a.v+s.dv*i,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,i){var s={dx:a.v,dv:t(a)},o=e(a,i*.5,s),u=e(a,i*.5,o),d=e(a,i,u),f=1/6*(s.dx+2*(o.dx+u.dx)+d.dx),h=1/6*(s.dv+2*(o.dv+u.dv)+d.dv);return a.x=a.x+f*i,a.v=a.v+h*i,a}return function a(i,s,o){var u={x:-1,v:0,tension:null,friction:null},d=[0],f=0,h=1/1e4,p=16/1e3,m,y,x;for(i=parseFloat(i)||500,s=parseFloat(s)||20,o=o||null,u.tension=i,u.friction=s,m=o!==null,m?(f=a(i,s),y=f/o*p):y=p;x=r(x||u,y),d.push(1+x.x),f+=16,Math.abs(x.x)>h&&Math.abs(x.v)>h;);return m?function(E){return d[E*(d.length-1)|0]}:f}})(),Ut=function(e,r,a,i){var s=AB(e,r,a,i);return function(o,u,d){return o+(u-o)*s(d)}},Cf={linear:function(e,r,a){return e+(r-e)*a},ease:Ut(.25,.1,.25,1),"ease-in":Ut(.42,0,1,1),"ease-out":Ut(0,0,.58,1),"ease-in-out":Ut(.42,0,.58,1),"ease-in-sine":Ut(.47,0,.745,.715),"ease-out-sine":Ut(.39,.575,.565,1),"ease-in-out-sine":Ut(.445,.05,.55,.95),"ease-in-quad":Ut(.55,.085,.68,.53),"ease-out-quad":Ut(.25,.46,.45,.94),"ease-in-out-quad":Ut(.455,.03,.515,.955),"ease-in-cubic":Ut(.55,.055,.675,.19),"ease-out-cubic":Ut(.215,.61,.355,1),"ease-in-out-cubic":Ut(.645,.045,.355,1),"ease-in-quart":Ut(.895,.03,.685,.22),"ease-out-quart":Ut(.165,.84,.44,1),"ease-in-out-quart":Ut(.77,0,.175,1),"ease-in-quint":Ut(.755,.05,.855,.06),"ease-out-quint":Ut(.23,1,.32,1),"ease-in-out-quint":Ut(.86,0,.07,1),"ease-in-expo":Ut(.95,.05,.795,.035),"ease-out-expo":Ut(.19,1,.22,1),"ease-in-out-expo":Ut(1,0,0,1),"ease-in-circ":Ut(.6,.04,.98,.335),"ease-out-circ":Ut(.075,.82,.165,1),"ease-in-out-circ":Ut(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Cf.linear;var i=MB(e,r,a);return function(s,o,u){return s+(o-s)*i(u)}},"cubic-bezier":Ut};function VS(t,e,r,a,i){if(a===1||e===r)return r;var s=i(e,r,a);return t==null||((t.roundValue||t.color)&&(s=Math.round(s)),t.min!==void 0&&(s=Math.max(s,t.min)),t.max!==void 0&&(s=Math.min(s,t.max))),s}function FS(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Kl(t,e,r,a,i){var s=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var o=FS(t,i),u=FS(e,i);if(De(o)&&De(u))return VS(s,o,u,r,a);if(_t(o)&&_t(u)){for(var d=[],f=0;f<u.length;f++){var h=o[f],p=u[f];if(h!=null&&p!=null){var m=VS(s,h,p,r,a);d.push(m)}else d.push(p)}return d}}function kB(t,e,r,a){var i=!a,s=t._private,o=e._private,u=o.easing,d=o.startTime,f=a?t:t.cy(),h=f.style();if(!o.easingImpl)if(u==null)o.easingImpl=Cf.linear;else{var p;if(Xe(u)){var m=h.parse("transition-timing-function",u);p=m.value}else p=u;var y,x;Xe(p)?(y=p,x=[]):(y=p[1],x=p.slice(2).map(function(K){return+K})),x.length>0?(y==="spring"&&x.push(o.duration),o.easingImpl=Cf[y].apply(null,x)):o.easingImpl=Cf[y]}var E=o.easingImpl,w;if(o.duration===0?w=1:w=(r-d)/o.duration,o.applying&&(w=o.progress),w<0?w=0:w>1&&(w=1),o.delay==null){var T=o.startPosition,C=o.position;if(C&&i&&!t.locked()){var N={};Lu(T.x,C.x)&&(N.x=Kl(T.x,C.x,w,E)),Lu(T.y,C.y)&&(N.y=Kl(T.y,C.y,w,E)),t.position(N)}var A=o.startPan,D=o.pan,M=s.pan,j=D!=null&&a;j&&(Lu(A.x,D.x)&&(M.x=Kl(A.x,D.x,w,E)),Lu(A.y,D.y)&&(M.y=Kl(A.y,D.y,w,E)),t.emit("pan"));var k=o.startZoom,R=o.zoom,z=R!=null&&a;z&&(Lu(k,R)&&(s.zoom=rc(s.minZoom,Kl(k,R,w,E),s.maxZoom)),t.emit("zoom")),(j||z)&&t.emit("viewport");var B=o.style;if(B&&B.length>0&&i){for(var L=0;L<B.length;L++){var q=B[L],I=q.name,Q=q,_=o.startStyle[I],V=h.properties[_.name],F=Kl(_,Q,w,E,V);h.overrideBypass(t,I,F)}t.emit("style")}}return o.progress=w,w}function Lu(t,e){return t==null||e==null?!1:De(t)&&De(e)?!0:!!(t&&e)}function DB(t,e,r,a){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function HS(t,e){var r=e._private.aniEles,a=[];function i(h,p){var m=h._private,y=m.animation.current,x=m.animation.queue,E=!1;if(y.length===0){var w=x.shift();w&&y.push(w)}for(var T=function(M){for(var j=M.length-1;j>=0;j--){var k=M[j];k()}M.splice(0,M.length)},C=y.length-1;C>=0;C--){var N=y[C],A=N._private;if(A.stopped){y.splice(C,1),A.hooked=!1,A.playing=!1,A.started=!1,T(A.frames);continue}!A.playing&&!A.applying||(A.playing&&A.applying&&(A.applying=!1),A.started||DB(h,N,t),kB(h,N,t,p),A.applying&&(A.applying=!1),T(A.frames),A.step!=null&&A.step(t),N.completed()&&(y.splice(C,1),A.hooked=!1,A.playing=!1,A.started=!1,T(A.completes)),E=!0)}return!p&&y.length===0&&x.length===0&&a.push(h),E}for(var s=!1,o=0;o<r.length;o++){var u=r[o],d=i(u);s=s||d}var f=i(e,!0);(s||f)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var OB={animate:jt.animate(),animation:jt.animation(),animated:jt.animated(),clearQueue:jt.clearQueue(),delay:jt.delay(),delayAnimation:jt.delayAnimation(),stop:jt.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&_f(function(s){HS(s,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(s,o){HS(o,e)},a.beforeRenderPriorities.animations):r()}},RB={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var i=r.qualifier;return i!=null?e!==a.target&&Tc(a.target)&&i.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},cf=function(e){return Xe(e)?new is(e):e},rN={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new vh(RB,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,cf(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,cf(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,cf(r),a),this},once:function(e,r,a){return this.emitter().one(e,cf(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};jt.eventAliasesOn(rN);var im={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};im.jpeg=im.jpg;var Nf={layout:function(e){var r=this;if(e==null){$t("Layout options must be specified to make a layout");return}if(e.name==null){$t("A `name` must be specified to make a layout");return}var a=e.name,i=r.extension("layout",a);if(i==null){$t("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var s;Xe(e.eles)?s=r.$(e.eles):s=e.eles!=null?e.eles:r.$();var o=new i(tt({},e,{cy:r,eles:s}));return o}};Nf.createLayout=Nf.makeLayout=Nf.layout;var BB={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var i=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&i.merge(r);return}if(a.notificationsEnabled){var s=this.renderer();this.destroyed()||!s||s.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var i=e.batchNotifications[a];i.empty()?r.notify(a):r.notify(a,i)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),i=0;i<a.length;i++){var s=a[i],o=e[s],u=r.getElementById(s);u.data(o)}})}},LB=Fr({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),sm={renderTo:function(e,r,a,i){var s=this._private.renderer;return s.renderTo(e,r,a,i),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,a=r.extension("renderer",e.name);if(a==null){$t("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&At("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var i=LB(e);i.cy=r,r._private.renderer=new a(i),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var i=a._private;i.rscratch={},i.rstyle={},i.animation.current=[],i.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};sm.invalidateDimensions=sm.resize;var jf={collection:function(e,r){return Xe(e)?this.$(e):Da(e)?e.collection():_t(e)?(r||(r={}),new Ir(this,e,r.unique,r.removed)):new Ir(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};jf.elements=jf.filter=jf.$;var Br={},Hu="t",PB="f";Br.apply=function(t){for(var e=this,r=e._private,a=r.cy,i=a.collection(),s=0;s<t.length;s++){var o=t[s],u=e.getContextMeta(o);if(!u.empty){var d=e.getContextStyle(u),f=e.applyContextStyle(u,d,o);o._private.appliedInitStyle?e.updateTransitions(o,f.diffProps):o._private.appliedInitStyle=!0;var h=e.updateStyleHints(o);h&&i.push(o)}}return i};Br.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},i=t+"-"+e,s=a[i];if(s)return s;for(var o=[],u={},d=0;d<r.length;d++){var f=r[d],h=t[d]===Hu,p=e[d]===Hu,m=h!==p,y=f.mappedProperties.length>0;if(m||p&&y){var x=void 0;m&&y||m?x=f.properties:y&&(x=f.mappedProperties);for(var E=0;E<x.length;E++){for(var w=x[E],T=w.name,C=!1,N=d+1;N<r.length;N++){var A=r[N],D=e[N]===Hu;if(D&&(C=A.properties[w.name]!=null,C))break}!u[T]&&!C&&(u[T]=!0,o.push(T))}}}return a[i]=o,o};Br.getContextMeta=function(t){for(var e=this,r="",a,i=t._private.styleCxtKey||"",s=0;s<e.length;s++){var o=e[s],u=o.selector&&o.selector.matches(t);u?r+=Hu:r+=PB}return a=e.getPropertiesDiff(i,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};Br.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var i={_private:{key:e}},s=0;s<r.length;s++){var o=r[s],u=e[s]===Hu;if(u)for(var d=0;d<o.properties.length;d++){var f=o.properties[d];i[f.name]=f}}return a[e]=i,i};Br.applyContextStyle=function(t,e,r){for(var a=this,i=t.diffPropNames,s={},o=a.types,u=0;u<i.length;u++){var d=i[u],f=e[d],h=r.pstyle(d);if(!f)if(h)h.bypass?f={name:d,deleteBypassed:!0}:f={name:d,delete:!0};else continue;if(h!==f){if(f.mapped===o.fn&&h!=null&&h.mapping!=null&&h.mapping.value===f.value){var p=h.mapping,m=p.fnValue=f.value(r);if(m===p.prevFnValue)continue}var y=s[d]={prev:h};a.applyParsedProperty(r,f),y.next=r.pstyle(d),y.next&&y.next.bypass&&(y.next=y.next.bypassed)}}return{diffProps:s}};Br.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,i=r.propertyGroupKeys,s=function(se,ie,Ne){return r.getPropertiesHash(se,ie,Ne)},o=e.styleKey;if(t.removed())return!1;var u=e.group==="nodes",d=t._private.style;a=Object.keys(d);for(var f=0;f<i.length;f++){var h=i[f];e.styleKeys[h]=[zs,to]}for(var p=function(se,ie){return e.styleKeys[ie][0]=Ju(se,e.styleKeys[ie][0])},m=function(se,ie){return e.styleKeys[ie][1]=ec(se,e.styleKeys[ie][1])},y=function(se,ie){p(se,ie),m(se,ie)},x=function(se,ie){for(var Ne=0;Ne<se.length;Ne++){var Ae=se.charCodeAt(Ne);p(Ae,ie),m(Ae,ie)}},E=2e9,w=function(se){return-128<se&&se<128&&Math.floor(se)!==se?E-(se*1024|0):se},T=0;T<a.length;T++){var C=a[T],N=d[C];if(N!=null){var A=this.properties[C],D=A.type,M=A.groupKey,j=void 0;A.hashOverride!=null?j=A.hashOverride(t,N):N.pfValue!=null&&(j=N.pfValue);var k=A.enums==null?N.value:null,R=j!=null,z=k!=null,B=R||z,L=N.units;if(D.number&&B&&!D.multiple){var q=R?j:k;y(w(q),M),!R&&L!=null&&x(L,M)}else x(N.strValue,M)}}for(var I=[zs,to],Q=0;Q<i.length;Q++){var _=i[Q],V=e.styleKeys[_];I[0]=Ju(V[0],I[0]),I[1]=ec(V[1],I[1])}e.styleKey=WD(I[0],I[1]);var F=e.styleKeys;e.labelDimsKey=Oi(F.labelDimensions);var K=s(t,["label"],F.labelDimensions);if(e.labelKey=Oi(K),e.labelStyleKey=Oi(tf(F.commonLabel,K)),!u){var ee=s(t,["source-label"],F.labelDimensions);e.sourceLabelKey=Oi(ee),e.sourceLabelStyleKey=Oi(tf(F.commonLabel,ee));var P=s(t,["target-label"],F.labelDimensions);e.targetLabelKey=Oi(P),e.targetLabelStyleKey=Oi(tf(F.commonLabel,P))}if(u){var G=e.styleKeys,Z=G.nodeBody,J=G.nodeBorder,X=G.nodeOutline,Y=G.backgroundImage,le=G.compound,me=G.pie,oe=G.stripe,ae=[Z,J,X,Y,le,me,oe].filter(function(re){return re!=null}).reduce(tf,[zs,to]);e.nodeKey=Oi(ae),e.hasPie=me!=null&&me[0]!==zs&&me[1]!==to,e.hasStripe=oe!=null&&oe[0]!==zs&&oe[1]!==to}return o!==e.styleKey};Br.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};Br.applyParsedProperty=function(t,e){var r=this,a=e,i=t._private.style,s,o=r.types,u=r.properties[a.name].type,d=a.bypass,f=i[a.name],h=f&&f.bypass,p=t._private,m="mapping",y=function(Z){return Z==null?null:Z.pfValue!=null?Z.pfValue:Z.value},x=function(){var Z=y(f),J=y(a);r.checkTriggers(t,a.name,Z,J)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",d)),a.delete)return i[a.name]=void 0,x(),!0;if(a.deleteBypassed)return f?f.bypass?(f.bypassed=void 0,x(),!0):!1:(x(),!0);if(a.deleteBypass)return f?f.bypass?(i[a.name]=f.bypassed,x(),!0):!1:(x(),!0);var E=function(){At("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var w=a.field.split("."),T=p.data,C=0;C<w.length&&T;C++){var N=w[C];T=T[N]}if(T==null)return E(),!1;var A;if(De(T)){var D=a.fieldMax-a.fieldMin;D===0?A=0:A=(T-a.fieldMin)/D}else return At("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+T+"` for `"+t.id()+"` is non-numeric)"),!1;if(A<0?A=0:A>1&&(A=1),u.color){var M=a.valueMin[0],j=a.valueMax[0],k=a.valueMin[1],R=a.valueMax[1],z=a.valueMin[2],B=a.valueMax[2],L=a.valueMin[3]==null?1:a.valueMin[3],q=a.valueMax[3]==null?1:a.valueMax[3],I=[Math.round(M+(j-M)*A),Math.round(k+(R-k)*A),Math.round(z+(B-z)*A),Math.round(L+(q-L)*A)];s={bypass:a.bypass,name:a.name,value:I,strValue:"rgb("+I[0]+", "+I[1]+", "+I[2]+")"}}else if(u.number){var Q=a.valueMin+(a.valueMax-a.valueMin)*A;s=this.parse(a.name,Q,a.bypass,m)}else return!1;if(!s)return E(),!1;s.mapping=a,a=s;break}case o.data:{for(var _=a.field.split("."),V=p.data,F=0;F<_.length&&V;F++){var K=_[F];V=V[K]}if(V!=null&&(s=this.parse(a.name,V,a.bypass,m)),!s)return E(),!1;s.mapping=a,a=s;break}case o.fn:{var ee=a.value,P=a.fnValue!=null?a.fnValue:ee(t);if(a.prevFnValue=P,P==null)return At("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(s=this.parse(a.name,P,a.bypass,m),!s)return At("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;s.mapping=Sn(a),a=s;break}case void 0:break;default:return!1}return d?(h?a.bypassed=f.bypassed:a.bypassed=f,i[a.name]=a):h?f.bypassed=a:i[a.name]=a,x(),!0};Br.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var i=a._private.style,s=Object.keys(i),o=0;o<s.length;o++){var u=s[o],d=i[u];d!=null&&(d.bypass?d.bypassed=null:i[u]=null)}}};Br.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};Br.updateTransitions=function(t,e){var r=this,a=t._private,i=t.pstyle("transition-property").value,s=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(i.length>0&&s>0){for(var u={},d=!1,f=0;f<i.length;f++){var h=i[f],p=t.pstyle(h),m=e[h];if(m){var y=m.prev,x=y,E=m.next!=null?m.next:p,w=!1,T=void 0,C=1e-6;x&&(De(x.pfValue)&&De(E.pfValue)?(w=E.pfValue-x.pfValue,T=x.pfValue+C*w):De(x.value)&&De(E.value)?(w=E.value-x.value,T=x.value+C*w):_t(x.value)&&_t(E.value)&&(w=x.value[0]!==E.value[0]||x.value[1]!==E.value[1]||x.value[2]!==E.value[2],T=x.strValue),w&&(u[h]=E.strValue,this.applyBypass(t,h,T),d=!0))}}if(!d)return;a.transitioning=!0,new Lo(function(N){o>0?t.delayAnimation(o).play().promise().then(N):N()}).then(function(){return t.animation({style:u,duration:s,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,i),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,i),t.emitAndNotify("style"),a.transitioning=!1)};Br.checkTrigger=function(t,e,r,a,i,s){var o=this.properties[e],u=i(o);t.removed()||u!=null&&u(r,a,t)&&s(o)};Br.checkZOrderTrigger=function(t,e,r,a){var i=this;this.checkTrigger(t,e,r,a,function(s){return s.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};Br.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};Br.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};Br.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};Br.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var Dc={};Dc.applyBypass=function(t,e,r,a){var i=this,s=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var u=0;u<i.properties.length;u++){var d=i.properties[u],f=d.name,h=this.parse(f,r,!0);h&&s.push(h)}}else if(Xe(e)){var p=this.parse(e,r,!0);p&&s.push(p)}else if(wt(e)){var m=e;a=r;for(var y=Object.keys(m),x=0;x<y.length;x++){var E=y[x],w=m[E];if(w===void 0&&(w=m[nh(E)]),w!==void 0){var T=this.parse(E,w,!0);T&&s.push(T)}}}else return!1;if(s.length===0)return!1;for(var C=!1,N=0;N<t.length;N++){for(var A=t[N],D={},M=void 0,j=0;j<s.length;j++){var k=s[j];if(a){var R=A.pstyle(k.name);M=D[k.name]={prev:R}}C=this.applyParsedProperty(A,Sn(k))||C,a&&(M.next=A.pstyle(k.name))}C&&this.updateStyleHints(A),a&&this.updateTransitions(A,D,o)}return C};Dc.overrideBypass=function(t,e,r){e=Vm(e);for(var a=0;a<t.length;a++){var i=t[a],s=i._private.style[e],o=this.properties[e].type,u=o.color,d=o.mutiple,f=s?s.pfValue!=null?s.pfValue:s.value:null;!s||!s.bypass?this.applyBypass(i,e,r):(s.value=r,s.pfValue!=null&&(s.pfValue=r),u?s.strValue="rgb("+r.join(",")+")":d?s.strValue=r.join(" "):s.strValue=""+r,this.updateStyleHints(i)),this.checkTriggers(i,e,f,r)}};Dc.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Dc.removeBypasses=function(t,e,r){for(var a=!0,i=0;i<t.length;i++){for(var s=t[i],o={},u=0;u<e.length;u++){var d=e[u],f=this.properties[d],h=s.pstyle(f.name);if(!(!h||!h.bypass)){var p="",m=this.parse(d,p,!0),y=o[f.name]={prev:h};this.applyParsedProperty(s,m),y.next=s.pstyle(f.name)}}this.updateStyleHints(s),r&&this.updateTransitions(s,o,a)}};var ay={};ay.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};ay.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var En={};En.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};En.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},i=0;i<r.properties.length;i++){var s=r.properties[i],o=r.getStylePropertyValue(t,s.name,e);o!=null&&(a[s.name]=o,a[nh(s.name)]=o)}return a}};En.getIndexedStyle=function(t,e,r,a){var i=t.pstyle(e)[r][a];return i??t.cy().style().getDefaultProperty(e)[r][0]};En.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var i=a.properties[e];i.alias&&(i=i.pointsTo);var s=i.type,o=t.pstyle(i.name);if(o){var u=o.value,d=o.units,f=o.strValue;if(r&&s.number&&u!=null&&De(u)){var h=t.cy().zoom(),p=function(w){return w*h},m=function(w,T){return p(w)+T},y=_t(u),x=y?d.every(function(E){return E!=null}):d!=null;return x?y?u.map(function(E,w){return m(E,d[w])}).join(" "):m(u,d):y?u.map(function(E){return Xe(E)?E:""+p(E)}).join(" "):""+p(u)}else if(f!=null)return f}return null}};En.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var i=e[a],s=i.name,o=t.pstyle(s);o!==void 0&&(wt(o)?o=this.parse(s,o.strValue):o=this.parse(s,o)),o&&(r[s]=o)}return r};En.getPropsList=function(t){var e=this,r=[],a=t,i=e.properties;if(a)for(var s=Object.keys(a),o=0;o<s.length;o++){var u=s[o],d=a[u],f=i[u]||i[Vm(u)],h=this.parse(f.name,d);h&&r.push(h)}return r};En.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),i,s,o,u,d,f;for(d=0;d<e.length;d++)if(i=e[d],s=t.pstyle(i,!1),s!=null)if(s.pfValue!=null)a[0]=Ju(u,a[0]),a[1]=ec(u,a[1]);else for(o=s.strValue,f=0;f<o.length;f++)u=o.charCodeAt(f),a[0]=Ju(u,a[0]),a[1]=ec(u,a[1]);return a};En.getPropertiesHash=En.getNonDefaultPropertiesHash;var mh={};mh.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],i=a.selector,s=a.style||a.css,o=Object.keys(s);e.selector(i);for(var u=0;u<o.length;u++){var d=o[u],f=s[d];e.css(d,f)}}return e};mh.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};mh.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,i=r.properties,s={},o=0;o<i.length;o++){var u=i[o];s[u.name]=u.strValue}t.push({selector:a?a.toString():"core",style:s})}return t};var ny={};ny.appendFromString=function(t){var e=this,r=this,a=""+t,i,s,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function u(){a.length>i.length?a=a.substr(i.length):a=""}function d(){s.length>o.length?s=s.substr(o.length):s=""}for(;;){var f=a.match(/^\s*$/);if(f)break;var h=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){At("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}i=h[0];var p=h[1];if(p!=="core"){var m=new is(p);if(m.invalid){At("Skipping parsing of block: Invalid selector found in string stylesheet: "+p),u();continue}}var y=h[2],x=!1;s=y;for(var E=[];;){var w=s.match(/^\s*$/);if(w)break;var T=s.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!T){At("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+y),x=!0;break}o=T[0];var C=T[1],N=T[2],A=e.properties[C];if(!A){At("Skipping property: Invalid property name in: "+o),d();continue}var D=r.parse(C,N);if(!D){At("Skipping property: Invalid property definition in: "+o),d();continue}E.push({name:C,val:N}),d()}if(x){u();break}r.selector(p);for(var M=0;M<E.length;M++){var j=E[M];r.css(j.name,j.val)}u()}return r};ny.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var gr={};(function(){var t=Sr,e=kD,r=OD,a=RD,i=BD,s=function(re){return"^"+re+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(re){var se=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+i;return"^"+re+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+se+")\\s*\\,\\s*("+se+")\\)$"},u=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];gr.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:s("data")},layoutData:{mapping:!0,regex:s("layoutData")},scratch:{mapping:!0,regex:s("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:u,singleRegexMatchValue:!0},urls:{regexes:u,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(re,se){switch(re.length){case 2:return se[0]!=="deg"&&se[0]!=="rad"&&se[1]!=="deg"&&se[1]!=="rad";case 1:return Xe(re[0])||se[0]==="deg"||se[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(re){var se=re.length;return se===1||se===2||se===4}}};var d={zeroNonZero:function(re,se){return(re==null||se==null)&&re!==se||re==0&&se!=0?!0:re!=0&&se==0},any:function(re,se){return re!=se},emptyNonEmpty:function(re,se){var ie=rs(re),Ne=rs(se);return ie&&!Ne||!ie&&Ne}},f=gr.types,h=[{name:"label",type:f.text,triggersBounds:d.any,triggersZOrder:d.emptyNonEmpty},{name:"text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any}],p=[{name:"source-label",type:f.text,triggersBounds:d.any},{name:"source-text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"source-text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"source-text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"source-text-offset",type:f.size,triggersBounds:d.any}],m=[{name:"target-label",type:f.text,triggersBounds:d.any},{name:"target-text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"target-text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"target-text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"target-text-offset",type:f.size,triggersBounds:d.any}],y=[{name:"font-family",type:f.fontFamily,triggersBounds:d.any},{name:"font-style",type:f.fontStyle,triggersBounds:d.any},{name:"font-weight",type:f.fontWeight,triggersBounds:d.any},{name:"font-size",type:f.size,triggersBounds:d.any},{name:"text-transform",type:f.textTransform,triggersBounds:d.any},{name:"text-wrap",type:f.textWrap,triggersBounds:d.any},{name:"text-overflow-wrap",type:f.textOverflowWrap,triggersBounds:d.any},{name:"text-max-width",type:f.size,triggersBounds:d.any},{name:"text-outline-width",type:f.size,triggersBounds:d.any},{name:"line-height",type:f.positiveNumber,triggersBounds:d.any}],x=[{name:"text-valign",type:f.valign,triggersBounds:d.any},{name:"text-halign",type:f.halign,triggersBounds:d.any},{name:"color",type:f.color},{name:"text-outline-color",type:f.color},{name:"text-outline-opacity",type:f.zeroOneNumber},{name:"text-background-color",type:f.color},{name:"text-background-opacity",type:f.zeroOneNumber},{name:"text-background-padding",type:f.size,triggersBounds:d.any},{name:"text-border-opacity",type:f.zeroOneNumber},{name:"text-border-color",type:f.color},{name:"text-border-width",type:f.size,triggersBounds:d.any},{name:"text-border-style",type:f.borderStyle,triggersBounds:d.any},{name:"text-background-shape",type:f.textBackgroundShape,triggersBounds:d.any},{name:"text-justification",type:f.justification},{name:"box-select-labels",type:f.bool,triggersBounds:d.any}],E=[{name:"events",type:f.bool,triggersZOrder:d.any},{name:"text-events",type:f.bool,triggersZOrder:d.any},{name:"box-selection",type:f.boxSelection,triggersZOrder:d.any}],w=[{name:"display",type:f.display,triggersZOrder:d.any,triggersBounds:d.any,triggersBoundsOfConnectedEdges:d.any,triggersBoundsOfParallelEdges:function(re,se,ie){return re===se?!1:ie.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:f.visibility,triggersZOrder:d.any},{name:"opacity",type:f.zeroOneNumber,triggersZOrder:d.zeroNonZero},{name:"text-opacity",type:f.zeroOneNumber},{name:"min-zoomed-font-size",type:f.size},{name:"z-compound-depth",type:f.zCompoundDepth,triggersZOrder:d.any},{name:"z-index-compare",type:f.zIndexCompare,triggersZOrder:d.any},{name:"z-index",type:f.number,triggersZOrder:d.any}],T=[{name:"overlay-padding",type:f.size,triggersBounds:d.any},{name:"overlay-color",type:f.color},{name:"overlay-opacity",type:f.zeroOneNumber,triggersBounds:d.zeroNonZero},{name:"overlay-shape",type:f.overlayShape,triggersBounds:d.any},{name:"overlay-corner-radius",type:f.cornerRadius}],C=[{name:"underlay-padding",type:f.size,triggersBounds:d.any},{name:"underlay-color",type:f.color},{name:"underlay-opacity",type:f.zeroOneNumber,triggersBounds:d.zeroNonZero},{name:"underlay-shape",type:f.overlayShape,triggersBounds:d.any},{name:"underlay-corner-radius",type:f.cornerRadius}],N=[{name:"transition-property",type:f.propList},{name:"transition-duration",type:f.time},{name:"transition-delay",type:f.time},{name:"transition-timing-function",type:f.easing}],A=function(re,se){return se.value==="label"?-re.poolIndex():se.pfValue},D=[{name:"height",type:f.nodeSize,triggersBounds:d.any,hashOverride:A},{name:"width",type:f.nodeSize,triggersBounds:d.any,hashOverride:A},{name:"shape",type:f.nodeShape,triggersBounds:d.any},{name:"shape-polygon-points",type:f.polygonPointList,triggersBounds:d.any},{name:"corner-radius",type:f.cornerRadius},{name:"background-color",type:f.color},{name:"background-fill",type:f.fill},{name:"background-opacity",type:f.zeroOneNumber},{name:"background-blacken",type:f.nOneOneNumber},{name:"background-gradient-stop-colors",type:f.colors},{name:"background-gradient-stop-positions",type:f.percentages},{name:"background-gradient-direction",type:f.gradientDirection},{name:"padding",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"padding-relative-to",type:f.paddingRelativeTo,triggersBounds:d.any},{name:"bounds-expansion",type:f.boundsExpansion,triggersBounds:d.any}],M=[{name:"border-color",type:f.color},{name:"border-opacity",type:f.zeroOneNumber},{name:"border-width",type:f.size,triggersBounds:d.any},{name:"border-style",type:f.borderStyle},{name:"border-cap",type:f.lineCap},{name:"border-join",type:f.lineJoin},{name:"border-dash-pattern",type:f.numbers},{name:"border-dash-offset",type:f.number},{name:"border-position",type:f.linePosition}],j=[{name:"outline-color",type:f.color},{name:"outline-opacity",type:f.zeroOneNumber},{name:"outline-width",type:f.size,triggersBounds:d.any},{name:"outline-style",type:f.borderStyle},{name:"outline-offset",type:f.size,triggersBounds:d.any}],k=[{name:"background-image",type:f.urls},{name:"background-image-crossorigin",type:f.bgCrossOrigin},{name:"background-image-opacity",type:f.zeroOneNumbers},{name:"background-image-containment",type:f.bgContainment},{name:"background-image-smoothing",type:f.bools},{name:"background-position-x",type:f.bgPos},{name:"background-position-y",type:f.bgPos},{name:"background-width-relative-to",type:f.bgRelativeTo},{name:"background-height-relative-to",type:f.bgRelativeTo},{name:"background-repeat",type:f.bgRepeat},{name:"background-fit",type:f.bgFit},{name:"background-clip",type:f.bgClip},{name:"background-width",type:f.bgWH},{name:"background-height",type:f.bgWH},{name:"background-offset-x",type:f.bgPos},{name:"background-offset-y",type:f.bgPos}],R=[{name:"position",type:f.position,triggersBounds:d.any},{name:"compound-sizing-wrt-labels",type:f.compoundIncludeLabels,triggersBounds:d.any},{name:"min-width",type:f.size,triggersBounds:d.any},{name:"min-width-bias-left",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-width-bias-right",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-height",type:f.size,triggersBounds:d.any},{name:"min-height-bias-top",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-height-bias-bottom",type:f.sizeMaybePercent,triggersBounds:d.any}],z=[{name:"line-style",type:f.lineStyle},{name:"line-color",type:f.color},{name:"line-fill",type:f.fill},{name:"line-cap",type:f.lineCap},{name:"line-opacity",type:f.zeroOneNumber},{name:"line-dash-pattern",type:f.numbers},{name:"line-dash-offset",type:f.number},{name:"line-outline-width",type:f.size},{name:"line-outline-color",type:f.color},{name:"line-gradient-stop-colors",type:f.colors},{name:"line-gradient-stop-positions",type:f.percentages},{name:"curve-style",type:f.curveStyle,triggersBounds:d.any,triggersBoundsOfParallelEdges:function(re,se){return re===se?!1:re==="bezier"||se==="bezier"}},{name:"haystack-radius",type:f.zeroOneNumber,triggersBounds:d.any},{name:"source-endpoint",type:f.edgeEndpoint,triggersBounds:d.any},{name:"target-endpoint",type:f.edgeEndpoint,triggersBounds:d.any},{name:"control-point-step-size",type:f.size,triggersBounds:d.any},{name:"control-point-distances",type:f.bidirectionalSizes,triggersBounds:d.any},{name:"control-point-weights",type:f.numbers,triggersBounds:d.any},{name:"segment-distances",type:f.bidirectionalSizes,triggersBounds:d.any},{name:"segment-weights",type:f.numbers,triggersBounds:d.any},{name:"segment-radii",type:f.numbers,triggersBounds:d.any},{name:"radius-type",type:f.radiusType,triggersBounds:d.any},{name:"taxi-turn",type:f.bidirectionalSizeMaybePercent,triggersBounds:d.any},{name:"taxi-turn-min-distance",type:f.size,triggersBounds:d.any},{name:"taxi-direction",type:f.axisDirection,triggersBounds:d.any},{name:"taxi-radius",type:f.number,triggersBounds:d.any},{name:"edge-distances",type:f.edgeDistances,triggersBounds:d.any},{name:"arrow-scale",type:f.positiveNumber,triggersBounds:d.any},{name:"loop-direction",type:f.angle,triggersBounds:d.any},{name:"loop-sweep",type:f.angle,triggersBounds:d.any},{name:"source-distance-from-node",type:f.size,triggersBounds:d.any},{name:"target-distance-from-node",type:f.size,triggersBounds:d.any}],B=[{name:"ghost",type:f.bool,triggersBounds:d.any},{name:"ghost-offset-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"ghost-offset-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"ghost-opacity",type:f.zeroOneNumber}],L=[{name:"selection-box-color",type:f.color},{name:"selection-box-opacity",type:f.zeroOneNumber},{name:"selection-box-border-color",type:f.color},{name:"selection-box-border-width",type:f.size},{name:"active-bg-color",type:f.color},{name:"active-bg-opacity",type:f.zeroOneNumber},{name:"active-bg-size",type:f.size},{name:"outside-texture-bg-color",type:f.color},{name:"outside-texture-bg-opacity",type:f.zeroOneNumber}],q=[];gr.pieBackgroundN=16,q.push({name:"pie-size",type:f.sizeMaybePercent}),q.push({name:"pie-hole",type:f.sizeMaybePercent}),q.push({name:"pie-start-angle",type:f.angle});for(var I=1;I<=gr.pieBackgroundN;I++)q.push({name:"pie-"+I+"-background-color",type:f.color}),q.push({name:"pie-"+I+"-background-size",type:f.percent}),q.push({name:"pie-"+I+"-background-opacity",type:f.zeroOneNumber});var Q=[];gr.stripeBackgroundN=16,Q.push({name:"stripe-size",type:f.sizeMaybePercent}),Q.push({name:"stripe-direction",type:f.axisDirectionPrimary});for(var _=1;_<=gr.stripeBackgroundN;_++)Q.push({name:"stripe-"+_+"-background-color",type:f.color}),Q.push({name:"stripe-"+_+"-background-size",type:f.percent}),Q.push({name:"stripe-"+_+"-background-opacity",type:f.zeroOneNumber});var V=[],F=gr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:f.arrowShape,triggersBounds:d.any},{name:"arrow-color",type:f.color},{name:"arrow-fill",type:f.arrowFill},{name:"arrow-width",type:f.arrowWidth}].forEach(function(ae){F.forEach(function(re){var se=re+"-"+ae.name,ie=ae.type,Ne=ae.triggersBounds;V.push({name:se,type:ie,triggersBounds:Ne})})},{});var K=gr.properties=[].concat(E,N,w,T,C,B,x,y,h,p,m,D,M,j,k,q,Q,R,z,V,L),ee=gr.propertyGroups={behavior:E,transition:N,visibility:w,overlay:T,underlay:C,ghost:B,commonLabel:x,labelDimensions:y,mainLabel:h,sourceLabel:p,targetLabel:m,nodeBody:D,nodeBorder:M,nodeOutline:j,backgroundImage:k,pie:q,stripe:Q,compound:R,edgeLine:z,edgeArrow:V,core:L},P=gr.propertyGroupNames={},G=gr.propertyGroupKeys=Object.keys(ee);G.forEach(function(ae){P[ae]=ee[ae].map(function(re){return re.name}),ee[ae].forEach(function(re){return re.groupKey=ae})});var Z=gr.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];gr.propertyNames=K.map(function(ae){return ae.name});for(var J=0;J<K.length;J++){var X=K[J];K[X.name]=X}for(var Y=0;Y<Z.length;Y++){var le=Z[Y],me=K[le.pointsTo],oe={name:le.name,alias:!0,pointsTo:me};K.push(oe),K[le.name]=oe}})();gr.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};gr.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=tt({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(d,f){for(var h=1;h<=gr.pieBackgroundN;h++){var p=f.name.replace("{{i}}",h),m=f.value;d[p]=m}return d},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(d,f){for(var h=1;h<=gr.stripeBackgroundN;h++){var p=f.name.replace("{{i}}",h),m=f.value;d[p]=m}return d},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(d,f){return gr.arrowPrefixes.forEach(function(h){var p=h+"-"+f.name,m=f.value;d[p]=m}),d},{})),r={},a=0;a<this.properties.length;a++){var i=this.properties[a];if(!i.pointsTo){var s=i.name,o=e[s],u=this.parse(s,o);r[s]=u}}return t.defaultProperties=r,t.defaultProperties};gr.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var yh={};yh.parse=function(t,e,r,a){var i=this;if(Wt(e))return i.parseImplWarn(t,e,r,a);var s=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=r?"t":"f",u=""+e,d=fC(t,u,o,s),f=i.propCache=i.propCache||[],h;return(h=f[d])||(h=f[d]=i.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(h=Sn(h),h&&(h.value=Sn(h.value))),h};yh.parseImplWarn=function(t,e,r,a){var i=this.parseImpl(t,e,r,a);return!i&&e!=null&&At("The style property `".concat(t,": ").concat(e,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&e==="label"&&At("The style value of `label` is deprecated for `"+i.name+"`"),i};yh.parseImpl=function(t,e,r,a){var i=this;t=Vm(t);var s=i.properties[t],o=e,u=i.types;if(!s||e===void 0)return null;s.alias&&(s=s.pointsTo,t=s.name);var d=Xe(e);d&&(e=e.trim());var f=s.type;if(!f)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(Wt(e))return{name:t,value:e,strValue:"fn",mapped:u.fn,bypass:r};var h,p;if(!(!d||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(h=new RegExp(u.data.regex).exec(e))){if(r)return!1;var m=u.data;return{name:t,value:h,strValue:""+e,mapped:m,field:h[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(p=new RegExp(u.mapData.regex).exec(e))){if(r||f.multiple)return!1;var y=u.mapData;if(!(f.color||f.number))return!1;var x=this.parse(t,p[4]);if(!x||x.mapped)return!1;var E=this.parse(t,p[5]);if(!E||E.mapped)return!1;if(x.pfValue===E.pfValue||x.strValue===E.strValue)return At("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+x.strValue+"`"),this.parse(t,x.strValue);if(f.color){var w=x.value,T=E.value,C=w[0]===T[0]&&w[1]===T[1]&&w[2]===T[2]&&(w[3]===T[3]||(w[3]==null||w[3]===1)&&(T[3]==null||T[3]===1));if(C)return!1}return{name:t,value:p,strValue:""+e,mapped:y,field:p[1],fieldMin:parseFloat(p[2]),fieldMax:parseFloat(p[3]),valueMin:x.value,valueMax:E.value,bypass:r}}}if(f.multiple&&a!=="multiple"){var N;if(d?N=e.split(/\s+/):_t(e)?N=e:N=[e],f.evenMultiple&&N.length%2!==0)return null;for(var A=[],D=[],M=[],j="",k=!1,R=0;R<N.length;R++){var z=i.parse(t,N[R],r,"multiple");k=k||Xe(z.value),A.push(z.value),M.push(z.pfValue!=null?z.pfValue:z.value),D.push(z.units),j+=(R>0?" ":"")+z.strValue}return f.validate&&!f.validate(A,D)?null:f.singleEnum&&k?A.length===1&&Xe(A[0])?{name:t,value:A[0],strValue:A[0],bypass:r}:null:{name:t,value:A,pfValue:M,strValue:j,bypass:r,units:D}}var B=function(){for(var oe=0;oe<f.enums.length;oe++){var ae=f.enums[oe];if(ae===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(f.number){var L,q="px";if(f.units&&(L=f.units),f.implicitUnits&&(q=f.implicitUnits),!f.unitless)if(d){var I="px|em"+(f.allowPercent?"|\\%":"");L&&(I=L);var Q=e.match("^("+Sr+")("+I+")?$");Q&&(e=Q[1],L=Q[2]||q)}else(!L||f.implicitUnits)&&(L=q);if(e=parseFloat(e),isNaN(e)&&f.enums===void 0)return null;if(isNaN(e)&&f.enums!==void 0)return e=o,B();if(f.integer&&!ED(e)||f.min!==void 0&&(e<f.min||f.strictMin&&e===f.min)||f.max!==void 0&&(e>f.max||f.strictMax&&e===f.max))return null;var _={name:t,value:e,strValue:""+e+(L||""),units:L,bypass:r};return f.unitless||L!=="px"&&L!=="em"?_.pfValue=e:_.pfValue=L==="px"||!L?e:this.getEmSizeInPixels()*e,(L==="ms"||L==="s")&&(_.pfValue=L==="ms"?e:1e3*e),(L==="deg"||L==="rad")&&(_.pfValue=L==="rad"?e:RO(e)),L==="%"&&(_.pfValue=e/100),_}else if(f.propList){var V=[],F=""+e;if(F!=="none"){for(var K=F.split(/\s*,\s*|\s+/),ee=0;ee<K.length;ee++){var P=K[ee].trim();i.properties[P]?V.push(P):At("`"+P+"` is not a valid property name")}if(V.length===0)return null}return{name:t,value:V,strValue:V.length===0?"none":V.join(" "),bypass:r}}else if(f.color){var G=iC(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(f.regex||f.regexes){if(f.enums){var Z=B();if(Z)return Z}for(var J=f.regexes?f.regexes:[f.regex],X=0;X<J.length;X++){var Y=new RegExp(J[X]),le=Y.exec(e);if(le)return{name:t,value:f.singleRegexMatchValue?le[1]:le,strValue:""+e,bypass:r}}return null}else return f.string?{name:t,value:""+e,strValue:""+e,bypass:r}:f.enums?B():null};var Rr=function(e){if(!(this instanceof Rr))return new Rr(e);if(!Im(e)){$t("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Zr=Rr.prototype;Zr.instanceString=function(){return"style"};Zr.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(i){var s=i[0]._private;s.styleDirty=!0,s.appliedInitStyle=!1}),this};Zr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Zr.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};Zr.selector=function(t){var e=t==="core"?null:new is(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};Zr.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var i=t.properties[a],s=r[i.name];s===void 0&&(s=r[nh(i.name)]),s!==void 0&&this.cssRule(i.name,s)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Zr.style=Zr.css;Zr.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[a].mappedProperties.push(r);var i=!this[a].selector;i&&(this._private.coreStyle[r.name]=r)}return this};Zr.append=function(t){return rC(t)?t.appendToStyle(this):_t(t)?this.appendFromJson(t):Xe(t)&&this.appendFromString(t),this};Rr.fromJson=function(t,e){var r=new Rr(t);return r.fromJson(e),r};Rr.fromString=function(t,e){return new Rr(t).fromString(e)};[Br,Dc,ay,En,mh,ny,gr,yh].forEach(function(t){tt(Zr,t)});Rr.types=Zr.types;Rr.properties=Zr.properties;Rr.propertyGroups=Zr.propertyGroups;Rr.propertyGroupNames=Zr.propertyGroupNames;Rr.propertyGroupKeys=Zr.propertyGroupKeys;var zB={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return rC(e)?r.style=e.generateStyle(this):_t(e)?r.style=Rr.fromJson(this,e):Xe(e)?r.style=Rr.fromString(this,e):r.style=Rr(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},_B="single",tl={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=_B),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,a,i,s,o,u;switch(e.length){case 0:return r;case 1:if(Xe(e[0]))return a=e[0],r[a];if(wt(e[0])){if(!this._private.panningEnabled)return this;s=e[0],o=s.x,u=s.y,De(o)&&(r.x=o),De(u)&&(r.y=u),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],i=e[1],(a==="x"||a==="y")&&De(i)&&(r[a]=i),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,i=this._private.pan,s,o,u,d,f;if(!this._private.panningEnabled)return this;switch(a.length){case 1:wt(e)&&(u=a[0],d=u.x,f=u.y,De(d)&&(i.x+=d),De(f)&&(i.y+=f),this.emit("pan viewport"));break;case 2:s=e,o=r,(s==="x"||s==="y")&&De(o)&&(i[s]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var i=this._private;i.zoom=a.zoom,i.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(De(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(Xe(e)){var i=e;e=this.$(i)}else if(ND(e)){var s=e;a={x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else Da(e)||(e=this.mutableElements());if(!(Da(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),u=this.height(),d;if(r=De(r)?r:0,!isNaN(o)&&!isNaN(u)&&o>0&&u>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){d=Math.min((o-2*r)/a.w,(u-2*r)/a.h),d=d>this._private.maxZoom?this._private.maxZoom:d,d=d<this._private.minZoom?this._private.minZoom:d;var f={x:(o-d*(a.x1+a.x2))/2,y:(u-d*(a.y1+a.y2))/2};return{zoom:d,pan:f}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var i=e;e=i.min,r=i.max}return De(e)&&De(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):De(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:De(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,i=r.zoom,s,o,u=!1;if(r.zoomingEnabled||(u=!0),De(e)?o=e:wt(e)&&(o=e.level,e.position!=null?s=lh(e.position,i,a):e.renderedPosition!=null&&(s=e.renderedPosition),s!=null&&!r.panningEnabled&&(u=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,u||!De(o)||o===i||s!=null&&(!De(s.x)||!De(s.y)))return null;if(s!=null){var d=a,f=i,h=o,p={x:-h/f*(s.x-d.x)+s.x,y:-h/f*(s.y-d.y)+s.y};return{zoomed:!0,panned:!0,zoom:h,pan:p}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,i=!0,s=[],o=!1,u=!1;if(!e)return this;if(De(e.zoom)||(a=!1),wt(e.pan)||(i=!1),!a&&!i)return this;if(a){var d=e.zoom;d<r.minZoom||d>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=d,s.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var f=e.pan;De(f.x)&&(r.pan.x=f.x,u=!1),De(f.y)&&(r.pan.y=f.y,u=!1),u||s.push("pan")}return s.length>0&&(s.push("viewport"),this.emit(s.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(Xe(e)){var a=e;e=this.mutableElements().filter(a)}else Da(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),s=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var u={x:(s-r*(i.x1+i.x2))/2,y:(o-r*(i.y1+i.y2))/2};return u}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?(function(){var i=a.window().getComputedStyle(r),s=function(u){return parseFloat(i.getPropertyValue(u))};return{width:r.clientWidth-s("padding-left")-s("padding-right"),height:r.clientHeight-s("padding-top")-s("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),i={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};tl.centre=tl.center;tl.autolockNodes=tl.autolock;tl.autoungrabifyNodes=tl.autoungrabify;var sc={data:jt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:jt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:jt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:jt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};sc.attr=sc.data;sc.removeAttr=sc.removeData;var lc=function(e){var r=this;e=tt({},e);var a=e.container;a&&!zf(a)&&zf(a[0])&&(a=a[0]);var i=a?a._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var s=i.readies=i.readies||[];a&&(a._cyreg=i),i.cy=r;var o=wr!==void 0&&a!==void 0&&!e.headless,u=e;u.layout=tt({name:o?"grid":"null"},u.layout),u.renderer=tt({name:o?"canvas":"null"},u.renderer);var d=function(x,E,w){return E!==void 0?E:w!==void 0?w:x},f=this._private={container:a,ready:!1,options:u,elements:new Ir(this),listeners:[],aniEles:new Ir(this),data:u.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:d(!0,u.zoomingEnabled),userZoomingEnabled:d(!0,u.userZoomingEnabled),panningEnabled:d(!0,u.panningEnabled),userPanningEnabled:d(!0,u.userPanningEnabled),boxSelectionEnabled:d(!0,u.boxSelectionEnabled),autolock:d(!1,u.autolock,u.autolockNodes),autoungrabify:d(!1,u.autoungrabify,u.autoungrabifyNodes),autounselectify:d(!1,u.autounselectify),styleEnabled:u.styleEnabled===void 0?o:u.styleEnabled,zoom:De(u.zoom)?u.zoom:1,pan:{x:wt(u.pan)&&De(u.pan.x)?u.pan.x:0,y:wt(u.pan)&&De(u.pan.y)?u.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:d(250,u.multiClickDebounceTime)};this.createEmitter(),this.selectionType(u.selectionType),this.zoomRange({min:u.minZoom,max:u.maxZoom});var h=function(x,E){var w=x.some(jD);if(w)return Lo.all(x).then(E);E(x)};f.styleEnabled&&r.setStyle([]);var p=tt({},u,u.renderer);r.initRenderer(p);var m=function(x,E,w){r.notifications(!1);var T=r.mutableElements();T.length>0&&T.remove(),x!=null&&(wt(x)||_t(x))&&r.add(x),r.one("layoutready",function(N){r.notifications(!0),r.emit(N),r.one("load",E),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",w),r.emit("done")});var C=tt({},r._private.options.layout);C.eles=r.elements(),r.layout(C).run()};h([u.style,u.elements],function(y){var x=y[0],E=y[1];f.styleEnabled&&r.style().append(x),m(E,function(){r.startAnimationLoop(),f.ready=!0,Wt(u.ready)&&r.on("ready",u.ready);for(var w=0;w<s.length;w++){var T=s[w];r.on("ready",T)}i&&(i.readies=[]),r.emit("ready")},u.done)})},Hf=lc.prototype;tt(Hf,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return wr;var r=this._private.container.ownerDocument;return r===void 0||r==null?wr:r.defaultView||wr},mount:function(e){if(e!=null){var r=this,a=r._private,i=a.options;return!zf(e)&&zf(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(tt({},i,i.renderer,{name:i.renderer.name==="null"?"canvas":i.renderer.name})),r.startAnimationLoop(),r.style(i.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Sn(this._private.options)},json:function(e){var r=this,a=r._private,i=r.mutableElements(),s=function(A){return r.getElementById(A.id())};if(wt(e)){if(r.startBatch(),e.elements){var o={},u=function(A,D){for(var M=[],j=[],k=0;k<A.length;k++){var R=A[k];if(!R.data.id){At("cy.json() cannot handle elements without an ID attribute");continue}var z=""+R.data.id,B=r.getElementById(z);o[z]=!0,B.length!==0?j.push({ele:B,json:R}):(D&&(R.group=D),M.push(R))}r.add(M);for(var L=0;L<j.length;L++){var q=j[L],I=q.ele,Q=q.json;I.json(Q)}};if(_t(e.elements))u(e.elements);else for(var d=["nodes","edges"],f=0;f<d.length;f++){var h=d[f],p=e.elements[h];_t(p)&&u(p,h)}var m=r.collection();i.filter(function(N){return!o[N.id()]}).forEach(function(N){N.isParent()?m.merge(N):N.remove()}),m.forEach(function(N){return N.children().move({parent:null})}),m.forEach(function(N){return s(N).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var y=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<y.length;x++){var E=y[x];e[E]!=null&&r[E](e[E])}return r.endBatch(),this}else{var w=!!e,T={};w?T.elements=this.elements().map(function(N){return N.json()}):(T.elements={},i.forEach(function(N){var A=N.group();T.elements[A]||(T.elements[A]=[]),T.elements[A].push(N.json())})),this._private.styleEnabled&&(T.style=r.style().json()),T.data=Sn(r.data());var C=a.options;return T.zoomingEnabled=a.zoomingEnabled,T.userZoomingEnabled=a.userZoomingEnabled,T.zoom=a.zoom,T.minZoom=a.minZoom,T.maxZoom=a.maxZoom,T.panningEnabled=a.panningEnabled,T.userPanningEnabled=a.userPanningEnabled,T.pan=Sn(a.pan),T.boxSelectionEnabled=a.boxSelectionEnabled,T.renderer=Sn(C.renderer),T.hideEdgesOnViewport=C.hideEdgesOnViewport,T.textureOnViewport=C.textureOnViewport,T.wheelSensitivity=C.wheelSensitivity,T.motionBlur=C.motionBlur,T.multiClickDebounceTime=C.multiClickDebounceTime,T}}});Hf.$id=Hf.getElementById;[jB,OB,rN,im,Nf,BB,sm,jf,zB,tl,sc].forEach(function(t){tt(Hf,t)});var UB={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},qB={maximal:!1,acyclic:!1},Xl=function(e){return e.scratch("breadthfirst")},GS=function(e,r){return e.scratch("breadthfirst",r)};function aN(t){this.options=tt({},UB,qB,t)}aN.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(Oe){return Oe.isChildless()}),i=r,s=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,u=!!t.boundingBox,d=na(u?t.boundingBox:structuredClone(e.extent())),f;if(Da(t.roots))f=t.roots;else if(_t(t.roots)){for(var h=[],p=0;p<t.roots.length;p++){var m=t.roots[p],y=e.getElementById(m);h.push(y)}f=e.collection(h)}else if(Xe(t.roots))f=e.$(t.roots);else if(s)f=a.roots();else{var x=r.components();f=e.collection();for(var E=function(){var ke=x[w],Pe=ke.maxDegree(!1),Ge=ke.filter(function(Je){return Je.degree(!1)===Pe});f=f.add(Ge)},w=0;w<x.length;w++)E()}var T=[],C={},N=function(ke,Pe){T[Pe]==null&&(T[Pe]=[]);var Ge=T[Pe].length;T[Pe].push(ke),GS(ke,{index:Ge,depth:Pe})},A=function(ke,Pe){var Ge=Xl(ke),Je=Ge.depth,Be=Ge.index;T[Je][Be]=null,ke.isChildless()&&N(ke,Pe)};i.bfs({roots:f,directed:t.directed,visit:function(ke,Pe,Ge,Je,Be){var nt=ke[0],ye=nt.id();nt.isChildless()&&N(nt,Be),C[ye]=!0}});for(var D=[],M=0;M<a.length;M++){var j=a[M];C[j.id()]||D.push(j)}var k=function(ke){for(var Pe=T[ke],Ge=0;Ge<Pe.length;Ge++){var Je=Pe[Ge];if(Je==null){Pe.splice(Ge,1),Ge--;continue}GS(Je,{depth:ke,index:Ge})}},R=function(ke,Pe){for(var Ge=Xl(ke),Je=ke.incomers().filter(function(ze){return ze.isNode()&&r.has(ze)}),Be=-1,nt=ke.id(),ye=0;ye<Je.length;ye++){var $e=Je[ye],et=Xl($e);Be=Math.max(Be,et.depth)}if(Ge.depth<=Be){if(!t.acyclic&&Pe[nt])return null;var xe=Be+1;return A(ke,xe),Pe[nt]=xe,!0}return!1};if(s&&o){var z=[],B={},L=function(ke){return z.push(ke)},q=function(){return z.shift()};for(a.forEach(function(Oe){return z.push(Oe)});z.length>0;){var I=q(),Q=R(I,B);if(Q)I.outgoers().filter(function(Oe){return Oe.isNode()&&r.has(Oe)}).forEach(L);else if(Q===null){At("Detected double maximal shift for node `"+I.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var _=0;if(t.avoidOverlap)for(var V=0;V<a.length;V++){var F=a[V],K=F.layoutDimensions(t),ee=K.w,P=K.h;_=Math.max(_,ee,P)}var G={},Z=function(ke){if(G[ke.id()])return G[ke.id()];for(var Pe=Xl(ke).depth,Ge=ke.neighborhood(),Je=0,Be=0,nt=0;nt<Ge.length;nt++){var ye=Ge[nt];if(!(ye.isEdge()||ye.isParent()||!a.has(ye))){var $e=Xl(ye);if($e!=null){var et=$e.index,xe=$e.depth;if(!(et==null||xe==null)){var ze=T[xe].length;xe<Pe&&(Je+=et/ze,Be++)}}}}return Be=Math.max(1,Be),Je=Je/Be,Be===0&&(Je=0),G[ke.id()]=Je,Je},J=function(ke,Pe){var Ge=Z(ke),Je=Z(Pe),Be=Ge-Je;return Be===0?nC(ke.id(),Pe.id()):Be};t.depthSort!==void 0&&(J=t.depthSort);for(var X=T.length,Y=0;Y<X;Y++)T[Y].sort(J),k(Y);for(var le=[],me=0;me<D.length;me++)le.push(D[me]);var oe=function(){for(var ke=0;ke<X;ke++)k(ke)};le.length&&(T.unshift(le),X=T.length,oe());for(var ae=0,re=0;re<X;re++)ae=Math.max(T[re].length,ae);var se={x:d.x1+d.w/2,y:d.y1+d.h/2},ie=a.reduce(function(Oe,ke){return(function(Pe){return{w:Oe.w===-1?Pe.w:(Oe.w+Pe.w)/2,h:Oe.h===-1?Pe.h:(Oe.h+Pe.h)/2}})(ke.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Ne=Math.max(X===1?0:u?(d.h-t.padding*2-ie.h)/(X-1):(d.h-t.padding*2-ie.h)/(X+1),_),Ae=T.reduce(function(Oe,ke){return Math.max(Oe,ke.length)},0),Ze=function(ke){var Pe=Xl(ke),Ge=Pe.depth,Je=Pe.index;if(t.circle){var Be=Math.min(d.w/2/X,d.h/2/X);Be=Math.max(Be,_);var nt=Be*Ge+Be-(X>0&&T[0].length<=3?Be/2:0),ye=2*Math.PI/T[Ge].length*Je;return Ge===0&&T[0].length===1&&(nt=1),{x:se.x+nt*Math.cos(ye),y:se.y+nt*Math.sin(ye)}}else{var $e=T[Ge].length,et=Math.max($e===1?0:u?(d.w-t.padding*2-ie.w)/((t.grid?Ae:$e)-1):(d.w-t.padding*2-ie.w)/((t.grid?Ae:$e)+1),_),xe={x:se.x+(Je+1-($e+1)/2)*et,y:se.y+(Ge+1-(X+1)/2)*Ne};return xe}},Qe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Qe).indexOf(t.direction)===-1&&$t("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Qe).join(", ")));var Se=function(ke){return rO(Ze(ke),d,Qe[t.direction])};return r.nodes().layoutPositions(this,t,Se),this};var IB={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function nN(t){this.options=tt({},IB,t)}nN.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,s=a.nodes().not(":parent");e.sort&&(s=s.sort(e.sort));for(var o=na(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u={x:o.x1+o.w/2,y:o.y1+o.h/2},d=e.sweep===void 0?2*Math.PI-2*Math.PI/s.length:e.sweep,f=d/Math.max(1,s.length-1),h,p=0,m=0;m<s.length;m++){var y=s[m],x=y.layoutDimensions(e),E=x.w,w=x.h;p=Math.max(p,E,w)}if(De(e.radius)?h=e.radius:s.length<=1?h=0:h=Math.min(o.h,o.w)/2-p,s.length>1&&e.avoidOverlap){p*=1.75;var T=Math.cos(f)-Math.cos(0),C=Math.sin(f)-Math.sin(0),N=Math.sqrt(p*p/(T*T+C*C));h=Math.max(N,h)}var A=function(M,j){var k=e.startAngle+j*f*(i?1:-1),R=h*Math.cos(k),z=h*Math.sin(k),B={x:u.x+R,y:u.y+z};return B};return a.nodes().layoutPositions(this,e,A),this};var VB={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function iN(t){this.options=tt({},VB,t)}iN.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,i=e.eles,s=i.nodes().not(":parent"),o=na(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),u={x:o.x1+o.w/2,y:o.y1+o.h/2},d=[],f=0,h=0;h<s.length;h++){var p=s[h],m=void 0;m=e.concentric(p),d.push({value:m,node:p}),p._private.scratch.concentric=m}s.updateStyle();for(var y=0;y<s.length;y++){var x=s[y],E=x.layoutDimensions(e);f=Math.max(f,E.w,E.h)}d.sort(function(Ne,Ae){return Ae.value-Ne.value});for(var w=e.levelWidth(s),T=[[]],C=T[0],N=0;N<d.length;N++){var A=d[N];if(C.length>0){var D=Math.abs(C[0].value-A.value);D>=w&&(C=[],T.push(C))}C.push(A)}var M=f+e.minNodeSpacing;if(!e.avoidOverlap){var j=T.length>0&&T[0].length>1,k=Math.min(o.w,o.h)/2-M,R=k/(T.length+j?1:0);M=Math.min(M,R)}for(var z=0,B=0;B<T.length;B++){var L=T[B],q=e.sweep===void 0?2*Math.PI-2*Math.PI/L.length:e.sweep,I=L.dTheta=q/Math.max(1,L.length-1);if(L.length>1&&e.avoidOverlap){var Q=Math.cos(I)-Math.cos(0),_=Math.sin(I)-Math.sin(0),V=Math.sqrt(M*M/(Q*Q+_*_));z=Math.max(V,z)}L.r=z,z+=M}if(e.equidistant){for(var F=0,K=0,ee=0;ee<T.length;ee++){var P=T[ee],G=P.r-K;F=Math.max(F,G)}K=0;for(var Z=0;Z<T.length;Z++){var J=T[Z];Z===0&&(K=J.r),J.r=K,K+=F}}for(var X={},Y=0;Y<T.length;Y++)for(var le=T[Y],me=le.dTheta,oe=le.r,ae=0;ae<le.length;ae++){var re=le[ae],se=e.startAngle+(r?1:-1)*me*ae,ie={x:u.x+oe*Math.cos(se),y:u.y+oe*Math.sin(se)};X[re.node.id()]=ie}return i.nodes().layoutPositions(this,e,function(Ne){var Ae=Ne.id();return X[Ae]}),this};var dg,FB={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function xh(t){this.options=tt({},FB,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(i){var s=i.source().data("id"),o=i.target().data("id"),u=e.some(function(f){return f.data("id")===s}),d=e.some(function(f){return f.data("id")===o});return!u||!d});this.options.eles=this.options.eles.not(a)}xh.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?dg=!0:dg=!1;var a=HB(e,r,t);dg&&QB(a),t.randomize&&$B(a);var i=ei(),s=function(){YB(a,e,t),t.fit===!0&&e.fit(t.padding)},o=function(m){return!(r.stopped||m>=t.numIter||(KB(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},u=function(){if(t.animate===!0||t.animate===!1)s(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var m=t.eles.nodes(),y=lN(a,t,m);m.layoutPositions(r,t,y)}},d=0,f=!0;if(t.animate===!0){var h=function(){for(var m=0;f&&m<t.refresh;)f=o(d),d++,m++;if(!f)$S(a,t),u();else{var y=ei();y-i>=t.animationThreshold&&s(),_f(h)}};h()}else{for(;f;)f=o(d),d++;$S(a,t),u()}return this};xh.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};xh.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var HB=function(e,r,a){for(var i=a.eles.edges(),s=a.eles.nodes(),o=na(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),u={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:s.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},d=a.eles.components(),f={},h=0;h<d.length;h++)for(var p=d[h],m=0;m<p.length;m++){var y=p[m];f[y.id()]=h}for(var h=0;h<u.nodeSize;h++){var x=s[h],E=x.layoutDimensions(a),w={};w.isLocked=x.locked(),w.id=x.data("id"),w.parentId=x.data("parent"),w.cmptId=f[x.id()],w.children=[],w.positionX=x.position("x"),w.positionY=x.position("y"),w.offsetX=0,w.offsetY=0,w.height=E.w,w.width=E.h,w.maxX=w.positionX+w.width/2,w.minX=w.positionX-w.width/2,w.maxY=w.positionY+w.height/2,w.minY=w.positionY-w.height/2,w.padLeft=parseFloat(x.style("padding")),w.padRight=parseFloat(x.style("padding")),w.padTop=parseFloat(x.style("padding")),w.padBottom=parseFloat(x.style("padding")),w.nodeRepulsion=Wt(a.nodeRepulsion)?a.nodeRepulsion(x):a.nodeRepulsion,u.layoutNodes.push(w),u.idToIndex[w.id]=h}for(var T=[],C=0,N=-1,A=[],h=0;h<u.nodeSize;h++){var x=u.layoutNodes[h],D=x.parentId;D!=null?u.layoutNodes[u.idToIndex[D]].children.push(x.id):(T[++N]=x.id,A.push(x.id))}for(u.graphSet.push(A);C<=N;){var M=T[C++],j=u.idToIndex[M],y=u.layoutNodes[j],k=y.children;if(k.length>0){u.graphSet.push(k);for(var h=0;h<k.length;h++)T[++N]=k[h]}}for(var h=0;h<u.graphSet.length;h++)for(var R=u.graphSet[h],m=0;m<R.length;m++){var z=u.idToIndex[R[m]];u.indexToGraph[z]=h}for(var h=0;h<u.edgeSize;h++){var B=i[h],L={};L.id=B.data("id"),L.sourceId=B.data("source"),L.targetId=B.data("target");var q=Wt(a.idealEdgeLength)?a.idealEdgeLength(B):a.idealEdgeLength,I=Wt(a.edgeElasticity)?a.edgeElasticity(B):a.edgeElasticity,Q=u.idToIndex[L.sourceId],_=u.idToIndex[L.targetId],V=u.indexToGraph[Q],F=u.indexToGraph[_];if(V!=F){for(var K=GB(L.sourceId,L.targetId,u),ee=u.graphSet[K],P=0,w=u.layoutNodes[Q];ee.indexOf(w.id)===-1;)w=u.layoutNodes[u.idToIndex[w.parentId]],P++;for(w=u.layoutNodes[_];ee.indexOf(w.id)===-1;)w=u.layoutNodes[u.idToIndex[w.parentId]],P++;q*=P*a.nestingFactor}L.idealLength=q,L.elasticity=I,u.layoutEdges.push(L)}return u},GB=function(e,r,a){var i=sN(e,r,0,a);return 2>i.count?0:i.graph},sN=function(e,r,a,i){var s=i.graphSet[a];if(-1<s.indexOf(e)&&-1<s.indexOf(r))return{count:2,graph:a};for(var o=0,u=0;u<s.length;u++){var d=s[u],f=i.idToIndex[d],h=i.layoutNodes[f].children;if(h.length!==0){var p=i.indexToGraph[i.idToIndex[h[0]]],m=sN(e,r,p,i);if(m.count!==0)if(m.count===1){if(o++,o===2)break}else return m}}return{count:o,graph:a}},QB,$B=function(e,r){for(var a=e.clientWidth,i=e.clientHeight,s=0;s<e.nodeSize;s++){var o=e.layoutNodes[s];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*i)}},lN=function(e,r,a){var i=e.boundingBox,s={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(o){var u=e.layoutNodes[e.idToIndex[o.data("id")]];s.x1=Math.min(s.x1,u.positionX),s.x2=Math.max(s.x2,u.positionX),s.y1=Math.min(s.y1,u.positionY),s.y2=Math.max(s.y2,u.positionY)}),s.w=s.x2-s.x1,s.h=s.y2-s.y1),function(o,u){var d=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var f=s.w===0?.5:(d.positionX-s.x1)/s.w,h=s.h===0?.5:(d.positionY-s.y1)/s.h;return{x:i.x1+f*i.w,y:i.y1+h*i.h}}else return{x:d.positionX,y:d.positionY}}},YB=function(e,r,a){var i=a.layout,s=a.eles.nodes(),o=lN(e,a,s);s.positions(o),e.ready!==!0&&(e.ready=!0,i.one("layoutready",a.ready),i.emit({type:"layoutready",layout:this}))},KB=function(e,r,a){XB(e,r),JB(e),eL(e,r),tL(e),rL(e)},XB=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var i=e.graphSet[a],s=i.length,o=0;o<s;o++)for(var u=e.layoutNodes[e.idToIndex[i[o]]],d=o+1;d<s;d++){var f=e.layoutNodes[e.idToIndex[i[d]]];ZB(u,f,e,r)}},QS=function(e){return-1+2*e*Math.random()},ZB=function(e,r,a,i){var s=e.cmptId,o=r.cmptId;if(!(s!==o&&!a.isCompound)){var u=r.positionX-e.positionX,d=r.positionY-e.positionY,f=1;u===0&&d===0&&(u=QS(f),d=QS(f));var h=WB(e,r,u,d);if(h>0)var p=i.nodeOverlap*h,m=Math.sqrt(u*u+d*d),y=p*u/m,x=p*d/m;else var E=Gf(e,u,d),w=Gf(r,-1*u,-1*d),T=w.x-E.x,C=w.y-E.y,N=T*T+C*C,m=Math.sqrt(N),p=(e.nodeRepulsion+r.nodeRepulsion)/N,y=p*T/m,x=p*C/m;e.isLocked||(e.offsetX-=y,e.offsetY-=x),r.isLocked||(r.offsetX+=y,r.offsetY+=x)}},WB=function(e,r,a,i){if(a>0)var s=e.maxX-r.minX;else var s=r.maxX-e.minX;if(i>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return s>=0&&o>=0?Math.sqrt(s*s+o*o):0},Gf=function(e,r,a){var i=e.positionX,s=e.positionY,o=e.height||1,u=e.width||1,d=a/r,f=o/u,h={};return r===0&&0<a||r===0&&0>a?(h.x=i,h.y=s+o/2,h):0<r&&-1*f<=d&&d<=f?(h.x=i+u/2,h.y=s+u*a/2/r,h):0>r&&-1*f<=d&&d<=f?(h.x=i-u/2,h.y=s-u*a/2/r,h):0<a&&(d<=-1*f||d>=f)?(h.x=i+o*r/2/a,h.y=s+o/2,h):(0>a&&(d<=-1*f||d>=f)&&(h.x=i-o*r/2/a,h.y=s-o/2),h)},JB=function(e,r){for(var a=0;a<e.edgeSize;a++){var i=e.layoutEdges[a],s=e.idToIndex[i.sourceId],o=e.layoutNodes[s],u=e.idToIndex[i.targetId],d=e.layoutNodes[u],f=d.positionX-o.positionX,h=d.positionY-o.positionY;if(!(f===0&&h===0)){var p=Gf(o,f,h),m=Gf(d,-1*f,-1*h),y=m.x-p.x,x=m.y-p.y,E=Math.sqrt(y*y+x*x),w=Math.pow(i.idealLength-E,2)/i.elasticity;if(E!==0)var T=w*y/E,C=w*x/E;else var T=0,C=0;o.isLocked||(o.offsetX+=T,o.offsetY+=C),d.isLocked||(d.offsetX-=T,d.offsetY-=C)}}},eL=function(e,r){if(r.gravity!==0)for(var a=1,i=0;i<e.graphSet.length;i++){var s=e.graphSet[i],o=s.length;if(i===0)var u=e.clientHeight/2,d=e.clientWidth/2;else var f=e.layoutNodes[e.idToIndex[s[0]]],h=e.layoutNodes[e.idToIndex[f.parentId]],u=h.positionX,d=h.positionY;for(var p=0;p<o;p++){var m=e.layoutNodes[e.idToIndex[s[p]]];if(!m.isLocked){var y=u-m.positionX,x=d-m.positionY,E=Math.sqrt(y*y+x*x);if(E>a){var w=r.gravity*y/E,T=r.gravity*x/E;m.offsetX+=w,m.offsetY+=T}}}}},tL=function(e,r){var a=[],i=0,s=-1;for(a.push.apply(a,e.graphSet[0]),s+=e.graphSet[0].length;i<=s;){var o=a[i++],u=e.idToIndex[o],d=e.layoutNodes[u],f=d.children;if(0<f.length&&!d.isLocked){for(var h=d.offsetX,p=d.offsetY,m=0;m<f.length;m++){var y=e.layoutNodes[e.idToIndex[f[m]]];y.offsetX+=h,y.offsetY+=p,a[++s]=f[m]}d.offsetX=0,d.offsetY=0}}},rL=function(e,r){for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];0<i.children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];if(!(0<i.children.length||i.isLocked)){var s=aL(i.offsetX,i.offsetY,e.temperature);i.positionX+=s.x,i.positionY+=s.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,oN(i,e)}}for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];0<i.children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},aL=function(e,r,a){var i=Math.sqrt(e*e+r*r);if(i>a)var s={x:a*e/i,y:a*r/i};else var s={x:e,y:r};return s},oN=function(e,r){var a=e.parentId;if(a!=null){var i=r.layoutNodes[r.idToIndex[a]],s=!1;if((i.maxX==null||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,s=!0),(i.minX==null||e.minX-i.padLeft<i.minX)&&(i.minX=e.minX-i.padLeft,s=!0),(i.maxY==null||e.maxY+i.padBottom>i.maxY)&&(i.maxY=e.maxY+i.padBottom,s=!0),(i.minY==null||e.minY-i.padTop<i.minY)&&(i.minY=e.minY-i.padTop,s=!0),s)return oN(i,r)}},$S=function(e,r){for(var a=e.layoutNodes,i=[],s=0;s<a.length;s++){var o=a[s],u=o.cmptId,d=i[u]=i[u]||[];d.push(o)}for(var f=0,s=0;s<i.length;s++){var h=i[s];if(h){h.x1=1/0,h.x2=-1/0,h.y1=1/0,h.y2=-1/0;for(var p=0;p<h.length;p++){var m=h[p];h.x1=Math.min(h.x1,m.positionX-m.width/2),h.x2=Math.max(h.x2,m.positionX+m.width/2),h.y1=Math.min(h.y1,m.positionY-m.height/2),h.y2=Math.max(h.y2,m.positionY+m.height/2)}h.w=h.x2-h.x1,h.h=h.y2-h.y1,f+=h.w*h.h}}i.sort(function(C,N){return N.w*N.h-C.w*C.h});for(var y=0,x=0,E=0,w=0,T=Math.sqrt(f)*e.clientWidth/e.clientHeight,s=0;s<i.length;s++){var h=i[s];if(h){for(var p=0;p<h.length;p++){var m=h[p];m.isLocked||(m.positionX+=y-h.x1,m.positionY+=x-h.y1)}y+=h.w+r.componentSpacing,E+=h.w+r.componentSpacing,w=Math.max(w,h.h),E>T&&(x+=w+r.componentSpacing,y=0,E=0,w=0)}}},nL={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function uN(t){this.options=tt({},nL,t)}uN.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));var s=na(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(s.h===0||s.w===0)a.nodes().layoutPositions(this,e,function(Z){return{x:s.x1,y:s.y1}});else{var o=i.size(),u=Math.sqrt(o*s.h/s.w),d=Math.round(u),f=Math.round(s.w/s.h*u),h=function(J){if(J==null)return Math.min(d,f);var X=Math.min(d,f);X==d?d=J:f=J},p=function(J){if(J==null)return Math.max(d,f);var X=Math.max(d,f);X==d?d=J:f=J},m=e.rows,y=e.cols!=null?e.cols:e.columns;if(m!=null&&y!=null)d=m,f=y;else if(m!=null&&y==null)d=m,f=Math.ceil(o/d);else if(m==null&&y!=null)f=y,d=Math.ceil(o/f);else if(f*d>o){var x=h(),E=p();(x-1)*E>=o?h(x-1):(E-1)*x>=o&&p(E-1)}else for(;f*d<o;){var w=h(),T=p();(T+1)*w>=o?p(T+1):h(w+1)}var C=s.w/f,N=s.h/d;if(e.condense&&(C=0,N=0),e.avoidOverlap)for(var A=0;A<i.length;A++){var D=i[A],M=D._private.position;(M.x==null||M.y==null)&&(M.x=0,M.y=0);var j=D.layoutDimensions(e),k=e.avoidOverlapPadding,R=j.w+k,z=j.h+k;C=Math.max(C,R),N=Math.max(N,z)}for(var B={},L=function(J,X){return!!B["c-"+J+"-"+X]},q=function(J,X){B["c-"+J+"-"+X]=!0},I=0,Q=0,_=function(){Q++,Q>=f&&(Q=0,I++)},V={},F=0;F<i.length;F++){var K=i[F],ee=e.position(K);if(ee&&(ee.row!==void 0||ee.col!==void 0)){var P={row:ee.row,col:ee.col};if(P.col===void 0)for(P.col=0;L(P.row,P.col);)P.col++;else if(P.row===void 0)for(P.row=0;L(P.row,P.col);)P.row++;V[K.id()]=P,q(P.row,P.col)}}var G=function(J,X){var Y,le;if(J.locked()||J.isParent())return!1;var me=V[J.id()];if(me)Y=me.col*C+C/2+s.x1,le=me.row*N+N/2+s.y1;else{for(;L(I,Q);)_();Y=Q*C+C/2+s.x1,le=I*N+N/2+s.y1,q(I,Q),_()}return{x:Y,y:le}};i.layoutPositions(this,e,G)}return this};var iL={ready:function(){},stop:function(){}};function iy(t){this.options=tt({},iL,t)}iy.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};iy.prototype.stop=function(){return this};var sL={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function cN(t){this.options=tt({},sL,t)}cN.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=Wt(t.positions);function i(s){if(t.positions==null)return AO(s.position());if(a)return t.positions(s);var o=t.positions[s._private.data.id];return o??null}return r.layoutPositions(this,t,function(s,o){var u=i(s);return s.locked()||u==null?!1:u}),this};var lL={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function dN(t){this.options=tt({},lL,t)}dN.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=na(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i=function(o,u){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,i),this};var oL=[{name:"breadthfirst",impl:aN},{name:"circle",impl:nN},{name:"concentric",impl:iN},{name:"cose",impl:xh},{name:"grid",impl:uN},{name:"null",impl:iy},{name:"preset",impl:cN},{name:"random",impl:dN}];function fN(t){this.options=t,this.notifications=0}var YS=function(){},KS=function(){throw new Error("A headless instance can not render images")};fN.prototype={recalculateRenderedStyle:YS,notify:function(){this.notifications++},init:YS,isHeadless:function(){return!0},png:KS,jpg:KS};var sy={};sy.arrowShapeWidth=.3;sy.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(f,h,p,m,y,x,E){var w=y.x-p/2-E,T=y.x+p/2+E,C=y.y-p/2-E,N=y.y+p/2+E,A=w<=f&&f<=T&&C<=h&&h<=N;return A},a=function(f,h,p,m,y){var x=f*Math.cos(m)-h*Math.sin(m),E=f*Math.sin(m)+h*Math.cos(m),w=x*p,T=E*p,C=w+y.x,N=T+y.y;return{x:C,y:N}},i=function(f,h,p,m){for(var y=[],x=0;x<f.length;x+=2){var E=f[x],w=f[x+1];y.push(a(E,w,h,p,m))}return y},s=function(f){for(var h=[],p=0;p<f.length;p++){var m=f[p];h.push(m.x,m.y)}return h},o=function(f){return f.pstyle("width").pfValue*f.pstyle("arrow-scale").pfValue*2},u=function(f,h){Xe(h)&&(h=t[h]),t[f]=tt({name:f,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(m,y,x,E,w,T){var C=s(i(this.points,x+2*T,E,w)),N=ma(m,y,C);return N},roughCollide:r,draw:function(m,y,x,E){var w=i(this.points,y,x,E);e.arrowShapeImpl("polygon")(m,w)},spacing:function(m){return 0},gap:o},h)};u("none",{collide:Uf,roughCollide:Uf,draw:Gm,spacing:uw,gap:uw}),u("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),u("arrow","triangle"),u("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=this.controlPoint,w=a(E[0],E[1],h,p,m);e.arrowShapeImpl(this.name)(f,x,w)},gap:function(f){return o(f)*.8}}),u("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(f,h,p,m,y,x,E){var w=s(i(this.points,p+2*E,m,y)),T=s(i(this.pointsTee,p+2*E,m,y)),C=ma(f,h,w)||ma(f,h,T);return C},draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=i(this.pointsTee,h,p,m);e.arrowShapeImpl(this.name)(f,x,E)}}),u("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(f,h,p,m,y,x,E){var w=y,T=Math.pow(w.x-f,2)+Math.pow(w.y-h,2)<=Math.pow((p+2*E)*this.radius,2),C=s(i(this.points,p+2*E,m,y));return ma(f,h,C)||T},draw:function(f,h,p,m,y){var x=i(this.pointsTr,h,p,m);e.arrowShapeImpl(this.name)(f,x,m.x,m.y,this.radius*h)},spacing:function(f){return e.getArrowWidth(f.pstyle("width").pfValue,f.pstyle("arrow-scale").value)*this.radius}}),u("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(f,h){var p=this.baseCrossLinePts.slice(),m=h/f,y=3,x=5;return p[y]=p[y]-m,p[x]=p[x]-m,p},collide:function(f,h,p,m,y,x,E){var w=s(i(this.points,p+2*E,m,y)),T=s(i(this.crossLinePts(p,x),p+2*E,m,y)),C=ma(f,h,w)||ma(f,h,T);return C},draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=i(this.crossLinePts(h,y),h,p,m);e.arrowShapeImpl(this.name)(f,x,E)}}),u("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(f){return o(f)*.525}}),u("circle",{radius:.15,collide:function(f,h,p,m,y,x,E){var w=y,T=Math.pow(w.x-f,2)+Math.pow(w.y-h,2)<=Math.pow((p+2*E)*this.radius,2);return T},draw:function(f,h,p,m,y){e.arrowShapeImpl(this.name)(f,m.x,m.y,this.radius*h)},spacing:function(f){return e.getArrowWidth(f.pstyle("width").pfValue,f.pstyle("arrow-scale").value)*this.radius}}),u("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(f){return 1},gap:function(f){return 1}}),u("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),u("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(f){return f.pstyle("width").pfValue*f.pstyle("arrow-scale").value}}),u("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(f){return .95*f.pstyle("width").pfValue*f.pstyle("arrow-scale").value}})};var ul={};ul.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),i=a[0],s=a[1],o=a[4],u=r.pan(),d=r.zoom(),f=((t-i)/o-u.x)/d,h=((e-s)/o-u.y)/d;return[f,h]};ul.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(T){return parseFloat(r.getPropertyValue(T))},i={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},s={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=t.clientWidth,u=t.clientHeight,d=i.left+i.right,f=i.top+i.bottom,h=s.left+s.right,p=e.width/(o+h),m=o-d,y=u-f,x=e.left+i.left+s.left,E=e.top+i.top+s.top;return this.containerBB=[x,E,m,y,p]};ul.invalidateContainerClientCoordsCache=function(){this.containerBB=null};ul.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};ul.findNearestElements=function(t,e,r,a){var i=this,s=this,o=s.getCachedZSortedEles(),u=[],d=s.cy.zoom(),f=s.cy.hasCompoundNodes(),h=(a?24:8)/d,p=(a?8:2)/d,m=(a?8:2)/d,y=1/0,x,E;r&&(o=o.interactive);function w(j,k){if(j.isNode()){if(E)return;E=j,u.push(j)}if(j.isEdge()&&(k==null||k<y))if(x){if(x.pstyle("z-compound-depth").value===j.pstyle("z-compound-depth").value&&x.pstyle("z-compound-depth").value===j.pstyle("z-compound-depth").value){for(var R=0;R<u.length;R++)if(u[R].isEdge()){u[R]=j,x=j,y=k??y;break}}}else u.push(j),x=j,y=k??y}function T(j){var k=j.outerWidth()+2*p,R=j.outerHeight()+2*p,z=k/2,B=R/2,L=j.position(),q=j.pstyle("corner-radius").value==="auto"?"auto":j.pstyle("corner-radius").pfValue,I=j._private.rscratch;if(L.x-z<=t&&t<=L.x+z&&L.y-B<=e&&e<=L.y+B){var Q=s.nodeShapes[i.getNodeShape(j)];if(Q.checkPoint(t,e,0,k,R,L.x,L.y,q,I))return w(j,0),!0}}function C(j){var k=j._private,R=k.rscratch,z=j.pstyle("width").pfValue,B=j.pstyle("arrow-scale").value,L=z/2+h,q=L*L,I=L*2,F=k.source,K=k.target,Q;if(R.edgeType==="segments"||R.edgeType==="straight"||R.edgeType==="haystack"){for(var _=R.allpts,V=0;V+3<_.length;V+=2)if(VO(t,e,_[V],_[V+1],_[V+2],_[V+3],I)&&q>(Q=$O(t,e,_[V],_[V+1],_[V+2],_[V+3])))return w(j,Q),!0}else if(R.edgeType==="bezier"||R.edgeType==="multibezier"||R.edgeType==="self"||R.edgeType==="compound"){for(var _=R.allpts,V=0;V+5<R.allpts.length;V+=4)if(FO(t,e,_[V],_[V+1],_[V+2],_[V+3],_[V+4],_[V+5],I)&&q>(Q=QO(t,e,_[V],_[V+1],_[V+2],_[V+3],_[V+4],_[V+5])))return w(j,Q),!0}for(var F=F||k.source,K=K||k.target,ee=i.getArrowWidth(z,B),P=[{name:"source",x:R.arrowStartX,y:R.arrowStartY,angle:R.srcArrowAngle},{name:"target",x:R.arrowEndX,y:R.arrowEndY,angle:R.tgtArrowAngle},{name:"mid-source",x:R.midX,y:R.midY,angle:R.midsrcArrowAngle},{name:"mid-target",x:R.midX,y:R.midY,angle:R.midtgtArrowAngle}],V=0;V<P.length;V++){var G=P[V],Z=s.arrowShapes[j.pstyle(G.name+"-arrow-shape").value],J=j.pstyle("width").pfValue;if(Z.roughCollide(t,e,ee,G.angle,{x:G.x,y:G.y},J,h)&&Z.collide(t,e,ee,G.angle,{x:G.x,y:G.y},J,h))return w(j),!0}f&&u.length>0&&(T(F),T(K))}function N(j,k,R){return ga(j,k,R)}function A(j,k){var R=j._private,z=m,B;k?B=k+"-":B="",j.boundingBox();var L=R.labelBounds[k||"main"],q=j.pstyle(B+"label").value,I=j.pstyle("text-events").strValue==="yes";if(!(!I||!q)){var Q=N(R.rscratch,"labelX",k),_=N(R.rscratch,"labelY",k),V=N(R.rscratch,"labelAngle",k),F=j.pstyle(B+"text-margin-x").pfValue,K=j.pstyle(B+"text-margin-y").pfValue,ee=L.x1-z-F,P=L.x2+z-F,G=L.y1-z-K,Z=L.y2+z-K;if(V){var J=Math.cos(V),X=Math.sin(V),Y=function(ie,Ne){return ie=ie-Q,Ne=Ne-_,{x:ie*J-Ne*X+Q,y:ie*X+Ne*J+_}},le=Y(ee,G),me=Y(ee,Z),oe=Y(P,G),ae=Y(P,Z),re=[le.x+F,le.y+K,oe.x+F,oe.y+K,ae.x+F,ae.y+K,me.x+F,me.y+K];if(ma(t,e,re))return w(j),!0}else if(Ki(L,t,e))return w(j),!0}}for(var D=o.length-1;D>=0;D--){var M=o[D];M.isNode()?T(M)||A(M):C(M)||A(M)||A(M,"source")||A(M,"target")}return u};ul.getAllInBox=function(t,e,r,a){var i=this.getCachedZSortedEles().interactive,s=this.cy.zoom(),o=2/s,u=[],d=Math.min(t,r),f=Math.max(t,r),h=Math.min(e,a),p=Math.max(e,a);t=d,r=f,e=h,a=p;var m=na({x1:t,y1:e,x2:r,y2:a}),y=[{x:m.x1,y:m.y1},{x:m.x2,y:m.y1},{x:m.x2,y:m.y2},{x:m.x1,y:m.y2}],x=[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]],[y[3],y[0]]];function E(ie,Ne,Ae){return ga(ie,Ne,Ae)}function w(ie,Ne){var Ae=ie._private,Ze=o,Qe="";ie.boundingBox();var Se=Ae.labelBounds.main;if(!Se)return null;var Oe=E(Ae.rscratch,"labelX",Ne),ke=E(Ae.rscratch,"labelY",Ne),Pe=E(Ae.rscratch,"labelAngle",Ne),Ge=ie.pstyle(Qe+"text-margin-x").pfValue,Je=ie.pstyle(Qe+"text-margin-y").pfValue,Be=Se.x1-Ze-Ge,nt=Se.x2+Ze-Ge,ye=Se.y1-Ze-Je,$e=Se.y2+Ze-Je;if(Pe){var et=Math.cos(Pe),xe=Math.sin(Pe),ze=function(we,$){return we=we-Oe,$=$-ke,{x:we*et-$*xe+Oe,y:we*xe+$*et+ke}};return[ze(Be,ye),ze(nt,ye),ze(nt,$e),ze(Be,$e)]}else return[{x:Be,y:ye},{x:nt,y:ye},{x:nt,y:$e},{x:Be,y:$e}]}function T(ie,Ne,Ae,Ze){function Qe(Se,Oe,ke){return(ke.y-Se.y)*(Oe.x-Se.x)>(Oe.y-Se.y)*(ke.x-Se.x)}return Qe(ie,Ae,Ze)!==Qe(Ne,Ae,Ze)&&Qe(ie,Ne,Ae)!==Qe(ie,Ne,Ze)}for(var C=0;C<i.length;C++){var N=i[C];if(N.isNode()){var A=N,D=A.pstyle("text-events").strValue==="yes",M=A.pstyle("box-selection").strValue,j=A.pstyle("box-select-labels").strValue==="yes";if(M==="none")continue;var k=(M==="overlap"||j)&&D,R=A.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:k});if(M==="contain"){var z=!1;if(j&&D){var B=w(A);B&&u0(B,y)&&(u.push(A),z=!0)}!z&&xC(m,R)&&u.push(A)}else if(M==="overlap"&&Km(m,R)){var L=A.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),q=[{x:L.x1,y:L.y1},{x:L.x2,y:L.y1},{x:L.x2,y:L.y2},{x:L.x1,y:L.y2}];if(u0(q,y))u.push(A);else{var I=w(A);I&&u0(I,y)&&u.push(A)}}}else{var Q=N,_=Q._private,V=_.rscratch,F=Q.pstyle("box-selection").strValue;if(F==="none")continue;if(F==="contain"){if(V.startX!=null&&V.startY!=null&&!Ki(m,V.startX,V.startY)||V.endX!=null&&V.endY!=null&&!Ki(m,V.endX,V.endY))continue;if(V.edgeType==="bezier"||V.edgeType==="multibezier"||V.edgeType==="self"||V.edgeType==="compound"||V.edgeType==="segments"||V.edgeType==="haystack"){for(var K=_.rstyle.bezierPts||_.rstyle.linePts||_.rstyle.haystackPts,ee=!0,P=0;P<K.length;P++)if(!vw(m,K[P])){ee=!1;break}ee&&u.push(Q)}else V.edgeType==="straight"&&u.push(Q)}else if(F==="overlap"){var G=!1;if(V.startX!=null&&V.startY!=null&&V.endX!=null&&V.endY!=null&&(Ki(m,V.startX,V.startY)||Ki(m,V.endX,V.endY)))u.push(Q),G=!0;else if(!G&&V.edgeType==="haystack"){for(var Z=_.rstyle.haystackPts,J=0;J<Z.length;J++)if(vw(m,Z[J])){u.push(Q),G=!0;break}}if(!G){var X=_.rstyle.bezierPts||_.rstyle.linePts||_.rstyle.haystackPts;if((!X||X.length<2)&&V.edgeType==="straight"&&V.startX!=null&&V.startY!=null&&V.endX!=null&&V.endY!=null&&(X=[{x:V.startX,y:V.startY},{x:V.endX,y:V.endY}]),!X||X.length<2)continue;for(var Y=0;Y<X.length-1;Y++){for(var le=X[Y],me=X[Y+1],oe=0;oe<x.length;oe++){var ae=mr(x[oe],2),re=ae[0],se=ae[1];if(T(le,me,re,se)){u.push(Q),G=!0;break}}if(G)break}}}}}return u};var Qf={};Qf.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",i=e.edgeType==="multibezier",s=e.edgeType==="segments",o=e.edgeType==="compound",u=e.edgeType==="self",d,f,h,p,m,y,T,C;if(r?(h=e.haystackPts[0],p=e.haystackPts[1],m=e.haystackPts[2],y=e.haystackPts[3]):(h=e.arrowStartX,p=e.arrowStartY,m=e.arrowEndX,y=e.arrowEndY),T=e.midX,C=e.midY,s)d=h-e.segpts[0],f=p-e.segpts[1];else if(i||o||u||a){var x=e.allpts,E=Or(x[0],x[2],x[4],.1),w=Or(x[1],x[3],x[5],.1);d=h-E,f=p-w}else d=h-T,f=p-C;e.srcArrowAngle=rf(d,f);var T=e.midX,C=e.midY;if(r&&(T=(h+m)/2,C=(p+y)/2),d=m-h,f=y-p,s){var x=e.allpts;if(x.length/2%2===0){var N=x.length/2,A=N-2;d=x[N]-x[A],f=x[N+1]-x[A+1]}else if(e.isRound)d=e.midVector[1],f=-e.midVector[0];else{var N=x.length/2-1,A=N-2;d=x[N]-x[A],f=x[N+1]-x[A+1]}}else if(i||o||u){var x=e.allpts,D=e.ctrlpts,M,j,k,R;if(D.length/2%2===0){var z=x.length/2-1,B=z+2,L=B+2;M=Or(x[z],x[B],x[L],0),j=Or(x[z+1],x[B+1],x[L+1],0),k=Or(x[z],x[B],x[L],1e-4),R=Or(x[z+1],x[B+1],x[L+1],1e-4)}else{var B=x.length/2-1,z=B-2,L=B+2;M=Or(x[z],x[B],x[L],.4999),j=Or(x[z+1],x[B+1],x[L+1],.4999),k=Or(x[z],x[B],x[L],.5),R=Or(x[z+1],x[B+1],x[L+1],.5)}d=k-M,f=R-j}if(e.midtgtArrowAngle=rf(d,f),e.midDispX=d,e.midDispY=f,d*=-1,f*=-1,s){var x=e.allpts;if(x.length/2%2!==0){if(!e.isRound){var N=x.length/2-1,q=N+2;d=-(x[q]-x[N]),f=-(x[q+1]-x[N+1])}}}if(e.midsrcArrowAngle=rf(d,f),s)d=m-e.segpts[e.segpts.length-2],f=y-e.segpts[e.segpts.length-1];else if(i||o||u||a){var x=e.allpts,I=x.length,E=Or(x[I-6],x[I-4],x[I-2],.9),w=Or(x[I-5],x[I-3],x[I-1],.9);d=m-E,f=y-w}else d=m-T,f=y-C;e.tgtArrowAngle=rf(d,f)};Qf.getArrowWidth=Qf.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var lm,om,mn={},Ga={},XS,ZS,_s,Af,Hn,Os,Ls,pn,Zl,df,hN,vN,um,cm,WS,JS=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},uL=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},cL=function(e,r,a,i,s){if(e!==WS?JS(r,e,mn):uL(Ga,mn),JS(r,a,Ga),XS=mn.nx*Ga.ny-mn.ny*Ga.nx,ZS=mn.nx*Ga.nx-mn.ny*-Ga.ny,Hn=Math.asin(Math.max(-1,Math.min(1,XS))),Math.abs(Hn)<1e-6){lm=r.x,om=r.y,Ls=Zl=0;return}_s=1,Af=!1,ZS<0?Hn<0?Hn=Math.PI+Hn:(Hn=Math.PI-Hn,_s=-1,Af=!0):Hn>0&&(_s=-1,Af=!0),r.radius!==void 0?Zl=r.radius:Zl=i,Os=Hn/2,df=Math.min(mn.len/2,Ga.len/2),s?(pn=Math.abs(Math.cos(Os)*Zl/Math.sin(Os)),pn>df?(pn=df,Ls=Math.abs(pn*Math.sin(Os)/Math.cos(Os))):Ls=Zl):(pn=Math.min(df,Zl),Ls=Math.abs(pn*Math.sin(Os)/Math.cos(Os))),um=r.x+Ga.nx*pn,cm=r.y+Ga.ny*pn,lm=um-Ga.ny*Ls*_s,om=cm+Ga.nx*Ls*_s,hN=r.x+mn.nx*pn,vN=r.y+mn.ny*pn,WS=r};function pN(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function ly(t,e,r,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(cL(t,e,r,a,i),{cx:lm,cy:om,radius:Ls,startX:hN,startY:vN,stopX:um,stopY:cm,startAngle:mn.ang+Math.PI/2*_s,endAngle:Ga.ang-Math.PI/2*_s,counterClockwise:Af})}var oc=.01,dL=Math.sqrt(2*oc),Wr={};Wr.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,i=e.vectorNormInverse,s,o=t.pstyle("source-endpoint"),u=t.pstyle("target-endpoint"),d=o.units!=null&&u.units!=null,f=function(D,M,j,k){var R=k-M,z=j-D,B=Math.sqrt(z*z+R*R);return{x:-R/B,y:z/B}},h=t.pstyle("edge-distances").value;switch(h){case"node-position":s=r;break;case"intersection":s=a;break;case"endpoints":{if(d){var p=this.manualEndptToPx(t.source()[0],o),m=mr(p,2),y=m[0],x=m[1],E=this.manualEndptToPx(t.target()[0],u),w=mr(E,2),T=w[0],C=w[1],N={x1:y,y1:x,x2:T,y2:C};i=f(y,x,T,C),s=N}else At("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),s=a;break}}return{midptPts:s,vectorNormInverse:i}};Wr.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,i=a.rscratch;if(!i.haystack){var s=Math.random()*2*Math.PI;i.source={x:Math.cos(s),y:Math.sin(s)},s=Math.random()*2*Math.PI,i.target={x:Math.cos(s),y:Math.sin(s)}}var o=a.source,u=a.target,d=o.position(),f=u.position(),h=o.width(),p=u.width(),m=o.height(),y=u.height(),x=r.pstyle("haystack-radius").value,E=x/2;i.haystackPts=i.allpts=[i.source.x*h*E+d.x,i.source.y*m*E+d.y,i.target.x*p*E+f.x,i.target.y*y*E+f.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};Wr.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),i=t.pstyle("segment-distances"),s=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),u=Math.min(a.pfValue.length,i.pfValue.length),d=s.pfValue[s.pfValue.length-1],f=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var h=0;h<u;h++){var p=a.pfValue[h],m=i.pfValue[h],y=1-p,x=p,E=this.findMidptPtsEtc(t,e),w=E.midptPts,T=E.vectorNormInverse,C={x:w.x1*y+w.x2*x,y:w.y1*y+w.y2*x};r.segpts.push(C.x+T.x*m,C.y+T.y*m),r.radii.push(s.pfValue[h]!==void 0?s.pfValue[h]:d),r.isArcRadius.push((o.pfValue[h]!==void 0?o.pfValue[h]:f)==="arc-radius")}};Wr.findLoopPoints=function(t,e,r,a){var i=t._private.rscratch,s=e.dirCounts,o=e.srcPos,u=t.pstyle("control-point-distances"),d=u?u.pfValue[0]:void 0,f=t.pstyle("loop-direction").pfValue,h=t.pstyle("loop-sweep").pfValue,p=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var m=r,y=p;a&&(m=0,y=d);var x=f-Math.PI/2,E=x-h/2,w=x+h/2,T=f+"_"+h;m=s[T]===void 0?s[T]=0:++s[T],i.ctrlpts=[o.x+Math.cos(E)*1.4*y*(m/3+1),o.y+Math.sin(E)*1.4*y*(m/3+1),o.x+Math.cos(w)*1.4*y*(m/3+1),o.y+Math.sin(w)*1.4*y*(m/3+1)]};Wr.findCompoundLoopPoints=function(t,e,r,a){var i=t._private.rscratch;i.edgeType="compound";var s=e.srcPos,o=e.tgtPos,u=e.srcW,d=e.srcH,f=e.tgtW,h=e.tgtH,p=t.pstyle("control-point-step-size").pfValue,m=t.pstyle("control-point-distances"),y=m?m.pfValue[0]:void 0,x=r,E=p;a&&(x=0,E=y);var w=50,T={x:s.x-u/2,y:s.y-d/2},C={x:o.x-f/2,y:o.y-h/2},N={x:Math.min(T.x,C.x),y:Math.min(T.y,C.y)},A=.5,D=Math.max(A,Math.log(u*oc)),M=Math.max(A,Math.log(f*oc));i.ctrlpts=[N.x,N.y-(1+Math.pow(w,1.12)/100)*E*(x/3+1)*D,N.x-(1+Math.pow(w,1.12)/100)*E*(x/3+1)*M,N.y]};Wr.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};Wr.findBezierPoints=function(t,e,r,a,i){var s=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,u=t.pstyle("control-point-distances"),d=t.pstyle("control-point-weights"),f=u&&d?Math.min(u.value.length,d.value.length):1,h=u?u.pfValue[0]:void 0,p=d.value[0],m=a;s.edgeType=m?"multibezier":"bezier",s.ctrlpts=[];for(var y=0;y<f;y++){var x=(.5-e.eles.length/2+r)*o*(i?-1:1),E=void 0,w=Ym(x);m&&(h=u?u.pfValue[y]:o,p=d.value[y]),a?E=h:E=h!==void 0?w*h:void 0;var T=E!==void 0?E:x,C=1-p,N=p,A=this.findMidptPtsEtc(t,e),D=A.midptPts,M=A.vectorNormInverse,j={x:D.x1*C+D.x2*N,y:D.y1*C+D.y2*N};s.ctrlpts.push(j.x+M.x*T,j.y+M.y*T)}};Wr.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",i="horizontal",s="leftward",o="rightward",u="downward",d="upward",f="auto",h=e.posPts,p=e.srcW,m=e.srcH,y=e.tgtW,x=e.tgtH,E=t.pstyle("edge-distances").value,w=E!=="node-position",T=t.pstyle("taxi-direction").value,C=T,N=t.pstyle("taxi-turn"),A=N.units==="%",D=N.pfValue,M=D<0,j=t.pstyle("taxi-turn-min-distance").pfValue,k=w?(p+y)/2:0,R=w?(m+x)/2:0,z=h.x2-h.x1,B=h.y2-h.y1,L=function($,ce){return $>0?Math.max($-ce,0):Math.min($+ce,0)},q=L(z,k),I=L(B,R),Q=!1;C===f?T=Math.abs(q)>Math.abs(I)?i:a:C===d||C===u?(T=a,Q=!0):(C===s||C===o)&&(T=i,Q=!0);var _=T===a,V=_?I:q,F=_?B:z,K=Ym(F),ee=!1;!(Q&&(A||M))&&(C===u&&F<0||C===d&&F>0||C===s&&F>0||C===o&&F<0)&&(K*=-1,V=K*Math.abs(V),ee=!0);var P;if(A){var G=D<0?1+D:D;P=G*V}else{var Z=D<0?V:0;P=Z+D*K}var J=function($){return Math.abs($)<j||Math.abs($)>=Math.abs(V)},X=J(P),Y=J(Math.abs(V)-Math.abs(P)),le=X||Y;if(le&&!ee)if(_){var me=Math.abs(F)<=m/2,oe=Math.abs(z)<=y/2;if(me){var ae=(h.x1+h.x2)/2,re=h.y1,se=h.y2;r.segpts=[ae,re,ae,se]}else if(oe){var ie=(h.y1+h.y2)/2,Ne=h.x1,Ae=h.x2;r.segpts=[Ne,ie,Ae,ie]}else r.segpts=[h.x1,h.y2]}else{var Ze=Math.abs(F)<=p/2,Qe=Math.abs(B)<=x/2;if(Ze){var Se=(h.y1+h.y2)/2,Oe=h.x1,ke=h.x2;r.segpts=[Oe,Se,ke,Se]}else if(Qe){var Pe=(h.x1+h.x2)/2,Ge=h.y1,Je=h.y2;r.segpts=[Pe,Ge,Pe,Je]}else r.segpts=[h.x2,h.y1]}else if(_){var Be=h.y1+P+(w?m/2*K:0),nt=h.x1,ye=h.x2;r.segpts=[nt,Be,ye,Be]}else{var $e=h.x1+P+(w?p/2*K:0),et=h.y1,xe=h.y2;r.segpts=[$e,et,$e,xe]}if(r.isRound){var ze=t.pstyle("taxi-radius").value,Re=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ze),r.isArcRadius=new Array(r.segpts.length/2).fill(Re)}};Wr.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,i=e.tgtPos,s=e.srcW,o=e.srcH,u=e.tgtW,d=e.tgtH,f=e.srcShape,h=e.tgtShape,p=e.srcCornerRadius,m=e.tgtCornerRadius,y=e.srcRs,x=e.tgtRs,E=!De(r.startX)||!De(r.startY),w=!De(r.arrowStartX)||!De(r.arrowStartY),T=!De(r.endX)||!De(r.endY),C=!De(r.arrowEndX)||!De(r.arrowEndY),N=3,A=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,D=N*A,M=Js({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),j=M<D,k=Js({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),R=k<D,z=!1;if(E||w||j){z=!0;var B={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},L=Math.sqrt(B.x*B.x+B.y*B.y),q={x:B.x/L,y:B.y/L},I=Math.max(s,o),Q={x:r.ctrlpts[0]+q.x*2*I,y:r.ctrlpts[1]+q.y*2*I},_=f.intersectLine(a.x,a.y,s,o,Q.x,Q.y,0,p,y);j?(r.ctrlpts[0]=r.ctrlpts[0]+q.x*(D-M),r.ctrlpts[1]=r.ctrlpts[1]+q.y*(D-M)):(r.ctrlpts[0]=_[0]+q.x*D,r.ctrlpts[1]=_[1]+q.y*D)}if(T||C||R){z=!0;var V={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},F=Math.sqrt(V.x*V.x+V.y*V.y),K={x:V.x/F,y:V.y/F},ee=Math.max(s,o),P={x:r.ctrlpts[0]+K.x*2*ee,y:r.ctrlpts[1]+K.y*2*ee},G=h.intersectLine(i.x,i.y,u,d,P.x,P.y,0,m,x);R?(r.ctrlpts[0]=r.ctrlpts[0]+K.x*(D-k),r.ctrlpts[1]=r.ctrlpts[1]+K.y*(D-k)):(r.ctrlpts[0]=G[0]+K.x*D,r.ctrlpts[1]=G[1]+K.y*D)}z&&this.findEndpoints(t)}};Wr.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,i;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,i=.5,e.midX=Or(e.allpts[a],e.allpts[a+2],e.allpts[a+4],i),e.midY=Or(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],i))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var s=2;s+3<e.allpts.length;s+=2){var o=e.radii[s/2-1],u=e.isArcRadius[s/2-1];e.roundCorners.push(ly({x:e.allpts[s-2],y:e.allpts[s-1]},{x:e.allpts[s],y:e.allpts[s+1],radius:o},{x:e.allpts[s+2],y:e.allpts[s+3]},o,u))}}if(e.segpts.length%4===0){var d=e.segpts.length/2,f=d-2;e.midX=(e.segpts[f]+e.segpts[d])/2,e.midY=(e.segpts[f+1]+e.segpts[d+1])/2}else{var h=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[h],e.midY=e.segpts[h+1];else{var p={x:e.segpts[h],y:e.segpts[h+1]},m=e.roundCorners[h/2];if(m.radius===0){var y={x:e.segpts[h+2],y:e.segpts[h+3]};e.midX=p.x,e.midY=p.y,e.midVector=[p.y-y.y,y.x-p.x]}else{var x=[p.x-m.cx,p.y-m.cy],E=m.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(w){return w*E}),e.midX=m.cx+x[0],e.midY=m.cy+x[1],e.midVector=x}}}}};Wr.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||De(e.startX)&&De(e.startY)&&De(e.endX)&&De(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,At("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};Wr.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,i=a.hasCompoundNodes(),s=new Zn,o=function(R,z){return[].concat(Pf(R),[z?1:0]).join("-")},u=[],d=[],f=0;f<t.length;f++){var h=t[f],p=h._private,m=h.pstyle("curve-style").value;if(!(h.removed()||!h.takesUpSpace())){if(m==="haystack"){d.push(h);continue}var y=m==="unbundled-bezier"||Yi(m,"segments")||m==="straight"||m==="straight-triangle"||Yi(m,"taxi"),x=m==="unbundled-bezier"||m==="bezier",E=p.source,w=p.target,T=E.poolIndex(),C=w.poolIndex(),N=[T,C].sort(),A=o(N,y),D=s.get(A);D==null&&(D={eles:[]},u.push({pairId:N,edgeIsUnbundled:y}),s.set(A,D)),D.eles.push(h),y&&(D.hasUnbundled=!0),x&&(D.hasBezier=!0)}}for(var M=function(){var R=u[j],z=R.pairId,B=R.edgeIsUnbundled,L=o(z,B),q=s.get(L),I;if(!q.hasUnbundled){var Q=q.eles[0].parallelEdges().filter(function(Re){return Re.isBundledBezier()});Qm(q.eles),Q.forEach(function(Re){return q.eles.push(Re)}),q.eles.sort(function(Re,we){return Re.poolIndex()-we.poolIndex()})}var _=q.eles[0],V=_.source(),F=_.target();if(V.poolIndex()>F.poolIndex()){var K=V;V=F,F=K}var ee=q.srcPos=V.position(),P=q.tgtPos=F.position(),G=q.srcW=V.outerWidth(),Z=q.srcH=V.outerHeight(),J=q.tgtW=F.outerWidth(),X=q.tgtH=F.outerHeight(),Y=q.srcShape=r.nodeShapes[e.getNodeShape(V)],le=q.tgtShape=r.nodeShapes[e.getNodeShape(F)],me=q.srcCornerRadius=V.pstyle("corner-radius").value==="auto"?"auto":V.pstyle("corner-radius").pfValue,oe=q.tgtCornerRadius=F.pstyle("corner-radius").value==="auto"?"auto":F.pstyle("corner-radius").pfValue,ae=q.tgtRs=F._private.rscratch,re=q.srcRs=V._private.rscratch;q.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var se=0;se<q.eles.length;se++){var ie=q.eles[se],Ne=ie[0]._private.rscratch,Ae=ie.pstyle("curve-style").value,Ze=Ae==="unbundled-bezier"||Yi(Ae,"segments")||Yi(Ae,"taxi"),Qe=!V.same(ie.source());if(!q.calculatedIntersection&&V!==F&&(q.hasBezier||q.hasUnbundled)){q.calculatedIntersection=!0;var Se=Y.intersectLine(ee.x,ee.y,G,Z,P.x,P.y,0,me,re),Oe=q.srcIntn=Se,ke=le.intersectLine(P.x,P.y,J,X,ee.x,ee.y,0,oe,ae),Pe=q.tgtIntn=ke,Ge=q.intersectionPts={x1:Se[0],x2:ke[0],y1:Se[1],y2:ke[1]},Je=q.posPts={x1:ee.x,x2:P.x,y1:ee.y,y2:P.y},Be=ke[1]-Se[1],nt=ke[0]-Se[0],ye=Math.sqrt(nt*nt+Be*Be);De(ye)&&ye>=dL||(ye=Math.sqrt(Math.max(nt*nt,oc)+Math.max(Be*Be,oc)));var $e=q.vector={x:nt,y:Be},et=q.vectorNorm={x:$e.x/ye,y:$e.y/ye},xe={x:-et.y,y:et.x};q.nodesOverlap=!De(ye)||le.checkPoint(Se[0],Se[1],0,J,X,P.x,P.y,oe,ae)||Y.checkPoint(ke[0],ke[1],0,G,Z,ee.x,ee.y,me,re),q.vectorNormInverse=xe,I={nodesOverlap:q.nodesOverlap,dirCounts:q.dirCounts,calculatedIntersection:!0,hasBezier:q.hasBezier,hasUnbundled:q.hasUnbundled,eles:q.eles,srcPos:P,srcRs:ae,tgtPos:ee,tgtRs:re,srcW:J,srcH:X,tgtW:G,tgtH:Z,srcIntn:Pe,tgtIntn:Oe,srcShape:le,tgtShape:Y,posPts:{x1:Je.x2,y1:Je.y2,x2:Je.x1,y2:Je.y1},intersectionPts:{x1:Ge.x2,y1:Ge.y2,x2:Ge.x1,y2:Ge.y1},vector:{x:-$e.x,y:-$e.y},vectorNorm:{x:-et.x,y:-et.y},vectorNormInverse:{x:-xe.x,y:-xe.y}}}var ze=Qe?I:q;Ne.nodesOverlap=ze.nodesOverlap,Ne.srcIntn=ze.srcIntn,Ne.tgtIntn=ze.tgtIntn,Ne.isRound=Ae.startsWith("round"),i&&(V.isParent()||V.isChild()||F.isParent()||F.isChild())&&(V.parents().anySame(F)||F.parents().anySame(V)||V.same(F)&&V.isParent())?e.findCompoundLoopPoints(ie,ze,se,Ze):V===F?e.findLoopPoints(ie,ze,se,Ze):Ae.endsWith("segments")?e.findSegmentsPoints(ie,ze):Ae.endsWith("taxi")?e.findTaxiPoints(ie,ze):Ae==="straight"||!Ze&&q.eles.length%2===1&&se===Math.floor(q.eles.length/2)?e.findStraightEdgePoints(ie):e.findBezierPoints(ie,ze,se,Ze,Qe),e.findEndpoints(ie),e.tryToCorrectInvalidPoints(ie,ze),e.checkForInvalidEdgeWarning(ie),e.storeAllpts(ie),e.storeEdgeProjections(ie),e.calculateArrowAngles(ie),e.recalculateEdgeLabelProjections(ie),e.calculateLabelAngles(ie)}},j=0;j<u.length;j++)M();this.findHaystackPoints(d)}};function gN(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],i=t[r+1];e.push({x:a,y:i})}return e}}Wr.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return gN(e.segpts)};Wr.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return gN(e.ctrlpts)};Wr.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Oc={};Oc.manualEndptToPx=function(t,e){var r=this,a=t.position(),i=t.outerWidth(),s=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var u=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(u[0]=u[0]*i),e.units[1]==="%"&&(u[1]=u[1]*s),u[0]+=a.x,u[1]+=a.y,u}else{var d=e.pfValue[0];d=-Math.PI/2+d;var f=2*Math.max(i,s),h=[a.x+Math.cos(d)*f,a.y+Math.sin(d)*f];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,i,s,h[0],h[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};Oc.findEndpoints=function(t){var e,r,a,i,s=this,o,u=t.source()[0],d=t.target()[0],f=u.position(),h=d.position(),p=t.pstyle("target-arrow-shape").value,m=t.pstyle("source-arrow-shape").value,y=t.pstyle("target-distance-from-node").pfValue,x=t.pstyle("source-distance-from-node").pfValue,E=u._private.rscratch,w=d._private.rscratch,T=t.pstyle("curve-style").value,C=t._private.rscratch,N=C.edgeType,A=Yi(T,"taxi"),D=N==="self"||N==="compound",M=N==="bezier"||N==="multibezier"||D,j=N!=="bezier",k=N==="straight"||N==="segments",R=N==="segments",z=M||j||k,B=D||A,L=t.pstyle("source-endpoint"),q=B?"outside-to-node":L.value,I=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue,Q=t.pstyle("target-endpoint"),_=B?"outside-to-node":Q.value,V=d.pstyle("corner-radius").value==="auto"?"auto":d.pstyle("corner-radius").pfValue;C.srcManEndpt=L,C.tgtManEndpt=Q;var F,K,ee,P,G=(e=(Q==null||(r=Q.pfValue)===null||r===void 0?void 0:r.length)===2?Q.pfValue:null)!==null&&e!==void 0?e:[0,0],Z=(a=(L==null||(i=L.pfValue)===null||i===void 0?void 0:i.length)===2?L.pfValue:null)!==null&&a!==void 0?a:[0,0];if(M){var J=[C.ctrlpts[0],C.ctrlpts[1]],X=j?[C.ctrlpts[C.ctrlpts.length-2],C.ctrlpts[C.ctrlpts.length-1]]:J;F=X,K=J}else if(k){var Y=R?C.segpts.slice(0,2):[h.x+G[0],h.y+G[1]],le=R?C.segpts.slice(C.segpts.length-2):[f.x+Z[0],f.y+Z[1]];F=le,K=Y}if(_==="inside-to-node")o=[h.x,h.y];else if(Q.units)o=this.manualEndptToPx(d,Q);else if(_==="outside-to-line")o=C.tgtIntn;else if(_==="outside-to-node"||_==="outside-to-node-or-label"?ee=F:(_==="outside-to-line"||_==="outside-to-line-or-label")&&(ee=[f.x,f.y]),o=s.nodeShapes[this.getNodeShape(d)].intersectLine(h.x,h.y,d.outerWidth(),d.outerHeight(),ee[0],ee[1],0,V,w),_==="outside-to-node-or-label"||_==="outside-to-line-or-label"){var me=d._private.rscratch,oe=me.labelWidth,ae=me.labelHeight,re=me.labelX,se=me.labelY,ie=oe/2,Ne=ae/2,Ae=d.pstyle("text-valign").value;Ae==="top"?se-=Ne:Ae==="bottom"&&(se+=Ne);var Ze=d.pstyle("text-halign").value;Ze==="left"?re-=ie:Ze==="right"&&(re+=ie);var Qe=ac(ee[0],ee[1],[re-ie,se-Ne,re+ie,se-Ne,re+ie,se+Ne,re-ie,se+Ne],h.x,h.y);if(Qe.length>0){var Se=f,Oe=Bs(Se,ro(o)),ke=Bs(Se,ro(Qe)),Pe=Oe;if(ke<Oe&&(o=Qe,Pe=ke),Qe.length>2){var Ge=Bs(Se,{x:Qe[2],y:Qe[3]});Ge<Pe&&(o=[Qe[2],Qe[3]])}}}var Je=af(o,F,s.arrowShapes[p].spacing(t)+y),Be=af(o,F,s.arrowShapes[p].gap(t)+y);if(C.endX=Be[0],C.endY=Be[1],C.arrowEndX=Je[0],C.arrowEndY=Je[1],q==="inside-to-node")o=[f.x,f.y];else if(L.units)o=this.manualEndptToPx(u,L);else if(q==="outside-to-line")o=C.srcIntn;else if(q==="outside-to-node"||q==="outside-to-node-or-label"?P=K:(q==="outside-to-line"||q==="outside-to-line-or-label")&&(P=[h.x,h.y]),o=s.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),P[0],P[1],0,I,E),q==="outside-to-node-or-label"||q==="outside-to-line-or-label"){var nt=u._private.rscratch,ye=nt.labelWidth,$e=nt.labelHeight,et=nt.labelX,xe=nt.labelY,ze=ye/2,Re=$e/2,we=u.pstyle("text-valign").value;we==="top"?xe-=Re:we==="bottom"&&(xe+=Re);var $=u.pstyle("text-halign").value;$==="left"?et-=ze:$==="right"&&(et+=ze);var ce=ac(P[0],P[1],[et-ze,xe-Re,et+ze,xe-Re,et+ze,xe+Re,et-ze,xe+Re],f.x,f.y);if(ce.length>0){var pe=h,ve=Bs(pe,ro(o)),Ee=Bs(pe,ro(ce)),Ue=ve;if(Ee<ve&&(o=[ce[0],ce[1]],Ue=Ee),ce.length>2){var je=Bs(pe,{x:ce[2],y:ce[3]});je<Ue&&(o=[ce[2],ce[3]])}}}var He=af(o,K,s.arrowShapes[m].spacing(t)+x),_e=af(o,K,s.arrowShapes[m].gap(t)+x);C.startX=_e[0],C.startY=_e[1],C.arrowStartX=He[0],C.arrowStartY=He[1],z&&(!De(C.startX)||!De(C.startY)||!De(C.endX)||!De(C.endY)?C.badLine=!0:C.badLine=!1)};Oc.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Oc.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var oy={};function fL(t,e,r){for(var a=function(f,h,p,m){return Or(f,h,p,m)},i=e._private,s=i.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var u=t.bezierProjPcts[o];s.push({x:a(r[0],r[2],r[4],u),y:a(r[1],r[3],r[5],u)})}}oy.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var i=0;i+5<r.allpts.length;i+=4)fL(this,t,r.allpts.slice(i,i+6))}else if(a==="segments")for(var s=e.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)s.push({x:r.allpts[i],y:r.allpts[i+1]});else if(a==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};oy.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Cn={};Cn.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!rs(e)){var r,a,i=t._private,s=t.width(),o=t.height(),u=t.padding(),d=t.position(),f=t.pstyle("text-halign").strValue,h=t.pstyle("text-valign").strValue,p=i.rscratch,m=i.rstyle;switch(f){case"left":r=d.x-s/2-u;break;case"right":r=d.x+s/2+u;break;default:r=d.x}switch(h){case"top":a=d.y-o/2-u;break;case"bottom":a=d.y+o/2+u;break;default:a=d.y}p.labelX=r,p.labelY=a,m.labelX=r,m.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var mN=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},yN=function(e,r){var a=r.x-e.x,i=r.y-e.y;return mN(a,i)},hL=function(e,r,a,i){var s=rc(0,i-.001,1),o=rc(0,i+.001,1),u=lo(e,r,a,s),d=lo(e,r,a,o);return yN(u,d)};Cn.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,i=this,s={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(s.mid||s.source||s.target){e={x:a.midX,y:a.midY};var o=function(p,m,y){Qn(r.rscratch,p,m,y),Qn(r.rstyle,p,m,y)};o("labelX",null,e.x),o("labelY",null,e.y);var u=mN(a.midDispX,a.midDispY);o("labelAutoAngle",null,u);var d=function(){if(d.cache)return d.cache;for(var p=[],m=0;m+5<a.allpts.length;m+=4){var y={x:a.allpts[m],y:a.allpts[m+1]},x={x:a.allpts[m+2],y:a.allpts[m+3]},E={x:a.allpts[m+4],y:a.allpts[m+5]};p.push({p0:y,p1:x,p2:E,startDist:0,length:0,segments:[]})}var w=r.rstyle.bezierPts,T=i.bezierProjPcts.length;function C(j,k,R,z,B){var L=Js(k,R),q=j.segments[j.segments.length-1],I={p0:k,p1:R,t0:z,t1:B,startDist:q?q.startDist+q.length:0,length:L};j.segments.push(I),j.length+=L}for(var N=0;N<p.length;N++){var A=p[N],D=p[N-1];D&&(A.startDist=D.startDist+D.length),C(A,A.p0,w[N*T],0,i.bezierProjPcts[0]);for(var M=0;M<T-1;M++)C(A,w[N*T+M],w[N*T+M+1],i.bezierProjPcts[M],i.bezierProjPcts[M+1]);C(A,w[N*T+T-1],A.p2,i.bezierProjPcts[T-1],1)}return d.cache=p},f=function(p){var m,y=p==="source";if(s[p]){var x=t.pstyle(p+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var E=d(),w,T=0,C=0,N=0;N<E.length;N++){for(var A=E[y?N:E.length-1-N],D=0;D<A.segments.length;D++){var M=A.segments[y?D:A.segments.length-1-D],j=N===E.length-1&&D===A.segments.length-1;if(T=C,C+=M.length,C>=x||j){w={cp:A,segment:M};break}}if(w)break}var k=w.cp,R=w.segment,z=(x-T)/R.length,B=R.t1-R.t0,L=y?R.t0+B*z:R.t1-B*z;L=rc(0,L,1),e=lo(k.p0,k.p1,k.p2,L),m=hL(k.p0,k.p1,k.p2,L);break}case"straight":case"segments":case"haystack":{for(var q=0,I,Q,_,V,F=a.allpts.length,K=0;K+3<F&&(y?(_={x:a.allpts[K],y:a.allpts[K+1]},V={x:a.allpts[K+2],y:a.allpts[K+3]}):(_={x:a.allpts[F-2-K],y:a.allpts[F-1-K]},V={x:a.allpts[F-4-K],y:a.allpts[F-3-K]}),I=Js(_,V),Q=q,q+=I,!(q>=x));K+=2);var ee=x-Q,P=ee/I;P=rc(0,P,1),e=LO(_,V,P),m=yN(_,V);break}}o("labelX",p,e.x),o("labelY",p,e.y),o("labelAutoAngle",p,m)}};f("source"),f("target"),this.applyLabelDimensions(t)}};Cn.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Cn.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),i=Ws(a,t._private.labelDimsKey);if(ga(r.rscratch,"prefixedLabelDimsKey",e)!==i){Qn(r.rscratch,"prefixedLabelDimsKey",e,i);var s=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,u=t.pstyle("text-wrap").strValue,d=ga(r.rscratch,"labelWrapCachedLines",e)||[],f=u!=="wrap"?1:Math.max(d.length,1),h=s.height/f,p=h*o,m=s.width,y=s.height+(f-1)*(o-1)*h;Qn(r.rstyle,"labelWidth",e,m),Qn(r.rscratch,"labelWidth",e,m),Qn(r.rstyle,"labelHeight",e,y),Qn(r.rscratch,"labelHeight",e,y),Qn(r.rscratch,"labelLineHeight",e,p)}};Cn.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",i=t.pstyle(a+"label").strValue,s=t.pstyle("text-transform").value,o=function(Z,J){return J?(Qn(r.rscratch,Z,e,J),J):ga(r.rscratch,Z,e)};if(!i)return"";s=="none"||(s=="uppercase"?i=i.toUpperCase():s=="lowercase"&&(i=i.toLowerCase()));var u=t.pstyle("text-wrap").value;if(u==="wrap"){var d=o("labelKey");if(d!=null&&o("labelWrapKey")===d)return o("labelWrapCachedText");for(var f="​",h=i.split(`
93
- `),p=t.pstyle("text-max-width").pfValue,m=t.pstyle("text-overflow-wrap").value,y=m==="anywhere",x=[],E=/[\s\u200b]+|$/g,w=0;w<h.length;w++){var T=h[w],C=this.calculateLabelDimensions(t,T),N=C.width;if(y){var A=T.split("").join(f);T=A}if(N>p){var D=T.matchAll(E),M="",j=0,k=xa(D),R;try{for(k.s();!(R=k.n()).done;){var z=R.value,B=z[0],L=T.substring(j,z.index);j=z.index+B.length;var q=M.length===0?L:M+L+B,I=this.calculateLabelDimensions(t,q),Q=I.width;Q<=p?M+=L+B:(M&&x.push(M),M=L+B)}}catch(G){k.e(G)}finally{k.f()}M.match(/^[\s\u200b]+$/)||x.push(M)}else x.push(T)}o("labelWrapCachedLines",x),i=o("labelWrapCachedText",x.join(`
94
- `)),o("labelWrapKey",d)}else if(u==="ellipsis"){var _=t.pstyle("text-max-width").pfValue,V="",F="…",K=!1;if(this.calculateLabelDimensions(t,i).width<_)return i;for(var ee=0;ee<i.length;ee++){var P=this.calculateLabelDimensions(t,V+i[ee]+F).width;if(P>_)break;V+=i[ee],ee===i.length-1&&(K=!0)}return K||(V+=F),V}return i};Cn.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Cn.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),i=a.document,s=0,o=t.pstyle("font-style").strValue,u=t.pstyle("font-size").pfValue,d=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,p=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=i.createElement("canvas"),p=this.labelCalcCanvasContext=h.getContext("2d");var m=h.style;m.position="absolute",m.left="-9999px",m.top="-9999px",m.zIndex="-1",m.visibility="hidden",m.pointerEvents="none"}p.font="".concat(o," ").concat(f," ").concat(u,"px ").concat(d);for(var y=0,x=0,E=e.split(`
95
- `),w=0;w<E.length;w++){var T=E[w],C=p.measureText(T),N=Math.ceil(C.width),A=u;y=Math.max(N,y),x+=A}return y+=s,x+=s,{width:y,height:x}};Cn.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,i=t.isEdge(),s=e?e+"-":"",o=t.pstyle(s+"text-rotation"),u=o.strValue;return u==="none"?0:i&&u==="autorotate"?a.labelAutoAngle:u==="autorotate"?0:o.pfValue};Cn.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,i=a.rscratch;i.labelAngle=e.calculateLabelAngle(t),r&&(i.sourceLabelAngle=e.calculateLabelAngle(t,"source"),i.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var xN={},eE=28,tE=!1;xN.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<eE||t.height()<eE))return tE||(At("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),tE=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var bh={};bh.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),u)for(var d=0;d<o.length;d++){var f=o[d],h=f._private,p=h.rstyle;p.clean=!1,p.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var u=o.target;a(u)}).on("style.* background.*",function(o){var u=o.target;a(u,!1)});var i=function(o){if(o){var u=r.onUpdateEleCalcsFns;e.cleanStyle();for(var d=0;d<e.length;d++){var f=e[d],h=f._private.rstyle;f.isNode()&&!h.cleanConnected&&(a(f.connectedEdges()),h.cleanConnected=!0)}if(u)for(var p=0;p<u.length;p++){var m=u[p];m(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};bh.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};bh.recalculateRenderedStyle=function(t,e){var r=function(A){return A._private.rstyle.cleanConnected};if(t.length!==0){var a=[],i=[];if(!this.destroyed){e===void 0&&(e=!0);for(var s=0;s<t.length;s++){var o=t[s],u=o._private,d=u.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(d.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(N){return!N._private.rstyle.clean&&N.isBundledBezier()})&&(d.clean=!1),!(e&&d.clean||o.removed())&&o.pstyle("display").value!=="none"&&(u.group==="nodes"?i.push(o):a.push(o),d.clean=!0)}for(var f=0;f<i.length;f++){var h=i[f],p=h._private,m=p.rstyle,y=h.position();this.recalculateNodeLabelProjection(h),m.nodeX=y.x,m.nodeY=y.y,m.nodeW=h.pstyle("width").pfValue,m.nodeH=h.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var x=0;x<a.length;x++){var E=a[x],w=E._private,T=w.rstyle,C=w.rscratch;T.srcX=C.arrowStartX,T.srcY=C.arrowStartY,T.tgtX=C.arrowEndX,T.tgtY=C.arrowEndY,T.midX=C.midX,T.midY=C.midY,T.labelAngle=C.labelAngle,T.sourceLabelAngle=C.sourceLabelAngle,T.targetLabelAngle=C.targetLabelAngle}}}};var wh={};wh.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],i=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):i.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};wh.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};wh.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(eN),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var bN={};[ul,Qf,Wr,Oc,oy,Cn,xN,bh,wh].forEach(function(t){tt(bN,t)});var wN={};wN.getCachedImage=function(t,e,r){var a=this,i=a.imageCache=a.imageCache||{},s=i[t];if(s)return s.image.complete||s.image.addEventListener("load",r),s.image;s=i[t]=i[t]||{};var o=s.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var u="data:",d=t.substring(0,u.length).toLowerCase()===u;return d||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var _o={};_o.registerBinding=function(t,e,r,a){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var s=[],o=0;o<t.length;o++){var u=t[o];if(u!==void 0){var d=this.binder(u);s.push(d.on.apply(d,i))}}return s}var d=this.binder(t);return d.on.apply(d,i)};_o.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||CD(t);if(e.supportsPassiveEvents==null){var i=!1;try{var s=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,s)}catch{}e.supportsPassiveEvents=i}var o=function(d,f,h){var p=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(p[2]={capture:h??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:p}),(t.addEventListener||t.on).apply(t,p),this};return{on:o,addEventListener:o,addListener:o,bind:o}};_o.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};_o.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};_o.load=function(){var t=this,e=t.cy.window(),r=function($){return $.selected()},a=function($){var ce=$.getRootNode();if(ce&&ce.nodeType===11&&ce.host!==void 0)return ce},i=function($,ce,pe,ve){$==null&&($=t.cy);for(var Ee=0;Ee<ce.length;Ee++){var Ue=ce[Ee];$.emit({originalEvent:pe,type:Ue,position:ve})}},s=function($){return $.shiftKey||$.metaKey||$.ctrlKey},o=function($,ce){var pe=!0;if(t.cy.hasCompoundNodes()&&$&&$.pannable())for(var ve=0;ce&&ve<ce.length;ve++){var $=ce[ve];if($.isNode()&&$.isParent()&&!$.pannable()){pe=!1;break}}else pe=!0;return pe},u=function($){$[0]._private.grabbed=!0},d=function($){$[0]._private.grabbed=!1},f=function($){$[0]._private.rscratch.inDragLayer=!0},h=function($){$[0]._private.rscratch.inDragLayer=!1},p=function($){$[0]._private.rscratch.isGrabTarget=!0},m=function($){$[0]._private.rscratch.isGrabTarget=!1},y=function($,ce){var pe=ce.addToList,ve=pe.has($);!ve&&$.grabbable()&&!$.locked()&&(pe.merge($),u($))},x=function($,ce){if($.cy().hasCompoundNodes()&&!(ce.inDragLayer==null&&ce.addToList==null)){var pe=$.descendants();ce.inDragLayer&&(pe.forEach(f),pe.connectedEdges().forEach(f)),ce.addToList&&y(pe,ce)}},E=function($,ce){ce=ce||{};var pe=$.cy().hasCompoundNodes();ce.inDragLayer&&($.forEach(f),$.neighborhood().stdFilter(function(ve){return!pe||ve.isEdge()}).forEach(f)),ce.addToList&&$.forEach(function(ve){y(ve,ce)}),x($,ce),C($,{inDragLayer:ce.inDragLayer}),t.updateCachedGrabbedEles()},w=E,T=function($){$&&(t.getCachedZSortedEles().forEach(function(ce){d(ce),h(ce),m(ce)}),t.updateCachedGrabbedEles())},C=function($,ce){if(!(ce.inDragLayer==null&&ce.addToList==null)&&$.cy().hasCompoundNodes()){var pe=$.ancestors().orphans();if(!pe.same($)){var ve=pe.descendants().spawnSelf().merge(pe).unmerge($).unmerge($.descendants()),Ee=ve.connectedEdges();ce.inDragLayer&&(Ee.forEach(f),ve.forEach(f)),ce.addToList&&ve.forEach(function(Ue){y(Ue,ce)})}}},N=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},A=typeof MutationObserver<"u",D=typeof ResizeObserver<"u";A?(t.removeObserver=new MutationObserver(function(we){for(var $=0;$<we.length;$++){var ce=we[$],pe=ce.removedNodes;if(pe)for(var ve=0;ve<pe.length;ve++){var Ee=pe[ve];if(Ee===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(we){t.destroy()});var M=Ac(function(){t.cy.resize()},100);A&&(t.styleObserver=new MutationObserver(M),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",M),D&&(t.resizeObserver=new ResizeObserver(M),t.resizeObserver.observe(t.container));var j=function($,ce){for(;$!=null;)ce($),$=$.parentNode},k=function(){t.invalidateContainerClientCoordsCache()};j(t.container,function(we){t.registerBinding(we,"transitionend",k),t.registerBinding(we,"animationend",k),t.registerBinding(we,"scroll",k)}),t.registerBinding(t.container,"contextmenu",function(we){we.preventDefault()});var R=function(){return t.selection[4]!==0},z=function($){for(var ce=t.findContainerClientCoords(),pe=ce[0],ve=ce[1],Ee=ce[2],Ue=ce[3],je=$.touches?$.touches:[$],He=!1,_e=0;_e<je.length;_e++){var Ke=je[_e];if(pe<=Ke.clientX&&Ke.clientX<=pe+Ee&&ve<=Ke.clientY&&Ke.clientY<=ve+Ue){He=!0;break}}if(!He)return!1;for(var it=t.container,st=$.target,Ve=st.parentNode,dt=!1;Ve;){if(Ve===it){dt=!0;break}Ve=Ve.parentNode}return!!dt};t.registerBinding(t.container,"mousedown",function($){if(z($)&&!(t.hoverData.which===1&&$.which!==1)){$.preventDefault(),N(),t.hoverData.capture=!0,t.hoverData.which=$.which;var ce=t.cy,pe=[$.clientX,$.clientY],ve=t.projectIntoViewport(pe[0],pe[1]),Ee=t.selection,Ue=t.findNearestElements(ve[0],ve[1],!0,!1),je=Ue[0],He=t.dragData.possibleDragElements;t.hoverData.mdownPos=ve,t.hoverData.mdownGPos=pe;var _e=function(ut){return{originalEvent:$,type:ut,position:{x:ve[0],y:ve[1]}}},Ke=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var ut=t.hoverData.down;ut?ut.emit(_e("taphold")):ce.emit(_e("taphold"))}},t.tapholdDuration)};if($.which==3){t.hoverData.cxtStarted=!0;var it={originalEvent:$,type:"cxttapstart",position:{x:ve[0],y:ve[1]}};je?(je.activate(),je.emit(it),t.hoverData.down=je):ce.emit(it),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if($.which==1){je&&je.activate();{if(je!=null&&t.nodeIsGrabbable(je)){var st=function(ut){ut.emit(_e("grab"))};if(p(je),!je.selected())He=t.dragData.possibleDragElements=ce.collection(),w(je,{addToList:He}),je.emit(_e("grabon")).emit(_e("grab"));else{He=t.dragData.possibleDragElements=ce.collection();var Ve=ce.$(function(dt){return dt.isNode()&&dt.selected()&&t.nodeIsGrabbable(dt)});E(Ve,{addToList:He}),je.emit(_e("grabon")),Ve.forEach(st)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=je,t.hoverData.downs=Ue,t.hoverData.downTime=new Date().getTime()}i(je,["mousedown","tapstart","vmousedown"],$,{x:ve[0],y:ve[1]}),je==null?(Ee[4]=1,t.data.bgActivePosistion={x:ve[0],y:ve[1]},t.redrawHint("select",!0),t.redraw()):je.pannable()&&(Ee[4]=1),Ke()}Ee[0]=Ee[2]=ve[0],Ee[1]=Ee[3]=ve[1]}},!1);var B=a(t.container);t.registerBinding([e,B],"mousemove",function($){var ce=t.hoverData.capture;if(!(!ce&&!z($))){var pe=!1,ve=t.cy,Ee=ve.zoom(),Ue=[$.clientX,$.clientY],je=t.projectIntoViewport(Ue[0],Ue[1]),He=t.hoverData.mdownPos,_e=t.hoverData.mdownGPos,Ke=t.selection,it=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(it=t.findNearestElement(je[0],je[1],!0,!1));var st=t.hoverData.last,Ve=t.hoverData.down,dt=[je[0]-Ke[2],je[1]-Ke[3]],ut=t.dragData.possibleDragElements,Yt;if(_e){var Ot=Ue[0]-_e[0],Lr=Ot*Ot,Kt=Ue[1]-_e[1],sr=Kt*Kt,Jt=Lr+sr;t.hoverData.isOverThresholdDrag=Yt=Jt>=t.desktopTapThreshold2}var lr=s($);Yt&&(t.hoverData.tapholdCancelled=!0);var Ra=function(){var Ar=t.hoverData.dragDelta=t.hoverData.dragDelta||[];Ar.length===0?(Ar.push(dt[0]),Ar.push(dt[1])):(Ar[0]+=dt[0],Ar[1]+=dt[1])};pe=!0,i(it,["mousemove","vmousemove","tapdrag"],$,{x:je[0],y:je[1]});var Xt=function(Ar){return{originalEvent:$,type:Ar,position:{x:je[0],y:je[1]}}},Ba=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||ve.emit(Xt("boxstart")),Ke[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Yt){var Cr=Xt("cxtdrag");Ve?Ve.emit(Cr):ve.emit(Cr),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||it!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(Xt("cxtdragout")),t.hoverData.cxtOver=it,it&&it.emit(Xt("cxtdragover")))}}else if(t.hoverData.dragging){if(pe=!0,ve.panningEnabled()&&ve.userPanningEnabled()){var Ht;if(t.hoverData.justStartedPan){var xr=t.hoverData.mdownPos;Ht={x:(je[0]-xr[0])*Ee,y:(je[1]-xr[1])*Ee},t.hoverData.justStartedPan=!1}else Ht={x:dt[0]*Ee,y:dt[1]*Ee};ve.panBy(Ht),ve.emit(Xt("dragpan")),t.hoverData.dragged=!0}je=t.projectIntoViewport($.clientX,$.clientY)}else if(Ke[4]==1&&(Ve==null||Ve.pannable())){if(Yt){if(!t.hoverData.dragging&&ve.boxSelectionEnabled()&&(lr||!ve.panningEnabled()||!ve.userPanningEnabled()))Ba();else if(!t.hoverData.selecting&&ve.panningEnabled()&&ve.userPanningEnabled()){var sa=o(Ve,t.hoverData.downs);sa&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Ke[4]=0,t.data.bgActivePosistion=ro(He),t.redrawHint("select",!0),t.redraw())}Ve&&Ve.pannable()&&Ve.active()&&Ve.unactivate()}}else{if(Ve&&Ve.pannable()&&Ve.active()&&Ve.unactivate(),(!Ve||!Ve.grabbed())&&it!=st&&(st&&i(st,["mouseout","tapdragout"],$,{x:je[0],y:je[1]}),it&&i(it,["mouseover","tapdragover"],$,{x:je[0],y:je[1]}),t.hoverData.last=it),Ve)if(Yt){if(ve.boxSelectionEnabled()&&lr)Ve&&Ve.grabbed()&&(T(ut),Ve.emit(Xt("freeon")),ut.emit(Xt("free")),t.dragData.didDrag&&(Ve.emit(Xt("dragfreeon")),ut.emit(Xt("dragfree")))),Ba();else if(Ve&&Ve.grabbed()&&t.nodeIsDraggable(Ve)){var Nr=!t.dragData.didDrag;Nr&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||E(ut,{inDragLayer:!0});var jr={x:0,y:0};if(De(dt[0])&&De(dt[1])&&(jr.x+=dt[0],jr.y+=dt[1],Nr)){var Gr=t.hoverData.dragDelta;Gr&&De(Gr[0])&&De(Gr[1])&&(jr.x+=Gr[0],jr.y+=Gr[1])}t.hoverData.draggingEles=!0,ut.silentShift(jr).emit(Xt("position")).emit(Xt("drag")),t.redrawHint("drag",!0),t.redraw()}}else Ra();pe=!0}if(Ke[2]=je[0],Ke[3]=je[1],pe)return $.stopPropagation&&$.stopPropagation(),$.preventDefault&&$.preventDefault(),!1}},!1);var L,q,I;t.registerBinding(e,"mouseup",function($){if(!(t.hoverData.which===1&&$.which!==1&&t.hoverData.capture)){var ce=t.hoverData.capture;if(ce){t.hoverData.capture=!1;var pe=t.cy,ve=t.projectIntoViewport($.clientX,$.clientY),Ee=t.selection,Ue=t.findNearestElement(ve[0],ve[1],!0,!1),je=t.dragData.possibleDragElements,He=t.hoverData.down,_e=s($);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,He&&He.unactivate();var Ke=function(Ot){return{originalEvent:$,type:Ot,position:{x:ve[0],y:ve[1]}}};if(t.hoverData.which===3){var it=Ke("cxttapend");if(He?He.emit(it):pe.emit(it),!t.hoverData.cxtDragged){var st=Ke("cxttap");He?He.emit(st):pe.emit(st)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(Ue,["mouseup","tapend","vmouseup"],$,{x:ve[0],y:ve[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(He,["click","tap","vclick"],$,{x:ve[0],y:ve[1]}),q=!1,$.timeStamp-I<=pe.multiClickDebounceTime()?(L&&clearTimeout(L),q=!0,I=null,i(He,["dblclick","dbltap","vdblclick"],$,{x:ve[0],y:ve[1]})):(L=setTimeout(function(){q||i(He,["oneclick","onetap","voneclick"],$,{x:ve[0],y:ve[1]})},pe.multiClickDebounceTime()),I=$.timeStamp)),He==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!s($)&&(pe.$(r).unselect(["tapunselect"]),je.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=je=pe.collection()),Ue==He&&!t.dragData.didDrag&&!t.hoverData.selecting&&Ue!=null&&Ue._private.selectable&&(t.hoverData.dragging||(pe.selectionType()==="additive"||_e?Ue.selected()?Ue.unselect(["tapunselect"]):Ue.select(["tapselect"]):_e||(pe.$(r).unmerge(Ue).unselect(["tapunselect"]),Ue.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ve=pe.collection(t.getAllInBox(Ee[0],Ee[1],Ee[2],Ee[3]));t.redrawHint("select",!0),Ve.length>0&&t.redrawHint("eles",!0),pe.emit(Ke("boxend"));var dt=function(Ot){return Ot.selectable()&&!Ot.selected()};pe.selectionType()==="additive"||_e||pe.$(r).unmerge(Ve).unselect(),Ve.emit(Ke("box")).stdFilter(dt).select().emit(Ke("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!Ee[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var ut=He&&He.grabbed();T(je),ut&&(He.emit(Ke("freeon")),je.emit(Ke("free")),t.dragData.didDrag&&(He.emit(Ke("dragfreeon")),je.emit(Ke("dragfree"))))}}Ee[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var Q=[],_=4,V,F=1e5,K=function($,ce){for(var pe=0;pe<$.length;pe++)if($[pe]%ce!==0)return!1;return!0},ee=function($){for(var ce=Math.abs($[0]),pe=1;pe<$.length;pe++)if(Math.abs($[pe])!==ce)return!1;return!0},P=function($){var ce=!1,pe=$.deltaY;if(pe==null&&($.wheelDeltaY!=null?pe=$.wheelDeltaY/4:$.wheelDelta!=null&&(pe=$.wheelDelta/4)),pe!==0){if(V==null)if(Q.length>=_){var ve=Q;if(V=K(ve,5),!V){var Ee=Math.abs(ve[0]);V=ee(ve)&&Ee>5}if(V)for(var Ue=0;Ue<ve.length;Ue++)F=Math.min(Math.abs(ve[Ue]),F)}else Q.push(pe),ce=!0;else V&&(F=Math.min(Math.abs(pe),F));if(!t.scrollingPage){var je=t.cy,He=je.zoom(),_e=je.pan(),Ke=t.projectIntoViewport($.clientX,$.clientY),it=[Ke[0]*He+_e.x,Ke[1]*He+_e.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||R()){$.preventDefault();return}if(je.panningEnabled()&&je.userPanningEnabled()&&je.zoomingEnabled()&&je.userZoomingEnabled()){$.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var st;ce&&Math.abs(pe)>5&&(pe=Ym(pe)*5),st=pe/-250,V&&(st/=F,st*=3),st=st*t.wheelSensitivity;var Ve=$.deltaMode===1;Ve&&(st*=33);var dt=je.zoom()*Math.pow(10,st);$.type==="gesturechange"&&(dt=t.gestureStartZoom*$.scale),je.zoom({level:dt,renderedPosition:{x:it[0],y:it[1]}}),je.emit({type:$.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:$,position:{x:Ke[0],y:Ke[1]}})}}}};t.registerBinding(t.container,"wheel",P,!0),t.registerBinding(e,"scroll",function($){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function($){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||$.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(we){t.hasTouchStarted||P(we)},!0),t.registerBinding(t.container,"mouseout",function($){var ce=t.projectIntoViewport($.clientX,$.clientY);t.cy.emit({originalEvent:$,type:"mouseout",position:{x:ce[0],y:ce[1]}})},!1),t.registerBinding(t.container,"mouseover",function($){var ce=t.projectIntoViewport($.clientX,$.clientY);t.cy.emit({originalEvent:$,type:"mouseover",position:{x:ce[0],y:ce[1]}})},!1);var G,Z,J,X,Y,le,me,oe,ae,re,se,ie,Ne,Ae=function($,ce,pe,ve){return Math.sqrt((pe-$)*(pe-$)+(ve-ce)*(ve-ce))},Ze=function($,ce,pe,ve){return(pe-$)*(pe-$)+(ve-ce)*(ve-ce)},Qe;t.registerBinding(t.container,"touchstart",Qe=function($){if(t.hasTouchStarted=!0,!!z($)){N(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var ce=t.cy,pe=t.touchData.now,ve=t.touchData.earlier;if($.touches[0]){var Ee=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);pe[0]=Ee[0],pe[1]=Ee[1]}if($.touches[1]){var Ee=t.projectIntoViewport($.touches[1].clientX,$.touches[1].clientY);pe[2]=Ee[0],pe[3]=Ee[1]}if($.touches[2]){var Ee=t.projectIntoViewport($.touches[2].clientX,$.touches[2].clientY);pe[4]=Ee[0],pe[5]=Ee[1]}var Ue=function(lr){return{originalEvent:$,type:lr,position:{x:pe[0],y:pe[1]}}};if($.touches[1]){t.touchData.singleTouchMoved=!0,T(t.dragData.touchDragEles);var je=t.findContainerClientCoords();ae=je[0],re=je[1],se=je[2],ie=je[3],G=$.touches[0].clientX-ae,Z=$.touches[0].clientY-re,J=$.touches[1].clientX-ae,X=$.touches[1].clientY-re,Ne=0<=G&&G<=se&&0<=J&&J<=se&&0<=Z&&Z<=ie&&0<=X&&X<=ie;var He=ce.pan(),_e=ce.zoom();Y=Ae(G,Z,J,X),le=Ze(G,Z,J,X),me=[(G+J)/2,(Z+X)/2],oe=[(me[0]-He.x)/_e,(me[1]-He.y)/_e];var Ke=200,it=Ke*Ke;if(le<it&&!$.touches[2]){var st=t.findNearestElement(pe[0],pe[1],!0,!0),Ve=t.findNearestElement(pe[2],pe[3],!0,!0);st&&st.isNode()?(st.activate().emit(Ue("cxttapstart")),t.touchData.start=st):Ve&&Ve.isNode()?(Ve.activate().emit(Ue("cxttapstart")),t.touchData.start=Ve):ce.emit(Ue("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if($.touches[2])ce.boxSelectionEnabled()&&$.preventDefault();else if(!$.touches[1]){if($.touches[0]){var dt=t.findNearestElements(pe[0],pe[1],!0,!0),ut=dt[0];if(ut!=null&&(ut.activate(),t.touchData.start=ut,t.touchData.starts=dt,t.nodeIsGrabbable(ut))){var Yt=t.dragData.touchDragEles=ce.collection(),Ot=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),ut.selected()?(Ot=ce.$(function(Jt){return Jt.selected()&&t.nodeIsGrabbable(Jt)}),E(Ot,{addToList:Yt})):w(ut,{addToList:Yt}),p(ut),ut.emit(Ue("grabon")),Ot?Ot.forEach(function(Jt){Jt.emit(Ue("grab"))}):ut.emit(Ue("grab"))}i(ut,["touchstart","tapstart","vmousedown"],$,{x:pe[0],y:pe[1]}),ut==null&&(t.data.bgActivePosistion={x:Ee[0],y:Ee[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&i(t.touchData.start,["taphold"],$,{x:pe[0],y:pe[1]})},t.tapholdDuration)}}if($.touches.length>=1){for(var Lr=t.touchData.startPosition=[null,null,null,null,null,null],Kt=0;Kt<pe.length;Kt++)Lr[Kt]=ve[Kt]=pe[Kt];var sr=$.touches[0];t.touchData.startGPosition=[sr.clientX,sr.clientY]}}},!1);var Se;t.registerBinding(e,"touchmove",Se=function($){var ce=t.touchData.capture;if(!(!ce&&!z($))){var pe=t.selection,ve=t.cy,Ee=t.touchData.now,Ue=t.touchData.earlier,je=ve.zoom();if($.touches[0]){var He=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);Ee[0]=He[0],Ee[1]=He[1]}if($.touches[1]){var He=t.projectIntoViewport($.touches[1].clientX,$.touches[1].clientY);Ee[2]=He[0],Ee[3]=He[1]}if($.touches[2]){var He=t.projectIntoViewport($.touches[2].clientX,$.touches[2].clientY);Ee[4]=He[0],Ee[5]=He[1]}var _e=function(_c){return{originalEvent:$,type:_c,position:{x:Ee[0],y:Ee[1]}}},Ke=t.touchData.startGPosition,it;if(ce&&$.touches[0]&&Ke){for(var st=[],Ve=0;Ve<Ee.length;Ve++)st[Ve]=Ee[Ve]-Ue[Ve];var dt=$.touches[0].clientX-Ke[0],ut=dt*dt,Yt=$.touches[0].clientY-Ke[1],Ot=Yt*Yt,Lr=ut+Ot;it=Lr>=t.touchTapThreshold2}if(ce&&t.touchData.cxt){$.preventDefault();var Kt=$.touches[0].clientX-ae,sr=$.touches[0].clientY-re,Jt=$.touches[1].clientX-ae,lr=$.touches[1].clientY-re,Ra=Ze(Kt,sr,Jt,lr),Xt=Ra/le,Ba=150,Cr=Ba*Ba,Ht=1.5,xr=Ht*Ht;if(Xt>=xr||Ra>=Cr){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var sa=_e("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(sa),t.touchData.start=null):ve.emit(sa)}}if(ce&&t.touchData.cxt){var sa=_e("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(sa):ve.emit(sa),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Nr=t.findNearestElement(Ee[0],Ee[1],!0,!0);(!t.touchData.cxtOver||Nr!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(_e("cxtdragout")),t.touchData.cxtOver=Nr,Nr&&Nr.emit(_e("cxtdragover")))}else if(ce&&$.touches[2]&&ve.boxSelectionEnabled())$.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||ve.emit(_e("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,pe[4]=1,!pe||pe.length===0||pe[0]===void 0?(pe[0]=(Ee[0]+Ee[2]+Ee[4])/3,pe[1]=(Ee[1]+Ee[3]+Ee[5])/3,pe[2]=(Ee[0]+Ee[2]+Ee[4])/3+1,pe[3]=(Ee[1]+Ee[3]+Ee[5])/3+1):(pe[2]=(Ee[0]+Ee[2]+Ee[4])/3,pe[3]=(Ee[1]+Ee[3]+Ee[5])/3),t.redrawHint("select",!0),t.redraw();else if(ce&&$.touches[1]&&!t.touchData.didSelect&&ve.zoomingEnabled()&&ve.panningEnabled()&&ve.userZoomingEnabled()&&ve.userPanningEnabled()){$.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var jr=t.dragData.touchDragEles;if(jr){t.redrawHint("drag",!0);for(var Gr=0;Gr<jr.length;Gr++){var ni=jr[Gr]._private;ni.grabbed=!1,ni.rscratch.inDragLayer=!1}}var Ar=t.touchData.start,Kt=$.touches[0].clientX-ae,sr=$.touches[0].clientY-re,Jt=$.touches[1].clientX-ae,lr=$.touches[1].clientY-re,dl=Ae(Kt,sr,Jt,lr),ii=dl/Y;if(Ne){var si=Kt-G,ps=sr-Z,li=Jt-J,dr=lr-X,Lc=(si+li)/2,Pc=(ps+dr)/2,wa=ve.zoom(),cn=wa*ii,fl=ve.pan(),qo=oe[0]*wa+fl.x,Io=oe[1]*wa+fl.y,Sh={x:-cn/wa*(qo-fl.x-Lc)+qo,y:-cn/wa*(Io-fl.y-Pc)+Io};if(Ar&&Ar.active()){var jr=t.dragData.touchDragEles;T(jr),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ar.unactivate().emit(_e("freeon")),jr.emit(_e("free")),t.dragData.didDrag&&(Ar.emit(_e("dragfreeon")),jr.emit(_e("dragfree")))}ve.viewport({zoom:cn,pan:Sh,cancelOnFailedZoom:!0}),ve.emit(_e("pinchzoom")),Y=dl,G=Kt,Z=sr,J=Jt,X=lr,t.pinching=!0}if($.touches[0]){var He=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);Ee[0]=He[0],Ee[1]=He[1]}if($.touches[1]){var He=t.projectIntoViewport($.touches[1].clientX,$.touches[1].clientY);Ee[2]=He[0],Ee[3]=He[1]}if($.touches[2]){var He=t.projectIntoViewport($.touches[2].clientX,$.touches[2].clientY);Ee[4]=He[0],Ee[5]=He[1]}}else if($.touches[0]&&!t.touchData.didSelect){var Qr=t.touchData.start,oi=t.touchData.last,Nr;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Nr=t.findNearestElement(Ee[0],Ee[1],!0,!0)),ce&&Qr!=null&&$.preventDefault(),ce&&Qr!=null&&t.nodeIsDraggable(Qr))if(it){var jr=t.dragData.touchDragEles,La=!t.dragData.didDrag;La&&E(jr,{inDragLayer:!0}),t.dragData.didDrag=!0;var Mr={x:0,y:0};if(De(st[0])&&De(st[1])&&(Mr.x+=st[0],Mr.y+=st[1],La)){t.redrawHint("eles",!0);var la=t.touchData.dragDelta;la&&De(la[0])&&De(la[1])&&(Mr.x+=la[0],Mr.y+=la[1])}t.hoverData.draggingEles=!0,jr.silentShift(Mr).emit(_e("position")).emit(_e("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==Ue[0]&&t.touchData.startPosition[1]==Ue[1]&&t.redrawHint("eles",!0),t.redraw()}else{var la=t.touchData.dragDelta=t.touchData.dragDelta||[];la.length===0?(la.push(st[0]),la.push(st[1])):(la[0]+=st[0],la[1]+=st[1])}if(i(Qr||Nr,["touchmove","tapdrag","vmousemove"],$,{x:Ee[0],y:Ee[1]}),(!Qr||!Qr.grabbed())&&Nr!=oi&&(oi&&oi.emit(_e("tapdragout")),Nr&&Nr.emit(_e("tapdragover"))),t.touchData.last=Nr,ce)for(var Gr=0;Gr<Ee.length;Gr++)Ee[Gr]&&t.touchData.startPosition[Gr]&&it&&(t.touchData.singleTouchMoved=!0);if(ce&&(Qr==null||Qr.pannable())&&ve.panningEnabled()&&ve.userPanningEnabled()){var Eh=o(Qr,t.touchData.starts);Eh&&($.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=ro(t.touchData.startPosition)),t.swipePanning?(ve.panBy({x:st[0]*je,y:st[1]*je}),ve.emit(_e("dragpan"))):it&&(t.swipePanning=!0,ve.panBy({x:dt*je,y:Yt*je}),ve.emit(_e("dragpan")),Qr&&(Qr.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var He=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);Ee[0]=He[0],Ee[1]=He[1]}}for(var Ve=0;Ve<Ee.length;Ve++)Ue[Ve]=Ee[Ve];ce&&$.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var Oe;t.registerBinding(e,"touchcancel",Oe=function($){var ce=t.touchData.start;t.touchData.capture=!1,ce&&ce.unactivate()});var ke,Pe,Ge,Je;if(t.registerBinding(e,"touchend",ke=function($){var ce=t.touchData.start,pe=t.touchData.capture;if(pe)$.touches.length===0&&(t.touchData.capture=!1),$.preventDefault();else return;var ve=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var Ee=t.cy,Ue=Ee.zoom(),je=t.touchData.now,He=t.touchData.earlier;if($.touches[0]){var _e=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);je[0]=_e[0],je[1]=_e[1]}if($.touches[1]){var _e=t.projectIntoViewport($.touches[1].clientX,$.touches[1].clientY);je[2]=_e[0],je[3]=_e[1]}if($.touches[2]){var _e=t.projectIntoViewport($.touches[2].clientX,$.touches[2].clientY);je[4]=_e[0],je[5]=_e[1]}var Ke=function(Cr){return{originalEvent:$,type:Cr,position:{x:je[0],y:je[1]}}};ce&&ce.unactivate();var it;if(t.touchData.cxt){if(it=Ke("cxttapend"),ce?ce.emit(it):Ee.emit(it),!t.touchData.cxtDragged){var st=Ke("cxttap");ce?ce.emit(st):Ee.emit(st)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!$.touches[2]&&Ee.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ve=Ee.collection(t.getAllInBox(ve[0],ve[1],ve[2],ve[3]));ve[0]=void 0,ve[1]=void 0,ve[2]=void 0,ve[3]=void 0,ve[4]=0,t.redrawHint("select",!0),Ee.emit(Ke("boxend"));var dt=function(Cr){return Cr.selectable()&&!Cr.selected()};Ve.emit(Ke("box")).stdFilter(dt).select().emit(Ke("boxselect")),Ve.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(ce!=null&&ce.unactivate(),$.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!$.touches[1]){if(!$.touches[0]){if(!$.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ut=t.dragData.touchDragEles;if(ce!=null){var Yt=ce._private.grabbed;T(ut),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Yt&&(ce.emit(Ke("freeon")),ut.emit(Ke("free")),t.dragData.didDrag&&(ce.emit(Ke("dragfreeon")),ut.emit(Ke("dragfree")))),i(ce,["touchend","tapend","vmouseup","tapdragout"],$,{x:je[0],y:je[1]}),ce.unactivate(),t.touchData.start=null}else{var Ot=t.findNearestElement(je[0],je[1],!0,!0);i(Ot,["touchend","tapend","vmouseup","tapdragout"],$,{x:je[0],y:je[1]})}var Lr=t.touchData.startPosition[0]-je[0],Kt=Lr*Lr,sr=t.touchData.startPosition[1]-je[1],Jt=sr*sr,lr=Kt+Jt,Ra=lr*Ue*Ue;t.touchData.singleTouchMoved||(ce||Ee.$(":selected").unselect(["tapunselect"]),i(ce,["tap","vclick"],$,{x:je[0],y:je[1]}),Pe=!1,$.timeStamp-Je<=Ee.multiClickDebounceTime()?(Ge&&clearTimeout(Ge),Pe=!0,Je=null,i(ce,["dbltap","vdblclick"],$,{x:je[0],y:je[1]})):(Ge=setTimeout(function(){Pe||i(ce,["onetap","voneclick"],$,{x:je[0],y:je[1]})},Ee.multiClickDebounceTime()),Je=$.timeStamp)),ce!=null&&!t.dragData.didDrag&&ce._private.selectable&&Ra<t.touchTapThreshold2&&!t.pinching&&(Ee.selectionType()==="single"?(Ee.$(r).unmerge(ce).unselect(["tapunselect"]),ce.select(["tapselect"])):ce.selected()?ce.unselect(["tapunselect"]):ce.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Xt=0;Xt<je.length;Xt++)He[Xt]=je[Xt];t.dragData.didDrag=!1,$.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),$.touches.length<2&&($.touches.length===1&&(t.touchData.startGPosition=[$.touches[0].clientX,$.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var Be=[],nt=function($){return{clientX:$.clientX,clientY:$.clientY,force:1,identifier:$.pointerId,pageX:$.pageX,pageY:$.pageY,radiusX:$.width/2,radiusY:$.height/2,screenX:$.screenX,screenY:$.screenY,target:$.target}},ye=function($){return{event:$,touch:nt($)}},$e=function($){Be.push(ye($))},et=function($){for(var ce=0;ce<Be.length;ce++){var pe=Be[ce];if(pe.event.pointerId===$.pointerId){Be.splice(ce,1);return}}},xe=function($){var ce=Be.filter(function(pe){return pe.event.pointerId===$.pointerId})[0];ce.event=$,ce.touch=nt($)},ze=function($){$.touches=Be.map(function(ce){return ce.touch})},Re=function($){return $.pointerType==="mouse"||$.pointerType===4};t.registerBinding(t.container,"pointerdown",function(we){Re(we)||(we.preventDefault(),$e(we),ze(we),Qe(we))}),t.registerBinding(t.container,"pointerup",function(we){Re(we)||(et(we),ze(we),ke(we))}),t.registerBinding(t.container,"pointercancel",function(we){Re(we)||(et(we),ze(we),Oe(we))}),t.registerBinding(t.container,"pointermove",function(we){Re(we)||(we.preventDefault(),xe(we),ze(we),Se(we))})}};var ri={};ri.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,i,s,o,u,d){this.renderer.nodeShapeImpl("polygon",a,i,s,o,u,this.points)},intersectLine:function(a,i,s,o,u,d,f,h){return ac(u,d,this.points,a,i,s/2,o/2,f)},checkPoint:function(a,i,s,o,u,d,f,h){return ti(a,i,this.points,d,f,o,u,[0,-1],s)},hasMiterBounds:t!=="rectangle",miterBounds:function(a,i,s,o,u,d){return IO(this.points,a,i,s,o,u)}}};ri.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s)},intersectLine:function(e,r,a,i,s,o,u,d){return KO(s,o,e,r,a/2+u,i/2+u)},checkPoint:function(e,r,a,i,s,o,u,d){return qs(e,r,i,s,o,u,a)}}};ri.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,i,s,o,u,d,f){if(d[f]!==void 0&&d[f+"-cx"]===a&&d[f+"-cy"]===i)return d[f];d[f]=new Array(e.length/2),d[f+"-cx"]=a,d[f+"-cy"]=i;var h=s/2,p=o/2;u=u==="auto"?SC(s,o):u;for(var m=new Array(e.length/2),y=0;y<e.length/2;y++)m[y]={x:a+h*e[y*2],y:i+p*e[y*2+1]};var x,E,w,T,C=m.length;for(E=m[C-1],x=0;x<C;x++)w=m[x%C],T=m[(x+1)%C],d[f][x]=ly(E,w,T,u),E=w,w=T;return d[f]},draw:function(a,i,s,o,u,d,f){this.renderer.nodeShapeImpl("round-polygon",a,i,s,o,u,this.points,this.getOrCreateCorners(i,s,o,u,d,f,"drawCorners"))},intersectLine:function(a,i,s,o,u,d,f,h,p){return ZO(u,d,this.points,a,i,s,o,f,this.getOrCreateCorners(a,i,s,o,h,p,"corners"))},checkPoint:function(a,i,s,o,u,d,f,h,p){return YO(a,i,this.points,d,f,o,u,this.getOrCreateCorners(d,f,o,u,h,p,"corners"))}}};ri.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ta(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,this.points,o)},intersectLine:function(e,r,a,i,s,o,u,d){return bC(s,o,e,r,a,i,u,d)},checkPoint:function(e,r,a,i,s,o,u,d){var f=i/2,h=s/2;d=d==="auto"?ns(i,s):d,d=Math.min(f,h,d);var p=d*2;return!!(ti(e,r,this.points,o,u,i,s-p,[0,-1],a)||ti(e,r,this.points,o,u,i-p,s,[0,-1],a)||qs(e,r,p,p,o-f+d,u-h+d,a)||qs(e,r,p,p,o+f-d,u-h+d,a)||qs(e,r,p,p,o+f-d,u+h-d,a)||qs(e,r,p,p,o-f+d,u+h-d,a))}}};ri.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Xm(),points:ta(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,null,o)},generateCutTrianglePts:function(e,r,a,i,s){var o=s==="auto"?this.cornerLength:s,u=r/2,d=e/2,f=a-d,h=a+d,p=i-u,m=i+u;return{topLeft:[f,p+o,f+o,p,f+o,p+o],topRight:[h-o,p,h,p+o,h-o,p+o],bottomRight:[h,m-o,h-o,m,h-o,m-o],bottomLeft:[f+o,m,f,m-o,f+o,m-o]}},intersectLine:function(e,r,a,i,s,o,u,d){var f=this.generateCutTrianglePts(a+2*u,i+2*u,e,r,d),h=[].concat.apply([],[f.topLeft.splice(0,4),f.topRight.splice(0,4),f.bottomRight.splice(0,4),f.bottomLeft.splice(0,4)]);return ac(s,o,h,e,r)},checkPoint:function(e,r,a,i,s,o,u,d){var f=d==="auto"?this.cornerLength:d;if(ti(e,r,this.points,o,u,i,s-2*f,[0,-1],a)||ti(e,r,this.points,o,u,i-2*f,s,[0,-1],a))return!0;var h=this.generateCutTrianglePts(i,s,o,u);return ma(e,r,h.topLeft)||ma(e,r,h.topRight)||ma(e,r,h.bottomRight)||ma(e,r,h.bottomLeft)}}};ri.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ta(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s)},intersectLine:function(e,r,a,i,s,o,u,d){var f=.15,h=.5,p=.85,m=this.generateBarrelBezierPts(a+2*u,i+2*u,e,r),y=function(w){var T=lo({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},f),C=lo({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},h),N=lo({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},p);return[w[0],w[1],T.x,T.y,C.x,C.y,N.x,N.y,w[4],w[5]]},x=[].concat(y(m.topLeft),y(m.topRight),y(m.bottomRight),y(m.bottomLeft));return ac(s,o,x,e,r)},generateBarrelBezierPts:function(e,r,a,i){var s=r/2,o=e/2,u=a-o,d=a+o,f=i-s,h=i+s,p=Wg(e,r),m=p.heightOffset,y=p.widthOffset,x=p.ctrlPtOffsetPct*e,E={topLeft:[u,f+m,u+x,f,u+y,f],topRight:[d-y,f,d-x,f,d,f+m],bottomRight:[d,h-m,d-x,h,d-y,h],bottomLeft:[u+y,h,u+x,h,u,h-m]};return E.topLeft.isTop=!0,E.topRight.isTop=!0,E.bottomLeft.isBottom=!0,E.bottomRight.isBottom=!0,E},checkPoint:function(e,r,a,i,s,o,u,d){var f=Wg(i,s),h=f.heightOffset,p=f.widthOffset;if(ti(e,r,this.points,o,u,i,s-2*h,[0,-1],a)||ti(e,r,this.points,o,u,i-2*p,s,[0,-1],a))return!0;for(var m=this.generateBarrelBezierPts(i,s,o,u),y=function(k,R,z){var B=z[4],L=z[2],q=z[0],I=z[5],Q=z[1],_=Math.min(B,q),V=Math.max(B,q),F=Math.min(I,Q),K=Math.max(I,Q);if(_<=k&&k<=V&&F<=R&&R<=K){var ee=WO(B,L,q),P=HO(ee[0],ee[1],ee[2],k),G=P.filter(function(Z){return 0<=Z&&Z<=1});if(G.length>0)return G[0]}return null},x=Object.keys(m),E=0;E<x.length;E++){var w=x[E],T=m[w],C=y(e,r,T);if(C!=null){var N=T[5],A=T[3],D=T[1],M=Or(N,A,D,C);if(T.isTop&&M<=r||T.isBottom&&r<=M)return!0}}return!1}}};ri.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ta(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,this.points,o)},intersectLine:function(e,r,a,i,s,o,u,d){var f=e-(a/2+u),h=r-(i/2+u),p=h,m=e+(a/2+u),y=Xi(s,o,e,r,f,h,m,p,!1);return y.length>0?y:bC(s,o,e,r,a,i,u,d)},checkPoint:function(e,r,a,i,s,o,u,d){d=d==="auto"?ns(i,s):d;var f=2*d;if(ti(e,r,this.points,o,u,i,s-f,[0,-1],a)||ti(e,r,this.points,o,u,i-f,s,[0,-1],a))return!0;var h=i/2+2*a,p=s/2+2*a,m=[o-h,u-p,o-h,u,o+h,u,o+h,u-p];return!!(ma(e,r,m)||qs(e,r,f,f,o+i/2-d,u+s/2-d,a)||qs(e,r,f,f,o-i/2+d,u+s/2-d,a))}}};ri.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",ta(3,0)),this.generateRoundPolygon("round-triangle",ta(3,0)),this.generatePolygon("rectangle",ta(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",ta(5,0)),this.generateRoundPolygon("round-pentagon",ta(5,0)),this.generatePolygon("hexagon",ta(6,0)),this.generateRoundPolygon("round-hexagon",ta(6,0)),this.generatePolygon("heptagon",ta(7,0)),this.generateRoundPolygon("round-heptagon",ta(7,0)),this.generatePolygon("octagon",ta(8,0)),this.generateRoundPolygon("round-octagon",ta(8,0));var a=new Array(20);{var i=Zg(5,0),s=Zg(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var u=0;u<s.length/2;u++)s[u*2]*=o,s[u*2+1]*=o;for(var u=0;u<20/4;u++)a[u*4]=i[u*2],a[u*4+1]=i[u*2+1],a[u*4+2]=s[u*2],a[u*4+3]=s[u*2+1]}a=wC(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var d=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",d),this.generateRoundPolygon("round-tag",d)}t.makePolygon=function(f){var h=f.join("$"),p="polygon-"+h,m;return(m=this[p])?m:e.generatePolygon(p,f)}};var Rc={};Rc.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Rc.redraw=function(t){t=t||gC();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};Rc.beforeRender=function(t,e){if(!this.destroyed){e==null&&$t("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,i){return i.priority-a.priority})}};var rE=function(e,r,a){for(var i=e.beforeRenderCallbacks,s=0;s<i.length;s++)i[s].fn(r,a)};Rc.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function(i){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){rE(t,!0,i);var s=ei();t.render(t.renderOptions);var o=t.lastDrawTime=ei();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-s),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var u=o-s;t.redrawTotalTime+=u,t.lastRedrawTime=u,t.averageRedrawTime=t.averageRedrawTime/2+u/2,t.requestedFrame=!1}else rE(t,!1,i);t.skipFrame=!1,_f(r)}};_f(r)}};var vL=function(e){this.init(e)},SN=vL,Uo=SN.prototype;Uo.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Uo.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var i=a.document,s=i.head,o="__________cytoscape_stylesheet",u="__________cytoscape_container",d=i.getElementById(o)!=null;if(r.className.indexOf(u)<0&&(r.className=(r.className||"")+" "+u),!d){var f=i.createElement("style");f.id=o,f.textContent="."+u+" { position: relative; }",s.insertBefore(f,s.children[0])}var h=a.getComputedStyle(r),p=h.getPropertyValue("position");p==="static"&&At("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=De(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};Uo.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),t==="gc"&&r.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};Uo.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,i=a.target;(i.off||i.removeEventListener).apply(i,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};Uo.isHeadless=function(){return!1};[sy,bN,wN,_o,ri,Rc].forEach(function(t){tt(Uo,t)});var fg=1e3/60,EN={setupDequeueing:function(e){return function(){var a=this,i=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var s=Ac(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),o=function(f,h){var p=ei(),m=i.averageRedrawTime,y=i.lastRedrawTime,x=[],E=i.cy.extent(),w=i.getPixelRatio();for(f||i.flushRenderedStyleQueue();;){var T=ei(),C=T-p,N=T-h;if(y<fg){var A=fg-(f?m:0);if(N>=e.deqFastCost*A)break}else if(f){if(C>=e.deqCost*y||C>=e.deqAvgCost*m)break}else if(N>=e.deqNoDrawCost*fg)break;var D=e.deq(a,w,E);if(D.length>0)for(var M=0;M<D.length;M++)x.push(D[M]);else break}x.length>0&&(e.onDeqd(a,x),!f&&e.shouldRedraw(a,x,w,E)&&s())},u=e.priority||Gm;i.beforeRender(o,u(a))}}}},pL=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Uf;cs(this,t),this.idsByKey=new Zn,this.keyForId=new Zn,this.cachesByLvl=new Zn,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return ds(t,[{key:"getIdsFor",value:function(r){r==null&&$t("Can not get id list for null key");var a=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Bo,a.set(r,i)),i}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),i=this.keyForId.get(a),s=this.getKey(r);this.deleteIdForKey(i,a),this.addIdForKey(s,a),this.keyForId.set(a,s)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),i=this.keyForId.get(a);this.deleteIdForKey(i,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),i=this.keyForId.get(a),s=this.getKey(r);return i!==s}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,i=this.lvls,s=a.get(r);return s||(s=new Zn,a.set(r,s),i.push(r)),s}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var i=this.getKey(r),s=this.getCache(i,a);return s!=null&&this.updateKeyMappingFor(r),s}},{key:"getForCachedKey",value:function(r,a){var i=this.keyForId.get(r.id()),s=this.getCache(i,a);return s}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var i=this.getKey(r);return this.hasCache(i,a)}},{key:"setCache",value:function(r,a,i){i.key=r,this.getCachesAt(a).set(r,i)}},{key:"set",value:function(r,a,i){var s=this.getKey(r);this.setCache(s,a,i),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var i=this.getKey(r);this.deleteCache(i,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(i){return a.deleteCache(r,i)})}},{key:"invalidate",value:function(r){var a=r.id(),i=this.keyForId.get(a);this.deleteKeyMappingFor(r);var s=this.doesEleInvalidateKey(r);return s&&this.invalidateKey(i),s||this.getNumberOfIdsForKey(i)===0}}])})(),aE=25,ff=50,Mf=-4,dm=3,TN=7.99,gL=8,mL=1024,yL=1024,xL=1024,bL=.2,wL=.8,SL=10,EL=.15,TL=.1,CL=.9,NL=.9,jL=100,AL=1,no={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ML=Fr({getKey:null,doesEleInvalidateKey:Uf,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:hC,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Vu=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var i=ML(r);tt(a,i),a.lookup=new pL(i.getKey,i.doesEleInvalidateKey),a.setupDequeueing()},Tr=Vu.prototype;Tr.reasons=no;Tr.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Tr.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};Tr.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Mc(function(r,a){return a.reqs-r.reqs});return e};Tr.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Tr.getElement=function(t,e,r,a,i){var s=this,o=this.renderer,u=o.cy.zoom(),d=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!s.allowEdgeTxrCaching&&t.isEdge()||!s.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil($m(u*r))),a<Mf)a=Mf;else if(u>=TN||a>dm)return null;var f=Math.pow(2,a),h=e.h*f,p=e.w*f,m=o.eleTextBiggerThanMin(t,f);if(!this.isVisible(t,m))return null;var y=d.get(t,a);if(y&&y.invalidated&&(y.invalidated=!1,y.texture.invalidatedWidth-=y.width),y)return y;var x;if(h<=aE?x=aE:h<=ff?x=ff:x=Math.ceil(h/ff)*ff,h>xL||p>yL)return null;var E=s.getTextureQueue(x),w=E[E.length-2],T=function(){return s.recycleTexture(x,p)||s.addTexture(x,p)};w||(w=E[E.length-1]),w||(w=T()),w.width-w.usedWidth<p&&(w=T());for(var C=function(_){return _&&_.scaledLabelShown===m},N=i&&i===no.dequeue,A=i&&i===no.highQuality,D=i&&i===no.downscale,M,j=a+1;j<=dm;j++){var k=d.get(t,j);if(k){M=k;break}}var R=M&&M.level===a+1?M:null,z=function(){w.context.drawImage(R.texture.canvas,R.x,0,R.width,R.height,w.usedWidth,0,p,h)};if(w.context.setTransform(1,0,0,1,0,0),w.context.clearRect(w.usedWidth,0,p,x),C(R))z();else if(C(M))if(A){for(var B=M.level;B>a;B--)R=s.getElement(t,e,r,B,no.downscale);z()}else return s.queueElement(t,M.level-1),M;else{var L;if(!N&&!A&&!D)for(var q=a-1;q>=Mf;q--){var I=d.get(t,q);if(I){L=I;break}}if(C(L))return s.queueElement(t,a),L;w.context.translate(w.usedWidth,0),w.context.scale(f,f),this.drawElement(w.context,t,e,m,!1),w.context.scale(1/f,1/f),w.context.translate(-w.usedWidth,0)}return y={x:w.usedWidth,texture:w,level:a,scale:f,width:p,height:h,scaledLabelShown:m},w.usedWidth+=Math.ceil(p+gL),w.eleCaches.push(y),d.set(t,a,y),s.checkTextureFullness(w),y};Tr.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Tr.invalidateElement=function(t){var e=this,r=e.lookup,a=[],i=r.isInvalid(t);if(i){for(var s=Mf;s<=dm;s++){var o=r.getForCachedKey(t,s);o&&a.push(o)}var u=r.invalidate(t);if(u)for(var d=0;d<a.length;d++){var f=a[d],h=f.texture;h.invalidatedWidth+=f.width,f.invalidated=!0,e.checkTextureUtility(h)}e.removeFromQueue(t)}};Tr.checkTextureUtility=function(t){t.invalidatedWidth>=bL*t.width&&this.retireTexture(t)};Tr.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>wL&&t.fullnessChecks>=SL?as(r,t):t.fullnessChecks++};Tr.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),i=this.lookup;as(a,t),t.retired=!0;for(var s=t.eleCaches,o=0;o<s.length;o++){var u=s[o];i.deleteCache(u.key,u.level)}Qm(s);var d=e.getRetiredTextureQueue(r);d.push(t)};Tr.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),i={};return a.push(i),i.eleCaches=[],i.height=t,i.width=Math.max(mL,e),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=r.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i};Tr.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),i=r.getRetiredTextureQueue(t),s=0;s<i.length;s++){var o=i[s];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Qm(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),as(i,o),a.push(o),o}};Tr.queueElement=function(t,e){var r=this,a=r.getElementQueue(),i=r.getElementKeyToQueue(),s=this.getKey(t),o=i[s];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var u={eles:t.spawn().merge(t),level:e,reqs:1,key:s};a.push(u),i[s]=u}};Tr.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),i=[],s=e.lookup,o=0;o<AL&&r.size()>0;o++){var u=r.pop(),d=u.key,f=u.eles[0],h=s.hasCache(f,u.level);if(a[d]=null,h)continue;i.push(u);var p=e.getBoundingBox(f);e.getElement(f,p,t,u.level,no.dequeue)}return i};Tr.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),i=this.getKey(t),s=a[i];s!=null&&(s.eles.length===1?(s.reqs=Hm,r.updateItem(s),r.pop(),a[i]=null):s.eles.unmerge(t))};Tr.onDequeue=function(t){this.onDequeues.push(t)};Tr.offDequeue=function(t){as(this.onDequeues,t)};Tr.setupDequeueing=EN.setupDequeueing({deqRedrawThreshold:jL,deqCost:EL,deqAvgCost:TL,deqNoDrawCost:CL,deqFastCost:NL,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var i=e.onDequeues[a];i(r)}},shouldRedraw:function(e,r,a,i){for(var s=0;s<r.length;s++)for(var o=r[s].eles,u=0;u<o.length;u++){var d=o[u].boundingBox();if(Km(d,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var kL=1,Gu=-4,$f=2,DL=3.99,OL=50,RL=50,BL=.15,LL=.1,PL=.9,zL=.9,_L=1,nE=250,UL=4e3*4e3,iE=32767,qL=!0,CN=function(e){var r=this,a=r.renderer=e,i=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=ei()-2*nE,r.skipping=!1,r.eleTxrDeqs=i.collection(),r.scheduleElementRefinement=Ac(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},RL),a.beforeRender(function(o,u){u-r.lastInvalidationTime<=nE?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var s=function(u,d){return d.reqs-u.reqs};r.layersQueue=new Mc(s),r.setupDequeueing()},Hr=CN.prototype,sE=0,IL=Math.pow(2,53)-1;Hr.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),i=Math.ceil(t.h*r),s=this.renderer.makeOffscreenCanvas(a,i),o={id:sE=++sE%IL,bb:t,level:e,width:a,height:i,canvas:s,context:s.getContext("2d"),eles:[],elesQueue:[],reqs:0},u=o.context,d=-o.bb.x1,f=-o.bb.y1;return u.scale(r,r),u.translate(d,f),o};Hr.getLayers=function(t,e,r){var a=this,i=a.renderer,s=i.cy,o=s.zoom(),u=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil($m(o*e)),r<Gu)r=Gu;else if(o>=DL||r>$f)return null}a.validateLayersElesOrdering(r,t);var d=a.layersByLevel,f=Math.pow(2,r),h=d[r]=d[r]||[],p,m=a.levelIsComplete(r,t),y,x=function(){var z=function(Q){if(a.validateLayersElesOrdering(Q,t),a.levelIsComplete(Q,t))return y=d[Q],!0},B=function(Q){if(!y)for(var _=r+Q;Gu<=_&&_<=$f&&!z(_);_+=Q);};B(1),B(-1);for(var L=h.length-1;L>=0;L--){var q=h[L];q.invalid&&as(h,q)}};if(!m)x();else return h;var E=function(){if(!p){p=na();for(var z=0;z<t.length;z++)_O(p,t[z].boundingBox())}return p},w=function(z){z=z||{};var B=z.after;E();var L=Math.ceil(p.w*f),q=Math.ceil(p.h*f);if(L>iE||q>iE)return null;var I=L*q;if(I>UL)return null;var Q=a.makeLayer(p,r);if(B!=null){var _=h.indexOf(B)+1;h.splice(_,0,Q)}else(z.insert===void 0||z.insert)&&h.unshift(Q);return Q};if(a.skipping&&!u)return null;for(var T=null,C=t.length/kL,N=!u,A=0;A<t.length;A++){var D=t[A],M=D._private.rscratch,j=M.imgLayerCaches=M.imgLayerCaches||{},k=j[r];if(k){T=k;continue}if((!T||T.eles.length>=C||!xC(T.bb,D.boundingBox()))&&(T=w({insert:!0,after:T}),!T))return null;y||N?a.queueLayer(T,D):a.drawEleInLayer(T,D,r,e),T.eles.push(D),j[r]=T}return y||(N?null:h)};Hr.getEleLevelForLayerLevel=function(t,e){return t};Hr.drawEleInLayer=function(t,e,r,a){var i=this,s=this.renderer,o=t.context,u=e.boundingBox();u.w===0||u.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,a),s.setImgSmoothing(o,!1),s.drawCachedElement(o,e,null,null,r,qL),s.setImgSmoothing(o,!0))};Hr.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var i=0,s=0;s<a.length;s++){var o=a[s];if(o.reqs>0||o.invalid)return!1;i+=o.eles.length}return i===e.length};Hr.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var i=r[a],s=-1,o=0;o<e.length;o++)if(i.eles[0]===e[o]){s=o;break}if(s<0){this.invalidateLayer(i);continue}for(var u=s,o=0;o<i.eles.length;o++)if(i.eles[o]!==e[u+o]){this.invalidateLayer(i);break}}};Hr.updateElementsInLayers=function(t,e){for(var r=this,a=Tc(t[0]),i=0;i<t.length;i++)for(var s=a?null:t[i],o=a?t[i]:t[i].ele,u=o._private.rscratch,d=u.imgLayerCaches=u.imgLayerCaches||{},f=Gu;f<=$f;f++){var h=d[f];h&&(s&&r.getEleLevelForLayerLevel(h.level)!==s.level||e(h,o,s))}};Hr.haveLayers=function(){for(var t=this,e=!1,r=Gu;r<=$f;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};Hr.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=ei(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,i,s){e.invalidateLayer(a)}))};Hr.invalidateLayer=function(t){if(this.lastInvalidationTime=ei(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];as(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i<r.length;i++){var s=r[i]._private.rscratch.imgLayerCaches;s&&(s[e]=null)}}};Hr.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,i,s){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var u=0;u<o.eles.length;u++)e.queueLayer(o,o.eles[u])})};Hr.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};Hr.queueLayer=function(t,e){var r=this,a=r.layersQueue,i=t.elesQueue,s=i.hasId=i.hasId||{};if(!t.replacement){if(e){if(s[e.id()])return;i.push(e),s[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}};Hr.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],i=0;i<_L&&r.size()!==0;){var s=r.peek();if(s.replacement){r.pop();continue}if(s.replaces&&s!==s.replaces.replacement){r.pop();continue}if(s.invalid){r.pop();continue}var o=s.elesQueue.shift();o&&(e.drawEleInLayer(s,o,s.level,t),i++),a.length===0&&a.push(!0),s.elesQueue.length===0&&(r.pop(),s.reqs=0,s.replaces&&e.applyLayerReplacement(s),e.requestRedraw())}return a};Hr.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,i=r.indexOf(a);if(!(i<0||a.invalid)){r[i]=t;for(var s=0;s<t.eles.length;s++){var o=t.eles[s]._private,u=o.imgLayerCaches=o.imgLayerCaches||{};u&&(u[t.level]=t)}e.requestRedraw()}};Hr.requestRedraw=Ac(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);Hr.setupDequeueing=EN.setupDequeueing({deqRedrawThreshold:OL,deqCost:BL,deqAvgCost:LL,deqNoDrawCost:PL,deqFastCost:zL,deq:function(e,r){return e.dequeue(r)},onDeqd:Gm,shouldRedraw:hC,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var NN={},lE;function VL(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function FL(t,e,r){for(var a,i=0;i<e.length;i++){var s=e[i];i===0&&(a=s),t.lineTo(s.x,s.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function oE(t,e,r){t.beginPath&&t.beginPath();for(var a=e,i=0;i<a.length;i++){var s=a[i];t.lineTo(s.x,s.y)}var o=r,u=r[0];t.moveTo(u.x,u.y);for(var i=1;i<o.length;i++){var s=o[i];t.lineTo(s.x,s.y)}t.closePath&&t.closePath()}function HL(t,e,r,a,i){t.beginPath&&t.beginPath(),t.arc(r,a,i,0,Math.PI*2,!1);var s=e,o=s[0];t.moveTo(o.x,o.y);for(var u=0;u<s.length;u++){var d=s[u];t.lineTo(d.x,d.y)}t.closePath&&t.closePath()}function GL(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}NN.arrowShapeImpl=function(t){return(lE||(lE={polygon:VL,"triangle-backcurve":FL,"triangle-tee":oE,"circle-triangle":HL,"triangle-cross":oE,circle:GL}))[t]};var Nn={};Nn.drawElement=function(t,e,r,a,i,s){var o=this;e.isNode()?o.drawNode(t,e,r,a,i,s):o.drawEdge(t,e,r,a,i,s)};Nn.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};Nn.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};Nn.drawCachedElementPortion=function(t,e,r,a,i,s,o,u){var d=this,f=r.getBoundingBox(e);if(!(f.w===0||f.h===0)){var h=r.getElement(e,f,a,i,s);if(h!=null){var p=u(d,e);if(p===0)return;var m=o(d,e),y=f.x1,x=f.y1,E=f.w,w=f.h,T,C,N,A,D;if(m!==0){var M=r.getRotationPoint(e);N=M.x,A=M.y,t.translate(N,A),t.rotate(m),D=d.getImgSmoothing(t),D||d.setImgSmoothing(t,!0);var j=r.getRotationOffset(e);T=j.x,C=j.y}else T=y,C=x;var k;p!==1&&(k=t.globalAlpha,t.globalAlpha=k*p),t.drawImage(h.texture.canvas,h.x,0,h.width,h.height,T,C,E,w),p!==1&&(t.globalAlpha=k),m!==0&&(t.rotate(-m),t.translate(-N,-A),D||d.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var QL=function(){return 0},$L=function(e,r){return e.getTextAngle(r,null)},YL=function(e,r){return e.getTextAngle(r,"source")},KL=function(e,r){return e.getTextAngle(r,"target")},XL=function(e,r){return r.effectiveOpacity()},hg=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};Nn.drawCachedElement=function(t,e,r,a,i,s){var o=this,u=o.data,d=u.eleTxrCache,f=u.lblTxrCache,h=u.slbTxrCache,p=u.tlbTxrCache,m=e.boundingBox(),y=s===!0?d.reasons.highQuality:null;if(!(m.w===0||m.h===0||!e.visible())&&(!a||Km(m,a))){var x=e.isEdge(),E=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,d,r,i,y,QL,XL),(!x||!E)&&o.drawCachedElementPortion(t,e,f,r,i,y,$L,hg),x&&!E&&(o.drawCachedElementPortion(t,e,h,r,i,y,YL,hg),o.drawCachedElementPortion(t,e,p,r,i,y,KL,hg)),o.drawElementOverlay(t,e)}};Nn.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var i=e[a];r.drawElement(t,i)}};Nn.drawCachedElements=function(t,e,r,a){for(var i=this,s=0;s<e.length;s++){var o=e[s];i.drawCachedElement(t,o,r,a)}};Nn.drawCachedNodes=function(t,e,r,a){for(var i=this,s=0;s<e.length;s++){var o=e[s];o.isNode()&&i.drawCachedElement(t,o,r,a)}};Nn.drawLayeredElements=function(t,e,r,a){var i=this,s=i.data.lyrTxrCache.getLayers(e,r);if(s)for(var o=0;o<s.length;o++){var u=s[o],d=u.bb;d.w===0||d.h===0||t.drawImage(u.canvas,d.x1,d.y1,d.w,d.h)}else i.drawCachedElements(t,e,r,a)};var ai={};ai.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,u=e._private.rscratch;if(!(s&&!e.visible())&&!(u.badLine||u.allpts==null||isNaN(u.allpts[0]))){var d;r&&(d=r,t.translate(-d.x1,-d.y1));var f=s?e.pstyle("opacity").value:1,h=s?e.pstyle("line-opacity").value:1,p=e.pstyle("curve-style").value,m=e.pstyle("line-style").value,y=e.pstyle("width").pfValue,x=e.pstyle("line-cap").value,E=e.pstyle("line-outline-width").value,w=e.pstyle("line-outline-color").value,T=f*h,C=f*h,N=function(){var Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;p==="straight-triangle"?(o.eleStrokeStyle(t,e,Q),o.drawEdgeTrianglePath(e,t,u.allpts)):(t.lineWidth=y,t.lineCap=x,o.eleStrokeStyle(t,e,Q),o.drawEdgePath(e,t,u.allpts,m),t.lineCap="butt")},A=function(){var Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;if(t.lineWidth=y+E,t.lineCap=x,E>0)o.colorStrokeStyle(t,w[0],w[1],w[2],Q);else{t.lineCap="butt";return}p==="straight-triangle"?o.drawEdgeTrianglePath(e,t,u.allpts):(o.drawEdgePath(e,t,u.allpts,m),t.lineCap="butt")},D=function(){i&&o.drawEdgeOverlay(t,e)},M=function(){i&&o.drawEdgeUnderlay(t,e)},j=function(){var Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:C;o.drawArrowheads(t,e,Q)},k=function(){o.drawElementText(t,e,null,a)};t.lineJoin="round";var R=e.pstyle("ghost").value==="yes";if(R){var z=e.pstyle("ghost-offset-x").pfValue,B=e.pstyle("ghost-offset-y").pfValue,L=e.pstyle("ghost-opacity").value,q=T*L;t.translate(z,B),N(q),j(q),t.translate(-z,-B)}else A();M(),N(),j(),D(),k(),r&&t.translate(d.x1,d.y1)}};var jN=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var i=a.pstyle("".concat(e,"-opacity")).value;if(i!==0){var s=this,o=s.usePaths(),u=a._private.rscratch,d=a.pstyle("".concat(e,"-padding")).pfValue,f=2*d,h=a.pstyle("".concat(e,"-color")).value;r.lineWidth=f,u.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",s.colorStrokeStyle(r,h[0],h[1],h[2],i),s.drawEdgePath(a,r,u.allpts,"solid")}}}};ai.drawEdgeOverlay=jN("overlay");ai.drawEdgeUnderlay=jN("underlay");ai.drawEdgePath=function(t,e,r,a){var i=t._private.rscratch,s=e,o,u=!1,d=this.usePaths(),f=t.pstyle("line-dash-pattern").pfValue,h=t.pstyle("line-dash-offset").pfValue;if(d){var p=r.join("$"),m=i.pathCacheKey&&i.pathCacheKey===p;m?(o=e=i.pathCache,u=!0):(o=e=new Path2D,i.pathCacheKey=p,i.pathCache=o)}if(s.setLineDash)switch(a){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(f),s.lineDashOffset=h;break;case"solid":s.setLineDash([]);break}if(!u&&!i.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var y=2;y+3<r.length;y+=4)e.quadraticCurveTo(r[y],r[y+1],r[y+2],r[y+3]);break;case"straight":case"haystack":for(var x=2;x+1<r.length;x+=2)e.lineTo(r[x],r[x+1]);break;case"segments":if(i.isRound){var E=xa(i.roundCorners),w;try{for(E.s();!(w=E.n()).done;){var T=w.value;pN(e,T)}}catch(N){E.e(N)}finally{E.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var C=2;C+1<r.length;C+=2)e.lineTo(r[C],r[C+1]);break}e=s,d?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};ai.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,i=0;i+1<r.length;i+=2){var s=[r[i+2]-r[i],r[i+3]-r[i+1]],o=Math.sqrt(s[0]*s[0]+s[1]*s[1]),u=[s[1]/o,-s[0]/o],d=[u[0]*a/2,u[1]*a/2];e.beginPath(),e.moveTo(r[i]-d[0],r[i+1]-d[1]),e.lineTo(r[i]+d[0],r[i+1]+d[1]),e.lineTo(r[i+2],r[i+3]),e.closePath(),e.fill()}};ai.drawArrowheads=function(t,e,r){var a=e._private.rscratch,i=a.edgeType==="haystack";i||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),i||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};ai.drawArrowhead=function(t,e,r,a,i,s,o){if(!(isNaN(a)||a==null||isNaN(i)||i==null||isNaN(s)||s==null)){var u=this,d=e.pstyle(r+"-arrow-shape").value;if(d!=="none"){var f=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",h=e.pstyle(r+"-arrow-fill").value,p=e.pstyle("width").pfValue,m=e.pstyle(r+"-arrow-width"),y=m.value==="match-line"?p:m.pfValue;m.units==="%"&&(y*=p);var x=e.pstyle("opacity").value;o===void 0&&(o=x);var E=t.globalCompositeOperation;(o!==1||h==="hollow")&&(t.globalCompositeOperation="destination-out",u.colorFillStyle(t,255,255,255,1),u.colorStrokeStyle(t,255,255,255,1),u.drawArrowShape(e,t,f,p,d,y,a,i,s),t.globalCompositeOperation=E);var w=e.pstyle(r+"-arrow-color").value;u.colorFillStyle(t,w[0],w[1],w[2],o),u.colorStrokeStyle(t,w[0],w[1],w[2],o),u.drawArrowShape(e,t,h,p,d,y,a,i,s)}}};ai.drawArrowShape=function(t,e,r,a,i,s,o,u,d){var f=this,h=this.usePaths()&&i!=="triangle-cross",p=!1,m,y=e,x={x:o,y:u},E=t.pstyle("arrow-scale").value,w=this.getArrowWidth(a,E),T=f.arrowShapes[i];if(h){var C=f.arrowPathCache=f.arrowPathCache||[],N=Ws(i),A=C[N];A!=null?(m=e=A,p=!0):(m=e=new Path2D,C[N]=m)}p||(e.beginPath&&e.beginPath(),h?T.draw(e,1,0,{x:0,y:0},1):T.draw(e,w,d,x,a),e.closePath&&e.closePath()),e=y,h&&(e.translate(o,u),e.rotate(d),e.scale(w,w)),(r==="filled"||r==="both")&&(h?e.fill(m):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=s/(h?w:1),e.lineJoin="miter",h?e.stroke(m):e.stroke()),h&&(e.scale(1/w,1/w),e.rotate(-d),e.translate(-o,-u))};var uy={};uy.safeDrawImage=function(t,e,r,a,i,s,o,u,d,f){if(!(i<=0||s<=0||d<=0||f<=0))try{t.drawImage(e,r,a,i,s,o,u,d,f)}catch(h){At(h)}};uy.drawInscribedImage=function(t,e,r,a,i){var s=this,o=r.position(),u=o.x,d=o.y,f=r.cy().style(),h=f.getIndexedStyle.bind(f),p=h(r,"background-fit","value",a),m=h(r,"background-repeat","value",a),y=r.width(),x=r.height(),E=r.padding()*2,w=y+(h(r,"background-width-relative-to","value",a)==="inner"?0:E),T=x+(h(r,"background-height-relative-to","value",a)==="inner"?0:E),C=r._private.rscratch,N=h(r,"background-clip","value",a),A=N==="node",D=h(r,"background-image-opacity","value",a)*i,M=h(r,"background-image-smoothing","value",a),j=r.pstyle("corner-radius").value;j!=="auto"&&(j=r.pstyle("corner-radius").pfValue);var k=e.width||e.cachedW,R=e.height||e.cachedH;(k==null||R==null)&&(document.body.appendChild(e),k=e.cachedW=e.width||e.offsetWidth,R=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var z=k,B=R;if(h(r,"background-width","value",a)!=="auto"&&(h(r,"background-width","units",a)==="%"?z=h(r,"background-width","pfValue",a)*w:z=h(r,"background-width","pfValue",a)),h(r,"background-height","value",a)!=="auto"&&(h(r,"background-height","units",a)==="%"?B=h(r,"background-height","pfValue",a)*T:B=h(r,"background-height","pfValue",a)),!(z===0||B===0)){if(p==="contain"){var L=Math.min(w/z,T/B);z*=L,B*=L}else if(p==="cover"){var L=Math.max(w/z,T/B);z*=L,B*=L}var q=u-w/2,I=h(r,"background-position-x","units",a),Q=h(r,"background-position-x","pfValue",a);I==="%"?q+=(w-z)*Q:q+=Q;var _=h(r,"background-offset-x","units",a),V=h(r,"background-offset-x","pfValue",a);_==="%"?q+=(w-z)*V:q+=V;var F=d-T/2,K=h(r,"background-position-y","units",a),ee=h(r,"background-position-y","pfValue",a);K==="%"?F+=(T-B)*ee:F+=ee;var P=h(r,"background-offset-y","units",a),G=h(r,"background-offset-y","pfValue",a);P==="%"?F+=(T-B)*G:F+=G,C.pathCache&&(q-=u,F-=d,u=0,d=0);var Z=t.globalAlpha;t.globalAlpha=D;var J=s.getImgSmoothing(t),X=!1;if(M==="no"&&J?(s.setImgSmoothing(t,!1),X=!0):M==="yes"&&!J&&(s.setImgSmoothing(t,!0),X=!0),m==="no-repeat")A&&(t.save(),C.pathCache?t.clip(C.pathCache):(s.nodeShapes[s.getNodeShape(r)].draw(t,u,d,w,T,j,C),t.clip())),s.safeDrawImage(t,e,0,0,k,R,q,F,z,B),A&&t.restore();else{var Y=t.createPattern(e,m);t.fillStyle=Y,s.nodeShapes[s.getNodeShape(r)].draw(t,u,d,w,T,j,C),t.translate(q,F),t.fill(),t.translate(-q,-F)}t.globalAlpha=Z,X&&s.setImgSmoothing(t,J)}};var cl={};cl.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),i=Math.ceil($m(r*a));e=Math.pow(2,i)}var s=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(s<o)};cl.drawElementText=function(t,e,r,a,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(s&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var u=e.pstyle("label");if(!u||!u.value)return;var d=o.getLabelJustification(e);t.textAlign=d,t.textBaseline="bottom"}else{var f=e.element()._private.rscratch.badLine,h=e.pstyle("label"),p=e.pstyle("source-label"),m=e.pstyle("target-label");if(f||(!h||!h.value)&&(!p||!p.value)&&(!m||!m.value))return;t.textAlign="center",t.textBaseline="bottom"}var y=!r,x;r&&(x=r,t.translate(-x.x1,-x.y1)),i==null?(o.drawText(t,e,null,y,s),e.isEdge()&&(o.drawText(t,e,"source",y,s),o.drawText(t,e,"target",y,s))):o.drawText(t,e,i,y,s),r&&t.translate(x.x1,x.y1)};cl.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};cl.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue+"px",s=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,u=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,d=e.pstyle("text-outline-opacity").value*u,f=e.pstyle("color").value,h=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+i+" "+s,t.lineJoin="round",this.colorFillStyle(t,f[0],f[1],f[2],u),this.colorStrokeStyle(t,h[0],h[1],h[2],d)};function ZL(t,e,r,a,i){var s=Math.min(a,i),o=s/2,u=e+a/2,d=r+i/2;t.beginPath(),t.arc(u,d,o,0,Math.PI*2),t.closePath()}function uE(t,e,r,a,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(s,a/2,i/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+i-o),t.quadraticCurveTo(e+a,r+i,e+a-o,r+i),t.lineTo(e+o,r+i),t.quadraticCurveTo(e,r+i,e,r+i-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}cl.getTextAngle=function(t,e){var r,a=t._private,i=a.rscratch,s=e?e+"-":"",o=t.pstyle(s+"text-rotation");if(o.strValue==="autorotate"){var u=ga(i,"labelAngle",e);r=t.isEdge()?u:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};cl.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=e._private,o=s.rscratch,u=i?e.effectiveOpacity():1;if(!(i&&(u===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var d=ga(o,"labelX",r),f=ga(o,"labelY",r),h,p,m=this.getLabelText(e,r);if(m!=null&&m!==""&&!isNaN(d)&&!isNaN(f)){this.setupTextStyle(t,e,i);var y=r?r+"-":"",x=ga(o,"labelWidth",r),E=ga(o,"labelHeight",r),w=e.pstyle(y+"text-margin-x").pfValue,T=e.pstyle(y+"text-margin-y").pfValue,C=e.isEdge(),N=e.pstyle("text-halign").value,A=e.pstyle("text-valign").value;C&&(N="center",A="center"),d+=w,f+=T;var D;switch(a?D=this.getTextAngle(e,r):D=0,D!==0&&(h=d,p=f,t.translate(h,p),t.rotate(D),d=0,f=0),A){case"top":break;case"center":f+=E/2;break;case"bottom":f+=E;break}var M=e.pstyle("text-background-opacity").value,j=e.pstyle("text-border-opacity").value,k=e.pstyle("text-border-width").pfValue,R=e.pstyle("text-background-padding").pfValue,z=e.pstyle("text-background-shape").strValue,B=z==="round-rectangle"||z==="roundrectangle",L=z==="circle",q=2;if(M>0||k>0&&j>0){var I=t.fillStyle,Q=t.strokeStyle,_=t.lineWidth,V=e.pstyle("text-background-color").value,F=e.pstyle("text-border-color").value,K=e.pstyle("text-border-style").value,ee=M>0,P=k>0&&j>0,G=d-R;switch(N){case"left":G-=x;break;case"center":G-=x/2;break}var Z=f-E-R,J=x+2*R,X=E+2*R;if(ee&&(t.fillStyle="rgba(".concat(V[0],",").concat(V[1],",").concat(V[2],",").concat(M*u,")")),P&&(t.strokeStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(j*u,")"),t.lineWidth=k,t.setLineDash))switch(K){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=k/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(B?(t.beginPath(),uE(t,G,Z,J,X,q)):L?(t.beginPath(),ZL(t,G,Z,J,X)):(t.beginPath(),t.rect(G,Z,J,X)),ee&&t.fill(),P&&t.stroke(),P&&K==="double"){var Y=k/2;t.beginPath(),B?uE(t,G+Y,Z+Y,J-2*Y,X-2*Y,q):t.rect(G+Y,Z+Y,J-2*Y,X-2*Y),t.stroke()}t.fillStyle=I,t.strokeStyle=Q,t.lineWidth=_,t.setLineDash&&t.setLineDash([])}var le=2*e.pstyle("text-outline-width").pfValue;if(le>0&&(t.lineWidth=le),e.pstyle("text-wrap").value==="wrap"){var me=ga(o,"labelWrapCachedLines",r),oe=ga(o,"labelLineHeight",r),ae=x/2,re=this.getLabelJustification(e);switch(re==="auto"||(N==="left"?re==="left"?d+=-x:re==="center"&&(d+=-ae):N==="center"?re==="left"?d+=-ae:re==="right"&&(d+=ae):N==="right"&&(re==="center"?d+=ae:re==="right"&&(d+=x))),A){case"top":f-=(me.length-1)*oe;break;case"center":case"bottom":f-=(me.length-1)*oe;break}for(var se=0;se<me.length;se++)le>0&&t.strokeText(me[se],d,f),t.fillText(me[se],d,f),f+=oe}else le>0&&t.strokeText(m,d,f),t.fillText(m,d,f);D!==0&&(t.rotate(-D),t.translate(-h,-p))}}};var hs={};hs.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,u,d,f=e._private,h=f.rscratch,p=e.position();if(!(!De(p.x)||!De(p.y))&&!(s&&!e.visible())){var m=s?e.effectiveOpacity():1,y=o.usePaths(),x,E=!1,w=e.padding();u=e.width()+2*w,d=e.height()+2*w;var T;r&&(T=r,t.translate(-T.x1,-T.y1));for(var C=e.pstyle("background-image"),N=C.value,A=new Array(N.length),D=new Array(N.length),M=0,j=0;j<N.length;j++){var k=N[j],R=A[j]=k!=null&&k!=="none";if(R){var z=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",j);M++,D[j]=o.getCachedImage(k,z,function(){f.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var B=e.pstyle("background-blacken").value,L=e.pstyle("border-width").pfValue,q=e.pstyle("background-opacity").value*m,I=e.pstyle("border-color").value,Q=e.pstyle("border-style").value,_=e.pstyle("border-join").value,V=e.pstyle("border-cap").value,F=e.pstyle("border-position").value,K=e.pstyle("border-dash-pattern").pfValue,ee=e.pstyle("border-dash-offset").pfValue,P=e.pstyle("border-opacity").value*m,G=e.pstyle("outline-width").pfValue,Z=e.pstyle("outline-color").value,J=e.pstyle("outline-style").value,X=e.pstyle("outline-opacity").value*m,Y=e.pstyle("outline-offset").value,le=e.pstyle("corner-radius").value;le!=="auto"&&(le=e.pstyle("corner-radius").pfValue);var me=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;o.eleFillStyle(t,e,Re)},oe=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P;o.colorStrokeStyle(t,I[0],I[1],I[2],Re)},ae=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:X;o.colorStrokeStyle(t,Z[0],Z[1],Z[2],Re)},re=function(Re,we,$,ce){var pe=o.nodePathCache=o.nodePathCache||[],ve=fC($==="polygon"?$+","+ce.join(","):$,""+we,""+Re,""+le),Ee=pe[ve],Ue,je=!1;return Ee!=null?(Ue=Ee,je=!0,h.pathCache=Ue):(Ue=new Path2D,pe[ve]=h.pathCache=Ue),{path:Ue,cacheHit:je}},se=e.pstyle("shape").strValue,ie=e.pstyle("shape-polygon-points").pfValue;if(y){t.translate(p.x,p.y);var Ne=re(u,d,se,ie);x=Ne.path,E=Ne.cacheHit}var Ae=function(){if(!E){var Re=p;y&&(Re={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(x||t,Re.x,Re.y,u,d,le,h)}y?t.fill(x):t.fill()},Ze=function(){for(var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,$=f.backgrounding,ce=0,pe=0;pe<D.length;pe++){var ve=e.cy().style().getIndexedStyle(e,"background-image-containment","value",pe);if(we&&ve==="over"||!we&&ve==="inside"){ce++;continue}A[pe]&&D[pe].complete&&!D[pe].error&&(ce++,o.drawInscribedImage(t,D[pe],e,pe,Re))}f.backgrounding=ce!==M,$!==f.backgrounding&&e.updateStyle(!1)},Qe=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;o.hasPie(e)&&(o.drawPie(t,e,we),Re&&(y||o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,le,h)))},Se=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;o.hasStripe(e)&&(t.save(),y?t.clip(h.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,le,h),t.clip()),o.drawStripe(t,e,we),t.restore(),Re&&(y||o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,le,h)))},Oe=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,we=(B>0?B:-B)*Re,$=B>0?0:255;B!==0&&(o.colorFillStyle(t,$,$,$,we),y?t.fill(x):t.fill())},ke=function(){if(L>0){if(t.lineWidth=L,t.lineCap=V,t.lineJoin=_,t.setLineDash)switch(Q){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(K),t.lineDashOffset=ee;break;case"solid":case"double":t.setLineDash([]);break}if(F!=="center"){if(t.save(),t.lineWidth*=2,F==="inside")y?t.clip(x):t.clip();else{var Re=new Path2D;Re.rect(-u/2-L,-d/2-L,u+2*L,d+2*L),Re.addPath(x),t.clip(Re,"evenodd")}y?t.stroke(x):t.stroke(),t.restore()}else y?t.stroke(x):t.stroke();if(Q==="double"){t.lineWidth=L/3;var we=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(x):t.stroke(),t.globalCompositeOperation=we}t.setLineDash&&t.setLineDash([])}},Pe=function(){if(G>0){if(t.lineWidth=G,t.lineCap="butt",t.setLineDash)switch(J){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var Re=p;y&&(Re={x:0,y:0});var we=o.getNodeShape(e),$=L;F==="inside"&&($=0),F==="outside"&&($*=2);var ce=(u+$+(G+Y))/u,pe=(d+$+(G+Y))/d,ve=u*ce,Ee=d*pe,Ue=o.nodeShapes[we].points,je;if(y){var He=re(ve,Ee,we,Ue);je=He.path}if(we==="ellipse")o.drawEllipsePath(je||t,Re.x,Re.y,ve,Ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(we)){var _e=0,Ke=0,it=0;we==="round-diamond"?_e=($+Y+G)*1.4:we==="round-heptagon"?(_e=($+Y+G)*1.075,it=-($/2+Y+G)/35):we==="round-hexagon"?_e=($+Y+G)*1.12:we==="round-pentagon"?(_e=($+Y+G)*1.13,it=-($/2+Y+G)/15):we==="round-tag"?(_e=($+Y+G)*1.12,Ke=($/2+G+Y)*.07):we==="round-triangle"&&(_e=($+Y+G)*(Math.PI/2),it=-($+Y/2+G)/Math.PI),_e!==0&&(ce=(u+_e)/u,ve=u*ce,["round-hexagon","round-tag"].includes(we)||(pe=(d+_e)/d,Ee=d*pe)),le=le==="auto"?SC(ve,Ee):le;for(var st=ve/2,Ve=Ee/2,dt=le+($+G+Y)/2,ut=new Array(Ue.length/2),Yt=new Array(Ue.length/2),Ot=0;Ot<Ue.length/2;Ot++)ut[Ot]={x:Re.x+Ke+st*Ue[Ot*2],y:Re.y+it+Ve*Ue[Ot*2+1]};var Lr,Kt,sr,Jt,lr=ut.length;for(Kt=ut[lr-1],Lr=0;Lr<lr;Lr++)sr=ut[Lr%lr],Jt=ut[(Lr+1)%lr],Yt[Lr]=ly(Kt,sr,Jt,dt),Kt=sr,sr=Jt;o.drawRoundPolygonPath(je||t,Re.x+Ke,Re.y+it,u*ce,d*pe,Ue,Yt)}else if(["roundrectangle","round-rectangle"].includes(we))le=le==="auto"?ns(ve,Ee):le,o.drawRoundRectanglePath(je||t,Re.x,Re.y,ve,Ee,le+($+G+Y)/2);else if(["cutrectangle","cut-rectangle"].includes(we))le=le==="auto"?Xm():le,o.drawCutRectanglePath(je||t,Re.x,Re.y,ve,Ee,null,le+($+G+Y)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(we))le=le==="auto"?ns(ve,Ee):le,o.drawBottomRoundRectanglePath(je||t,Re.x,Re.y,ve,Ee,le+($+G+Y)/2);else if(we==="barrel")o.drawBarrelPath(je||t,Re.x,Re.y,ve,Ee);else if(we.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(we)){var Ra=($+G+Y)/u;Ue=qf(If(Ue,Ra)),o.drawPolygonPath(je||t,Re.x,Re.y,u,d,Ue)}else{var Xt=($+G+Y)/u;Ue=qf(If(Ue,-Xt)),o.drawPolygonPath(je||t,Re.x,Re.y,u,d,Ue)}if(y?t.stroke(je):t.stroke(),J==="double"){t.lineWidth=$/3;var Ba=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(je):t.stroke(),t.globalCompositeOperation=Ba}t.setLineDash&&t.setLineDash([])}},Ge=function(){i&&o.drawNodeOverlay(t,e,p,u,d)},Je=function(){i&&o.drawNodeUnderlay(t,e,p,u,d)},Be=function(){o.drawElementText(t,e,null,a)},nt=e.pstyle("ghost").value==="yes";if(nt){var ye=e.pstyle("ghost-offset-x").pfValue,$e=e.pstyle("ghost-offset-y").pfValue,et=e.pstyle("ghost-opacity").value,xe=et*m;t.translate(ye,$e),ae(),Pe(),me(et*q),Ae(),Ze(xe,!0),oe(et*P),ke(),Qe(B!==0||L!==0),Se(B!==0||L!==0),Ze(xe,!1),Oe(xe),t.translate(-ye,-$e)}y&&t.translate(-p.x,-p.y),Je(),y&&t.translate(p.x,p.y),ae(),Pe(),me(),Ae(),Ze(m,!0),oe(),ke(),Qe(B!==0||L!==0),Se(B!==0||L!==0),Ze(m,!1),Oe(),y&&t.translate(-p.x,-p.y),Be(),Ge(),r&&t.translate(T.x1,T.y1)}};var AN=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,i,s,o){var u=this;if(a.visible()){var d=a.pstyle("".concat(e,"-padding")).pfValue,f=a.pstyle("".concat(e,"-opacity")).value,h=a.pstyle("".concat(e,"-color")).value,p=a.pstyle("".concat(e,"-shape")).value,m=a.pstyle("".concat(e,"-corner-radius")).value;if(f>0){if(i=i||a.position(),s==null||o==null){var y=a.padding();s=a.width()+2*y,o=a.height()+2*y}u.colorFillStyle(r,h[0],h[1],h[2],f),u.nodeShapes[p].draw(r,i.x,i.y,s+d*2,o+d*2,m),r.fill()}}}};hs.drawNodeOverlay=AN("overlay");hs.drawNodeUnderlay=AN("underlay");hs.hasPie=function(t){return t=t[0],t._private.hasPie};hs.hasStripe=function(t){return t=t[0],t._private.hasStripe};hs.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var i=e.cy().style(),s=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),u=e.pstyle("pie-start-angle").pfValue,d=a.x,f=a.y,h=e.width(),p=e.height(),m=Math.min(h,p)/2,y,x=0,E=this.usePaths();if(E&&(d=0,f=0),s.units==="%"?m=m*s.pfValue:s.pfValue!==void 0&&(m=s.pfValue/2),o.units==="%"?y=m*o.pfValue:o.pfValue!==void 0&&(y=o.pfValue/2),!(y>=m))for(var w=1;w<=i.pieBackgroundN;w++){var T=e.pstyle("pie-"+w+"-background-size").value,C=e.pstyle("pie-"+w+"-background-color").value,N=e.pstyle("pie-"+w+"-background-opacity").value*r,A=T/100;A+x>1&&(A=1-x);var D=1.5*Math.PI+2*Math.PI*x;D+=u;var M=2*Math.PI*A,j=D+M;T===0||x>=1||x+A>1||(y===0?(t.beginPath(),t.moveTo(d,f),t.arc(d,f,m,D,j),t.closePath()):(t.beginPath(),t.arc(d,f,m,D,j),t.arc(d,f,y,j,D,!0),t.closePath()),this.colorFillStyle(t,C[0],C[1],C[2],N),t.fill(),x+=A)}};hs.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var i=e.cy().style(),s=a.x,o=a.y,u=e.width(),d=e.height(),f=0,h=this.usePaths();t.save();var p=e.pstyle("stripe-direction").value,m=e.pstyle("stripe-size");switch(p){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var y=u,x=d;m.units==="%"?(y=y*m.pfValue,x=x*m.pfValue):m.pfValue!==void 0&&(y=m.pfValue,x=m.pfValue),h&&(s=0,o=0),o-=y/2,s-=x/2;for(var E=1;E<=i.stripeBackgroundN;E++){var w=e.pstyle("stripe-"+E+"-background-size").value,T=e.pstyle("stripe-"+E+"-background-color").value,C=e.pstyle("stripe-"+E+"-background-opacity").value*r,N=w/100;N+f>1&&(N=1-f),!(w===0||f>=1||f+N>1)&&(t.beginPath(),t.rect(s,o+x*f,y,x*N),t.closePath(),this.colorFillStyle(t,T[0],T[1],T[2],C),t.fill(),f+=N)}t.restore()};var ia={},WL=100;ia.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};ia.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,i=0;i<e.length;i++)if(a=e[i],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};ia.createGradientStyleFor=function(t,e,r,a,i){var s,o=this.usePaths(),u=r.pstyle(e+"-gradient-stop-colors").value,d=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var f=r.sourceEndpoint(),h=r.targetEndpoint(),p=r.midpoint(),m=Js(f,p),y=Js(h,p);s=t.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(m,y))}else{var x=o?{x:0,y:0}:r.position(),E=r.paddedWidth(),w=r.paddedHeight();s=t.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(E,w))}else if(r.isEdge()){var T=r.sourceEndpoint(),C=r.targetEndpoint();s=t.createLinearGradient(T.x,T.y,C.x,C.y)}else{var N=o?{x:0,y:0}:r.position(),A=r.paddedWidth(),D=r.paddedHeight(),M=A/2,j=D/2,k=r.pstyle("background-gradient-direction").value;switch(k){case"to-bottom":s=t.createLinearGradient(N.x,N.y-j,N.x,N.y+j);break;case"to-top":s=t.createLinearGradient(N.x,N.y+j,N.x,N.y-j);break;case"to-left":s=t.createLinearGradient(N.x+M,N.y,N.x-M,N.y);break;case"to-right":s=t.createLinearGradient(N.x-M,N.y,N.x+M,N.y);break;case"to-bottom-right":case"to-right-bottom":s=t.createLinearGradient(N.x-M,N.y-j,N.x+M,N.y+j);break;case"to-top-right":case"to-right-top":s=t.createLinearGradient(N.x-M,N.y+j,N.x+M,N.y-j);break;case"to-bottom-left":case"to-left-bottom":s=t.createLinearGradient(N.x+M,N.y-j,N.x-M,N.y+j);break;case"to-top-left":case"to-left-top":s=t.createLinearGradient(N.x+M,N.y+j,N.x-M,N.y-j);break}}if(!s)return null;for(var R=d.length===u.length,z=u.length,B=0;B<z;B++)s.addColorStop(R?d[B]:B/(z-1),"rgba("+u[B][0]+","+u[B][1]+","+u[B][2]+","+i+")");return s};ia.gradientFillStyle=function(t,e,r,a){var i=this.createGradientStyleFor(t,"background",e,r,a);if(!i)return null;t.fillStyle=i};ia.colorFillStyle=function(t,e,r,a,i){t.fillStyle="rgba("+e+","+r+","+a+","+i+")"};ia.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var i=e.pstyle("background-color").value;this.colorFillStyle(t,i[0],i[1],i[2],r)}};ia.gradientStrokeStyle=function(t,e,r,a){var i=this.createGradientStyleFor(t,"line",e,r,a);if(!i)return null;t.strokeStyle=i};ia.colorStrokeStyle=function(t,e,r,a,i){t.strokeStyle="rgba("+e+","+r+","+a+","+i+")"};ia.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var i=e.pstyle("line-color").value;this.colorStrokeStyle(t,i[0],i[1],i[2],r)}};ia.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),i=a[2],s=a[3],o=e.getPixelRatio(),u=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=u);var d=i*o,f=s*o,h;if(!(d===e.canvasWidth&&f===e.canvasHeight)){e.fontCaches=null;var p=r.canvasContainer;p.style.width=i+"px",p.style.height=s+"px";for(var m=0;m<e.CANVAS_LAYERS;m++)h=r.canvases[m],h.width=d,h.height=f,h.style.width=i+"px",h.style.height=s+"px";for(var m=0;m<e.BUFFER_COUNT;m++)h=r.bufferCanvases[m],h.width=d,h.height=f,h.style.width=i+"px",h.style.height=s+"px";e.textureMult=1,o<=1&&(h=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,h.width=d*e.textureMult,h.height=f*e.textureMult),e.canvasWidth=d,e.canvasHeight=f,e.pixelRatio=o}};ia.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};ia.clearCanvas=function(){var t=this,e=t.data;function r(a){a.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};ia.render=function(t){var e=this;t=t||gC();var r=e.cy,a=t.forcedContext,i=t.drawAllLayers,s=t.drawOnlyNodeLayer,o=t.forcedZoom,u=t.forcedPan,d=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,f=e.data,h=f.canvasNeedsRedraw,p=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),m=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,y=e.motionBlurPxRatio,x=r.hasCompoundNodes(),E=e.hoverData.draggingEles,w=!!(e.hoverData.selecting||e.touchData.selecting);m=m&&!a&&e.motionBlurEnabled&&!w;var T=m;a||(e.prevPxRatio!==d&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=d),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),m&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(T=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!p&&(h[e.NODE]=!0,h[e.SELECT_BOX]=!0);var C=r.style(),N=r.zoom(),A=o!==void 0?o:N,D=r.pan(),M={x:D.x,y:D.y},j={zoom:N,pan:{x:D.x,y:D.y}},k=e.prevViewport,R=k===void 0||j.zoom!==k.zoom||j.pan.x!==k.pan.x||j.pan.y!==k.pan.y;!R&&!(E&&!x)&&(e.motionBlurPxRatio=1),u&&(M=u),A*=d,M.x*=d,M.y*=d;var z=e.getCachedZSortedEles();function B(oe,ae,re,se,ie){var Ne=oe.globalCompositeOperation;oe.globalCompositeOperation="destination-out",e.colorFillStyle(oe,255,255,255,e.motionBlurTransparency),oe.fillRect(ae,re,se,ie),oe.globalCompositeOperation=Ne}function L(oe,ae){var re,se,ie,Ne;!e.clearingMotionBlur&&(oe===f.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||oe===f.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(re={x:D.x*y,y:D.y*y},se=N*y,ie=e.canvasWidth*y,Ne=e.canvasHeight*y):(re=M,se=A,ie=e.canvasWidth,Ne=e.canvasHeight),oe.setTransform(1,0,0,1,0,0),ae==="motionBlur"?B(oe,0,0,ie,Ne):!a&&(ae===void 0||ae)&&oe.clearRect(0,0,ie,Ne),i||(oe.translate(re.x,re.y),oe.scale(se,se)),u&&oe.translate(u.x,u.y),o&&oe.scale(o,o)}if(p||(e.textureDrawLastFrame=!1),p){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var q=e.data.bufferContexts[e.TEXTURE_BUFFER];q.setTransform(1,0,0,1,0,0),q.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:q,drawOnlyNodeLayer:!0,forcedPxRatio:d*e.textureMult});var j=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};j.mpan={x:(0-j.pan.x)/j.zoom,y:(0-j.pan.y)/j.zoom}}h[e.DRAG]=!1,h[e.NODE]=!1;var I=f.contexts[e.NODE],Q=e.textureCache.texture,j=e.textureCache.viewport;I.setTransform(1,0,0,1,0,0),m?B(I,0,0,j.width,j.height):I.clearRect(0,0,j.width,j.height);var _=C.core("outside-texture-bg-color").value,V=C.core("outside-texture-bg-opacity").value;e.colorFillStyle(I,_[0],_[1],_[2],V),I.fillRect(0,0,j.width,j.height);var N=r.zoom();L(I,!1),I.clearRect(j.mpan.x,j.mpan.y,j.width/j.zoom/d,j.height/j.zoom/d),I.drawImage(Q,j.mpan.x,j.mpan.y,j.width/j.zoom/d,j.height/j.zoom/d)}else e.textureOnViewport&&!a&&(e.textureCache=null);var F=r.extent(),K=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),ee=e.hideEdgesOnViewport&&K,P=[];if(P[e.NODE]=!h[e.NODE]&&m&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,P[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),P[e.DRAG]=!h[e.DRAG]&&m&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,P[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),h[e.NODE]||i||s||P[e.NODE]){var G=m&&!P[e.NODE]&&y!==1,I=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:f.contexts[e.NODE]),Z=m&&!G?"motionBlur":void 0;L(I,Z),ee?e.drawCachedNodes(I,z.nondrag,d,F):e.drawLayeredElements(I,z.nondrag,d,F),e.debug&&e.drawDebugPoints(I,z.nondrag),!i&&!m&&(h[e.NODE]=!1)}if(!s&&(h[e.DRAG]||i||P[e.DRAG])){var G=m&&!P[e.DRAG]&&y!==1,I=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:f.contexts[e.DRAG]);L(I,m&&!G?"motionBlur":void 0),ee?e.drawCachedNodes(I,z.drag,d,F):e.drawCachedElements(I,z.drag,d,F),e.debug&&e.drawDebugPoints(I,z.drag),!i&&!m&&(h[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,L),m&&y!==1){var J=f.contexts[e.NODE],X=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Y=f.contexts[e.DRAG],le=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],me=function(ae,re,se){ae.setTransform(1,0,0,1,0,0),se||!T?ae.clearRect(0,0,e.canvasWidth,e.canvasHeight):B(ae,0,0,e.canvasWidth,e.canvasHeight);var ie=y;ae.drawImage(re,0,0,e.canvasWidth*ie,e.canvasHeight*ie,0,0,e.canvasWidth,e.canvasHeight)};(h[e.NODE]||P[e.NODE])&&(me(J,X,P[e.NODE]),h[e.NODE]=!1),(h[e.DRAG]||P[e.DRAG])&&(me(Y,le,P[e.DRAG]),h[e.DRAG]=!1)}e.prevViewport=j,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),m&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!p,e.mbFrames=0,h[e.NODE]=!0,h[e.DRAG]=!0,e.redraw()},WL)),a||r.emit("render")};var Pu;ia.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,i=r.data,s=a.style(),o=t.drawOnlyNodeLayer,u=t.drawAllLayers,d=i.canvasNeedsRedraw,f=t.forcedContext;if(r.showFps||!o&&d[r.SELECT_BOX]&&!u){var h=f||i.contexts[r.SELECT_BOX];if(e(h),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var p=r.cy.zoom(),m=s.core("selection-box-border-width").value/p;h.lineWidth=m,h.fillStyle="rgba("+s.core("selection-box-color").value[0]+","+s.core("selection-box-color").value[1]+","+s.core("selection-box-color").value[2]+","+s.core("selection-box-opacity").value+")",h.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),m>0&&(h.strokeStyle="rgba("+s.core("selection-box-border-color").value[0]+","+s.core("selection-box-border-color").value[1]+","+s.core("selection-box-border-color").value[2]+","+s.core("selection-box-opacity").value+")",h.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(i.bgActivePosistion&&!r.hoverData.selecting){var p=r.cy.zoom(),y=i.bgActivePosistion;h.fillStyle="rgba("+s.core("active-bg-color").value[0]+","+s.core("active-bg-color").value[1]+","+s.core("active-bg-color").value[2]+","+s.core("active-bg-opacity").value+")",h.beginPath(),h.arc(y.x,y.y,s.core("active-bg-size").pfValue/p,0,2*Math.PI),h.fill()}var x=r.lastRedrawTime;if(r.showFps&&x){x=Math.round(x);var E=Math.round(1e3/x),w="1 frame = "+x+" ms = "+E+" fps";if(h.setTransform(1,0,0,1,0,0),h.fillStyle="rgba(255, 0, 0, 0.75)",h.strokeStyle="rgba(255, 0, 0, 0.75)",h.font="30px Arial",!Pu){var T=h.measureText(w);Pu=T.actualBoundingBoxAscent}h.fillText(w,0,Pu);var C=60;h.strokeRect(0,Pu+10,250,20),h.fillRect(0,Pu+10,250*Math.min(E/C,1),20)}u||(d[r.SELECT_BOX]=!1)}};function cE(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function JL(t,e,r){var a=cE(t,t.VERTEX_SHADER,e),i=cE(t,t.FRAGMENT_SHADER,r),s=t.createProgram();if(t.attachShader(s,a),t.attachShader(s,i),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw new Error("Could not initialize shaders");return s}function eP(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),i=a.context=a.getContext("2d");return a.clear=function(){return i.clearRect(0,0,a.width,a.height)},a.clear(),a}function cy(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function tP(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function rP(t,e,r,a,i){var s=a*r+e.x,o=i*r+e.y;return o=Math.round(t.canvasHeight-o),[s,o]}function aP(t){return t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function nP(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function Rs(t,e,r){var a=t[0]/255,i=t[1]/255,s=t[2]/255,o=e,u=r||new Array(4);return u[0]=a*o,u[1]=i*o,u[2]=s*o,u[3]=o,u}function Wl(t,e){var r=e||new Array(4);return r[0]=(t>>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function iP(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function sP(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function MN(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function kN(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function lP(t,e,r,a,i,s){switch(e){case t.FLOAT:return new Float32Array(r.buffer,s*a,i);case t.INT:return new Int32Array(r.buffer,s*a,i)}}function oP(t,e,r,a){var i=MN(t,e),s=mr(i,2),o=s[0],u=s[1],d=kN(t,u,a),f=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,f),t.bufferData(t.ARRAY_BUFFER,d,t.STATIC_DRAW),u===t.FLOAT?t.vertexAttribPointer(r,o,u,!1,0,0):u===t.INT&&t.vertexAttribIPointer(r,o,u,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),f}function gn(t,e,r,a){var i=MN(t,r),s=mr(i,3),o=s[0],u=s[1],d=s[2],f=kN(t,u,e*o),h=o*d,p=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,p),t.bufferData(t.ARRAY_BUFFER,e*h,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),u===t.FLOAT?t.vertexAttribPointer(a,o,u,!1,h,0):u===t.INT&&t.vertexAttribIPointer(a,o,u,h,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var m=new Array(e),y=0;y<e;y++)m[y]=lP(t,u,f,h,o,y);return p.dataArray=f,p.stride=h,p.size=o,p.getView=function(x){return m[x]},p.setPoint=function(x,E,w){var T=m[x];T[0]=E,T[1]=w},p.bufferSubData=function(x){t.bindBuffer(t.ARRAY_BUFFER,p),x?t.bufferSubData(t.ARRAY_BUFFER,0,f,0,x*o):t.bufferSubData(t.ARRAY_BUFFER,0,f)},p}function uP(t,e,r){for(var a=9,i=new Float32Array(e*a),s=new Array(e),o=0;o<e;o++){var u=o*a*4;s[o]=new Float32Array(i.buffer,u,a)}var d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,i.byteLength,t.DYNAMIC_DRAW);for(var f=0;f<3;f++){var h=r+f;t.enableVertexAttribArray(h),t.vertexAttribPointer(h,3,t.FLOAT,!1,36,f*12),t.vertexAttribDivisor(h,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),d.getMatrixView=function(p){return s[p]},d.setData=function(p,m){s[m].set(p,0)},d.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferSubData(t.ARRAY_BUFFER,0,i)},d}function cP(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,i){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,a,i,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var dE=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function vg(){var t=new dE(9);return dE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function fE(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function dP(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=r[0],y=r[1],x=r[2],E=r[3],w=r[4],T=r[5],C=r[6],N=r[7],A=r[8];return t[0]=m*a+y*o+x*f,t[1]=m*i+y*u+x*h,t[2]=m*s+y*d+x*p,t[3]=E*a+w*o+T*f,t[4]=E*i+w*u+T*h,t[5]=E*s+w*d+T*p,t[6]=C*a+N*o+A*f,t[7]=C*i+N*u+A*h,t[8]=C*s+N*d+A*p,t}function kf(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=r[0],y=r[1];return t[0]=a,t[1]=i,t[2]=s,t[3]=o,t[4]=u,t[5]=d,t[6]=m*a+y*o+f,t[7]=m*i+y*u+h,t[8]=m*s+y*d+p,t}function hE(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=Math.sin(r),y=Math.cos(r);return t[0]=y*a+m*o,t[1]=y*i+m*u,t[2]=y*s+m*d,t[3]=y*o-m*a,t[4]=y*u-m*i,t[5]=y*d-m*s,t[6]=f,t[7]=h,t[8]=p,t}function fm(t,e,r){var a=r[0],i=r[1];return t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function fP(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var hP=(function(){function t(e,r,a,i){cs(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(e,r,r),this.scratch=i(e,r,this.texHeight,"scratch")}return ds(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var a=r.w,i=r.h,s=this.texHeight,o=this.texSize,u=s/i,d=a*u,f=i*u;return d>o&&(u=o/a,d=a*u,f=i*u),{scale:u,texW:d,texH:f}}},{key:"draw",value:function(r,a,i){var s=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,u=this.texRows,d=this.texHeight,f=this.getScale(a),h=f.scale,p=f.texW,m=f.texH,y=function(N,A){if(i&&A){var D=A.context,M=N.x,j=N.row,k=M,R=d*j;D.save(),D.translate(k,R),D.scale(h,h),i(D,a),D.restore()}},x=[null,null],E=function(){y(s.freePointer,s.canvas),x[0]={x:s.freePointer.x,y:s.freePointer.row*d,w:p,h:m},x[1]={x:s.freePointer.x+p,y:s.freePointer.row*d,w:0,h:m},s.freePointer.x+=p,s.freePointer.x==o&&(s.freePointer.x=0,s.freePointer.row++)},w=function(){var N=s.scratch,A=s.canvas;N.clear(),y({x:0,row:0},N);var D=o-s.freePointer.x,M=p-D,j=d;{var k=s.freePointer.x,R=s.freePointer.row*d,z=D;A.context.drawImage(N,0,0,z,j,k,R,z,j),x[0]={x:k,y:R,w:z,h:m}}{var B=D,L=(s.freePointer.row+1)*d,q=M;A&&A.context.drawImage(N,B,0,q,j,0,L,q,j),x[1]={x:0,y:L,w:q,h:m}}s.freePointer.x=M,s.freePointer.row++},T=function(){s.freePointer.x=0,s.freePointer.row++};if(this.freePointer.x+p<=o)E();else{if(this.freePointer.row>=u-1)return!1;this.freePointer.x===o?(T(),E()):this.enableWrapping?w():(T(),E())}return this.keyToLocation.set(r,x),this.needsBuffer=!0,x}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,i=this.texRows,s=this.getScale(r),o=s.texW;return this.freePointer.x+o>a?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=sP(r,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),vP=(function(){function t(e,r,a,i){cs(this,t),this.r=e,this.texSize=r,this.texRows=a,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return ds(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,a=this.texSize,i=this.texRows,s=this.createTextureCanvas;return new hP(r,a,i,s)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.texSize,i=this.texRows,s=this.createTextureCanvas,o=Math.floor(a/i);this.scratch=s(r,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,i){var s=this.styleKeyToAtlas.get(r);return s||(s=this.atlases[this.atlases.length-1],(!s||!s.canFit(a))&&(s&&s.lock(),s=this._createAtlas(),this.atlases.push(s)),s.draw(r,a,i),this.styleKeyToAtlas.set(r,s)),s}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var i=[],s=new Map,o=null,u=xa(this.atlases),d;try{var f=function(){var p=d.value,m=p.getKeys(),y=pP(a,m);if(y.size===0)return i.push(p),m.forEach(function(D){return s.set(D,p)}),1;o||(o=r._createAtlas(),i.push(o));var x=xa(m),E;try{for(x.s();!(E=x.n()).done;){var w=E.value;if(!y.has(w)){var T=p.getOffsets(w),C=mr(T,2),N=C[0],A=C[1];o.canFit({w:N.w+A.w,h:N.h})||(o.lock(),o=r._createAtlas(),i.push(o)),p.canvas&&(r._copyTextureToNewAtlas(w,p,o),s.set(w,o))}}}catch(D){x.e(D)}finally{x.f()}p.dispose()};for(u.s();!(d=u.n()).done;)f()}catch(h){u.e(h)}finally{u.f()}this.atlases=i,this.styleKeyToAtlas=s,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,a,i){var s=a.getOffsets(r),o=mr(s,2),u=o[0],d=o[1];if(d.w===0)i.draw(r,u,function(m){m.drawImage(a.canvas,u.x,u.y,u.w,u.h,0,0,u.w,u.h)});else{var f=this._getScratchCanvas();f.clear(),f.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,0,0,u.w,u.h),f.context.drawImage(a.canvas,d.x,d.y,d.w,d.h,u.w,0,d.w,d.h);var h=u.w+d.w,p=u.h;i.draw(r,{w:h,h:p},function(m){m.drawImage(f,0,0,h,p,0,0,h,p)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function pP(t,e){return t.intersection?t.intersection(e):new Set(Pf(t).filter(function(r){return e.has(r)}))}var gP=(function(){function t(e,r){cs(this,t),this.r=e,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return ds(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,a){var i=this.globalOptions,s=i.webglTexSize,o=i.createTextureCanvas,u=a.texRows,d=this._cacheScratchCanvas(o),f=new vP(this.r,s,u,d);this.collections.set(r,f)}},{key:"addRenderType",value:function(r,a){var i=a.collection;if(!this.collections.has(i))throw new Error("invalid atlas collection name '".concat(i,"'"));var s=this.collections.get(i),o=tt({type:r,atlasCollection:s},a);this.renderTypes.set(r,o)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var a=-1,i=-1,s=null;return function(o,u,d,f){return f?((!s||u!=a||d!=i)&&(a=u,i=d,s=r(o,u,d)),s):r(o,u,d)}}},{key:"_key",value:function(r,a){return"".concat(r,"-").concat(a)}},{key:"invalidate",value:function(r){var a=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.forceRedraw,o=s===void 0?!1:s,u=i.filterEle,d=u===void 0?function(){return!0}:u,f=i.filterType,h=f===void 0?function(){return!0}:f,p=!1,m=!1,y=xa(r),x;try{for(y.s();!(x=y.n()).done;){var E=x.value;if(d(E)){var w=xa(this.renderTypes.values()),T;try{var C=function(){var A=T.value,D=A.type;if(h(D)){var M=a.collections.get(A.collection),j=A.getKey(E),k=Array.isArray(j)?j:[j];if(o)k.forEach(function(L){return M.markKeyForGC(L)}),m=!0;else{var R=A.getID?A.getID(E):E.id(),z=a._key(D,R),B=a.typeAndIdToKey.get(z);B!==void 0&&!nP(k,B)&&(p=!0,a.typeAndIdToKey.delete(z),B.forEach(function(L){return M.markKeyForGC(L)}))}}};for(w.s();!(T=w.n()).done;)C()}catch(N){w.e(N)}finally{w.f()}}}}catch(N){y.e(N)}finally{y.f()}return m&&(this.gc(),p=!1),p}},{key:"gc",value:function(){var r=xa(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var i=a.value;i.gc()}}catch(s){r.e(s)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,i,s){var o=this.renderTypes.get(a),u=this.collections.get(o.collection),d=!1,f=u.draw(s,i,function(m){o.drawClipped?(m.save(),m.beginPath(),m.rect(0,0,i.w,i.h),m.clip(),o.drawElement(m,r,i,!0,!0),m.restore()):o.drawElement(m,r,i,!0,!0),d=!0});if(d){var h=o.getID?o.getID(r):r.id(),p=this._key(a,h);this.typeAndIdToKey.has(p)?this.typeAndIdToKey.get(p).push(s):this.typeAndIdToKey.set(p,[s])}return f}},{key:"getAtlasInfo",value:function(r,a){var i=this,s=this.renderTypes.get(a),o=s.getKey(r),u=Array.isArray(o)?o:[o];return u.map(function(d){var f=s.getBoundingBox(r,d),h=i.getOrCreateAtlas(r,a,f,d),p=h.getOffsets(d),m=mr(p,2),y=m[0],x=m[1];return{atlas:h,tex:y,tex1:y,tex2:x,bb:f}})}},{key:"getDebugInfo",value:function(){var r=[],a=xa(this.collections),i;try{for(a.s();!(i=a.n()).done;){var s=mr(i.value,2),o=s[0],u=s[1],d=u.getCounts(),f=d.keyCount,h=d.atlasCount;r.push({type:o,keyCount:f,atlasCount:h})}}catch(p){a.e(p)}finally{a.f()}return r}}])})(),mP=(function(){function t(e){cs(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return ds(t,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])})(),yP=`
96
- float circleSD(vec2 p, float r) {
97
- return distance(vec2(0), p) - r; // signed distance
98
- }
99
- `,xP=`
100
- float rectangleSD(vec2 p, vec2 b) {
101
- vec2 d = abs(p)-b;
102
- return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
103
- }
104
- `,bP=`
105
- float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
106
- cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
107
- cr.x = (p.y > 0.0) ? cr.x : cr.y;
108
- vec2 q = abs(p) - b + cr.x;
109
- return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
110
- }
111
- `,wP=`
112
- float ellipseSD(vec2 p, vec2 ab) {
113
- p = abs( p ); // symmetry
114
-
115
- // find root with Newton solver
116
- vec2 q = ab*(p-ab);
117
- float w = (q.x<q.y)? 1.570796327 : 0.0;
118
- for( int i=0; i<5; i++ ) {
119
- vec2 cs = vec2(cos(w),sin(w));
120
- vec2 u = ab*vec2( cs.x,cs.y);
121
- vec2 v = ab*vec2(-cs.y,cs.x);
122
- w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
123
- }
124
-
125
- // compute final point and distance
126
- float d = length(p-ab*vec2(cos(w),sin(w)));
127
-
128
- // return signed distance
129
- return (dot(p/ab,p/ab)>1.0) ? d : -d;
130
- }
131
- `,Qu={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Yf={IGNORE:1,USE_BB:2},pg=0,vE=1,pE=2,gg=3,Jl=4,hf=5,zu=6,_u=7,SP=(function(){function t(e,r,a){cs(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=eP,this.atlasManager=new gP(e,a),this.batchManager=new mP(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Qu.SCREEN),this.pickingProgram=this._createShaderProgram(Qu.PICKING),this.vao=this._createVAO()}return ds(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.type,s=this.atlasManager;return i?s.invalidate(r,{filterType:function(u){return u===i},forceRedraw:!0}):s.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,i=`#version 300 es
132
- precision highp float;
133
-
134
- uniform mat3 uPanZoomMatrix;
135
- uniform int uAtlasSize;
136
-
137
- // instanced
138
- in vec2 aPosition; // a vertex from the unit square
139
-
140
- in mat3 aTransform; // used to transform verticies, eg into a bounding box
141
- in int aVertType; // the type of thing we are rendering
142
-
143
- // the z-index that is output when using picking mode
144
- in vec4 aIndex;
145
-
146
- // For textures
147
- in int aAtlasId; // which shader unit/atlas to use
148
- in vec4 aTex; // x/y/w/h of texture in atlas
149
-
150
- // for edges
151
- in vec4 aPointAPointB;
152
- in vec4 aPointCPointD;
153
- in vec2 aLineWidth; // also used for node border width
154
-
155
- // simple shapes
156
- in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
157
- in vec4 aColor; // also used for edges
158
- in vec4 aBorderColor; // aLineWidth is used for border width
159
-
160
- // output values passed to the fragment shader
161
- out vec2 vTexCoord;
162
- out vec4 vColor;
163
- out vec2 vPosition;
164
- // flat values are not interpolated
165
- flat out int vAtlasId;
166
- flat out int vVertType;
167
- flat out vec2 vTopRight;
168
- flat out vec2 vBotLeft;
169
- flat out vec4 vCornerRadius;
170
- flat out vec4 vBorderColor;
171
- flat out vec2 vBorderWidth;
172
- flat out vec4 vIndex;
173
-
174
- void main(void) {
175
- int vid = gl_VertexID;
176
- vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
177
-
178
- if(aVertType == `.concat(pg,`) {
179
- float texX = aTex.x; // texture coordinates
180
- float texY = aTex.y;
181
- float texW = aTex.z;
182
- float texH = aTex.w;
183
-
184
- if(vid == 1 || vid == 2 || vid == 4) {
185
- texX += texW;
186
- }
187
- if(vid == 2 || vid == 4 || vid == 5) {
188
- texY += texH;
189
- }
190
-
191
- float d = float(uAtlasSize);
192
- vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
193
-
194
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
195
- }
196
- else if(aVertType == `).concat(Jl," || aVertType == ").concat(_u,`
197
- || aVertType == `).concat(hf," || aVertType == ").concat(zu,`) { // simple shapes
198
-
199
- // the bounding box is needed by the fragment shader
200
- vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
201
- vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
202
- vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
203
-
204
- // calculations are done in the fragment shader, just pass these along
205
- vColor = aColor;
206
- vCornerRadius = aCornerRadius;
207
- vBorderColor = aBorderColor;
208
- vBorderWidth = aLineWidth;
209
-
210
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
211
- }
212
- else if(aVertType == `).concat(vE,`) {
213
- vec2 source = aPointAPointB.xy;
214
- vec2 target = aPointAPointB.zw;
215
-
216
- // adjust the geometry so that the line is centered on the edge
217
- position.y = position.y - 0.5;
218
-
219
- // stretch the unit square into a long skinny rectangle
220
- vec2 xBasis = target - source;
221
- vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
222
- vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
223
-
224
- gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
225
- vColor = aColor;
226
- }
227
- else if(aVertType == `).concat(pE,`) {
228
- vec2 pointA = aPointAPointB.xy;
229
- vec2 pointB = aPointAPointB.zw;
230
- vec2 pointC = aPointCPointD.xy;
231
- vec2 pointD = aPointCPointD.zw;
232
-
233
- // adjust the geometry so that the line is centered on the edge
234
- position.y = position.y - 0.5;
235
-
236
- vec2 p0, p1, p2, pos;
237
- if(position.x == 0.0) { // The left side of the unit square
238
- p0 = pointA;
239
- p1 = pointB;
240
- p2 = pointC;
241
- pos = position;
242
- } else { // The right side of the unit square, use same approach but flip the geometry upside down
243
- p0 = pointD;
244
- p1 = pointC;
245
- p2 = pointB;
246
- pos = vec2(0.0, -position.y);
247
- }
248
-
249
- vec2 p01 = p1 - p0;
250
- vec2 p12 = p2 - p1;
251
- vec2 p21 = p1 - p2;
252
-
253
- // Find the normal vector.
254
- vec2 tangent = normalize(normalize(p12) + normalize(p01));
255
- vec2 normal = vec2(-tangent.y, tangent.x);
256
-
257
- // Find the vector perpendicular to p0 -> p1.
258
- vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
259
-
260
- // Determine the bend direction.
261
- float sigma = sign(dot(p01 + p21, normal));
262
- float width = aLineWidth[0];
263
-
264
- if(sign(pos.y) == -sigma) {
265
- // This is an intersecting vertex. Adjust the position so that there's no overlap.
266
- vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
267
- gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
268
- } else {
269
- // This is a non-intersecting vertex. Treat it like a mitre join.
270
- vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
271
- gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
272
- }
273
-
274
- vColor = aColor;
275
- }
276
- else if(aVertType == `).concat(gg,` && vid < 3) {
277
- // massage the first triangle into an edge arrow
278
- if(vid == 0)
279
- position = vec2(-0.15, -0.3);
280
- if(vid == 1)
281
- position = vec2( 0.0, 0.0);
282
- if(vid == 2)
283
- position = vec2( 0.15, -0.3);
284
-
285
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
286
- vColor = aColor;
287
- }
288
- else {
289
- gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
290
- }
291
-
292
- vAtlasId = aAtlasId;
293
- vVertType = aVertType;
294
- vIndex = aIndex;
295
- }
296
- `),s=this.batchManager.getIndexArray(),o=`#version 300 es
297
- precision highp float;
298
-
299
- // declare texture unit for each texture atlas in the batch
300
- `.concat(s.map(function(f){return"uniform sampler2D uTexture".concat(f,";")}).join(`
301
- `),`
302
-
303
- uniform vec4 uBGColor;
304
- uniform float uZoom;
305
-
306
- in vec2 vTexCoord;
307
- in vec4 vColor;
308
- in vec2 vPosition; // model coordinates
309
-
310
- flat in int vAtlasId;
311
- flat in vec4 vIndex;
312
- flat in int vVertType;
313
- flat in vec2 vTopRight;
314
- flat in vec2 vBotLeft;
315
- flat in vec4 vCornerRadius;
316
- flat in vec4 vBorderColor;
317
- flat in vec2 vBorderWidth;
318
-
319
- out vec4 outColor;
320
-
321
- `).concat(yP,`
322
- `).concat(xP,`
323
- `).concat(bP,`
324
- `).concat(wP,`
325
-
326
- vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
327
- return vec4(
328
- top.rgb + (bot.rgb * (1.0 - top.a)),
329
- top.a + (bot.a * (1.0 - top.a))
330
- );
331
- }
332
-
333
- vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
334
- // scale to the zoom level so that borders don't look blurry when zoomed in
335
- // note 1.5 is an aribitrary value chosen because it looks good
336
- return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
337
- }
338
-
339
- void main(void) {
340
- if(vVertType == `).concat(pg,`) {
341
- // look up the texel from the texture unit
342
- `).concat(s.map(function(f){return"if(vAtlasId == ".concat(f,") outColor = texture(uTexture").concat(f,", vTexCoord);")}).join(`
343
- else `),`
344
- }
345
- else if(vVertType == `).concat(gg,`) {
346
- // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
347
- outColor = blend(vColor, uBGColor);
348
- outColor.a = 1.0; // make opaque, masks out line under arrow
349
- }
350
- else if(vVertType == `).concat(Jl,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
351
- outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
352
- }
353
- else if(vVertType == `).concat(Jl," || vVertType == ").concat(_u,`
354
- || vVertType == `).concat(hf," || vVertType == ").concat(zu,`) { // use SDF
355
-
356
- float outerBorder = vBorderWidth[0];
357
- float innerBorder = vBorderWidth[1];
358
- float borderPadding = outerBorder * 2.0;
359
- float w = vTopRight.x - vBotLeft.x - borderPadding;
360
- float h = vTopRight.y - vBotLeft.y - borderPadding;
361
- vec2 b = vec2(w/2.0, h/2.0); // half width, half height
362
- vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
363
-
364
- float d; // signed distance
365
- if(vVertType == `).concat(Jl,`) {
366
- d = rectangleSD(p, b);
367
- } else if(vVertType == `).concat(_u,` && w == h) {
368
- d = circleSD(p, b.x); // faster than ellipse
369
- } else if(vVertType == `).concat(_u,`) {
370
- d = ellipseSD(p, b);
371
- } else {
372
- d = roundRectangleSD(p, b, vCornerRadius.wzyx);
373
- }
374
-
375
- // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
376
- // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
377
- if(d > 0.0) {
378
- if(d > outerBorder) {
379
- discard;
380
- } else {
381
- outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
382
- }
383
- } else {
384
- if(d > innerBorder) {
385
- vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
386
- vec4 innerBorderColor = blend(vBorderColor, vColor);
387
- outColor = distInterp(innerBorderColor, outerColor, d);
388
- }
389
- else {
390
- vec4 outerColor;
391
- if(innerBorder == 0.0 && outerBorder == 0.0) {
392
- outerColor = vec4(0);
393
- } else if(innerBorder == 0.0) {
394
- outerColor = vBorderColor;
395
- } else {
396
- outerColor = blend(vBorderColor, vColor);
397
- }
398
- outColor = distInterp(vColor, outerColor, d - innerBorder);
399
- }
400
- }
401
- }
402
- else {
403
- outColor = vColor;
404
- }
405
-
406
- `).concat(r.picking?`if(outColor.a == 0.0) discard;
407
- else outColor = vIndex;`:"",`
408
- }
409
- `),u=JL(a,i,o);u.aPosition=a.getAttribLocation(u,"aPosition"),u.aIndex=a.getAttribLocation(u,"aIndex"),u.aVertType=a.getAttribLocation(u,"aVertType"),u.aTransform=a.getAttribLocation(u,"aTransform"),u.aAtlasId=a.getAttribLocation(u,"aAtlasId"),u.aTex=a.getAttribLocation(u,"aTex"),u.aPointAPointB=a.getAttribLocation(u,"aPointAPointB"),u.aPointCPointD=a.getAttribLocation(u,"aPointCPointD"),u.aLineWidth=a.getAttribLocation(u,"aLineWidth"),u.aColor=a.getAttribLocation(u,"aColor"),u.aCornerRadius=a.getAttribLocation(u,"aCornerRadius"),u.aBorderColor=a.getAttribLocation(u,"aBorderColor"),u.uPanZoomMatrix=a.getUniformLocation(u,"uPanZoomMatrix"),u.uAtlasSize=a.getUniformLocation(u,"uAtlasSize"),u.uBGColor=a.getUniformLocation(u,"uBGColor"),u.uZoom=a.getUniformLocation(u,"uZoom"),u.uTextures=[];for(var d=0;d<this.batchManager.getMaxAtlasesPerBatch();d++)u.uTextures.push(a.getUniformLocation(u,"uTexture".concat(d)));return u}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var a=this.maxInstances,i=this.gl,s=this.program,o=i.createVertexArray();return i.bindVertexArray(o),oP(i,"vec2",s.aPosition,r),this.transformBuffer=uP(i,a,s.aTransform),this.indexBuffer=gn(i,a,"vec4",s.aIndex),this.vertTypeBuffer=gn(i,a,"int",s.aVertType),this.atlasIdBuffer=gn(i,a,"int",s.aAtlasId),this.texBuffer=gn(i,a,"vec4",s.aTex),this.pointAPointBBuffer=gn(i,a,"vec4",s.aPointAPointB),this.pointCPointDBuffer=gn(i,a,"vec4",s.aPointCPointD),this.lineWidthBuffer=gn(i,a,"vec2",s.aLineWidth),this.colorBuffer=gn(i,a,"vec4",s.aColor),this.cornerRadiusBuffer=gn(i,a,"vec4",s.aCornerRadius),this.borderColorBuffer=gn(i,a,"vec4",s.aBorderColor),i.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return Yi(a,"Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qu.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,i){var s=this.atlasManager,o=this.batchManager,u=s.getRenderTypeOpts(i);if(this._isVisible(r,u)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&u.getTexPickingMode){var d=u.getTexPickingMode(r);if(d===Yf.IGNORE)return;if(d==Yf.USE_BB){this.drawPickingRectangle(r,a,i);return}}var f=s.getAtlasInfo(r,i),h=xa(f),p;try{for(h.s();!(p=h.n()).done;){var m=p.value,y=m.atlas,x=m.tex1,E=m.tex2;o.canAddToCurrentBatch(y)||this.endBatch();for(var w=o.getAtlasIndexForBatch(y),T=0,C=[[x,!0],[E,!1]];T<C.length;T++){var N=mr(C[T],2),A=N[0],D=N[1];if(A.w!=0){var M=this.instanceCount;this.vertTypeBuffer.getView(M)[0]=pg;var j=this.indexBuffer.getView(M);Wl(a,j);var k=this.atlasIdBuffer.getView(M);k[0]=w;var R=this.texBuffer.getView(M);R[0]=A.x,R[1]=A.y,R[2]=A.w,R[3]=A.h;var z=this.transformBuffer.getMatrixView(M);this.setTransformMatrix(r,z,u,m,D),this.instanceCount++,D||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(B){h.e(B)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(r,a,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,u=0;if(i.shapeProps&&i.shapeProps.padding&&(u=r.pstyle(i.shapeProps.padding).pfValue),s){var d=s.bb,f=s.tex1,h=s.tex2,p=f.w/(f.w+h.w);o||(p=1-p);var m=this._getAdjustedBB(d,u,o,p);this._applyTransformMatrix(a,m,i,r)}else{var y=i.getBoundingBox(r),x=this._getAdjustedBB(y,u,!0,1);this._applyTransformMatrix(a,x,i,r)}}},{key:"_applyTransformMatrix",value:function(r,a,i,s){var o,u;fE(r);var d=i.getRotation?i.getRotation(s):0;if(d!==0){var f=i.getRotationPoint(s),h=f.x,p=f.y;kf(r,r,[h,p]),hE(r,r,d);var m=i.getRotationOffset(s);o=m.x+(a.xOffset||0),u=m.y+(a.yOffset||0)}else o=a.x1,u=a.y1;kf(r,r,[o,u]),fm(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,i,s){var o=r.x1,u=r.y1,d=r.w,f=r.h,h=r.yOffset;a&&(o-=a,u-=a,d+=2*a,f+=2*a);var p=0,m=d*s;return i&&s<1?d=m:!i&&s<1&&(p=d-m,o+=p,d=m),{x1:o,y1:u,w:d,h:f,xOffset:p,yOffset:h}}},{key:"drawPickingRectangle",value:function(r,a,i){var s=this.atlasManager.getRenderTypeOpts(i),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Jl;var u=this.indexBuffer.getView(o);Wl(a,u);var d=this.colorBuffer.getView(o);Rs([0,0,0],1,d);var f=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,f,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,i){var s=this.simpleShapeOptions.get(i);if(this._isVisible(r,s)){var o=s.shapeProps,u=this._getVertTypeForShape(r,o.shape);if(u===void 0||s.isSimple&&!s.isSimple(r)){this.drawTexture(r,a,i);return}var d=this.instanceCount;if(this.vertTypeBuffer.getView(d)[0]=u,u===hf||u===zu){var f=s.getBoundingBox(r),h=this._getCornerRadius(r,o.radius,f),p=this.cornerRadiusBuffer.getView(d);p[0]=h,p[1]=h,p[2]=h,p[3]=h,u===zu&&(p[0]=0,p[2]=0)}var m=this.indexBuffer.getView(d);Wl(a,m);var y=r.pstyle(o.color).value,x=r.pstyle(o.opacity).value,E=this.colorBuffer.getView(d);Rs(y,x,E);var w=this.lineWidthBuffer.getView(d);if(w[0]=0,w[1]=0,o.border){var T=r.pstyle("border-width").value;if(T>0){var C=r.pstyle("border-color").value,N=r.pstyle("border-opacity").value,A=this.borderColorBuffer.getView(d);Rs(C,N,A);var D=r.pstyle("border-position").value;if(D==="inside")w[0]=0,w[1]=-T;else if(D==="outside")w[0]=T,w[1]=0;else{var M=T/2;w[0]=M,w[1]=-M}}}var j=this.transformBuffer.getMatrixView(d);this.setTransformMatrix(r,j,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){var i=r.pstyle(a).value;switch(i){case"rectangle":return Jl;case"ellipse":return _u;case"roundrectangle":case"round-rectangle":return hf;case"bottom-round-rectangle":return zu;default:return}}},{key:"_getCornerRadius",value:function(r,a,i){var s=i.w,o=i.h;if(r.pstyle(a).value==="auto")return ns(s,o);var u=r.pstyle(a).pfValue,d=s/2,f=o/2;return Math.min(u,f,d)}},{key:"drawEdgeArrow",value:function(r,a,i){if(r.visible()){var s=r._private.rscratch,o,u,d;if(i==="source"?(o=s.arrowStartX,u=s.arrowStartY,d=s.srcArrowAngle):(o=s.arrowEndX,u=s.arrowEndY,d=s.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(u)||u==null||isNaN(d)||d==null)){var f=r.pstyle(i+"-arrow-shape").value;if(f!=="none"){var h=r.pstyle(i+"-arrow-color").value,p=r.pstyle("opacity").value,m=r.pstyle("line-opacity").value,y=p*m,x=r.pstyle("width").pfValue,E=r.pstyle("arrow-scale").value,w=this.r.getArrowWidth(x,E),T=this.instanceCount,C=this.transformBuffer.getMatrixView(T);fE(C),kf(C,C,[o,u]),fm(C,C,[w,w]),hE(C,C,d),this.vertTypeBuffer.getView(T)[0]=gg;var N=this.indexBuffer.getView(T);Wl(a,N);var A=this.colorBuffer.getView(T);Rs(h,y,A),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var i=this._getEdgePoints(r);if(i){var s=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,u=r.pstyle("width").pfValue,d=r.pstyle("line-color").value,f=s*o;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=vE;var p=this.indexBuffer.getView(h);Wl(a,p);var m=this.colorBuffer.getView(h);Rs(d,f,m);var y=this.lineWidthBuffer.getView(h);y[0]=u;var x=this.pointAPointBBuffer.getView(h);x[0]=i[0],x[1]=i[1],x[2]=i[2],x[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var E=0;E<i.length-2;E+=2){var w=this.instanceCount;this.vertTypeBuffer.getView(w)[0]=pE;var T=this.indexBuffer.getView(w);Wl(a,T);var C=this.colorBuffer.getView(w);Rs(d,f,C);var N=this.lineWidthBuffer.getView(w);N[0]=u;var A=i[E-2],D=i[E-1],M=i[E],j=i[E+1],k=i[E+2],R=i[E+3],z=i[E+4],B=i[E+5];E==0&&(A=2*M-k+.001,D=2*j-R+.001),E==i.length-4&&(z=2*k-M+.001,B=2*R-j+.001);var L=this.pointAPointBBuffer.getView(w);L[0]=A,L[1]=D,L[2]=M,L[3]=j;var q=this.pointCPointDBuffer.getView(w);q[0]=k,q[1]=R,q[2]=z,q[3]=B,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var a=r._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(this._isValidEdge(r)){var i=a.allpts;if(i.length==4)return i;var s=this._getNumSegments(r);return this._getCurveSegmentPoints(i,s)}}},{key:"_getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var i=Array((a+1)*2),s=0;s<=a;s++)if(s==0)i[0]=r[0],i[1]=r[1];else if(s==a)i[s*2]=r[r.length-2],i[s*2+1]=r[r.length-1];else{var o=s/a;this._setCurvePoint(r,o,i,s*2)}return i}},{key:"_setCurvePoint",value:function(r,a,i,s){if(r.length<=2)i[s]=r[0],i[s+1]=r[1];else{for(var o=Array(r.length-2),u=0;u<o.length;u+=2){var d=(1-a)*r[u]+a*r[u+2],f=(1-a)*r[u+1]+a*r[u+3];o[u]=d,o[u+1]=f}return this._setCurvePoint(o,a,i,s)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,i=this.vertexCount,s=this.instanceCount;if(s!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(a);var u=xa(this.buffers),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;f.bufferSubData(s)}}catch(x){u.e(x)}finally{u.f()}for(var h=this.batchManager.getAtlases(),p=0;p<h.length;p++)h[p].bufferIfNeeded(r);for(var m=0;m<h.length;m++)r.activeTexture(r.TEXTURE0+m),r.bindTexture(r.TEXTURE_2D,h[m].texture),r.uniform1i(o.uTextures[m],m);r.uniform1f(o.uZoom,tP(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var y=Rs(this.bgColor,1);r.uniform4fv(o.uBGColor,y),r.drawArraysInstanced(r.TRIANGLES,0,i,s),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:s,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),a=r.reduce(function(o,u){return o+u.atlasCount},0),i=this.batchDebugInfo,s=i.reduce(function(o,u){return o+u.count},0);return{atlasInfo:r,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:s}}}])})(),DN={};DN.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL];t.bgColor=EP(r),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=cP(a),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new SP(r,a,t);var i=function(p){return function(m){return r.getTextAngle(m,p)}},s=function(p){return function(m){var y=m.pstyle(p);return y&&y.value}},o=function(p){return function(m){return m.pstyle("".concat(p,"-opacity")).value>0}},u=function(p){var m=p.pstyle("text-events").strValue==="yes";return m?Yf.USE_BB:Yf.IGNORE},d=function(p){var m=p.position(),y=m.x,x=m.y,E=p.outerWidth(),w=p.outerHeight();return{w:E,h:w,x1:y-E/2,y1:x-w/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:d,isSimple:aP,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:d,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:d,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:u,getKey:mg(e.getLabelKey,null),getBoundingBox:yg(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:s("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:u,getKey:mg(e.getSourceLabelKey,"source"),getBoundingBox:yg(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:s("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:u,getKey:mg(e.getTargetLabelKey,"target"),getBoundingBox:yg(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:s("target-label")});var f=Ac(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(h,p){var m=!1;p&&p.length>0&&(m|=r.drawing.invalidate(p)),m&&f()}),TP(r)};function EP(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return iC(r)}function ON(t,e){var r=t._private.rscratch;return ga(r,"labelWrapCachedLines",e)||[]}var mg=function(e,r){return function(a){var i=e(a),s=ON(a,r);return s.length>1?s.map(function(o,u){return"".concat(i,"_").concat(u)}):i}},yg=function(e,r){return function(a,i){var s=e(a);if(typeof i=="string"){var o=i.indexOf("_");if(o>0){var u=Number(i.substring(o+1)),d=ON(a,r),f=s.h/d.length,h=f*u,p=s.y1+h;return{x1:s.x1,w:s.w,y1:p,h:f,yOffset:h}}}return s}};function TP(t){{var e=t.render;t.render=function(s){s=s||{};var o=t.cy;t.webgl&&(o.zoom()>TN?(CP(t),e.call(t,s)):(NP(t),BN(t,s,Qu.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(s){r.call(t,s),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(s,o,u,d){return OP(t,s,o)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(s,o){i.call(t,s,o),s==="viewport"||s==="bounds"?t.pickingFrameBuffer.needsDraw=!0:s==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function CP(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function NP(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function jP(t){var e=t.canvasWidth,r=t.canvasHeight,a=cy(t),i=a.pan,s=a.zoom,o=vg();kf(o,o,[i.x,i.y]),fm(o,o,[s,s]);var u=vg();fP(u,e,r);var d=vg();return dP(d,u,o),d}function RN(t,e){var r=t.canvasWidth,a=t.canvasHeight,i=cy(t),s=i.pan,o=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(s.x,s.y),e.scale(o,o)}function AP(t,e){t.drawSelectionRectangle(e,function(r){return RN(t,r)})}function MP(t){var e=t.data.contexts[t.NODE];e.save(),RN(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function kP(t){var e=function(i,s,o){for(var u=i.atlasManager.getAtlasCollection(s),d=t.data.contexts[t.NODE],f=u.atlases,h=0;h<f.length;h++){var p=f[h],m=p.canvas;if(m){var y=m.width,x=m.height,E=y*h,w=m.height*o,T=.4;d.save(),d.scale(T,T),d.drawImage(m,E,w),d.strokeStyle="black",d.rect(E,w,y,x),d.stroke(),d.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function DP(t,e,r,a,i){var s,o,u,d,f=cy(t),h=f.pan,p=f.zoom;{var m=rP(t,h,p,e,r),y=mr(m,2),x=y[0],E=y[1],w=6;s=x-w/2,o=E-w/2,u=w,d=w}if(u===0||d===0)return[];var T=t.data.contexts[t.WEBGL];T.bindFramebuffer(T.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(T.viewport(0,0,T.canvas.width,T.canvas.height),BN(t,null,Qu.PICKING),t.pickingFrameBuffer.needsDraw=!1);var C=u*d,N=new Uint8Array(C*4);T.readPixels(s,o,u,d,T.RGBA,T.UNSIGNED_BYTE,N),T.bindFramebuffer(T.FRAMEBUFFER,null);for(var A=new Set,D=0;D<C;D++){var M=N.slice(D*4,D*4+4),j=iP(M)-1;j>=0&&A.add(j)}return A}function OP(t,e,r){var a=DP(t,e,r),i=t.getCachedZSortedEles(),s,o,u=xa(a),d;try{for(u.s();!(d=u.n()).done;){var f=d.value,h=i[f];if(!s&&h.isNode()&&(s=h),!o&&h.isEdge()&&(o=h),s&&o)break}}catch(p){u.e(p)}finally{u.f()}return[s,o].filter(Boolean)}function xg(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function BN(t,e,r){var a;t.webglDebug&&(a=performance.now());var i=t.drawing,s=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&AP(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var u=jP(t),d=t.getCachedZSortedEles();if(s=d.length,i.startFrame(u,r),r.screen){for(var f=0;f<d.nondrag.length;f++)xg(t,f,d.nondrag[f]);for(var h=0;h<d.drag.length;h++)xg(t,h,d.drag[h])}else if(r.picking)for(var p=0;p<d.length;p++)xg(t,p,d[p]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(MP(t),kP(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var m=performance.now(),y=!1,x=Math.ceil(m-a),E=i.getDebugInfo(),w=["".concat(s," elements"),"".concat(E.totalInstances," instances"),"".concat(E.batchCount," batches"),"".concat(E.totalAtlases," atlases"),"".concat(E.wrappedCount," wrapped textures"),"".concat(E.simpleCount," simple shapes")].join(", ");if(y)console.log("WebGL (".concat(r.name,") - time ").concat(x,"ms, ").concat(w));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(w)),console.log("Texture Atlases Used:");var T=E.atlasInfo,C=xa(T),N;try{for(C.s();!(N=C.n()).done;){var A=N.value;console.log(" ".concat(A.type,": ").concat(A.keyCount," keys, ").concat(A.atlasCount," atlases"))}}catch(D){C.e(D)}finally{C.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var vs={};vs.drawPolygonPath=function(t,e,r,a,i,s){var o=a/2,u=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*s[0],r+u*s[1]);for(var d=1;d<s.length/2;d++)t.lineTo(e+o*s[d*2],r+u*s[d*2+1]);t.closePath()};vs.drawRoundPolygonPath=function(t,e,r,a,i,s,o){o.forEach(function(u){return pN(t,u)}),t.closePath()};vs.drawRoundRectanglePath=function(t,e,r,a,i,s){var o=a/2,u=i/2,d=s==="auto"?ns(a,i):Math.min(s,u,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-u),t.arcTo(e+o,r-u,e+o,r,d),t.arcTo(e+o,r+u,e,r+u,d),t.arcTo(e-o,r+u,e-o,r,d),t.arcTo(e-o,r-u,e,r-u,d),t.lineTo(e,r-u),t.closePath()};vs.drawBottomRoundRectanglePath=function(t,e,r,a,i,s){var o=a/2,u=i/2,d=s==="auto"?ns(a,i):s;t.beginPath&&t.beginPath(),t.moveTo(e,r-u),t.lineTo(e+o,r-u),t.lineTo(e+o,r),t.arcTo(e+o,r+u,e,r+u,d),t.arcTo(e-o,r+u,e-o,r,d),t.lineTo(e-o,r-u),t.lineTo(e,r-u),t.closePath()};vs.drawCutRectanglePath=function(t,e,r,a,i,s,o){var u=a/2,d=i/2,f=o==="auto"?Xm():o;t.beginPath&&t.beginPath(),t.moveTo(e-u+f,r-d),t.lineTo(e+u-f,r-d),t.lineTo(e+u,r-d+f),t.lineTo(e+u,r+d-f),t.lineTo(e+u-f,r+d),t.lineTo(e-u+f,r+d),t.lineTo(e-u,r+d-f),t.lineTo(e-u,r-d+f),t.closePath()};vs.drawBarrelPath=function(t,e,r,a,i){var s=a/2,o=i/2,u=e-s,d=e+s,f=r-o,h=r+o,p=Wg(a,i),m=p.widthOffset,y=p.heightOffset,x=p.ctrlPtOffsetPct*m;t.beginPath&&t.beginPath(),t.moveTo(u,f+y),t.lineTo(u,h-y),t.quadraticCurveTo(u+x,h,u+m,h),t.lineTo(d-m,h),t.quadraticCurveTo(d-x,h,d,h-y),t.lineTo(d,f+y),t.quadraticCurveTo(d-x,f,d-m,f),t.lineTo(u+m,f),t.quadraticCurveTo(u+x,f,u,f+y),t.closePath()};var gE=Math.sin(0),mE=Math.cos(0),hm={},vm={},LN=Math.PI/40;for(var eo=0*Math.PI;eo<2*Math.PI;eo+=LN)hm[eo]=Math.sin(eo),vm[eo]=Math.cos(eo);vs.drawEllipsePath=function(t,e,r,a,i){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,i/2,0,0,2*Math.PI);else for(var s,o,u=a/2,d=i/2,f=0*Math.PI;f<2*Math.PI;f+=LN)s=e-u*hm[f]*gE+u*vm[f]*mE,o=r+d*vm[f]*gE+d*hm[f]*mE,f===0?t.moveTo(s,o):t.lineTo(s,o);t.closePath()};var Bc={};Bc.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Bc.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),i=this.findContainerClientCoords(),s=t.full?Math.ceil(a.w):i[2],o=t.full?Math.ceil(a.h):i[3],u=De(t.maxWidth)||De(t.maxHeight),d=this.getPixelRatio(),f=1;if(t.scale!==void 0)s*=t.scale,o*=t.scale,f=t.scale;else if(u){var h=1/0,p=1/0;De(t.maxWidth)&&(h=f*t.maxWidth/s),De(t.maxHeight)&&(p=f*t.maxHeight/o),f=Math.min(h,p),s*=f,o*=f}u||(s*=d,o*=d,f*=d);var m=document.createElement("canvas");m.width=s,m.height=o,m.style.width=s+"px",m.style.height=o+"px";var y=m.getContext("2d");if(s>0&&o>0){y.clearRect(0,0,s,o),y.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(t.full)y.translate(-a.x1*f,-a.y1*f),y.scale(f,f),this.drawElements(y,x),y.scale(1/f,1/f),y.translate(a.x1*f,a.y1*f);else{var E=e.pan(),w={x:E.x*f,y:E.y*f};f*=e.zoom(),y.translate(w.x,w.y),y.scale(f,f),this.drawElements(y,x),y.scale(1/f,1/f),y.translate(-w.x,-w.y)}t.bg&&(y.globalCompositeOperation="destination-over",y.fillStyle=t.bg,y.rect(0,0,s,o),y.fill())}return m};function RP(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),i=new Uint8Array(a),s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return new Blob([a],{type:e})}function yE(t){var e=t.indexOf(",");return t.substr(e+1)}function PN(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Lo(function(i,s){try{e.toBlob(function(o){o!=null?i(o):s(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){s(o)}});case"blob":return RP(yE(a()),r);case"base64":return yE(a());case"base64uri":default:return a()}}Bc.png=function(t){return PN(t,this.bufferCanvasImage(t),"image/png")};Bc.jpg=function(t){return PN(t,this.bufferCanvasImage(t),"image/jpeg")};var zN={};zN.nodeShapeImpl=function(t,e,r,a,i,s,o,u){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,i,s);case"polygon":return this.drawPolygonPath(e,r,a,i,s,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,i,s,o,u);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,i,s,u);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,i,s,o,u);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,i,s,u);case"barrel":return this.drawBarrelPath(e,r,a,i,s)}};var BP=_N,ft=_N.prototype;ft.CANVAS_LAYERS=3;ft.SELECT_BOX=0;ft.DRAG=1;ft.NODE=2;ft.WEBGL=3;ft.CANVAS_TYPES=["2d","2d","2d","webgl2"];ft.BUFFER_COUNT=3;ft.TEXTURE_BUFFER=0;ft.MOTIONBLUR_BUFFER_NODE=1;ft.MOTIONBLUR_BUFFER_DRAG=2;function _N(t){var e=this,r=e.cy.window(),a=r.document;t.webgl&&(ft.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(ft.CANVAS_LAYERS),contexts:new Array(ft.CANVAS_LAYERS),canvasNeedsRedraw:new Array(ft.CANVAS_LAYERS),bufferCanvases:new Array(ft.BUFFER_COUNT),bufferContexts:new Array(ft.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",s="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=s,o.position="relative",o.zIndex="0",o.overflow="hidden";var u=t.cy.container();u.appendChild(e.data.canvasContainer),u.style[i]=s;var d={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};AD()&&(d["-ms-touch-action"]="none",d["touch-action"]="none");for(var f=0;f<ft.CANVAS_LAYERS;f++){var h=e.data.canvases[f]=a.createElement("canvas"),p=ft.CANVAS_TYPES[f];e.data.contexts[f]=h.getContext(p),e.data.contexts[f]||$t("Could not create canvas of type "+p),Object.keys(d).forEach(function(oe){h.style[oe]=d[oe]}),h.style.position="absolute",h.setAttribute("data-id","layer"+f),h.style.zIndex=String(ft.CANVAS_LAYERS-f),e.data.canvasContainer.appendChild(h),e.data.canvasNeedsRedraw[f]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[ft.NODE].setAttribute("data-id","layer"+ft.NODE+"-node"),e.data.canvases[ft.SELECT_BOX].setAttribute("data-id","layer"+ft.SELECT_BOX+"-selectbox"),e.data.canvases[ft.DRAG].setAttribute("data-id","layer"+ft.DRAG+"-drag"),e.data.canvases[ft.WEBGL]&&e.data.canvases[ft.WEBGL].setAttribute("data-id","layer"+ft.WEBGL+"-webgl");for(var f=0;f<ft.BUFFER_COUNT;f++)e.data.bufferCanvases[f]=a.createElement("canvas"),e.data.bufferContexts[f]=e.data.bufferCanvases[f].getContext("2d"),e.data.bufferCanvases[f].style.position="absolute",e.data.bufferCanvases[f].setAttribute("data-id","buffer"+f),e.data.bufferCanvases[f].style.zIndex=String(-f-1),e.data.bufferCanvases[f].style.visibility="hidden";e.pathsEnabled=!0;var m=na(),y=function(ae){return{x:(ae.x1+ae.x2)/2,y:(ae.y1+ae.y2)/2}},x=function(ae){return{x:-ae.w/2,y:-ae.h/2}},E=function(ae){var re=ae[0]._private,se=re.oldBackgroundTimestamp===re.backgroundTimestamp;return!se},w=function(ae){return ae[0]._private.nodeKey},T=function(ae){return ae[0]._private.labelStyleKey},C=function(ae){return ae[0]._private.sourceLabelStyleKey},N=function(ae){return ae[0]._private.targetLabelStyleKey},A=function(ae,re,se,ie,Ne){return e.drawElement(ae,re,se,!1,!1,Ne)},D=function(ae,re,se,ie,Ne){return e.drawElementText(ae,re,se,ie,"main",Ne)},M=function(ae,re,se,ie,Ne){return e.drawElementText(ae,re,se,ie,"source",Ne)},j=function(ae,re,se,ie,Ne){return e.drawElementText(ae,re,se,ie,"target",Ne)},k=function(ae){return ae.boundingBox(),ae[0]._private.bodyBounds},R=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.main||m},z=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.source||m},B=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.target||m},L=function(ae,re){return re},q=function(ae){return y(k(ae))},I=function(ae,re,se){var ie=ae?ae+"-":"";return{x:re.x+se.pstyle(ie+"text-margin-x").pfValue,y:re.y+se.pstyle(ie+"text-margin-y").pfValue}},Q=function(ae,re,se){var ie=ae[0]._private.rscratch;return{x:ie[re],y:ie[se]}},_=function(ae){return I("",Q(ae,"labelX","labelY"),ae)},V=function(ae){return I("source",Q(ae,"sourceLabelX","sourceLabelY"),ae)},F=function(ae){return I("target",Q(ae,"targetLabelX","targetLabelY"),ae)},K=function(ae){return x(k(ae))},ee=function(ae){return x(z(ae))},P=function(ae){return x(B(ae))},G=function(ae){var re=R(ae),se=x(R(ae));if(ae.isNode()){switch(ae.pstyle("text-halign").value){case"left":se.x=-re.w-(re.leftPad||0);break;case"right":se.x=-(re.rightPad||0);break}switch(ae.pstyle("text-valign").value){case"top":se.y=-re.h-(re.topPad||0);break;case"bottom":se.y=-(re.botPad||0);break}}return se},Z=e.data.eleTxrCache=new Vu(e,{getKey:w,doesEleInvalidateKey:E,drawElement:A,getBoundingBox:k,getRotationPoint:q,getRotationOffset:K,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),J=e.data.lblTxrCache=new Vu(e,{getKey:T,drawElement:D,getBoundingBox:R,getRotationPoint:_,getRotationOffset:G,isVisible:L}),X=e.data.slbTxrCache=new Vu(e,{getKey:C,drawElement:M,getBoundingBox:z,getRotationPoint:V,getRotationOffset:ee,isVisible:L}),Y=e.data.tlbTxrCache=new Vu(e,{getKey:N,drawElement:j,getBoundingBox:B,getRotationPoint:F,getRotationOffset:P,isVisible:L}),le=e.data.lyrTxrCache=new CN(e);e.onUpdateEleCalcs(function(ae,re){Z.invalidateElements(re),J.invalidateElements(re),X.invalidateElements(re),Y.invalidateElements(re),le.invalidateElements(re);for(var se=0;se<re.length;se++){var ie=re[se]._private;ie.oldBackgroundTimestamp=ie.backgroundTimestamp}});var me=function(ae){for(var re=0;re<ae.length;re++)le.enqueueElementRefinement(ae[re].ele)};Z.onDequeue(me),J.onDequeue(me),X.onDequeue(me),Y.onDequeue(me),t.webgl&&e.initWebgl(t,{getStyleKey:w,getLabelKey:T,getSourceLabelKey:C,getTargetLabelKey:N,drawElement:A,drawLabel:D,drawSourceLabel:M,drawTargetLabel:j,getElementBox:k,getLabelBox:R,getSourceLabelBox:z,getTargetLabelBox:B,getElementRotationPoint:q,getElementRotationOffset:K,getLabelRotationPoint:_,getSourceLabelRotationPoint:V,getTargetLabelRotationPoint:F,getLabelRotationOffset:G,getSourceLabelRotationOffset:ee,getTargetLabelRotationOffset:P})}ft.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[ft.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[ft.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[ft.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var LP=typeof Path2D<"u";ft.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};ft.usePaths=function(){return LP&&this.pathsEnabled};ft.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};ft.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};ft.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":Er(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),i=a.document;r=i.createElement("canvas"),r.width=t,r.height=e}return r};[NN,Nn,ai,uy,cl,hs,ia,DN,vs,Bc,zN].forEach(function(t){tt(ft,t)});var PP=[{name:"null",impl:fN},{name:"base",impl:SN},{name:"canvas",impl:BP}],zP=[{type:"layout",extensions:oL},{type:"renderer",extensions:PP}],UN={},qN={};function IN(t,e,r){var a=r,i=function(k){At("Can not register `"+e+"` for `"+t+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(lc.prototype[e])return i(e);lc.prototype[e]=r}else if(t==="collection"){if(Ir.prototype[e])return i(e);Ir.prototype[e]=r}else if(t==="layout"){for(var s=function(k){this.options=k,r.call(this,k),wt(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},o=s.prototype=Object.create(r.prototype),u=[],d=0;d<u.length;d++){var f=u[d];o[f]=o[f]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var h=r.prototype.stop;o.stop=function(){var j=this.options;if(j&&j.animate){var k=this.animations;if(k)for(var R=0;R<k.length;R++)k[R].stop()}return h?h.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var p=function(k){return k._private.cy},m={addEventFields:function(k,R){R.layout=k,R.cy=p(k),R.target=k},bubble:function(){return!0},parent:function(k){return p(k)}};tt(o,{createEmitter:function(){return this._private.emitter=new vh(m,this),this},emitter:function(){return this._private.emitter},on:function(k,R){return this.emitter().on(k,R),this},one:function(k,R){return this.emitter().one(k,R),this},once:function(k,R){return this.emitter().one(k,R),this},removeListener:function(k,R){return this.emitter().removeListener(k,R),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(k,R){return this.emitter().emit(k,R),this}}),jt.eventAliasesOn(o),a=s}else if(t==="renderer"&&e!=="null"&&e!=="base"){var y=VN("renderer","base"),x=y.prototype,E=r,w=r.prototype,T=function(){y.apply(this,arguments),E.apply(this,arguments)},C=T.prototype;for(var N in x){var A=x[N],D=w[N]!=null;if(D)return i(N);C[N]=A}for(var M in w)C[M]=w[M];x.clientFunctions.forEach(function(j){C[j]=C[j]||function(){$t("Renderer does not implement `renderer."+j+"()` on its prototype")}}),a=T}else if(t==="__proto__"||t==="constructor"||t==="prototype")return $t(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return sC({map:UN,keys:[t,e],value:a})}function VN(t,e){return lC({map:UN,keys:[t,e]})}function _P(t,e,r,a,i){return sC({map:qN,keys:[t,e,r,a],value:i})}function UP(t,e,r,a){return lC({map:qN,keys:[t,e,r,a]})}var pm=function(){if(arguments.length===2)return VN.apply(null,arguments);if(arguments.length===3)return IN.apply(null,arguments);if(arguments.length===4)return UP.apply(null,arguments);if(arguments.length===5)return _P.apply(null,arguments);$t("Invalid extension access syntax")};lc.prototype.extension=pm;zP.forEach(function(t){t.extensions.forEach(function(e){IN(t.type,e.name,e.impl)})});var Kf=function(){if(!(this instanceof Kf))return new Kf;this.length=0},rl=Kf.prototype;rl.instanceString=function(){return"stylesheet"};rl.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};rl.css=function(t,e){var r=this.length-1;if(Xe(t))this[r].properties.push({name:t,value:e});else if(wt(t))for(var a=t,i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],u=a[o];if(u!=null){var d=Rr.properties[o]||Rr.properties[nh(o)];if(d!=null){var f=d.name,h=u;this[r].properties.push({name:f,value:h})}}}return this};rl.style=rl.css;rl.generateStyle=function(t){var e=new Rr(t);return this.appendToStyle(e)};rl.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,i=r.properties;t.selector(a);for(var s=0;s<i.length;s++){var o=i[s];t.css(o.name,o.value)}}return t};var qP="3.33.1",al=function(e){if(e===void 0&&(e={}),wt(e))return new lc(e);if(Xe(e))return pm.apply(pm,arguments)};al.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(al),t.apply(null,e),this};al.warnings=function(t){return vC(t)};al.version=qP;al.stylesheet=al.Stylesheet=Kf;const IP={projectId:"",collection:"",readonly:!0},VP=["title","name","label","displayName","summary","description","text","subject"];function FP(t){const e={};if(!t)return e;for(const r of t.nodeSchemas??[])(r.titleField||r.subtitleField)&&(e[r.aType]={titleField:r.titleField,subtitleField:r.subtitleField});for(const r of t.edgeSchemas??[])(r.titleField||r.subtitleField)&&(e[r.axbType]={titleField:r.titleField,subtitleField:r.subtitleField});return e}function HP(t,e,r){const a=i=>i.length>24?i.slice(0,22)+"…":i;if(r){const i=t[r];if(typeof i=="string"&&i.length>0)return a(i);if(typeof i=="number"||typeof i=="boolean")return a(String(i))}for(const i of VP){const s=t[i];if(typeof s=="string"&&s.length>0)return a(s)}for(const i of Object.values(t))if(typeof i=="string"&&i.length>0&&i.length<=80)return a(i);return e.slice(0,8)}function fo(t,e,r,a){var i;return HP(t,e,(i=a[r])==null?void 0:i.titleField)}function GP(t,e,r,a,i){const s=[],o=[],u=new Set,d=new Set;u.add(t.aUid),s.push({data:{id:t.aUid,label:fo(t.data,t.aUid,t.aType,i),nodeType:t.aType,isFocus:!0}});for(const f of e){if(!u.has(f.bUid)){u.add(f.bUid);const p=a[f.bUid];s.push({data:{id:f.bUid,label:p?fo(p.data,f.bUid,f.bType,i):f.bUid.slice(0,8),nodeType:f.bType}})}const h=`${f.aUid}:${f.axbType}:${f.bUid}`;d.has(h)||(d.add(h),o.push({data:{id:h,source:f.aUid,target:f.bUid,label:f.axbType,edgeType:f.axbType}}))}for(const f of r){if(!u.has(f.aUid)){u.add(f.aUid);const p=a[f.aUid];s.push({data:{id:f.aUid,label:p?fo(p.data,f.aUid,f.aType,i):f.aUid.slice(0,8),nodeType:f.aType}})}const h=`${f.aUid}:${f.axbType}:${f.bUid}`;d.has(h)||(d.add(h),o.push({data:{id:h,source:f.aUid,target:f.bUid,label:f.axbType,edgeType:f.axbType}}))}return[...s,...o]}function QP(t,e,r,a){const i=[],s=[],o=new Set,u=new Set;if(!o.has(t)){o.add(t);const d=r[t];i.push({data:{id:t,label:d?fo(d.data,t,d.aType,a):t.slice(0,8),nodeType:(d==null?void 0:d.aType)??"",isFocus:!0}})}for(const d of e){if(!o.has(d.aUid)){o.add(d.aUid);const h=r[d.aUid];i.push({data:{id:d.aUid,label:h?fo(h.data,d.aUid,d.aType,a):d.aUid.slice(0,8),nodeType:d.aType}})}if(!o.has(d.bUid)){o.add(d.bUid);const h=r[d.bUid];i.push({data:{id:d.bUid,label:h?fo(h.data,d.bUid,d.bType,a):d.bUid.slice(0,8),nodeType:d.bType}})}const f=`${d.aUid}:${d.axbType}:${d.bUid}`;u.has(f)||(u.add(f),s.push({data:{id:f,source:d.aUid,target:d.bUid,label:d.axbType,edgeType:d.axbType}}))}return[...i,...s]}const $P=[{selector:"node",style:{"background-color":"data(color)",label:"data(label)",color:"#e2e8f0","text-valign":"bottom","text-halign":"center","font-size":"11px","font-family":"ui-monospace, SFMono-Regular, Menlo, monospace","text-margin-y":6,"text-outline-color":"#020617","text-outline-width":2,width:28,height:28,"border-width":2,"border-color":"#334155"}},{selector:"node[?isFocus]",style:{width:42,height:42,"border-width":3,"border-color":"#818cf8","font-size":"13px","font-weight":"bold"}},{selector:"edge",style:{width:1.5,"line-color":"#475569","target-arrow-color":"#475569","target-arrow-shape":"triangle","curve-style":"bezier",label:"data(label)",color:"#94a3b8","font-size":"9px","font-family":"ui-monospace, SFMono-Regular, Menlo, monospace","text-rotation":"autorotate","text-background-color":"#0f172a","text-background-opacity":.85,"text-background-padding":"2px","text-background-shape":"round-rectangle"}},{selector:"node:active",style:{"overlay-color":"#818cf8","overlay-padding":4,"overlay-opacity":.2}},{selector:"node:selected",style:{"border-color":"#818cf8","border-width":3}}];function YP(t,e){switch(t){case"concentric":return{name:"concentric",concentric:r=>r.id()===e?10:1,levelWidth:()=>1,minNodeSpacing:50,animate:!0,animationDuration:300};case"breadthfirst":return{name:"breadthfirst",roots:`#${CSS.escape(e)}`,directed:!0,spacingFactor:1.25,animate:!0,animationDuration:300};case"cose":default:return{name:"cose",animate:!0,animationDuration:300,nodeRepulsion:()=>8e3,idealEdgeLength:()=>80,gravity:.25}}}function FN({node:t,focusUid:e,edges:r,schema:a,viewRegistry:i,config:s,onClose:o,onNodeClick:u}){const d=U.useRef(null),f=U.useRef(null),[h,p]=U.useState("breadthfirst"),[m,y]=U.useState(null),x=s??IP,{scopePath:E}=ba(),w=(t==null?void 0:t.aUid)??e??"",T=Ro(),C=!!r,N=r??[],A=C?[]:(T==null?void 0:T.edgeResults.out.edges)??[],D=C?[]:(T==null?void 0:T.edgeResults.in.edges)??[],M=U.useMemo(()=>{const F=new Set;if(C){for(const K of N)F.add(K.aUid),F.add(K.bUid);F.add(w)}else{for(const K of A)F.add(K.bUid);for(const K of D)F.add(K.aUid)}return t&&F.delete(t.aUid),[...F]},[C,N,A,D,t,w]),{data:j}=xt.getNodesBatch.useQuery({uids:M,...Zt(E)},{enabled:M.length>0}),k=U.useMemo(()=>{const F=(j==null?void 0:j.nodes)??{};return t&&(F[t.aUid]=t),F},[j,t]),R=C?N:[...A,...D],z=U.useMemo(()=>{const F={};for(const K of R){const ee=`${K.aUid}:${K.axbType}:${K.bUid}`;F[ee]||(F[ee]={edgeType:K.axbType,data:K.data,aType:K.aType,bType:K.bType})}return F},[R]),B=U.useMemo(()=>FP(a),[a]),L=U.useMemo(()=>C?QP(w,N,k,B):GP(t,A,D,k,B),[C,w,N,t,A,D,k,B]),q=L.filter(F=>!F.data.source).length,I=L.filter(F=>F.data.source).length;for(const F of L)!F.data.source&&F.data.nodeType&&(F.data.color=L2(F.data.nodeType));U.useEffect(()=>{const F=K=>{K.key==="Escape"&&o()};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[o]),U.useEffect(()=>{if(!d.current)return;f.current&&(f.current.destroy(),f.current=null);const F=al({container:d.current,elements:L,style:$P,layout:YP(h,w),minZoom:.2,maxZoom:4,wheelSensitivity:.3});return F.on("tap","node",K=>{const ee=K.target,P=ee.id(),G=ee.data("nodeType");P!==w&&u(P,G)}),F.on("mouseover","node",K=>{const ee=K.target,P=K.originalEvent;y({kind:"node",uid:ee.id(),nodeType:ee.data("nodeType"),x:P.clientX,y:P.clientY})}),F.on("mouseover","edge",K=>{const ee=K.target,P=K.originalEvent;y({kind:"edge",edgeId:ee.id(),edgeType:ee.data("edgeType"),x:P.clientX,y:P.clientY})}),F.on("mouseout","node, edge",()=>{y(null)}),F.on("viewport",()=>y(null)),f.current=F,()=>{F.destroy(),f.current=null}},[h,w,L.length]);const Q=U.useCallback(()=>{var F;(F=f.current)==null||F.fit(void 0,40)},[]),_=[...new Set(L.filter(F=>!F.data.source).map(F=>F.data.nodeType))],V=U.useMemo(()=>{var X,Y,le,me,oe,ae,re,se,ie;if(!m)return null;if(m.kind==="node"){const{uid:Ne,nodeType:Ae}=m,Ze=t&&Ne===t.aUid?t.data:((X=k[Ne])==null?void 0:X.data)??null;if(!Ze)return{title:`${Ae} ${Ne}`,tagName:null,data:null};const Qe=((Y=i==null?void 0:i.nodes[Ae])==null?void 0:Y.views)??[],Se=(me=(le=x.viewDefaults)==null?void 0:le.nodes)==null?void 0:me[Ae],Oe=nn(Se,Qe),ke=Oe!=="json"?((oe=Qe.find(Pe=>Pe.viewName===Oe))==null?void 0:oe.tagName)??null:null;return{title:`${Ae} ${Ne}`,tagName:ke,data:Ze}}const{edgeId:F,edgeType:K}=m,ee=z[F];if(!ee)return null;const P=((ae=i==null?void 0:i.edges[K])==null?void 0:ae.views)??[],G=(se=(re=x.viewDefaults)==null?void 0:re.edges)==null?void 0:se[K],Z=nn(G,P),J=Z!=="json"?((ie=P.find(Ne=>Ne.viewName===Z))==null?void 0:ie.tagName)??null:null;return{title:`${ee.aType} —[${K}]→ ${ee.bType}`,tagName:J,data:ee.data}},[m,t,k,i,x,z]);return Ku.createPortal(g.jsxs("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50",onClick:o,children:[g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl shadow-2xl flex flex-col overflow-hidden",style:{width:"90vw",height:"85vh"},onClick:F=>F.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b border-slate-700/60 bg-slate-900/80 shrink-0",children:[g.jsx("span",{className:"text-sm font-medium text-slate-200",children:"Graph"}),g.jsxs("span",{className:"text-xs text-slate-500",children:[q," nodes, ",I," edges"]}),g.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[g.jsxs("select",{value:h,onChange:F=>p(F.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-slate-300 focus:outline-none focus:border-slate-500",children:[g.jsx("option",{value:"breadthfirst",children:"Tree"}),g.jsx("option",{value:"concentric",children:"Concentric"}),g.jsx("option",{value:"cose",children:"Force-directed"})]}),g.jsx("button",{onClick:Q,className:"px-2.5 py-1 bg-slate-800 border border-slate-700 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",title:"Fit to viewport",children:"Fit"}),g.jsx("button",{onClick:o,className:"px-2 py-1 text-slate-400 hover:text-slate-200 transition-colors text-lg leading-none",title:"Close",children:"×"})]})]}),g.jsx("div",{ref:d,className:"flex-1 bg-slate-950"}),g.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/60 bg-slate-900/80 shrink-0 overflow-x-auto",children:[_.map(F=>g.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-400 whitespace-nowrap",children:[g.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:L2(F)}}),F]},F)),g.jsx("span",{className:"text-xs text-slate-600 ml-auto whitespace-nowrap",children:"Click a node to drill in"})]})]}),m&&V&&V.data&&g.jsx(KP,{x:m.x,y:m.y,title:V.title,tagName:V.tagName,data:V.data})]}),document.body)}function KP({x:t,y:e,title:r,tagName:a,data:i}){const s=U.useRef(null),[o,u]=U.useState({left:t+12,top:e+12}),[d,f]=U.useState(!1);return U.useEffect(()=>{const h=s.current;if(!h)return;const p=h.getBoundingClientRect(),m=12;let y=t+m,x=e+m;y+p.width>window.innerWidth-m&&(y=t-p.width-m),x+p.height>window.innerHeight-m&&(x=e-p.height-m),u({left:y,top:x})},[t,e]),g.jsxs("div",{ref:s,className:"fixed z-[60] max-w-sm rounded-lg border border-slate-600 bg-slate-900 shadow-2xl overflow-hidden pointer-events-none",style:{left:o.left,top:o.top},onClick:h=>h.stopPropagation(),children:[g.jsx("div",{className:"px-3 py-1.5 border-b border-slate-700/60 text-xs text-slate-400 font-mono truncate",children:r}),g.jsx("div",{className:"p-2 max-h-64 overflow-auto",children:a&&!d?g.jsx(Jn,{tagName:a,data:i,onError:()=>f(!0)}):g.jsx("div",{className:"text-xs font-mono",children:g.jsx(Oa,{data:i,defaultExpanded:!0,depth:0})})})]})}function HN({schema:t,existingNode:e,defaultType:r,onSaved:a,onCancel:i}){var M;const{scopePath:s}=ba(),o=!!e,u=t.nodeSchemas??[],[d,f]=U.useState((e==null?void 0:e.aType)??r??((M=u[0])==null?void 0:M.aType)??""),[h,p]=U.useState((e==null?void 0:e.aUid)??""),[m,y]=U.useState((e==null?void 0:e.data)??{}),[x,E]=U.useState(null),w=xt.createNode.useMutation({onSuccess:j=>a(j.uid),onError:j=>E(j.message)}),T=xt.updateNode.useMutation({onSuccess:()=>a(e.aUid),onError:j=>E(j.message)}),C=w.isPending||T.isPending,N=U.useMemo(()=>u.find(j=>j.aType===d),[u,d]),A=j=>{f(j),o||y({})},D=()=>{E(null),o?T.mutate({uid:e.aUid,data:m,...Zt(s)}):w.mutate({aType:d,uid:h||void 0,data:m,...Zt(s)})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4",children:o?`Edit Node: ${e.aUid}`:"Create Node"}),!o&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Node Type"}),g.jsx("select",{value:d,onChange:j=>A(j.target.value),className:"w-full max-w-xs bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:u.map(j=>g.jsxs("option",{value:j.aType,children:[j.aType,j.description?` — ${j.description}`:""]},j.aType))})]}),!o&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"UID (optional, auto-generated if empty)"}),g.jsx("input",{type:"text",value:h,onChange:j=>p(j.target.value),placeholder:"Leave empty to auto-generate",className:"w-full max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),N&&N.fields.length>0?g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:"Data Fields"}),g.jsx(Wu,{fields:N.fields,values:m,onChange:y})]}):g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:JSON.stringify(m,null,2),onChange:j=>{try{y(JSON.parse(j.target.value))}catch{}},rows:6,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),x&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:x}),g.jsxs("div",{className:"flex gap-3",children:[g.jsxs("button",{onClick:D,disabled:C||!d,className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[C&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),o?"Save Changes":"Create Node"]}),g.jsx("button",{onClick:i,disabled:C,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"})]})]})}function vf(t,e,r){if(!e)return t.edgeTypes;const a=t.edgeTypes.filter(i=>r==="forward"?i.aType===e:i.bType===e);return a.length>0?a:t.edgeTypes}function pf(t){return[...new Set(t.map(e=>e.axbType))]}function xE(t,e,r){const a=[];let i=e;for(const s of r){const o=t.edgeTypes.filter(d=>d.axbType===s.axbType);let u;if(i&&o.length>0)if(s.direction==="forward"){const d=o.find(f=>f.aType===i);u=d==null?void 0:d.bType}else{const d=o.find(f=>f.bType===i);u=d==null?void 0:d.aType}else o.length===1&&(u=s.direction==="forward"?o[0].bType:o[0].aType);a.push({sourceType:i,targetType:u}),i=u}return a}function XP(t,e){var a;const r=(a=t.edgeSchemas)==null?void 0:a.find(i=>i.axbType===e&&!i.isNodeEntry);return(r==null?void 0:r.fields)??[]}function ZP({schema:t}){const[e,r]=U.useState(""),[a,i]=U.useState("");return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h1",{className:"text-xl font-bold mb-1",children:"Graph Traversal"}),g.jsx("p",{className:"text-sm text-slate-400",children:"Build multi-hop traversals to explore graph relationships"})]}),g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"mb-5 flex gap-4 items-end",children:[g.jsxs("div",{className:"flex-1 max-w-sm",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Start Node UID"}),g.jsx("input",{type:"text",value:e,onChange:s=>r(s.target.value),placeholder:"paste a node UID",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Node Type"}),g.jsxs("select",{value:a,onChange:s=>i(s.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:[g.jsx("option",{value:"",children:"Any type"}),t.nodeTypes.map(s=>g.jsx("option",{value:s.type,children:s.type},s.type))]})]})]}),g.jsx(GN,{schema:t,startUid:e,startNodeType:a||void 0})]})]})}function GN({schema:t,startUid:e,startNodeType:r,viewRegistry:a,config:i}){const{scopePath:s}=ba(),o=U.useMemo(()=>{var B,L;if(r){const q=vf(t,r,"forward");return pf(q)[0]||((B=t.edgeTypes[0])==null?void 0:B.axbType)||""}return((L=t.edgeTypes[0])==null?void 0:L.axbType)||""},[t,r]),[u,d]=U.useState([{axbType:o,direction:"forward",limit:10}]),[f,h]=U.useState(100),[p,m]=U.useState(5),[y,x]=U.useState(null),[E,w]=U.useState(null),[T,C]=U.useState(new Set),N=xt.traverse.useMutation({onSuccess:B=>x(B),onError:B=>w(B.message)}),A=N.isPending,D=U.useMemo(()=>xE(t,r,u),[t,r,u]),M=()=>{var I;const B=(I=D[D.length-1])==null?void 0:I.targetType,L=vf(t,B,"forward"),q=pf(L);d([...u,{axbType:q[0]||"",direction:"forward",limit:10}])},j=B=>{u.length<=1||(d(u.filter((L,q)=>q!==B)),C(L=>{const q=new Set;for(const I of L)I<B?q.add(I):I>B&&q.add(I-1);return q}))},k=(B,L)=>{d(q=>{var Q;const I=[...q];if(I[B]={...I[B],...L},"direction"in L){const V=(Q=xE(t,r,I)[B])==null?void 0:Q.sourceType,F=pf(vf(t,V,I[B].direction));F.length>0&&!F.includes(I[B].axbType)&&(I[B]={...I[B],axbType:F[0]})}return I})},R=B=>{C(L=>{const q=new Set(L);return q.has(B)?q.delete(B):q.add(B),q})},z=()=>{e.trim()&&(w(null),x(null),N.mutate({startUid:e.trim(),hops:u,maxReads:f,concurrency:p,...Zt(s)}))};return g.jsxs(g.Fragment,{children:[r&&g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx("span",{className:"text-xs text-slate-500",children:"Starting from"}),g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-medium ${nr(r)}`,children:r}),g.jsx("span",{className:"text-xs text-slate-400 font-mono",children:e})]}),g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-2",children:"Hops"}),g.jsx("div",{className:"space-y-2",children:u.map((B,L)=>{const q=D[L],I=q==null?void 0:q.sourceType,Q=q==null?void 0:q.targetType,_=vf(t,I,B.direction),V=pf(_),F=T.has(L),K=XP(t,B.axbType);return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"flex items-center gap-2 p-3",children:[g.jsxs("span",{className:"text-xs text-slate-500 w-6 shrink-0",children:["#",L+1]}),I?g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono shrink-0 ${nr(I)}`,children:I}):g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-slate-700 text-slate-500 shrink-0",children:"?"}),g.jsxs("select",{value:B.direction,onChange:ee=>k(L,{direction:ee.target.value}),className:"bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"forward",children:"Forward"}),g.jsx("option",{value:"reverse",children:"Reverse"})]}),g.jsx("select",{value:B.axbType,onChange:ee=>k(L,{axbType:ee.target.value}),className:"bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500 flex-1 max-w-xs",children:V.map(ee=>g.jsx("option",{value:ee,children:ee},ee))}),g.jsx("span",{className:"text-slate-600 text-xs",children:"→"}),Q?g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono shrink-0 ${nr(Q)}`,children:Q}):g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-slate-700 text-slate-500 shrink-0",children:"?"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-xs text-slate-500",children:"limit:"}),g.jsx("input",{type:"number",value:B.limit,onChange:ee=>k(L,{limit:parseInt(ee.target.value)||10}),className:"w-14 bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:200})]}),g.jsx("button",{onClick:()=>R(L),className:`p-1 transition-colors ${F?"text-indigo-400":"text-slate-600 hover:text-slate-400"}`,title:"Advanced options",children:g.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),u.length>1&&g.jsx("button",{onClick:()=>j(L),className:"text-slate-600 hover:text-red-400 transition-colors p-1",title:"Remove hop",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),F&&g.jsx(WP,{hop:B,index:L,fields:K,updateHop:k})]},L)})}),g.jsxs("button",{onClick:M,className:"mt-2 text-xs text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Hop"]})]}),g.jsxs("div",{className:"mb-5 flex gap-5 items-end",children:[g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Read Budget"}),g.jsx("input",{type:"number",value:f,onChange:B=>h(parseInt(B.target.value)||100),className:"w-24 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:1e3})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Concurrency"}),g.jsx("input",{type:"number",value:p,onChange:B=>m(parseInt(B.target.value)||5),className:"w-20 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:20})]})]}),g.jsxs("div",{className:"mb-5 bg-slate-950 rounded-lg p-3",children:[g.jsx("p",{className:"text-xs text-slate-500 mb-1",children:"Query Preview"}),g.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-mono flex-wrap",children:[g.jsx("span",{className:"text-indigo-400",children:e||"?"}),r&&g.jsxs("span",{className:"text-slate-500 text-xs",children:["(",r,")"]}),u.map((B,L)=>{var I;const q=(I=D[L])==null?void 0:I.targetType;return g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-slate-600",children:B.direction==="forward"?"→":"←"}),g.jsx("span",{className:"text-emerald-400",children:B.axbType||"?"}),q&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-600",children:"→"}),g.jsx("span",{className:"text-cyan-400 text-xs",children:q})]})]},L)})]})]}),g.jsx("button",{onClick:z,disabled:A||!e.trim(),className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:A?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Running..."]}):g.jsxs(g.Fragment,{children:[g.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Run Traversal"]})}),E&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mt-4 text-sm text-red-400",children:E}),y&&g.jsx("div",{className:"mt-5",children:g.jsx(tz,{result:y,startUid:e,schema:t,viewRegistry:a,config:i})})]})}function WP({hop:t,index:e,fields:r,updateHop:a}){var u,d;const i=()=>{var h;const f=t.where??[];a(e,{where:[...f,{field:((h=r[0])==null?void 0:h.name)||"",op:"==",value:""}]})},s=(f,h)=>{const p=[...t.where??[]];p[f]={...p[f],...h},a(e,{where:p})},o=f=>{const h=(t.where??[]).filter((p,m)=>m!==f);a(e,{where:h.length>0?h:void 0})};return g.jsxs("div",{className:"border-t border-slate-700/50 px-3 pb-3 pt-2 space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[10px] text-slate-500 w-16 shrink-0",children:"Order By"}),r.length>0?g.jsxs("select",{value:((u=t.orderBy)==null?void 0:u.field)||"",onChange:f=>{var h;return a(e,{orderBy:f.target.value?{field:f.target.value,direction:((h=t.orderBy)==null?void 0:h.direction)??"asc"}:void 0})},className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"None"}),r.map(f=>g.jsx("option",{value:f.name,children:f.name},f.name))]}):g.jsx("input",{type:"text",value:((d=t.orderBy)==null?void 0:d.field)||"",onChange:f=>{var h;return a(e,{orderBy:f.target.value?{field:f.target.value,direction:((h=t.orderBy)==null?void 0:h.direction)??"asc"}:void 0})},placeholder:"field name",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-32"}),t.orderBy&&g.jsxs("select",{value:t.orderBy.direction,onChange:f=>a(e,{orderBy:{...t.orderBy,direction:f.target.value}}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"asc",children:"asc"}),g.jsx("option",{value:"desc",children:"desc"})]})]}),g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 w-16 shrink-0",children:"Where"}),g.jsx("button",{onClick:i,className:"text-[10px] text-indigo-400 hover:text-indigo-300 transition-colors",children:"+ Add filter"})]}),(t.where??[]).map((f,h)=>g.jsxs("div",{className:"flex items-center gap-1.5 ml-[4.5rem] mb-1",children:[r.length>0?g.jsx("select",{value:f.field,onChange:p=>s(h,{field:p.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:r.map(p=>g.jsx("option",{value:p.name,children:p.name},p.name))}):g.jsx("input",{type:"text",value:f.field,onChange:p=>s(h,{field:p.target.value}),placeholder:"field",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-24"}),g.jsxs("select",{value:f.op,onChange:p=>s(h,{op:p.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500 w-14",children:[g.jsx("option",{value:"==",children:"=="}),g.jsx("option",{value:"!=",children:"!="}),g.jsx("option",{value:"<",children:"<"}),g.jsx("option",{value:"<=",children:"<="}),g.jsx("option",{value:">",children:">"}),g.jsx("option",{value:">=",children:">="})]}),g.jsx("input",{type:"text",value:String(f.value),onChange:p=>{const m=Number(p.target.value),y=p.target.value==="true"?!0:p.target.value==="false"?!1:!isNaN(m)&&p.target.value!==""?m:p.target.value;s(h,{value:y})},placeholder:"value",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-28"}),g.jsx("button",{onClick:()=>o(h),className:"text-slate-600 hover:text-red-400 transition-colors p-0.5",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},h))]})]})}function QN(t,e,r){const a=[],i=t[e].direction;let s=i==="forward"?r.aUid:r.bUid;for(let u=e-1;u>=0;u--){const d=t[u],f=d.edges.find(h=>d.direction==="forward"?h.bUid===s:h.aUid===s);if(!f)break;a.unshift({edge:f,direction:d.direction}),s=d.direction==="forward"?f.aUid:f.bUid}const o=a.map(({edge:u,direction:d})=>({uid:d==="forward"?u.bUid:u.aUid,nodeType:d==="forward"?u.bType:u.aType,edgeType:u.axbType,direction:d==="forward"?"out":"in"}));return o.push({uid:i==="forward"?r.bUid:r.aUid,nodeType:i==="forward"?r.bType:r.aType,edgeType:r.axbType,direction:i==="forward"?"out":"in"}),o}const JP=20;function ez(t){return{uid:t,nodeType:"",edgeType:"",direction:"out"}}function tz({result:t,startUid:e,schema:r,viewRegistry:a,config:i}){const s=KT(),o=un(),{scopedPath:u}=ba(),[d,f]=U.useState(!1),h=U.useMemo(()=>t.hops.flatMap(m=>m.edges),[t.hops]),p=m=>{const E=t.hops[m].edges.slice(0,JP).map(w=>QN(t.hops,m,w));if(s)for(const w of E)s.createLane([ez(e),...w]);else o(u(`/node/${encodeURIComponent(e)}`),{state:{initialPaths:E}})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center gap-6 mb-5",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.nodes.length}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Result Nodes"})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.hops.length}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Hops"})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.totalReads}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Firestore Reads"})]}),t.truncated&&g.jsx("div",{className:"px-2 py-1 bg-amber-500/10 text-amber-400 rounded text-xs",children:"Truncated (budget exceeded)"}),g.jsx("button",{onClick:()=>f(!0),className:"ml-auto px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Graph"})]}),g.jsx("div",{className:"space-y-4",children:t.hops.map((m,y)=>g.jsxs("div",{className:"border-l-2 border-indigo-500/30 pl-4",children:[g.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[g.jsxs("span",{className:"text-slate-500",children:["Hop ",y+1,":"]}),g.jsx("span",{className:"text-indigo-400 font-mono",children:m.axbType}),g.jsxs("span",{className:"text-slate-600 text-xs",children:["(",m.direction,", ",m.edges.length," edges from ",m.sourceCount," sources)"]}),m.truncated&&g.jsx("span",{className:"text-amber-400 text-[10px]",children:"truncated"}),m.edges.length>0&&g.jsx("button",{onClick:()=>p(y),className:"text-[10px] text-indigo-400 hover:text-indigo-300 transition-colors ml-auto",children:"show paths"})]}),g.jsxs("div",{className:"space-y-1.5",children:[m.edges.slice(0,20).map((x,E)=>{var w,T;return g.jsx(rz,{edge:x,direction:m.direction,allHops:t.hops,hopIndex:y,edgeViews:((w=a==null?void 0:a.edges[x.axbType])==null?void 0:w.views)??[],nodeViews:((T=a==null?void 0:a.nodes[m.direction==="forward"?x.bType:x.aType])==null?void 0:T.views)??[],config:i},E)}),m.edges.length>20&&g.jsxs("p",{className:"text-xs text-slate-500 pl-2",children:["... and ",m.edges.length-20," more"]}),m.edges.length===0&&g.jsx("p",{className:"text-xs text-slate-500",children:"No edges found"})]})]},y))}),d&&h.length>0&&g.jsx(FN,{focusUid:e,edges:h,schema:r,viewRegistry:a,config:i,onClose:()=>f(!1),onNodeClick:(m,y)=>{f(!1),s?s.drillIn({uid:m,nodeType:y,edgeType:"",direction:"out"}):o(u(`/node/${encodeURIComponent(m)}`))}})]})}function rz({edge:t,direction:e,allHops:r,hopIndex:a,edgeViews:i=[],nodeViews:s=[],config:o}){const{scopePath:u,scopedPath:d}=ba(),f=KT(),h=xt.useUtils(),[p,m]=U.useState(!1),[y,x]=U.useState(!1),[E,w]=U.useState(void 0),[T,C]=U.useState(!1),{aType:N,aUid:A,bType:D,bUid:M,data:j}=t,k=j&&Object.keys(j).length>0,R=e==="forward"?M:A,z=e==="forward"?D:N,B=e==="forward"?A:M,L=e==="forward"?N:D,q=E!==void 0,I=()=>{var Z,J;const G=(J=(Z=o==null?void 0:o.viewDefaults)==null?void 0:Z.edges)==null?void 0:J[t.axbType];if(G&&i.length>0){const X=nn(G,i,"inline");if(X!=="json"){const Y=i.find(le=>le.viewName===X);if(Y)return Y.tagName}}return"json"},[Q,_]=U.useState(I),V=()=>{var Z,J;const G=(J=(Z=o==null?void 0:o.viewDefaults)==null?void 0:Z.nodes)==null?void 0:J[z];if(G&&s.length>0){const X=nn(G,s,"inline");if(X!=="json"){const Y=s.find(le=>le.viewName===X);if(Y)return Y.tagName}}return"json"},[F,K]=U.useState(V),ee=()=>{if(!f)return;const G=QN(r,a,t);f.drillPath(G)},P=async()=>{var G,Z;C(!0);try{const X=(await h.getNodesBatch.fetch({uids:[R],...Zt(u)})).nodes[R]??null;if(w(X),x(!0),X){const Y=(Z=(G=o==null?void 0:o.viewDefaults)==null?void 0:G.nodes)==null?void 0:Z[z];if(Y&&s.length>0){const le=nn(Y,s,"inline");if(le!=="json"){const me=s.find(oe=>oe.viewName===le);me&&K(me.tagName)}}}}catch{}finally{C(!1)}};return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"px-3 pt-2 pb-1 flex items-center gap-2 text-xs text-slate-500",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(L)}`,children:L}),g.jsx("span",{className:"font-mono text-slate-400",children:B}),g.jsx("span",{className:"text-slate-600",children:e==="forward"?"→":"←"}),g.jsx("span",{className:"text-slate-600 font-mono text-[10px]",children:t.axbType})]}),g.jsxs("div",{className:"px-3 pb-2 flex items-center gap-3",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(z)}`,children:z}),f?g.jsx("button",{onClick:ee,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",title:"Dive into this node",children:R}):g.jsx(Qt,{to:d(`/node/${encodeURIComponent(R)}`),className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",children:R}),g.jsx(Qt,{to:d(`/node/${encodeURIComponent(R)}`),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",title:"Navigate to this node's page",children:"go to"}),k&&g.jsx("button",{onClick:()=>m(!p),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:p?"hide edge":"show edge"}),!q&&!T&&g.jsx("button",{onClick:P,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"resolve"}),T&&g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-400 border-t-transparent rounded-full animate-spin"}),q&&g.jsx("button",{onClick:()=>x(!y),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:y?"hide node":"show node"})]}),p&&k&&g.jsxs("div",{className:"px-3 pb-2",children:[i.length>0&&g.jsx("div",{className:"mb-2",children:g.jsx(Ao,{views:i,activeView:Q,onSwitch:_})}),Q==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Oa,{data:j,defaultExpanded:!0})}):g.jsx(Jn,{tagName:Q,data:j,onError:()=>_("json")})]}),y&&q&&g.jsx("div",{className:"px-3 pb-2",children:E===null?g.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"Node not found"}):g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Node Data"}),s.length>0&&g.jsx(Ao,{views:s,activeView:F,onSwitch:K})]}),F==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Oa,{data:E.data,defaultExpanded:!0})}):g.jsx(Jn,{tagName:F,data:E.data,onError:()=>K("json")})]})})]})}function $N({nodeType:t,data:e,viewRegistry:r,config:a}){var f;const i=((f=r==null?void 0:r.nodes[t])==null?void 0:f.views)??[],[s,o]=U.useState("json"),[u,d]=U.useState(!1);return U.useEffect(()=>{var p,m;if(u)return;const h=(m=(p=a.viewDefaults)==null?void 0:p.nodes)==null?void 0:m[t];if(h&&i.length>0){const y=nn(h,i,"detail");if(y!=="json"){const x=i.find(E=>E.viewName===y);x&&o(x.tagName)}}d(!0)},[u,i,a,t]),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Data"}),g.jsx(Ao,{views:i,activeView:s,onSwitch:o})]}),s==="json"?g.jsx("div",{className:"font-mono text-xs leading-relaxed bg-slate-950 rounded-lg p-4 overflow-auto max-h-96",children:g.jsx(Oa,{data:e,defaultExpanded:!0})}):g.jsx(Jn,{tagName:s,data:e,onError:()=>o("json")})]})}const az=[10,25,50,100];function io(t,e){return e?`${e} (${t})`:t}function nz({schema:t,viewRegistry:e,config:r,onDataChanged:a,uidParam:i}){var f;const{uid:s}=Dm(),o=ll(),u=i??s;if(!u)return null;const d=(f=o.state)==null?void 0:f.initialPaths;return g.jsx(Wk,{rootUid:u,initialPaths:d,children:g.jsx(aD,{schema:t,viewRegistry:e,config:r,onDataChanged:a})})}function iz({uid:t,schema:e,viewRegistry:r,config:a,onDataChanged:i,isDrilled:s=!1,drillIndex:o=0,laneId:u}){var $e,et;const d=un(),{drillIn:f,popTo:h,setRootType:p}=ah(),{scopePath:m,scopeUrlPrefix:y,scopedPath:x,enterSubgraph:E}=ba(),w=Ro(),T=xt.useUtils(),[C,N]=U.useState(!1),[A,D]=U.useState(!1),[M,j]=U.useState(null),[k,R]=U.useState(""),[z,B]=U.useState(!1),[L,q]=U.useState(!1),[I,Q]=U.useState(null),[_,V]=U.useState(null),[F,K]=U.useState(null),ee=!e.readonly,{addRecent:P}=rh(),{data:G,isLoading:Z,error:J,refetch:X}=xt.getNodeDetail.useQuery({uid:t,...Zt(m)},{enabled:!!t}),Y=(G==null?void 0:G.node)??null,le=((($e=G==null?void 0:G.outEdges)==null?void 0:$e.length)??0)+(((et=G==null?void 0:G.inEdges)==null?void 0:et.length)??0),me=(J==null?void 0:J.message)??F??null,[oe,ae]=U.useState(0),re=()=>ae(xe=>xe+1),se=()=>{T.getNodeDetail.invalidate({uid:t,...Zt(m)}),T.getEdges.invalidate()};U.useEffect(()=>{N(!1),B(!1),q(!1),K(null)},[t]),U.useEffect(()=>{Y&&o===0&&p(Y.aType)},[Y,o,p]),U.useEffect(()=>{Y&&o===0&&P({type:"node",label:Y.aUid,sublabel:Y.aType,url:x(`/node/${encodeURIComponent(Y.aUid)}`)})},[Y==null?void 0:Y.aUid]),U.useEffect(()=>{if(!(!w||!Y||o!==0))return w.setFocused({uid:Y.aUid,nodeType:Y.aType}),()=>{w.setFocused(null)}},[Y==null?void 0:Y.aUid,Y==null?void 0:Y.aType,o,w]);const ie=xt.deleteNode.useMutation({onSuccess:()=>{se(),i==null||i(),s&&u?h(u,o-1):d(y)},onError:xe=>K(xe.message),onSettled:()=>{j(null),R("")}}),Ne=xt.deleteNodeCascade.useMutation({onSuccess:xe=>{se(),K(xe.errors.length>0?`Cascade partially failed: ${xe.errors.map(ze=>ze.message).join(", ")}`:null),i==null||i(),xe.success&&(s&&u?h(u,o-1):d(y))},onError:xe=>K(xe.message),onSettled:()=>{j(null),R("")}}),Ae=xt.deleteEdge.useMutation({onSuccess:()=>{Q(null),se(),re(),i==null||i()},onError:xe=>K(xe.message)}),Ze=xt.bulkDeleteEdges.useMutation({onSuccess:xe=>{V(null),se(),re(),i==null||i(),xe.errors.length>0&&K(`Bulk delete partially failed: deleted ${xe.deleted}, ${xe.errors.length} batch(es) failed`)},onError:xe=>{K(xe.message),V(null)}}),Qe=xt.deleteEdgesBatch.useMutation({onSuccess:()=>{V(null),se(),re(),i==null||i()},onError:xe=>{K(xe.message),V(null)}}),Se=()=>{t&&ie.mutate({uid:t,...Zt(m)})},Oe=()=>{t&&Ne.mutate({uid:t,...Zt(m)})},ke=()=>{I&&Ae.mutate({aUid:I.aUid,axbType:I.axbType,bUid:I.bUid,...Zt(m)})},Pe=()=>{if(!_)return;const xe=_;if(xe.mode==="visible")Qe.mutate({edges:xe.edges,...Zt(m)});else if(xe.mode==="filtered"){const ze={axbType:xe.axbType,...xe.direction==="out"?{aUid:xe.uid}:{bUid:xe.uid},...Zt(m)};xe.where.length>0&&(ze.where=xe.where),Ze.mutate(ze)}else Ze.mutate(xe.direction==="out"?{aUid:xe.uid,axbType:xe.axbType,...Zt(m)}:{bUid:xe.uid,axbType:xe.axbType,...Zt(m)})},Ge=U.useMemo(()=>{if(!Y)return[];const xe=[],ze=new Set;for(const Re of e.edgeTypes)Re.aType===Y.aType&&Re.targetGraph&&!ze.has(Re.targetGraph)&&(ze.add(Re.targetGraph),xe.push({name:Re.targetGraph,edgeType:Re.axbType,targetType:Re.bType}));return xe},[e.edgeTypes,Y]),Je=U.useMemo(()=>(e.collections??[]).filter(xe=>xe.parentNodeType===(Y==null?void 0:Y.aType)),[e.collections,Y==null?void 0:Y.aType]);if(Z)return g.jsx("div",{className:"flex items-center justify-center py-20",children:g.jsx("div",{className:"w-5 h-5 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})});if(me)return g.jsx("div",{className:"p-6",children:g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-sm text-red-400",children:me})});if(!Y)return g.jsx("div",{className:"p-6",children:g.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[g.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Node Not Found"}),g.jsxs("p",{className:"text-sm text-slate-400",children:["No node with UID ",g.jsx("code",{className:"text-indigo-400 font-mono",children:t})," was found."]})]})});if(C)return g.jsx("div",{className:"p-6 max-w-6xl mx-auto",children:g.jsx(HN,{schema:e,existingNode:Y,onSaved:()=>{N(!1),X(),i==null||i()},onCancel:()=>N(!1)})});const Be=e.edgeTypes.filter(xe=>xe.aType===Y.aType).map(xe=>xe.axbType),nt=e.edgeTypes.filter(xe=>xe.bType===Y.aType).map(xe=>xe.axbType),ye={};for(const xe of e.edgeTypes)xe.inverseLabel&&(ye[xe.axbType]=xe.inverseLabel);return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx(Qt,{to:x(`/browse/${encodeURIComponent(Y.aType)}`),className:`px-2 py-0.5 rounded text-xs font-mono hover:opacity-80 transition-opacity ${nr(Y.aType)}`,children:Y.aType}),g.jsx("h1",{className:"text-xl font-bold font-mono",children:Y.aUid}),g.jsxs("div",{className:"ml-auto flex gap-2",children:[g.jsx("button",{onClick:()=>D(!0),className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Graph"}),ee&&g.jsxs(g.Fragment,{children:[g.jsx("button",{onClick:()=>N(!0),className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Edit"}),g.jsx("button",{onClick:()=>j("choose"),className:"px-3 py-1.5 bg-red-600/20 text-red-400 rounded-lg text-xs hover:bg-red-600/30 transition-colors",children:"Delete"})]})]})]}),g.jsxs("div",{className:"flex gap-4 text-xs text-slate-500 mt-2",children:[g.jsxs("span",{children:["Created: ",so(Y.createdAt)]}),g.jsxs("span",{children:["Updated: ",so(Y.updatedAt)]})]}),(Ge.length>0||Je.length>0)&&g.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[Ge.map(xe=>g.jsxs("button",{onClick:()=>E(Y.aUid,xe.name),className:"flex items-center gap-1.5 px-3 py-1.5 bg-indigo-950/50 border border-indigo-500/30 rounded-lg text-xs text-indigo-300 hover:bg-indigo-900/50 hover:border-indigo-400/50 transition-colors",children:[g.jsx("svg",{className:"w-3 h-3 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),xe.name]},xe.name)),Je.map(xe=>{const ze={};xe.pathParams.length>0&&(ze[xe.pathParams[0]]=Y.aUid);const Re=an(xe.path,ze);return g.jsxs(Qt,{to:aa(Re),className:"flex items-center gap-1.5 px-3 py-1.5 bg-amber-950/30 border border-amber-500/20 rounded-lg text-xs text-amber-300 hover:bg-amber-900/40 hover:border-amber-400/40 transition-colors",children:[g.jsx("svg",{className:"w-3 h-3 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),xe.name]},xe.name)})]})]}),g.jsx("div",{className:"mb-6",children:g.jsx($N,{nodeType:Y.aType,data:Y.data,viewRegistry:r,config:a},t)}),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5 mb-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Outgoing Edges"}),ee&&!z&&g.jsxs("button",{onClick:()=>B(!0),className:"px-3 py-1 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Edge"]})]}),z&&g.jsx("div",{className:"mb-4",children:g.jsx(V2,{schema:e,viewRegistry:r,config:a,defaultUid:Y.aUid,defaultType:Y.aType,direction:"out",onSaved:()=>{B(!1),re(),i==null||i()},onCancel:()=>B(!1)})}),!z&&g.jsx(bE,{uid:Y.aUid,direction:"out",axbTypes:Be,canWrite:ee,onDeleteEdge:xe=>Q({aUid:xe.aUid,axbType:xe.axbType,bUid:xe.bUid}),onBulkDelete:xe=>V(xe),nodeUid:Y.aUid,reloadKey:oe,viewRegistry:r,config:a,schema:e,publishToNearby:o===0})]}),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5 mb-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Incoming Edges"}),ee&&!L&&nt.length>0&&g.jsxs("button",{onClick:()=>q(!0),className:"px-3 py-1 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Edge"]})]}),L&&g.jsx("div",{className:"mb-4",children:g.jsx(V2,{schema:e,viewRegistry:r,config:a,defaultUid:Y.aUid,defaultType:Y.aType,direction:"in",onSaved:()=>{q(!1),re(),i==null||i()},onCancel:()=>q(!1)})}),!L&&g.jsx(bE,{uid:Y.aUid,direction:"in",axbTypes:nt,inverseLabelMap:ye,canWrite:ee,onDeleteEdge:xe=>Q({aUid:xe.aUid,axbType:xe.axbType,bUid:xe.bUid,inverseLabel:ye[xe.axbType]}),onBulkDelete:xe=>V(xe),nodeUid:Y.aUid,reloadKey:oe,viewRegistry:r,config:a,schema:e,publishToNearby:o===0})]}),e.edgeTypes.length>0&&g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("h2",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[g.jsx("svg",{className:"w-4 h-4 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Traverse from this node"]}),g.jsx(GN,{schema:e,startUid:Y.aUid,startNodeType:Y.aType,viewRegistry:r,config:a})]}),M==="choose"&&Ku.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:()=>j(null),children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:xe=>xe.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Delete Node"}),g.jsxs("p",{className:"text-sm text-slate-400 mb-2",children:["How do you want to delete"," ",g.jsxs("span",{className:"font-mono text-slate-300",children:['"',Y.aUid,'"']})," (",Y.aType,")?"]}),le>0&&g.jsxs("p",{className:"text-xs text-amber-400/80 mb-4",children:["This node has ",le,"+ connected edge",le!==1?"s":"","."]}),g.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[g.jsxs("button",{onClick:()=>{R(""),j("confirm-cascade")},className:"w-full px-4 py-2.5 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors flex items-center justify-center gap-2",children:["Delete node + ",g.jsx("span",{className:"font-bold uppercase",children:"ALL"})," edges"]}),g.jsx("button",{onClick:()=>{R(""),j("confirm-node-only")},className:"w-full px-4 py-2 bg-slate-800 text-slate-300 rounded-lg text-sm hover:bg-slate-700 transition-colors flex items-center justify-center gap-2",children:"Delete node only"}),g.jsx("button",{onClick:()=>j(null),className:"w-full px-4 py-2 text-sm text-slate-500 hover:text-slate-300 transition-colors",children:"Cancel"})]})]})}),document.body),(M==="confirm-cascade"||M==="confirm-node-only")&&Ku.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:()=>{j(null),R("")},children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:xe=>xe.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:M==="confirm-cascade"?g.jsxs(g.Fragment,{children:["Confirm: Delete node + ",g.jsx("span",{className:"text-red-400 uppercase",children:"ALL"})," edges"]}):"Confirm: Delete node only"}),g.jsx("p",{className:"text-sm text-slate-400 mb-4",children:M==="confirm-cascade"?g.jsxs(g.Fragment,{children:["This will permanently delete the node and"," ",g.jsx("span",{className:"text-red-400 font-semibold uppercase",children:"ALL"})," connected edges."]}):"This will delete only the node record. Connected edges will remain."}),g.jsxs("div",{className:"mb-4",children:[g.jsxs("p",{className:"text-xs text-slate-500 mb-2",children:["Type ",g.jsx("span",{className:"font-mono text-slate-300",children:Y.aUid})," to confirm:"]}),g.jsx("input",{type:"text",value:k,onChange:xe=>R(xe.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono focus:outline-none focus:border-red-500/50 placeholder:text-slate-600",placeholder:Y.aUid,autoFocus:!0,onKeyDown:xe=>{xe.key==="Enter"&&k===Y.aUid&&(M==="confirm-cascade"?Oe():Se())}})]}),g.jsxs("div",{className:"flex justify-end gap-3",children:[g.jsx("button",{onClick:()=>{j("choose"),R("")},disabled:ie.isPending||Ne.isPending,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Back"}),g.jsxs("button",{onClick:M==="confirm-cascade"?Oe:Se,disabled:k!==Y.aUid||ie.isPending||Ne.isPending,className:"px-4 py-2 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[(ie.isPending||Ne.isPending)&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),M==="confirm-cascade"?"Delete":"Delete node only"]})]})]})}),document.body),I&&g.jsx(q2,{title:"Delete Edge",message:`Delete edge ${I.aUid} —[${io(I.axbType,I.inverseLabel)}]→ ${I.bUid}?`,requireConfirmText:I.axbType,onConfirm:ke,onCancel:()=>Q(null),loading:Ae.isPending}),_&&g.jsx(q2,{title:_.mode==="visible"?`Delete ${_.edges.length} Edge${_.edges.length!==1?"s":""}`:_.mode==="filtered"?"Delete Filtered Edges":g.jsxs(g.Fragment,{children:["Delete ",g.jsx("span",{className:"text-red-400 uppercase font-bold",children:"ALL"})," Edges"]}),message:_.mode==="visible"?`Delete the ${_.edges.length} "${io(_.axbType,_.inverseLabel)}" edge${_.edges.length!==1?"s":""} currently visible on this page?`:_.mode==="filtered"?`Delete all "${io(_.axbType,_.inverseLabel)}" edges ${_.direction==="out"?"from":"to"} this node that match the current filters? This may include edges on other pages.`:g.jsxs(g.Fragment,{children:["Delete ",g.jsx("span",{className:"text-red-400 font-semibold uppercase",children:"ALL"}),' "',io(_.axbType,_.inverseLabel),'" edges'," ",_.direction==="out"?"from":"to"," this node? This cannot be undone."]}),confirmLabel:_.mode==="visible"?`Delete ${_.edges.length}`:"Delete All",requireConfirmText:_.axbType,onConfirm:Pe,onCancel:()=>V(null),loading:Ze.isPending||Qe.isPending}),A&&Y&&g.jsx(FN,{node:Y,schema:e,viewRegistry:r,config:a,onClose:()=>D(!1),onNodeClick:(xe,ze)=>{D(!1),f({uid:xe,nodeType:ze,edgeType:"",direction:"out"})}})]})}function bE({uid:t,direction:e,axbTypes:r,inverseLabelMap:a={},canWrite:i,onDeleteEdge:s,onBulkDelete:o,nodeUid:u,reloadKey:d,viewRegistry:f,config:h,schema:p,publishToNearby:m=!1}){const{scopePath:y}=ba(),[x,E]=U.useState(25),[w,T]=U.useState(""),[C,N]=U.useState(""),[A,D]=U.useState("asc"),[M,j]=U.useState(""),[k,R]=U.useState("=="),[z,B]=U.useState(""),[L,q]=U.useState([]),[I,Q]=U.useState(!1),[_,V]=U.useState(1),[F,K]=U.useState([]),[ee,P]=U.useState(void 0),[G,Z]=U.useState(!1),[J,X]=U.useState(!1),[Y,le]=U.useState({}),me=["axbType","aType","aUid","bType","bUid","createdAt","updatedAt"],oe=U.useMemo(()=>{const ye=p.edgeSchemas??[],$e=w?ye.filter(xe=>xe.axbType===w):ye.filter(xe=>r.includes(xe.axbType)),et=new Set;for(const xe of $e)for(const ze of xe.fields)et.add(ze.name);return[...et].sort()},[p.edgeSchemas,w,r]),ae={...e==="out"?{aUid:t}:{bUid:t},...w?{axbType:w}:{},limit:x,startAfter:ee,...C?{sortBy:C,sortDir:A}:{},...L.length>0?{where:L}:{},...Zt(y)},{data:re,isLoading:se,error:ie,refetch:Ne}=xt.getEdges.useQuery(ae,{placeholderData:ye=>ye}),Ae=(re==null?void 0:re.edges)??[],Ze=(re==null?void 0:re.hasMore)??!1,Qe=(re==null?void 0:re.nextCursor)??null,Se=(ie==null?void 0:ie.message)??null,Oe=Ro();U.useEffect(()=>{!m||!Oe||Oe.setEdgeResults(e,{edges:Ae,hasMore:Ze,loading:se})},[m,Oe,e,Ae,Ze,se]);const ke=J&&Ae.length>0?[...new Set(Ae.map(ye=>e==="out"?ye.bUid:ye.aUid))].filter(ye=>!(ye in Y)):[],{data:Pe,isFetching:Ge}=xt.getNodesBatch.useQuery({uids:ke,...Zt(y)},{enabled:ke.length>0});U.useEffect(()=>{if(!Pe)return;const ye={};for(const[$e,et]of Object.entries(Pe.nodes))ye[$e]=et;le($e=>({...$e,...ye}))},[Pe]),U.useEffect(()=>{V(1),K([]),P(void 0),le({})},[t,e,x,w,C,A,L,d,y]);const Je=()=>{Qe&&(K(ye=>[...ye,Qe]),V(ye=>ye+1),P(Qe))},Be=()=>{if(_<=1)return;const ye=[...F];ye.pop();const $e=ye.length>0?ye[ye.length-1]:void 0;K(ye),V(et=>et-1),P($e)},nt={};for(const ye of Ae){const $e=ye.axbType;nt[$e]||(nt[$e]=[]),nt[$e].push(ye)}return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-3",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Show"}),g.jsx("select",{value:x,onChange:ye=>E(Number(ye.target.value)),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:az.map(ye=>g.jsx("option",{value:ye,children:ye},ye))})]}),r.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Type"}),g.jsxs("select",{value:w,onChange:ye=>T(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"All"}),r.map(ye=>g.jsx("option",{value:ye,children:ye},ye))]})]})]}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("button",{onClick:()=>Q(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors flex items-center gap-1 ${I||C||L.length>0?"bg-indigo-600/20 border-indigo-500/40 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),L.length>0?`Filter (${L.length})`:C?"Sort":"Sort / Filter"]}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:Be,disabled:_<=1||se,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Prev"}),g.jsxs("span",{className:"text-xs text-slate-400 px-1",children:["Page ",_]}),g.jsx("button",{onClick:Je,disabled:!Ze||se,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]}),g.jsx("button",{onClick:()=>{V(1),K([]),P(void 0),Ne()},disabled:se,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-50",title:"Refresh",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsx("button",{onClick:()=>Z(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors ${G?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,title:G?"Collapse all edge details":"Expand all edge details",children:G?"Collapse all":"Expand all"}),g.jsx("button",{onClick:()=>X(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors ${J?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,title:J?"Stop resolving target nodes":"Resolve all target nodes inline",children:Ge?g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx("span",{className:"w-2.5 h-2.5 border border-indigo-400 border-t-transparent rounded-full animate-spin"}),"Resolving..."]}):J?"Resolved":"Resolve all"})]}),I&&g.jsxs("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3 mb-3 space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-10",children:"Sort"}),g.jsxs("select",{value:C,onChange:ye=>N(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"Default (axbType)"}),me.map(ye=>g.jsx("option",{value:ye,children:ye},ye)),oe.length>0&&g.jsx("optgroup",{label:"Data fields",children:oe.map(ye=>g.jsx("option",{value:ye,children:ye},ye))})]}),g.jsxs("select",{value:A,onChange:ye=>D(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"asc",children:"asc"}),g.jsx("option",{value:"desc",children:"desc"})]})]}),L.length>0&&g.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[L.map((ye,$e)=>g.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-600/20 border border-indigo-500/30 rounded text-[11px] text-indigo-300",children:[g.jsx("span",{className:"font-mono",children:ye.field}),g.jsx("span",{className:"text-indigo-400",children:ye.op}),g.jsx("span",{className:"font-mono",children:String(ye.value)}),g.jsx("button",{onClick:()=>q(et=>et.filter((xe,ze)=>ze!==$e)),className:"ml-0.5 text-indigo-400 hover:text-red-400 transition-colors",children:"×"})]},$e)),g.jsx("button",{onClick:()=>q([]),className:"text-[10px] text-slate-500 hover:text-red-400 transition-colors",children:"Clear all"})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-10",children:"Where"}),g.jsxs("select",{value:M,onChange:ye=>j(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"Field..."}),me.map(ye=>g.jsx("option",{value:ye,children:ye},ye)),oe.length>0&&g.jsx("optgroup",{label:"Data fields",children:oe.map(ye=>g.jsx("option",{value:ye,children:ye},ye))})]}),g.jsx("select",{value:k,onChange:ye=>R(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:["==","!=","<","<=",">",">="].map(ye=>g.jsx("option",{value:ye,children:ye},ye))}),g.jsx("input",{type:"text",value:z,onChange:ye=>B(ye.target.value),placeholder:"value",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500 w-28",onKeyDown:ye=>{if(ye.key==="Enter"&&M&&z){let $e=z;z==="true"?$e=!0:z==="false"?$e=!1:!isNaN(Number(z))&&z.trim()!==""&&($e=Number(z)),q(et=>[...et,{field:M,op:k,value:$e}]),B("")}}}),g.jsx("button",{onClick:()=>{if(!M||!z)return;let ye=z;z==="true"?ye=!0:z==="false"?ye=!1:!isNaN(Number(z))&&z.trim()!==""&&(ye=Number(z)),q($e=>[...$e,{field:M,op:k,value:ye}]),B("")},disabled:!M||!z,className:"px-2 py-1 bg-indigo-600/30 text-indigo-300 rounded text-xs hover:bg-indigo-600/40 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Add"})]})]}),Se&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-2 mb-3 text-xs text-red-400",children:Se}),se?g.jsxs("div",{className:"flex items-center gap-2 text-slate-400 py-6 justify-center",children:[g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-xs",children:"Loading edges..."})]}):Ae.length===0?g.jsxs("p",{className:"text-sm text-slate-500",children:["No ",e==="out"?"outgoing":"incoming"," edges",w?` of type "${w}"`:""]}):g.jsx("div",{className:"space-y-4",children:Object.entries(nt).map(([ye,$e])=>g.jsx(sz,{axbType:ye,edges:$e,direction:e,inverseLabel:e==="in"?a[ye]:void 0,canWrite:i,onDeleteEdge:s,onBulkDelete:o&&u?et=>{const xe=e==="in"?a[ye]:void 0;o(et==="visible"?{mode:"visible",axbType:ye,inverseLabel:xe,edges:$e.map(ze=>({aUid:ze.aUid,axbType:ze.axbType,bUid:ze.bUid}))}:et==="filtered"?{mode:"filtered",axbType:ye,inverseLabel:xe,direction:e,uid:u,where:L}:{mode:"all",axbType:ye,inverseLabel:xe,direction:e,uid:u})}:void 0,hasActiveFilters:L.length>0,expandAll:G,resolveAll:J,resolvedNodes:Y,viewRegistry:f,config:h},ye))}),Ae.length>0&&(Ze||_>1)&&g.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[g.jsxs("span",{className:"text-[10px] text-slate-500",children:[Ae.length," edge",Ae.length!==1?"s":""," on this page"]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:Be,disabled:_<=1||se,className:"px-2 py-1 bg-slate-800 text-slate-300 rounded text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Previous"}),g.jsxs("span",{className:"text-[10px] text-slate-400 px-1",children:["Page ",_]}),g.jsx("button",{onClick:Je,disabled:!Ze||se,className:"px-2 py-1 bg-slate-800 text-slate-300 rounded text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]})]})]})}function sz({axbType:t,edges:e,direction:r,inverseLabel:a,canWrite:i,onDeleteEdge:s,onBulkDelete:o,hasActiveFilters:u=!1,expandAll:d,resolveAll:f,resolvedNodes:h,viewRegistry:p,config:m}){var ee;const{scopePath:y}=ba(),[x,E]=U.useState(!1),[w,T]=U.useState(""),[C,N]=U.useState(""),[A,D]=U.useState(!1),[M,j]=U.useState(!1),[k,R]=U.useState({}),z=d||A,B=f||M,[L,q]=U.useState(!0),I=((ee=p==null?void 0:p.edges[t])==null?void 0:ee.views)??[],Q=U.useMemo(()=>{var G;const P=new Map;if(!p)return[];for(const Z of e){const J=r==="out"?Z.bType:Z.aType;for(const X of((G=p.nodes[J])==null?void 0:G.views)??[])P.has(X.viewName)||P.set(X.viewName,X)}return[...P.values()]},[p,e,r]),_={...h,...k},V=M&&!f&&e.length>0?[...new Set(e.map(P=>r==="out"?P.bUid:P.aUid))].filter(P=>!(P in _)):[],{data:F,isFetching:K}=xt.getNodesBatch.useQuery({uids:V,...Zt(y)},{enabled:V.length>0});return U.useEffect(()=>{if(!F)return;const P={};for(const[G,Z]of Object.entries(F.nodes))P[G]=Z;R(G=>({...G,...P}))},[F]),g.jsxs("div",{children:[g.jsxs("div",{className:"text-xs font-mono mb-2 flex items-center gap-2",children:[r==="out"?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"—"}),g.jsx("span",{className:"text-indigo-400",children:t}),g.jsx("span",{className:"text-slate-500",children:"→"})]}):a?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"—"}),g.jsx("span",{className:"text-amber-400 cursor-help",title:`Inverse of: ${t}`,children:a}),g.jsx("span",{className:"text-slate-500",children:"→"})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"←"}),g.jsx("span",{className:"text-indigo-400",children:t}),g.jsx("span",{className:"text-slate-500",children:"—"})]}),g.jsxs("span",{className:"text-slate-600 text-[10px]",children:["(",e.length,")"]}),g.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[g.jsx("button",{onClick:()=>D(P=>!P),className:`p-1 border rounded transition-colors ${z?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-500 hover:text-slate-300 hover:bg-slate-700"}`,title:z?"Collapse edges":"Expand edges",children:g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:z?g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"}):g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),g.jsx("button",{onClick:()=>{B?q(P=>!P):(j(!0),q(!0))},className:`p-1 border rounded transition-colors ${B?L?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-indigo-500/50 text-slate-500 hover:text-slate-300":"bg-slate-800 border-slate-700 text-slate-500 hover:text-slate-300 hover:bg-slate-700"}`,title:B?L?"Hide node data":"Show node data":"Resolve target nodes","aria-label":B?L?"Hide node data":"Show node data":"Resolve target nodes",children:K?g.jsx("span",{className:"w-3 h-3 border-[1.5px] border-indigo-400 border-t-transparent rounded-full animate-spin block"}):B&&L?g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M3 3l18 18"})}):g.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),I.length>0&&g.jsxs("span",{className:"relative inline-flex items-center",children:[g.jsx("svg",{className:"w-3 h-3 text-slate-500 absolute left-1.5 pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 5l7 7-7 7M5 12h14"})}),g.jsxs("select",{value:w,onChange:P=>T(P.target.value),className:"bg-slate-800 border border-slate-700 rounded pl-6 pr-1.5 py-0.5 text-[10px] text-slate-300 focus:outline-none focus:border-indigo-500 appearance-none",style:{direction:"rtl"},title:"Edge data view",children:[g.jsx("option",{value:"",dir:"ltr",children:"default"}),g.jsx("option",{value:"json",dir:"ltr",children:"JSON"}),I.map(P=>g.jsx("option",{value:P.viewName,dir:"ltr",children:P.viewName},P.viewName))]})]}),Q.length>0&&g.jsxs("span",{className:"relative inline-flex items-center",children:[g.jsx("svg",{className:"w-3 h-3 text-slate-500 absolute left-1.5 pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("circle",{cx:"12",cy:"12",r:"8"})}),g.jsxs("select",{value:C,onChange:P=>N(P.target.value),className:"bg-slate-800 border border-slate-700 rounded pl-6 pr-1.5 py-0.5 text-[10px] text-slate-300 focus:outline-none focus:border-indigo-500 appearance-none",style:{direction:"rtl"},title:"Node data view",children:[g.jsx("option",{value:"",dir:"ltr",children:"default"}),g.jsx("option",{value:"json",dir:"ltr",children:"JSON"}),Q.map(P=>g.jsx("option",{value:P.viewName,dir:"ltr",children:P.viewName},P.viewName))]})]}),i&&o&&g.jsxs("div",{className:"relative",children:[g.jsx("button",{onClick:()=>E(P=>!P),className:`p-1 border rounded transition-colors ${x?"bg-red-600/20 border-red-500/50 text-red-400":"bg-slate-800 border-slate-700 text-slate-600 hover:text-red-400 hover:border-red-500/50"}`,title:`Bulk delete ${io(t,a)} edges`,children:g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}),x&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>E(!1)}),g.jsxs("div",{className:"absolute right-0 top-full mt-1 z-40 bg-slate-800 border border-slate-700 rounded-lg shadow-xl py-1 min-w-[200px]",children:[g.jsxs("button",{onClick:()=>{E(!1),o("visible")},className:"w-full text-left px-3 py-2 text-xs text-slate-300 hover:bg-slate-700 transition-colors",children:["Delete visible (",e.length,")"]}),u&&g.jsx("button",{onClick:()=>{E(!1),o("filtered")},className:"w-full text-left px-3 py-2 text-xs text-slate-300 hover:bg-slate-700 transition-colors",children:"Delete all matching filters"}),g.jsxs("button",{onClick:()=>{E(!1),o("all")},className:"w-full text-left px-3 py-2 text-xs text-red-400 hover:bg-slate-700 transition-colors",children:["Delete ",g.jsx("span",{className:"font-bold uppercase",children:"ALL"})," ",io(t,a)," edges"]})]})]})]})]})]}),g.jsx("div",{className:"space-y-1",children:e.map((P,G)=>{var X,Y;const Z=r==="out"?P.bUid:P.aUid,J=r==="out"?P.bType:P.aType;return g.jsx(lz,{edge:P,targetUid:Z,targetType:J,direction:r,canWrite:i,onDelete:()=>s(P),expandAllActive:z,resolvedNode:_[Z],resolveAllActive:B,edgeViews:((X=p==null?void 0:p.edges[P.axbType])==null?void 0:X.views)??[],nodeViews:((Y=p==null?void 0:p.nodes[J])==null?void 0:Y.views)??[],config:m,groupEdgeView:w,groupNodeView:C,groupNodeVisible:L},G)})})]})}function lz({edge:t,targetUid:e,targetType:r,direction:a,canWrite:i,onDelete:s,expandAllActive:o,resolvedNode:u,resolveAllActive:d,edgeViews:f=[],nodeViews:h=[],config:p,groupEdgeView:m="",groupNodeView:y="",groupNodeVisible:x=!0}){const{drillIn:E}=ah(),{scopePath:w,scopedPath:T}=ba(),C=xt.useUtils(),[N,A]=U.useState(!1),D=N||!!o,[M,j]=U.useState(!1),k=()=>{var oe,ae;const me=(ae=(oe=p.viewDefaults)==null?void 0:oe.edges)==null?void 0:ae[t.axbType];if(me&&f.length>0){const re=nn(me,f,"inline");if(re!=="json"){const se=f.find(ie=>ie.viewName===re);if(se)return se.tagName}}return"json"},[R,z]=U.useState(k),B=()=>{var oe,ae;const me=(ae=(oe=p.viewDefaults)==null?void 0:oe.nodes)==null?void 0:ae[r];if(me&&h.length>0){const re=nn(me,h,"inline");if(re!=="json"){const se=h.find(ie=>ie.viewName===re);if(se)return se.tagName}}return"json"},[L,q]=U.useState(B),I=(me,oe,ae)=>{if(!me)return ae;if(me==="json")return"json";const re=oe.find(se=>se.viewName===me);return re?re.tagName:ae},Q=I(m,f,R),_=z,V=I(y,h,L),F=q,[K,ee]=U.useState(void 0),[P,G]=U.useState(!1),Z=Object.keys(t.data).length>0,J=K!==void 0?K:u,X=J!==void 0;U.useEffect(()=>{var me,oe;if(d&&u!==void 0&&(j(!0),u)){const ae=(oe=(me=p.viewDefaults)==null?void 0:me.nodes)==null?void 0:oe[r];if(ae&&h.length>0){const re=nn(ae,h,"inline");if(re!=="json"){const se=h.find(ie=>ie.viewName===re);se&&F(se.tagName)}}}},[d,u]);const Y=async()=>{var me,oe;G(!0);try{const re=(await C.getNodesBatch.fetch({uids:[e],...Zt(w)})).nodes[e]??null;if(ee(re),j(!0),re){const se=(oe=(me=p.viewDefaults)==null?void 0:me.nodes)==null?void 0:oe[r];if(se&&h.length>0){const ie=nn(se,h,"inline");if(ie!=="json"){const Ne=h.find(Ae=>Ae.viewName===ie);Ne&&F(Ne.tagName)}}}}catch{}finally{G(!1)}},le=()=>{E({uid:e,nodeType:r,edgeType:t.axbType,direction:a})};return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(r)}`,children:r}),g.jsx("button",{onClick:le,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",title:"Dive into this node",children:e}),g.jsx(Qt,{to:T(`/node/${encodeURIComponent(e)}`),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",title:"Navigate to this node's page",children:"go to"}),g.jsx("button",{onClick:()=>A(!N),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:D?"hide edge":"show edge"}),!X&&!P&&g.jsx("button",{onClick:Y,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"resolve"}),P&&g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-400 border-t-transparent rounded-full animate-spin"}),X&&g.jsx("button",{onClick:()=>j(!M),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:M?"hide node":"show node"}),i&&g.jsx("button",{onClick:s,className:"ml-auto text-[10px] text-slate-600 hover:text-red-400 transition-colors",children:"delete"})]}),D&&g.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[g.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[11px] font-mono bg-slate-950 rounded p-2",children:[g.jsx("span",{className:"text-slate-500",children:"aType"}),g.jsx("span",{className:"text-slate-300",children:t.aType}),g.jsx("span",{className:"text-slate-500",children:"aUid"}),g.jsx("span",{className:"text-slate-300",children:t.aUid}),g.jsx("span",{className:"text-slate-500",children:"axbType"}),g.jsx("span",{className:"text-slate-300",children:t.axbType}),g.jsx("span",{className:"text-slate-500",children:"bType"}),g.jsx("span",{className:"text-slate-300",children:t.bType}),g.jsx("span",{className:"text-slate-500",children:"bUid"}),g.jsx("span",{className:"text-slate-300",children:t.bUid}),g.jsx("span",{className:"text-slate-500",children:"createdAt"}),g.jsx("span",{className:"text-slate-300",children:so(t.createdAt)}),g.jsx("span",{className:"text-slate-500",children:"updatedAt"}),g.jsx("span",{className:"text-slate-300",children:so(t.updatedAt)})]}),Z&&g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Data"}),f.length>0&&g.jsx(Ao,{views:f,activeView:Q,onSwitch:_})]}),Q==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Oa,{data:t.data,defaultExpanded:!0})}):g.jsx(Jn,{tagName:Q,data:t.data,onError:()=>_("json")})]})]}),M&&X&&x&&g.jsx("div",{className:"px-3 pb-2",children:J===null?g.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"Node not found"}):g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Node Data"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:so(J.updatedAt)}),h.length>0&&g.jsx(Ao,{views:h,activeView:V,onSwitch:F})]}),V==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Oa,{data:J.data,defaultExpanded:!0})}):g.jsx(Jn,{tagName:V,data:J.data,onError:()=>F("json")})]})})]})}function oz(t){const e=t.data;switch(t.kind){case"node-detail":{const r=e.node;return r?`${r.type}:${r.uid}`:"Node Not Found"}case"nodes-list":return`${(Array.isArray(e.nodes)?e.nodes:[]).length} Nodes`;case"edges-list":return`${(Array.isArray(e.edges)?e.edges:[]).length} Edges`;case"traverse":return`Traversal (${(Array.isArray(e.hops)?e.hops:[]).length} hops)`;case"search":return"Search Results";case"schema":return"Schema";default:return"Query Result"}}function uz({artifact:t,viewRegistry:e,config:r,onNavigate:a}){switch(t.kind){case"node-detail":return g.jsx(cz,{data:t.data,viewRegistry:e,config:r,onNavigate:a});case"nodes-list":return g.jsx(dz,{data:t.data,onNavigate:a});case"edges-list":return g.jsx(fz,{data:t.data,onNavigate:a});case"traverse":return g.jsx(hz,{data:t.data,onNavigate:a});case"search":return g.jsx(vz,{data:t.data,onNavigate:a});case"schema":return g.jsx(pz,{data:t.data});default:return g.jsx(Oa,{data:t.data??{},defaultExpanded:!0})}}function cz({data:t,viewRegistry:e,config:r,onNavigate:a}){const i=t.node;return i?g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${nr(i.type)}`,children:i.type}),g.jsx("h1",{className:"text-xl font-bold font-mono",children:i.uid}),g.jsx("button",{onClick:()=>a(i.uid),className:"ml-auto px-3 py-1.5 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors",children:"View full details"})]}),g.jsx($N,{nodeType:i.type,data:i.data??{},viewRegistry:e,config:r})]}):g.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[g.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Node Not Found"}),g.jsx("p",{className:"text-sm text-slate-400",children:"The queried node was not found."})]})}function dz({data:t,onNavigate:e}){const r=t.nodes??[],a=t.hasMore;return g.jsxs("div",{className:"space-y-2",children:[r.map((i,s)=>g.jsxs("div",{className:"bg-slate-900 rounded-lg border border-slate-800 px-4 py-3",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(i.type)}`,children:i.type}),g.jsx("button",{onClick:()=>e(i.uid),className:"font-mono text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:i.uid})]}),i.data&&Object.keys(i.data).length>0&&g.jsx("div",{className:"mt-1",children:g.jsx(Oa,{data:i.data,defaultExpanded:!1})})]},s)),a&&g.jsx("p",{className:"text-[10px] text-slate-500 text-center py-1",children:"Results truncated — use a higher limit to see more"})]})}function fz({data:t,onNavigate:e}){const r=t.edges??[],a=t.hasMore;return g.jsxs("div",{className:"space-y-1",children:[g.jsx(YN,{edges:r,onNavigate:e}),a&&g.jsx("p",{className:"text-[10px] text-slate-500 text-center py-1",children:"Results truncated — use a higher limit to see more"})]})}function hz({data:t,onNavigate:e}){const r=t.hops??[],a=t.totalReads;return g.jsxs("div",{className:"space-y-4",children:[r.map((i,s)=>g.jsxs(gm,{title:`Hop ${i.depth}: ${i.relation} (${i.direction})`,badge:`${i.edgeCount} edges`,children:[g.jsx(YN,{edges:i.edges,onNavigate:e}),i.truncated&&g.jsx("p",{className:"text-[10px] text-amber-500 mt-1",children:"Truncated — increase limit to see more"})]},s)),a!=null&&g.jsxs("p",{className:"text-[10px] text-slate-500 text-right",children:[a," total reads"]})]})}function vz({data:t,onNavigate:e}){const r=t.results??[];return r.length===0?g.jsx("p",{className:"text-slate-400 text-sm",children:"No results found"}):g.jsx("div",{className:"space-y-2",children:r.map((a,i)=>g.jsxs("div",{className:"bg-slate-900 rounded-lg border border-slate-800 px-4 py-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(a.type)}`,children:a.type}),g.jsx("button",{onClick:()=>e(a.uid),className:"font-mono text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:a.uid}),a.matchType&&g.jsx("span",{className:"text-[9px] text-slate-500 ml-auto",children:a.matchType})]}),a.data&&Object.keys(a.data).length>0&&g.jsx("div",{className:"mt-1",children:g.jsx(Oa,{data:a.data,defaultExpanded:!1})})]},i))})}function pz({data:t}){const e=t.nodeTypes??[],r=t.edgeTypes??[];return g.jsxs("div",{className:"space-y-4",children:[g.jsx(gm,{title:`Node Types (${e.length})`,children:g.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(a=>g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${nr(a)}`,children:a},a))})}),g.jsx(gm,{title:`Edge Types (${r.length})`,children:g.jsx("div",{className:"space-y-1",children:r.map((a,i)=>g.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono",children:[g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] ${nr(a.from)}`,children:a.from}),g.jsx("span",{className:"text-slate-500",children:"--["}),g.jsx("span",{className:"text-indigo-400",children:a.relation}),g.jsx("span",{className:"text-slate-500",children:"]-->"}),g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] ${nr(a.to)}`,children:a.to}),a.inverseLabel&&g.jsxs("span",{className:"text-[10px] text-slate-600 ml-1",children:["(",a.inverseLabel,")"]})]},i))})})]})}function gm({title:t,badge:e,trailing:r,children:a}){return g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-4",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h3",{className:"text-sm font-semibold text-slate-200",children:t}),e&&g.jsx("span",{className:"text-[10px] text-slate-500",children:e})]}),r]}),a]})}function YN({edges:t,onNavigate:e}){const[r,a]=U.useState(new Set);return g.jsx("div",{className:"space-y-0.5",children:t.map((i,s)=>g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 text-xs",children:[g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] font-mono ${nr(i.fromType)}`,children:i.fromType}),g.jsx("button",{onClick:()=>e(i.fromUid),className:"font-mono text-indigo-400 hover:text-indigo-300 transition-colors truncate max-w-[100px]",title:i.fromUid,children:i.fromUid}),g.jsx("span",{className:"text-slate-500 shrink-0",children:"--["}),g.jsx("span",{className:"text-indigo-400 shrink-0",children:i.relation}),g.jsx("span",{className:"text-slate-500 shrink-0",children:"]-->"}),g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] font-mono ${nr(i.toType)}`,children:i.toType}),g.jsx("button",{onClick:()=>e(i.toUid),className:"font-mono text-indigo-400 hover:text-indigo-300 transition-colors truncate max-w-[100px]",title:i.toUid,children:i.toUid}),i.data&&Object.keys(i.data).length>0&&g.jsx("button",{onClick:()=>{a(o=>{const u=new Set(o);return u.has(s)?u.delete(s):u.add(s),u})},className:"text-[10px] text-slate-500 hover:text-slate-300 ml-auto shrink-0",children:r.has(s)?"hide":"data"})]}),r.has(s)&&i.data&&g.jsx("div",{className:"ml-4 mb-1",children:g.jsx(Oa,{data:i.data,defaultExpanded:!0})})]},s))})}function gz(t,e){var a;const r={};if(t!=null&&t.focused){r.focusedNode={uid:t.focused.uid,nodeType:t.focused.nodeType};const i=(a=e.nodeSchemas)==null?void 0:a.find(s=>s.aType===t.focused.nodeType&&s.isNodeEntry);if(i&&(r.nodeSchema={type:i.aType,description:i.description,fields:i.fields.map(s=>({name:s.name,type:s.type,required:s.required,description:s.description,enumValues:s.enumValues}))}),t.edgeResults.out.edges.length>0){const s={};for(const o of t.edgeResults.out.edges){const u=o.axbType;s[u]||(s[u]={targetType:o.bType,count:0}),s[u].count++}r.outgoingEdges=Object.entries(s).map(([o,u])=>({axbType:o,targetType:u.targetType,count:u.count,hasMore:t.edgeResults.out.hasMore}))}if(t.edgeResults.in.edges.length>0){const s={};for(const o of t.edgeResults.in.edges){const u=o.axbType;s[u]||(s[u]={sourceType:o.aType,count:0}),s[u].count++}r.incomingEdges=Object.entries(s).map(([o,u])=>({axbType:o,sourceType:u.sourceType,count:u.count,hasMore:t.edgeResults.in.hasMore}))}}return r.graphTopology=e.edgeTypes.map(i=>({aType:i.aType,axbType:i.axbType,bType:i.bType,inverseLabel:i.inverseLabel})),r}function mz(t){const e=t.data;switch(t.kind){case"node-detail":{const r=e.node,a=Array.isArray(e.outEdges)?e.outEdges.length:0,i=Array.isArray(e.inEdges)?e.inEdges.length:0;return{icon:"●",label:r?`${r.type}:${r.uid}`:"Node not found",detail:`${a+i} edges`}}case"nodes-list":return{icon:"≡",label:`${(Array.isArray(e.nodes)?e.nodes:[]).length} nodes`,detail:e.hasMore?"has more":""};case"edges-list":return{icon:"→",label:`${(Array.isArray(e.edges)?e.edges:[]).length} edges`,detail:e.hasMore?"has more":""};case"traverse":return{icon:"⚡",label:`Traversal: ${(Array.isArray(e.hops)?e.hops:[]).length} hops`,detail:`${e.totalReads??0} reads`};case"search":return{icon:"⌕",label:`${(Array.isArray(e.results)?e.results:[]).length} results`,detail:"search"};case"schema":{const r=Array.isArray(e.nodeTypes)?e.nodeTypes:[],a=Array.isArray(e.edgeTypes)?e.edgeTypes:[];return{icon:"⊞",label:`${r.length} node types`,detail:`${a.length} edge types`}}default:return{icon:"?",label:"Query result",detail:""}}}function yz({schema:t,viewRegistry:e,config:r}){const{messages:a,status:i,isStreaming:s,sendMessage:o,clearHistory:u,chatEnabled:d}=lk(),{mode:f,expand:h,collapse:p}=tk(),{activeArtifact:m,showArtifact:y,dismissArtifact:x}=JM(),E=Ro(),w=un(),[T,C]=U.useState(""),N=U.useRef(null),A=U.useRef(null),D=U.useRef(null),M=U.useRef(null),j=U.useRef(typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)),k=m!==null;U.useEffect(()=>{var V;(V=N.current)==null||V.scrollIntoView({behavior:"smooth"})},[a]),U.useEffect(()=>{const V=A.current;V&&(V.style.height="auto",V.style.height=Math.min(V.scrollHeight,120)+"px")},[T]),U.useEffect(()=>{f==="expanded"&&setTimeout(()=>{var V;return(V=A.current)==null?void 0:V.focus()},100)},[f]),U.useEffect(()=>{if(!d)return;const V=F=>{const K=F.target.tagName,ee=F.target===A.current;if((F.metaKey||F.ctrlKey)&&F.key==="k"){F.preventDefault(),f==="collapsed"?h():p();return}F.key==="Escape"&&f==="expanded"&&(ee||K!=="INPUT"&&K!=="TEXTAREA"&&K!=="SELECT")&&(k?x():p())};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[d,f,h,p,k,x]);const R=U.useCallback(()=>{j.current||f!=="collapsed"||(D.current=window.setTimeout(()=>{h()},200))},[f,h]),z=U.useCallback(()=>{D.current!==null&&(clearTimeout(D.current),D.current=null)},[]),B=U.useCallback(()=>{s||j.current||(M.current=window.setTimeout(()=>{p()},300))},[s,p]),L=U.useCallback(()=>{M.current!==null&&(clearTimeout(M.current),M.current=null)},[]),q=U.useCallback(()=>{const V=T.trim();if(!V||s||i!=="connected")return;const F=gz(E,t);o(V,F),C("")},[T,s,i,E,t,o]),I=V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),q())},Q=U.useCallback(V=>{y(V)},[y]),_=U.useCallback(V=>{x(),p(),w(`/node/${encodeURIComponent(V)}`)},[x,p,w]);return d?f==="collapsed"?g.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 flex justify-center pointer-events-none",style:{height:40},children:g.jsx("div",{className:"pointer-events-auto cursor-pointer flex items-end pb-3",style:{width:160},onMouseEnter:R,onMouseLeave:z,onClick:()=>{z(),h()},children:g.jsx("div",{className:"chat-breathe-line w-full h-[2px] bg-emerald-400 rounded-full",style:{animation:"chat-breathe 3s ease-in-out infinite"}})})}):g.jsxs("div",{className:"fixed inset-0 z-50 flex",style:{animation:"chat-overlay-in 0.2s ease-out"},onMouseEnter:L,onMouseLeave:B,children:[g.jsx("div",{className:"absolute inset-0 bg-slate-950/90 backdrop-blur-md",onClick:()=>{k?x():p()}}),g.jsxs("div",{className:"relative flex w-full h-full",children:[g.jsxs("div",{className:`flex flex-col h-full transition-all duration-300 ease-out ${k?"w-[420px] shrink-0 border-r border-slate-800":"w-full max-w-[700px] mx-auto"}`,children:[g.jsxs("div",{className:"shrink-0 border-b border-slate-800 px-5 py-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:`w-2 h-2 rounded-full ${i==="connected"?"bg-emerald-500":i==="checking"?"bg-amber-500 animate-pulse":"bg-slate-600"}`}),g.jsx("span",{className:"text-xs text-slate-400 font-medium",children:i==="connected"?"Connected":i==="checking"?"Checking...":"Offline"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[a.length>0&&g.jsx("button",{onClick:u,className:"text-[11px] text-slate-600 hover:text-slate-400 transition-colors px-2 py-1",children:"Clear"}),g.jsx("button",{onClick:p,className:"p-1.5 text-slate-500 hover:text-slate-200 transition-colors",title:"Close (Esc)",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:g.jsx("path",{d:"M1 1l12 12M13 1L1 13"})})})]})]}),g.jsxs("div",{className:"flex-1 overflow-auto px-5 py-6 space-y-4",children:[a.length===0&&g.jsx("div",{className:"text-center text-slate-600 text-sm mt-12",children:i==="connected"?g.jsx("p",{children:"Ask a question about your graph data."}):g.jsx("p",{children:"Waiting for chat service to connect..."})}),a.map(V=>g.jsx(xz,{message:V,activeArtifactId:(m==null?void 0:m.id)??null,onArtifactClick:Q},V.id)),g.jsx("div",{ref:N})]}),g.jsx("div",{className:"px-5 py-1 shrink-0",children:g.jsx("span",{className:"text-[10px] text-slate-600",children:E!=null&&E.focused?`Context: ${E.focused.nodeType}:${E.focused.uid.slice(0,16)}${E.focused.uid.length>16?"...":""}`:"Context: schema only"})}),g.jsx("div",{className:"px-5 pb-5 shrink-0",children:g.jsxs("div",{className:"flex gap-3 items-end",children:[g.jsx("textarea",{ref:A,value:T,onChange:V=>C(V.target.value),onKeyDown:I,placeholder:i==="connected"?"Ask about your graph...":"Agent offline",disabled:i!=="connected"||s,rows:1,className:"flex-1 bg-slate-800/60 border border-slate-700 rounded-xl px-4 py-3 text-sm text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-emerald-500/50 focus:ring-1 focus:ring-emerald-500/20 transition-all resize-none disabled:opacity-50 disabled:cursor-not-allowed"}),g.jsx("button",{onClick:q,disabled:!T.trim()||i!=="connected"||s,className:"px-4 py-3 bg-emerald-600 text-white rounded-xl text-sm font-medium hover:bg-emerald-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:s?g.jsx("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin inline-block"}):g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]}),k&&g.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden animate-[slide-in-right_0.2s_ease-out]",children:[g.jsxs("div",{className:"shrink-0 border-b border-slate-800 px-5 py-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx("span",{className:"text-sm font-semibold text-slate-200 shrink-0",children:oz(m)}),g.jsx("span",{className:"text-[10px] text-slate-500 font-mono truncate",children:m.command.replace(/^npx\s+firegraph\s+/,"")})]}),g.jsx("button",{onClick:x,className:"p-1.5 text-slate-400 hover:text-slate-200 transition-colors shrink-0 ml-3",title:"Close artifact",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:g.jsx("path",{d:"M1 1l12 12M13 1L1 13"})})})]}),g.jsx("div",{className:"flex-1 overflow-auto p-5",children:g.jsx(uz,{artifact:m,viewRegistry:e,config:r,onNavigate:_},m.id)})]})]})]}):null}function xz({message:t,activeArtifactId:e,onArtifactClick:r}){var a;return t.role==="user"?g.jsx("div",{className:"flex justify-end",children:g.jsx("div",{className:"bg-indigo-600/20 border border-indigo-500/20 rounded-xl px-4 py-3 max-w-[80%]",children:g.jsx("p",{className:"text-sm text-slate-200 whitespace-pre-wrap break-words",children:t.content})})}):t.role==="error"?g.jsx("div",{className:"flex justify-start",children:g.jsx("div",{className:"bg-red-500/10 border border-red-500/20 rounded-xl px-4 py-3 max-w-[80%]",children:g.jsx("p",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:t.content})})}):g.jsxs("div",{className:"flex flex-col gap-2 items-start",children:[(t.content||t.streaming)&&g.jsx("div",{className:"bg-slate-800/40 border border-slate-700/40 rounded-xl px-4 py-3 max-w-[85%]",children:g.jsxs("pre",{className:"text-sm text-slate-300 whitespace-pre-wrap break-words font-sans leading-relaxed",children:[t.content,t.streaming&&!t.activeToolCall&&g.jsx("span",{className:"inline-block w-1.5 h-4 bg-emerald-400 animate-pulse ml-0.5 align-text-bottom rounded-sm"})]})}),t.activeToolCall&&g.jsx("div",{className:"bg-slate-800/40 border border-amber-500/20 rounded-xl px-4 py-3 max-w-[85%]",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"w-3 h-3 border-2 border-amber-400 border-t-transparent rounded-full animate-spin shrink-0"}),g.jsx("span",{className:"text-xs text-amber-400 font-mono truncate",children:t.activeToolCall.replace(/^npx\s+firegraph\s+/,"")})]})}),(a=t.artifacts)==null?void 0:a.map(i=>{const{icon:s,label:o,detail:u}=mz(i),d=e===i.id;return g.jsx("button",{onClick:()=>r(i),className:`w-full max-w-[85%] text-left bg-slate-800/60 border rounded-xl px-4 py-3
410
- transition-all hover:bg-slate-700/60 hover:border-indigo-500/50 group
411
- ${d?"border-indigo-500/60 ring-1 ring-indigo-500/30":"border-slate-700/50"}`,children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-indigo-400 text-sm shrink-0",children:s}),g.jsx("span",{className:"text-sm font-medium text-slate-200 truncate",children:o}),g.jsx("span",{className:"text-xs text-slate-500 ml-auto shrink-0",children:u})]})},i.id)})]})}function bz(){const t=eD();if(!t||!t.isScoped)return null;const{scopeSegments:e,firestorePath:r}=t,i=r.split("/")[0];return g.jsxs("nav",{className:"flex items-center px-4 py-2 bg-indigo-950/40 border-b border-indigo-500/20 text-xs gap-1 flex-wrap",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-indigo-400 mr-1 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx(Qt,{to:`/${ya(i)}`,className:"text-indigo-400 hover:text-indigo-300 font-medium transition-colors",children:i}),e.map((s,o)=>{const u=[i];for(let p=0;p<o;p++)u.push(e[p].parentUid,e[p].subgraphName);const d=u.join("/"),h=[...u,s.parentUid,s.subgraphName].join("/");return g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx("span",{className:"text-slate-600",children:"/"}),g.jsx(Qt,{to:`/${ya(d)}/node/${encodeURIComponent(s.parentUid)}`,className:"text-slate-400 hover:text-slate-200 font-mono transition-colors",title:s.parentUid,children:s.parentUid.length>10?`${s.parentUid.slice(0,8)}…`:s.parentUid}),g.jsx("span",{className:"text-slate-600",children:"/"}),g.jsx(Qt,{to:`/${ya(h)}`,className:"text-indigo-400 hover:text-indigo-300 font-medium transition-colors",children:s.subgraphName})]},o)})]})}function wz({schema:t}){const{focused:e,onPeekNearby:r,onClearPeek:a,edgeResults:i}=Xk(),s=un(),o=U.useMemo(()=>e?{uid:e.uid,nodeType:e.nodeType,edgeType:"",direction:"out"}:{uid:"",nodeType:"",edgeType:"",direction:"out"},[e==null?void 0:e.uid,e==null?void 0:e.nodeType]);return e?g.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[g.jsx("div",{className:"px-3 py-2 border-b border-slate-800 shrink-0 cursor-pointer hover:bg-slate-800/50 transition-colors",onMouseEnter:()=>r(o),children:g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[9px] font-mono ${nr(e.nodeType)}`,children:e.nodeType}),g.jsx("span",{className:"text-[11px] font-mono text-slate-300 truncate",children:e.uid})]})}),g.jsx(wE,{direction:"out",results:i.out,schema:t,onPeek:r,onClearPeek:a,navigate:s}),g.jsx(wE,{direction:"in",results:i.in,schema:t,onPeek:r,onClearPeek:a,navigate:s})]}):g.jsxs("div",{className:"px-3 py-6 text-center",children:[g.jsx("svg",{className:"w-6 h-6 mx-auto mb-2 text-slate-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),g.jsx("p",{className:"text-[11px] text-slate-500",children:"Navigate to a node to explore nearby relationships"})]})}function wE({direction:t,results:e,schema:r,onPeek:a,onClearPeek:i,navigate:s}){const{edges:o,hasMore:u,loading:d}=e,f=U.useMemo(()=>{const m={};for(const y of r.edgeTypes)y.inverseLabel&&(m[y.axbType]=y.inverseLabel);return m},[r.edgeTypes]),h=U.useMemo(()=>{const m={};for(const y of o)m[y.axbType]||(m[y.axbType]=[]),m[y.axbType].push(y);return m},[o]),p=Object.entries(h);return d?g.jsxs("div",{className:"px-3 py-2",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-1",children:t==="out"?"Outgoing":"Incoming"}),g.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-600 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:"Loading..."})]})]}):g.jsxs("div",{className:"px-2 py-2",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-1 px-1",children:t==="out"?"Outgoing":"Incoming"}),p.length===0?g.jsx("p",{className:"text-[10px] text-slate-600 px-1",children:"None"}):p.map(([m,y])=>g.jsx(Sz,{axbType:m,edges:y,direction:t,inverseLabel:t==="in"?f[m]:void 0,onPeek:a,onClearPeek:i,navigate:s},m)),u&&g.jsx("p",{className:"text-[10px] text-slate-600 px-1 mt-1",children:"and more..."})]})}function Sz({axbType:t,edges:e,direction:r,inverseLabel:a,onPeek:i,onClearPeek:s,navigate:o}){const[u,d]=U.useState(!0);return g.jsxs("div",{className:"mb-1",children:[g.jsxs("button",{onClick:()=>d(!u),className:"w-full flex items-center gap-1 px-1 py-0.5 rounded text-left hover:bg-slate-800/50 transition-colors group",children:[g.jsx("svg",{className:`w-3 h-3 text-slate-600 transition-transform ${u?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),a?g.jsx("span",{className:"text-amber-400/80 text-[11px] font-mono cursor-help",title:`Inverse of: ${t}`,children:a}):g.jsx("span",{className:"text-indigo-400/80 text-[11px] font-mono",children:t}),g.jsxs("span",{className:"text-slate-600 text-[10px]",children:["(",e.length,")"]})]}),u&&g.jsx("div",{className:"ml-3 space-y-px",children:e.map(f=>{const h=r==="out"?f.bUid:f.aUid,p=r==="out"?f.bType:f.aType;return g.jsx(Ez,{targetUid:h,targetType:p,edgeType:f.axbType,direction:r,onPeek:i,onClearPeek:s,navigate:o},`${f.aUid}:${f.axbType}:${f.bUid}`)})})]})}function Ez({targetUid:t,targetType:e,edgeType:r,direction:a,onPeek:i,onClearPeek:s,navigate:o}){const{scopedPath:u}=ba(),d=U.useRef(null),f=U.useMemo(()=>({uid:t,nodeType:e,edgeType:r,direction:a}),[t,e,r,a]),h=U.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,i(f)},150)},[f,i]),p=U.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),m=U.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null),s(),o(u(`/node/${encodeURIComponent(t)}`))},[t,s,o]);return U.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),g.jsxs("button",{onClick:m,onMouseEnter:h,onMouseLeave:p,className:"w-full flex items-center gap-1.5 px-2 py-1 rounded text-left transition-colors text-slate-400 hover:bg-slate-800 hover:text-slate-200",children:[g.jsx("span",{className:`px-1 py-px rounded text-[9px] font-mono shrink-0 ${nr(e)}`,children:e}),g.jsx("span",{className:"text-[11px] font-mono truncate",children:t})]})}function Tz(t){const e=Math.floor((Date.now()-t)/1e3);return e<60?"just now":e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`}const Cz={node:g.jsx("svg",{className:"w-3 h-3 shrink-0 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})}),collection:g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),"collection-doc":g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-400/80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})};function Nz({entry:t,onClose:e}){return g.jsxs(Qt,{to:t.url,onClick:e,className:"flex items-center gap-2 px-3 py-1.5 hover:bg-slate-800/50 transition-colors group",title:t.label,children:[Cz[t.type],g.jsxs("span",{className:"flex-1 min-w-0",children:[g.jsx("span",{className:"block text-[11px] text-slate-300 truncate font-mono",children:t.label.length>14?`${t.label.slice(0,12)}…`:t.label}),t.sublabel&&g.jsx("span",{className:"block text-[9px] text-slate-500 truncate",children:t.sublabel})]}),g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0 group-hover:text-slate-500",children:Tz(t.timestamp)})]})}function SE({entries:t,triggerRef:e,onClose:r,onClear:a}){const i=U.useRef(null),[s,o]=U.useState(null);return U.useEffect(()=>{if(e.current){const u=e.current.getBoundingClientRect();o({top:u.top,left:u.right+8})}},[e]),U.useEffect(()=>{const u=d=>{const f=d.target;i.current&&!i.current.contains(f)&&e.current&&!e.current.contains(f)&&r()};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r,e]),s?Ku.createPortal(g.jsxs("div",{ref:i,style:{position:"fixed",top:s.top,left:s.left,zIndex:9999},className:"w-64 bg-slate-900 border border-slate-700 rounded-xl shadow-xl shadow-black/50",onMouseLeave:r,children:[g.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-slate-800",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Recent"}),g.jsx("button",{onClick:u=>{u.stopPropagation(),a(),r()},className:"text-[10px] text-slate-600 hover:text-slate-400 transition-colors",children:"Clear"})]}),g.jsx("div",{className:"py-1 max-h-80 overflow-auto",children:t.map(u=>g.jsx(Nz,{entry:u,onClose:r},u.url+u.timestamp))})]}),document.body):null}function jz(t,e){const r=ll();return U.useMemo(()=>{const a=r.pathname;if(a==="/")return{pathType:"root",firestorePath:"",encodedPath:"",graphScope:"",scopeNamesPath:"",isScoped:!1,collectionMatch:null,pageAction:"",isOnNodePage:!1};const i=a.slice(1),s=i.indexOf("/"),o=s>=0?i.slice(0,s):i,u=s>=0?i.slice(s):"",d=IT(o),f=u.startsWith("/node/");if(e)for(const h of e){const p=Kg(d,h.path);if(p)return{pathType:"collection",firestorePath:d,encodedPath:o,graphScope:"",scopeNamesPath:"",isScoped:!1,collectionMatch:{collection:h,params:p},pageAction:u,isOnNodePage:f}}if(VT(d,t)){const h=FT(d,t);return{pathType:"graph",firestorePath:d,encodedPath:o,graphScope:h,scopeNamesPath:HT(h),isScoped:h!=="",collectionMatch:null,pageAction:u,isOnNodePage:f}}return{pathType:"unknown",firestorePath:d,encodedPath:o,graphScope:"",scopeNamesPath:"",isScoped:!1,collectionMatch:null,pageAction:u,isOnNodePage:f}},[r.pathname,t,e])}function Az({schema:t,config:e,viewRegistry:r}){var q;const a=ll(),i=un(),[s,o]=U.useState(""),[u,d]=U.useState(!1),{displayRecents:f,clearRecents:h}=rh(),p=Ro(),m=U.useRef(null),y=jz(e.collection,t.collections),x=xt.useUtils(),E=xt.reloadSchema.useMutation({onSuccess:()=>{x.getSchema.invalidate(),x.getViews.invalidate(),x.getWarnings.invalidate()}}),[w,T]=U.useState(null),C=U.useCallback(I=>{if(!y.encodedPath)return"/";const Q=`/${y.encodedPath}`;if(!I)return Q;const _=I.startsWith("/")?I.slice(1):I;return`${Q}/${_}`},[y.encodedPath]),N=U.useCallback((I,Q)=>{const _=y.firestorePath+"/"+I+"/"+Q;i(`/${ya(_)}`)},[i,y.firestorePath]),A=U.useCallback(()=>{e.collection?i(`/${ya(e.collection)}`):i("/")},[i,e.collection]),D=U.useMemo(()=>{const I=t.nodeSchemas??[];return t.nodeTypes.filter(Q=>{const _=I.find(V=>V.aType===Q.type&&V.isNodeEntry);return qT(y.scopeNamesPath,_==null?void 0:_.allowedIn)})},[t.nodeTypes,t.nodeSchemas,y.scopeNamesPath]),M=U.useCallback(I=>{I.preventDefault();const Q=s.trim();Q&&(y.pathType==="collection"&&y.collectionMatch?i(aa(y.firestorePath,`doc/${encodeURIComponent(Q)}`)):i(C(`/node/${encodeURIComponent(Q)}`)),o(""))},[s,y,i,C]),j=y.pathType==="graph"&&y.isOnNodePage&&!!(p!=null&&p.focused),k=U.useMemo(()=>{if(!(p!=null&&p.focused))return[];const I=[],Q=new Set;for(const _ of t.edgeTypes)_.aType===p.focused.nodeType&&_.targetGraph&&!Q.has(_.targetGraph)&&(Q.add(_.targetGraph),I.push({name:_.targetGraph,edgeType:_.axbType,targetType:_.bType}));return I},[t.edgeTypes,p==null?void 0:p.focused]),R=U.useMemo(()=>(t.collections??[]).filter(I=>{var Q;return I.parentNodeType===((Q=p==null?void 0:p.focused)==null?void 0:Q.nodeType)&&z2(I.path,e.collection)}),[t.collections,(q=p==null?void 0:p.focused)==null?void 0:q.nodeType,e.collection]),z=U.useMemo(()=>(t.collections??[]).filter(I=>!I.parentNodeType&&z2(I.path,e.collection)),[t.collections,e.collection]),B=U.useMemo(()=>(t.collections??[]).filter(I=>!I.path.includes("/")),[t.collections]),L=U.useCallback(I=>{if(I.pathParams.length===0)return aa(I.path);const Q={};return p!=null&&p.focused&&I.pathParams.length>0&&(Q[I.pathParams[0]]=p.focused.uid),aa(an(I.path,Q))},[p==null?void 0:p.focused]);return g.jsxs("aside",{className:"w-64 bg-slate-900 border-r border-slate-800 flex flex-col h-full shrink-0",children:[g.jsxs("div",{className:"p-4 border-b border-slate-800",children:[g.jsxs(Qt,{to:"/",className:"flex items-center gap-2 group",children:[g.jsx("div",{className:"w-7 h-7 bg-indigo-600 rounded-lg flex items-center justify-center text-xs font-bold",children:"FG"}),g.jsx("span",{className:"font-semibold text-sm group-hover:text-indigo-400 transition-colors",children:"Firegraph Editor"})]}),g.jsx("div",{className:"mt-2 text-[10px] text-slate-500 font-mono truncate",title:e.projectId,children:e.projectId}),y.isScoped&&g.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[g.jsx("svg",{className:"w-3 h-3 text-indigo-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx("span",{className:"text-[10px] text-indigo-400 font-mono truncate",title:y.graphScope,children:y.graphScope}),g.jsx("button",{onClick:A,className:"text-[9px] text-slate-500 hover:text-slate-300 underline shrink-0 transition-colors",children:"exit"})]}),(t.dynamicMode||t.readonly)&&g.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[t.dynamicMode&&g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-violet-500/15 text-violet-400",children:"Dynamic"}),t.readonly&&g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-slate-500/15 text-slate-400",children:"Read-Only"})]}),t.dynamicMode&&g.jsxs("div",{className:"mt-2",children:[g.jsxs("button",{onClick:()=>{T(null),E.mutate(void 0,{onSuccess:I=>{T(`Loaded ${I.nodeTypeCount} node, ${I.edgeTypeCount} edge types`),setTimeout(()=>T(null),3e3)},onError:I=>{T(`Error: ${I.message}`),setTimeout(()=>T(null),5e3)}})},disabled:E.isPending,className:"w-full flex items-center justify-center gap-1.5 px-2 py-1 rounded-md text-[10px] font-medium bg-violet-600/20 text-violet-300 hover:bg-violet-600/30 transition-colors disabled:opacity-50",children:[g.jsx("svg",{className:`w-3 h-3 ${E.isPending?"animate-spin":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),E.isPending?"Refreshing...":"Refresh Schemas"]}),w&&g.jsx("p",{className:`mt-1 text-[9px] ${E.isError?"text-red-400":"text-emerald-400"}`,children:w})]})]}),(y.pathType==="graph"||y.pathType==="collection")&&g.jsx("div",{className:"p-3 border-b border-slate-800",children:g.jsx("form",{onSubmit:M,children:g.jsx("input",{type:"text",value:s,onChange:I=>o(I.target.value),placeholder:y.pathType==="collection"?"Go to document by ID...":"Go to node by UID...",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-indigo-500 transition-colors"})})}),g.jsxs("nav",{className:"flex-1 overflow-auto p-3",children:[y.pathType==="root"&&g.jsxs("div",{className:"mb-4",children:[e.collection&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Graphs"}),g.jsxs(Qt,{to:`/${ya(e.collection)}`,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),e.collection]})]}),B.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 mt-3 px-3",children:"Collections"}),B.map(I=>g.jsxs(Qt,{to:aa(I.path),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs text-slate-400 hover:text-slate-200 hover:bg-slate-800/50 transition-colors",children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"flex-1 truncate",children:I.name})]},I.name))]})]}),y.pathType==="graph"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"mb-4",children:[g.jsxs(Qt,{to:C(),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===C()?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})}),"Graph"]}),g.jsxs(Qt,{to:C("/traverse"),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===C("/traverse")?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Traverse"]}),(r==null?void 0:r.hasViews)&&g.jsxs(Qt,{to:C("/views"),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===C("/views")?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})}),"Views"]}),f.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{ref:m,onClick:()=>d(I=>!I),onMouseEnter:()=>d(!0),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors w-full text-left ${u?"bg-slate-800 text-slate-200":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Recent"]}),u&&g.jsx(SE,{entries:f,triggerRef:m,onClose:()=>d(!1),onClear:h})]})]}),j?g.jsx("div",{className:"mb-4",children:g.jsx(wz,{schema:t})}):g.jsxs("div",{className:"mb-4",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Nodes"}),D.length===0?g.jsx("p",{className:"text-xs text-slate-600 px-3",children:t.nodeTypes.length===0?"No nodes registered":"No nodes allowed in this scope"}):D.map(I=>g.jsxs(Qt,{to:C(`/browse/${encodeURIComponent(I.type)}`),className:`flex items-center justify-between px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===C(`/browse/${encodeURIComponent(I.type)}`)?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:`w-2 h-2 rounded-full ${Rk(I.type)}`}),I.type]}),I.isDynamic&&g.jsx("span",{className:"px-1 py-px rounded text-[8px] font-semibold bg-violet-500/20 text-violet-400",title:"Dynamic type (from Firestore)",children:"D"})]},I.type))]})]}),y.pathType==="collection"&&g.jsx("div",{className:"mb-4",children:f.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{ref:m,onClick:()=>d(I=>!I),onMouseEnter:()=>d(!0),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors w-full text-left ${u?"bg-slate-800 text-slate-200":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Recent"]}),u&&g.jsx(SE,{entries:f,triggerRef:m,onClose:()=>d(!1),onClear:h})]})}),j&&(k.length>0||R.length>0)&&g.jsxs("div",{className:"mb-4",children:[k.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Subgraphs"}),k.map(I=>g.jsxs("button",{onClick:()=>(p==null?void 0:p.focused)&&N(p.focused.uid,I.name),className:"w-full flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs text-slate-400 hover:text-slate-200 hover:bg-slate-800/50 transition-colors text-left",children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx("span",{className:"flex-1 truncate",children:I.name})]},I.name))]}),R.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:`text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3 ${k.length>0?"mt-3":""}`,children:"Collections"}),R.map(I=>g.jsxs(Qt,{to:L(I),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname.startsWith(L(I))?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"flex-1 truncate",children:I.name})]},I.name))]})]}),!j&&z.length>0&&g.jsxs("div",{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Collections"}),z.map(I=>g.jsxs(Qt,{to:aa(I.path),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname.startsWith(aa(I.path))?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"flex-1 truncate",children:I.name}),I.pathParams.length>0&&g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:I.pathParams.map(Q=>`{${Q}}`).join("/")})]},I.name))]})]}),g.jsx("div",{className:"p-3 border-t border-slate-800"})]})}function Mz({warnings:t}){const[e,r]=U.useState(!1),[a,i]=U.useState(!1);return t.length===0||a?null:g.jsx("div",{className:"mx-6 mt-4",children:g.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-4 py-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("button",{onClick:()=>r(!e),className:"flex items-center gap-2 text-left",children:[g.jsx("svg",{className:"w-4 h-4 text-amber-400 shrink-0",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.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"})}),g.jsxs("span",{className:"text-amber-400 text-sm font-medium",children:[t.length," schema/views warning",t.length!==1?"s":""]}),g.jsx("svg",{className:`w-3.5 h-3.5 text-amber-400/60 transition-transform ${e?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),g.jsx("button",{onClick:()=>i(!0),className:"text-amber-400/40 hover:text-amber-400/70 transition-colors p-1",title:"Dismiss",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]}),e&&g.jsx("ul",{className:"mt-3 space-y-1.5",children:t.map((s,o)=>g.jsxs("li",{className:"text-xs text-amber-300/80 flex items-start gap-2",children:[g.jsx("span",{className:"shrink-0 mt-1 w-1.5 h-1.5 rounded-full bg-amber-400"}),g.jsxs("span",{children:[g.jsxs("span",{className:"text-amber-400/50 font-mono mr-1",children:["[",s.code,"]"]}),s.message]})]},o))})]})})}function kz({schema:t,config:e,viewRegistry:r,warnings:a=[],children:i}){const s=r??{nodes:{},edges:{},collections:{},hasViews:!1};return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex h-screen overflow-hidden",children:[g.jsx(Az,{schema:t,config:e,viewRegistry:r}),g.jsxs("main",{className:"flex-1 overflow-auto relative",children:[g.jsx(bz,{}),g.jsx(Mz,{warnings:a}),i]})]}),g.jsx(yz,{schema:t,viewRegistry:s,config:e})]})}function EE({schema:t,viewRegistry:e,config:r,onDataChanged:a,typeParam:i}){const{scopedPath:s,scopeNamesPath:o}=ba(),u=un(),[d,f]=U.useState(!1),h=i??"",p=!t.readonly,m=U.useMemo(()=>{const y=t.nodeSchemas??[];return t.nodeTypes.filter(x=>{const E=y.find(w=>w.aType===x.type&&w.isNodeEntry);return qT(o,E==null?void 0:E.allowedIn)})},[t.nodeTypes,t.nodeSchemas,o]);return h?g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-4",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx("h1",{className:"text-xl font-bold",children:h}),g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${nr(h)}`,children:"node"}),p&&!d&&g.jsxs("button",{onClick:()=>f(!0),className:"ml-auto px-3 py-1.5 bg-indigo-600 text-white rounded-lg text-xs font-medium hover:bg-indigo-500 transition-colors flex items-center gap-1.5",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Create ",h]})]}),g.jsxs("p",{className:"text-sm text-slate-400",children:["Browse all ",g.jsx("strong",{children:h})," nodes"]})]}),d&&g.jsx("div",{className:"mb-6",children:g.jsx(HN,{schema:t,defaultType:h,onSaved:y=>{f(!1),a==null||a(),u(s(`/node/${encodeURIComponent(y)}`))},onCancel:()=>f(!1)})}),g.jsx(ZT,{type:h,schema:t,viewRegistry:e,config:r})]}):g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("h1",{className:"text-xl font-bold text-slate-300",children:"Graph"}),g.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"Select a node type from the sidebar to browse."})]}),m.length>0&&g.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:m.map(y=>g.jsx("button",{onClick:()=>u(s(`/browse/${encodeURIComponent(y.type)}`)),className:"block w-full text-left px-4 py-3 bg-slate-900 border border-slate-800 rounded-xl hover:border-indigo-500/40 transition-colors",children:g.jsx("span",{className:`inline-block px-2 py-0.5 rounded text-xs font-mono mb-1 ${nr(y.type)}`,children:y.type})},y.type))})]})}function Dz({schema:t,config:e}){const r=e.collection,i=(t.collections??[]).filter(o=>!o.path.includes("/")),s=!!r||i.length>0;return g.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h1",{className:"text-xl font-bold text-slate-300",children:"Firegraph"}),g.jsx("p",{className:"text-sm text-slate-400 mt-1",children:e.projectId})]}),!s&&g.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:g.jsx("p",{className:"text-sm text-slate-400",children:"No graph collection or collections configured."})}),g.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r&&g.jsxs(Qt,{to:`/${ya(r)}`,className:"block px-5 py-4 bg-slate-900 border border-slate-800 rounded-xl hover:border-indigo-500/40 transition-colors group",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("svg",{className:"w-4 h-4 text-indigo-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx("span",{className:"text-sm font-semibold text-slate-200 group-hover:text-indigo-300 transition-colors",children:r})]}),g.jsxs("p",{className:"text-xs text-slate-500",children:["Graph · ",t.nodeTypes.length," node type",t.nodeTypes.length!==1?"s":"",", ",t.edgeTypes.length," edge type",t.edgeTypes.length!==1?"s":""]})]}),i.map(o=>g.jsxs(Qt,{to:`/${ya(o.path)}`,className:"block px-5 py-4 bg-slate-900 border border-slate-800 rounded-xl hover:border-amber-500/30 transition-colors group",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("svg",{className:"w-4 h-4 text-amber-400/70 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"text-sm font-semibold text-slate-200 group-hover:text-amber-300 transition-colors",children:o.name})]}),o.description&&g.jsx("p",{className:"text-xs text-slate-500",children:o.description})]},o.name))]})]})}function Oz({viewRegistry:t,schema:e}){if(!t||!t.hasViews)return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsx("h1",{className:"text-xl font-bold mb-2",children:"Views"}),g.jsxs("p",{className:"text-sm text-slate-400",children:["No views configured. Use ",g.jsx("code",{className:"text-slate-300",children:"--views <path>"})," to load a views file."]})]});const r=Object.entries(t.nodes).filter(([,s])=>s.views.length>0),a=Object.entries(t.edges).filter(([,s])=>s.views.length>0),i=Object.entries(t.collections??{}).filter(([,s])=>s.views.length>0);return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h1",{className:"text-xl font-bold mb-1",children:"View Gallery"}),g.jsx("p",{className:"text-sm text-slate-400",children:"Preview all registered views with sample data"})]}),r.length>0&&g.jsxs("section",{className:"mb-8",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Node Views"}),g.jsx("div",{className:"space-y-6",children:r.map(([s,o])=>g.jsx(bg,{entityType:s,meta:o,kind:"node"},s))})]}),a.length>0&&g.jsxs("section",{className:"mb-8",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Edge Views"}),g.jsx("div",{className:"space-y-6",children:a.map(([s,o])=>g.jsx(bg,{entityType:s,meta:o,kind:"edge"},s))})]}),i.length>0&&g.jsxs("section",{children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Collection Views"}),g.jsx("div",{className:"space-y-6",children:i.map(([s,o])=>g.jsx(bg,{entityType:s,meta:o,kind:"collection"},s))})]})]})}function bg({entityType:t,meta:e,kind:r}){const a=e.sampleData??{},[i,s]=U.useState(JSON.stringify(a,null,2)),[o,u]=U.useState(a),[d,f]=U.useState(null),[h,p]=U.useState(!1),m=y=>{s(y);try{const x=JSON.parse(y);u(x),f(null)}catch{f("Invalid JSON")}};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-indigo-500/15 text-indigo-400",children:r}),g.jsx("h3",{className:"text-sm font-semibold",children:t}),g.jsxs("span",{className:"text-slate-500 text-xs",children:["(",e.views.length," view",e.views.length!==1?"s":"",")"]}),g.jsx("button",{onClick:()=>p(!h),className:"ml-auto text-xs text-slate-400 hover:text-slate-200 transition-colors",children:h?"Hide data editor":"Edit sample data"})]}),h&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Sample Data (JSON)"}),g.jsx("textarea",{value:i,onChange:y=>m(y.target.value),rows:6,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs font-mono text-slate-200 focus:outline-none focus:border-indigo-500 resize-y"}),d&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:d})]}),g.jsx("div",{className:`grid gap-4 ${e.views.length===1?"grid-cols-1":"grid-cols-1 md:grid-cols-2"}`,children:e.views.map(y=>g.jsxs("div",{className:"bg-slate-950 rounded-lg p-4",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[g.jsx("span",{className:"text-xs font-semibold text-slate-300",children:y.viewName}),y.description&&g.jsx("span",{className:"text-[10px] text-slate-500",children:y.description}),g.jsxs("span",{className:"ml-auto text-[10px] text-slate-600 font-mono",children:["<",y.tagName,">"]})]}),g.jsx(Jn,{tagName:y.tagName,data:o})]},y.tagName))})]})}function Rz(){const{data:t,error:e,isLoading:r}=xt.getSchema.useQuery(),{data:a,error:i,isLoading:s}=xt.getConfig.useQuery(),{data:o,error:u,isLoading:d}=xt.getViews.useQuery(),{data:f}=xt.getWarnings.useQuery(),h=r||s||d,p=e||i||u,m=U.useRef(0),y=U.useCallback(()=>{if(o!=null&&o.hasViews&&!document.querySelector('script[src="/api/views/bundle"]')){const E=document.createElement("script");E.type="module",E.src="/api/views/bundle",document.head.appendChild(E)}},[o]);if(o&&!h&&y(),U.useEffect(()=>{if(!(t!=null&&t.dynamicMode)||!(o!=null&&o.hasViews))return;const E=document.querySelector("script[data-dynamic-views]");E&&E.remove(),m.current++;const w=document.createElement("script");return w.type="module",w.src=`/api/views/dynamic-bundle?v=${m.current}`,w.setAttribute("data-dynamic-views","true"),document.head.appendChild(w),()=>{w.remove()}},[t,o]),h)return g.jsx("div",{className:"flex items-center justify-center h-screen",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"w-8 h-8 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"}),g.jsx("p",{className:"text-slate-400",children:"Connecting to Firestore..."})]})});if(p)return g.jsx("div",{className:"flex items-center justify-center h-screen",children:g.jsxs("div",{className:"bg-slate-900 border border-red-500/30 rounded-xl p-8 max-w-lg",children:[g.jsx("h2",{className:"text-red-400 text-lg font-semibold mb-2",children:"Connection Error"}),g.jsx("p",{className:"text-slate-300 text-sm mb-4",children:p.message}),g.jsxs("p",{className:"text-slate-500 text-xs mb-4",children:["Make sure you have ADC configured (run"," ",g.jsx("code",{className:"text-slate-300",children:"gcloud auth application-default login"}),") and the server is running with the correct --project, --collection, and --registry flags."]}),g.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-indigo-600 text-white rounded-lg text-sm hover:bg-indigo-500 transition-colors",children:"Retry"})]})});const x=o??{nodes:{},edges:{},collections:{},hasViews:!1};return g.jsx(Kk,{children:g.jsx(sk,{chatEnabled:(a==null?void 0:a.chatEnabled)??!1,children:g.jsx(WM,{children:g.jsx(ek,{children:g.jsx(qk,{children:g.jsx(kz,{schema:t,config:a,viewRegistry:x,warnings:(f==null?void 0:f.warnings)??[],children:g.jsxs(IM,{children:[g.jsx(Gg,{path:"/",element:g.jsx(Dz,{schema:t,config:a})}),g.jsx(Gg,{path:"/:encodedPath/*",element:g.jsx(Jk,{graphCollection:a==null?void 0:a.collection,collections:t==null?void 0:t.collections,children:g.jsx(Bz,{schema:t,viewRegistry:x,config:a})})})]})})})})})})})}function Bz({schema:t,viewRegistry:e,config:r}){const{"*":a=""}=Dm(),{pathType:i,collectionMatch:s}=XT(),o=a?`/${a}`:"";if(i==="graph"){const u=o.match(/^\/browse\/(.+)$/),d=o.match(/^\/node\/(.+)$/);return u?g.jsx(EE,{schema:t,viewRegistry:e,config:r,typeParam:decodeURIComponent(u[1])}):d?g.jsx(nz,{schema:t,viewRegistry:e,config:r,uidParam:decodeURIComponent(d[1])}):o==="/traverse"?g.jsx(ZP,{schema:t}):o==="/views"?g.jsx(Oz,{viewRegistry:e,schema:t}):g.jsx(EE,{schema:t,viewRegistry:e,config:r,typeParam:""})}if(i==="collection"&&s){const u=o.match(/^\/doc\/(.+)$/);return u?g.jsx(Yk,{collectionDef:s.collection,docId:decodeURIComponent(u[1]),params:s.params,readonly:r.readonly,viewRegistry:e}):g.jsx(Fk,{collectionDef:s.collection,params:s.params,readonly:r.readonly})}return g.jsx("div",{className:"p-6 max-w-4xl mx-auto",children:g.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[g.jsx("h2",{className:"text-lg font-semibold mb-2 text-slate-300",children:"Unknown Path"}),g.jsx("p",{className:"text-sm text-slate-400",children:"This Firestore path doesn't match any configured graph or collection."})]})})}function Lz(){const[t]=U.useState(()=>new D4({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1}}})),[e]=U.useState(()=>xt.createClient({links:[MA({url:"/api/trpc"})]}));return g.jsx(xt.Provider,{client:e,queryClient:t,children:g.jsx(R4,{client:t,children:g.jsx(YM,{children:g.jsx(Rz,{})})})})}KA.createRoot(document.getElementById("root")).render(g.jsx($E.StrictMode,{children:g.jsx(Lz,{})}));