agent-dag 1.46.2 → 1.46.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  # ccdeck
4
4
 
5
- **A live canvas for your AI agents.** Watch Claude Code and OpenAI Codex call tools and finish — every Claude Code subagent on a node of its own — all on one calm graph, in real time.
5
+ **An agent session is a tree. Your terminal shows it as a scroll.**
6
+
7
+ **ccdeck draws the tree** — Claude Code and OpenAI Codex on one live canvas, with every Claude Code subagent on a node of its own.
6
8
 
7
9
  [![npm](https://img.shields.io/npm/v/ccdeck?color=cb3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/ccdeck)
8
10
  [![agents-deck downloads](https://img.shields.io/npm/dm/agents-deck?color=blue&label=agents-deck%20downloads)](https://www.npmjs.com/package/agents-deck)
@@ -10,15 +12,18 @@
10
12
  [![Node.js >=18](https://img.shields.io/badge/node-%3E%3D18-brightgreen?logo=node.js&logoColor=white)](https://nodejs.org)
11
13
  [![macOS · Linux · Windows](https://img.shields.io/badge/macOS%20·%20Linux%20·%20Windows-supported-6aa9f7)](#requirements)
12
14
 
13
- [What you get](#what-you-get) · [Quick start](#quick-start) · [How it works](#how-it-works) · [What it touches](#what-it-touches) · [Accounts](#accounts) · [Options](#options)
14
-
15
15
  ```bash
16
16
  npx ccdeck
17
17
  ```
18
18
 
19
19
  [![ccdeck — live agent DAG](assets/canvas.png)](assets/canvas.png)
20
20
 
21
- *An older shot the deck was still called `agents-deck` then. Click through for full size.*
21
+ *A generated session, drawn by the deck itself see `assets/canvas-demo.mjs`. Click through for full size.*
22
+
23
+ tool calls · cost · quota · who is blocked on you · one canvas · local · no telemetry
24
+
25
+ [What you get](#what-you-get) · [Quick start](#quick-start) · [How it works](#how-it-works) · [What it touches](#what-it-touches) · [Accounts](#accounts) · [Options](#options)
26
+
22
27
 
23
28
  </div>
24
29
 
@@ -52,7 +57,7 @@ One canvas. No tabs. No kanban.
52
57
  npx ccdeck # or: npx agents-deck · npx agent-dag — same deck
53
58
  ```
54
59
 
55
- Opens **http://127.0.0.1:4317** and registers the Claude Code hook on first run. Start any Claude Code or Codex session and the graph fills in live. `Ctrl+C` stops it.
60
+ Opens **http://127.0.0.1:4317** and registers the Claude Code hook on first run. If something else already holds 4317, the deck takes a port between 4318 and 4400 instead and prints the address it ended up on — that line in the terminal is the one to trust. Start any Claude Code or Codex session and the graph fills in live. `Ctrl+C` stops it.
56
61
 
57
62
  No config file. No account. No telemetry — nothing about your sessions is reported anywhere.
58
63
 
@@ -84,7 +84,7 @@ Both CLIs get the finish tone. The second tone — Claude is waiting for you —
84
84
 
85
85
  Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return u+c+f+`
86
86
 
87
- Click to set the volume and the sound of each tone, and to hear either one.`}function fT(e){const t=new Map;for(const r of e)for(const s of r.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const o=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};o.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,o.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,o)}return[...t.values()].sort((r,s)=>s.cost-r.cost||r.id.localeCompare(s.id))}function kD(e){const t=fT([{agents:e}]);return t.length<2?null:t.map(r=>`${d0(r.id)} ${Ge(r.cost)}`).join(" · ")}function S1(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function SD(e,t){if(!(t>0)||!(e>0))return"0%";const r=e/t*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function $u(e){const t=e.toLowerCase();return t.includes("opus")?"var(--usage-purple)":t.includes("sonnet")?"var(--usage-blue)":t.includes("haiku")?"var(--usage-green)":t.includes("gpt-5")||t.includes("gpt5")?"var(--usage-amber)":t.includes("gpt")?"var(--usage-red)":t.includes("gemini")?"var(--usage-indigo)":t.includes("codex")?"var(--usage-orange)":"var(--usage-zinc)"}const ED=[7,14,30,90];function ND(e){const[t,r]=N.useState(null),[s,o]=N.useState(!1),a=N.useState(mD)[0],u=N.useRef(!1),c=(f=!1)=>{if(f&&!js(u.current))return;const p=a.begin();u.current=f;const d=e;o(!0);const y=`/api/ccusage?since=${gD(d)}${f?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&r({range:d,resp:w})}).catch(()=>{p()&&r({range:d,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(u.current=!1,o(!1))})};return N.useEffect(()=>(c(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>c(!0)}}function CD({onClose:e,providers:t}){var U;const[r,s]=N.useState(30),[o,a]=N.useState(null),{landed:u,loading:c,reload:f}=ND(r),p=N.useRef(null),d=Kr(e,{focusRef:p}),g=vD({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((U=u.resp.days)==null?void 0:U.length)??0}}),y=g.phase==="chart"?u.resp.days??[]:[],w=N.useMemo(()=>y.reduce((O,M)=>Math.max(O,M.totalCost),0),[y]),S=N.useRef(null);N.useLayoutEffect(()=>{const O=S.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:_,totalTok:b,inOut:k,cacheRead:E,modelCosts:C}=N.useMemo(()=>{let O=0,M=0,q=0,V=0;const X=new Map;for(const j of y){O+=j.totalCost,M+=j.totalTokens,q+=j.inputTokens+j.outputTokens,V+=j.cacheReadTokens;for(const G of j.modelBreakdowns)X.set(G.modelName,(X.get(G.modelName)??0)+G.cost)}return{totalCost:O,totalTok:M,inOut:q,cacheRead:V,modelCosts:X}},[y]),T=N.useMemo(()=>Array.from(C.entries()).sort((O,M)=>M[1]-O[1]),[C]),A=N.useMemo(()=>fT(y),[y]),L=A.length>1,P=o?y.find(O=>O.period===o)??null:null;return m.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:m.jsxs("div",{ref:d,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[m.jsxs("header",{className:"uh-head",children:[m.jsxs("div",{className:"uh-titlewrap",children:[m.jsx("div",{className:"uh-title",children:"Usage history"}),m.jsx("div",{className:"uh-sub",children:xD(t,A.map(O=>O.id))})]}),m.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:ED.map(O=>m.jsxs("button",{type:"button","aria-pressed":r===O,className:"uh-range-btn",onClick:()=>{s(O),a(null)},children:[O,"d"]},O))}),m.jsx("button",{className:"glyph-btn uh-reload",onClick:f,...Wr(c),title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),m.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?m.jsx("div",{className:"uh-status","aria-busy":"true",children:u?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?m.jsxs("div",{className:"uh-status uh-err",title:xo(u.resp)||void 0,children:[Eq(u.resp,"ccusage did not report usage"),m.jsx("div",{children:m.jsx("button",{className:"btn uh-retry",onClick:f,...Wr(c),children:c?"trying…":"Try again"})})]}):g.phase==="empty"?m.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):m.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[m.jsxs("div",{className:"uh-totals",children:[m.jsx(qu,{label:"total cost",val:Ge(_),accent:!0}),m.jsx(qu,{label:"tokens",val:At(b)}),m.jsx(qu,{label:"input+output",val:At(k)}),m.jsx(qu,{label:"cache reads",val:At(E)})]}),L&&m.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[m.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:A.map(O=>m.jsx("span",{className:"uh-agent-seg",style:{width:`${_>0?O.cost/_*100:0}%`,background:S1(O.id)}},O.id))}),m.jsx("div",{className:"uh-agent-keys",children:A.map(O=>m.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${At(O.tokens)} tokens`,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:S1(O.id)}}),d0(O.id),m.jsx("span",{className:"uh-agent-cost",children:Ge(O.cost)}),m.jsx("span",{className:"uh-agent-share",children:SD(O.cost,_)})]},O.id))})]}),m.jsx("div",{ref:S,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(O=>{const M=w>0?O.totalCost/w*100:0,q=O.period===o,V=`${O.period}, ${Ge(O.totalCost)}`;return m.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:O.period),"aria-pressed":q,"aria-label":V,title:`${O.period} · ${Ge(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[m.jsx("div",{className:"uh-bar",style:{height:`${Math.max(M,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((X,j)=>j.cost-X.cost).map(X=>{const j=O.totalCost>0?X.cost/O.totalCost*100:0;return m.jsx("div",{className:"uh-bar-seg",style:{height:`${j}%`,background:$u(X.modelName)}},X.modelName)})}),m.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),m.jsx("div",{className:"uh-legend",children:T.map(([O,M])=>m.jsxs("span",{className:"uh-legend-item",title:O,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:$u(O)}}),li(O)," ",m.jsx("span",{className:"uh-legend-cost",children:Ge(M)})]},O))}),P&&m.jsxs("div",{className:"uh-detail",children:[m.jsxs("div",{className:"uh-detail-head",children:[m.jsx("span",{className:"uh-detail-date",children:P.period}),m.jsx("span",{className:"uh-detail-cost",children:Ge(P.totalCost)}),(()=>{var q,V;const M=kD(P.agents)??((V=(q=P.metadata)==null?void 0:q.agents)!=null&&V.length?P.metadata.agents.join(" · "):null);return M?m.jsx("span",{className:"uh-detail-agents",title:M,children:M}):null})()]}),m.jsxs("div",{className:"uh-detail-mini",children:[m.jsx(Du,{label:"input",val:At(P.inputTokens)}),m.jsx(Du,{label:"output",val:At(P.outputTokens)}),m.jsx(Du,{label:"cache write",val:At(P.cacheCreationTokens)}),m.jsx(Du,{label:"cache read",val:At(P.cacheReadTokens)})]}),m.jsx("div",{className:"uh-detail-models",children:P.modelBreakdowns.slice().sort((O,M)=>M.cost-O.cost).map(O=>{const M=P.totalCost>0?O.cost/P.totalCost*100:0;return m.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[m.jsxs("span",{className:"uh-model-name",children:[m.jsx("span",{className:"uh-legend-dot",style:{background:$u(O.modelName)}}),m.jsx("span",{className:"uh-model-label",children:li(O.modelName)})]}),m.jsx("span",{className:"uh-model-bar",children:m.jsx("span",{className:"uh-model-bar-fill",style:{width:`${M}%`,background:$u(O.modelName)}})}),m.jsx("span",{className:"uh-model-cost",children:Ge(O.cost)})]},O.modelName)})})]})]})]})})}function qu({label:e,val:t,accent:r}){return m.jsxs("div",{className:"uh-stat",children:[m.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:t}),m.jsx("span",{className:"uh-stat-label",children:e})]})}function Du({label:e,val:t}){return m.jsxs("div",{className:"uh-ministat",children:[m.jsx("span",{className:"uh-ministat-val",children:t}),m.jsx("span",{className:"uh-ministat-label",children:e})]})}function f0(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Of,E1;function jD(){if(E1)return Of;E1=1;function e(){this.__data__=[],this.size=0}return Of=e,Of}var Pf,N1;function No(){if(N1)return Pf;N1=1;function e(t,r){return t===r||t!==t&&r!==r}return Pf=e,Pf}var Lf,C1;function wc(){if(C1)return Lf;C1=1;var e=No();function t(r,s){for(var o=r.length;o--;)if(e(r[o][0],s))return o;return-1}return Lf=t,Lf}var $f,j1;function TD(){if(j1)return $f;j1=1;var e=wc(),t=Array.prototype,r=t.splice;function s(o){var a=this.__data__,u=e(a,o);if(u<0)return!1;var c=a.length-1;return u==c?a.pop():r.call(a,u,1),--this.size,!0}return $f=s,$f}var qf,T1;function RD(){if(T1)return qf;T1=1;var e=wc();function t(r){var s=this.__data__,o=e(s,r);return o<0?void 0:s[o][1]}return qf=t,qf}var Df,R1;function AD(){if(R1)return Df;R1=1;var e=wc();function t(r){return e(this.__data__,r)>-1}return Df=t,Df}var Ff,A1;function ID(){if(A1)return Ff;A1=1;var e=wc();function t(r,s){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,s])):o[a][1]=s,this}return Ff=t,Ff}var zf,I1;function xc(){if(I1)return zf;I1=1;var e=jD(),t=TD(),r=RD(),s=AD(),o=ID();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=s,a.prototype.set=o,zf=a,zf}var Bf,M1;function MD(){if(M1)return Bf;M1=1;var e=xc();function t(){this.__data__=new e,this.size=0}return Bf=t,Bf}var Uf,O1;function OD(){if(O1)return Uf;O1=1;function e(t){var r=this.__data__,s=r.delete(t);return this.size=r.size,s}return Uf=e,Uf}var Hf,P1;function PD(){if(P1)return Hf;P1=1;function e(t){return this.__data__.get(t)}return Hf=e,Hf}var Wf,L1;function LD(){if(L1)return Wf;L1=1;function e(t){return this.__data__.has(t)}return Wf=e,Wf}var Vf,$1;function hT(){if($1)return Vf;$1=1;var e=typeof _u=="object"&&_u&&_u.Object===Object&&_u;return Vf=e,Vf}var Gf,q1;function ar(){if(q1)return Gf;q1=1;var e=hT(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Gf=r,Gf}var Yf,D1;function Co(){if(D1)return Yf;D1=1;var e=ar(),t=e.Symbol;return Yf=t,Yf}var Kf,F1;function $D(){if(F1)return Kf;F1=1;var e=Co(),t=Object.prototype,r=t.hasOwnProperty,s=t.toString,o=e?e.toStringTag:void 0;function a(u){var c=r.call(u,o),f=u[o];try{u[o]=void 0;var p=!0}catch{}var d=s.call(u);return p&&(c?u[o]=f:delete u[o]),d}return Kf=a,Kf}var Xf,z1;function qD(){if(z1)return Xf;z1=1;var e=Object.prototype,t=e.toString;function r(s){return t.call(s)}return Xf=r,Xf}var Qf,B1;function ui(){if(B1)return Qf;B1=1;var e=Co(),t=$D(),r=qD(),s="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:s:a&&a in Object(c)?t(c):r(c)}return Qf=u,Qf}var Zf,U1;function Dn(){if(U1)return Zf;U1=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Zf=e,Zf}var Jf,H1;function sl(){if(H1)return Jf;H1=1;var e=ui(),t=Dn(),r="[object AsyncFunction]",s="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==s||f==o||f==r||f==a}return Jf=u,Jf}var eh,W1;function DD(){if(W1)return eh;W1=1;var e=ar(),t=e["__core-js_shared__"];return eh=t,eh}var th,V1;function FD(){if(V1)return th;V1=1;var e=DD(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function r(s){return!!t&&t in s}return th=r,th}var nh,G1;function pT(){if(G1)return nh;G1=1;var e=Function.prototype,t=e.toString;function r(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return nh=r,nh}var rh,Y1;function zD(){if(Y1)return rh;Y1=1;var e=sl(),t=FD(),r=Dn(),s=pT(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,p=c.hasOwnProperty,d=RegExp("^"+f.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!r(y)||t(y))return!1;var w=e(y)?d:a;return w.test(s(y))}return rh=g,rh}var sh,K1;function BD(){if(K1)return sh;K1=1;function e(t,r){return t==null?void 0:t[r]}return sh=e,sh}var ih,X1;function ci(){if(X1)return ih;X1=1;var e=zD(),t=BD();function r(s,o){var a=t(s,o);return e(a)?a:void 0}return ih=r,ih}var oh,Q1;function h0(){if(Q1)return oh;Q1=1;var e=ci(),t=ar(),r=e(t,"Map");return oh=r,oh}var ah,Z1;function _c(){if(Z1)return ah;Z1=1;var e=ci(),t=e(Object,"create");return ah=t,ah}var lh,J1;function UD(){if(J1)return lh;J1=1;var e=_c();function t(){this.__data__=e?e(null):{},this.size=0}return lh=t,lh}var uh,eb;function HD(){if(eb)return uh;eb=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return uh=e,uh}var ch,tb;function WD(){if(tb)return ch;tb=1;var e=_c(),t="__lodash_hash_undefined__",r=Object.prototype,s=r.hasOwnProperty;function o(a){var u=this.__data__;if(e){var c=u[a];return c===t?void 0:c}return s.call(u,a)?u[a]:void 0}return ch=o,ch}var dh,nb;function VD(){if(nb)return dh;nb=1;var e=_c(),t=Object.prototype,r=t.hasOwnProperty;function s(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return dh=s,dh}var fh,rb;function GD(){if(rb)return fh;rb=1;var e=_c(),t="__lodash_hash_undefined__";function r(s,o){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&o===void 0?t:o,this}return fh=r,fh}var hh,sb;function YD(){if(sb)return hh;sb=1;var e=UD(),t=HD(),r=WD(),s=VD(),o=GD();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=s,a.prototype.set=o,hh=a,hh}var ph,ib;function KD(){if(ib)return ph;ib=1;var e=YD(),t=xc(),r=h0();function s(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return ph=s,ph}var mh,ob;function XD(){if(ob)return mh;ob=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return mh=e,mh}var gh,ab;function bc(){if(ab)return gh;ab=1;var e=XD();function t(r,s){var o=r.__data__;return e(s)?o[typeof s=="string"?"string":"hash"]:o.map}return gh=t,gh}var vh,lb;function QD(){if(lb)return vh;lb=1;var e=bc();function t(r){var s=e(this,r).delete(r);return this.size-=s?1:0,s}return vh=t,vh}var yh,ub;function ZD(){if(ub)return yh;ub=1;var e=bc();function t(r){return e(this,r).get(r)}return yh=t,yh}var wh,cb;function JD(){if(cb)return wh;cb=1;var e=bc();function t(r){return e(this,r).has(r)}return wh=t,wh}var xh,db;function e5(){if(db)return xh;db=1;var e=bc();function t(r,s){var o=e(this,r),a=o.size;return o.set(r,s),this.size+=o.size==a?0:1,this}return xh=t,xh}var _h,fb;function p0(){if(fb)return _h;fb=1;var e=KD(),t=QD(),r=ZD(),s=JD(),o=e5();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=s,a.prototype.set=o,_h=a,_h}var bh,hb;function t5(){if(hb)return bh;hb=1;var e=xc(),t=h0(),r=p0(),s=200;function o(a,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!t||f.length<s-1)return f.push([a,u]),this.size=++c.size,this;c=this.__data__=new r(f)}return c.set(a,u),this.size=c.size,this}return bh=o,bh}var kh,pb;function kc(){if(pb)return kh;pb=1;var e=xc(),t=MD(),r=OD(),s=PD(),o=LD(),a=t5();function u(c){var f=this.__data__=new e(c);this.size=f.size}return u.prototype.clear=t,u.prototype.delete=r,u.prototype.get=s,u.prototype.has=o,u.prototype.set=a,kh=u,kh}var Sh,mb;function m0(){if(mb)return Sh;mb=1;function e(t,r){for(var s=-1,o=t==null?0:t.length;++s<o&&r(t[s],s,t)!==!1;);return t}return Sh=e,Sh}var Eh,gb;function mT(){if(gb)return Eh;gb=1;var e=ci(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Eh=t,Eh}var Nh,vb;function Sc(){if(vb)return Nh;vb=1;var e=mT();function t(r,s,o){s=="__proto__"&&e?e(r,s,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[s]=o}return Nh=t,Nh}var Ch,yb;function Ec(){if(yb)return Ch;yb=1;var e=Sc(),t=No(),r=Object.prototype,s=r.hasOwnProperty;function o(a,u,c){var f=a[u];(!(s.call(a,u)&&t(f,c))||c===void 0&&!(u in a))&&e(a,u,c)}return Ch=o,Ch}var jh,wb;function il(){if(wb)return jh;wb=1;var e=Ec(),t=Sc();function r(s,o,a,u){var c=!a;a||(a={});for(var f=-1,p=o.length;++f<p;){var d=o[f],g=u?u(a[d],s[d],d,a,s):void 0;g===void 0&&(g=s[d]),c?t(a,d,g):e(a,d,g)}return a}return jh=r,jh}var Th,xb;function n5(){if(xb)return Th;xb=1;function e(t,r){for(var s=-1,o=Array(t);++s<t;)o[s]=r(s);return o}return Th=e,Th}var Rh,_b;function kr(){if(_b)return Rh;_b=1;function e(t){return t!=null&&typeof t=="object"}return Rh=e,Rh}var Ah,bb;function r5(){if(bb)return Ah;bb=1;var e=ui(),t=kr(),r="[object Arguments]";function s(o){return t(o)&&e(o)==r}return Ah=s,Ah}var Ih,kb;function ol(){if(kb)return Ih;kb=1;var e=r5(),t=kr(),r=Object.prototype,s=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(u){return t(u)&&s.call(u,"callee")&&!o.call(u,"callee")};return Ih=a,Ih}var Mh,Sb;function Ct(){if(Sb)return Mh;Sb=1;var e=Array.isArray;return Mh=e,Mh}var Ia={exports:{}},Oh,Eb;function s5(){if(Eb)return Oh;Eb=1;function e(){return!1}return Oh=e,Oh}Ia.exports;var Nb;function jo(){return Nb||(Nb=1,(function(e,t){var r=ar(),s=s5(),o=t&&!t.nodeType&&t,a=o&&!0&&e&&!e.nodeType&&e,u=a&&a.exports===o,c=u?r.Buffer:void 0,f=c?c.isBuffer:void 0,p=f||s;e.exports=p})(Ia,Ia.exports)),Ia.exports}var Ph,Cb;function Nc(){if(Cb)return Ph;Cb=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(s,o){var a=typeof s;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<o}return Ph=r,Ph}var Lh,jb;function g0(){if(jb)return Lh;jb=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Lh=t,Lh}var $h,Tb;function i5(){if(Tb)return $h;Tb=1;var e=ui(),t=g0(),r=kr(),s="[object Arguments]",o="[object Array]",a="[object Boolean]",u="[object Date]",c="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",S="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",k="[object DataView]",E="[object Float32Array]",C="[object Float64Array]",T="[object Int8Array]",A="[object Int16Array]",L="[object Int32Array]",P="[object Uint8Array]",U="[object Uint8ClampedArray]",O="[object Uint16Array]",M="[object Uint32Array]",q={};q[E]=q[C]=q[T]=q[A]=q[L]=q[P]=q[U]=q[O]=q[M]=!0,q[s]=q[o]=q[b]=q[a]=q[k]=q[u]=q[c]=q[f]=q[p]=q[d]=q[g]=q[y]=q[w]=q[S]=q[_]=!1;function V(X){return r(X)&&t(X.length)&&!!q[e(X)]}return $h=V,$h}var qh,Rb;function Cc(){if(Rb)return qh;Rb=1;function e(t){return function(r){return t(r)}}return qh=e,qh}var Ma={exports:{}};Ma.exports;var Ab;function v0(){return Ab||(Ab=1,(function(e,t){var r=hT(),s=t&&!t.nodeType&&t,o=s&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===s,u=a&&r.process,c=(function(){try{var f=o&&o.require&&o.require("util").types;return f||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(Ma,Ma.exports)),Ma.exports}var Dh,Ib;function al(){if(Ib)return Dh;Ib=1;var e=i5(),t=Cc(),r=v0(),s=r&&r.isTypedArray,o=s?t(s):e;return Dh=o,Dh}var Fh,Mb;function gT(){if(Mb)return Fh;Mb=1;var e=n5(),t=ol(),r=Ct(),s=jo(),o=Nc(),a=al(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var g=r(p),y=!g&&t(p),w=!g&&!y&&s(p),S=!g&&!y&&!w&&a(p),_=g||y||w||S,b=_?e(p.length,String):[],k=b.length;for(var E in p)(d||c.call(p,E))&&!(_&&(E=="length"||w&&(E=="offset"||E=="parent")||S&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||o(E,k)))&&b.push(E);return b}return Fh=f,Fh}var zh,Ob;function jc(){if(Ob)return zh;Ob=1;var e=Object.prototype;function t(r){var s=r&&r.constructor,o=typeof s=="function"&&s.prototype||e;return r===o}return zh=t,zh}var Bh,Pb;function vT(){if(Pb)return Bh;Pb=1;function e(t,r){return function(s){return t(r(s))}}return Bh=e,Bh}var Uh,Lb;function o5(){if(Lb)return Uh;Lb=1;var e=vT(),t=e(Object.keys,Object);return Uh=t,Uh}var Hh,$b;function y0(){if($b)return Hh;$b=1;var e=jc(),t=o5(),r=Object.prototype,s=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var u=[];for(var c in Object(a))s.call(a,c)&&c!="constructor"&&u.push(c);return u}return Hh=o,Hh}var Wh,qb;function Xr(){if(qb)return Wh;qb=1;var e=sl(),t=g0();function r(s){return s!=null&&t(s.length)&&!e(s)}return Wh=r,Wh}var Vh,Db;function Ts(){if(Db)return Vh;Db=1;var e=gT(),t=y0(),r=Xr();function s(o){return r(o)?e(o):t(o)}return Vh=s,Vh}var Gh,Fb;function a5(){if(Fb)return Gh;Fb=1;var e=il(),t=Ts();function r(s,o){return s&&e(o,t(o),s)}return Gh=r,Gh}var Yh,zb;function l5(){if(zb)return Yh;zb=1;function e(t){var r=[];if(t!=null)for(var s in Object(t))r.push(s);return r}return Yh=e,Yh}var Kh,Bb;function u5(){if(Bb)return Kh;Bb=1;var e=Dn(),t=jc(),r=l5(),s=Object.prototype,o=s.hasOwnProperty;function a(u){if(!e(u))return r(u);var c=t(u),f=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||f.push(p);return f}return Kh=a,Kh}var Xh,Ub;function di(){if(Ub)return Xh;Ub=1;var e=gT(),t=u5(),r=Xr();function s(o){return r(o)?e(o,!0):t(o)}return Xh=s,Xh}var Qh,Hb;function c5(){if(Hb)return Qh;Hb=1;var e=il(),t=di();function r(s,o){return s&&e(o,t(o),s)}return Qh=r,Qh}var Oa={exports:{}};Oa.exports;var Wb;function yT(){return Wb||(Wb=1,(function(e,t){var r=ar(),s=t&&!t.nodeType&&t,o=s&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===s,u=a?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function f(p,d){if(d)return p.slice();var g=p.length,y=c?c(g):new p.constructor(g);return p.copy(y),y}e.exports=f})(Oa,Oa.exports)),Oa.exports}var Zh,Vb;function wT(){if(Vb)return Zh;Vb=1;function e(t,r){var s=-1,o=t.length;for(r||(r=Array(o));++s<o;)r[s]=t[s];return r}return Zh=e,Zh}var Jh,Gb;function xT(){if(Gb)return Jh;Gb=1;function e(t,r){for(var s=-1,o=t==null?0:t.length,a=0,u=[];++s<o;){var c=t[s];r(c,s,t)&&(u[a++]=c)}return u}return Jh=e,Jh}var ep,Yb;function _T(){if(Yb)return ep;Yb=1;function e(){return[]}return ep=e,ep}var tp,Kb;function w0(){if(Kb)return tp;Kb=1;var e=xT(),t=_T(),r=Object.prototype,s=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return s.call(u,c)}))}:t;return tp=a,tp}var np,Xb;function d5(){if(Xb)return np;Xb=1;var e=il(),t=w0();function r(s,o){return e(s,t(s),o)}return np=r,np}var rp,Qb;function x0(){if(Qb)return rp;Qb=1;function e(t,r){for(var s=-1,o=r.length,a=t.length;++s<o;)t[a+s]=r[s];return t}return rp=e,rp}var sp,Zb;function Tc(){if(Zb)return sp;Zb=1;var e=vT(),t=e(Object.getPrototypeOf,Object);return sp=t,sp}var ip,Jb;function bT(){if(Jb)return ip;Jb=1;var e=x0(),t=Tc(),r=w0(),s=_T(),o=Object.getOwnPropertySymbols,a=o?function(u){for(var c=[];u;)e(c,r(u)),u=t(u);return c}:s;return ip=a,ip}var op,ek;function f5(){if(ek)return op;ek=1;var e=il(),t=bT();function r(s,o){return e(s,t(s),o)}return op=r,op}var ap,tk;function kT(){if(tk)return ap;tk=1;var e=x0(),t=Ct();function r(s,o,a){var u=o(s);return t(s)?u:e(u,a(s))}return ap=r,ap}var lp,nk;function ST(){if(nk)return lp;nk=1;var e=kT(),t=w0(),r=Ts();function s(o){return e(o,r,t)}return lp=s,lp}var up,rk;function h5(){if(rk)return up;rk=1;var e=kT(),t=bT(),r=di();function s(o){return e(o,r,t)}return up=s,up}var cp,sk;function p5(){if(sk)return cp;sk=1;var e=ci(),t=ar(),r=e(t,"DataView");return cp=r,cp}var dp,ik;function m5(){if(ik)return dp;ik=1;var e=ci(),t=ar(),r=e(t,"Promise");return dp=r,dp}var fp,ok;function ET(){if(ok)return fp;ok=1;var e=ci(),t=ar(),r=e(t,"Set");return fp=r,fp}var hp,ak;function g5(){if(ak)return hp;ak=1;var e=ci(),t=ar(),r=e(t,"WeakMap");return hp=r,hp}var pp,lk;function To(){if(lk)return pp;lk=1;var e=p5(),t=h0(),r=m5(),s=ET(),o=g5(),a=ui(),u=pT(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",g="[object WeakMap]",y="[object DataView]",w=u(e),S=u(t),_=u(r),b=u(s),k=u(o),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=y||t&&E(new t)!=c||r&&E(r.resolve())!=p||s&&E(new s)!=d||o&&E(new o)!=g)&&(E=function(C){var T=a(C),A=T==f?C.constructor:void 0,L=A?u(A):"";if(L)switch(L){case w:return y;case S:return c;case _:return p;case b:return d;case k:return g}return T}),pp=E,pp}var mp,uk;function v5(){if(uk)return mp;uk=1;var e=Object.prototype,t=e.hasOwnProperty;function r(s){var o=s.length,a=new s.constructor(o);return o&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return mp=r,mp}var gp,ck;function NT(){if(ck)return gp;ck=1;var e=ar(),t=e.Uint8Array;return gp=t,gp}var vp,dk;function _0(){if(dk)return vp;dk=1;var e=NT();function t(r){var s=new r.constructor(r.byteLength);return new e(s).set(new e(r)),s}return vp=t,vp}var yp,fk;function y5(){if(fk)return yp;fk=1;var e=_0();function t(r,s){var o=s?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return yp=t,yp}var wp,hk;function w5(){if(hk)return wp;hk=1;var e=/\w*$/;function t(r){var s=new r.constructor(r.source,e.exec(r));return s.lastIndex=r.lastIndex,s}return wp=t,wp}var xp,pk;function x5(){if(pk)return xp;pk=1;var e=Co(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function s(o){return r?Object(r.call(o)):{}}return xp=s,xp}var _p,mk;function CT(){if(mk)return _p;mk=1;var e=_0();function t(r,s){var o=s?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return _p=t,_p}var bp,gk;function _5(){if(gk)return bp;gk=1;var e=_0(),t=y5(),r=w5(),s=x5(),o=CT(),a="[object Boolean]",u="[object Date]",c="[object Map]",f="[object Number]",p="[object RegExp]",d="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",S="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",T="[object Uint8Array]",A="[object Uint8ClampedArray]",L="[object Uint16Array]",P="[object Uint32Array]";function U(O,M,q){var V=O.constructor;switch(M){case w:return e(O);case a:case u:return new V(+O);case S:return t(O,q);case _:case b:case k:case E:case C:case T:case A:case L:case P:return o(O,q);case c:return new V;case f:case g:return new V(O);case p:return r(O);case d:return new V;case y:return s(O)}}return bp=U,bp}var kp,vk;function jT(){if(vk)return kp;vk=1;var e=Dn(),t=Object.create,r=(function(){function s(){}return function(o){if(!e(o))return{};if(t)return t(o);s.prototype=o;var a=new s;return s.prototype=void 0,a}})();return kp=r,kp}var Sp,yk;function TT(){if(yk)return Sp;yk=1;var e=jT(),t=Tc(),r=jc();function s(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return Sp=s,Sp}var Ep,wk;function b5(){if(wk)return Ep;wk=1;var e=To(),t=kr(),r="[object Map]";function s(o){return t(o)&&e(o)==r}return Ep=s,Ep}var Np,xk;function k5(){if(xk)return Np;xk=1;var e=b5(),t=Cc(),r=v0(),s=r&&r.isMap,o=s?t(s):e;return Np=o,Np}var Cp,_k;function S5(){if(_k)return Cp;_k=1;var e=To(),t=kr(),r="[object Set]";function s(o){return t(o)&&e(o)==r}return Cp=s,Cp}var jp,bk;function E5(){if(bk)return jp;bk=1;var e=S5(),t=Cc(),r=v0(),s=r&&r.isSet,o=s?t(s):e;return jp=o,jp}var Tp,kk;function RT(){if(kk)return Tp;kk=1;var e=kc(),t=m0(),r=Ec(),s=a5(),o=c5(),a=yT(),u=wT(),c=d5(),f=f5(),p=ST(),d=h5(),g=To(),y=v5(),w=_5(),S=TT(),_=Ct(),b=jo(),k=k5(),E=Dn(),C=E5(),T=Ts(),A=di(),L=1,P=2,U=4,O="[object Arguments]",M="[object Array]",q="[object Boolean]",V="[object Date]",X="[object Error]",j="[object Function]",G="[object GeneratorFunction]",B="[object Map]",te="[object Number]",Z="[object Object]",$="[object RegExp]",H="[object Set]",I="[object String]",Y="[object Symbol]",ce="[object WeakMap]",z="[object ArrayBuffer]",Q="[object DataView]",ne="[object Float32Array]",ae="[object Float64Array]",fe="[object Int8Array]",pe="[object Int16Array]",ye="[object Int32Array]",Me="[object Uint8Array]",Ue="[object Uint8ClampedArray]",ze="[object Uint16Array]",Ie="[object Uint32Array]",ke={};ke[O]=ke[M]=ke[z]=ke[Q]=ke[q]=ke[V]=ke[ne]=ke[ae]=ke[fe]=ke[pe]=ke[ye]=ke[B]=ke[te]=ke[Z]=ke[$]=ke[H]=ke[I]=ke[Y]=ke[Me]=ke[Ue]=ke[ze]=ke[Ie]=!0,ke[X]=ke[j]=ke[ce]=!1;function le(we,xe,Ye,gt,ft,ot){var Be,et=xe&L,Xe=xe&P,wt=xe&U;if(Ye&&(Be=ft?Ye(we,gt,ft,ot):Ye(we)),Be!==void 0)return Be;if(!E(we))return we;var ee=_(we);if(ee){if(Be=y(we),!et)return u(we,Be)}else{var Le=g(we),De=Le==j||Le==G;if(b(we))return a(we,et);if(Le==Z||Le==O||De&&!ft){if(Be=Xe||De?{}:S(we),!et)return Xe?f(we,o(Be,we)):c(we,s(Be,we))}else{if(!ke[Le])return ft?we:{};Be=w(we,Le,et)}}ot||(ot=new e);var Re=ot.get(we);if(Re)return Re;ot.set(we,Be),C(we)?we.forEach(function(tt){Be.add(le(tt,xe,Ye,tt,we,ot))}):k(we)&&we.forEach(function(tt,Ce){Be.set(Ce,le(tt,xe,Ye,Ce,we,ot))});var $e=wt?Xe?d:p:Xe?A:T,rt=ee?void 0:$e(we);return t(rt||we,function(tt,Ce){rt&&(Ce=tt,tt=we[Ce]),r(Be,Ce,le(tt,xe,Ye,Ce,we,ot))}),Be}return Tp=le,Tp}var Rp,Sk;function N5(){if(Sk)return Rp;Sk=1;var e=RT(),t=4;function r(s){return e(s,t)}return Rp=r,Rp}var Ap,Ek;function b0(){if(Ek)return Ap;Ek=1;function e(t){return function(){return t}}return Ap=e,Ap}var Ip,Nk;function C5(){if(Nk)return Ip;Nk=1;function e(t){return function(r,s,o){for(var a=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[t?f:++a];if(s(u[p],p,u)===!1)break}return r}}return Ip=e,Ip}var Mp,Ck;function k0(){if(Ck)return Mp;Ck=1;var e=C5(),t=e();return Mp=t,Mp}var Op,jk;function S0(){if(jk)return Op;jk=1;var e=k0(),t=Ts();function r(s,o){return s&&e(s,o,t)}return Op=r,Op}var Pp,Tk;function j5(){if(Tk)return Pp;Tk=1;var e=Xr();function t(r,s){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var u=o.length,c=s?u:-1,f=Object(o);(s?c--:++c<u)&&a(f[c],c,f)!==!1;);return o}}return Pp=t,Pp}var Lp,Rk;function Rc(){if(Rk)return Lp;Rk=1;var e=S0(),t=j5(),r=t(e);return Lp=r,Lp}var $p,Ak;function fi(){if(Ak)return $p;Ak=1;function e(t){return t}return $p=e,$p}var qp,Ik;function AT(){if(Ik)return qp;Ik=1;var e=fi();function t(r){return typeof r=="function"?r:e}return qp=t,qp}var Dp,Mk;function IT(){if(Mk)return Dp;Mk=1;var e=m0(),t=Rc(),r=AT(),s=Ct();function o(a,u){var c=s(a)?e:t;return c(a,r(u))}return Dp=o,Dp}var Fp,Ok;function MT(){return Ok||(Ok=1,Fp=IT()),Fp}var zp,Pk;function T5(){if(Pk)return zp;Pk=1;var e=Rc();function t(r,s){var o=[];return e(r,function(a,u,c){s(a,u,c)&&o.push(a)}),o}return zp=t,zp}var Bp,Lk;function R5(){if(Lk)return Bp;Lk=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Bp=t,Bp}var Up,$k;function A5(){if($k)return Up;$k=1;function e(t){return this.__data__.has(t)}return Up=e,Up}var Hp,qk;function OT(){if(qk)return Hp;qk=1;var e=p0(),t=R5(),r=A5();function s(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new e;++a<u;)this.add(o[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=r,Hp=s,Hp}var Wp,Dk;function I5(){if(Dk)return Wp;Dk=1;function e(t,r){for(var s=-1,o=t==null?0:t.length;++s<o;)if(r(t[s],s,t))return!0;return!1}return Wp=e,Wp}var Vp,Fk;function PT(){if(Fk)return Vp;Fk=1;function e(t,r){return t.has(r)}return Vp=e,Vp}var Gp,zk;function LT(){if(zk)return Gp;zk=1;var e=OT(),t=I5(),r=PT(),s=1,o=2;function a(u,c,f,p,d,g){var y=f&s,w=u.length,S=c.length;if(w!=S&&!(y&&S>w))return!1;var _=g.get(u),b=g.get(c);if(_&&b)return _==c&&b==u;var k=-1,E=!0,C=f&o?new e:void 0;for(g.set(u,c),g.set(c,u);++k<w;){var T=u[k],A=c[k];if(p)var L=y?p(A,T,k,c,u,g):p(T,A,k,u,c,g);if(L!==void 0){if(L)continue;E=!1;break}if(C){if(!t(c,function(P,U){if(!r(C,U)&&(T===P||d(T,P,f,p,g)))return C.push(U)})){E=!1;break}}else if(!(T===A||d(T,A,f,p,g))){E=!1;break}}return g.delete(u),g.delete(c),E}return Gp=a,Gp}var Yp,Bk;function M5(){if(Bk)return Yp;Bk=1;function e(t){var r=-1,s=Array(t.size);return t.forEach(function(o,a){s[++r]=[a,o]}),s}return Yp=e,Yp}var Kp,Uk;function E0(){if(Uk)return Kp;Uk=1;function e(t){var r=-1,s=Array(t.size);return t.forEach(function(o){s[++r]=o}),s}return Kp=e,Kp}var Xp,Hk;function O5(){if(Hk)return Xp;Hk=1;var e=Co(),t=NT(),r=No(),s=LT(),o=M5(),a=E0(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",S="[object Set]",_="[object String]",b="[object Symbol]",k="[object ArrayBuffer]",E="[object DataView]",C=e?e.prototype:void 0,T=C?C.valueOf:void 0;function A(L,P,U,O,M,q,V){switch(U){case E:if(L.byteLength!=P.byteLength||L.byteOffset!=P.byteOffset)return!1;L=L.buffer,P=P.buffer;case k:return!(L.byteLength!=P.byteLength||!q(new t(L),new t(P)));case f:case p:case y:return r(+L,+P);case d:return L.name==P.name&&L.message==P.message;case w:case _:return L==P+"";case g:var X=o;case S:var j=O&u;if(X||(X=a),L.size!=P.size&&!j)return!1;var G=V.get(L);if(G)return G==P;O|=c,V.set(L,P);var B=s(X(L),X(P),O,M,q,V);return V.delete(L),B;case b:if(T)return T.call(L)==T.call(P)}return!1}return Xp=A,Xp}var Qp,Wk;function P5(){if(Wk)return Qp;Wk=1;var e=ST(),t=1,r=Object.prototype,s=r.hasOwnProperty;function o(a,u,c,f,p,d){var g=c&t,y=e(a),w=y.length,S=e(u),_=S.length;if(w!=_&&!g)return!1;for(var b=w;b--;){var k=y[b];if(!(g?k in u:s.call(u,k)))return!1}var E=d.get(a),C=d.get(u);if(E&&C)return E==u&&C==a;var T=!0;d.set(a,u),d.set(u,a);for(var A=g;++b<w;){k=y[b];var L=a[k],P=u[k];if(f)var U=g?f(P,L,k,u,a,d):f(L,P,k,a,u,d);if(!(U===void 0?L===P||p(L,P,c,f,d):U)){T=!1;break}A||(A=k=="constructor")}if(T&&!A){var O=a.constructor,M=u.constructor;O!=M&&"constructor"in a&&"constructor"in u&&!(typeof O=="function"&&O instanceof O&&typeof M=="function"&&M instanceof M)&&(T=!1)}return d.delete(a),d.delete(u),T}return Qp=o,Qp}var Zp,Vk;function L5(){if(Vk)return Zp;Vk=1;var e=kc(),t=LT(),r=O5(),s=P5(),o=To(),a=Ct(),u=jo(),c=al(),f=1,p="[object Arguments]",d="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function S(_,b,k,E,C,T){var A=a(_),L=a(b),P=A?d:o(_),U=L?d:o(b);P=P==p?g:P,U=U==p?g:U;var O=P==g,M=U==g,q=P==U;if(q&&u(_)){if(!u(b))return!1;A=!0,O=!1}if(q&&!O)return T||(T=new e),A||c(_)?t(_,b,k,E,C,T):r(_,b,P,k,E,C,T);if(!(k&f)){var V=O&&w.call(_,"__wrapped__"),X=M&&w.call(b,"__wrapped__");if(V||X){var j=V?_.value():_,G=X?b.value():b;return T||(T=new e),C(j,G,k,E,T)}}return q?(T||(T=new e),s(_,b,k,E,C,T)):!1}return Zp=S,Zp}var Jp,Gk;function $T(){if(Gk)return Jp;Gk=1;var e=L5(),t=kr();function r(s,o,a,u,c){return s===o?!0:s==null||o==null||!t(s)&&!t(o)?s!==s&&o!==o:e(s,o,a,u,r,c)}return Jp=r,Jp}var em,Yk;function $5(){if(Yk)return em;Yk=1;var e=kc(),t=$T(),r=1,s=2;function o(a,u,c,f){var p=c.length,d=p,g=!f;if(a==null)return!d;for(a=Object(a);p--;){var y=c[p];if(g&&y[2]?y[1]!==a[y[0]]:!(y[0]in a))return!1}for(;++p<d;){y=c[p];var w=y[0],S=a[w],_=y[1];if(g&&y[2]){if(S===void 0&&!(w in a))return!1}else{var b=new e;if(f)var k=f(S,_,w,a,u,b);if(!(k===void 0?t(_,S,r|s,f,b):k))return!1}}return!0}return em=o,em}var tm,Kk;function qT(){if(Kk)return tm;Kk=1;var e=Dn();function t(r){return r===r&&!e(r)}return tm=t,tm}var nm,Xk;function q5(){if(Xk)return nm;Xk=1;var e=qT(),t=Ts();function r(s){for(var o=t(s),a=o.length;a--;){var u=o[a],c=s[u];o[a]=[u,c,e(c)]}return o}return nm=r,nm}var rm,Qk;function DT(){if(Qk)return rm;Qk=1;function e(t,r){return function(s){return s==null?!1:s[t]===r&&(r!==void 0||t in Object(s))}}return rm=e,rm}var sm,Zk;function D5(){if(Zk)return sm;Zk=1;var e=$5(),t=q5(),r=DT();function s(o){var a=t(o);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(u){return u===o||e(u,o,a)}}return sm=s,sm}var im,Jk;function Ro(){if(Jk)return im;Jk=1;var e=ui(),t=kr(),r="[object Symbol]";function s(o){return typeof o=="symbol"||t(o)&&e(o)==r}return im=s,im}var om,eS;function N0(){if(eS)return om;eS=1;var e=Ct(),t=Ro(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function o(a,u){if(e(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||t(a)?!0:s.test(a)||!r.test(a)||u!=null&&a in Object(u)}return om=o,om}var am,tS;function F5(){if(tS)return am;tS=1;var e=p0(),t="Expected a function";function r(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var u=arguments,c=o?o.apply(this,u):u[0],f=a.cache;if(f.has(c))return f.get(c);var p=s.apply(this,u);return a.cache=f.set(c,p)||f,p};return a.cache=new(r.Cache||e),a}return r.Cache=e,am=r,am}var lm,nS;function z5(){if(nS)return lm;nS=1;var e=F5(),t=500;function r(s){var o=e(s,function(u){return a.size===t&&a.clear(),u}),a=o.cache;return o}return lm=r,lm}var um,rS;function B5(){if(rS)return um;rS=1;var e=z5(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,s=e(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(t,function(u,c,f,p){a.push(f?p.replace(r,"$1"):c||u)}),a});return um=s,um}var cm,sS;function Ac(){if(sS)return cm;sS=1;function e(t,r){for(var s=-1,o=t==null?0:t.length,a=Array(o);++s<o;)a[s]=r(t[s],s,t);return a}return cm=e,cm}var dm,iS;function U5(){if(iS)return dm;iS=1;var e=Co(),t=Ac(),r=Ct(),s=Ro(),o=e?e.prototype:void 0,a=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return t(c,u)+"";if(s(c))return a?a.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return dm=u,dm}var fm,oS;function FT(){if(oS)return fm;oS=1;var e=U5();function t(r){return r==null?"":e(r)}return fm=t,fm}var hm,aS;function Ic(){if(aS)return hm;aS=1;var e=Ct(),t=N0(),r=B5(),s=FT();function o(a,u){return e(a)?a:t(a,u)?[a]:r(s(a))}return hm=o,hm}var pm,lS;function ll(){if(lS)return pm;lS=1;var e=Ro();function t(r){if(typeof r=="string"||e(r))return r;var s=r+"";return s=="0"&&1/r==-1/0?"-0":s}return pm=t,pm}var mm,uS;function Mc(){if(uS)return mm;uS=1;var e=Ic(),t=ll();function r(s,o){o=e(o,s);for(var a=0,u=o.length;s!=null&&a<u;)s=s[t(o[a++])];return a&&a==u?s:void 0}return mm=r,mm}var gm,cS;function H5(){if(cS)return gm;cS=1;var e=Mc();function t(r,s,o){var a=r==null?void 0:e(r,s);return a===void 0?o:a}return gm=t,gm}var vm,dS;function W5(){if(dS)return vm;dS=1;function e(t,r){return t!=null&&r in Object(t)}return vm=e,vm}var ym,fS;function zT(){if(fS)return ym;fS=1;var e=Ic(),t=ol(),r=Ct(),s=Nc(),o=g0(),a=ll();function u(c,f,p){f=e(f,c);for(var d=-1,g=f.length,y=!1;++d<g;){var w=a(f[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=g?y:(g=c==null?0:c.length,!!g&&o(g)&&s(w,g)&&(r(c)||t(c)))}return ym=u,ym}var wm,hS;function BT(){if(hS)return wm;hS=1;var e=W5(),t=zT();function r(s,o){return s!=null&&t(s,o,e)}return wm=r,wm}var xm,pS;function V5(){if(pS)return xm;pS=1;var e=$T(),t=H5(),r=BT(),s=N0(),o=qT(),a=DT(),u=ll(),c=1,f=2;function p(d,g){return s(d)&&o(g)?a(u(d),g):function(y){var w=t(y,d);return w===void 0&&w===g?r(y,d):e(g,w,c|f)}}return xm=p,xm}var _m,mS;function UT(){if(mS)return _m;mS=1;function e(t){return function(r){return r==null?void 0:r[t]}}return _m=e,_m}var bm,gS;function G5(){if(gS)return bm;gS=1;var e=Mc();function t(r){return function(s){return e(s,r)}}return bm=t,bm}var km,vS;function Y5(){if(vS)return km;vS=1;var e=UT(),t=G5(),r=N0(),s=ll();function o(a){return r(a)?e(s(a)):t(a)}return km=o,km}var Sm,yS;function Qr(){if(yS)return Sm;yS=1;var e=D5(),t=V5(),r=fi(),s=Ct(),o=Y5();function a(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?s(u)?t(u[0],u[1]):e(u):o(u)}return Sm=a,Sm}var Em,wS;function HT(){if(wS)return Em;wS=1;var e=xT(),t=T5(),r=Qr(),s=Ct();function o(a,u){var c=s(a)?e:t;return c(a,r(u,3))}return Em=o,Em}var Nm,xS;function K5(){if(xS)return Nm;xS=1;var e=Object.prototype,t=e.hasOwnProperty;function r(s,o){return s!=null&&t.call(s,o)}return Nm=r,Nm}var Cm,_S;function WT(){if(_S)return Cm;_S=1;var e=K5(),t=zT();function r(s,o){return s!=null&&t(s,o,e)}return Cm=r,Cm}var jm,bS;function X5(){if(bS)return jm;bS=1;var e=y0(),t=To(),r=ol(),s=Ct(),o=Xr(),a=jo(),u=jc(),c=al(),f="[object Map]",p="[object Set]",d=Object.prototype,g=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||c(w)||r(w)))return!w.length;var S=t(w);if(S==f||S==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(g.call(w,_))return!1;return!0}return jm=y,jm}var Tm,kS;function VT(){if(kS)return Tm;kS=1;function e(t){return t===void 0}return Tm=e,Tm}var Rm,SS;function GT(){if(SS)return Rm;SS=1;var e=Rc(),t=Xr();function r(s,o){var a=-1,u=t(s)?Array(s.length):[];return e(s,function(c,f,p){u[++a]=o(c,f,p)}),u}return Rm=r,Rm}var Am,ES;function YT(){if(ES)return Am;ES=1;var e=Ac(),t=Qr(),r=GT(),s=Ct();function o(a,u){var c=s(a)?e:r;return c(a,t(u,3))}return Am=o,Am}var Im,NS;function Q5(){if(NS)return Im;NS=1;function e(t,r,s,o){var a=-1,u=t==null?0:t.length;for(o&&u&&(s=t[++a]);++a<u;)s=r(s,t[a],a,t);return s}return Im=e,Im}var Mm,CS;function Z5(){if(CS)return Mm;CS=1;function e(t,r,s,o,a){return a(t,function(u,c,f){s=o?(o=!1,u):r(s,u,c,f)}),s}return Mm=e,Mm}var Om,jS;function KT(){if(jS)return Om;jS=1;var e=Q5(),t=Rc(),r=Qr(),s=Z5(),o=Ct();function a(u,c,f){var p=o(u)?e:s,d=arguments.length<3;return p(u,r(c,4),f,d,t)}return Om=a,Om}var Pm,TS;function J5(){if(TS)return Pm;TS=1;var e=ui(),t=Ct(),r=kr(),s="[object String]";function o(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==s}return Pm=o,Pm}var Lm,RS;function eF(){if(RS)return Lm;RS=1;var e=UT(),t=e("length");return Lm=t,Lm}var $m,AS;function tF(){if(AS)return $m;AS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",o=t+r+s,a="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+a+"]");function f(p){return c.test(p)}return $m=f,$m}var qm,IS;function nF(){if(IS)return qm;IS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",o=t+r+s,a="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+f+")",d="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",S=p+"?",_="["+a+"]?",b="(?:"+w+"(?:"+[d,g,y].join("|")+")"+_+S+")*",k=_+S+b,E="(?:"+[d+c+"?",c,g,y,u].join("|")+")",C=RegExp(f+"(?="+f+")|"+E+k,"g");function T(A){for(var L=C.lastIndex=0;C.test(A);)++L;return L}return qm=T,qm}var Dm,MS;function rF(){if(MS)return Dm;MS=1;var e=eF(),t=tF(),r=nF();function s(o){return t(o)?r(o):e(o)}return Dm=s,Dm}var Fm,OS;function sF(){if(OS)return Fm;OS=1;var e=y0(),t=To(),r=Xr(),s=J5(),o=rF(),a="[object Map]",u="[object Set]";function c(f){if(f==null)return 0;if(r(f))return s(f)?o(f):f.length;var p=t(f);return p==a||p==u?f.size:e(f).length}return Fm=c,Fm}var zm,PS;function iF(){if(PS)return zm;PS=1;var e=m0(),t=jT(),r=S0(),s=Qr(),o=Tc(),a=Ct(),u=jo(),c=sl(),f=Dn(),p=al();function d(g,y,w){var S=a(g),_=S||u(g)||p(g);if(y=s(y,4),w==null){var b=g&&g.constructor;_?w=S?new b:[]:f(g)?w=c(b)?t(o(g)):{}:w={}}return(_?e:r)(g,function(k,E,C){return y(w,k,E,C)}),w}return zm=d,zm}var Bm,LS;function oF(){if(LS)return Bm;LS=1;var e=Co(),t=ol(),r=Ct(),s=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(s&&a&&a[s])}return Bm=o,Bm}var Um,$S;function C0(){if($S)return Um;$S=1;var e=x0(),t=oF();function r(s,o,a,u,c){var f=-1,p=s.length;for(a||(a=t),c||(c=[]);++f<p;){var d=s[f];o>0&&a(d)?o>1?r(d,o-1,a,u,c):e(c,d):u||(c[c.length]=d)}return c}return Um=r,Um}var Hm,qS;function aF(){if(qS)return Hm;qS=1;function e(t,r,s){switch(s.length){case 0:return t.call(r);case 1:return t.call(r,s[0]);case 2:return t.call(r,s[0],s[1]);case 3:return t.call(r,s[0],s[1],s[2])}return t.apply(r,s)}return Hm=e,Hm}var Wm,DS;function XT(){if(DS)return Wm;DS=1;var e=aF(),t=Math.max;function r(s,o,a){return o=t(o===void 0?s.length-1:o,0),function(){for(var u=arguments,c=-1,f=t(u.length-o,0),p=Array(f);++c<f;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=a(p),e(s,this,d)}}return Wm=r,Wm}var Vm,FS;function lF(){if(FS)return Vm;FS=1;var e=b0(),t=mT(),r=fi(),s=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return Vm=s,Vm}var Gm,zS;function uF(){if(zS)return Gm;zS=1;var e=800,t=16,r=Date.now;function s(o){var a=0,u=0;return function(){var c=r(),f=t-(c-u);if(u=c,f>0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return Gm=s,Gm}var Ym,BS;function QT(){if(BS)return Ym;BS=1;var e=lF(),t=uF(),r=t(e);return Ym=r,Ym}var Km,US;function Oc(){if(US)return Km;US=1;var e=fi(),t=XT(),r=QT();function s(o,a){return r(t(o,a,e),o+"")}return Km=s,Km}var Xm,HS;function ZT(){if(HS)return Xm;HS=1;function e(t,r,s,o){for(var a=t.length,u=s+(o?1:-1);o?u--:++u<a;)if(r(t[u],u,t))return u;return-1}return Xm=e,Xm}var Qm,WS;function cF(){if(WS)return Qm;WS=1;function e(t){return t!==t}return Qm=e,Qm}var Zm,VS;function dF(){if(VS)return Zm;VS=1;function e(t,r,s){for(var o=s-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return Zm=e,Zm}var Jm,GS;function fF(){if(GS)return Jm;GS=1;var e=ZT(),t=cF(),r=dF();function s(o,a,u){return a===a?r(o,a,u):e(o,t,u)}return Jm=s,Jm}var eg,YS;function hF(){if(YS)return eg;YS=1;var e=fF();function t(r,s){var o=r==null?0:r.length;return!!o&&e(r,s,0)>-1}return eg=t,eg}var tg,KS;function pF(){if(KS)return tg;KS=1;function e(t,r,s){for(var o=-1,a=t==null?0:t.length;++o<a;)if(s(r,t[o]))return!0;return!1}return tg=e,tg}var ng,XS;function mF(){if(XS)return ng;XS=1;function e(){}return ng=e,ng}var rg,QS;function gF(){if(QS)return rg;QS=1;var e=ET(),t=mF(),r=E0(),s=1/0,o=e&&1/r(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return rg=o,rg}var sg,ZS;function vF(){if(ZS)return sg;ZS=1;var e=OT(),t=hF(),r=pF(),s=PT(),o=gF(),a=E0(),u=200;function c(f,p,d){var g=-1,y=t,w=f.length,S=!0,_=[],b=_;if(d)S=!1,y=r;else if(w>=u){var k=p?null:o(f);if(k)return a(k);S=!1,y=s,b=new e}else b=p?[]:_;e:for(;++g<w;){var E=f[g],C=p?p(E):E;if(E=d||E!==0?E:0,S&&C===C){for(var T=b.length;T--;)if(b[T]===C)continue e;p&&b.push(C),_.push(E)}else y(b,C,d)||(b!==_&&b.push(C),_.push(E))}return _}return sg=c,sg}var ig,JS;function JT(){if(JS)return ig;JS=1;var e=Xr(),t=kr();function r(s){return t(s)&&e(s)}return ig=r,ig}var og,eE;function yF(){if(eE)return og;eE=1;var e=C0(),t=Oc(),r=vF(),s=JT(),o=t(function(a){return r(e(a,1,s,!0))});return og=o,og}var ag,tE;function wF(){if(tE)return ag;tE=1;var e=Ac();function t(r,s){return e(s,function(o){return r[o]})}return ag=t,ag}var lg,nE;function eR(){if(nE)return lg;nE=1;var e=wF(),t=Ts();function r(s){return s==null?[]:e(s,t(s))}return lg=r,lg}var ug,rE;function Fn(){if(rE)return ug;rE=1;var e;if(typeof f0=="function")try{e={clone:N5(),constant:b0(),each:MT(),filter:HT(),has:WT(),isArray:Ct(),isEmpty:X5(),isFunction:sl(),isUndefined:VT(),keys:Ts(),map:YT(),reduce:KT(),size:sF(),transform:iF(),union:yF(),values:eR()}}catch{}return e||(e=window._),ug=e,ug}var cg,sE;function j0(){if(sE)return cg;sE=1;var e=Fn();cg=o;var t="\0",r="\0",s="";function o(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(d){return this._label=d,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(g){return e.isEmpty(d._in[g])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(g){return e.isEmpty(d._out[g])})},o.prototype.setNodes=function(d,g){var y=arguments,w=this;return e.each(d,function(S){y.length>1?w.setNode(S,g):w.setNode(S)}),this},o.prototype.setNode=function(d,g){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=g),this):(this._nodes[d]=arguments.length>1?g:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},o.prototype.node=function(d){return this._nodes[d]},o.prototype.hasNode=function(d){return e.has(this._nodes,d)},o.prototype.removeNode=function(d){var g=this;if(e.has(this._nodes,d)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){g.setParent(w)}),delete this._children[d]),e.each(e.keys(this._in[d]),y),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),y),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},o.prototype.setParent=function(d,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=r;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+g+" as parent of "+d+" would create a cycle");this.setNode(g)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=g,this._children[g][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var g=this._parent[d];if(g!==r)return g}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var g=this._children[d];if(g)return e.keys(g)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var g=this._preds[d];if(g)return e.keys(g)},o.prototype.successors=function(d){var g=this._sucs[d];if(g)return e.keys(g)},o.prototype.neighbors=function(d){var g=this.predecessors(d);if(g)return e.union(g,this.successors(d))},o.prototype.isLeaf=function(d){var g;return this.isDirected()?g=this.successors(d):g=this.neighbors(d),g.length===0},o.prototype.filterNodes=function(d){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,b){d(b)&&g.setNode(b,_)}),e.each(this._edgeObjs,function(_){g.hasNode(_.v)&&g.hasNode(_.w)&&g.setEdge(_,y.edge(_))});var w={};function S(_){var b=y.parent(_);return b===void 0||g.hasNode(b)?(w[_]=b,b):b in w?w[b]:S(b)}return this._isCompound&&e.each(g.nodes(),function(_){g.setParent(_,S(_))}),g},o.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(d,g){var y=this,w=arguments;return e.reduce(d,function(S,_){return w.length>1?y.setEdge(S,_,g):y.setEdge(S,_),_}),this},o.prototype.setEdge=function(){var d,g,y,w,S=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,g=_.w,y=_.name,arguments.length===2&&(w=arguments[1],S=!0)):(d=_,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],S=!0)),d=""+d,g=""+g,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,g,y);if(e.has(this._edgeLabels,b))return S&&(this._edgeLabels[b]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(g),this._edgeLabels[b]=S?w:this._defaultEdgeLabelFn(d,g,y);var k=f(this._isDirected,d,g,y);return d=k.v,g=k.w,Object.freeze(k),this._edgeObjs[b]=k,a(this._preds[g],d),a(this._sucs[d],g),this._in[g][b]=k,this._out[d][b]=k,this._edgeCount++,this},o.prototype.edge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y),S=this._edgeObjs[w];return S&&(d=S.v,g=S.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[g],d),u(this._sucs[d],g),delete this._in[g][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,g){var y=this._in[d];if(y){var w=e.values(y);return g?e.filter(w,function(S){return S.v===g}):w}},o.prototype.outEdges=function(d,g){var y=this._out[d];if(y){var w=e.values(y);return g?e.filter(w,function(S){return S.w===g}):w}},o.prototype.nodeEdges=function(d,g){var y=this.inEdges(d,g);if(y)return y.concat(this.outEdges(d,g))};function a(d,g){d[g]?d[g]++:d[g]=1}function u(d,g){--d[g]||delete d[g]}function c(d,g,y,w){var S=""+g,_=""+y;if(!d&&S>_){var b=S;S=_,_=b}return S+s+_+s+(e.isUndefined(w)?t:w)}function f(d,g,y,w){var S=""+g,_=""+y;if(!d&&S>_){var b=S;S=_,_=b}var k={v:S,w:_};return w&&(k.name=w),k}function p(d,g){return c(d,g.v,g.w,g.name)}return cg}var dg,iE;function xF(){return iE||(iE=1,dg="2.1.8"),dg}var fg,oE;function _F(){return oE||(oE=1,fg={Graph:j0(),version:xF()}),fg}var hg,aE;function bF(){if(aE)return hg;aE=1;var e=Fn(),t=j0();hg={write:r,read:a};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:s(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function s(u){return e.map(u.nodes(),function(c){var f=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(f)||(d.value=f),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var f=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(f)||(p.value=f),p})}function a(u){var c=new t(u.options).setGraph(u.value);return e.each(u.nodes,function(f){c.setNode(f.v,f.value),f.parent&&c.setParent(f.v,f.parent)}),e.each(u.edges,function(f){c.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),c}return hg}var pg,lE;function kF(){if(lE)return pg;lE=1;var e=Fn();pg=t;function t(r){var s={},o=[],a;function u(c){e.has(s,c)||(s[c]=!0,a.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){a=[],u(c),a.length&&o.push(a)}),o}return pg}var mg,uE;function tR(){if(uE)return mg;uE=1;var e=Fn();mg=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var s=this._keyIndices[r];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,s){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var a=this._arr,u=a.length;return o[r]=u,a.push({key:r,priority:s}),this._decrease(u),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,s){var o=this._keyIndices[r];if(s>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+s);this._arr[o].priority=s,this._decrease(o)},t.prototype._heapify=function(r){var s=this._arr,o=2*r,a=o+1,u=r;o<s.length&&(u=s[o].priority<s[u].priority?o:u,a<s.length&&(u=s[a].priority<s[u].priority?a:u),u!==r&&(this._swap(r,u),this._heapify(u)))},t.prototype._decrease=function(r){for(var s=this._arr,o=s[r].priority,a;r!==0&&(a=r>>1,!(s[a].priority<o));)this._swap(r,a),r=a},t.prototype._swap=function(r,s){var o=this._arr,a=this._keyIndices,u=o[r],c=o[s];o[r]=c,o[s]=u,a[c.key]=r,a[u.key]=s},mg}var gg,cE;function nR(){if(cE)return gg;cE=1;var e=Fn(),t=tR();gg=s;var r=e.constant(1);function s(a,u,c,f){return o(a,String(u),c||r,f||function(p){return a.outEdges(p)})}function o(a,u,c,f){var p={},d=new t,g,y,w=function(S){var _=S.v!==g?S.v:S.w,b=p[_],k=c(S),E=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+S+" Weight: "+k);E<b.distance&&(b.distance=E,b.predecessor=g,d.decrease(_,E))};for(a.nodes().forEach(function(S){var _=S===u?0:Number.POSITIVE_INFINITY;p[S]={distance:_},d.add(S,_)});d.size()>0&&(g=d.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return gg}var vg,dE;function SF(){if(dE)return vg;dE=1;var e=nR(),t=Fn();vg=r;function r(s,o,a){return t.transform(s.nodes(),function(u,c){u[c]=e(s,c,o,a)},{})}return vg}var yg,fE;function rR(){if(fE)return yg;fE=1;var e=Fn();yg=t;function t(r){var s=0,o=[],a={},u=[];function c(f){var p=a[f]={onStack:!0,lowlink:s,index:s++};if(o.push(f),r.successors(f).forEach(function(y){e.has(a,y)?a[y].onStack&&(p.lowlink=Math.min(p.lowlink,a[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,a[y].lowlink))}),p.lowlink===p.index){var d=[],g;do g=o.pop(),a[g].onStack=!1,d.push(g);while(f!==g);u.push(d)}}return r.nodes().forEach(function(f){e.has(a,f)||c(f)}),u}return yg}var wg,hE;function EF(){if(hE)return wg;hE=1;var e=Fn(),t=rR();wg=r;function r(s){return e.filter(t(s),function(o){return o.length>1||o.length===1&&s.hasEdge(o[0],o[0])})}return wg}var xg,pE;function NF(){if(pE)return xg;pE=1;var e=Fn();xg=r;var t=e.constant(1);function r(o,a,u){return s(o,a||t,u||function(c){return o.outEdges(c)})}function s(o,a,u){var c={},f=o.nodes();return f.forEach(function(p){c[p]={},c[p][p]={distance:0},f.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var g=d.v===p?d.w:d.v,y=a(d);c[p][g]={distance:y,predecessor:p}})}),f.forEach(function(p){var d=c[p];f.forEach(function(g){var y=c[g];f.forEach(function(w){var S=y[p],_=d[w],b=y[w],k=S.distance+_.distance;k<b.distance&&(b.distance=k,b.predecessor=_.predecessor)})})}),c}return xg}var _g,mE;function sR(){if(mE)return _g;mE=1;var e=Fn();_g=t,t.CycleException=r;function t(s){var o={},a={},u=[];function c(f){if(e.has(a,f))throw new r;e.has(o,f)||(a[f]=!0,o[f]=!0,e.each(s.predecessors(f),c),delete a[f],u.push(f))}if(e.each(s.sinks(),c),e.size(o)!==s.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,_g}var bg,gE;function CF(){if(gE)return bg;gE=1;var e=sR();bg=t;function t(r){try{e(r)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return bg}var kg,vE;function iR(){if(vE)return kg;vE=1;var e=Fn();kg=t;function t(s,o,a){e.isArray(o)||(o=[o]);var u=(s.isDirected()?s.successors:s.neighbors).bind(s),c=[],f={};return e.each(o,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);r(s,p,a==="post",f,u,c)}),c}function r(s,o,a,u,c,f){e.has(u,o)||(u[o]=!0,a||f.push(o),e.each(c(o),function(p){r(s,p,a,u,c,f)}),a&&f.push(o))}return kg}var Sg,yE;function jF(){if(yE)return Sg;yE=1;var e=iR();Sg=t;function t(r,s){return e(r,s,"post")}return Sg}var Eg,wE;function TF(){if(wE)return Eg;wE=1;var e=iR();Eg=t;function t(r,s){return e(r,s,"pre")}return Eg}var Ng,xE;function RF(){if(xE)return Ng;xE=1;var e=Fn(),t=j0(),r=tR();Ng=s;function s(o,a){var u=new t,c={},f=new r,p;function d(y){var w=y.v===p?y.w:y.v,S=f.priority(w);if(S!==void 0){var _=a(y);_<S&&(c[w]=p,f.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),f.decrease(o.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(g)throw new Error("Input graph is not connected: "+o);g=!0}o.nodeEdges(p).forEach(d)}return u}return Ng}var Cg,_E;function AF(){return _E||(_E=1,Cg={components:kF(),dijkstra:nR(),dijkstraAll:SF(),findCycles:EF(),floydWarshall:NF(),isAcyclic:CF(),postorder:jF(),preorder:TF(),prim:RF(),tarjan:rR(),topsort:sR()}),Cg}var jg,bE;function IF(){if(bE)return jg;bE=1;var e=_F();return jg={Graph:e.Graph,json:bF(),alg:AF(),version:e.version},jg}var Tg,kE;function ir(){if(kE)return Tg;kE=1;var e;if(typeof f0=="function")try{e=IF()}catch{}return e||(e=window.graphlib),Tg=e,Tg}var Rg,SE;function MF(){if(SE)return Rg;SE=1;var e=RT(),t=1,r=4;function s(o){return e(o,t|r)}return Rg=s,Rg}var Ag,EE;function Pc(){if(EE)return Ag;EE=1;var e=No(),t=Xr(),r=Nc(),s=Dn();function o(a,u,c){if(!s(c))return!1;var f=typeof u;return(f=="number"?t(c)&&r(u,c.length):f=="string"&&u in c)?e(c[u],a):!1}return Ag=o,Ag}var Ig,NE;function OF(){if(NE)return Ig;NE=1;var e=Oc(),t=No(),r=Pc(),s=di(),o=Object.prototype,a=o.hasOwnProperty,u=e(function(c,f){c=Object(c);var p=-1,d=f.length,g=d>2?f[2]:void 0;for(g&&r(f[0],f[1],g)&&(d=1);++p<d;)for(var y=f[p],w=s(y),S=-1,_=w.length;++S<_;){var b=w[S],k=c[b];(k===void 0||t(k,o[b])&&!a.call(c,b))&&(c[b]=y[b])}return c});return Ig=u,Ig}var Mg,CE;function PF(){if(CE)return Mg;CE=1;var e=Qr(),t=Xr(),r=Ts();function s(o){return function(a,u,c){var f=Object(a);if(!t(a)){var p=e(u,3);a=r(a),u=function(g){return p(f[g],g,f)}}var d=o(a,u,c);return d>-1?f[p?a[d]:d]:void 0}}return Mg=s,Mg}var Og,jE;function LF(){if(jE)return Og;jE=1;var e=/\s/;function t(r){for(var s=r.length;s--&&e.test(r.charAt(s)););return s}return Og=t,Og}var Pg,TE;function $F(){if(TE)return Pg;TE=1;var e=LF(),t=/^\s+/;function r(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Pg=r,Pg}var Lg,RE;function qF(){if(RE)return Lg;RE=1;var e=$F(),t=Dn(),r=Ro(),s=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function f(p){if(typeof p=="number")return p;if(r(p))return s;if(t(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=t(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||u.test(p)?c(p.slice(2),g?2:8):o.test(p)?s:+p}return Lg=f,Lg}var $g,AE;function oR(){if(AE)return $g;AE=1;var e=qF(),t=1/0,r=17976931348623157e292;function s(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var a=o<0?-1:1;return a*r}return o===o?o:0}return $g=s,$g}var qg,IE;function DF(){if(IE)return qg;IE=1;var e=oR();function t(r){var s=e(r),o=s%1;return s===s?o?s-o:s:0}return qg=t,qg}var Dg,ME;function FF(){if(ME)return Dg;ME=1;var e=ZT(),t=Qr(),r=DF(),s=Math.max;function o(a,u,c){var f=a==null?0:a.length;if(!f)return-1;var p=c==null?0:r(c);return p<0&&(p=s(f+p,0)),e(a,t(u,3),p)}return Dg=o,Dg}var Fg,OE;function zF(){if(OE)return Fg;OE=1;var e=PF(),t=FF(),r=e(t);return Fg=r,Fg}var zg,PE;function aR(){if(PE)return zg;PE=1;var e=C0();function t(r){var s=r==null?0:r.length;return s?e(r,1):[]}return zg=t,zg}var Bg,LE;function BF(){if(LE)return Bg;LE=1;var e=k0(),t=AT(),r=di();function s(o,a){return o==null?o:e(o,t(a),r)}return Bg=s,Bg}var Ug,$E;function UF(){if($E)return Ug;$E=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ug=e,Ug}var Hg,qE;function HF(){if(qE)return Hg;qE=1;var e=Sc(),t=S0(),r=Qr();function s(o,a){var u={};return a=r(a,3),t(o,function(c,f,p){e(u,f,a(c,f,p))}),u}return Hg=s,Hg}var Wg,DE;function T0(){if(DE)return Wg;DE=1;var e=Ro();function t(r,s,o){for(var a=-1,u=r.length;++a<u;){var c=r[a],f=s(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return Wg=t,Wg}var Vg,FE;function WF(){if(FE)return Vg;FE=1;function e(t,r){return t>r}return Vg=e,Vg}var Gg,zE;function VF(){if(zE)return Gg;zE=1;var e=T0(),t=WF(),r=fi();function s(o){return o&&o.length?e(o,r,t):void 0}return Gg=s,Gg}var Yg,BE;function lR(){if(BE)return Yg;BE=1;var e=Sc(),t=No();function r(s,o,a){(a!==void 0&&!t(s[o],a)||a===void 0&&!(o in s))&&e(s,o,a)}return Yg=r,Yg}var Kg,UE;function GF(){if(UE)return Kg;UE=1;var e=ui(),t=Tc(),r=kr(),s="[object Object]",o=Function.prototype,a=Object.prototype,u=o.toString,c=a.hasOwnProperty,f=u.call(Object);function p(d){if(!r(d)||e(d)!=s)return!1;var g=t(d);if(g===null)return!0;var y=c.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==f}return Kg=p,Kg}var Xg,HE;function uR(){if(HE)return Xg;HE=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return Xg=e,Xg}var Qg,WE;function YF(){if(WE)return Qg;WE=1;var e=il(),t=di();function r(s){return e(s,t(s))}return Qg=r,Qg}var Zg,VE;function KF(){if(VE)return Zg;VE=1;var e=lR(),t=yT(),r=CT(),s=wT(),o=TT(),a=ol(),u=Ct(),c=JT(),f=jo(),p=sl(),d=Dn(),g=GF(),y=al(),w=uR(),S=YF();function _(b,k,E,C,T,A,L){var P=w(b,E),U=w(k,E),O=L.get(U);if(O){e(b,E,O);return}var M=A?A(P,U,E+"",b,k,L):void 0,q=M===void 0;if(q){var V=u(U),X=!V&&f(U),j=!V&&!X&&y(U);M=U,V||X||j?u(P)?M=P:c(P)?M=s(P):X?(q=!1,M=t(U,!0)):j?(q=!1,M=r(U,!0)):M=[]:g(U)||a(U)?(M=P,a(P)?M=S(P):(!d(P)||p(P))&&(M=o(U))):q=!1}q&&(L.set(U,M),T(M,U,C,A,L),L.delete(U)),e(b,E,M)}return Zg=_,Zg}var Jg,GE;function XF(){if(GE)return Jg;GE=1;var e=kc(),t=lR(),r=k0(),s=KF(),o=Dn(),a=di(),u=uR();function c(f,p,d,g,y){f!==p&&r(p,function(w,S){if(y||(y=new e),o(w))s(f,p,S,d,c,g,y);else{var _=g?g(u(f,S),w,S+"",f,p,y):void 0;_===void 0&&(_=w),t(f,S,_)}},a)}return Jg=c,Jg}var ev,YE;function QF(){if(YE)return ev;YE=1;var e=Oc(),t=Pc();function r(s){return e(function(o,a){var u=-1,c=a.length,f=c>1?a[c-1]:void 0,p=c>2?a[2]:void 0;for(f=s.length>3&&typeof f=="function"?(c--,f):void 0,p&&t(a[0],a[1],p)&&(f=c<3?void 0:f,c=1),o=Object(o);++u<c;){var d=a[u];d&&s(o,d,u,f)}return o})}return ev=r,ev}var tv,KE;function ZF(){if(KE)return tv;KE=1;var e=XF(),t=QF(),r=t(function(s,o,a){e(s,o,a)});return tv=r,tv}var nv,XE;function cR(){if(XE)return nv;XE=1;function e(t,r){return t<r}return nv=e,nv}var rv,QE;function JF(){if(QE)return rv;QE=1;var e=T0(),t=cR(),r=fi();function s(o){return o&&o.length?e(o,r,t):void 0}return rv=s,rv}var sv,ZE;function ez(){if(ZE)return sv;ZE=1;var e=T0(),t=Qr(),r=cR();function s(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return sv=s,sv}var iv,JE;function tz(){if(JE)return iv;JE=1;var e=ar(),t=function(){return e.Date.now()};return iv=t,iv}var ov,eN;function nz(){if(eN)return ov;eN=1;var e=Ec(),t=Ic(),r=Nc(),s=Dn(),o=ll();function a(u,c,f,p){if(!s(u))return u;c=t(c,u);for(var d=-1,g=c.length,y=g-1,w=u;w!=null&&++d<g;){var S=o(c[d]),_=f;if(S==="__proto__"||S==="constructor"||S==="prototype")return u;if(d!=y){var b=w[S];_=p?p(b,S,w):void 0,_===void 0&&(_=s(b)?b:r(c[d+1])?[]:{})}e(w,S,_),w=w[S]}return u}return ov=a,ov}var av,tN;function rz(){if(tN)return av;tN=1;var e=Mc(),t=nz(),r=Ic();function s(o,a,u){for(var c=-1,f=a.length,p={};++c<f;){var d=a[c],g=e(o,d);u(g,d)&&t(p,r(d,o),g)}return p}return av=s,av}var lv,nN;function sz(){if(nN)return lv;nN=1;var e=rz(),t=BT();function r(s,o){return e(s,o,function(a,u){return t(s,u)})}return lv=r,lv}var uv,rN;function iz(){if(rN)return uv;rN=1;var e=aR(),t=XT(),r=QT();function s(o){return r(t(o,void 0,e),o+"")}return uv=s,uv}var cv,sN;function oz(){if(sN)return cv;sN=1;var e=sz(),t=iz(),r=t(function(s,o){return s==null?{}:e(s,o)});return cv=r,cv}var dv,iN;function az(){if(iN)return dv;iN=1;var e=Math.ceil,t=Math.max;function r(s,o,a,u){for(var c=-1,f=t(e((o-s)/(a||1)),0),p=Array(f);f--;)p[u?f:++c]=s,s+=a;return p}return dv=r,dv}var fv,oN;function lz(){if(oN)return fv;oN=1;var e=az(),t=Pc(),r=oR();function s(o){return function(a,u,c){return c&&typeof c!="number"&&t(a,u,c)&&(u=c=void 0),a=r(a),u===void 0?(u=a,a=0):u=r(u),c=c===void 0?a<u?1:-1:r(c),e(a,u,c,o)}}return fv=s,fv}var hv,aN;function uz(){if(aN)return hv;aN=1;var e=lz(),t=e();return hv=t,hv}var pv,lN;function cz(){if(lN)return pv;lN=1;function e(t,r){var s=t.length;for(t.sort(r);s--;)t[s]=t[s].value;return t}return pv=e,pv}var mv,uN;function dz(){if(uN)return mv;uN=1;var e=Ro();function t(r,s){if(r!==s){var o=r!==void 0,a=r===null,u=r===r,c=e(r),f=s!==void 0,p=s===null,d=s===s,g=e(s);if(!p&&!g&&!c&&r>s||c&&f&&d&&!p&&!g||a&&f&&d||!o&&d||!u)return 1;if(!a&&!c&&!g&&r<s||g&&o&&u&&!a&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return mv=t,mv}var gv,cN;function fz(){if(cN)return gv;cN=1;var e=dz();function t(r,s,o){for(var a=-1,u=r.criteria,c=s.criteria,f=u.length,p=o.length;++a<f;){var d=e(u[a],c[a]);if(d){if(a>=p)return d;var g=o[a];return d*(g=="desc"?-1:1)}}return r.index-s.index}return gv=t,gv}var vv,dN;function hz(){if(dN)return vv;dN=1;var e=Ac(),t=Mc(),r=Qr(),s=GT(),o=cz(),a=Cc(),u=fz(),c=fi(),f=Ct();function p(d,g,y){g.length?g=e(g,function(_){return f(_)?function(b){return t(b,_.length===1?_[0]:_)}:_}):g=[c];var w=-1;g=e(g,a(r));var S=s(d,function(_,b,k){var E=e(g,function(C){return C(_)});return{criteria:E,index:++w,value:_}});return o(S,function(_,b){return u(_,b,y)})}return vv=p,vv}var yv,fN;function pz(){if(fN)return yv;fN=1;var e=C0(),t=hz(),r=Oc(),s=Pc(),o=r(function(a,u){if(a==null)return[];var c=u.length;return c>1&&s(a,u[0],u[1])?u=[]:c>2&&s(u[0],u[1],u[2])&&(u=[u[0]]),t(a,e(u,1),[])});return yv=o,yv}var wv,hN;function mz(){if(hN)return wv;hN=1;var e=FT(),t=0;function r(s){var o=++t;return e(s)+o}return wv=r,wv}var xv,pN;function gz(){if(pN)return xv;pN=1;function e(t,r,s){for(var o=-1,a=t.length,u=r.length,c={};++o<a;){var f=o<u?r[o]:void 0;s(c,t[o],f)}return c}return xv=e,xv}var _v,mN;function vz(){if(mN)return _v;mN=1;var e=Ec(),t=gz();function r(s,o){return t(s||[],o||[],e)}return _v=r,_v}var bv,gN;function mt(){if(gN)return bv;gN=1;var e;if(typeof f0=="function")try{e={cloneDeep:MF(),constant:b0(),defaults:OF(),each:MT(),filter:HT(),find:zF(),flatten:aR(),forEach:IT(),forIn:BF(),has:WT(),isUndefined:VT(),last:UF(),map:YT(),mapValues:HF(),max:VF(),merge:ZF(),min:JF(),minBy:ez(),now:tz(),pick:oz(),range:uz(),reduce:KT(),sortBy:pz(),uniqueId:mz(),values:eR(),zipObject:vz()}}catch{}return e||(e=window._),bv=e,bv}var kv,vN;function yz(){if(vN)return kv;vN=1,kv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,o=s._prev;if(o!==s)return t(o),o},e.prototype.enqueue=function(s){var o=this._sentinel;s._prev&&s._next&&t(s),s._next=o._next,o._next._prev=s,o._next=s,s._prev=o},e.prototype.toString=function(){for(var s=[],o=this._sentinel,a=o._prev;a!==o;)s.push(JSON.stringify(a,r)),a=a._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function r(s,o){if(s!=="_next"&&s!=="_prev")return o}return kv}var Sv,yN;function wz(){if(yN)return Sv;yN=1;var e=mt(),t=ir().Graph,r=yz();Sv=o;var s=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var g=c(p,d||s),y=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,d,g){for(var y=[],w=d[d.length-1],S=d[0],_;p.nodeCount();){for(;_=S.dequeue();)u(p,d,g,_);for(;_=w.dequeue();)u(p,d,g,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,g,_,!0));break}}}return y}function u(p,d,g,y,w){var S=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),k=p.node(_.v);w&&S.push({v:_.v,w:_.w}),k.out-=b,f(d,g,k)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),k=_.w,E=p.node(k);E.in-=b,f(d,g,E)}),p.removeNode(y.v),S}function c(p,d){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(b){g.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var k=g.edge(b.v,b.w)||0,E=d(b),C=k+E;g.setEdge(b.v,b.w,C),w=Math.max(w,g.node(b.v).out+=E),y=Math.max(y,g.node(b.w).in+=E)});var S=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(g.nodes(),function(b){f(S,_,g.node(b))}),{graph:g,buckets:S,zeroIdx:_}}function f(p,d,g){g.out?g.in?p[g.out-g.in+d].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return Sv}var Ev,wN;function xz(){if(wN)return Ev;wN=1;var e=mt(),t=wz();Ev={run:r,undo:o};function r(a){var u=a.graph().acyclicer==="greedy"?t(a,c(a)):s(a);e.forEach(u,function(f){var p=a.edge(f);a.removeEdge(f),p.forwardName=f.name,p.reversed=!0,a.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function c(f){return function(p){return f.edge(p).weight}}}function s(a){var u=[],c={},f={};function p(d){e.has(f,d)||(f[d]=!0,c[d]=!0,e.forEach(a.outEdges(d),function(g){e.has(c,g.w)?u.push(g):p(g.w)}),delete c[d])}return e.forEach(a.nodes(),p),u}function o(a){e.forEach(a.edges(),function(u){var c=a.edge(u);if(c.reversed){a.removeEdge(u);var f=c.forwardName;delete c.reversed,delete c.forwardName,a.setEdge(u.w,u.v,c,f)}})}return Ev}var Nv,xN;function cn(){if(xN)return Nv;xN=1;var e=mt(),t=ir().Graph;Nv={addDummyNode:r,simplify:s,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:g,maxRank:y,partition:w,time:S,notime:_};function r(b,k,E,C){var T;do T=e.uniqueId(C);while(b.hasNode(T));return E.dummy=k,b.setNode(T,E),T}function s(b){var k=new t().setGraph(b.graph());return e.forEach(b.nodes(),function(E){k.setNode(E,b.node(E))}),e.forEach(b.edges(),function(E){var C=k.edge(E.v,E.w)||{weight:0,minlen:1},T=b.edge(E);k.setEdge(E.v,E.w,{weight:C.weight+T.weight,minlen:Math.max(C.minlen,T.minlen)})}),k}function o(b){var k=new t({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(E){b.children(E).length||k.setNode(E,b.node(E))}),e.forEach(b.edges(),function(E){k.setEdge(E,b.edge(E))}),k}function a(b){var k=e.map(b.nodes(),function(E){var C={};return e.forEach(b.outEdges(E),function(T){C[T.w]=(C[T.w]||0)+b.edge(T).weight}),C});return e.zipObject(b.nodes(),k)}function u(b){var k=e.map(b.nodes(),function(E){var C={};return e.forEach(b.inEdges(E),function(T){C[T.v]=(C[T.v]||0)+b.edge(T).weight}),C});return e.zipObject(b.nodes(),k)}function c(b,k){var E=b.x,C=b.y,T=k.x-E,A=k.y-C,L=b.width/2,P=b.height/2;if(!T&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var U,O;return Math.abs(A)*L>Math.abs(T)*P?(A<0&&(P=-P),U=P*T/A,O=P):(T<0&&(L=-L),U=L,O=L*A/T),{x:E+U,y:C+O}}function f(b){var k=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(E){var C=b.node(E),T=C.rank;e.isUndefined(T)||(k[T][C.order]=E)}),k}function p(b){var k=e.min(e.map(b.nodes(),function(E){return b.node(E).rank}));e.forEach(b.nodes(),function(E){var C=b.node(E);e.has(C,"rank")&&(C.rank-=k)})}function d(b){var k=e.min(e.map(b.nodes(),function(A){return b.node(A).rank})),E=[];e.forEach(b.nodes(),function(A){var L=b.node(A).rank-k;E[L]||(E[L]=[]),E[L].push(A)});var C=0,T=b.graph().nodeRankFactor;e.forEach(E,function(A,L){e.isUndefined(A)&&L%T!==0?--C:C&&e.forEach(A,function(P){b.node(P).rank+=C})})}function g(b,k,E,C){var T={width:0,height:0};return arguments.length>=4&&(T.rank=E,T.order=C),r(b,"border",T,k)}function y(b){return e.max(e.map(b.nodes(),function(k){var E=b.node(k).rank;if(!e.isUndefined(E))return E}))}function w(b,k){var E={lhs:[],rhs:[]};return e.forEach(b,function(C){k(C)?E.lhs.push(C):E.rhs.push(C)}),E}function S(b,k){var E=e.now();try{return k()}finally{console.log(b+" time: "+(e.now()-E)+"ms")}}function _(b,k){return k()}return Nv}var Cv,_N;function _z(){if(_N)return Cv;_N=1;var e=mt(),t=cn();Cv={run:r,undo:o};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(u){s(a,u)})}function s(a,u){var c=u.v,f=a.node(c).rank,p=u.w,d=a.node(p).rank,g=u.name,y=a.edge(u),w=y.labelRank;if(d!==f+1){a.removeEdge(u);var S,_,b;for(b=0,++f;f<d;++b,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:f},S=t.addDummyNode(a,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),a.setEdge(c,S,{weight:y.weight},g),b===0&&a.graph().dummyChains.push(S),c=S;a.setEdge(c,p,{weight:y.weight},g)}}function o(a){e.forEach(a.graph().dummyChains,function(u){var c=a.node(u),f=c.edgeLabel,p;for(a.setEdge(c.edgeObj,f);c.dummy;)p=a.successors(u)[0],a.removeNode(u),f.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(f.x=c.x,f.y=c.y,f.width=c.width,f.height=c.height),u=p,c=a.node(u)})}return Cv}var jv,bN;function oc(){if(bN)return jv;bN=1;var e=mt();jv={longestPath:t,slack:r};function t(s){var o={};function a(u){var c=s.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var f=e.min(e.map(s.outEdges(u),function(p){return a(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),c.rank=f}e.forEach(s.sources(),a)}function r(s,o){return s.node(o.w).rank-s.node(o.v).rank-s.edge(o).minlen}return jv}var Tv,kN;function dR(){if(kN)return Tv;kN=1;var e=mt(),t=ir().Graph,r=oc().slack;Tv=s;function s(c){var f=new t({directed:!1}),p=c.nodes()[0],d=c.nodeCount();f.setNode(p,{});for(var g,y;o(f,c)<d;)g=a(f,c),y=f.hasNode(g.v)?r(c,g):-r(c,g),u(f,c,y);return f}function o(c,f){function p(d){e.forEach(f.nodeEdges(d),function(g){var y=g.v,w=d===y?g.w:y;!c.hasNode(w)&&!r(f,g)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function a(c,f){return e.minBy(f.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(f,p)})}function u(c,f,p){e.forEach(c.nodes(),function(d){f.node(d).rank+=p})}return Tv}var Rv,SN;function bz(){if(SN)return Rv;SN=1;var e=mt(),t=dR(),r=oc().slack,s=oc().longestPath,o=ir().alg.preorder,a=ir().alg.postorder,u=cn().simplify;Rv=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=S,c.exchangeEdges=_;function c(C){C=u(C),s(C);var T=t(C);g(T),f(T,C);for(var A,L;A=w(T);)L=S(T,C,A),_(T,C,A,L)}function f(C,T){var A=a(C,C.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(L){p(C,T,L)})}function p(C,T,A){var L=C.node(A),P=L.parent;C.edge(A,P).cutvalue=d(C,T,A)}function d(C,T,A){var L=C.node(A),P=L.parent,U=!0,O=T.edge(A,P),M=0;return O||(U=!1,O=T.edge(P,A)),M=O.weight,e.forEach(T.nodeEdges(A),function(q){var V=q.v===A,X=V?q.w:q.v;if(X!==P){var j=V===U,G=T.edge(q).weight;if(M+=j?G:-G,k(C,A,X)){var B=C.edge(A,X).cutvalue;M+=j?-B:B}}}),M}function g(C,T){arguments.length<2&&(T=C.nodes()[0]),y(C,{},1,T)}function y(C,T,A,L,P){var U=A,O=C.node(L);return T[L]=!0,e.forEach(C.neighbors(L),function(M){e.has(T,M)||(A=y(C,T,A,M,L))}),O.low=U,O.lim=A++,P?O.parent=P:delete O.parent,A}function w(C){return e.find(C.edges(),function(T){return C.edge(T).cutvalue<0})}function S(C,T,A){var L=A.v,P=A.w;T.hasEdge(L,P)||(L=A.w,P=A.v);var U=C.node(L),O=C.node(P),M=U,q=!1;U.lim>O.lim&&(M=O,q=!0);var V=e.filter(T.edges(),function(X){return q===E(C,C.node(X.v),M)&&q!==E(C,C.node(X.w),M)});return e.minBy(V,function(X){return r(T,X)})}function _(C,T,A,L){var P=A.v,U=A.w;C.removeEdge(P,U),C.setEdge(L.v,L.w,{}),g(C),f(C,T),b(C,T)}function b(C,T){var A=e.find(C.nodes(),function(P){return!T.node(P).parent}),L=o(C,A);L=L.slice(1),e.forEach(L,function(P){var U=C.node(P).parent,O=T.edge(P,U),M=!1;O||(O=T.edge(U,P),M=!0),T.node(P).rank=T.node(U).rank+(M?O.minlen:-O.minlen)})}function k(C,T,A){return C.hasEdge(T,A)}function E(C,T,A){return A.low<=T.lim&&T.lim<=A.lim}return Rv}var Av,EN;function kz(){if(EN)return Av;EN=1;var e=oc(),t=e.longestPath,r=dR(),s=bz();Av=o;function o(f){switch(f.graph().ranker){case"network-simplex":c(f);break;case"tight-tree":u(f);break;case"longest-path":a(f);break;default:c(f)}}var a=t;function u(f){t(f),r(f)}function c(f){s(f)}return Av}var Iv,NN;function Sz(){if(NN)return Iv;NN=1;var e=mt();Iv=t;function t(o){var a=s(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),f=c.edgeObj,p=r(o,a,f.v,f.w),d=p.path,g=p.lca,y=0,w=d[y],S=!0;u!==f.w;){if(c=o.node(u),S){for(;(w=d[y])!==g&&o.node(w).maxRank<c.rank;)y++;w===g&&(S=!1)}if(!S){for(;y<d.length-1&&o.node(w=d[y+1]).minRank<=c.rank;)y++;w=d[y]}o.setParent(u,w),u=o.successors(u)[0]}})}function r(o,a,u,c){var f=[],p=[],d=Math.min(a[u].low,a[c].low),g=Math.max(a[u].lim,a[c].lim),y,w;y=u;do y=o.parent(y),f.push(y);while(y&&(a[y].low>d||g>a[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function s(o){var a={},u=0;function c(f){var p=u;e.forEach(o.children(f),c),a[f]={low:p,lim:u++}}return e.forEach(o.children(),c),a}return Iv}var Mv,CN;function Ez(){if(CN)return Mv;CN=1;var e=mt(),t=cn();Mv={run:r,cleanup:u};function r(c){var f=t.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,g=2*d+1;c.graph().nestingRoot=f,e.forEach(c.edges(),function(w){c.edge(w).minlen*=g});var y=a(c)+1;e.forEach(c.children(),function(w){s(c,f,g,y,d,p,w)}),c.graph().nodeRankFactor=g}function s(c,f,p,d,g,y,w){var S=c.children(w);if(!S.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(c,"_bt"),b=t.addBorderNode(c,"_bb"),k=c.node(w);c.setParent(_,w),k.borderTop=_,c.setParent(b,w),k.borderBottom=b,e.forEach(S,function(E){s(c,f,p,d,g,y,E);var C=c.node(E),T=C.borderTop?C.borderTop:E,A=C.borderBottom?C.borderBottom:E,L=C.borderTop?d:2*d,P=T!==A?1:g-y[w]+1;c.setEdge(_,T,{weight:L,minlen:P,nestingEdge:!0}),c.setEdge(A,b,{weight:L,minlen:P,nestingEdge:!0})}),c.parent(w)||c.setEdge(f,_,{weight:0,minlen:g+y[w]})}function o(c){var f={};function p(d,g){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),f[d]=g}return e.forEach(c.children(),function(d){p(d,1)}),f}function a(c){return e.reduce(c.edges(),function(f,p){return f+c.edge(p).weight},0)}function u(c){var f=c.graph();c.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return Mv}var Ov,jN;function Nz(){if(jN)return Ov;jN=1;var e=mt(),t=cn();Ov=r;function r(o){function a(u){var c=o.children(u),f=o.node(u);if(c.length&&e.forEach(c,a),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,d=f.maxRank+1;p<d;++p)s(o,"borderLeft","_bl",u,f,p),s(o,"borderRight","_br",u,f,p)}}e.forEach(o.children(),a)}function s(o,a,u,c,f,p){var d={width:0,height:0,rank:p,borderType:a},g=f[a][p-1],y=t.addDummyNode(o,"border",d,u);f[a][p]=y,o.setParent(y,c),g&&o.setEdge(g,y,{weight:1})}return Ov}var Pv,TN;function Cz(){if(TN)return Pv;TN=1;var e=mt();Pv={adjust:t,undo:r};function t(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&s(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&a(p),(d==="lr"||d==="rl")&&(c(p),s(p))}function s(p){e.forEach(p.nodes(),function(d){o(p.node(d))}),e.forEach(p.edges(),function(d){o(p.edge(d))})}function o(p){var d=p.width;p.width=p.height,p.height=d}function a(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var g=p.edge(d);e.forEach(g.points,u),e.has(g,"y")&&u(g)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){f(p.node(d))}),e.forEach(p.edges(),function(d){var g=p.edge(d);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var d=p.x;p.x=p.y,p.y=d}return Pv}var Lv,RN;function jz(){if(RN)return Lv;RN=1;var e=mt();Lv=t;function t(r){var s={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),a=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(a+1),function(){return[]});function c(p){if(!e.has(s,p)){s[p]=!0;var d=r.node(p);u[d.rank].push(p),e.forEach(r.successors(p),c)}}var f=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(f,c),u}return Lv}var $v,AN;function Tz(){if(AN)return $v;AN=1;var e=mt();$v=t;function t(s,o){for(var a=0,u=1;u<o.length;++u)a+=r(s,o[u-1],o[u]);return a}function r(s,o,a){for(var u=e.zipObject(a,e.map(a,function(y,w){return w})),c=e.flatten(e.map(o,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:u[w.w],weight:s.edge(w).weight}}),"pos")}),!0),f=1;f<a.length;)f<<=1;var p=2*f-1;f-=1;var d=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(c.forEach(function(y){var w=y.pos+f;d[w]+=y.weight;for(var S=0;w>0;)w%2&&(S+=d[w+1]),w=w-1>>1,d[w]+=y.weight;g+=y.weight*S})),g}return $v}var qv,IN;function Rz(){if(IN)return qv;IN=1;var e=mt();qv=t;function t(r,s){return e.map(s,function(o){var a=r.inEdges(o);if(a.length){var u=e.reduce(a,function(c,f){var p=r.edge(f),d=r.node(f.v);return{sum:c.sum+p.weight*d.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:o,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:o}})}return qv}var Dv,MN;function Az(){if(MN)return Dv;MN=1;var e=mt();Dv=t;function t(o,a){var u={};e.forEach(o,function(f,p){var d=u[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(d.barycenter=f.barycenter,d.weight=f.weight)}),e.forEach(a.edges(),function(f){var p=u[f.v],d=u[f.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[f.w]))});var c=e.filter(u,function(f){return!f.indegree});return r(c)}function r(o){var a=[];function u(p){return function(d){d.merged||(e.isUndefined(d.barycenter)||e.isUndefined(p.barycenter)||d.barycenter>=p.barycenter)&&s(p,d)}}function c(p){return function(d){d.in.push(p),--d.indegree===0&&o.push(d)}}for(;o.length;){var f=o.pop();a.push(f),e.forEach(f.in.reverse(),u(f)),e.forEach(f.out,c(f))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(o,a){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),a.weight&&(u+=a.barycenter*a.weight,c+=a.weight),o.vs=a.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(a.i,o.i),a.merged=!0}return Dv}var Fv,ON;function Iz(){if(ON)return Fv;ON=1;var e=mt(),t=cn();Fv=r;function r(a,u){var c=t.partition(a,function(_){return e.has(_,"barycenter")}),f=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],g=0,y=0,w=0;f.sort(o(!!u)),w=s(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),g+=_.barycenter*_.weight,y+=_.weight,w=s(d,p,w)});var S={vs:e.flatten(d,!0)};return y&&(S.barycenter=g/y,S.weight=y),S}function s(a,u,c){for(var f;u.length&&(f=e.last(u)).i<=c;)u.pop(),a.push(f.vs),c++;return c}function o(a){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:a?c.i-u.i:u.i-c.i}}return Fv}var zv,PN;function Mz(){if(PN)return zv;PN=1;var e=mt(),t=Rz(),r=Az(),s=Iz();zv=o;function o(c,f,p,d){var g=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,S=y?y.borderRight:void 0,_={};w&&(g=e.filter(g,function(A){return A!==w&&A!==S}));var b=t(c,g);e.forEach(b,function(A){if(c.children(A.v).length){var L=o(c,A.v,p,d);_[A.v]=L,e.has(L,"barycenter")&&u(A,L)}});var k=r(b,p);a(k,_);var E=s(k,d);if(w&&(E.vs=e.flatten([w,E.vs,S],!0),c.predecessors(w).length)){var C=c.node(c.predecessors(w)[0]),T=c.node(c.predecessors(S)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+C.order+T.order)/(E.weight+2),E.weight+=2}return E}function a(c,f){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return f[d]?f[d].vs:d}),!0)})}function u(c,f){e.isUndefined(c.barycenter)?(c.barycenter=f.barycenter,c.weight=f.weight):(c.barycenter=(c.barycenter*c.weight+f.barycenter*f.weight)/(c.weight+f.weight),c.weight+=f.weight)}return zv}var Bv,LN;function Oz(){if(LN)return Bv;LN=1;var e=mt(),t=ir().Graph;Bv=r;function r(o,a,u){var c=s(o),f=new t({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),g=o.parent(p);(d.rank===a||d.minRank<=a&&a<=d.maxRank)&&(f.setNode(p),f.setParent(p,g||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,S=f.edge(w,p),_=e.isUndefined(S)?0:S.weight;f.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&f.setNode(p,{borderLeft:d.borderLeft[a],borderRight:d.borderRight[a]}))}),f}function s(o){for(var a;o.hasNode(a=e.uniqueId("_root")););return a}return Bv}var Uv,$N;function Pz(){if($N)return Uv;$N=1;var e=mt();Uv=t;function t(r,s,o){var a={},u;e.forEach(o,function(c){for(var f=r.parent(c),p,d;f;){if(p=r.parent(f),p?(d=a[p],a[p]=f):(d=u,u=f),d&&d!==f){s.setEdge(d,f);return}f=p}})}return Uv}var Hv,qN;function Lz(){if(qN)return Hv;qN=1;var e=mt(),t=jz(),r=Tz(),s=Mz(),o=Oz(),a=Pz(),u=ir().Graph,c=cn();Hv=f;function f(y){var w=c.maxRank(y),S=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),b=t(y);g(y,b);for(var k=Number.POSITIVE_INFINITY,E,C=0,T=0;T<4;++C,++T){d(C%2?S:_,C%4>=2),b=c.buildLayerMatrix(y);var A=r(y,b);A<k&&(T=0,E=e.cloneDeep(b),k=A)}g(y,E)}function p(y,w,S){return e.map(w,function(_){return o(y,_,S)})}function d(y,w){var S=new u;e.forEach(y,function(_){var b=_.graph().root,k=s(_,b,S,w);e.forEach(k.vs,function(E,C){_.node(E).order=C}),a(_,S,k.vs)})}function g(y,w){e.forEach(w,function(S){e.forEach(S,function(_,b){y.node(_).order=b})})}return Hv}var Wv,DN;function $z(){if(DN)return Wv;DN=1;var e=mt(),t=ir().Graph,r=cn();Wv={positionX:S,findType1Conflicts:s,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(k,E){var C={};function T(A,L){var P=0,U=0,O=A.length,M=e.last(L);return e.forEach(L,function(q,V){var X=a(k,q),j=X?k.node(X).order:O;(X||q===M)&&(e.forEach(L.slice(U,V+1),function(G){e.forEach(k.predecessors(G),function(B){var te=k.node(B),Z=te.order;(Z<P||j<Z)&&!(te.dummy&&k.node(G).dummy)&&u(C,B,G)})}),U=V+1,P=j)}),L}return e.reduce(E,T),C}function o(k,E){var C={};function T(L,P,U,O,M){var q;e.forEach(e.range(P,U),function(V){q=L[V],k.node(q).dummy&&e.forEach(k.predecessors(q),function(X){var j=k.node(X);j.dummy&&(j.order<O||j.order>M)&&u(C,X,q)})})}function A(L,P){var U=-1,O,M=0;return e.forEach(P,function(q,V){if(k.node(q).dummy==="border"){var X=k.predecessors(q);X.length&&(O=k.node(X[0]).order,T(P,M,V,U,O),M=V,U=O)}T(P,M,P.length,O,L.length)}),P}return e.reduce(E,A),C}function a(k,E){if(k.node(E).dummy)return e.find(k.predecessors(E),function(C){return k.node(C).dummy})}function u(k,E,C){if(E>C){var T=E;E=C,C=T}var A=k[E];A||(k[E]=A={}),A[C]=!0}function c(k,E,C){if(E>C){var T=E;E=C,C=T}return e.has(k[E],C)}function f(k,E,C,T){var A={},L={},P={};return e.forEach(E,function(U){e.forEach(U,function(O,M){A[O]=O,L[O]=O,P[O]=M})}),e.forEach(E,function(U){var O=-1;e.forEach(U,function(M){var q=T(M);if(q.length){q=e.sortBy(q,function(B){return P[B]});for(var V=(q.length-1)/2,X=Math.floor(V),j=Math.ceil(V);X<=j;++X){var G=q[X];L[M]===M&&O<P[G]&&!c(C,M,G)&&(L[G]=M,L[M]=A[M]=A[G],O=P[G])}}})}),{root:A,align:L}}function p(k,E,C,T,A){var L={},P=d(k,E,C,A),U=A?"borderLeft":"borderRight";function O(V,X){for(var j=P.nodes(),G=j.pop(),B={};G;)B[G]?V(G):(B[G]=!0,j.push(G),j=j.concat(X(G))),G=j.pop()}function M(V){L[V]=P.inEdges(V).reduce(function(X,j){return Math.max(X,L[j.v]+P.edge(j))},0)}function q(V){var X=P.outEdges(V).reduce(function(G,B){return Math.min(G,L[B.w]-P.edge(B))},Number.POSITIVE_INFINITY),j=k.node(V);X!==Number.POSITIVE_INFINITY&&j.borderType!==U&&(L[V]=Math.max(L[V],X))}return O(M,P.predecessors.bind(P)),O(q,P.successors.bind(P)),e.forEach(T,function(V){L[V]=L[C[V]]}),L}function d(k,E,C,T){var A=new t,L=k.graph(),P=_(L.nodesep,L.edgesep,T);return e.forEach(E,function(U){var O;e.forEach(U,function(M){var q=C[M];if(A.setNode(q),O){var V=C[O],X=A.edge(V,q);A.setEdge(V,q,Math.max(P(k,M,O),X||0))}O=M})}),A}function g(k,E){return e.minBy(e.values(E),function(C){var T=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(C,function(L,P){var U=b(k,P)/2;T=Math.max(L+U,T),A=Math.min(L-U,A)}),T-A})}function y(k,E){var C=e.values(E),T=e.min(C),A=e.max(C);e.forEach(["u","d"],function(L){e.forEach(["l","r"],function(P){var U=L+P,O=k[U],M;if(O!==E){var q=e.values(O);M=P==="l"?T-e.min(q):A-e.max(q),M&&(k[U]=e.mapValues(O,function(V){return V+M}))}})})}function w(k,E){return e.mapValues(k.ul,function(C,T){if(E)return k[E.toLowerCase()][T];var A=e.sortBy(e.map(k,T));return(A[1]+A[2])/2})}function S(k){var E=r.buildLayerMatrix(k),C=e.merge(s(k,E),o(k,E)),T={},A;e.forEach(["u","d"],function(P){A=P==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(U){U==="r"&&(A=e.map(A,function(V){return e.values(V).reverse()}));var O=(P==="u"?k.predecessors:k.successors).bind(k),M=f(k,A,C,O),q=p(k,A,M.root,M.align,U==="r");U==="r"&&(q=e.mapValues(q,function(V){return-V})),T[P+U]=q})});var L=g(k,T);return y(T,L),w(T,k.graph().align)}function _(k,E,C){return function(T,A,L){var P=T.node(A),U=T.node(L),O=0,M;if(O+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":M=-P.width/2;break;case"r":M=P.width/2;break}if(M&&(O+=C?M:-M),M=0,O+=(P.dummy?E:k)/2,O+=(U.dummy?E:k)/2,O+=U.width/2,e.has(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":M=U.width/2;break;case"r":M=-U.width/2;break}return M&&(O+=C?M:-M),M=0,O}}function b(k,E){return k.node(E).width}return Wv}var Vv,FN;function qz(){if(FN)return Vv;FN=1;var e=mt(),t=cn(),r=$z().positionX;Vv=s;function s(a){a=t.asNonCompoundGraph(a),o(a),e.forEach(r(a),function(u,c){a.node(c).x=u})}function o(a){var u=t.buildLayerMatrix(a),c=a.graph().ranksep,f=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=f+d/2}),f+=d+c})}return Vv}var Gv,zN;function Dz(){if(zN)return Gv;zN=1;var e=mt(),t=xz(),r=_z(),s=kz(),o=cn().normalizeRanks,a=Sz(),u=cn().removeEmptyRanks,c=Ez(),f=Nz(),p=Cz(),d=Lz(),g=qz(),y=cn(),w=ir().Graph;Gv=S;function S(z,Q){var ne=Q&&Q.debugTiming?y.time:y.notime;ne("layout",function(){var ae=ne(" buildLayoutGraph",function(){return O(z)});ne(" runLayout",function(){_(ae,ne)}),ne(" updateInputGraph",function(){b(z,ae)})})}function _(z,Q){Q(" makeSpaceForEdgeLabels",function(){M(z)}),Q(" removeSelfEdges",function(){$(z)}),Q(" acyclic",function(){t.run(z)}),Q(" nestingGraph.run",function(){c.run(z)}),Q(" rank",function(){s(y.asNonCompoundGraph(z))}),Q(" injectEdgeLabelProxies",function(){q(z)}),Q(" removeEmptyRanks",function(){u(z)}),Q(" nestingGraph.cleanup",function(){c.cleanup(z)}),Q(" normalizeRanks",function(){o(z)}),Q(" assignRankMinMax",function(){V(z)}),Q(" removeEdgeLabelProxies",function(){X(z)}),Q(" normalize.run",function(){r.run(z)}),Q(" parentDummyChains",function(){a(z)}),Q(" addBorderSegments",function(){f(z)}),Q(" order",function(){d(z)}),Q(" insertSelfEdges",function(){H(z)}),Q(" adjustCoordinateSystem",function(){p.adjust(z)}),Q(" position",function(){g(z)}),Q(" positionSelfEdges",function(){I(z)}),Q(" removeBorderNodes",function(){Z(z)}),Q(" normalize.undo",function(){r.undo(z)}),Q(" fixupEdgeLabelCoords",function(){B(z)}),Q(" undoCoordinateSystem",function(){p.undo(z)}),Q(" translateGraph",function(){j(z)}),Q(" assignNodeIntersects",function(){G(z)}),Q(" reversePoints",function(){te(z)}),Q(" acyclic.undo",function(){t.undo(z)})}function b(z,Q){e.forEach(z.nodes(),function(ne){var ae=z.node(ne),fe=Q.node(ne);ae&&(ae.x=fe.x,ae.y=fe.y,Q.children(ne).length&&(ae.width=fe.width,ae.height=fe.height))}),e.forEach(z.edges(),function(ne){var ae=z.edge(ne),fe=Q.edge(ne);ae.points=fe.points,e.has(fe,"x")&&(ae.x=fe.x,ae.y=fe.y)}),z.graph().width=Q.graph().width,z.graph().height=Q.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],T=["width","height"],A={width:0,height:0},L=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function O(z){var Q=new w({multigraph:!0,compound:!0}),ne=ce(z.graph());return Q.setGraph(e.merge({},E,Y(ne,k),e.pick(ne,C))),e.forEach(z.nodes(),function(ae){var fe=ce(z.node(ae));Q.setNode(ae,e.defaults(Y(fe,T),A)),Q.setParent(ae,z.parent(ae))}),e.forEach(z.edges(),function(ae){var fe=ce(z.edge(ae));Q.setEdge(ae,e.merge({},P,Y(fe,L),e.pick(fe,U)))}),Q}function M(z){var Q=z.graph();Q.ranksep/=2,e.forEach(z.edges(),function(ne){var ae=z.edge(ne);ae.minlen*=2,ae.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?ae.width+=ae.labeloffset:ae.height+=ae.labeloffset)})}function q(z){e.forEach(z.edges(),function(Q){var ne=z.edge(Q);if(ne.width&&ne.height){var ae=z.node(Q.v),fe=z.node(Q.w),pe={rank:(fe.rank-ae.rank)/2+ae.rank,e:Q};y.addDummyNode(z,"edge-proxy",pe,"_ep")}})}function V(z){var Q=0;e.forEach(z.nodes(),function(ne){var ae=z.node(ne);ae.borderTop&&(ae.minRank=z.node(ae.borderTop).rank,ae.maxRank=z.node(ae.borderBottom).rank,Q=e.max(Q,ae.maxRank))}),z.graph().maxRank=Q}function X(z){e.forEach(z.nodes(),function(Q){var ne=z.node(Q);ne.dummy==="edge-proxy"&&(z.edge(ne.e).labelRank=ne.rank,z.removeNode(Q))})}function j(z){var Q=Number.POSITIVE_INFINITY,ne=0,ae=Number.POSITIVE_INFINITY,fe=0,pe=z.graph(),ye=pe.marginx||0,Me=pe.marginy||0;function Ue(ze){var Ie=ze.x,ke=ze.y,le=ze.width,we=ze.height;Q=Math.min(Q,Ie-le/2),ne=Math.max(ne,Ie+le/2),ae=Math.min(ae,ke-we/2),fe=Math.max(fe,ke+we/2)}e.forEach(z.nodes(),function(ze){Ue(z.node(ze))}),e.forEach(z.edges(),function(ze){var Ie=z.edge(ze);e.has(Ie,"x")&&Ue(Ie)}),Q-=ye,ae-=Me,e.forEach(z.nodes(),function(ze){var Ie=z.node(ze);Ie.x-=Q,Ie.y-=ae}),e.forEach(z.edges(),function(ze){var Ie=z.edge(ze);e.forEach(Ie.points,function(ke){ke.x-=Q,ke.y-=ae}),e.has(Ie,"x")&&(Ie.x-=Q),e.has(Ie,"y")&&(Ie.y-=ae)}),pe.width=ne-Q+ye,pe.height=fe-ae+Me}function G(z){e.forEach(z.edges(),function(Q){var ne=z.edge(Q),ae=z.node(Q.v),fe=z.node(Q.w),pe,ye;ne.points?(pe=ne.points[0],ye=ne.points[ne.points.length-1]):(ne.points=[],pe=fe,ye=ae),ne.points.unshift(y.intersectRect(ae,pe)),ne.points.push(y.intersectRect(fe,ye))})}function B(z){e.forEach(z.edges(),function(Q){var ne=z.edge(Q);if(e.has(ne,"x"))switch((ne.labelpos==="l"||ne.labelpos==="r")&&(ne.width-=ne.labeloffset),ne.labelpos){case"l":ne.x-=ne.width/2+ne.labeloffset;break;case"r":ne.x+=ne.width/2+ne.labeloffset;break}})}function te(z){e.forEach(z.edges(),function(Q){var ne=z.edge(Q);ne.reversed&&ne.points.reverse()})}function Z(z){e.forEach(z.nodes(),function(Q){if(z.children(Q).length){var ne=z.node(Q),ae=z.node(ne.borderTop),fe=z.node(ne.borderBottom),pe=z.node(e.last(ne.borderLeft)),ye=z.node(e.last(ne.borderRight));ne.width=Math.abs(ye.x-pe.x),ne.height=Math.abs(fe.y-ae.y),ne.x=pe.x+ne.width/2,ne.y=ae.y+ne.height/2}}),e.forEach(z.nodes(),function(Q){z.node(Q).dummy==="border"&&z.removeNode(Q)})}function $(z){e.forEach(z.edges(),function(Q){if(Q.v===Q.w){var ne=z.node(Q.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:Q,label:z.edge(Q)}),z.removeEdge(Q)}})}function H(z){var Q=y.buildLayerMatrix(z);e.forEach(Q,function(ne){var ae=0;e.forEach(ne,function(fe,pe){var ye=z.node(fe);ye.order=pe+ae,e.forEach(ye.selfEdges,function(Me){y.addDummyNode(z,"selfedge",{width:Me.label.width,height:Me.label.height,rank:ye.rank,order:pe+ ++ae,e:Me.e,label:Me.label},"_se")}),delete ye.selfEdges})})}function I(z){e.forEach(z.nodes(),function(Q){var ne=z.node(Q);if(ne.dummy==="selfedge"){var ae=z.node(ne.e.v),fe=ae.x+ae.width/2,pe=ae.y,ye=ne.x-fe,Me=ae.height/2;z.setEdge(ne.e,ne.label),z.removeNode(Q),ne.label.points=[{x:fe+2*ye/3,y:pe-Me},{x:fe+5*ye/6,y:pe-Me},{x:fe+ye,y:pe},{x:fe+5*ye/6,y:pe+Me},{x:fe+2*ye/3,y:pe+Me}],ne.label.x=ne.x,ne.label.y=ne.y}})}function Y(z,Q){return e.mapValues(e.pick(z,Q),Number)}function ce(z){var Q={};return e.forEach(z,function(ne,ae){Q[ae.toLowerCase()]=ne}),Q}return Gv}var Yv,BN;function Fz(){if(BN)return Yv;BN=1;var e=mt(),t=cn(),r=ir().Graph;Yv={debugOrdering:s};function s(o){var a=t.buildLayerMatrix(o),u=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(a,function(c,f){var p="layer"+f;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,g){return u.setEdge(d,g,{style:"invis"}),g})}),u}return Yv}var Kv,UN;function zz(){return UN||(UN=1,Kv="0.8.5"),Kv}var Xv,HN;function Bz(){return HN||(HN=1,Xv={graphlib:ir(),layout:Dz(),debug:Fz(),util:{time:cn().time,notime:cn().notime},version:zz()}),Xv}var Uz=Bz();const WN=My(Uz),So=240,ac=130,mo=74,Lc=72,VN=mo+Lc;function Hz(e,t){var s;let r=So;for(const o of e)r=Math.max(r,((s=t.get(o.id))==null?void 0:s.width)??So);return r}const fR=420,Wz=2;function Ga(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function Vz(e,t){return((t==null?void 0:t.get(e))??0)>0?fR:0}function Gz(e,t){const r=(t==null?void 0:t.get(e))??0;return r>0?6+r*36:0}function Ya(e,t,r){const s=t.get(e);return{w:((s==null?void 0:s.width)??So)+Vz(e,r),h:Math.max((s==null?void 0:s.height)??ac,Gz(e,r))}}function Yz(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function Kz(e,t,r,s,o,a){const u=new WN.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(k=>!o.has(k)),f=new Set(c);for(const k of c){const{w:E,h:C}=Ya(k,s,a);u.setNode(k,{width:E,height:C})}for(const k of t)f.has(k.source)&&f.has(k.target)&&u.setEdge(k.source,k.target);WN.layout(u);const p=new Map;let d=1/0,g=1/0,y=-1/0,w=-1/0;for(const k of c){const E=u.node(k);if(!E)continue;const C=s.get(k),T=(C==null?void 0:C.width)??So,A=(C==null?void 0:C.height)??ac,L=Ya(k,s,a),P=E.x-L.w/2,U=E.y-L.h/2;p.set(k,{x:P,y:U}),P<d&&(d=P),U<g&&(g=U),P+T>y&&(y=P+T),U+A>w&&(w=U+A)}if(Number.isFinite(d)&&Number.isFinite(g))for(const[k,E]of p)p.set(k,{x:E.x-d,y:E.y-g});const S=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-g:0;let b=null;for(const k of e){const E=o.get(k);if(!E)continue;const C=s.get(k),T=(C==null?void 0:C.width)??So,A=(C==null?void 0:C.height)??ac;b=b===null?{minX:E.x,minY:E.y,maxX:E.x+T,maxY:E.y+A}:{minX:Math.min(b.minX,E.x),minY:Math.min(b.minY,E.y),maxX:Math.max(b.maxX,E.x+T),maxY:Math.max(b.maxY,E.y+A)}}return{positions:p,width:S,height:_,pinnedBox:b}}function Xz(e,t,r={}){const s=r.direction??"LR",o=r.pinned??new Map,a=r.measured??new Map,u=r.lanes,c=new Map;for(const k of e){const E=Ga(k),C=c.get(E);C?C.push(k.id):c.set(E,[k.id])}const p=Array.from(c.keys()).sort().map(k=>({sid:k,...Kz(c.get(k),t,s,a,o,u)})),d=Hz(e,a),g=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=k=>{const E=[[]];let C=0;for(const T of p)E.length<k&&C>0&&C+T.height>g&&(E.push([]),C=0),E[E.length-1].push(T),C+=T.height+VN;return E},w=k=>k.reduce((E,C)=>Math.max(E,C.width),0)+fR;let S=y(r.availableWidth?Wz:1);S.length>1&&S.reduce((E,C)=>E+w(C),0)+d*(S.length-1)>(r.availableWidth??0)&&(S=y(1));const _=new Map;let b=0;for(const k of S){const E=w(k);let C=0;for(const{positions:T,height:A,pinnedBox:L}of k){for(const[U,O]of T)_.set(U,{x:O.x+b,y:O.y+C});let P=C+A;L&&L.maxY>P&&L.minX<b+E&&b<L.maxX&&(P=L.maxY),C=P+VN}b+=E+d}return e.map(k=>{const E=o.get(k.id);if(E)return{...k,position:E};const C=_.get(k.id);return C?{...k,position:C}:k})}function Qz(e,t,r,s,o){const u=mo+Lc,c=60,f=w=>Ya(w,s,o),p=new Map(e.map(w=>[w.id,Ga(w)])),d=[],g=e.map(w=>({id:w.id,pos:r.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,S)=>w.pos.y-S.pos.y||w.pos.x-S.pos.x||w.id.localeCompare(S.id)),y=[];for(const{id:w,pos:S}of g){const{w:_,h:b}=f(w),k=p.get(w)??"_default";if(r.has(w)){d.push({x:S.x,y:S.y,w:_,h:b,sid:k});continue}let E=S.y;for(let C=0;C<d.length+1;C++){const T=d.find(A=>{const L=A.sid===k?24:c,P=A.sid===k?24:u;return S.x<A.x+A.w+L&&A.x<S.x+_+L&&E<A.y+A.h+P&&A.y<E+b+P});if(!T)break;E=T.y+T.h+(T.sid===k?24:u)}E!==S.y&&(t.set(w,{x:S.x,y:E}),y.push(w)),d.push({x:S.x,y:E,w:_,h:b,sid:k})}return y}function Zz(e,t,r,s,o,a){const u=_=>Ya(_,s,a),c=_=>r.get(_)??t.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=Ga(_),k=f.get(b);k?k.push(_):f.set(b,[_])}const p=new Set;for(const[_,b]of f)b.every(k=>o.has(k.id)&&!r.has(k.id))&&p.add(_);const d=new Map,g=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:k,h:E}=u(_.id),C=Ga(_);p.has(C)?(d.get(C)??d.set(C,[]).get(C)).push(_):g.push({x:b.x,y:b.y,w:k,h:E})}if(d.size===0)return[];const y=mo+Lc,w=(_,b,k,E)=>g.some(C=>_<C.x+C.w+mo&&C.x<_+k+mo&&b<C.y+C.h+y&&C.y<b+E+y),S=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let k=1/0,E=1/0,C=-1/0,T=-1/0;for(const q of b){const V=c(q.id),{w:X,h:j}=u(q.id);k=Math.min(k,V.x),E=Math.min(E,V.y),C=Math.max(C,V.x+X),T=Math.max(T,V.y+j)}const A=C-k,L=T-E,P=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,V)=>q-V),U=P.length?P:[k],O=[0,...g.map(q=>q.y+q.h+y)].sort((q,V)=>q-V);let M=null;e:for(const q of U)for(const V of O){if(V>=E)break;if(!w(q,V,A,L)){M={x:q,y:V};break e}}if(M){const q=M.x-k,V=M.y-E;for(const X of b){const j=c(X.id);t.set(X.id,{x:j.x+q,y:j.y+V})}S.push(_)}for(const q of b){const V=c(q.id),{w:X,h:j}=u(q.id);g.push({x:V.x,y:V.y,w:X,h:j})}}return S}function Jz(e,t,r,s,o,a=!1,u){const p=mo+Lc+1,d=8,g=1.75,y=200,w=.7,S=.01,_=M=>Ya(M,s,u),b=M=>r.get(M)??t.get(M),k=new Map;for(const M of e){if(!b(M.id))continue;const q=Ga(M),V=k.get(q);V?V.push(M):k.set(q,[M])}const E=[],C=new Set,T=new Set,A=o.size===0;for(const M of[...k.keys()].sort()){const q=k.get(M);let V=1/0,X=1/0,j=-1/0,G=-1/0,B=!1;for(const H of q){const I=b(H.id),{w:Y,h:ce}=_(H.id);V=Math.min(V,I.x),X=Math.min(X,I.y),j=Math.max(j,I.x+Y),G=Math.max(G,I.y+ce),r.has(H.id)&&(B=!0)}const te=j-V,Z=G-X;T.add(M);const $=o.get(M);$&&(te>$.w+d||Z>$.h+d)&&C.add(M),o.set(M,{w:te,h:Z}),E.push({sid:M,members:q.map(H=>H.id),x:V,y:X,w:te,h:Z,anchored:B,mass:1})}for(const M of[...o.keys()])T.has(M)||o.delete(M);if(a||A)return[];let L=!1;for(let M=0;M<E.length&&!L;M++)for(let q=M+1;q<E.length;q++){const V=E[M],X=E[q];if(!(V.anchored&&X.anchored)&&Math.abs(V.x+V.w/2-(X.x+X.w/2))<(V.w+X.w)/2+61&&Math.abs(V.y+V.h/2-(X.y+X.h/2))<(V.h+X.h)/2+p){L=!0;break}}if(C.size===0&&!L)return[];if(C.size>0)for(const M of E)C.has(M.sid)&&(M.mass=8);else for(const M of E)M.mass=Math.max(1,M.w*M.h/(So*ac));const P=new Map(E.map(M=>[M.sid,M.x])),U=new Map(E.map(M=>[M.sid,M.y]));for(let M=0;M<y;M++){const q=new Map,V=new Map;let X=0;for(let j=0;j<E.length;j++)for(let G=j+1;G<E.length;G++){const B=E[j],te=E[G];if(B.anchored&&te.anchored)continue;const Z=B.x+B.w/2,$=B.y+B.h/2,H=te.x+te.w/2,I=te.y+te.h/2,Y=(B.w+te.w)/2+61-Math.abs(Z-H),ce=(B.h+te.h)/2+p-Math.abs($-I);if(Y<=0||ce<=0)continue;const z=(Be,et)=>!Be.anchored&&!(et<0&&Be.x<=0),Q=(Be,et)=>!Be.anchored&&!(et<0&&Be.y<=0),ne=(Be,et,Xe)=>{const wt=Be===et,ee=wt?B.sid<te.sid?-1:1:Math.sign(Be-et);return Xe(B,ee)||Xe(te,-ee)?ee:wt&&(Xe(B,-ee)||Xe(te,ee))?-ee:0},ae=ne(Z,H,z),fe=ne($,I,Q),pe=ae!==0,ye=fe!==0;if(!pe&&!ye)continue;const Me=pe&&(!ye||Y*g<ce),[Ue,ze,Ie,ke]=Me?[ae,Y,q,z]:[fe,ce,V,Q],le=ke(B,Ue),we=ke(te,-Ue),xe=B.mass,Ye=te.mass,gt=le?we?Ye/(xe+Ye):1:0,ft=we?le?xe/(xe+Ye):1:0,ot=ze*w;Ie.set(B.sid,(Ie.get(B.sid)??0)+Ue*ot*gt),Ie.set(te.sid,(Ie.get(te.sid)??0)-Ue*ot*ft),X+=ot}for(const j of E)j.anchored||(j.x=Math.max(0,j.x+(q.get(j.sid)??0)),j.y=Math.max(0,j.y+(V.get(j.sid)??0)));if(X<S)break}const O=[];for(const M of E){const q=M.x-P.get(M.sid),V=M.y-U.get(M.sid);if(!(Math.abs(q)<1&&Math.abs(V)<1)){for(const X of M.members){if(r.has(X))continue;const j=t.get(X);j&&t.set(X,{x:j.x+q,y:j.y+V})}O.push(M.sid)}}return O}const e6=600;function Ty(e,t){return!(e.exitAt!=null&&t-e.exitAt>e6||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function t6(e,t){const r=new Set;for(const s of e.agents.values())Ty(s,t)&&r.add(s.id);return r}function n6(e,t,r=0){return e.right+r>t.left&&e.left-r<t.right&&e.bottom+r>t.top&&e.top-r<t.bottom}function r6(e,t,r=0){if(!e)return!1;for(const s of t)if(n6(e,s,r))return!0;return!1}const hR="sessionGroup";function s6(e,t){var s;if(e.type===hR)return"transparent";const r=(s=e.data)==null?void 0:s.state;return t(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const pR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line"];function GN(e){const t={};for(const r of pR)t[r]=e(r);return t}function i6(e){return t=>e[t]??""}function o6(e,t){return pR.every(r=>e[r]===t[r])}function a6(e){const t=new Set(e.pins),r=new Map,s=new Map;for(const[o,a]of e.positions)r.set(o,a),t.has(o)&&s.set(o,a);return{positions:r,pinned:s}}const l6=1200,u6=1e3;function YN(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<l6?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<u6}function Qv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function c6(e,t,r){const s=e.x*t.zoom+t.x,o=e.y*t.zoom+t.y,a=(e.x+e.width)*t.zoom+t.x,u=(e.y+e.height)*t.zoom+t.y;return a>0&&s<r.width&&u>0&&o<r.height}function d6({pane:e,viewport:t,boxes:r}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const o of r)if(s=!0,c6(o,t,e))return!1;return s}const f6="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Zv="click for what's new";function h6(e){if(e.checkDisabled)return`${f6} · ${Zv}`;if(e.checking)return`Asking npm for the newest release… · ${Zv}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",r=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${r} · re-checked periodically · ${Zv}, and to check npm now`}function p6(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:`${t} and check npm for a newer release`}function m6(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,r=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${r}`}function g6(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Ry={kind:"assumed",claude:!0,codex:!0};function v6(e){if(!e||typeof e!="object")return Ry;const t=e.providers;if(!t||typeof t!="object")return Ry;const r=t;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function lc(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const KN=99;function y6(e){const t=Math.max(0,Math.floor(e));return t>KN?`${KN}+`:String(t)}const w6="Pause the canvas";function x6(e){if(!e.paused)return"Pause live updates — events keep arriving and are applied when you resume (Space)";const t=Math.max(0,Math.floor(e.dropped??0));return t>0?`The pause is full — ${lc(e.held)} held and ${t} older ${t===1?"one":"ones"} already dropped. Resume to follow the canvas again (Space)`:e.held<=0?"Nothing has arrived since you paused. Resume to follow the canvas again (Space)":`${lc(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function _6(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const mR="paused · full",b6=(e,t)=>t>0?mR:e>0?`paused · ${y6(e)}`:"paused";function k6(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",label:b6(e.held,t),widest:mR,title:t>0?`Connected — the pause is full at ${lc(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${lc(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function XN(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const S6={agent:C$,sessionGroup:U$},gR="react-flow__node";function QN(e){var t,r;return!!e&&((r=(t=e.classList)==null?void 0:t.contains)==null?void 0:r.call(t,gR))===!0}function E6(e){try{const t=document.querySelector(`.${gR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const N6=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),C6=420,Fu=18,j6=200,T6=5*6e4,R6=6,A6=2*6e4,ZN=400,R0="agent-dag.layout",A0="agent-dag.viewport",vR="agent-dag.summariesDismissed",yR="agent-dag.sessionListOpen",wR="agent-dag.detailOpen",xR="agent-dag.usagePanelOpen",JN="agent-dag.accountsPanelOpen",Jv="agent-dag.versionNoticeDismissed",eC="agent-dag.oldNameNoticeDismissed",I6=15*6e4,ey={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:"},tC="agent-dag.autoRestart",nC="agent-dag.bundleReloadedFor";function M6(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(yR)==="1"}catch{return!1}}function O6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yR,e?"1":"0")}catch{}}function P6(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(wR)==="1"}catch{return!1}}function L6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(wR,e?"1":"0")}catch{}}function $6(){const e=yc(xR);return e===null?!0:e==="1"}function q6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(xR,e?"1":"0")}catch{}}function D6(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(vR);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(r=>typeof r=="string"):[])}catch{return new Set}}function rC(e){if(!(typeof window>"u"))try{const t=Array.from(e),r=t.length>200?t.slice(-200):t;window.localStorage.setItem(vR,JSON.stringify(r))}catch{}}function F6(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(R0);if(!t)return e;const r=JSON.parse(t);if(!("v"in r)){const o=Object.entries(r).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:o,pins:o.map(([a])=>a)}}return{positions:Object.entries(r.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(r.pins)?r.pins:[]}}catch{return e}}function ty(e,t){if(!(typeof window>"u"))try{const r={};for(const[s,o]of e)r[s]=o;for(const[s,o]of t)r[s]=o;window.localStorage.setItem(R0,JSON.stringify({v:2,positions:r,pins:Array.from(t.keys())}))}catch{}}function z6(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(A0);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function B6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(A0,JSON.stringify(e))}catch{}}function sC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(R0)}catch{}try{window.localStorage.removeItem(A0)}catch{}}}function U6(e,t){const r=e.agents.get(t);if(!r)return;const s=[];for(const d of e.agents.values())d.sessionId===t&&s.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:s.map(d=>({id:d.id,kind:d.kind,label:d.label,parentId:d.parentId,state:d.state,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,cwd:d.cwd,usage:d.usage,prompts:d.prompts,tools:d.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},a=JSON.stringify(o,null,2),u=new Blob([a],{type:"application/json"}),c=URL.createObjectURL(u),f=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=c,f.download=`${Yt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Ay={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Iy={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},_R=Hj;function H6(e,t,r,s,o,a,u,c,f,p,d,g,y,w,S,_,b,k){const E=[],C=[];for(const M of e.agents.values()){if(!b.has(M.id))continue;const q=M.exitAt!=null,V=_!=null&&!_.has(M.id),X=[q?"rf-exiting":"",V?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,j=a.get(M.id);if(E.push({id:M.id,type:"agent",position:{x:0,y:0},data:{...M,now:t,onOpenContext:k},className:X,...j?{width:j.width,height:j.height}:null}),M.parentId&&b.has(M.parentId)){const G=Zy(M.sessionId),B=q,te=S.size>0&&(S.has(M.id)||S.has(M.parentId)),Z=_!=null&&!_.has(M.id)&&!_.has(M.parentId),$=M.state==="active"?2:1.5,H=te?$+1.5:$,I=B?.2:Z?.12:1,Y=["sess-edge",M.state==="active"?"sess-live":"sess-idle",B?"rf-edge-exiting":"",te?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${M.parentId}->${M.id}`,source:M.parentId,target:M.id,animated:(M.state==="active"||te)&&!B,type:"smoothstep",style:{"--session-hue":G,strokeWidth:H,opacity:I,transition:"var(--edge-transition)"},className:Y})}}const T=new Map;for(const M of e.agents.values())M.tools.length>0&&T.set(M.id,Math.min(4,M.tools.length));const A=`${y}#lanes:${Yz(T)}`,L=E.filter(M=>eD(M.id,o,d,g));if(L.length>0||A!==w.current){if(L.length>0){const M=Xz(E,C,{direction:"LR",pinned:o,measured:a,availableWidth:r,availableHeight:s,lanes:T});for(const q of M)cT(q.id,d,g)&&nD(q.id,q.position,d,g);Zz(E,d,o,a,new Set(L.map(q=>q.id)),T)}Qz(E,d,o,a,T),w.current=A}const P=Jz(E,d,o,a,u,!f||p,T);P.length>0&&c(P),Lu(d,e.agents),Lu(g,e.agents),Lu(o,e.agents),Lu(a,Q4(e.agents.values()));const U=[];let O=!1;for(const M of E){let q=o.get(M.id)??d.get(M.id);q||(q=tD(M.id,d,g),O=!0),U.push({...M,position:q})}return O&&(w.current=""),{nodes:U,edges:C}}function W6(){return m.jsx(Xy,{children:m.jsx(V6,{})})}function V6(){var Qo,Zo,Or,Cl;const e=Ja(),t=Nt(),r=N.useState(yy)[0],s=N.useRef(r),[,o]=N.useState(0),a=N.useCallback(()=>o(F=>F+1),[]),[u,c]=N.useState(()=>new Set),[f,p]=N.useState(null),[d,g]=N.useState(null),y=N.useCallback((F,W)=>{c(ie=>{if(!W)return new Set([F]);const de=new Set(ie);return de.has(F)?de.delete(F):de.add(F),de}),p(ie=>W&&ie===F?ie:F)},[]),w=N.useCallback(()=>{c(new Set),p(null)},[]),[S,_]=N.useState(null),[b,k]=N.useState(null),E=N.useCallback(F=>k(F),[]),[C,T]=N.useState(!1),[A,L]=N.useState(!1),P=N.useState(D6)[0],[U,O]=N.useState(M6);N.useEffect(()=>{O6(U)},[U]);const[M,q]=N.useState(P6);N.useEffect(()=>{L6(M)},[M]);const[V,X]=N.useState($6);N.useEffect(()=>{q6(V)},[V]);const[j,G]=N.useState(()=>{try{const F=window.localStorage.getItem(JN);return F===null?!0:F==="1"}catch{return!0}});N.useEffect(()=>{try{window.localStorage.setItem(JN,j?"1":"0")}catch{}},[j]);const[B,te]=N.useState(null);N.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}te(F===null?!0:F==="on")},[]);const Z=N.useCallback(()=>{te(F=>{var ie;const W=F!==!0;try{localStorage.setItem("agent-dag.sound",W?"on":"off")}catch{}return W&&((ie=Me.current)==null||ie.unlock()),W})},[]),$=N.useCallback(F=>{Z()},[Z]),H=N.useRef($);H.current=$;const I=N.useRef(B);I.current=B;const[Y,ce]=N.useState(()=>S4(yc)),z=N.useRef(Y);z.current=Y;const Q=N.useRef(null),ne=N.useCallback((F,W=!1)=>{var ie,de;if((ie=Me.current)==null||ie.unlock(),Q.current!==null&&clearTimeout(Q.current),Q.current=null,!W){(de=Me.current)==null||de.play(F,!0);return}Q.current=setTimeout(()=>{var _e;Q.current=null,(_e=Me.current)==null||_e.play(F,!0)},w4)},[]),ae=N.useCallback((F,W)=>{ce(ie=>{const de={level:Va(W.level??ie[F].level),figure:iT(F,W.figure??ie[F].figure)};try{localStorage.setItem(aT[F],String(de.level)),localStorage.setItem(lT[F],de.figure)}catch{}return{...ie,[F]:de}}),ne(F,!0)},[ne]);N.useEffect(()=>()=>{Q.current!==null&&clearTimeout(Q.current)},[]);const[fe,pe]=N.useState(!1),ye=N.useRef(null),Me=N.useRef(null),[Ue,ze]=N.useState("locked");N.useEffect(()=>{const F=C4({enabled:()=>I.current===!0,prefs:()=>z.current,onState:ze});Me.current=F,ze(F.state());const W=()=>F.unlock();return window.addEventListener("pointerdown",W,{once:!0,capture:!0}),window.addEventListener("keydown",W,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",W,{capture:!0}),window.removeEventListener("keydown",W,{capture:!0})}},[]);const[Ie,ke]=N.useState(!1),[le,we]=N.useState(null),[xe,Ye]=N.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Jv)??""}catch{return""}}),[gt,ft]=N.useState(!1),ot=N.useRef(0),[Be,et]=N.useState(!1),Xe=N.useCallback((F=!1)=>(F&&(ot.current=Date.now(),et(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(W=>W.ok?W.json():null).then(W=>{W&&we(W)}).catch(()=>{}).finally(()=>{F&&et(!1)})),[]),wt=N.useCallback(()=>{Xe(Date.now()-ot.current>=I6)},[Xe]);N.useEffect(()=>{Xe();const F=window.setInterval(wt,5*6e4),W=()=>{document.visibilityState==="visible"&&wt()};return document.addEventListener("visibilitychange",W),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",W)}},[Xe,wt]),N.useEffect(()=>{Ie&&Xe()},[Ie,Xe]);const ee=(le==null?void 0:le.notice)??null,[Le,De]=N.useState(null),Re=N.useRef(!1);N.useEffect(()=>{if(Re.current)return;const F=q4(),W=D4(F),ie=B4({stored:W,running:(le==null?void 0:le.running)??null,notes:b1,remembers:F4(F)});ie.reason!=="no-version"&&(Re.current=!0,ie.record&&z4(F,ie.record),ie.show.length&&De({entries:ie.show,since:W,firstRun:ie.reason==="welcome"}))},[le==null?void 0:le.running]);const $e=(le==null?void 0:le.running)??"1.46.2",rt=N.useMemo(()=>uT(b1,null,$e),[$e]),tt=N.useCallback(()=>{De({entries:rt,since:null,firstRun:!1})},[rt]),[Ce,kt]=N.useState(null),[Ve,lt]=N.useState(Ry);N.useEffect(()=>{let F=!1;return fetch("/api/health").then(W=>W.ok?W.json():null).then(W=>{F||(lt(v6(W)),!(!W||typeof W.workspace!="string")&&kt(W.workspace))}).catch(()=>{}),()=>{F=!0}},[Ie]);const dn=N.useRef(Ve);dn.current=Ve;const wn=ee?`${ee.kind}:${ee.to}`:"",xn=ee!=null&&xe!==wn,_n=N.useCallback(()=>{Ye("");try{window.localStorage.setItem(Jv,"")}catch{}},[]),zn=N.useCallback(()=>{if(ee){Ye(wn);try{window.localStorage.setItem(Jv,wn)}catch{}}},[ee,wn]),[bn,hi]=N.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(eC)??""}catch{return""}}),fn=le!=null&&le.invokedAs&&le.invokedAs!==Yt?le.invokedAs:null,pi=fn!=null&&bn!==fn,mi=N.useCallback(()=>{if(fn){hi(fn);try{window.localStorage.setItem(eC,fn)}catch{}}},[fn]),qt=((Qo=le==null?void 0:le.upgrade)==null?void 0:Qo.state)??"idle",Sr=t4(le==null?void 0:le.upgrade),Bn=N.useRef(!1),Rs=N.useCallback(async()=>{if(js(Bn.current||qt==="running")){Bn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Xe(),Bn.current=!1}},[qt,Xe]);N.useEffect(()=>{if(qt!=="running")return;const F=window.setInterval(Xe,3e3);return()=>window.clearInterval(F)},[qt,Xe]);const Er=N.useCallback(async()=>{var ie;const F=le==null?void 0:le.command;if(!F)return;let W=!1;try{W=await Promise.race([((ie=navigator.clipboard)==null?void 0:ie.writeText(F).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{W=!1}if(!W)try{const de=document.createElement("textarea");de.value=F,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),W=document.execCommand("copy"),de.remove()}catch{W=!1}W&&(ft(!0),window.setTimeout(()=>ft(!1),1600))},[le==null?void 0:le.command]),Ao=N.useCallback(()=>{O(F=>(F||G(!1),!F))},[]),lr=N.useCallback(()=>{G(F=>(F||O(!1),!F))},[]),[Nr,ur]=N.useState(!1),[As,gi]=N.useState(0),vi=N.useRef(null),[yi,kn]=N.useState(!1),cr=N.useRef(null),[wi,xi]=N.useState(0),Bt=N.useState(()=>aD({protect:F=>FL(s.current,F)}))[0],[Cr,_i]=N.useState(!1),Zr=N.useCallback(()=>{const F=Bt.paused&&Bt.dropped>0,W=Bt.setPaused(!Bt.paused);F&&zL(s.current);for(const ie of W)s.current=P_(s.current,ie);_i(Bt.paused)},[Bt]),[xt,Io]=N.useState(Date.now()),[st,Mo]=N.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(tC)!=="0"}catch{return!0}}),Is=N.useCallback(()=>{Mo(F=>{const W=!F;try{window.localStorage.setItem(tC,W?"1":"0")}catch{}return W})},[]),[Sn,Un]=N.useState(!1),[bi,ki]=N.useState("restart"),[jr,Kt]=N.useState(null),En=N.useRef(!1),tn=N.useRef(null),ul=N.useRef(0),Si=N.useCallback(async F=>{if(!js(En.current))return;const W=(F==null?void 0:F.upgrade)===!0;En.current=!0,tn.current=Sr;const ie=++ul.current;ki(W?"npx":"restart"),Un(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ee==null?void 0:ee.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:W})})}catch{}window.setTimeout(()=>{if(ul.current===ie&&En.current){En.current=!1,Un(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},W?18e4:3e4)},[ee==null?void 0:ee.to,Sr]),cl=N.useRef(null);N.useEffect(()=>{let F=!1;for(const ie of s.current.agents.values())if(ie.state==="active"){F=!0;break}const W=r4({enabled:st,kind:ee==null?void 0:ee.kind,canRestart:(le==null?void 0:le.canRestart)===!0,busy:F,idleSince:cl.current,now:xt});cl.current=W.idleSince,W.restart&&Si()},[st,ee==null?void 0:ee.kind,le==null?void 0:le.canRestart,xt,Si]),N.useEffect(()=>{const F=le==null?void 0:le.running;let W=null,ie=null;try{W=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(nC)}catch{return}const de=e4({bundle:"1.46.2",running:F,pending:W,lastTried:ie});if(de==="reload"){try{window.sessionStorage.setItem(nC,F??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}En.current=!1,Un(!1),Kt(F??null);const _e=window.setTimeout(()=>Kt(null),6e3);return()=>window.clearTimeout(_e)},[le==null?void 0:le.running]),N.useEffect(()=>{if(Sn&&n4({asked:tn.current,reported:Sr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}En.current=!1,Un(!1)}},[Sn,Sr]);const Ms=N.useState(()=>a6(F6()))[0],Mt=N.useRef(Ms.pinned),dr=N.useRef(null),Tr=N.useState(()=>z6())[0],[dl,$c]=N.useState(()=>new Set),[Rr,Oo]=N.useState(uD),[Hn,Os]=N.useState(()=>GN(XN)),fl=N.useMemo(()=>i6(Hn),[Hn]),Po=N.useCallback(F=>s6(F,fl),[fl]),Je=N.useMemo(()=>({background:Hn["--panel"],border:`1px solid ${Hn["--line"]}`,borderRadius:8}),[Hn]),[Lo,hl]=N.useState(!1);N.useEffect(()=>{document.documentElement.dataset.theme=Rr;try{window.localStorage.setItem(dT,Rr)}catch{}Os(F=>{const W=GN(XN);return o6(F,W)?F:W})},[Rr]);const Wn=N.useCallback((F,W)=>{if(Qv({durationMs:W,documentHidden:document.hidden})){e.setViewport(F,{duration:W});return}const{d3Zoom:ie,d3Selection:de}=t.getState(),_e=de==null?void 0:de.property("__zoom");if(ie&&de&&_e&&_e.k>0&&F.zoom>0){ie.transform(de,_e.scale(F.zoom/_e.k).translate((F.x-_e.x)/F.zoom,(F.y-_e.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,t]),Jr=N.useRef(null);N.useEffect(()=>{if(!Tr)return;const F=window.setTimeout(()=>{try{Wn(Tr,0)}catch{}Nn.current=Date.now()},60);return()=>window.clearTimeout(F)},[Wn,Tr]);const $o=N.useRef(!0);N.useEffect(()=>{const F=new EventSource("/events"),W=iD(a,{now:()=>Date.now(),setTimeout:(ie,de)=>window.setTimeout(ie,de),clearTimeout:ie=>window.clearTimeout(ie)});return F.addEventListener("open",()=>{ke(!0),hl(!0)}),F.addEventListener("error",()=>ke(!1)),F.addEventListener("replay-end",()=>{$o.current=!1,W.flush()}),F.addEventListener("hook",ie=>{var de;try{const _e=JSON.parse(ie.data);if(!Bt.accept(_e))return;s.current=P_(s.current,_e);const Se=_e.replay===!0||$o.current||Date.now()-_e.receivedAt>3e4;Se?W.replay():W.live();const Fe=N4(_e,Se);Fe&&((de=Me.current)==null||de.play(Fe))}catch{}}),()=>{F.close(),W.cancel()}},[a]),N.useEffect(()=>{const F=setInterval(()=>{const W=Date.now();Io(W);let ie=BL(s.current,W,O_);UL(s.current,W,O_)&&(ie=!0),qL(s.current,W,j6,T6)&&(ie=!0),DL(s.current,W,R6,A6)&&(ie=!0),c(de=>X4(de,s.current.agents)),p(de=>de!=null&&!s.current.agents.has(de)?null:de),ie&&a()},250);return()=>clearInterval(F)},[a]);const Ei=N.useRef(null),Nn=N.useRef(0),Ni=420,jt=N.useCallback((F=500)=>{try{const Se=document.querySelector(".canvas-wrap"),Fe=Array.from(document.querySelectorAll(".react-flow__node")).filter(nt=>nt.offsetWidth>0);if(!Se||Fe.length===0)return;const Ke=Se.getBoundingClientRect(),ht=e.getViewport();if(!Number.isFinite(ht.zoom)||ht.zoom<=0)return;const at=nt=>(nt-Ke.left-ht.x)/ht.zoom,Ut=nt=>(nt-Ke.top-ht.y)/ht.zoom,os=Fe.map(nt=>nt.getBoundingClientRect()),Jo=Math.min(...os.map(nt=>at(nt.left))),jl=Math.max(...os.map(nt=>at(nt.right))),ea=Math.min(...os.map(nt=>Ut(nt.top))),Wc=Math.max(...os.map(nt=>Ut(nt.bottom))),Tl=jl-Jo,ta=Wc-ea;if(!(Tl>0&&ta>0))return;const Fs=Math.max(.2,Math.min(1,(Ke.width-160)/(Tl+Ni)*.86,(Ke.height-160)/ta*.86)),zs={x:80-Jo*Fs,y:Math.max(80,(Ke.height-ta*Fs)/2)-ea*Fs,zoom:Fs};Wn(zs,F),Nn.current=Date.now(),Jr.current=Qv({durationMs:F,documentHidden:document.hidden})?{target:zs,until:Date.now()+F+60}:null,window.setTimeout(()=>{var nt;try{((nt=Jr.current)==null?void 0:nt.target)===zs&&(Jr.current=null);const as=e.getViewport();(Math.abs(as.zoom-Fs)>.01||Math.abs(as.x-zs.x)>2)&&Wn(zs,0)}catch{}},F+60)}catch{}},[e,Wn]);N.useEffect(()=>{const F=()=>{if(!document.hidden)return;const W=Jr.current;if(Jr.current=null,!(!W||Date.now()>W.until)){try{Wn(W.target,0)}catch{}Nn.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[Wn]);const Cn=N.useRef(""),jn=N.useRef(null),es=N.useRef(0),fr=N.useCallback(()=>{es.current=Date.now()},[]),Tn=N.useRef(null),pl=N.useRef(0),Ci=N.useCallback(()=>{pl.current=Date.now()},[]),ts=N.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:Nn.current,lastCanvasInputAt:pl.current}),[]),qo="agent-dag.autoFitDisabled",Do=N.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(qo)==="1"}catch{return!1}})[0],Vn=N.useRef(Do),[Fo,ml]=N.useState(Do),Ar=N.useCallback(()=>{if(!Vn.current){Vn.current=!0,ml(!0);try{window.localStorage.setItem(qo,"1")}catch{}}},[]),Ps=N.useCallback(()=>{Vn.current=!1,ml(!1);try{window.localStorage.removeItem(qo)}catch{}jt(400)},[e,jt]);N.useEffect(()=>{const F=setInterval(()=>{if(Vn.current||Date.now()-es.current<800)return;const W=s.current,ie=Date.now(),de=[];for(const Se of W.agents.values())Ty(Se,ie)&&de.push({id:Se.id});if(de.length===0)return;const _e=[];for(const{id:Se}of de){const Fe=Gn.current.get(Se),Ke=Mt.current.get(Se)??Xt.current.get(Se);!Fe||!Ke||_e.push({x:Ke.x,y:Ke.y,width:Fe.width,height:Fe.height})}d6({pane:Tn.current,viewport:e.getViewport(),boxes:_e})&&jt(600)},1500);return()=>clearInterval(F)},[e]);const hr=N.useRef(!1),Gn=N.useRef(new Map),gl=N.useRef(0),qc=N.useCallback(F=>{const W=Gn.current;let ie=!1;for(const de of F.nodeInternals.values()){const _e=de.width,Se=de.height;if(_e==null||Se==null)continue;const Fe=W.get(de.id);Fe?(Math.abs(Fe.height-Se)>4||Math.abs(Fe.width-_e)>4)&&(W.set(de.id,{width:_e,height:Se}),ie=!0):(W.set(de.id,{width:_e,height:Se}),ie=!0)}return ie&&(gl.current+=1),gl.current},[]),ji=it(qc),[Ls,zo]=N.useState(0);N.useEffect(()=>{let F=0;const W=()=>{const de=Gn.current;let _e=!1;for(const Se of document.querySelectorAll(".react-flow__node[data-id]")){const Fe=Se.getAttribute("data-id");if(!Fe)continue;const Ke=Se.offsetWidth,ht=Se.offsetHeight;if(!Ke||!ht)continue;const at=de.get(Fe);(!at||Math.abs(at.width-Ke)>4||Math.abs(at.height-ht)>4)&&(de.set(Fe,{width:Ke,height:ht}),_e=!0)}_e&&zo(Se=>Se+1)};if(hr.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(W,32):F=requestAnimationFrame(W),()=>{cancelAnimationFrame(F),window.clearTimeout(ie)}});const Xt=N.useRef(Ms.positions),pr=N.useRef(new Set),$s=N.useRef(""),Yn=N.useMemo(()=>{const F=[];for(const W of s.current.agents.values())Ty(W,xt)&&F.push(W.id+(W.parentId?`>${W.parentId}`:""));return F.sort(),`${F.join("|")}#sv${ji}.${Ls}`},[s.current,s.current.revision,xt,ji,Ls]),ns=N.useRef(null);N.useEffect(()=>(ns.current!=null&&window.clearTimeout(ns.current),ns.current=window.setTimeout(()=>{ty(Xt.current,Mt.current)},1500),()=>{ns.current!=null&&window.clearTimeout(ns.current)}),[Yn]),N.useEffect(()=>{if(Cn.current===Yn)return;const F=Cn.current;if(Cn.current=Yn,!F||Vn.current)return;Date.now()-Nn.current>1200&&jt(400),Ei.current&&window.clearTimeout(Ei.current),Ei.current=window.setTimeout(()=>{Vn.current||jt(500)},280)},[Yn,e,jt]);const rs=N.useMemo(()=>J4(s.current,u),[s.current,s.current.revision,u]),ss=N.useMemo(()=>t6(s.current,xt),[s.current,s.current.revision,xt]),Bo=N.useRef(null),[Ot,Ir]=N.useState({w:0,h:0});N.useEffect(()=>{const F=Bo.current;if(!F||typeof ResizeObserver>"u")return;const W=new ResizeObserver(ie=>{var _e;const de=(_e=ie[0])==null?void 0:_e.contentRect;de&&(Tn.current={width:de.width,height:de.height},Ir(Se=>Math.abs(Se.w-de.width)>40||Math.abs(Se.h-de.height)>40?{w:de.width,h:de.height}:Se))});return W.observe(F),Tn.current={width:F.clientWidth,height:F.clientHeight},Ir({w:F.clientWidth,h:F.clientHeight}),()=>W.disconnect()},[]);const Uo=N.useCallback(F=>{var ie,de;const W=F.target;!(W!=null&&W.closest)||W.closest(N6)!==F.currentTarget||(F.preventDefault(),(de=(ie=document.activeElement)==null?void 0:ie.blur)==null||de.call(ie))},[]),qs=N.useRef(new Map),[vl,Ho]=N.useState(!1);N.useEffect(()=>{const F=window.setTimeout(()=>Ho(!0),2500);return()=>window.clearTimeout(F)},[]);const[Wo,Mr]=N.useState(!1),hn=N.useRef(null),[Ti,yl]=N.useState(!1),Dc=N.useCallback(()=>{hn.current&&(window.clearTimeout(hn.current),hn.current=null),Mr(!1)},[]),Fc=N.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{Mr(!0),hn.current&&window.clearTimeout(hn.current),hn.current=window.setTimeout(()=>Mr(!1),C6+80)})},[]);N.useEffect(()=>()=>{hn.current&&window.clearTimeout(hn.current)},[]);const Ri=Ot.w>0?Ot.w*.92:0,wl=Ot.h>0?Ot.h:0,{nodes:mr,edges:zc}=N.useMemo(()=>H6(s.current,xt,Ri,wl,Mt.current,Gn.current,qs.current,Fc,vl,Ti,Xt.current,pr.current,Yn,$s,u,rs,ss,E),[s.current,s.current.revision,xt,Ri,wl,vl,Ti,Yn,u,rs,ss,E,As]),xl=N.useMemo(()=>{const F=new Map;for(const ie of mr){const de=ie.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const _e=ie.width,Se=ie.height;if(_e==null||Se==null)continue;const Fe=ie.position.x,Ke=ie.position.y,ht=Fe+_e,at=Ke+Se,Ut=F.get(de.sessionId);Ut?(Ut.minX=Math.min(Ut.minX,Fe),Ut.minY=Math.min(Ut.minY,Ke),Ut.maxX=Math.max(Ut.maxX,ht),Ut.maxY=Math.max(Ut.maxY,at)):F.set(de.sessionId,{minX:Fe,minY:Ke,maxX:ht,maxY:at})}const W=[];for(const[ie,de]of F){const _e=de.maxX-de.minX+Fu*2,Se=de.maxY-de.minY+Fu*2;W.push({id:`group:${ie}`,type:hR,position:{x:de.minX-Fu,y:de.minY-Fu},data:{sessionId:ie,w:_e,h:Se},width:_e,height:Se,style:{width:_e,height:Se},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return W},[mr,xt]),Bc=N.useMemo(()=>{const F=[...xl,...mr],W=cr.current;return!W||W.size===0?F:F.map(ie=>{const de=W.get(ie.id);return de?{...ie,position:de}:ie})},[xl,mr,wi]),Ds=N.useMemo(()=>{const F=new Set;for(const W of s.current.agents.values())for(const ie of W.tools)F.add(_R(ie.name));return Object.keys(Ay).filter(W=>F.has(W))},[s.current,s.current.revision]);N.useEffect(()=>{if(Ds.length<=1){kn(!1);return}let F=0;const W=()=>{const ie=vi.current;if(ie&&!document.hidden){const de=ie.getBoundingClientRect(),_e=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Fe=>Fe.getBoundingClientRect()),Se=r6(de,_e,8);kn(Fe=>Fe===Se?Fe:Se)}F=window.setTimeout(W,300)};return W(),()=>window.clearTimeout(F)},[Ds.length]);const Uc=N.useCallback(F=>{$c(W=>{const ie=new Set(W);return ie.has(F)?ie.delete(F):ie.add(F),ie})},[]),Qt=f?s.current.agents.get(f):null,Vo=d?Array.from(s.current.agents.values()).flatMap(F=>F.tools).find(F=>F.id===d)??null:null,_l=N.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=yy(),Mt.current.clear(),Gn.current.clear(),Xt.current.clear(),$s.current="",sC(),w(),a()},[a,w]),Ai=N.useRef(C);Ai.current=C;const bl=N.useRef(A);bl.current=A;const Go=N.useRef(!1);Go.current=Vo!=null||Nr||b!=null||S!=null||A||Le!=null;const Ii=N.useCallback(F=>{const W=s4(F,{confirmOpen:Ai.current,modalOpen:Go.current});W==="confirm"?T(!0):W==="clear"&&(T(!1),_l())},[_l]),Mi=N.useCallback(()=>{Mt.current.clear(),Xt.current.clear(),$s.current="",sC(),a(),window.setTimeout(()=>jt(500),80)},[a,e,jt]),kl=N.useCallback(()=>jt(500),[jt]),Oi=N.useRef(mr);Oi.current=mr;const Sl=N.useRef(f);Sl.current=f;const Yo=N.useCallback(F=>{const W=Oi.current,ie=W4(W.map(Se=>({id:Se.id,x:Se.position.x,y:Se.position.y})),Sl.current,F),de=ie?W.find(Se=>Se.id===ie):void 0;if(!de)return;const _e=QN(document.activeElement);y(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}Nn.current=Date.now(),_e&&E6(de.id)},30)},[y,e]),El=N.useCallback(F=>{y(F,!1),window.setTimeout(()=>{try{const W=Oi.current.find(ie=>ie.id===F);W&&e.fitView({padding:.3,duration:500,nodes:[W]}),Nn.current=Date.now()}catch{}},60)},[y,e]);N.useEffect(()=>{const F=W=>{var Ke,ht;const ie=W.target,de={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(Ke=ie==null?void 0:ie.getAttribute)==null?void 0:Ke.call(ie,"role"),type:ie==null?void 0:ie.type};if(W.key==="Escape"){const at=c$({overlayOpen:po.depth()>0,panelOnTop:po.topIsPanel(),typing:t0(de)});at==="dismiss"?po.dismissTop():at==="blur"?ie==null||ie.blur():(K4(de)&&(ie==null||ie.blur()),w());return}if(e0(W))return;const _e=QN(ie)?(ht=ie==null?void 0:ie.getAttribute)==null?void 0:ht.call(ie,"data-id"):null,Se=_e&&Oi.current.some(at=>at.id===_e)?_e:null,Fe=G4(W,Se);if(Fe.kind==="activate"){W.preventDefault(),y(Fe.nodeId,Fe.additive);return}Fe.kind!=="node"&&(Fe.nodeId==null&&y$(de)||w$({key:W.key,modalOpen:Go.current,sheetOpen:bl.current})||(W.key===" "&&(W.preventDefault(),Zr()),(W.key==="c"||W.key==="C")&&Ii("shortcut"),(W.key==="r"||W.key==="R")&&Mi(),(W.key==="f"||W.key==="F")&&kl(),(W.key==="l"||W.key==="L")&&Ao(),(W.key==="h"||W.key==="H")&&ur(at=>!at),(W.key==="u"||W.key==="U")&&X(at=>!at),(W.key==="a"||W.key==="A")&&dn.current.claude&&lr(),(W.key==="j"||W.key==="J")&&Yo(1),(W.key==="k"||W.key==="K")&&Yo(-1),(W.key==="t"||W.key==="T")&&Oo(at=>at==="dark"?"light":"dark"),(W.key==="m"||W.key==="M")&&dn.current.claude&&I.current!==null&&H.current(W.shiftKey),W.key==="?"&&L(at=>!at)))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[Ii,Mi,kl,w,y,Yo,Zr]);const Ko=s.current.agents.size,Kn=N.useMemo(()=>R3(s.current.agents.values()),[s.current,s.current.revision]),Pi=N.useMemo(()=>A3(s.current.agents.values()),[s.current,s.current.revision]),is=N.useRef(null);N.useEffect(()=>{const F=cD({waiting:Kn.length,running:Pi}),W=is.current;if(is.current=F,(W==null?void 0:W.title)!==F.title&&(document.title=F.title),(W==null?void 0:W.icon)!==F.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=dD[F.icon])}},[Kn.length,Pi]);const[Hc,Nl]=N.useState(""),Xo=hD(Kn);N.useEffect(()=>{Nl(F=>pD(F,Xo))},[Xo]);const Zt=N.useMemo(()=>Kj(s.current.agents.values()),[s.current,s.current.revision]);return m.jsxs("div",{className:"app",children:[m.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),m.jsxs("header",{className:"topbar",children:[m.jsxs("div",{className:"readout",children:[m.jsxs("div",{className:"brand",children:[m.jsx("span",{className:"logo"}),m.jsx("h1",{children:Yt}),ee?m.jsxs("button",{type:"button",className:"v stale",onClick:()=>{tt(),_n()},"aria-haspopup":"dialog","aria-label":m6({...ee,open:xn}),title:ee.kind==="restart"?`Running v${ee.from}; v${ee.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${ee.from}; v${ee.to} is on npm · click for what's new`,children:["v",ee.from,m.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:$e,latest:le==null?void 0:le.latest,latestPending:le==null?void 0:le.latestPending,checkedAgo:le!=null&&le.checkedAt?by(xt-le.checkedAt):null,checkDisabled:le==null?void 0:le.checkDisabled,checking:Be};return m.jsxs("button",{type:"button",className:Be?"v checking":"v",onClick:()=>{tt(),Xe(!0)},"aria-busy":Be||void 0,"aria-haspopup":"dialog","aria-label":p6(F),title:h6(F),children:["v",F.running]})})()]}),m.jsxs("span",{className:"status",children:[(()=>{const F=k6({connected:Ie,paused:Cr,held:Bt.size,dropped:Bt.dropped});return m.jsx("span",{className:`pill ${F.tone}`,title:F.title,children:m.jsxs("span",{className:"pill-box",children:[m.jsx("span",{className:"pill-widest","aria-hidden":!0,children:F.widest}),m.jsx("span",{className:"pill-label",children:F.label})]})})})(),m.jsx(nq,{usageOpen:V}),Zt.sum>0&&m.jsxs("span",{className:"stat",title:`in:${Zt.inputTokens.toLocaleString()} out:${Zt.outputTokens.toLocaleString()} cache-r:${Zt.cacheReadTokens.toLocaleString()} cache-c:${Zt.cacheCreateTokens.toLocaleString()}
87
+ Click to set the volume and the sound of each tone, and to hear either one.`}function fT(e){const t=new Map;for(const r of e)for(const s of r.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const o=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};o.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,o.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,o)}return[...t.values()].sort((r,s)=>s.cost-r.cost||r.id.localeCompare(s.id))}function kD(e){const t=fT([{agents:e}]);return t.length<2?null:t.map(r=>`${d0(r.id)} ${Ge(r.cost)}`).join(" · ")}function S1(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function SD(e,t){if(!(t>0)||!(e>0))return"0%";const r=e/t*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function $u(e){const t=e.toLowerCase();return t.includes("opus")?"var(--usage-purple)":t.includes("sonnet")?"var(--usage-blue)":t.includes("haiku")?"var(--usage-green)":t.includes("gpt-5")||t.includes("gpt5")?"var(--usage-amber)":t.includes("gpt")?"var(--usage-red)":t.includes("gemini")?"var(--usage-indigo)":t.includes("codex")?"var(--usage-orange)":"var(--usage-zinc)"}const ED=[7,14,30,90];function ND(e){const[t,r]=N.useState(null),[s,o]=N.useState(!1),a=N.useState(mD)[0],u=N.useRef(!1),c=(f=!1)=>{if(f&&!js(u.current))return;const p=a.begin();u.current=f;const d=e;o(!0);const y=`/api/ccusage?since=${gD(d)}${f?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&r({range:d,resp:w})}).catch(()=>{p()&&r({range:d,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(u.current=!1,o(!1))})};return N.useEffect(()=>(c(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>c(!0)}}function CD({onClose:e,providers:t}){var U;const[r,s]=N.useState(30),[o,a]=N.useState(null),{landed:u,loading:c,reload:f}=ND(r),p=N.useRef(null),d=Kr(e,{focusRef:p}),g=vD({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((U=u.resp.days)==null?void 0:U.length)??0}}),y=g.phase==="chart"?u.resp.days??[]:[],w=N.useMemo(()=>y.reduce((O,M)=>Math.max(O,M.totalCost),0),[y]),S=N.useRef(null);N.useLayoutEffect(()=>{const O=S.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:_,totalTok:b,inOut:k,cacheRead:E,modelCosts:C}=N.useMemo(()=>{let O=0,M=0,q=0,V=0;const X=new Map;for(const j of y){O+=j.totalCost,M+=j.totalTokens,q+=j.inputTokens+j.outputTokens,V+=j.cacheReadTokens;for(const G of j.modelBreakdowns)X.set(G.modelName,(X.get(G.modelName)??0)+G.cost)}return{totalCost:O,totalTok:M,inOut:q,cacheRead:V,modelCosts:X}},[y]),T=N.useMemo(()=>Array.from(C.entries()).sort((O,M)=>M[1]-O[1]),[C]),A=N.useMemo(()=>fT(y),[y]),L=A.length>1,P=o?y.find(O=>O.period===o)??null:null;return m.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:m.jsxs("div",{ref:d,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[m.jsxs("header",{className:"uh-head",children:[m.jsxs("div",{className:"uh-titlewrap",children:[m.jsx("div",{className:"uh-title",children:"Usage history"}),m.jsx("div",{className:"uh-sub",children:xD(t,A.map(O=>O.id))})]}),m.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:ED.map(O=>m.jsxs("button",{type:"button","aria-pressed":r===O,className:"uh-range-btn",onClick:()=>{s(O),a(null)},children:[O,"d"]},O))}),m.jsx("button",{className:"glyph-btn uh-reload",onClick:f,...Wr(c),title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),m.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?m.jsx("div",{className:"uh-status","aria-busy":"true",children:u?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?m.jsxs("div",{className:"uh-status uh-err",title:xo(u.resp)||void 0,children:[Eq(u.resp,"ccusage did not report usage"),m.jsx("div",{children:m.jsx("button",{className:"btn uh-retry",onClick:f,...Wr(c),children:c?"trying…":"Try again"})})]}):g.phase==="empty"?m.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):m.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[m.jsxs("div",{className:"uh-totals",children:[m.jsx(qu,{label:"total cost",val:Ge(_),accent:!0}),m.jsx(qu,{label:"tokens",val:At(b)}),m.jsx(qu,{label:"input+output",val:At(k)}),m.jsx(qu,{label:"cache reads",val:At(E)})]}),L&&m.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[m.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:A.map(O=>m.jsx("span",{className:"uh-agent-seg",style:{width:`${_>0?O.cost/_*100:0}%`,background:S1(O.id)}},O.id))}),m.jsx("div",{className:"uh-agent-keys",children:A.map(O=>m.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${At(O.tokens)} tokens`,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:S1(O.id)}}),d0(O.id),m.jsx("span",{className:"uh-agent-cost",children:Ge(O.cost)}),m.jsx("span",{className:"uh-agent-share",children:SD(O.cost,_)})]},O.id))})]}),m.jsx("div",{ref:S,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(O=>{const M=w>0?O.totalCost/w*100:0,q=O.period===o,V=`${O.period}, ${Ge(O.totalCost)}`;return m.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:O.period),"aria-pressed":q,"aria-label":V,title:`${O.period} · ${Ge(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[m.jsx("div",{className:"uh-bar",style:{height:`${Math.max(M,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((X,j)=>j.cost-X.cost).map(X=>{const j=O.totalCost>0?X.cost/O.totalCost*100:0;return m.jsx("div",{className:"uh-bar-seg",style:{height:`${j}%`,background:$u(X.modelName)}},X.modelName)})}),m.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),m.jsx("div",{className:"uh-legend",children:T.map(([O,M])=>m.jsxs("span",{className:"uh-legend-item",title:O,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:$u(O)}}),li(O)," ",m.jsx("span",{className:"uh-legend-cost",children:Ge(M)})]},O))}),P&&m.jsxs("div",{className:"uh-detail",children:[m.jsxs("div",{className:"uh-detail-head",children:[m.jsx("span",{className:"uh-detail-date",children:P.period}),m.jsx("span",{className:"uh-detail-cost",children:Ge(P.totalCost)}),(()=>{var q,V;const M=kD(P.agents)??((V=(q=P.metadata)==null?void 0:q.agents)!=null&&V.length?P.metadata.agents.join(" · "):null);return M?m.jsx("span",{className:"uh-detail-agents",title:M,children:M}):null})()]}),m.jsxs("div",{className:"uh-detail-mini",children:[m.jsx(Du,{label:"input",val:At(P.inputTokens)}),m.jsx(Du,{label:"output",val:At(P.outputTokens)}),m.jsx(Du,{label:"cache write",val:At(P.cacheCreationTokens)}),m.jsx(Du,{label:"cache read",val:At(P.cacheReadTokens)})]}),m.jsx("div",{className:"uh-detail-models",children:P.modelBreakdowns.slice().sort((O,M)=>M.cost-O.cost).map(O=>{const M=P.totalCost>0?O.cost/P.totalCost*100:0;return m.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[m.jsxs("span",{className:"uh-model-name",children:[m.jsx("span",{className:"uh-legend-dot",style:{background:$u(O.modelName)}}),m.jsx("span",{className:"uh-model-label",children:li(O.modelName)})]}),m.jsx("span",{className:"uh-model-bar",children:m.jsx("span",{className:"uh-model-bar-fill",style:{width:`${M}%`,background:$u(O.modelName)}})}),m.jsx("span",{className:"uh-model-cost",children:Ge(O.cost)})]},O.modelName)})})]})]})]})})}function qu({label:e,val:t,accent:r}){return m.jsxs("div",{className:"uh-stat",children:[m.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:t}),m.jsx("span",{className:"uh-stat-label",children:e})]})}function Du({label:e,val:t}){return m.jsxs("div",{className:"uh-ministat",children:[m.jsx("span",{className:"uh-ministat-val",children:t}),m.jsx("span",{className:"uh-ministat-label",children:e})]})}function f0(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Of,E1;function jD(){if(E1)return Of;E1=1;function e(){this.__data__=[],this.size=0}return Of=e,Of}var Pf,N1;function No(){if(N1)return Pf;N1=1;function e(t,r){return t===r||t!==t&&r!==r}return Pf=e,Pf}var Lf,C1;function wc(){if(C1)return Lf;C1=1;var e=No();function t(r,s){for(var o=r.length;o--;)if(e(r[o][0],s))return o;return-1}return Lf=t,Lf}var $f,j1;function TD(){if(j1)return $f;j1=1;var e=wc(),t=Array.prototype,r=t.splice;function s(o){var a=this.__data__,u=e(a,o);if(u<0)return!1;var c=a.length-1;return u==c?a.pop():r.call(a,u,1),--this.size,!0}return $f=s,$f}var qf,T1;function RD(){if(T1)return qf;T1=1;var e=wc();function t(r){var s=this.__data__,o=e(s,r);return o<0?void 0:s[o][1]}return qf=t,qf}var Df,R1;function AD(){if(R1)return Df;R1=1;var e=wc();function t(r){return e(this.__data__,r)>-1}return Df=t,Df}var Ff,A1;function ID(){if(A1)return Ff;A1=1;var e=wc();function t(r,s){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,s])):o[a][1]=s,this}return Ff=t,Ff}var zf,I1;function xc(){if(I1)return zf;I1=1;var e=jD(),t=TD(),r=RD(),s=AD(),o=ID();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=s,a.prototype.set=o,zf=a,zf}var Bf,M1;function MD(){if(M1)return Bf;M1=1;var e=xc();function t(){this.__data__=new e,this.size=0}return Bf=t,Bf}var Uf,O1;function OD(){if(O1)return Uf;O1=1;function e(t){var r=this.__data__,s=r.delete(t);return this.size=r.size,s}return Uf=e,Uf}var Hf,P1;function PD(){if(P1)return Hf;P1=1;function e(t){return this.__data__.get(t)}return Hf=e,Hf}var Wf,L1;function LD(){if(L1)return Wf;L1=1;function e(t){return this.__data__.has(t)}return Wf=e,Wf}var Vf,$1;function hT(){if($1)return Vf;$1=1;var e=typeof _u=="object"&&_u&&_u.Object===Object&&_u;return Vf=e,Vf}var Gf,q1;function ar(){if(q1)return Gf;q1=1;var e=hT(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Gf=r,Gf}var Yf,D1;function Co(){if(D1)return Yf;D1=1;var e=ar(),t=e.Symbol;return Yf=t,Yf}var Kf,F1;function $D(){if(F1)return Kf;F1=1;var e=Co(),t=Object.prototype,r=t.hasOwnProperty,s=t.toString,o=e?e.toStringTag:void 0;function a(u){var c=r.call(u,o),f=u[o];try{u[o]=void 0;var p=!0}catch{}var d=s.call(u);return p&&(c?u[o]=f:delete u[o]),d}return Kf=a,Kf}var Xf,z1;function qD(){if(z1)return Xf;z1=1;var e=Object.prototype,t=e.toString;function r(s){return t.call(s)}return Xf=r,Xf}var Qf,B1;function ui(){if(B1)return Qf;B1=1;var e=Co(),t=$D(),r=qD(),s="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:s:a&&a in Object(c)?t(c):r(c)}return Qf=u,Qf}var Zf,U1;function Dn(){if(U1)return Zf;U1=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Zf=e,Zf}var Jf,H1;function sl(){if(H1)return Jf;H1=1;var e=ui(),t=Dn(),r="[object AsyncFunction]",s="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==s||f==o||f==r||f==a}return Jf=u,Jf}var eh,W1;function DD(){if(W1)return eh;W1=1;var e=ar(),t=e["__core-js_shared__"];return eh=t,eh}var th,V1;function FD(){if(V1)return th;V1=1;var e=DD(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function r(s){return!!t&&t in s}return th=r,th}var nh,G1;function pT(){if(G1)return nh;G1=1;var e=Function.prototype,t=e.toString;function r(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return nh=r,nh}var rh,Y1;function zD(){if(Y1)return rh;Y1=1;var e=sl(),t=FD(),r=Dn(),s=pT(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,p=c.hasOwnProperty,d=RegExp("^"+f.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!r(y)||t(y))return!1;var w=e(y)?d:a;return w.test(s(y))}return rh=g,rh}var sh,K1;function BD(){if(K1)return sh;K1=1;function e(t,r){return t==null?void 0:t[r]}return sh=e,sh}var ih,X1;function ci(){if(X1)return ih;X1=1;var e=zD(),t=BD();function r(s,o){var a=t(s,o);return e(a)?a:void 0}return ih=r,ih}var oh,Q1;function h0(){if(Q1)return oh;Q1=1;var e=ci(),t=ar(),r=e(t,"Map");return oh=r,oh}var ah,Z1;function _c(){if(Z1)return ah;Z1=1;var e=ci(),t=e(Object,"create");return ah=t,ah}var lh,J1;function UD(){if(J1)return lh;J1=1;var e=_c();function t(){this.__data__=e?e(null):{},this.size=0}return lh=t,lh}var uh,eb;function HD(){if(eb)return uh;eb=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return uh=e,uh}var ch,tb;function WD(){if(tb)return ch;tb=1;var e=_c(),t="__lodash_hash_undefined__",r=Object.prototype,s=r.hasOwnProperty;function o(a){var u=this.__data__;if(e){var c=u[a];return c===t?void 0:c}return s.call(u,a)?u[a]:void 0}return ch=o,ch}var dh,nb;function VD(){if(nb)return dh;nb=1;var e=_c(),t=Object.prototype,r=t.hasOwnProperty;function s(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return dh=s,dh}var fh,rb;function GD(){if(rb)return fh;rb=1;var e=_c(),t="__lodash_hash_undefined__";function r(s,o){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&o===void 0?t:o,this}return fh=r,fh}var hh,sb;function YD(){if(sb)return hh;sb=1;var e=UD(),t=HD(),r=WD(),s=VD(),o=GD();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=s,a.prototype.set=o,hh=a,hh}var ph,ib;function KD(){if(ib)return ph;ib=1;var e=YD(),t=xc(),r=h0();function s(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return ph=s,ph}var mh,ob;function XD(){if(ob)return mh;ob=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return mh=e,mh}var gh,ab;function bc(){if(ab)return gh;ab=1;var e=XD();function t(r,s){var o=r.__data__;return e(s)?o[typeof s=="string"?"string":"hash"]:o.map}return gh=t,gh}var vh,lb;function QD(){if(lb)return vh;lb=1;var e=bc();function t(r){var s=e(this,r).delete(r);return this.size-=s?1:0,s}return vh=t,vh}var yh,ub;function ZD(){if(ub)return yh;ub=1;var e=bc();function t(r){return e(this,r).get(r)}return yh=t,yh}var wh,cb;function JD(){if(cb)return wh;cb=1;var e=bc();function t(r){return e(this,r).has(r)}return wh=t,wh}var xh,db;function e5(){if(db)return xh;db=1;var e=bc();function t(r,s){var o=e(this,r),a=o.size;return o.set(r,s),this.size+=o.size==a?0:1,this}return xh=t,xh}var _h,fb;function p0(){if(fb)return _h;fb=1;var e=KD(),t=QD(),r=ZD(),s=JD(),o=e5();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=s,a.prototype.set=o,_h=a,_h}var bh,hb;function t5(){if(hb)return bh;hb=1;var e=xc(),t=h0(),r=p0(),s=200;function o(a,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!t||f.length<s-1)return f.push([a,u]),this.size=++c.size,this;c=this.__data__=new r(f)}return c.set(a,u),this.size=c.size,this}return bh=o,bh}var kh,pb;function kc(){if(pb)return kh;pb=1;var e=xc(),t=MD(),r=OD(),s=PD(),o=LD(),a=t5();function u(c){var f=this.__data__=new e(c);this.size=f.size}return u.prototype.clear=t,u.prototype.delete=r,u.prototype.get=s,u.prototype.has=o,u.prototype.set=a,kh=u,kh}var Sh,mb;function m0(){if(mb)return Sh;mb=1;function e(t,r){for(var s=-1,o=t==null?0:t.length;++s<o&&r(t[s],s,t)!==!1;);return t}return Sh=e,Sh}var Eh,gb;function mT(){if(gb)return Eh;gb=1;var e=ci(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Eh=t,Eh}var Nh,vb;function Sc(){if(vb)return Nh;vb=1;var e=mT();function t(r,s,o){s=="__proto__"&&e?e(r,s,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[s]=o}return Nh=t,Nh}var Ch,yb;function Ec(){if(yb)return Ch;yb=1;var e=Sc(),t=No(),r=Object.prototype,s=r.hasOwnProperty;function o(a,u,c){var f=a[u];(!(s.call(a,u)&&t(f,c))||c===void 0&&!(u in a))&&e(a,u,c)}return Ch=o,Ch}var jh,wb;function il(){if(wb)return jh;wb=1;var e=Ec(),t=Sc();function r(s,o,a,u){var c=!a;a||(a={});for(var f=-1,p=o.length;++f<p;){var d=o[f],g=u?u(a[d],s[d],d,a,s):void 0;g===void 0&&(g=s[d]),c?t(a,d,g):e(a,d,g)}return a}return jh=r,jh}var Th,xb;function n5(){if(xb)return Th;xb=1;function e(t,r){for(var s=-1,o=Array(t);++s<t;)o[s]=r(s);return o}return Th=e,Th}var Rh,_b;function kr(){if(_b)return Rh;_b=1;function e(t){return t!=null&&typeof t=="object"}return Rh=e,Rh}var Ah,bb;function r5(){if(bb)return Ah;bb=1;var e=ui(),t=kr(),r="[object Arguments]";function s(o){return t(o)&&e(o)==r}return Ah=s,Ah}var Ih,kb;function ol(){if(kb)return Ih;kb=1;var e=r5(),t=kr(),r=Object.prototype,s=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(u){return t(u)&&s.call(u,"callee")&&!o.call(u,"callee")};return Ih=a,Ih}var Mh,Sb;function Ct(){if(Sb)return Mh;Sb=1;var e=Array.isArray;return Mh=e,Mh}var Ia={exports:{}},Oh,Eb;function s5(){if(Eb)return Oh;Eb=1;function e(){return!1}return Oh=e,Oh}Ia.exports;var Nb;function jo(){return Nb||(Nb=1,(function(e,t){var r=ar(),s=s5(),o=t&&!t.nodeType&&t,a=o&&!0&&e&&!e.nodeType&&e,u=a&&a.exports===o,c=u?r.Buffer:void 0,f=c?c.isBuffer:void 0,p=f||s;e.exports=p})(Ia,Ia.exports)),Ia.exports}var Ph,Cb;function Nc(){if(Cb)return Ph;Cb=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(s,o){var a=typeof s;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<o}return Ph=r,Ph}var Lh,jb;function g0(){if(jb)return Lh;jb=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Lh=t,Lh}var $h,Tb;function i5(){if(Tb)return $h;Tb=1;var e=ui(),t=g0(),r=kr(),s="[object Arguments]",o="[object Array]",a="[object Boolean]",u="[object Date]",c="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",S="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",k="[object DataView]",E="[object Float32Array]",C="[object Float64Array]",T="[object Int8Array]",A="[object Int16Array]",L="[object Int32Array]",P="[object Uint8Array]",U="[object Uint8ClampedArray]",O="[object Uint16Array]",M="[object Uint32Array]",q={};q[E]=q[C]=q[T]=q[A]=q[L]=q[P]=q[U]=q[O]=q[M]=!0,q[s]=q[o]=q[b]=q[a]=q[k]=q[u]=q[c]=q[f]=q[p]=q[d]=q[g]=q[y]=q[w]=q[S]=q[_]=!1;function V(X){return r(X)&&t(X.length)&&!!q[e(X)]}return $h=V,$h}var qh,Rb;function Cc(){if(Rb)return qh;Rb=1;function e(t){return function(r){return t(r)}}return qh=e,qh}var Ma={exports:{}};Ma.exports;var Ab;function v0(){return Ab||(Ab=1,(function(e,t){var r=hT(),s=t&&!t.nodeType&&t,o=s&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===s,u=a&&r.process,c=(function(){try{var f=o&&o.require&&o.require("util").types;return f||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(Ma,Ma.exports)),Ma.exports}var Dh,Ib;function al(){if(Ib)return Dh;Ib=1;var e=i5(),t=Cc(),r=v0(),s=r&&r.isTypedArray,o=s?t(s):e;return Dh=o,Dh}var Fh,Mb;function gT(){if(Mb)return Fh;Mb=1;var e=n5(),t=ol(),r=Ct(),s=jo(),o=Nc(),a=al(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var g=r(p),y=!g&&t(p),w=!g&&!y&&s(p),S=!g&&!y&&!w&&a(p),_=g||y||w||S,b=_?e(p.length,String):[],k=b.length;for(var E in p)(d||c.call(p,E))&&!(_&&(E=="length"||w&&(E=="offset"||E=="parent")||S&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||o(E,k)))&&b.push(E);return b}return Fh=f,Fh}var zh,Ob;function jc(){if(Ob)return zh;Ob=1;var e=Object.prototype;function t(r){var s=r&&r.constructor,o=typeof s=="function"&&s.prototype||e;return r===o}return zh=t,zh}var Bh,Pb;function vT(){if(Pb)return Bh;Pb=1;function e(t,r){return function(s){return t(r(s))}}return Bh=e,Bh}var Uh,Lb;function o5(){if(Lb)return Uh;Lb=1;var e=vT(),t=e(Object.keys,Object);return Uh=t,Uh}var Hh,$b;function y0(){if($b)return Hh;$b=1;var e=jc(),t=o5(),r=Object.prototype,s=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var u=[];for(var c in Object(a))s.call(a,c)&&c!="constructor"&&u.push(c);return u}return Hh=o,Hh}var Wh,qb;function Xr(){if(qb)return Wh;qb=1;var e=sl(),t=g0();function r(s){return s!=null&&t(s.length)&&!e(s)}return Wh=r,Wh}var Vh,Db;function Ts(){if(Db)return Vh;Db=1;var e=gT(),t=y0(),r=Xr();function s(o){return r(o)?e(o):t(o)}return Vh=s,Vh}var Gh,Fb;function a5(){if(Fb)return Gh;Fb=1;var e=il(),t=Ts();function r(s,o){return s&&e(o,t(o),s)}return Gh=r,Gh}var Yh,zb;function l5(){if(zb)return Yh;zb=1;function e(t){var r=[];if(t!=null)for(var s in Object(t))r.push(s);return r}return Yh=e,Yh}var Kh,Bb;function u5(){if(Bb)return Kh;Bb=1;var e=Dn(),t=jc(),r=l5(),s=Object.prototype,o=s.hasOwnProperty;function a(u){if(!e(u))return r(u);var c=t(u),f=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||f.push(p);return f}return Kh=a,Kh}var Xh,Ub;function di(){if(Ub)return Xh;Ub=1;var e=gT(),t=u5(),r=Xr();function s(o){return r(o)?e(o,!0):t(o)}return Xh=s,Xh}var Qh,Hb;function c5(){if(Hb)return Qh;Hb=1;var e=il(),t=di();function r(s,o){return s&&e(o,t(o),s)}return Qh=r,Qh}var Oa={exports:{}};Oa.exports;var Wb;function yT(){return Wb||(Wb=1,(function(e,t){var r=ar(),s=t&&!t.nodeType&&t,o=s&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===s,u=a?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function f(p,d){if(d)return p.slice();var g=p.length,y=c?c(g):new p.constructor(g);return p.copy(y),y}e.exports=f})(Oa,Oa.exports)),Oa.exports}var Zh,Vb;function wT(){if(Vb)return Zh;Vb=1;function e(t,r){var s=-1,o=t.length;for(r||(r=Array(o));++s<o;)r[s]=t[s];return r}return Zh=e,Zh}var Jh,Gb;function xT(){if(Gb)return Jh;Gb=1;function e(t,r){for(var s=-1,o=t==null?0:t.length,a=0,u=[];++s<o;){var c=t[s];r(c,s,t)&&(u[a++]=c)}return u}return Jh=e,Jh}var ep,Yb;function _T(){if(Yb)return ep;Yb=1;function e(){return[]}return ep=e,ep}var tp,Kb;function w0(){if(Kb)return tp;Kb=1;var e=xT(),t=_T(),r=Object.prototype,s=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return s.call(u,c)}))}:t;return tp=a,tp}var np,Xb;function d5(){if(Xb)return np;Xb=1;var e=il(),t=w0();function r(s,o){return e(s,t(s),o)}return np=r,np}var rp,Qb;function x0(){if(Qb)return rp;Qb=1;function e(t,r){for(var s=-1,o=r.length,a=t.length;++s<o;)t[a+s]=r[s];return t}return rp=e,rp}var sp,Zb;function Tc(){if(Zb)return sp;Zb=1;var e=vT(),t=e(Object.getPrototypeOf,Object);return sp=t,sp}var ip,Jb;function bT(){if(Jb)return ip;Jb=1;var e=x0(),t=Tc(),r=w0(),s=_T(),o=Object.getOwnPropertySymbols,a=o?function(u){for(var c=[];u;)e(c,r(u)),u=t(u);return c}:s;return ip=a,ip}var op,ek;function f5(){if(ek)return op;ek=1;var e=il(),t=bT();function r(s,o){return e(s,t(s),o)}return op=r,op}var ap,tk;function kT(){if(tk)return ap;tk=1;var e=x0(),t=Ct();function r(s,o,a){var u=o(s);return t(s)?u:e(u,a(s))}return ap=r,ap}var lp,nk;function ST(){if(nk)return lp;nk=1;var e=kT(),t=w0(),r=Ts();function s(o){return e(o,r,t)}return lp=s,lp}var up,rk;function h5(){if(rk)return up;rk=1;var e=kT(),t=bT(),r=di();function s(o){return e(o,r,t)}return up=s,up}var cp,sk;function p5(){if(sk)return cp;sk=1;var e=ci(),t=ar(),r=e(t,"DataView");return cp=r,cp}var dp,ik;function m5(){if(ik)return dp;ik=1;var e=ci(),t=ar(),r=e(t,"Promise");return dp=r,dp}var fp,ok;function ET(){if(ok)return fp;ok=1;var e=ci(),t=ar(),r=e(t,"Set");return fp=r,fp}var hp,ak;function g5(){if(ak)return hp;ak=1;var e=ci(),t=ar(),r=e(t,"WeakMap");return hp=r,hp}var pp,lk;function To(){if(lk)return pp;lk=1;var e=p5(),t=h0(),r=m5(),s=ET(),o=g5(),a=ui(),u=pT(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",g="[object WeakMap]",y="[object DataView]",w=u(e),S=u(t),_=u(r),b=u(s),k=u(o),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=y||t&&E(new t)!=c||r&&E(r.resolve())!=p||s&&E(new s)!=d||o&&E(new o)!=g)&&(E=function(C){var T=a(C),A=T==f?C.constructor:void 0,L=A?u(A):"";if(L)switch(L){case w:return y;case S:return c;case _:return p;case b:return d;case k:return g}return T}),pp=E,pp}var mp,uk;function v5(){if(uk)return mp;uk=1;var e=Object.prototype,t=e.hasOwnProperty;function r(s){var o=s.length,a=new s.constructor(o);return o&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return mp=r,mp}var gp,ck;function NT(){if(ck)return gp;ck=1;var e=ar(),t=e.Uint8Array;return gp=t,gp}var vp,dk;function _0(){if(dk)return vp;dk=1;var e=NT();function t(r){var s=new r.constructor(r.byteLength);return new e(s).set(new e(r)),s}return vp=t,vp}var yp,fk;function y5(){if(fk)return yp;fk=1;var e=_0();function t(r,s){var o=s?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return yp=t,yp}var wp,hk;function w5(){if(hk)return wp;hk=1;var e=/\w*$/;function t(r){var s=new r.constructor(r.source,e.exec(r));return s.lastIndex=r.lastIndex,s}return wp=t,wp}var xp,pk;function x5(){if(pk)return xp;pk=1;var e=Co(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function s(o){return r?Object(r.call(o)):{}}return xp=s,xp}var _p,mk;function CT(){if(mk)return _p;mk=1;var e=_0();function t(r,s){var o=s?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return _p=t,_p}var bp,gk;function _5(){if(gk)return bp;gk=1;var e=_0(),t=y5(),r=w5(),s=x5(),o=CT(),a="[object Boolean]",u="[object Date]",c="[object Map]",f="[object Number]",p="[object RegExp]",d="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",S="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",T="[object Uint8Array]",A="[object Uint8ClampedArray]",L="[object Uint16Array]",P="[object Uint32Array]";function U(O,M,q){var V=O.constructor;switch(M){case w:return e(O);case a:case u:return new V(+O);case S:return t(O,q);case _:case b:case k:case E:case C:case T:case A:case L:case P:return o(O,q);case c:return new V;case f:case g:return new V(O);case p:return r(O);case d:return new V;case y:return s(O)}}return bp=U,bp}var kp,vk;function jT(){if(vk)return kp;vk=1;var e=Dn(),t=Object.create,r=(function(){function s(){}return function(o){if(!e(o))return{};if(t)return t(o);s.prototype=o;var a=new s;return s.prototype=void 0,a}})();return kp=r,kp}var Sp,yk;function TT(){if(yk)return Sp;yk=1;var e=jT(),t=Tc(),r=jc();function s(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return Sp=s,Sp}var Ep,wk;function b5(){if(wk)return Ep;wk=1;var e=To(),t=kr(),r="[object Map]";function s(o){return t(o)&&e(o)==r}return Ep=s,Ep}var Np,xk;function k5(){if(xk)return Np;xk=1;var e=b5(),t=Cc(),r=v0(),s=r&&r.isMap,o=s?t(s):e;return Np=o,Np}var Cp,_k;function S5(){if(_k)return Cp;_k=1;var e=To(),t=kr(),r="[object Set]";function s(o){return t(o)&&e(o)==r}return Cp=s,Cp}var jp,bk;function E5(){if(bk)return jp;bk=1;var e=S5(),t=Cc(),r=v0(),s=r&&r.isSet,o=s?t(s):e;return jp=o,jp}var Tp,kk;function RT(){if(kk)return Tp;kk=1;var e=kc(),t=m0(),r=Ec(),s=a5(),o=c5(),a=yT(),u=wT(),c=d5(),f=f5(),p=ST(),d=h5(),g=To(),y=v5(),w=_5(),S=TT(),_=Ct(),b=jo(),k=k5(),E=Dn(),C=E5(),T=Ts(),A=di(),L=1,P=2,U=4,O="[object Arguments]",M="[object Array]",q="[object Boolean]",V="[object Date]",X="[object Error]",j="[object Function]",G="[object GeneratorFunction]",B="[object Map]",te="[object Number]",Z="[object Object]",$="[object RegExp]",H="[object Set]",I="[object String]",Y="[object Symbol]",ce="[object WeakMap]",z="[object ArrayBuffer]",Q="[object DataView]",ne="[object Float32Array]",ae="[object Float64Array]",fe="[object Int8Array]",pe="[object Int16Array]",ye="[object Int32Array]",Me="[object Uint8Array]",Ue="[object Uint8ClampedArray]",ze="[object Uint16Array]",Ie="[object Uint32Array]",ke={};ke[O]=ke[M]=ke[z]=ke[Q]=ke[q]=ke[V]=ke[ne]=ke[ae]=ke[fe]=ke[pe]=ke[ye]=ke[B]=ke[te]=ke[Z]=ke[$]=ke[H]=ke[I]=ke[Y]=ke[Me]=ke[Ue]=ke[ze]=ke[Ie]=!0,ke[X]=ke[j]=ke[ce]=!1;function le(we,xe,Ye,gt,ft,ot){var Be,et=xe&L,Xe=xe&P,wt=xe&U;if(Ye&&(Be=ft?Ye(we,gt,ft,ot):Ye(we)),Be!==void 0)return Be;if(!E(we))return we;var ee=_(we);if(ee){if(Be=y(we),!et)return u(we,Be)}else{var Le=g(we),De=Le==j||Le==G;if(b(we))return a(we,et);if(Le==Z||Le==O||De&&!ft){if(Be=Xe||De?{}:S(we),!et)return Xe?f(we,o(Be,we)):c(we,s(Be,we))}else{if(!ke[Le])return ft?we:{};Be=w(we,Le,et)}}ot||(ot=new e);var Re=ot.get(we);if(Re)return Re;ot.set(we,Be),C(we)?we.forEach(function(tt){Be.add(le(tt,xe,Ye,tt,we,ot))}):k(we)&&we.forEach(function(tt,Ce){Be.set(Ce,le(tt,xe,Ye,Ce,we,ot))});var $e=wt?Xe?d:p:Xe?A:T,rt=ee?void 0:$e(we);return t(rt||we,function(tt,Ce){rt&&(Ce=tt,tt=we[Ce]),r(Be,Ce,le(tt,xe,Ye,Ce,we,ot))}),Be}return Tp=le,Tp}var Rp,Sk;function N5(){if(Sk)return Rp;Sk=1;var e=RT(),t=4;function r(s){return e(s,t)}return Rp=r,Rp}var Ap,Ek;function b0(){if(Ek)return Ap;Ek=1;function e(t){return function(){return t}}return Ap=e,Ap}var Ip,Nk;function C5(){if(Nk)return Ip;Nk=1;function e(t){return function(r,s,o){for(var a=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[t?f:++a];if(s(u[p],p,u)===!1)break}return r}}return Ip=e,Ip}var Mp,Ck;function k0(){if(Ck)return Mp;Ck=1;var e=C5(),t=e();return Mp=t,Mp}var Op,jk;function S0(){if(jk)return Op;jk=1;var e=k0(),t=Ts();function r(s,o){return s&&e(s,o,t)}return Op=r,Op}var Pp,Tk;function j5(){if(Tk)return Pp;Tk=1;var e=Xr();function t(r,s){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var u=o.length,c=s?u:-1,f=Object(o);(s?c--:++c<u)&&a(f[c],c,f)!==!1;);return o}}return Pp=t,Pp}var Lp,Rk;function Rc(){if(Rk)return Lp;Rk=1;var e=S0(),t=j5(),r=t(e);return Lp=r,Lp}var $p,Ak;function fi(){if(Ak)return $p;Ak=1;function e(t){return t}return $p=e,$p}var qp,Ik;function AT(){if(Ik)return qp;Ik=1;var e=fi();function t(r){return typeof r=="function"?r:e}return qp=t,qp}var Dp,Mk;function IT(){if(Mk)return Dp;Mk=1;var e=m0(),t=Rc(),r=AT(),s=Ct();function o(a,u){var c=s(a)?e:t;return c(a,r(u))}return Dp=o,Dp}var Fp,Ok;function MT(){return Ok||(Ok=1,Fp=IT()),Fp}var zp,Pk;function T5(){if(Pk)return zp;Pk=1;var e=Rc();function t(r,s){var o=[];return e(r,function(a,u,c){s(a,u,c)&&o.push(a)}),o}return zp=t,zp}var Bp,Lk;function R5(){if(Lk)return Bp;Lk=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Bp=t,Bp}var Up,$k;function A5(){if($k)return Up;$k=1;function e(t){return this.__data__.has(t)}return Up=e,Up}var Hp,qk;function OT(){if(qk)return Hp;qk=1;var e=p0(),t=R5(),r=A5();function s(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new e;++a<u;)this.add(o[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=r,Hp=s,Hp}var Wp,Dk;function I5(){if(Dk)return Wp;Dk=1;function e(t,r){for(var s=-1,o=t==null?0:t.length;++s<o;)if(r(t[s],s,t))return!0;return!1}return Wp=e,Wp}var Vp,Fk;function PT(){if(Fk)return Vp;Fk=1;function e(t,r){return t.has(r)}return Vp=e,Vp}var Gp,zk;function LT(){if(zk)return Gp;zk=1;var e=OT(),t=I5(),r=PT(),s=1,o=2;function a(u,c,f,p,d,g){var y=f&s,w=u.length,S=c.length;if(w!=S&&!(y&&S>w))return!1;var _=g.get(u),b=g.get(c);if(_&&b)return _==c&&b==u;var k=-1,E=!0,C=f&o?new e:void 0;for(g.set(u,c),g.set(c,u);++k<w;){var T=u[k],A=c[k];if(p)var L=y?p(A,T,k,c,u,g):p(T,A,k,u,c,g);if(L!==void 0){if(L)continue;E=!1;break}if(C){if(!t(c,function(P,U){if(!r(C,U)&&(T===P||d(T,P,f,p,g)))return C.push(U)})){E=!1;break}}else if(!(T===A||d(T,A,f,p,g))){E=!1;break}}return g.delete(u),g.delete(c),E}return Gp=a,Gp}var Yp,Bk;function M5(){if(Bk)return Yp;Bk=1;function e(t){var r=-1,s=Array(t.size);return t.forEach(function(o,a){s[++r]=[a,o]}),s}return Yp=e,Yp}var Kp,Uk;function E0(){if(Uk)return Kp;Uk=1;function e(t){var r=-1,s=Array(t.size);return t.forEach(function(o){s[++r]=o}),s}return Kp=e,Kp}var Xp,Hk;function O5(){if(Hk)return Xp;Hk=1;var e=Co(),t=NT(),r=No(),s=LT(),o=M5(),a=E0(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",S="[object Set]",_="[object String]",b="[object Symbol]",k="[object ArrayBuffer]",E="[object DataView]",C=e?e.prototype:void 0,T=C?C.valueOf:void 0;function A(L,P,U,O,M,q,V){switch(U){case E:if(L.byteLength!=P.byteLength||L.byteOffset!=P.byteOffset)return!1;L=L.buffer,P=P.buffer;case k:return!(L.byteLength!=P.byteLength||!q(new t(L),new t(P)));case f:case p:case y:return r(+L,+P);case d:return L.name==P.name&&L.message==P.message;case w:case _:return L==P+"";case g:var X=o;case S:var j=O&u;if(X||(X=a),L.size!=P.size&&!j)return!1;var G=V.get(L);if(G)return G==P;O|=c,V.set(L,P);var B=s(X(L),X(P),O,M,q,V);return V.delete(L),B;case b:if(T)return T.call(L)==T.call(P)}return!1}return Xp=A,Xp}var Qp,Wk;function P5(){if(Wk)return Qp;Wk=1;var e=ST(),t=1,r=Object.prototype,s=r.hasOwnProperty;function o(a,u,c,f,p,d){var g=c&t,y=e(a),w=y.length,S=e(u),_=S.length;if(w!=_&&!g)return!1;for(var b=w;b--;){var k=y[b];if(!(g?k in u:s.call(u,k)))return!1}var E=d.get(a),C=d.get(u);if(E&&C)return E==u&&C==a;var T=!0;d.set(a,u),d.set(u,a);for(var A=g;++b<w;){k=y[b];var L=a[k],P=u[k];if(f)var U=g?f(P,L,k,u,a,d):f(L,P,k,a,u,d);if(!(U===void 0?L===P||p(L,P,c,f,d):U)){T=!1;break}A||(A=k=="constructor")}if(T&&!A){var O=a.constructor,M=u.constructor;O!=M&&"constructor"in a&&"constructor"in u&&!(typeof O=="function"&&O instanceof O&&typeof M=="function"&&M instanceof M)&&(T=!1)}return d.delete(a),d.delete(u),T}return Qp=o,Qp}var Zp,Vk;function L5(){if(Vk)return Zp;Vk=1;var e=kc(),t=LT(),r=O5(),s=P5(),o=To(),a=Ct(),u=jo(),c=al(),f=1,p="[object Arguments]",d="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function S(_,b,k,E,C,T){var A=a(_),L=a(b),P=A?d:o(_),U=L?d:o(b);P=P==p?g:P,U=U==p?g:U;var O=P==g,M=U==g,q=P==U;if(q&&u(_)){if(!u(b))return!1;A=!0,O=!1}if(q&&!O)return T||(T=new e),A||c(_)?t(_,b,k,E,C,T):r(_,b,P,k,E,C,T);if(!(k&f)){var V=O&&w.call(_,"__wrapped__"),X=M&&w.call(b,"__wrapped__");if(V||X){var j=V?_.value():_,G=X?b.value():b;return T||(T=new e),C(j,G,k,E,T)}}return q?(T||(T=new e),s(_,b,k,E,C,T)):!1}return Zp=S,Zp}var Jp,Gk;function $T(){if(Gk)return Jp;Gk=1;var e=L5(),t=kr();function r(s,o,a,u,c){return s===o?!0:s==null||o==null||!t(s)&&!t(o)?s!==s&&o!==o:e(s,o,a,u,r,c)}return Jp=r,Jp}var em,Yk;function $5(){if(Yk)return em;Yk=1;var e=kc(),t=$T(),r=1,s=2;function o(a,u,c,f){var p=c.length,d=p,g=!f;if(a==null)return!d;for(a=Object(a);p--;){var y=c[p];if(g&&y[2]?y[1]!==a[y[0]]:!(y[0]in a))return!1}for(;++p<d;){y=c[p];var w=y[0],S=a[w],_=y[1];if(g&&y[2]){if(S===void 0&&!(w in a))return!1}else{var b=new e;if(f)var k=f(S,_,w,a,u,b);if(!(k===void 0?t(_,S,r|s,f,b):k))return!1}}return!0}return em=o,em}var tm,Kk;function qT(){if(Kk)return tm;Kk=1;var e=Dn();function t(r){return r===r&&!e(r)}return tm=t,tm}var nm,Xk;function q5(){if(Xk)return nm;Xk=1;var e=qT(),t=Ts();function r(s){for(var o=t(s),a=o.length;a--;){var u=o[a],c=s[u];o[a]=[u,c,e(c)]}return o}return nm=r,nm}var rm,Qk;function DT(){if(Qk)return rm;Qk=1;function e(t,r){return function(s){return s==null?!1:s[t]===r&&(r!==void 0||t in Object(s))}}return rm=e,rm}var sm,Zk;function D5(){if(Zk)return sm;Zk=1;var e=$5(),t=q5(),r=DT();function s(o){var a=t(o);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(u){return u===o||e(u,o,a)}}return sm=s,sm}var im,Jk;function Ro(){if(Jk)return im;Jk=1;var e=ui(),t=kr(),r="[object Symbol]";function s(o){return typeof o=="symbol"||t(o)&&e(o)==r}return im=s,im}var om,eS;function N0(){if(eS)return om;eS=1;var e=Ct(),t=Ro(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function o(a,u){if(e(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||t(a)?!0:s.test(a)||!r.test(a)||u!=null&&a in Object(u)}return om=o,om}var am,tS;function F5(){if(tS)return am;tS=1;var e=p0(),t="Expected a function";function r(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var u=arguments,c=o?o.apply(this,u):u[0],f=a.cache;if(f.has(c))return f.get(c);var p=s.apply(this,u);return a.cache=f.set(c,p)||f,p};return a.cache=new(r.Cache||e),a}return r.Cache=e,am=r,am}var lm,nS;function z5(){if(nS)return lm;nS=1;var e=F5(),t=500;function r(s){var o=e(s,function(u){return a.size===t&&a.clear(),u}),a=o.cache;return o}return lm=r,lm}var um,rS;function B5(){if(rS)return um;rS=1;var e=z5(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,s=e(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(t,function(u,c,f,p){a.push(f?p.replace(r,"$1"):c||u)}),a});return um=s,um}var cm,sS;function Ac(){if(sS)return cm;sS=1;function e(t,r){for(var s=-1,o=t==null?0:t.length,a=Array(o);++s<o;)a[s]=r(t[s],s,t);return a}return cm=e,cm}var dm,iS;function U5(){if(iS)return dm;iS=1;var e=Co(),t=Ac(),r=Ct(),s=Ro(),o=e?e.prototype:void 0,a=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return t(c,u)+"";if(s(c))return a?a.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return dm=u,dm}var fm,oS;function FT(){if(oS)return fm;oS=1;var e=U5();function t(r){return r==null?"":e(r)}return fm=t,fm}var hm,aS;function Ic(){if(aS)return hm;aS=1;var e=Ct(),t=N0(),r=B5(),s=FT();function o(a,u){return e(a)?a:t(a,u)?[a]:r(s(a))}return hm=o,hm}var pm,lS;function ll(){if(lS)return pm;lS=1;var e=Ro();function t(r){if(typeof r=="string"||e(r))return r;var s=r+"";return s=="0"&&1/r==-1/0?"-0":s}return pm=t,pm}var mm,uS;function Mc(){if(uS)return mm;uS=1;var e=Ic(),t=ll();function r(s,o){o=e(o,s);for(var a=0,u=o.length;s!=null&&a<u;)s=s[t(o[a++])];return a&&a==u?s:void 0}return mm=r,mm}var gm,cS;function H5(){if(cS)return gm;cS=1;var e=Mc();function t(r,s,o){var a=r==null?void 0:e(r,s);return a===void 0?o:a}return gm=t,gm}var vm,dS;function W5(){if(dS)return vm;dS=1;function e(t,r){return t!=null&&r in Object(t)}return vm=e,vm}var ym,fS;function zT(){if(fS)return ym;fS=1;var e=Ic(),t=ol(),r=Ct(),s=Nc(),o=g0(),a=ll();function u(c,f,p){f=e(f,c);for(var d=-1,g=f.length,y=!1;++d<g;){var w=a(f[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=g?y:(g=c==null?0:c.length,!!g&&o(g)&&s(w,g)&&(r(c)||t(c)))}return ym=u,ym}var wm,hS;function BT(){if(hS)return wm;hS=1;var e=W5(),t=zT();function r(s,o){return s!=null&&t(s,o,e)}return wm=r,wm}var xm,pS;function V5(){if(pS)return xm;pS=1;var e=$T(),t=H5(),r=BT(),s=N0(),o=qT(),a=DT(),u=ll(),c=1,f=2;function p(d,g){return s(d)&&o(g)?a(u(d),g):function(y){var w=t(y,d);return w===void 0&&w===g?r(y,d):e(g,w,c|f)}}return xm=p,xm}var _m,mS;function UT(){if(mS)return _m;mS=1;function e(t){return function(r){return r==null?void 0:r[t]}}return _m=e,_m}var bm,gS;function G5(){if(gS)return bm;gS=1;var e=Mc();function t(r){return function(s){return e(s,r)}}return bm=t,bm}var km,vS;function Y5(){if(vS)return km;vS=1;var e=UT(),t=G5(),r=N0(),s=ll();function o(a){return r(a)?e(s(a)):t(a)}return km=o,km}var Sm,yS;function Qr(){if(yS)return Sm;yS=1;var e=D5(),t=V5(),r=fi(),s=Ct(),o=Y5();function a(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?s(u)?t(u[0],u[1]):e(u):o(u)}return Sm=a,Sm}var Em,wS;function HT(){if(wS)return Em;wS=1;var e=xT(),t=T5(),r=Qr(),s=Ct();function o(a,u){var c=s(a)?e:t;return c(a,r(u,3))}return Em=o,Em}var Nm,xS;function K5(){if(xS)return Nm;xS=1;var e=Object.prototype,t=e.hasOwnProperty;function r(s,o){return s!=null&&t.call(s,o)}return Nm=r,Nm}var Cm,_S;function WT(){if(_S)return Cm;_S=1;var e=K5(),t=zT();function r(s,o){return s!=null&&t(s,o,e)}return Cm=r,Cm}var jm,bS;function X5(){if(bS)return jm;bS=1;var e=y0(),t=To(),r=ol(),s=Ct(),o=Xr(),a=jo(),u=jc(),c=al(),f="[object Map]",p="[object Set]",d=Object.prototype,g=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||c(w)||r(w)))return!w.length;var S=t(w);if(S==f||S==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(g.call(w,_))return!1;return!0}return jm=y,jm}var Tm,kS;function VT(){if(kS)return Tm;kS=1;function e(t){return t===void 0}return Tm=e,Tm}var Rm,SS;function GT(){if(SS)return Rm;SS=1;var e=Rc(),t=Xr();function r(s,o){var a=-1,u=t(s)?Array(s.length):[];return e(s,function(c,f,p){u[++a]=o(c,f,p)}),u}return Rm=r,Rm}var Am,ES;function YT(){if(ES)return Am;ES=1;var e=Ac(),t=Qr(),r=GT(),s=Ct();function o(a,u){var c=s(a)?e:r;return c(a,t(u,3))}return Am=o,Am}var Im,NS;function Q5(){if(NS)return Im;NS=1;function e(t,r,s,o){var a=-1,u=t==null?0:t.length;for(o&&u&&(s=t[++a]);++a<u;)s=r(s,t[a],a,t);return s}return Im=e,Im}var Mm,CS;function Z5(){if(CS)return Mm;CS=1;function e(t,r,s,o,a){return a(t,function(u,c,f){s=o?(o=!1,u):r(s,u,c,f)}),s}return Mm=e,Mm}var Om,jS;function KT(){if(jS)return Om;jS=1;var e=Q5(),t=Rc(),r=Qr(),s=Z5(),o=Ct();function a(u,c,f){var p=o(u)?e:s,d=arguments.length<3;return p(u,r(c,4),f,d,t)}return Om=a,Om}var Pm,TS;function J5(){if(TS)return Pm;TS=1;var e=ui(),t=Ct(),r=kr(),s="[object String]";function o(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==s}return Pm=o,Pm}var Lm,RS;function eF(){if(RS)return Lm;RS=1;var e=UT(),t=e("length");return Lm=t,Lm}var $m,AS;function tF(){if(AS)return $m;AS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",o=t+r+s,a="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+a+"]");function f(p){return c.test(p)}return $m=f,$m}var qm,IS;function nF(){if(IS)return qm;IS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",o=t+r+s,a="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+f+")",d="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",S=p+"?",_="["+a+"]?",b="(?:"+w+"(?:"+[d,g,y].join("|")+")"+_+S+")*",k=_+S+b,E="(?:"+[d+c+"?",c,g,y,u].join("|")+")",C=RegExp(f+"(?="+f+")|"+E+k,"g");function T(A){for(var L=C.lastIndex=0;C.test(A);)++L;return L}return qm=T,qm}var Dm,MS;function rF(){if(MS)return Dm;MS=1;var e=eF(),t=tF(),r=nF();function s(o){return t(o)?r(o):e(o)}return Dm=s,Dm}var Fm,OS;function sF(){if(OS)return Fm;OS=1;var e=y0(),t=To(),r=Xr(),s=J5(),o=rF(),a="[object Map]",u="[object Set]";function c(f){if(f==null)return 0;if(r(f))return s(f)?o(f):f.length;var p=t(f);return p==a||p==u?f.size:e(f).length}return Fm=c,Fm}var zm,PS;function iF(){if(PS)return zm;PS=1;var e=m0(),t=jT(),r=S0(),s=Qr(),o=Tc(),a=Ct(),u=jo(),c=sl(),f=Dn(),p=al();function d(g,y,w){var S=a(g),_=S||u(g)||p(g);if(y=s(y,4),w==null){var b=g&&g.constructor;_?w=S?new b:[]:f(g)?w=c(b)?t(o(g)):{}:w={}}return(_?e:r)(g,function(k,E,C){return y(w,k,E,C)}),w}return zm=d,zm}var Bm,LS;function oF(){if(LS)return Bm;LS=1;var e=Co(),t=ol(),r=Ct(),s=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(s&&a&&a[s])}return Bm=o,Bm}var Um,$S;function C0(){if($S)return Um;$S=1;var e=x0(),t=oF();function r(s,o,a,u,c){var f=-1,p=s.length;for(a||(a=t),c||(c=[]);++f<p;){var d=s[f];o>0&&a(d)?o>1?r(d,o-1,a,u,c):e(c,d):u||(c[c.length]=d)}return c}return Um=r,Um}var Hm,qS;function aF(){if(qS)return Hm;qS=1;function e(t,r,s){switch(s.length){case 0:return t.call(r);case 1:return t.call(r,s[0]);case 2:return t.call(r,s[0],s[1]);case 3:return t.call(r,s[0],s[1],s[2])}return t.apply(r,s)}return Hm=e,Hm}var Wm,DS;function XT(){if(DS)return Wm;DS=1;var e=aF(),t=Math.max;function r(s,o,a){return o=t(o===void 0?s.length-1:o,0),function(){for(var u=arguments,c=-1,f=t(u.length-o,0),p=Array(f);++c<f;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=a(p),e(s,this,d)}}return Wm=r,Wm}var Vm,FS;function lF(){if(FS)return Vm;FS=1;var e=b0(),t=mT(),r=fi(),s=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return Vm=s,Vm}var Gm,zS;function uF(){if(zS)return Gm;zS=1;var e=800,t=16,r=Date.now;function s(o){var a=0,u=0;return function(){var c=r(),f=t-(c-u);if(u=c,f>0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return Gm=s,Gm}var Ym,BS;function QT(){if(BS)return Ym;BS=1;var e=lF(),t=uF(),r=t(e);return Ym=r,Ym}var Km,US;function Oc(){if(US)return Km;US=1;var e=fi(),t=XT(),r=QT();function s(o,a){return r(t(o,a,e),o+"")}return Km=s,Km}var Xm,HS;function ZT(){if(HS)return Xm;HS=1;function e(t,r,s,o){for(var a=t.length,u=s+(o?1:-1);o?u--:++u<a;)if(r(t[u],u,t))return u;return-1}return Xm=e,Xm}var Qm,WS;function cF(){if(WS)return Qm;WS=1;function e(t){return t!==t}return Qm=e,Qm}var Zm,VS;function dF(){if(VS)return Zm;VS=1;function e(t,r,s){for(var o=s-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return Zm=e,Zm}var Jm,GS;function fF(){if(GS)return Jm;GS=1;var e=ZT(),t=cF(),r=dF();function s(o,a,u){return a===a?r(o,a,u):e(o,t,u)}return Jm=s,Jm}var eg,YS;function hF(){if(YS)return eg;YS=1;var e=fF();function t(r,s){var o=r==null?0:r.length;return!!o&&e(r,s,0)>-1}return eg=t,eg}var tg,KS;function pF(){if(KS)return tg;KS=1;function e(t,r,s){for(var o=-1,a=t==null?0:t.length;++o<a;)if(s(r,t[o]))return!0;return!1}return tg=e,tg}var ng,XS;function mF(){if(XS)return ng;XS=1;function e(){}return ng=e,ng}var rg,QS;function gF(){if(QS)return rg;QS=1;var e=ET(),t=mF(),r=E0(),s=1/0,o=e&&1/r(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return rg=o,rg}var sg,ZS;function vF(){if(ZS)return sg;ZS=1;var e=OT(),t=hF(),r=pF(),s=PT(),o=gF(),a=E0(),u=200;function c(f,p,d){var g=-1,y=t,w=f.length,S=!0,_=[],b=_;if(d)S=!1,y=r;else if(w>=u){var k=p?null:o(f);if(k)return a(k);S=!1,y=s,b=new e}else b=p?[]:_;e:for(;++g<w;){var E=f[g],C=p?p(E):E;if(E=d||E!==0?E:0,S&&C===C){for(var T=b.length;T--;)if(b[T]===C)continue e;p&&b.push(C),_.push(E)}else y(b,C,d)||(b!==_&&b.push(C),_.push(E))}return _}return sg=c,sg}var ig,JS;function JT(){if(JS)return ig;JS=1;var e=Xr(),t=kr();function r(s){return t(s)&&e(s)}return ig=r,ig}var og,eE;function yF(){if(eE)return og;eE=1;var e=C0(),t=Oc(),r=vF(),s=JT(),o=t(function(a){return r(e(a,1,s,!0))});return og=o,og}var ag,tE;function wF(){if(tE)return ag;tE=1;var e=Ac();function t(r,s){return e(s,function(o){return r[o]})}return ag=t,ag}var lg,nE;function eR(){if(nE)return lg;nE=1;var e=wF(),t=Ts();function r(s){return s==null?[]:e(s,t(s))}return lg=r,lg}var ug,rE;function Fn(){if(rE)return ug;rE=1;var e;if(typeof f0=="function")try{e={clone:N5(),constant:b0(),each:MT(),filter:HT(),has:WT(),isArray:Ct(),isEmpty:X5(),isFunction:sl(),isUndefined:VT(),keys:Ts(),map:YT(),reduce:KT(),size:sF(),transform:iF(),union:yF(),values:eR()}}catch{}return e||(e=window._),ug=e,ug}var cg,sE;function j0(){if(sE)return cg;sE=1;var e=Fn();cg=o;var t="\0",r="\0",s="";function o(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(d){return this._label=d,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(g){return e.isEmpty(d._in[g])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(g){return e.isEmpty(d._out[g])})},o.prototype.setNodes=function(d,g){var y=arguments,w=this;return e.each(d,function(S){y.length>1?w.setNode(S,g):w.setNode(S)}),this},o.prototype.setNode=function(d,g){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=g),this):(this._nodes[d]=arguments.length>1?g:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},o.prototype.node=function(d){return this._nodes[d]},o.prototype.hasNode=function(d){return e.has(this._nodes,d)},o.prototype.removeNode=function(d){var g=this;if(e.has(this._nodes,d)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){g.setParent(w)}),delete this._children[d]),e.each(e.keys(this._in[d]),y),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),y),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},o.prototype.setParent=function(d,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=r;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+g+" as parent of "+d+" would create a cycle");this.setNode(g)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=g,this._children[g][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var g=this._parent[d];if(g!==r)return g}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var g=this._children[d];if(g)return e.keys(g)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var g=this._preds[d];if(g)return e.keys(g)},o.prototype.successors=function(d){var g=this._sucs[d];if(g)return e.keys(g)},o.prototype.neighbors=function(d){var g=this.predecessors(d);if(g)return e.union(g,this.successors(d))},o.prototype.isLeaf=function(d){var g;return this.isDirected()?g=this.successors(d):g=this.neighbors(d),g.length===0},o.prototype.filterNodes=function(d){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,b){d(b)&&g.setNode(b,_)}),e.each(this._edgeObjs,function(_){g.hasNode(_.v)&&g.hasNode(_.w)&&g.setEdge(_,y.edge(_))});var w={};function S(_){var b=y.parent(_);return b===void 0||g.hasNode(b)?(w[_]=b,b):b in w?w[b]:S(b)}return this._isCompound&&e.each(g.nodes(),function(_){g.setParent(_,S(_))}),g},o.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(d,g){var y=this,w=arguments;return e.reduce(d,function(S,_){return w.length>1?y.setEdge(S,_,g):y.setEdge(S,_),_}),this},o.prototype.setEdge=function(){var d,g,y,w,S=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,g=_.w,y=_.name,arguments.length===2&&(w=arguments[1],S=!0)):(d=_,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],S=!0)),d=""+d,g=""+g,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,g,y);if(e.has(this._edgeLabels,b))return S&&(this._edgeLabels[b]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(g),this._edgeLabels[b]=S?w:this._defaultEdgeLabelFn(d,g,y);var k=f(this._isDirected,d,g,y);return d=k.v,g=k.w,Object.freeze(k),this._edgeObjs[b]=k,a(this._preds[g],d),a(this._sucs[d],g),this._in[g][b]=k,this._out[d][b]=k,this._edgeCount++,this},o.prototype.edge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y),S=this._edgeObjs[w];return S&&(d=S.v,g=S.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[g],d),u(this._sucs[d],g),delete this._in[g][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,g){var y=this._in[d];if(y){var w=e.values(y);return g?e.filter(w,function(S){return S.v===g}):w}},o.prototype.outEdges=function(d,g){var y=this._out[d];if(y){var w=e.values(y);return g?e.filter(w,function(S){return S.w===g}):w}},o.prototype.nodeEdges=function(d,g){var y=this.inEdges(d,g);if(y)return y.concat(this.outEdges(d,g))};function a(d,g){d[g]?d[g]++:d[g]=1}function u(d,g){--d[g]||delete d[g]}function c(d,g,y,w){var S=""+g,_=""+y;if(!d&&S>_){var b=S;S=_,_=b}return S+s+_+s+(e.isUndefined(w)?t:w)}function f(d,g,y,w){var S=""+g,_=""+y;if(!d&&S>_){var b=S;S=_,_=b}var k={v:S,w:_};return w&&(k.name=w),k}function p(d,g){return c(d,g.v,g.w,g.name)}return cg}var dg,iE;function xF(){return iE||(iE=1,dg="2.1.8"),dg}var fg,oE;function _F(){return oE||(oE=1,fg={Graph:j0(),version:xF()}),fg}var hg,aE;function bF(){if(aE)return hg;aE=1;var e=Fn(),t=j0();hg={write:r,read:a};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:s(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function s(u){return e.map(u.nodes(),function(c){var f=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(f)||(d.value=f),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var f=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(f)||(p.value=f),p})}function a(u){var c=new t(u.options).setGraph(u.value);return e.each(u.nodes,function(f){c.setNode(f.v,f.value),f.parent&&c.setParent(f.v,f.parent)}),e.each(u.edges,function(f){c.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),c}return hg}var pg,lE;function kF(){if(lE)return pg;lE=1;var e=Fn();pg=t;function t(r){var s={},o=[],a;function u(c){e.has(s,c)||(s[c]=!0,a.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){a=[],u(c),a.length&&o.push(a)}),o}return pg}var mg,uE;function tR(){if(uE)return mg;uE=1;var e=Fn();mg=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var s=this._keyIndices[r];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,s){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var a=this._arr,u=a.length;return o[r]=u,a.push({key:r,priority:s}),this._decrease(u),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,s){var o=this._keyIndices[r];if(s>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+s);this._arr[o].priority=s,this._decrease(o)},t.prototype._heapify=function(r){var s=this._arr,o=2*r,a=o+1,u=r;o<s.length&&(u=s[o].priority<s[u].priority?o:u,a<s.length&&(u=s[a].priority<s[u].priority?a:u),u!==r&&(this._swap(r,u),this._heapify(u)))},t.prototype._decrease=function(r){for(var s=this._arr,o=s[r].priority,a;r!==0&&(a=r>>1,!(s[a].priority<o));)this._swap(r,a),r=a},t.prototype._swap=function(r,s){var o=this._arr,a=this._keyIndices,u=o[r],c=o[s];o[r]=c,o[s]=u,a[c.key]=r,a[u.key]=s},mg}var gg,cE;function nR(){if(cE)return gg;cE=1;var e=Fn(),t=tR();gg=s;var r=e.constant(1);function s(a,u,c,f){return o(a,String(u),c||r,f||function(p){return a.outEdges(p)})}function o(a,u,c,f){var p={},d=new t,g,y,w=function(S){var _=S.v!==g?S.v:S.w,b=p[_],k=c(S),E=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+S+" Weight: "+k);E<b.distance&&(b.distance=E,b.predecessor=g,d.decrease(_,E))};for(a.nodes().forEach(function(S){var _=S===u?0:Number.POSITIVE_INFINITY;p[S]={distance:_},d.add(S,_)});d.size()>0&&(g=d.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return gg}var vg,dE;function SF(){if(dE)return vg;dE=1;var e=nR(),t=Fn();vg=r;function r(s,o,a){return t.transform(s.nodes(),function(u,c){u[c]=e(s,c,o,a)},{})}return vg}var yg,fE;function rR(){if(fE)return yg;fE=1;var e=Fn();yg=t;function t(r){var s=0,o=[],a={},u=[];function c(f){var p=a[f]={onStack:!0,lowlink:s,index:s++};if(o.push(f),r.successors(f).forEach(function(y){e.has(a,y)?a[y].onStack&&(p.lowlink=Math.min(p.lowlink,a[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,a[y].lowlink))}),p.lowlink===p.index){var d=[],g;do g=o.pop(),a[g].onStack=!1,d.push(g);while(f!==g);u.push(d)}}return r.nodes().forEach(function(f){e.has(a,f)||c(f)}),u}return yg}var wg,hE;function EF(){if(hE)return wg;hE=1;var e=Fn(),t=rR();wg=r;function r(s){return e.filter(t(s),function(o){return o.length>1||o.length===1&&s.hasEdge(o[0],o[0])})}return wg}var xg,pE;function NF(){if(pE)return xg;pE=1;var e=Fn();xg=r;var t=e.constant(1);function r(o,a,u){return s(o,a||t,u||function(c){return o.outEdges(c)})}function s(o,a,u){var c={},f=o.nodes();return f.forEach(function(p){c[p]={},c[p][p]={distance:0},f.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var g=d.v===p?d.w:d.v,y=a(d);c[p][g]={distance:y,predecessor:p}})}),f.forEach(function(p){var d=c[p];f.forEach(function(g){var y=c[g];f.forEach(function(w){var S=y[p],_=d[w],b=y[w],k=S.distance+_.distance;k<b.distance&&(b.distance=k,b.predecessor=_.predecessor)})})}),c}return xg}var _g,mE;function sR(){if(mE)return _g;mE=1;var e=Fn();_g=t,t.CycleException=r;function t(s){var o={},a={},u=[];function c(f){if(e.has(a,f))throw new r;e.has(o,f)||(a[f]=!0,o[f]=!0,e.each(s.predecessors(f),c),delete a[f],u.push(f))}if(e.each(s.sinks(),c),e.size(o)!==s.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,_g}var bg,gE;function CF(){if(gE)return bg;gE=1;var e=sR();bg=t;function t(r){try{e(r)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return bg}var kg,vE;function iR(){if(vE)return kg;vE=1;var e=Fn();kg=t;function t(s,o,a){e.isArray(o)||(o=[o]);var u=(s.isDirected()?s.successors:s.neighbors).bind(s),c=[],f={};return e.each(o,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);r(s,p,a==="post",f,u,c)}),c}function r(s,o,a,u,c,f){e.has(u,o)||(u[o]=!0,a||f.push(o),e.each(c(o),function(p){r(s,p,a,u,c,f)}),a&&f.push(o))}return kg}var Sg,yE;function jF(){if(yE)return Sg;yE=1;var e=iR();Sg=t;function t(r,s){return e(r,s,"post")}return Sg}var Eg,wE;function TF(){if(wE)return Eg;wE=1;var e=iR();Eg=t;function t(r,s){return e(r,s,"pre")}return Eg}var Ng,xE;function RF(){if(xE)return Ng;xE=1;var e=Fn(),t=j0(),r=tR();Ng=s;function s(o,a){var u=new t,c={},f=new r,p;function d(y){var w=y.v===p?y.w:y.v,S=f.priority(w);if(S!==void 0){var _=a(y);_<S&&(c[w]=p,f.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),f.decrease(o.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(g)throw new Error("Input graph is not connected: "+o);g=!0}o.nodeEdges(p).forEach(d)}return u}return Ng}var Cg,_E;function AF(){return _E||(_E=1,Cg={components:kF(),dijkstra:nR(),dijkstraAll:SF(),findCycles:EF(),floydWarshall:NF(),isAcyclic:CF(),postorder:jF(),preorder:TF(),prim:RF(),tarjan:rR(),topsort:sR()}),Cg}var jg,bE;function IF(){if(bE)return jg;bE=1;var e=_F();return jg={Graph:e.Graph,json:bF(),alg:AF(),version:e.version},jg}var Tg,kE;function ir(){if(kE)return Tg;kE=1;var e;if(typeof f0=="function")try{e=IF()}catch{}return e||(e=window.graphlib),Tg=e,Tg}var Rg,SE;function MF(){if(SE)return Rg;SE=1;var e=RT(),t=1,r=4;function s(o){return e(o,t|r)}return Rg=s,Rg}var Ag,EE;function Pc(){if(EE)return Ag;EE=1;var e=No(),t=Xr(),r=Nc(),s=Dn();function o(a,u,c){if(!s(c))return!1;var f=typeof u;return(f=="number"?t(c)&&r(u,c.length):f=="string"&&u in c)?e(c[u],a):!1}return Ag=o,Ag}var Ig,NE;function OF(){if(NE)return Ig;NE=1;var e=Oc(),t=No(),r=Pc(),s=di(),o=Object.prototype,a=o.hasOwnProperty,u=e(function(c,f){c=Object(c);var p=-1,d=f.length,g=d>2?f[2]:void 0;for(g&&r(f[0],f[1],g)&&(d=1);++p<d;)for(var y=f[p],w=s(y),S=-1,_=w.length;++S<_;){var b=w[S],k=c[b];(k===void 0||t(k,o[b])&&!a.call(c,b))&&(c[b]=y[b])}return c});return Ig=u,Ig}var Mg,CE;function PF(){if(CE)return Mg;CE=1;var e=Qr(),t=Xr(),r=Ts();function s(o){return function(a,u,c){var f=Object(a);if(!t(a)){var p=e(u,3);a=r(a),u=function(g){return p(f[g],g,f)}}var d=o(a,u,c);return d>-1?f[p?a[d]:d]:void 0}}return Mg=s,Mg}var Og,jE;function LF(){if(jE)return Og;jE=1;var e=/\s/;function t(r){for(var s=r.length;s--&&e.test(r.charAt(s)););return s}return Og=t,Og}var Pg,TE;function $F(){if(TE)return Pg;TE=1;var e=LF(),t=/^\s+/;function r(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Pg=r,Pg}var Lg,RE;function qF(){if(RE)return Lg;RE=1;var e=$F(),t=Dn(),r=Ro(),s=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function f(p){if(typeof p=="number")return p;if(r(p))return s;if(t(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=t(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||u.test(p)?c(p.slice(2),g?2:8):o.test(p)?s:+p}return Lg=f,Lg}var $g,AE;function oR(){if(AE)return $g;AE=1;var e=qF(),t=1/0,r=17976931348623157e292;function s(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var a=o<0?-1:1;return a*r}return o===o?o:0}return $g=s,$g}var qg,IE;function DF(){if(IE)return qg;IE=1;var e=oR();function t(r){var s=e(r),o=s%1;return s===s?o?s-o:s:0}return qg=t,qg}var Dg,ME;function FF(){if(ME)return Dg;ME=1;var e=ZT(),t=Qr(),r=DF(),s=Math.max;function o(a,u,c){var f=a==null?0:a.length;if(!f)return-1;var p=c==null?0:r(c);return p<0&&(p=s(f+p,0)),e(a,t(u,3),p)}return Dg=o,Dg}var Fg,OE;function zF(){if(OE)return Fg;OE=1;var e=PF(),t=FF(),r=e(t);return Fg=r,Fg}var zg,PE;function aR(){if(PE)return zg;PE=1;var e=C0();function t(r){var s=r==null?0:r.length;return s?e(r,1):[]}return zg=t,zg}var Bg,LE;function BF(){if(LE)return Bg;LE=1;var e=k0(),t=AT(),r=di();function s(o,a){return o==null?o:e(o,t(a),r)}return Bg=s,Bg}var Ug,$E;function UF(){if($E)return Ug;$E=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ug=e,Ug}var Hg,qE;function HF(){if(qE)return Hg;qE=1;var e=Sc(),t=S0(),r=Qr();function s(o,a){var u={};return a=r(a,3),t(o,function(c,f,p){e(u,f,a(c,f,p))}),u}return Hg=s,Hg}var Wg,DE;function T0(){if(DE)return Wg;DE=1;var e=Ro();function t(r,s,o){for(var a=-1,u=r.length;++a<u;){var c=r[a],f=s(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return Wg=t,Wg}var Vg,FE;function WF(){if(FE)return Vg;FE=1;function e(t,r){return t>r}return Vg=e,Vg}var Gg,zE;function VF(){if(zE)return Gg;zE=1;var e=T0(),t=WF(),r=fi();function s(o){return o&&o.length?e(o,r,t):void 0}return Gg=s,Gg}var Yg,BE;function lR(){if(BE)return Yg;BE=1;var e=Sc(),t=No();function r(s,o,a){(a!==void 0&&!t(s[o],a)||a===void 0&&!(o in s))&&e(s,o,a)}return Yg=r,Yg}var Kg,UE;function GF(){if(UE)return Kg;UE=1;var e=ui(),t=Tc(),r=kr(),s="[object Object]",o=Function.prototype,a=Object.prototype,u=o.toString,c=a.hasOwnProperty,f=u.call(Object);function p(d){if(!r(d)||e(d)!=s)return!1;var g=t(d);if(g===null)return!0;var y=c.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==f}return Kg=p,Kg}var Xg,HE;function uR(){if(HE)return Xg;HE=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return Xg=e,Xg}var Qg,WE;function YF(){if(WE)return Qg;WE=1;var e=il(),t=di();function r(s){return e(s,t(s))}return Qg=r,Qg}var Zg,VE;function KF(){if(VE)return Zg;VE=1;var e=lR(),t=yT(),r=CT(),s=wT(),o=TT(),a=ol(),u=Ct(),c=JT(),f=jo(),p=sl(),d=Dn(),g=GF(),y=al(),w=uR(),S=YF();function _(b,k,E,C,T,A,L){var P=w(b,E),U=w(k,E),O=L.get(U);if(O){e(b,E,O);return}var M=A?A(P,U,E+"",b,k,L):void 0,q=M===void 0;if(q){var V=u(U),X=!V&&f(U),j=!V&&!X&&y(U);M=U,V||X||j?u(P)?M=P:c(P)?M=s(P):X?(q=!1,M=t(U,!0)):j?(q=!1,M=r(U,!0)):M=[]:g(U)||a(U)?(M=P,a(P)?M=S(P):(!d(P)||p(P))&&(M=o(U))):q=!1}q&&(L.set(U,M),T(M,U,C,A,L),L.delete(U)),e(b,E,M)}return Zg=_,Zg}var Jg,GE;function XF(){if(GE)return Jg;GE=1;var e=kc(),t=lR(),r=k0(),s=KF(),o=Dn(),a=di(),u=uR();function c(f,p,d,g,y){f!==p&&r(p,function(w,S){if(y||(y=new e),o(w))s(f,p,S,d,c,g,y);else{var _=g?g(u(f,S),w,S+"",f,p,y):void 0;_===void 0&&(_=w),t(f,S,_)}},a)}return Jg=c,Jg}var ev,YE;function QF(){if(YE)return ev;YE=1;var e=Oc(),t=Pc();function r(s){return e(function(o,a){var u=-1,c=a.length,f=c>1?a[c-1]:void 0,p=c>2?a[2]:void 0;for(f=s.length>3&&typeof f=="function"?(c--,f):void 0,p&&t(a[0],a[1],p)&&(f=c<3?void 0:f,c=1),o=Object(o);++u<c;){var d=a[u];d&&s(o,d,u,f)}return o})}return ev=r,ev}var tv,KE;function ZF(){if(KE)return tv;KE=1;var e=XF(),t=QF(),r=t(function(s,o,a){e(s,o,a)});return tv=r,tv}var nv,XE;function cR(){if(XE)return nv;XE=1;function e(t,r){return t<r}return nv=e,nv}var rv,QE;function JF(){if(QE)return rv;QE=1;var e=T0(),t=cR(),r=fi();function s(o){return o&&o.length?e(o,r,t):void 0}return rv=s,rv}var sv,ZE;function ez(){if(ZE)return sv;ZE=1;var e=T0(),t=Qr(),r=cR();function s(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return sv=s,sv}var iv,JE;function tz(){if(JE)return iv;JE=1;var e=ar(),t=function(){return e.Date.now()};return iv=t,iv}var ov,eN;function nz(){if(eN)return ov;eN=1;var e=Ec(),t=Ic(),r=Nc(),s=Dn(),o=ll();function a(u,c,f,p){if(!s(u))return u;c=t(c,u);for(var d=-1,g=c.length,y=g-1,w=u;w!=null&&++d<g;){var S=o(c[d]),_=f;if(S==="__proto__"||S==="constructor"||S==="prototype")return u;if(d!=y){var b=w[S];_=p?p(b,S,w):void 0,_===void 0&&(_=s(b)?b:r(c[d+1])?[]:{})}e(w,S,_),w=w[S]}return u}return ov=a,ov}var av,tN;function rz(){if(tN)return av;tN=1;var e=Mc(),t=nz(),r=Ic();function s(o,a,u){for(var c=-1,f=a.length,p={};++c<f;){var d=a[c],g=e(o,d);u(g,d)&&t(p,r(d,o),g)}return p}return av=s,av}var lv,nN;function sz(){if(nN)return lv;nN=1;var e=rz(),t=BT();function r(s,o){return e(s,o,function(a,u){return t(s,u)})}return lv=r,lv}var uv,rN;function iz(){if(rN)return uv;rN=1;var e=aR(),t=XT(),r=QT();function s(o){return r(t(o,void 0,e),o+"")}return uv=s,uv}var cv,sN;function oz(){if(sN)return cv;sN=1;var e=sz(),t=iz(),r=t(function(s,o){return s==null?{}:e(s,o)});return cv=r,cv}var dv,iN;function az(){if(iN)return dv;iN=1;var e=Math.ceil,t=Math.max;function r(s,o,a,u){for(var c=-1,f=t(e((o-s)/(a||1)),0),p=Array(f);f--;)p[u?f:++c]=s,s+=a;return p}return dv=r,dv}var fv,oN;function lz(){if(oN)return fv;oN=1;var e=az(),t=Pc(),r=oR();function s(o){return function(a,u,c){return c&&typeof c!="number"&&t(a,u,c)&&(u=c=void 0),a=r(a),u===void 0?(u=a,a=0):u=r(u),c=c===void 0?a<u?1:-1:r(c),e(a,u,c,o)}}return fv=s,fv}var hv,aN;function uz(){if(aN)return hv;aN=1;var e=lz(),t=e();return hv=t,hv}var pv,lN;function cz(){if(lN)return pv;lN=1;function e(t,r){var s=t.length;for(t.sort(r);s--;)t[s]=t[s].value;return t}return pv=e,pv}var mv,uN;function dz(){if(uN)return mv;uN=1;var e=Ro();function t(r,s){if(r!==s){var o=r!==void 0,a=r===null,u=r===r,c=e(r),f=s!==void 0,p=s===null,d=s===s,g=e(s);if(!p&&!g&&!c&&r>s||c&&f&&d&&!p&&!g||a&&f&&d||!o&&d||!u)return 1;if(!a&&!c&&!g&&r<s||g&&o&&u&&!a&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return mv=t,mv}var gv,cN;function fz(){if(cN)return gv;cN=1;var e=dz();function t(r,s,o){for(var a=-1,u=r.criteria,c=s.criteria,f=u.length,p=o.length;++a<f;){var d=e(u[a],c[a]);if(d){if(a>=p)return d;var g=o[a];return d*(g=="desc"?-1:1)}}return r.index-s.index}return gv=t,gv}var vv,dN;function hz(){if(dN)return vv;dN=1;var e=Ac(),t=Mc(),r=Qr(),s=GT(),o=cz(),a=Cc(),u=fz(),c=fi(),f=Ct();function p(d,g,y){g.length?g=e(g,function(_){return f(_)?function(b){return t(b,_.length===1?_[0]:_)}:_}):g=[c];var w=-1;g=e(g,a(r));var S=s(d,function(_,b,k){var E=e(g,function(C){return C(_)});return{criteria:E,index:++w,value:_}});return o(S,function(_,b){return u(_,b,y)})}return vv=p,vv}var yv,fN;function pz(){if(fN)return yv;fN=1;var e=C0(),t=hz(),r=Oc(),s=Pc(),o=r(function(a,u){if(a==null)return[];var c=u.length;return c>1&&s(a,u[0],u[1])?u=[]:c>2&&s(u[0],u[1],u[2])&&(u=[u[0]]),t(a,e(u,1),[])});return yv=o,yv}var wv,hN;function mz(){if(hN)return wv;hN=1;var e=FT(),t=0;function r(s){var o=++t;return e(s)+o}return wv=r,wv}var xv,pN;function gz(){if(pN)return xv;pN=1;function e(t,r,s){for(var o=-1,a=t.length,u=r.length,c={};++o<a;){var f=o<u?r[o]:void 0;s(c,t[o],f)}return c}return xv=e,xv}var _v,mN;function vz(){if(mN)return _v;mN=1;var e=Ec(),t=gz();function r(s,o){return t(s||[],o||[],e)}return _v=r,_v}var bv,gN;function mt(){if(gN)return bv;gN=1;var e;if(typeof f0=="function")try{e={cloneDeep:MF(),constant:b0(),defaults:OF(),each:MT(),filter:HT(),find:zF(),flatten:aR(),forEach:IT(),forIn:BF(),has:WT(),isUndefined:VT(),last:UF(),map:YT(),mapValues:HF(),max:VF(),merge:ZF(),min:JF(),minBy:ez(),now:tz(),pick:oz(),range:uz(),reduce:KT(),sortBy:pz(),uniqueId:mz(),values:eR(),zipObject:vz()}}catch{}return e||(e=window._),bv=e,bv}var kv,vN;function yz(){if(vN)return kv;vN=1,kv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,o=s._prev;if(o!==s)return t(o),o},e.prototype.enqueue=function(s){var o=this._sentinel;s._prev&&s._next&&t(s),s._next=o._next,o._next._prev=s,o._next=s,s._prev=o},e.prototype.toString=function(){for(var s=[],o=this._sentinel,a=o._prev;a!==o;)s.push(JSON.stringify(a,r)),a=a._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function r(s,o){if(s!=="_next"&&s!=="_prev")return o}return kv}var Sv,yN;function wz(){if(yN)return Sv;yN=1;var e=mt(),t=ir().Graph,r=yz();Sv=o;var s=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var g=c(p,d||s),y=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,d,g){for(var y=[],w=d[d.length-1],S=d[0],_;p.nodeCount();){for(;_=S.dequeue();)u(p,d,g,_);for(;_=w.dequeue();)u(p,d,g,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,g,_,!0));break}}}return y}function u(p,d,g,y,w){var S=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),k=p.node(_.v);w&&S.push({v:_.v,w:_.w}),k.out-=b,f(d,g,k)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),k=_.w,E=p.node(k);E.in-=b,f(d,g,E)}),p.removeNode(y.v),S}function c(p,d){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(b){g.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var k=g.edge(b.v,b.w)||0,E=d(b),C=k+E;g.setEdge(b.v,b.w,C),w=Math.max(w,g.node(b.v).out+=E),y=Math.max(y,g.node(b.w).in+=E)});var S=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(g.nodes(),function(b){f(S,_,g.node(b))}),{graph:g,buckets:S,zeroIdx:_}}function f(p,d,g){g.out?g.in?p[g.out-g.in+d].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return Sv}var Ev,wN;function xz(){if(wN)return Ev;wN=1;var e=mt(),t=wz();Ev={run:r,undo:o};function r(a){var u=a.graph().acyclicer==="greedy"?t(a,c(a)):s(a);e.forEach(u,function(f){var p=a.edge(f);a.removeEdge(f),p.forwardName=f.name,p.reversed=!0,a.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function c(f){return function(p){return f.edge(p).weight}}}function s(a){var u=[],c={},f={};function p(d){e.has(f,d)||(f[d]=!0,c[d]=!0,e.forEach(a.outEdges(d),function(g){e.has(c,g.w)?u.push(g):p(g.w)}),delete c[d])}return e.forEach(a.nodes(),p),u}function o(a){e.forEach(a.edges(),function(u){var c=a.edge(u);if(c.reversed){a.removeEdge(u);var f=c.forwardName;delete c.reversed,delete c.forwardName,a.setEdge(u.w,u.v,c,f)}})}return Ev}var Nv,xN;function cn(){if(xN)return Nv;xN=1;var e=mt(),t=ir().Graph;Nv={addDummyNode:r,simplify:s,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:g,maxRank:y,partition:w,time:S,notime:_};function r(b,k,E,C){var T;do T=e.uniqueId(C);while(b.hasNode(T));return E.dummy=k,b.setNode(T,E),T}function s(b){var k=new t().setGraph(b.graph());return e.forEach(b.nodes(),function(E){k.setNode(E,b.node(E))}),e.forEach(b.edges(),function(E){var C=k.edge(E.v,E.w)||{weight:0,minlen:1},T=b.edge(E);k.setEdge(E.v,E.w,{weight:C.weight+T.weight,minlen:Math.max(C.minlen,T.minlen)})}),k}function o(b){var k=new t({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(E){b.children(E).length||k.setNode(E,b.node(E))}),e.forEach(b.edges(),function(E){k.setEdge(E,b.edge(E))}),k}function a(b){var k=e.map(b.nodes(),function(E){var C={};return e.forEach(b.outEdges(E),function(T){C[T.w]=(C[T.w]||0)+b.edge(T).weight}),C});return e.zipObject(b.nodes(),k)}function u(b){var k=e.map(b.nodes(),function(E){var C={};return e.forEach(b.inEdges(E),function(T){C[T.v]=(C[T.v]||0)+b.edge(T).weight}),C});return e.zipObject(b.nodes(),k)}function c(b,k){var E=b.x,C=b.y,T=k.x-E,A=k.y-C,L=b.width/2,P=b.height/2;if(!T&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var U,O;return Math.abs(A)*L>Math.abs(T)*P?(A<0&&(P=-P),U=P*T/A,O=P):(T<0&&(L=-L),U=L,O=L*A/T),{x:E+U,y:C+O}}function f(b){var k=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(E){var C=b.node(E),T=C.rank;e.isUndefined(T)||(k[T][C.order]=E)}),k}function p(b){var k=e.min(e.map(b.nodes(),function(E){return b.node(E).rank}));e.forEach(b.nodes(),function(E){var C=b.node(E);e.has(C,"rank")&&(C.rank-=k)})}function d(b){var k=e.min(e.map(b.nodes(),function(A){return b.node(A).rank})),E=[];e.forEach(b.nodes(),function(A){var L=b.node(A).rank-k;E[L]||(E[L]=[]),E[L].push(A)});var C=0,T=b.graph().nodeRankFactor;e.forEach(E,function(A,L){e.isUndefined(A)&&L%T!==0?--C:C&&e.forEach(A,function(P){b.node(P).rank+=C})})}function g(b,k,E,C){var T={width:0,height:0};return arguments.length>=4&&(T.rank=E,T.order=C),r(b,"border",T,k)}function y(b){return e.max(e.map(b.nodes(),function(k){var E=b.node(k).rank;if(!e.isUndefined(E))return E}))}function w(b,k){var E={lhs:[],rhs:[]};return e.forEach(b,function(C){k(C)?E.lhs.push(C):E.rhs.push(C)}),E}function S(b,k){var E=e.now();try{return k()}finally{console.log(b+" time: "+(e.now()-E)+"ms")}}function _(b,k){return k()}return Nv}var Cv,_N;function _z(){if(_N)return Cv;_N=1;var e=mt(),t=cn();Cv={run:r,undo:o};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(u){s(a,u)})}function s(a,u){var c=u.v,f=a.node(c).rank,p=u.w,d=a.node(p).rank,g=u.name,y=a.edge(u),w=y.labelRank;if(d!==f+1){a.removeEdge(u);var S,_,b;for(b=0,++f;f<d;++b,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:f},S=t.addDummyNode(a,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),a.setEdge(c,S,{weight:y.weight},g),b===0&&a.graph().dummyChains.push(S),c=S;a.setEdge(c,p,{weight:y.weight},g)}}function o(a){e.forEach(a.graph().dummyChains,function(u){var c=a.node(u),f=c.edgeLabel,p;for(a.setEdge(c.edgeObj,f);c.dummy;)p=a.successors(u)[0],a.removeNode(u),f.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(f.x=c.x,f.y=c.y,f.width=c.width,f.height=c.height),u=p,c=a.node(u)})}return Cv}var jv,bN;function oc(){if(bN)return jv;bN=1;var e=mt();jv={longestPath:t,slack:r};function t(s){var o={};function a(u){var c=s.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var f=e.min(e.map(s.outEdges(u),function(p){return a(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),c.rank=f}e.forEach(s.sources(),a)}function r(s,o){return s.node(o.w).rank-s.node(o.v).rank-s.edge(o).minlen}return jv}var Tv,kN;function dR(){if(kN)return Tv;kN=1;var e=mt(),t=ir().Graph,r=oc().slack;Tv=s;function s(c){var f=new t({directed:!1}),p=c.nodes()[0],d=c.nodeCount();f.setNode(p,{});for(var g,y;o(f,c)<d;)g=a(f,c),y=f.hasNode(g.v)?r(c,g):-r(c,g),u(f,c,y);return f}function o(c,f){function p(d){e.forEach(f.nodeEdges(d),function(g){var y=g.v,w=d===y?g.w:y;!c.hasNode(w)&&!r(f,g)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function a(c,f){return e.minBy(f.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(f,p)})}function u(c,f,p){e.forEach(c.nodes(),function(d){f.node(d).rank+=p})}return Tv}var Rv,SN;function bz(){if(SN)return Rv;SN=1;var e=mt(),t=dR(),r=oc().slack,s=oc().longestPath,o=ir().alg.preorder,a=ir().alg.postorder,u=cn().simplify;Rv=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=S,c.exchangeEdges=_;function c(C){C=u(C),s(C);var T=t(C);g(T),f(T,C);for(var A,L;A=w(T);)L=S(T,C,A),_(T,C,A,L)}function f(C,T){var A=a(C,C.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(L){p(C,T,L)})}function p(C,T,A){var L=C.node(A),P=L.parent;C.edge(A,P).cutvalue=d(C,T,A)}function d(C,T,A){var L=C.node(A),P=L.parent,U=!0,O=T.edge(A,P),M=0;return O||(U=!1,O=T.edge(P,A)),M=O.weight,e.forEach(T.nodeEdges(A),function(q){var V=q.v===A,X=V?q.w:q.v;if(X!==P){var j=V===U,G=T.edge(q).weight;if(M+=j?G:-G,k(C,A,X)){var B=C.edge(A,X).cutvalue;M+=j?-B:B}}}),M}function g(C,T){arguments.length<2&&(T=C.nodes()[0]),y(C,{},1,T)}function y(C,T,A,L,P){var U=A,O=C.node(L);return T[L]=!0,e.forEach(C.neighbors(L),function(M){e.has(T,M)||(A=y(C,T,A,M,L))}),O.low=U,O.lim=A++,P?O.parent=P:delete O.parent,A}function w(C){return e.find(C.edges(),function(T){return C.edge(T).cutvalue<0})}function S(C,T,A){var L=A.v,P=A.w;T.hasEdge(L,P)||(L=A.w,P=A.v);var U=C.node(L),O=C.node(P),M=U,q=!1;U.lim>O.lim&&(M=O,q=!0);var V=e.filter(T.edges(),function(X){return q===E(C,C.node(X.v),M)&&q!==E(C,C.node(X.w),M)});return e.minBy(V,function(X){return r(T,X)})}function _(C,T,A,L){var P=A.v,U=A.w;C.removeEdge(P,U),C.setEdge(L.v,L.w,{}),g(C),f(C,T),b(C,T)}function b(C,T){var A=e.find(C.nodes(),function(P){return!T.node(P).parent}),L=o(C,A);L=L.slice(1),e.forEach(L,function(P){var U=C.node(P).parent,O=T.edge(P,U),M=!1;O||(O=T.edge(U,P),M=!0),T.node(P).rank=T.node(U).rank+(M?O.minlen:-O.minlen)})}function k(C,T,A){return C.hasEdge(T,A)}function E(C,T,A){return A.low<=T.lim&&T.lim<=A.lim}return Rv}var Av,EN;function kz(){if(EN)return Av;EN=1;var e=oc(),t=e.longestPath,r=dR(),s=bz();Av=o;function o(f){switch(f.graph().ranker){case"network-simplex":c(f);break;case"tight-tree":u(f);break;case"longest-path":a(f);break;default:c(f)}}var a=t;function u(f){t(f),r(f)}function c(f){s(f)}return Av}var Iv,NN;function Sz(){if(NN)return Iv;NN=1;var e=mt();Iv=t;function t(o){var a=s(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),f=c.edgeObj,p=r(o,a,f.v,f.w),d=p.path,g=p.lca,y=0,w=d[y],S=!0;u!==f.w;){if(c=o.node(u),S){for(;(w=d[y])!==g&&o.node(w).maxRank<c.rank;)y++;w===g&&(S=!1)}if(!S){for(;y<d.length-1&&o.node(w=d[y+1]).minRank<=c.rank;)y++;w=d[y]}o.setParent(u,w),u=o.successors(u)[0]}})}function r(o,a,u,c){var f=[],p=[],d=Math.min(a[u].low,a[c].low),g=Math.max(a[u].lim,a[c].lim),y,w;y=u;do y=o.parent(y),f.push(y);while(y&&(a[y].low>d||g>a[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function s(o){var a={},u=0;function c(f){var p=u;e.forEach(o.children(f),c),a[f]={low:p,lim:u++}}return e.forEach(o.children(),c),a}return Iv}var Mv,CN;function Ez(){if(CN)return Mv;CN=1;var e=mt(),t=cn();Mv={run:r,cleanup:u};function r(c){var f=t.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,g=2*d+1;c.graph().nestingRoot=f,e.forEach(c.edges(),function(w){c.edge(w).minlen*=g});var y=a(c)+1;e.forEach(c.children(),function(w){s(c,f,g,y,d,p,w)}),c.graph().nodeRankFactor=g}function s(c,f,p,d,g,y,w){var S=c.children(w);if(!S.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(c,"_bt"),b=t.addBorderNode(c,"_bb"),k=c.node(w);c.setParent(_,w),k.borderTop=_,c.setParent(b,w),k.borderBottom=b,e.forEach(S,function(E){s(c,f,p,d,g,y,E);var C=c.node(E),T=C.borderTop?C.borderTop:E,A=C.borderBottom?C.borderBottom:E,L=C.borderTop?d:2*d,P=T!==A?1:g-y[w]+1;c.setEdge(_,T,{weight:L,minlen:P,nestingEdge:!0}),c.setEdge(A,b,{weight:L,minlen:P,nestingEdge:!0})}),c.parent(w)||c.setEdge(f,_,{weight:0,minlen:g+y[w]})}function o(c){var f={};function p(d,g){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),f[d]=g}return e.forEach(c.children(),function(d){p(d,1)}),f}function a(c){return e.reduce(c.edges(),function(f,p){return f+c.edge(p).weight},0)}function u(c){var f=c.graph();c.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return Mv}var Ov,jN;function Nz(){if(jN)return Ov;jN=1;var e=mt(),t=cn();Ov=r;function r(o){function a(u){var c=o.children(u),f=o.node(u);if(c.length&&e.forEach(c,a),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,d=f.maxRank+1;p<d;++p)s(o,"borderLeft","_bl",u,f,p),s(o,"borderRight","_br",u,f,p)}}e.forEach(o.children(),a)}function s(o,a,u,c,f,p){var d={width:0,height:0,rank:p,borderType:a},g=f[a][p-1],y=t.addDummyNode(o,"border",d,u);f[a][p]=y,o.setParent(y,c),g&&o.setEdge(g,y,{weight:1})}return Ov}var Pv,TN;function Cz(){if(TN)return Pv;TN=1;var e=mt();Pv={adjust:t,undo:r};function t(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&s(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&a(p),(d==="lr"||d==="rl")&&(c(p),s(p))}function s(p){e.forEach(p.nodes(),function(d){o(p.node(d))}),e.forEach(p.edges(),function(d){o(p.edge(d))})}function o(p){var d=p.width;p.width=p.height,p.height=d}function a(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var g=p.edge(d);e.forEach(g.points,u),e.has(g,"y")&&u(g)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){f(p.node(d))}),e.forEach(p.edges(),function(d){var g=p.edge(d);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var d=p.x;p.x=p.y,p.y=d}return Pv}var Lv,RN;function jz(){if(RN)return Lv;RN=1;var e=mt();Lv=t;function t(r){var s={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),a=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(a+1),function(){return[]});function c(p){if(!e.has(s,p)){s[p]=!0;var d=r.node(p);u[d.rank].push(p),e.forEach(r.successors(p),c)}}var f=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(f,c),u}return Lv}var $v,AN;function Tz(){if(AN)return $v;AN=1;var e=mt();$v=t;function t(s,o){for(var a=0,u=1;u<o.length;++u)a+=r(s,o[u-1],o[u]);return a}function r(s,o,a){for(var u=e.zipObject(a,e.map(a,function(y,w){return w})),c=e.flatten(e.map(o,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:u[w.w],weight:s.edge(w).weight}}),"pos")}),!0),f=1;f<a.length;)f<<=1;var p=2*f-1;f-=1;var d=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(c.forEach(function(y){var w=y.pos+f;d[w]+=y.weight;for(var S=0;w>0;)w%2&&(S+=d[w+1]),w=w-1>>1,d[w]+=y.weight;g+=y.weight*S})),g}return $v}var qv,IN;function Rz(){if(IN)return qv;IN=1;var e=mt();qv=t;function t(r,s){return e.map(s,function(o){var a=r.inEdges(o);if(a.length){var u=e.reduce(a,function(c,f){var p=r.edge(f),d=r.node(f.v);return{sum:c.sum+p.weight*d.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:o,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:o}})}return qv}var Dv,MN;function Az(){if(MN)return Dv;MN=1;var e=mt();Dv=t;function t(o,a){var u={};e.forEach(o,function(f,p){var d=u[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(d.barycenter=f.barycenter,d.weight=f.weight)}),e.forEach(a.edges(),function(f){var p=u[f.v],d=u[f.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[f.w]))});var c=e.filter(u,function(f){return!f.indegree});return r(c)}function r(o){var a=[];function u(p){return function(d){d.merged||(e.isUndefined(d.barycenter)||e.isUndefined(p.barycenter)||d.barycenter>=p.barycenter)&&s(p,d)}}function c(p){return function(d){d.in.push(p),--d.indegree===0&&o.push(d)}}for(;o.length;){var f=o.pop();a.push(f),e.forEach(f.in.reverse(),u(f)),e.forEach(f.out,c(f))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(o,a){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),a.weight&&(u+=a.barycenter*a.weight,c+=a.weight),o.vs=a.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(a.i,o.i),a.merged=!0}return Dv}var Fv,ON;function Iz(){if(ON)return Fv;ON=1;var e=mt(),t=cn();Fv=r;function r(a,u){var c=t.partition(a,function(_){return e.has(_,"barycenter")}),f=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],g=0,y=0,w=0;f.sort(o(!!u)),w=s(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),g+=_.barycenter*_.weight,y+=_.weight,w=s(d,p,w)});var S={vs:e.flatten(d,!0)};return y&&(S.barycenter=g/y,S.weight=y),S}function s(a,u,c){for(var f;u.length&&(f=e.last(u)).i<=c;)u.pop(),a.push(f.vs),c++;return c}function o(a){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:a?c.i-u.i:u.i-c.i}}return Fv}var zv,PN;function Mz(){if(PN)return zv;PN=1;var e=mt(),t=Rz(),r=Az(),s=Iz();zv=o;function o(c,f,p,d){var g=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,S=y?y.borderRight:void 0,_={};w&&(g=e.filter(g,function(A){return A!==w&&A!==S}));var b=t(c,g);e.forEach(b,function(A){if(c.children(A.v).length){var L=o(c,A.v,p,d);_[A.v]=L,e.has(L,"barycenter")&&u(A,L)}});var k=r(b,p);a(k,_);var E=s(k,d);if(w&&(E.vs=e.flatten([w,E.vs,S],!0),c.predecessors(w).length)){var C=c.node(c.predecessors(w)[0]),T=c.node(c.predecessors(S)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+C.order+T.order)/(E.weight+2),E.weight+=2}return E}function a(c,f){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return f[d]?f[d].vs:d}),!0)})}function u(c,f){e.isUndefined(c.barycenter)?(c.barycenter=f.barycenter,c.weight=f.weight):(c.barycenter=(c.barycenter*c.weight+f.barycenter*f.weight)/(c.weight+f.weight),c.weight+=f.weight)}return zv}var Bv,LN;function Oz(){if(LN)return Bv;LN=1;var e=mt(),t=ir().Graph;Bv=r;function r(o,a,u){var c=s(o),f=new t({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),g=o.parent(p);(d.rank===a||d.minRank<=a&&a<=d.maxRank)&&(f.setNode(p),f.setParent(p,g||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,S=f.edge(w,p),_=e.isUndefined(S)?0:S.weight;f.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&f.setNode(p,{borderLeft:d.borderLeft[a],borderRight:d.borderRight[a]}))}),f}function s(o){for(var a;o.hasNode(a=e.uniqueId("_root")););return a}return Bv}var Uv,$N;function Pz(){if($N)return Uv;$N=1;var e=mt();Uv=t;function t(r,s,o){var a={},u;e.forEach(o,function(c){for(var f=r.parent(c),p,d;f;){if(p=r.parent(f),p?(d=a[p],a[p]=f):(d=u,u=f),d&&d!==f){s.setEdge(d,f);return}f=p}})}return Uv}var Hv,qN;function Lz(){if(qN)return Hv;qN=1;var e=mt(),t=jz(),r=Tz(),s=Mz(),o=Oz(),a=Pz(),u=ir().Graph,c=cn();Hv=f;function f(y){var w=c.maxRank(y),S=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),b=t(y);g(y,b);for(var k=Number.POSITIVE_INFINITY,E,C=0,T=0;T<4;++C,++T){d(C%2?S:_,C%4>=2),b=c.buildLayerMatrix(y);var A=r(y,b);A<k&&(T=0,E=e.cloneDeep(b),k=A)}g(y,E)}function p(y,w,S){return e.map(w,function(_){return o(y,_,S)})}function d(y,w){var S=new u;e.forEach(y,function(_){var b=_.graph().root,k=s(_,b,S,w);e.forEach(k.vs,function(E,C){_.node(E).order=C}),a(_,S,k.vs)})}function g(y,w){e.forEach(w,function(S){e.forEach(S,function(_,b){y.node(_).order=b})})}return Hv}var Wv,DN;function $z(){if(DN)return Wv;DN=1;var e=mt(),t=ir().Graph,r=cn();Wv={positionX:S,findType1Conflicts:s,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(k,E){var C={};function T(A,L){var P=0,U=0,O=A.length,M=e.last(L);return e.forEach(L,function(q,V){var X=a(k,q),j=X?k.node(X).order:O;(X||q===M)&&(e.forEach(L.slice(U,V+1),function(G){e.forEach(k.predecessors(G),function(B){var te=k.node(B),Z=te.order;(Z<P||j<Z)&&!(te.dummy&&k.node(G).dummy)&&u(C,B,G)})}),U=V+1,P=j)}),L}return e.reduce(E,T),C}function o(k,E){var C={};function T(L,P,U,O,M){var q;e.forEach(e.range(P,U),function(V){q=L[V],k.node(q).dummy&&e.forEach(k.predecessors(q),function(X){var j=k.node(X);j.dummy&&(j.order<O||j.order>M)&&u(C,X,q)})})}function A(L,P){var U=-1,O,M=0;return e.forEach(P,function(q,V){if(k.node(q).dummy==="border"){var X=k.predecessors(q);X.length&&(O=k.node(X[0]).order,T(P,M,V,U,O),M=V,U=O)}T(P,M,P.length,O,L.length)}),P}return e.reduce(E,A),C}function a(k,E){if(k.node(E).dummy)return e.find(k.predecessors(E),function(C){return k.node(C).dummy})}function u(k,E,C){if(E>C){var T=E;E=C,C=T}var A=k[E];A||(k[E]=A={}),A[C]=!0}function c(k,E,C){if(E>C){var T=E;E=C,C=T}return e.has(k[E],C)}function f(k,E,C,T){var A={},L={},P={};return e.forEach(E,function(U){e.forEach(U,function(O,M){A[O]=O,L[O]=O,P[O]=M})}),e.forEach(E,function(U){var O=-1;e.forEach(U,function(M){var q=T(M);if(q.length){q=e.sortBy(q,function(B){return P[B]});for(var V=(q.length-1)/2,X=Math.floor(V),j=Math.ceil(V);X<=j;++X){var G=q[X];L[M]===M&&O<P[G]&&!c(C,M,G)&&(L[G]=M,L[M]=A[M]=A[G],O=P[G])}}})}),{root:A,align:L}}function p(k,E,C,T,A){var L={},P=d(k,E,C,A),U=A?"borderLeft":"borderRight";function O(V,X){for(var j=P.nodes(),G=j.pop(),B={};G;)B[G]?V(G):(B[G]=!0,j.push(G),j=j.concat(X(G))),G=j.pop()}function M(V){L[V]=P.inEdges(V).reduce(function(X,j){return Math.max(X,L[j.v]+P.edge(j))},0)}function q(V){var X=P.outEdges(V).reduce(function(G,B){return Math.min(G,L[B.w]-P.edge(B))},Number.POSITIVE_INFINITY),j=k.node(V);X!==Number.POSITIVE_INFINITY&&j.borderType!==U&&(L[V]=Math.max(L[V],X))}return O(M,P.predecessors.bind(P)),O(q,P.successors.bind(P)),e.forEach(T,function(V){L[V]=L[C[V]]}),L}function d(k,E,C,T){var A=new t,L=k.graph(),P=_(L.nodesep,L.edgesep,T);return e.forEach(E,function(U){var O;e.forEach(U,function(M){var q=C[M];if(A.setNode(q),O){var V=C[O],X=A.edge(V,q);A.setEdge(V,q,Math.max(P(k,M,O),X||0))}O=M})}),A}function g(k,E){return e.minBy(e.values(E),function(C){var T=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(C,function(L,P){var U=b(k,P)/2;T=Math.max(L+U,T),A=Math.min(L-U,A)}),T-A})}function y(k,E){var C=e.values(E),T=e.min(C),A=e.max(C);e.forEach(["u","d"],function(L){e.forEach(["l","r"],function(P){var U=L+P,O=k[U],M;if(O!==E){var q=e.values(O);M=P==="l"?T-e.min(q):A-e.max(q),M&&(k[U]=e.mapValues(O,function(V){return V+M}))}})})}function w(k,E){return e.mapValues(k.ul,function(C,T){if(E)return k[E.toLowerCase()][T];var A=e.sortBy(e.map(k,T));return(A[1]+A[2])/2})}function S(k){var E=r.buildLayerMatrix(k),C=e.merge(s(k,E),o(k,E)),T={},A;e.forEach(["u","d"],function(P){A=P==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(U){U==="r"&&(A=e.map(A,function(V){return e.values(V).reverse()}));var O=(P==="u"?k.predecessors:k.successors).bind(k),M=f(k,A,C,O),q=p(k,A,M.root,M.align,U==="r");U==="r"&&(q=e.mapValues(q,function(V){return-V})),T[P+U]=q})});var L=g(k,T);return y(T,L),w(T,k.graph().align)}function _(k,E,C){return function(T,A,L){var P=T.node(A),U=T.node(L),O=0,M;if(O+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":M=-P.width/2;break;case"r":M=P.width/2;break}if(M&&(O+=C?M:-M),M=0,O+=(P.dummy?E:k)/2,O+=(U.dummy?E:k)/2,O+=U.width/2,e.has(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":M=U.width/2;break;case"r":M=-U.width/2;break}return M&&(O+=C?M:-M),M=0,O}}function b(k,E){return k.node(E).width}return Wv}var Vv,FN;function qz(){if(FN)return Vv;FN=1;var e=mt(),t=cn(),r=$z().positionX;Vv=s;function s(a){a=t.asNonCompoundGraph(a),o(a),e.forEach(r(a),function(u,c){a.node(c).x=u})}function o(a){var u=t.buildLayerMatrix(a),c=a.graph().ranksep,f=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=f+d/2}),f+=d+c})}return Vv}var Gv,zN;function Dz(){if(zN)return Gv;zN=1;var e=mt(),t=xz(),r=_z(),s=kz(),o=cn().normalizeRanks,a=Sz(),u=cn().removeEmptyRanks,c=Ez(),f=Nz(),p=Cz(),d=Lz(),g=qz(),y=cn(),w=ir().Graph;Gv=S;function S(z,Q){var ne=Q&&Q.debugTiming?y.time:y.notime;ne("layout",function(){var ae=ne(" buildLayoutGraph",function(){return O(z)});ne(" runLayout",function(){_(ae,ne)}),ne(" updateInputGraph",function(){b(z,ae)})})}function _(z,Q){Q(" makeSpaceForEdgeLabels",function(){M(z)}),Q(" removeSelfEdges",function(){$(z)}),Q(" acyclic",function(){t.run(z)}),Q(" nestingGraph.run",function(){c.run(z)}),Q(" rank",function(){s(y.asNonCompoundGraph(z))}),Q(" injectEdgeLabelProxies",function(){q(z)}),Q(" removeEmptyRanks",function(){u(z)}),Q(" nestingGraph.cleanup",function(){c.cleanup(z)}),Q(" normalizeRanks",function(){o(z)}),Q(" assignRankMinMax",function(){V(z)}),Q(" removeEdgeLabelProxies",function(){X(z)}),Q(" normalize.run",function(){r.run(z)}),Q(" parentDummyChains",function(){a(z)}),Q(" addBorderSegments",function(){f(z)}),Q(" order",function(){d(z)}),Q(" insertSelfEdges",function(){H(z)}),Q(" adjustCoordinateSystem",function(){p.adjust(z)}),Q(" position",function(){g(z)}),Q(" positionSelfEdges",function(){I(z)}),Q(" removeBorderNodes",function(){Z(z)}),Q(" normalize.undo",function(){r.undo(z)}),Q(" fixupEdgeLabelCoords",function(){B(z)}),Q(" undoCoordinateSystem",function(){p.undo(z)}),Q(" translateGraph",function(){j(z)}),Q(" assignNodeIntersects",function(){G(z)}),Q(" reversePoints",function(){te(z)}),Q(" acyclic.undo",function(){t.undo(z)})}function b(z,Q){e.forEach(z.nodes(),function(ne){var ae=z.node(ne),fe=Q.node(ne);ae&&(ae.x=fe.x,ae.y=fe.y,Q.children(ne).length&&(ae.width=fe.width,ae.height=fe.height))}),e.forEach(z.edges(),function(ne){var ae=z.edge(ne),fe=Q.edge(ne);ae.points=fe.points,e.has(fe,"x")&&(ae.x=fe.x,ae.y=fe.y)}),z.graph().width=Q.graph().width,z.graph().height=Q.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],T=["width","height"],A={width:0,height:0},L=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function O(z){var Q=new w({multigraph:!0,compound:!0}),ne=ce(z.graph());return Q.setGraph(e.merge({},E,Y(ne,k),e.pick(ne,C))),e.forEach(z.nodes(),function(ae){var fe=ce(z.node(ae));Q.setNode(ae,e.defaults(Y(fe,T),A)),Q.setParent(ae,z.parent(ae))}),e.forEach(z.edges(),function(ae){var fe=ce(z.edge(ae));Q.setEdge(ae,e.merge({},P,Y(fe,L),e.pick(fe,U)))}),Q}function M(z){var Q=z.graph();Q.ranksep/=2,e.forEach(z.edges(),function(ne){var ae=z.edge(ne);ae.minlen*=2,ae.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?ae.width+=ae.labeloffset:ae.height+=ae.labeloffset)})}function q(z){e.forEach(z.edges(),function(Q){var ne=z.edge(Q);if(ne.width&&ne.height){var ae=z.node(Q.v),fe=z.node(Q.w),pe={rank:(fe.rank-ae.rank)/2+ae.rank,e:Q};y.addDummyNode(z,"edge-proxy",pe,"_ep")}})}function V(z){var Q=0;e.forEach(z.nodes(),function(ne){var ae=z.node(ne);ae.borderTop&&(ae.minRank=z.node(ae.borderTop).rank,ae.maxRank=z.node(ae.borderBottom).rank,Q=e.max(Q,ae.maxRank))}),z.graph().maxRank=Q}function X(z){e.forEach(z.nodes(),function(Q){var ne=z.node(Q);ne.dummy==="edge-proxy"&&(z.edge(ne.e).labelRank=ne.rank,z.removeNode(Q))})}function j(z){var Q=Number.POSITIVE_INFINITY,ne=0,ae=Number.POSITIVE_INFINITY,fe=0,pe=z.graph(),ye=pe.marginx||0,Me=pe.marginy||0;function Ue(ze){var Ie=ze.x,ke=ze.y,le=ze.width,we=ze.height;Q=Math.min(Q,Ie-le/2),ne=Math.max(ne,Ie+le/2),ae=Math.min(ae,ke-we/2),fe=Math.max(fe,ke+we/2)}e.forEach(z.nodes(),function(ze){Ue(z.node(ze))}),e.forEach(z.edges(),function(ze){var Ie=z.edge(ze);e.has(Ie,"x")&&Ue(Ie)}),Q-=ye,ae-=Me,e.forEach(z.nodes(),function(ze){var Ie=z.node(ze);Ie.x-=Q,Ie.y-=ae}),e.forEach(z.edges(),function(ze){var Ie=z.edge(ze);e.forEach(Ie.points,function(ke){ke.x-=Q,ke.y-=ae}),e.has(Ie,"x")&&(Ie.x-=Q),e.has(Ie,"y")&&(Ie.y-=ae)}),pe.width=ne-Q+ye,pe.height=fe-ae+Me}function G(z){e.forEach(z.edges(),function(Q){var ne=z.edge(Q),ae=z.node(Q.v),fe=z.node(Q.w),pe,ye;ne.points?(pe=ne.points[0],ye=ne.points[ne.points.length-1]):(ne.points=[],pe=fe,ye=ae),ne.points.unshift(y.intersectRect(ae,pe)),ne.points.push(y.intersectRect(fe,ye))})}function B(z){e.forEach(z.edges(),function(Q){var ne=z.edge(Q);if(e.has(ne,"x"))switch((ne.labelpos==="l"||ne.labelpos==="r")&&(ne.width-=ne.labeloffset),ne.labelpos){case"l":ne.x-=ne.width/2+ne.labeloffset;break;case"r":ne.x+=ne.width/2+ne.labeloffset;break}})}function te(z){e.forEach(z.edges(),function(Q){var ne=z.edge(Q);ne.reversed&&ne.points.reverse()})}function Z(z){e.forEach(z.nodes(),function(Q){if(z.children(Q).length){var ne=z.node(Q),ae=z.node(ne.borderTop),fe=z.node(ne.borderBottom),pe=z.node(e.last(ne.borderLeft)),ye=z.node(e.last(ne.borderRight));ne.width=Math.abs(ye.x-pe.x),ne.height=Math.abs(fe.y-ae.y),ne.x=pe.x+ne.width/2,ne.y=ae.y+ne.height/2}}),e.forEach(z.nodes(),function(Q){z.node(Q).dummy==="border"&&z.removeNode(Q)})}function $(z){e.forEach(z.edges(),function(Q){if(Q.v===Q.w){var ne=z.node(Q.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:Q,label:z.edge(Q)}),z.removeEdge(Q)}})}function H(z){var Q=y.buildLayerMatrix(z);e.forEach(Q,function(ne){var ae=0;e.forEach(ne,function(fe,pe){var ye=z.node(fe);ye.order=pe+ae,e.forEach(ye.selfEdges,function(Me){y.addDummyNode(z,"selfedge",{width:Me.label.width,height:Me.label.height,rank:ye.rank,order:pe+ ++ae,e:Me.e,label:Me.label},"_se")}),delete ye.selfEdges})})}function I(z){e.forEach(z.nodes(),function(Q){var ne=z.node(Q);if(ne.dummy==="selfedge"){var ae=z.node(ne.e.v),fe=ae.x+ae.width/2,pe=ae.y,ye=ne.x-fe,Me=ae.height/2;z.setEdge(ne.e,ne.label),z.removeNode(Q),ne.label.points=[{x:fe+2*ye/3,y:pe-Me},{x:fe+5*ye/6,y:pe-Me},{x:fe+ye,y:pe},{x:fe+5*ye/6,y:pe+Me},{x:fe+2*ye/3,y:pe+Me}],ne.label.x=ne.x,ne.label.y=ne.y}})}function Y(z,Q){return e.mapValues(e.pick(z,Q),Number)}function ce(z){var Q={};return e.forEach(z,function(ne,ae){Q[ae.toLowerCase()]=ne}),Q}return Gv}var Yv,BN;function Fz(){if(BN)return Yv;BN=1;var e=mt(),t=cn(),r=ir().Graph;Yv={debugOrdering:s};function s(o){var a=t.buildLayerMatrix(o),u=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(a,function(c,f){var p="layer"+f;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,g){return u.setEdge(d,g,{style:"invis"}),g})}),u}return Yv}var Kv,UN;function zz(){return UN||(UN=1,Kv="0.8.5"),Kv}var Xv,HN;function Bz(){return HN||(HN=1,Xv={graphlib:ir(),layout:Dz(),debug:Fz(),util:{time:cn().time,notime:cn().notime},version:zz()}),Xv}var Uz=Bz();const WN=My(Uz),So=240,ac=130,mo=74,Lc=72,VN=mo+Lc;function Hz(e,t){var s;let r=So;for(const o of e)r=Math.max(r,((s=t.get(o.id))==null?void 0:s.width)??So);return r}const fR=420,Wz=2;function Ga(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function Vz(e,t){return((t==null?void 0:t.get(e))??0)>0?fR:0}function Gz(e,t){const r=(t==null?void 0:t.get(e))??0;return r>0?6+r*36:0}function Ya(e,t,r){const s=t.get(e);return{w:((s==null?void 0:s.width)??So)+Vz(e,r),h:Math.max((s==null?void 0:s.height)??ac,Gz(e,r))}}function Yz(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function Kz(e,t,r,s,o,a){const u=new WN.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(k=>!o.has(k)),f=new Set(c);for(const k of c){const{w:E,h:C}=Ya(k,s,a);u.setNode(k,{width:E,height:C})}for(const k of t)f.has(k.source)&&f.has(k.target)&&u.setEdge(k.source,k.target);WN.layout(u);const p=new Map;let d=1/0,g=1/0,y=-1/0,w=-1/0;for(const k of c){const E=u.node(k);if(!E)continue;const C=s.get(k),T=(C==null?void 0:C.width)??So,A=(C==null?void 0:C.height)??ac,L=Ya(k,s,a),P=E.x-L.w/2,U=E.y-L.h/2;p.set(k,{x:P,y:U}),P<d&&(d=P),U<g&&(g=U),P+T>y&&(y=P+T),U+A>w&&(w=U+A)}if(Number.isFinite(d)&&Number.isFinite(g))for(const[k,E]of p)p.set(k,{x:E.x-d,y:E.y-g});const S=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-g:0;let b=null;for(const k of e){const E=o.get(k);if(!E)continue;const C=s.get(k),T=(C==null?void 0:C.width)??So,A=(C==null?void 0:C.height)??ac;b=b===null?{minX:E.x,minY:E.y,maxX:E.x+T,maxY:E.y+A}:{minX:Math.min(b.minX,E.x),minY:Math.min(b.minY,E.y),maxX:Math.max(b.maxX,E.x+T),maxY:Math.max(b.maxY,E.y+A)}}return{positions:p,width:S,height:_,pinnedBox:b}}function Xz(e,t,r={}){const s=r.direction??"LR",o=r.pinned??new Map,a=r.measured??new Map,u=r.lanes,c=new Map;for(const k of e){const E=Ga(k),C=c.get(E);C?C.push(k.id):c.set(E,[k.id])}const p=Array.from(c.keys()).sort().map(k=>({sid:k,...Kz(c.get(k),t,s,a,o,u)})),d=Hz(e,a),g=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=k=>{const E=[[]];let C=0;for(const T of p)E.length<k&&C>0&&C+T.height>g&&(E.push([]),C=0),E[E.length-1].push(T),C+=T.height+VN;return E},w=k=>k.reduce((E,C)=>Math.max(E,C.width),0)+fR;let S=y(r.availableWidth?Wz:1);S.length>1&&S.reduce((E,C)=>E+w(C),0)+d*(S.length-1)>(r.availableWidth??0)&&(S=y(1));const _=new Map;let b=0;for(const k of S){const E=w(k);let C=0;for(const{positions:T,height:A,pinnedBox:L}of k){for(const[U,O]of T)_.set(U,{x:O.x+b,y:O.y+C});let P=C+A;L&&L.maxY>P&&L.minX<b+E&&b<L.maxX&&(P=L.maxY),C=P+VN}b+=E+d}return e.map(k=>{const E=o.get(k.id);if(E)return{...k,position:E};const C=_.get(k.id);return C?{...k,position:C}:k})}function Qz(e,t,r,s,o){const u=mo+Lc,c=60,f=w=>Ya(w,s,o),p=new Map(e.map(w=>[w.id,Ga(w)])),d=[],g=e.map(w=>({id:w.id,pos:r.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,S)=>w.pos.y-S.pos.y||w.pos.x-S.pos.x||w.id.localeCompare(S.id)),y=[];for(const{id:w,pos:S}of g){const{w:_,h:b}=f(w),k=p.get(w)??"_default";if(r.has(w)){d.push({x:S.x,y:S.y,w:_,h:b,sid:k});continue}let E=S.y;for(let C=0;C<d.length+1;C++){const T=d.find(A=>{const L=A.sid===k?24:c,P=A.sid===k?24:u;return S.x<A.x+A.w+L&&A.x<S.x+_+L&&E<A.y+A.h+P&&A.y<E+b+P});if(!T)break;E=T.y+T.h+(T.sid===k?24:u)}E!==S.y&&(t.set(w,{x:S.x,y:E}),y.push(w)),d.push({x:S.x,y:E,w:_,h:b,sid:k})}return y}function Zz(e,t,r,s,o,a){const u=_=>Ya(_,s,a),c=_=>r.get(_)??t.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=Ga(_),k=f.get(b);k?k.push(_):f.set(b,[_])}const p=new Set;for(const[_,b]of f)b.every(k=>o.has(k.id)&&!r.has(k.id))&&p.add(_);const d=new Map,g=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:k,h:E}=u(_.id),C=Ga(_);p.has(C)?(d.get(C)??d.set(C,[]).get(C)).push(_):g.push({x:b.x,y:b.y,w:k,h:E})}if(d.size===0)return[];const y=mo+Lc,w=(_,b,k,E)=>g.some(C=>_<C.x+C.w+mo&&C.x<_+k+mo&&b<C.y+C.h+y&&C.y<b+E+y),S=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let k=1/0,E=1/0,C=-1/0,T=-1/0;for(const q of b){const V=c(q.id),{w:X,h:j}=u(q.id);k=Math.min(k,V.x),E=Math.min(E,V.y),C=Math.max(C,V.x+X),T=Math.max(T,V.y+j)}const A=C-k,L=T-E,P=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,V)=>q-V),U=P.length?P:[k],O=[0,...g.map(q=>q.y+q.h+y)].sort((q,V)=>q-V);let M=null;e:for(const q of U)for(const V of O){if(V>=E)break;if(!w(q,V,A,L)){M={x:q,y:V};break e}}if(M){const q=M.x-k,V=M.y-E;for(const X of b){const j=c(X.id);t.set(X.id,{x:j.x+q,y:j.y+V})}S.push(_)}for(const q of b){const V=c(q.id),{w:X,h:j}=u(q.id);g.push({x:V.x,y:V.y,w:X,h:j})}}return S}function Jz(e,t,r,s,o,a=!1,u){const p=mo+Lc+1,d=8,g=1.75,y=200,w=.7,S=.01,_=M=>Ya(M,s,u),b=M=>r.get(M)??t.get(M),k=new Map;for(const M of e){if(!b(M.id))continue;const q=Ga(M),V=k.get(q);V?V.push(M):k.set(q,[M])}const E=[],C=new Set,T=new Set,A=o.size===0;for(const M of[...k.keys()].sort()){const q=k.get(M);let V=1/0,X=1/0,j=-1/0,G=-1/0,B=!1;for(const H of q){const I=b(H.id),{w:Y,h:ce}=_(H.id);V=Math.min(V,I.x),X=Math.min(X,I.y),j=Math.max(j,I.x+Y),G=Math.max(G,I.y+ce),r.has(H.id)&&(B=!0)}const te=j-V,Z=G-X;T.add(M);const $=o.get(M);$&&(te>$.w+d||Z>$.h+d)&&C.add(M),o.set(M,{w:te,h:Z}),E.push({sid:M,members:q.map(H=>H.id),x:V,y:X,w:te,h:Z,anchored:B,mass:1})}for(const M of[...o.keys()])T.has(M)||o.delete(M);if(a||A)return[];let L=!1;for(let M=0;M<E.length&&!L;M++)for(let q=M+1;q<E.length;q++){const V=E[M],X=E[q];if(!(V.anchored&&X.anchored)&&Math.abs(V.x+V.w/2-(X.x+X.w/2))<(V.w+X.w)/2+61&&Math.abs(V.y+V.h/2-(X.y+X.h/2))<(V.h+X.h)/2+p){L=!0;break}}if(C.size===0&&!L)return[];if(C.size>0)for(const M of E)C.has(M.sid)&&(M.mass=8);else for(const M of E)M.mass=Math.max(1,M.w*M.h/(So*ac));const P=new Map(E.map(M=>[M.sid,M.x])),U=new Map(E.map(M=>[M.sid,M.y]));for(let M=0;M<y;M++){const q=new Map,V=new Map;let X=0;for(let j=0;j<E.length;j++)for(let G=j+1;G<E.length;G++){const B=E[j],te=E[G];if(B.anchored&&te.anchored)continue;const Z=B.x+B.w/2,$=B.y+B.h/2,H=te.x+te.w/2,I=te.y+te.h/2,Y=(B.w+te.w)/2+61-Math.abs(Z-H),ce=(B.h+te.h)/2+p-Math.abs($-I);if(Y<=0||ce<=0)continue;const z=(Be,et)=>!Be.anchored&&!(et<0&&Be.x<=0),Q=(Be,et)=>!Be.anchored&&!(et<0&&Be.y<=0),ne=(Be,et,Xe)=>{const wt=Be===et,ee=wt?B.sid<te.sid?-1:1:Math.sign(Be-et);return Xe(B,ee)||Xe(te,-ee)?ee:wt&&(Xe(B,-ee)||Xe(te,ee))?-ee:0},ae=ne(Z,H,z),fe=ne($,I,Q),pe=ae!==0,ye=fe!==0;if(!pe&&!ye)continue;const Me=pe&&(!ye||Y*g<ce),[Ue,ze,Ie,ke]=Me?[ae,Y,q,z]:[fe,ce,V,Q],le=ke(B,Ue),we=ke(te,-Ue),xe=B.mass,Ye=te.mass,gt=le?we?Ye/(xe+Ye):1:0,ft=we?le?xe/(xe+Ye):1:0,ot=ze*w;Ie.set(B.sid,(Ie.get(B.sid)??0)+Ue*ot*gt),Ie.set(te.sid,(Ie.get(te.sid)??0)-Ue*ot*ft),X+=ot}for(const j of E)j.anchored||(j.x=Math.max(0,j.x+(q.get(j.sid)??0)),j.y=Math.max(0,j.y+(V.get(j.sid)??0)));if(X<S)break}const O=[];for(const M of E){const q=M.x-P.get(M.sid),V=M.y-U.get(M.sid);if(!(Math.abs(q)<1&&Math.abs(V)<1)){for(const X of M.members){if(r.has(X))continue;const j=t.get(X);j&&t.set(X,{x:j.x+q,y:j.y+V})}O.push(M.sid)}}return O}const e6=600;function Ty(e,t){return!(e.exitAt!=null&&t-e.exitAt>e6||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function t6(e,t){const r=new Set;for(const s of e.agents.values())Ty(s,t)&&r.add(s.id);return r}function n6(e,t,r=0){return e.right+r>t.left&&e.left-r<t.right&&e.bottom+r>t.top&&e.top-r<t.bottom}function r6(e,t,r=0){if(!e)return!1;for(const s of t)if(n6(e,s,r))return!0;return!1}const hR="sessionGroup";function s6(e,t){var s;if(e.type===hR)return"transparent";const r=(s=e.data)==null?void 0:s.state;return t(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const pR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line"];function GN(e){const t={};for(const r of pR)t[r]=e(r);return t}function i6(e){return t=>e[t]??""}function o6(e,t){return pR.every(r=>e[r]===t[r])}function a6(e){const t=new Set(e.pins),r=new Map,s=new Map;for(const[o,a]of e.positions)r.set(o,a),t.has(o)&&s.set(o,a);return{positions:r,pinned:s}}const l6=1200,u6=1e3;function YN(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<l6?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<u6}function Qv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function c6(e,t,r){const s=e.x*t.zoom+t.x,o=e.y*t.zoom+t.y,a=(e.x+e.width)*t.zoom+t.x,u=(e.y+e.height)*t.zoom+t.y;return a>0&&s<r.width&&u>0&&o<r.height}function d6({pane:e,viewport:t,boxes:r}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const o of r)if(s=!0,c6(o,t,e))return!1;return s}const f6="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Zv="click for what's new";function h6(e){if(e.checkDisabled)return`${f6} · ${Zv}`;if(e.checking)return`Asking npm for the newest release… · ${Zv}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",r=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${r} · re-checked periodically · ${Zv}, and to check npm now`}function p6(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:`${t} and check npm for a newer release`}function m6(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,r=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${r}`}function g6(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Ry={kind:"assumed",claude:!0,codex:!0};function v6(e){if(!e||typeof e!="object")return Ry;const t=e.providers;if(!t||typeof t!="object")return Ry;const r=t;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function lc(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const KN=99;function y6(e){const t=Math.max(0,Math.floor(e));return t>KN?`${KN}+`:String(t)}const w6="Pause the canvas";function x6(e){if(!e.paused)return"Pause live updates — events keep arriving and are applied when you resume (Space)";const t=Math.max(0,Math.floor(e.dropped??0));return t>0?`The pause is full — ${lc(e.held)} held and ${t} older ${t===1?"one":"ones"} already dropped. Resume to follow the canvas again (Space)`:e.held<=0?"Nothing has arrived since you paused. Resume to follow the canvas again (Space)":`${lc(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function _6(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const mR="paused · full",b6=(e,t)=>t>0?mR:e>0?`paused · ${y6(e)}`:"paused";function k6(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",label:b6(e.held,t),widest:mR,title:t>0?`Connected — the pause is full at ${lc(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${lc(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function XN(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const S6={agent:C$,sessionGroup:U$},gR="react-flow__node";function QN(e){var t,r;return!!e&&((r=(t=e.classList)==null?void 0:t.contains)==null?void 0:r.call(t,gR))===!0}function E6(e){try{const t=document.querySelector(`.${gR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const N6=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),C6=420,Fu=18,j6=200,T6=5*6e4,R6=6,A6=2*6e4,ZN=400,R0="agent-dag.layout",A0="agent-dag.viewport",vR="agent-dag.summariesDismissed",yR="agent-dag.sessionListOpen",wR="agent-dag.detailOpen",xR="agent-dag.usagePanelOpen",JN="agent-dag.accountsPanelOpen",Jv="agent-dag.versionNoticeDismissed",eC="agent-dag.oldNameNoticeDismissed",I6=15*6e4,ey={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:"},tC="agent-dag.autoRestart",nC="agent-dag.bundleReloadedFor";function M6(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(yR)==="1"}catch{return!1}}function O6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yR,e?"1":"0")}catch{}}function P6(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(wR)==="1"}catch{return!1}}function L6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(wR,e?"1":"0")}catch{}}function $6(){const e=yc(xR);return e===null?!0:e==="1"}function q6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(xR,e?"1":"0")}catch{}}function D6(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(vR);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(r=>typeof r=="string"):[])}catch{return new Set}}function rC(e){if(!(typeof window>"u"))try{const t=Array.from(e),r=t.length>200?t.slice(-200):t;window.localStorage.setItem(vR,JSON.stringify(r))}catch{}}function F6(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(R0);if(!t)return e;const r=JSON.parse(t);if(!("v"in r)){const o=Object.entries(r).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:o,pins:o.map(([a])=>a)}}return{positions:Object.entries(r.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(r.pins)?r.pins:[]}}catch{return e}}function ty(e,t){if(!(typeof window>"u"))try{const r={};for(const[s,o]of e)r[s]=o;for(const[s,o]of t)r[s]=o;window.localStorage.setItem(R0,JSON.stringify({v:2,positions:r,pins:Array.from(t.keys())}))}catch{}}function z6(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(A0);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function B6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(A0,JSON.stringify(e))}catch{}}function sC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(R0)}catch{}try{window.localStorage.removeItem(A0)}catch{}}}function U6(e,t){const r=e.agents.get(t);if(!r)return;const s=[];for(const d of e.agents.values())d.sessionId===t&&s.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:s.map(d=>({id:d.id,kind:d.kind,label:d.label,parentId:d.parentId,state:d.state,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,cwd:d.cwd,usage:d.usage,prompts:d.prompts,tools:d.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},a=JSON.stringify(o,null,2),u=new Blob([a],{type:"application/json"}),c=URL.createObjectURL(u),f=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=c,f.download=`${Yt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Ay={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Iy={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},_R=Hj;function H6(e,t,r,s,o,a,u,c,f,p,d,g,y,w,S,_,b,k){const E=[],C=[];for(const M of e.agents.values()){if(!b.has(M.id))continue;const q=M.exitAt!=null,V=_!=null&&!_.has(M.id),X=[q?"rf-exiting":"",V?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,j=a.get(M.id);if(E.push({id:M.id,type:"agent",position:{x:0,y:0},data:{...M,now:t,onOpenContext:k},className:X,...j?{width:j.width,height:j.height}:null}),M.parentId&&b.has(M.parentId)){const G=Zy(M.sessionId),B=q,te=S.size>0&&(S.has(M.id)||S.has(M.parentId)),Z=_!=null&&!_.has(M.id)&&!_.has(M.parentId),$=M.state==="active"?2:1.5,H=te?$+1.5:$,I=B?.2:Z?.12:1,Y=["sess-edge",M.state==="active"?"sess-live":"sess-idle",B?"rf-edge-exiting":"",te?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${M.parentId}->${M.id}`,source:M.parentId,target:M.id,animated:(M.state==="active"||te)&&!B,type:"smoothstep",style:{"--session-hue":G,strokeWidth:H,opacity:I,transition:"var(--edge-transition)"},className:Y})}}const T=new Map;for(const M of e.agents.values())M.tools.length>0&&T.set(M.id,Math.min(4,M.tools.length));const A=`${y}#lanes:${Yz(T)}`,L=E.filter(M=>eD(M.id,o,d,g));if(L.length>0||A!==w.current){if(L.length>0){const M=Xz(E,C,{direction:"LR",pinned:o,measured:a,availableWidth:r,availableHeight:s,lanes:T});for(const q of M)cT(q.id,d,g)&&nD(q.id,q.position,d,g);Zz(E,d,o,a,new Set(L.map(q=>q.id)),T)}Qz(E,d,o,a,T),w.current=A}const P=Jz(E,d,o,a,u,!f||p,T);P.length>0&&c(P),Lu(d,e.agents),Lu(g,e.agents),Lu(o,e.agents),Lu(a,Q4(e.agents.values()));const U=[];let O=!1;for(const M of E){let q=o.get(M.id)??d.get(M.id);q||(q=tD(M.id,d,g),O=!0),U.push({...M,position:q})}return O&&(w.current=""),{nodes:U,edges:C}}function W6(){return m.jsx(Xy,{children:m.jsx(V6,{})})}function V6(){var Qo,Zo,Or,Cl;const e=Ja(),t=Nt(),r=N.useState(yy)[0],s=N.useRef(r),[,o]=N.useState(0),a=N.useCallback(()=>o(F=>F+1),[]),[u,c]=N.useState(()=>new Set),[f,p]=N.useState(null),[d,g]=N.useState(null),y=N.useCallback((F,W)=>{c(ie=>{if(!W)return new Set([F]);const de=new Set(ie);return de.has(F)?de.delete(F):de.add(F),de}),p(ie=>W&&ie===F?ie:F)},[]),w=N.useCallback(()=>{c(new Set),p(null)},[]),[S,_]=N.useState(null),[b,k]=N.useState(null),E=N.useCallback(F=>k(F),[]),[C,T]=N.useState(!1),[A,L]=N.useState(!1),P=N.useState(D6)[0],[U,O]=N.useState(M6);N.useEffect(()=>{O6(U)},[U]);const[M,q]=N.useState(P6);N.useEffect(()=>{L6(M)},[M]);const[V,X]=N.useState($6);N.useEffect(()=>{q6(V)},[V]);const[j,G]=N.useState(()=>{try{const F=window.localStorage.getItem(JN);return F===null?!0:F==="1"}catch{return!0}});N.useEffect(()=>{try{window.localStorage.setItem(JN,j?"1":"0")}catch{}},[j]);const[B,te]=N.useState(null);N.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}te(F===null?!0:F==="on")},[]);const Z=N.useCallback(()=>{te(F=>{var ie;const W=F!==!0;try{localStorage.setItem("agent-dag.sound",W?"on":"off")}catch{}return W&&((ie=Me.current)==null||ie.unlock()),W})},[]),$=N.useCallback(F=>{Z()},[Z]),H=N.useRef($);H.current=$;const I=N.useRef(B);I.current=B;const[Y,ce]=N.useState(()=>S4(yc)),z=N.useRef(Y);z.current=Y;const Q=N.useRef(null),ne=N.useCallback((F,W=!1)=>{var ie,de;if((ie=Me.current)==null||ie.unlock(),Q.current!==null&&clearTimeout(Q.current),Q.current=null,!W){(de=Me.current)==null||de.play(F,!0);return}Q.current=setTimeout(()=>{var _e;Q.current=null,(_e=Me.current)==null||_e.play(F,!0)},w4)},[]),ae=N.useCallback((F,W)=>{ce(ie=>{const de={level:Va(W.level??ie[F].level),figure:iT(F,W.figure??ie[F].figure)};try{localStorage.setItem(aT[F],String(de.level)),localStorage.setItem(lT[F],de.figure)}catch{}return{...ie,[F]:de}}),ne(F,!0)},[ne]);N.useEffect(()=>()=>{Q.current!==null&&clearTimeout(Q.current)},[]);const[fe,pe]=N.useState(!1),ye=N.useRef(null),Me=N.useRef(null),[Ue,ze]=N.useState("locked");N.useEffect(()=>{const F=C4({enabled:()=>I.current===!0,prefs:()=>z.current,onState:ze});Me.current=F,ze(F.state());const W=()=>F.unlock();return window.addEventListener("pointerdown",W,{once:!0,capture:!0}),window.addEventListener("keydown",W,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",W,{capture:!0}),window.removeEventListener("keydown",W,{capture:!0})}},[]);const[Ie,ke]=N.useState(!1),[le,we]=N.useState(null),[xe,Ye]=N.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Jv)??""}catch{return""}}),[gt,ft]=N.useState(!1),ot=N.useRef(0),[Be,et]=N.useState(!1),Xe=N.useCallback((F=!1)=>(F&&(ot.current=Date.now(),et(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(W=>W.ok?W.json():null).then(W=>{W&&we(W)}).catch(()=>{}).finally(()=>{F&&et(!1)})),[]),wt=N.useCallback(()=>{Xe(Date.now()-ot.current>=I6)},[Xe]);N.useEffect(()=>{Xe();const F=window.setInterval(wt,5*6e4),W=()=>{document.visibilityState==="visible"&&wt()};return document.addEventListener("visibilitychange",W),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",W)}},[Xe,wt]),N.useEffect(()=>{Ie&&Xe()},[Ie,Xe]);const ee=(le==null?void 0:le.notice)??null,[Le,De]=N.useState(null),Re=N.useRef(!1);N.useEffect(()=>{if(Re.current)return;const F=q4(),W=D4(F),ie=B4({stored:W,running:(le==null?void 0:le.running)??null,notes:b1,remembers:F4(F)});ie.reason!=="no-version"&&(Re.current=!0,ie.record&&z4(F,ie.record),ie.show.length&&De({entries:ie.show,since:W,firstRun:ie.reason==="welcome"}))},[le==null?void 0:le.running]);const $e=(le==null?void 0:le.running)??"1.46.3",rt=N.useMemo(()=>uT(b1,null,$e),[$e]),tt=N.useCallback(()=>{De({entries:rt,since:null,firstRun:!1})},[rt]),[Ce,kt]=N.useState(null),[Ve,lt]=N.useState(Ry);N.useEffect(()=>{let F=!1;return fetch("/api/health").then(W=>W.ok?W.json():null).then(W=>{F||(lt(v6(W)),!(!W||typeof W.workspace!="string")&&kt(W.workspace))}).catch(()=>{}),()=>{F=!0}},[Ie]);const dn=N.useRef(Ve);dn.current=Ve;const wn=ee?`${ee.kind}:${ee.to}`:"",xn=ee!=null&&xe!==wn,_n=N.useCallback(()=>{Ye("");try{window.localStorage.setItem(Jv,"")}catch{}},[]),zn=N.useCallback(()=>{if(ee){Ye(wn);try{window.localStorage.setItem(Jv,wn)}catch{}}},[ee,wn]),[bn,hi]=N.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(eC)??""}catch{return""}}),fn=le!=null&&le.invokedAs&&le.invokedAs!==Yt?le.invokedAs:null,pi=fn!=null&&bn!==fn,mi=N.useCallback(()=>{if(fn){hi(fn);try{window.localStorage.setItem(eC,fn)}catch{}}},[fn]),qt=((Qo=le==null?void 0:le.upgrade)==null?void 0:Qo.state)??"idle",Sr=t4(le==null?void 0:le.upgrade),Bn=N.useRef(!1),Rs=N.useCallback(async()=>{if(js(Bn.current||qt==="running")){Bn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Xe(),Bn.current=!1}},[qt,Xe]);N.useEffect(()=>{if(qt!=="running")return;const F=window.setInterval(Xe,3e3);return()=>window.clearInterval(F)},[qt,Xe]);const Er=N.useCallback(async()=>{var ie;const F=le==null?void 0:le.command;if(!F)return;let W=!1;try{W=await Promise.race([((ie=navigator.clipboard)==null?void 0:ie.writeText(F).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{W=!1}if(!W)try{const de=document.createElement("textarea");de.value=F,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),W=document.execCommand("copy"),de.remove()}catch{W=!1}W&&(ft(!0),window.setTimeout(()=>ft(!1),1600))},[le==null?void 0:le.command]),Ao=N.useCallback(()=>{O(F=>(F||G(!1),!F))},[]),lr=N.useCallback(()=>{G(F=>(F||O(!1),!F))},[]),[Nr,ur]=N.useState(!1),[As,gi]=N.useState(0),vi=N.useRef(null),[yi,kn]=N.useState(!1),cr=N.useRef(null),[wi,xi]=N.useState(0),Bt=N.useState(()=>aD({protect:F=>FL(s.current,F)}))[0],[Cr,_i]=N.useState(!1),Zr=N.useCallback(()=>{const F=Bt.paused&&Bt.dropped>0,W=Bt.setPaused(!Bt.paused);F&&zL(s.current);for(const ie of W)s.current=P_(s.current,ie);_i(Bt.paused)},[Bt]),[xt,Io]=N.useState(Date.now()),[st,Mo]=N.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(tC)!=="0"}catch{return!0}}),Is=N.useCallback(()=>{Mo(F=>{const W=!F;try{window.localStorage.setItem(tC,W?"1":"0")}catch{}return W})},[]),[Sn,Un]=N.useState(!1),[bi,ki]=N.useState("restart"),[jr,Kt]=N.useState(null),En=N.useRef(!1),tn=N.useRef(null),ul=N.useRef(0),Si=N.useCallback(async F=>{if(!js(En.current))return;const W=(F==null?void 0:F.upgrade)===!0;En.current=!0,tn.current=Sr;const ie=++ul.current;ki(W?"npx":"restart"),Un(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ee==null?void 0:ee.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:W})})}catch{}window.setTimeout(()=>{if(ul.current===ie&&En.current){En.current=!1,Un(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},W?18e4:3e4)},[ee==null?void 0:ee.to,Sr]),cl=N.useRef(null);N.useEffect(()=>{let F=!1;for(const ie of s.current.agents.values())if(ie.state==="active"){F=!0;break}const W=r4({enabled:st,kind:ee==null?void 0:ee.kind,canRestart:(le==null?void 0:le.canRestart)===!0,busy:F,idleSince:cl.current,now:xt});cl.current=W.idleSince,W.restart&&Si()},[st,ee==null?void 0:ee.kind,le==null?void 0:le.canRestart,xt,Si]),N.useEffect(()=>{const F=le==null?void 0:le.running;let W=null,ie=null;try{W=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(nC)}catch{return}const de=e4({bundle:"1.46.3",running:F,pending:W,lastTried:ie});if(de==="reload"){try{window.sessionStorage.setItem(nC,F??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}En.current=!1,Un(!1),Kt(F??null);const _e=window.setTimeout(()=>Kt(null),6e3);return()=>window.clearTimeout(_e)},[le==null?void 0:le.running]),N.useEffect(()=>{if(Sn&&n4({asked:tn.current,reported:Sr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}En.current=!1,Un(!1)}},[Sn,Sr]);const Ms=N.useState(()=>a6(F6()))[0],Mt=N.useRef(Ms.pinned),dr=N.useRef(null),Tr=N.useState(()=>z6())[0],[dl,$c]=N.useState(()=>new Set),[Rr,Oo]=N.useState(uD),[Hn,Os]=N.useState(()=>GN(XN)),fl=N.useMemo(()=>i6(Hn),[Hn]),Po=N.useCallback(F=>s6(F,fl),[fl]),Je=N.useMemo(()=>({background:Hn["--panel"],border:`1px solid ${Hn["--line"]}`,borderRadius:8}),[Hn]),[Lo,hl]=N.useState(!1);N.useEffect(()=>{document.documentElement.dataset.theme=Rr;try{window.localStorage.setItem(dT,Rr)}catch{}Os(F=>{const W=GN(XN);return o6(F,W)?F:W})},[Rr]);const Wn=N.useCallback((F,W)=>{if(Qv({durationMs:W,documentHidden:document.hidden})){e.setViewport(F,{duration:W});return}const{d3Zoom:ie,d3Selection:de}=t.getState(),_e=de==null?void 0:de.property("__zoom");if(ie&&de&&_e&&_e.k>0&&F.zoom>0){ie.transform(de,_e.scale(F.zoom/_e.k).translate((F.x-_e.x)/F.zoom,(F.y-_e.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,t]),Jr=N.useRef(null);N.useEffect(()=>{if(!Tr)return;const F=window.setTimeout(()=>{try{Wn(Tr,0)}catch{}Nn.current=Date.now()},60);return()=>window.clearTimeout(F)},[Wn,Tr]);const $o=N.useRef(!0);N.useEffect(()=>{const F=new EventSource("/events"),W=iD(a,{now:()=>Date.now(),setTimeout:(ie,de)=>window.setTimeout(ie,de),clearTimeout:ie=>window.clearTimeout(ie)});return F.addEventListener("open",()=>{ke(!0),hl(!0)}),F.addEventListener("error",()=>ke(!1)),F.addEventListener("replay-end",()=>{$o.current=!1,W.flush()}),F.addEventListener("hook",ie=>{var de;try{const _e=JSON.parse(ie.data);if(!Bt.accept(_e))return;s.current=P_(s.current,_e);const Se=_e.replay===!0||$o.current||Date.now()-_e.receivedAt>3e4;Se?W.replay():W.live();const Fe=N4(_e,Se);Fe&&((de=Me.current)==null||de.play(Fe))}catch{}}),()=>{F.close(),W.cancel()}},[a]),N.useEffect(()=>{const F=setInterval(()=>{const W=Date.now();Io(W);let ie=BL(s.current,W,O_);UL(s.current,W,O_)&&(ie=!0),qL(s.current,W,j6,T6)&&(ie=!0),DL(s.current,W,R6,A6)&&(ie=!0),c(de=>X4(de,s.current.agents)),p(de=>de!=null&&!s.current.agents.has(de)?null:de),ie&&a()},250);return()=>clearInterval(F)},[a]);const Ei=N.useRef(null),Nn=N.useRef(0),Ni=420,jt=N.useCallback((F=500)=>{try{const Se=document.querySelector(".canvas-wrap"),Fe=Array.from(document.querySelectorAll(".react-flow__node")).filter(nt=>nt.offsetWidth>0);if(!Se||Fe.length===0)return;const Ke=Se.getBoundingClientRect(),ht=e.getViewport();if(!Number.isFinite(ht.zoom)||ht.zoom<=0)return;const at=nt=>(nt-Ke.left-ht.x)/ht.zoom,Ut=nt=>(nt-Ke.top-ht.y)/ht.zoom,os=Fe.map(nt=>nt.getBoundingClientRect()),Jo=Math.min(...os.map(nt=>at(nt.left))),jl=Math.max(...os.map(nt=>at(nt.right))),ea=Math.min(...os.map(nt=>Ut(nt.top))),Wc=Math.max(...os.map(nt=>Ut(nt.bottom))),Tl=jl-Jo,ta=Wc-ea;if(!(Tl>0&&ta>0))return;const Fs=Math.max(.2,Math.min(1,(Ke.width-160)/(Tl+Ni)*.86,(Ke.height-160)/ta*.86)),zs={x:80-Jo*Fs,y:Math.max(80,(Ke.height-ta*Fs)/2)-ea*Fs,zoom:Fs};Wn(zs,F),Nn.current=Date.now(),Jr.current=Qv({durationMs:F,documentHidden:document.hidden})?{target:zs,until:Date.now()+F+60}:null,window.setTimeout(()=>{var nt;try{((nt=Jr.current)==null?void 0:nt.target)===zs&&(Jr.current=null);const as=e.getViewport();(Math.abs(as.zoom-Fs)>.01||Math.abs(as.x-zs.x)>2)&&Wn(zs,0)}catch{}},F+60)}catch{}},[e,Wn]);N.useEffect(()=>{const F=()=>{if(!document.hidden)return;const W=Jr.current;if(Jr.current=null,!(!W||Date.now()>W.until)){try{Wn(W.target,0)}catch{}Nn.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[Wn]);const Cn=N.useRef(""),jn=N.useRef(null),es=N.useRef(0),fr=N.useCallback(()=>{es.current=Date.now()},[]),Tn=N.useRef(null),pl=N.useRef(0),Ci=N.useCallback(()=>{pl.current=Date.now()},[]),ts=N.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:Nn.current,lastCanvasInputAt:pl.current}),[]),qo="agent-dag.autoFitDisabled",Do=N.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(qo)==="1"}catch{return!1}})[0],Vn=N.useRef(Do),[Fo,ml]=N.useState(Do),Ar=N.useCallback(()=>{if(!Vn.current){Vn.current=!0,ml(!0);try{window.localStorage.setItem(qo,"1")}catch{}}},[]),Ps=N.useCallback(()=>{Vn.current=!1,ml(!1);try{window.localStorage.removeItem(qo)}catch{}jt(400)},[e,jt]);N.useEffect(()=>{const F=setInterval(()=>{if(Vn.current||Date.now()-es.current<800)return;const W=s.current,ie=Date.now(),de=[];for(const Se of W.agents.values())Ty(Se,ie)&&de.push({id:Se.id});if(de.length===0)return;const _e=[];for(const{id:Se}of de){const Fe=Gn.current.get(Se),Ke=Mt.current.get(Se)??Xt.current.get(Se);!Fe||!Ke||_e.push({x:Ke.x,y:Ke.y,width:Fe.width,height:Fe.height})}d6({pane:Tn.current,viewport:e.getViewport(),boxes:_e})&&jt(600)},1500);return()=>clearInterval(F)},[e]);const hr=N.useRef(!1),Gn=N.useRef(new Map),gl=N.useRef(0),qc=N.useCallback(F=>{const W=Gn.current;let ie=!1;for(const de of F.nodeInternals.values()){const _e=de.width,Se=de.height;if(_e==null||Se==null)continue;const Fe=W.get(de.id);Fe?(Math.abs(Fe.height-Se)>4||Math.abs(Fe.width-_e)>4)&&(W.set(de.id,{width:_e,height:Se}),ie=!0):(W.set(de.id,{width:_e,height:Se}),ie=!0)}return ie&&(gl.current+=1),gl.current},[]),ji=it(qc),[Ls,zo]=N.useState(0);N.useEffect(()=>{let F=0;const W=()=>{const de=Gn.current;let _e=!1;for(const Se of document.querySelectorAll(".react-flow__node[data-id]")){const Fe=Se.getAttribute("data-id");if(!Fe)continue;const Ke=Se.offsetWidth,ht=Se.offsetHeight;if(!Ke||!ht)continue;const at=de.get(Fe);(!at||Math.abs(at.width-Ke)>4||Math.abs(at.height-ht)>4)&&(de.set(Fe,{width:Ke,height:ht}),_e=!0)}_e&&zo(Se=>Se+1)};if(hr.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(W,32):F=requestAnimationFrame(W),()=>{cancelAnimationFrame(F),window.clearTimeout(ie)}});const Xt=N.useRef(Ms.positions),pr=N.useRef(new Set),$s=N.useRef(""),Yn=N.useMemo(()=>{const F=[];for(const W of s.current.agents.values())Ty(W,xt)&&F.push(W.id+(W.parentId?`>${W.parentId}`:""));return F.sort(),`${F.join("|")}#sv${ji}.${Ls}`},[s.current,s.current.revision,xt,ji,Ls]),ns=N.useRef(null);N.useEffect(()=>(ns.current!=null&&window.clearTimeout(ns.current),ns.current=window.setTimeout(()=>{ty(Xt.current,Mt.current)},1500),()=>{ns.current!=null&&window.clearTimeout(ns.current)}),[Yn]),N.useEffect(()=>{if(Cn.current===Yn)return;const F=Cn.current;if(Cn.current=Yn,!F||Vn.current)return;Date.now()-Nn.current>1200&&jt(400),Ei.current&&window.clearTimeout(Ei.current),Ei.current=window.setTimeout(()=>{Vn.current||jt(500)},280)},[Yn,e,jt]);const rs=N.useMemo(()=>J4(s.current,u),[s.current,s.current.revision,u]),ss=N.useMemo(()=>t6(s.current,xt),[s.current,s.current.revision,xt]),Bo=N.useRef(null),[Ot,Ir]=N.useState({w:0,h:0});N.useEffect(()=>{const F=Bo.current;if(!F||typeof ResizeObserver>"u")return;const W=new ResizeObserver(ie=>{var _e;const de=(_e=ie[0])==null?void 0:_e.contentRect;de&&(Tn.current={width:de.width,height:de.height},Ir(Se=>Math.abs(Se.w-de.width)>40||Math.abs(Se.h-de.height)>40?{w:de.width,h:de.height}:Se))});return W.observe(F),Tn.current={width:F.clientWidth,height:F.clientHeight},Ir({w:F.clientWidth,h:F.clientHeight}),()=>W.disconnect()},[]);const Uo=N.useCallback(F=>{var ie,de;const W=F.target;!(W!=null&&W.closest)||W.closest(N6)!==F.currentTarget||(F.preventDefault(),(de=(ie=document.activeElement)==null?void 0:ie.blur)==null||de.call(ie))},[]),qs=N.useRef(new Map),[vl,Ho]=N.useState(!1);N.useEffect(()=>{const F=window.setTimeout(()=>Ho(!0),2500);return()=>window.clearTimeout(F)},[]);const[Wo,Mr]=N.useState(!1),hn=N.useRef(null),[Ti,yl]=N.useState(!1),Dc=N.useCallback(()=>{hn.current&&(window.clearTimeout(hn.current),hn.current=null),Mr(!1)},[]),Fc=N.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{Mr(!0),hn.current&&window.clearTimeout(hn.current),hn.current=window.setTimeout(()=>Mr(!1),C6+80)})},[]);N.useEffect(()=>()=>{hn.current&&window.clearTimeout(hn.current)},[]);const Ri=Ot.w>0?Ot.w*.92:0,wl=Ot.h>0?Ot.h:0,{nodes:mr,edges:zc}=N.useMemo(()=>H6(s.current,xt,Ri,wl,Mt.current,Gn.current,qs.current,Fc,vl,Ti,Xt.current,pr.current,Yn,$s,u,rs,ss,E),[s.current,s.current.revision,xt,Ri,wl,vl,Ti,Yn,u,rs,ss,E,As]),xl=N.useMemo(()=>{const F=new Map;for(const ie of mr){const de=ie.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const _e=ie.width,Se=ie.height;if(_e==null||Se==null)continue;const Fe=ie.position.x,Ke=ie.position.y,ht=Fe+_e,at=Ke+Se,Ut=F.get(de.sessionId);Ut?(Ut.minX=Math.min(Ut.minX,Fe),Ut.minY=Math.min(Ut.minY,Ke),Ut.maxX=Math.max(Ut.maxX,ht),Ut.maxY=Math.max(Ut.maxY,at)):F.set(de.sessionId,{minX:Fe,minY:Ke,maxX:ht,maxY:at})}const W=[];for(const[ie,de]of F){const _e=de.maxX-de.minX+Fu*2,Se=de.maxY-de.minY+Fu*2;W.push({id:`group:${ie}`,type:hR,position:{x:de.minX-Fu,y:de.minY-Fu},data:{sessionId:ie,w:_e,h:Se},width:_e,height:Se,style:{width:_e,height:Se},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return W},[mr,xt]),Bc=N.useMemo(()=>{const F=[...xl,...mr],W=cr.current;return!W||W.size===0?F:F.map(ie=>{const de=W.get(ie.id);return de?{...ie,position:de}:ie})},[xl,mr,wi]),Ds=N.useMemo(()=>{const F=new Set;for(const W of s.current.agents.values())for(const ie of W.tools)F.add(_R(ie.name));return Object.keys(Ay).filter(W=>F.has(W))},[s.current,s.current.revision]);N.useEffect(()=>{if(Ds.length<=1){kn(!1);return}let F=0;const W=()=>{const ie=vi.current;if(ie&&!document.hidden){const de=ie.getBoundingClientRect(),_e=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Fe=>Fe.getBoundingClientRect()),Se=r6(de,_e,8);kn(Fe=>Fe===Se?Fe:Se)}F=window.setTimeout(W,300)};return W(),()=>window.clearTimeout(F)},[Ds.length]);const Uc=N.useCallback(F=>{$c(W=>{const ie=new Set(W);return ie.has(F)?ie.delete(F):ie.add(F),ie})},[]),Qt=f?s.current.agents.get(f):null,Vo=d?Array.from(s.current.agents.values()).flatMap(F=>F.tools).find(F=>F.id===d)??null:null,_l=N.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=yy(),Mt.current.clear(),Gn.current.clear(),Xt.current.clear(),$s.current="",sC(),w(),a()},[a,w]),Ai=N.useRef(C);Ai.current=C;const bl=N.useRef(A);bl.current=A;const Go=N.useRef(!1);Go.current=Vo!=null||Nr||b!=null||S!=null||A||Le!=null;const Ii=N.useCallback(F=>{const W=s4(F,{confirmOpen:Ai.current,modalOpen:Go.current});W==="confirm"?T(!0):W==="clear"&&(T(!1),_l())},[_l]),Mi=N.useCallback(()=>{Mt.current.clear(),Xt.current.clear(),$s.current="",sC(),a(),window.setTimeout(()=>jt(500),80)},[a,e,jt]),kl=N.useCallback(()=>jt(500),[jt]),Oi=N.useRef(mr);Oi.current=mr;const Sl=N.useRef(f);Sl.current=f;const Yo=N.useCallback(F=>{const W=Oi.current,ie=W4(W.map(Se=>({id:Se.id,x:Se.position.x,y:Se.position.y})),Sl.current,F),de=ie?W.find(Se=>Se.id===ie):void 0;if(!de)return;const _e=QN(document.activeElement);y(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}Nn.current=Date.now(),_e&&E6(de.id)},30)},[y,e]),El=N.useCallback(F=>{y(F,!1),window.setTimeout(()=>{try{const W=Oi.current.find(ie=>ie.id===F);W&&e.fitView({padding:.3,duration:500,nodes:[W]}),Nn.current=Date.now()}catch{}},60)},[y,e]);N.useEffect(()=>{const F=W=>{var Ke,ht;const ie=W.target,de={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(Ke=ie==null?void 0:ie.getAttribute)==null?void 0:Ke.call(ie,"role"),type:ie==null?void 0:ie.type};if(W.key==="Escape"){const at=c$({overlayOpen:po.depth()>0,panelOnTop:po.topIsPanel(),typing:t0(de)});at==="dismiss"?po.dismissTop():at==="blur"?ie==null||ie.blur():(K4(de)&&(ie==null||ie.blur()),w());return}if(e0(W))return;const _e=QN(ie)?(ht=ie==null?void 0:ie.getAttribute)==null?void 0:ht.call(ie,"data-id"):null,Se=_e&&Oi.current.some(at=>at.id===_e)?_e:null,Fe=G4(W,Se);if(Fe.kind==="activate"){W.preventDefault(),y(Fe.nodeId,Fe.additive);return}Fe.kind!=="node"&&(Fe.nodeId==null&&y$(de)||w$({key:W.key,modalOpen:Go.current,sheetOpen:bl.current})||(W.key===" "&&(W.preventDefault(),Zr()),(W.key==="c"||W.key==="C")&&Ii("shortcut"),(W.key==="r"||W.key==="R")&&Mi(),(W.key==="f"||W.key==="F")&&kl(),(W.key==="l"||W.key==="L")&&Ao(),(W.key==="h"||W.key==="H")&&ur(at=>!at),(W.key==="u"||W.key==="U")&&X(at=>!at),(W.key==="a"||W.key==="A")&&dn.current.claude&&lr(),(W.key==="j"||W.key==="J")&&Yo(1),(W.key==="k"||W.key==="K")&&Yo(-1),(W.key==="t"||W.key==="T")&&Oo(at=>at==="dark"?"light":"dark"),(W.key==="m"||W.key==="M")&&dn.current.claude&&I.current!==null&&H.current(W.shiftKey),W.key==="?"&&L(at=>!at)))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[Ii,Mi,kl,w,y,Yo,Zr]);const Ko=s.current.agents.size,Kn=N.useMemo(()=>R3(s.current.agents.values()),[s.current,s.current.revision]),Pi=N.useMemo(()=>A3(s.current.agents.values()),[s.current,s.current.revision]),is=N.useRef(null);N.useEffect(()=>{const F=cD({waiting:Kn.length,running:Pi}),W=is.current;if(is.current=F,(W==null?void 0:W.title)!==F.title&&(document.title=F.title),(W==null?void 0:W.icon)!==F.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=dD[F.icon])}},[Kn.length,Pi]);const[Hc,Nl]=N.useState(""),Xo=hD(Kn);N.useEffect(()=>{Nl(F=>pD(F,Xo))},[Xo]);const Zt=N.useMemo(()=>Kj(s.current.agents.values()),[s.current,s.current.revision]);return m.jsxs("div",{className:"app",children:[m.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),m.jsxs("header",{className:"topbar",children:[m.jsxs("div",{className:"readout",children:[m.jsxs("div",{className:"brand",children:[m.jsx("span",{className:"logo"}),m.jsx("h1",{children:Yt}),ee?m.jsxs("button",{type:"button",className:"v stale",onClick:()=>{tt(),_n()},"aria-haspopup":"dialog","aria-label":m6({...ee,open:xn}),title:ee.kind==="restart"?`Running v${ee.from}; v${ee.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${ee.from}; v${ee.to} is on npm · click for what's new`,children:["v",ee.from,m.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:$e,latest:le==null?void 0:le.latest,latestPending:le==null?void 0:le.latestPending,checkedAgo:le!=null&&le.checkedAt?by(xt-le.checkedAt):null,checkDisabled:le==null?void 0:le.checkDisabled,checking:Be};return m.jsxs("button",{type:"button",className:Be?"v checking":"v",onClick:()=>{tt(),Xe(!0)},"aria-busy":Be||void 0,"aria-haspopup":"dialog","aria-label":p6(F),title:h6(F),children:["v",F.running]})})()]}),m.jsxs("span",{className:"status",children:[(()=>{const F=k6({connected:Ie,paused:Cr,held:Bt.size,dropped:Bt.dropped});return m.jsx("span",{className:`pill ${F.tone}`,title:F.title,children:m.jsxs("span",{className:"pill-box",children:[m.jsx("span",{className:"pill-widest","aria-hidden":!0,children:F.widest}),m.jsx("span",{className:"pill-label",children:F.label})]})})})(),m.jsx(nq,{usageOpen:V}),Zt.sum>0&&m.jsxs("span",{className:"stat",title:`in:${Zt.inputTokens.toLocaleString()} out:${Zt.outputTokens.toLocaleString()} cache-r:${Zt.cacheReadTokens.toLocaleString()} cache-c:${Zt.cacheCreateTokens.toLocaleString()}
88
88
 
89
89
  ${ic}`,children:[m.jsx("span",{className:"count",children:At(Zt.sum)}),m.jsx("span",{className:"lbl",children:N3})]}),Zt.cost.total>0&&(()=>{let F=0,W=0;for(const _e of s.current.agents.values()){if(_e.state!=="active")continue;const Se=vn(_e);F+=Se.total,W=Math.max(W,((_e.endedAt??xt)-_e.startedAt)/1e3)}const ie=W>0?rc(F,W):null,de=`input ${Ge(Zt.cost.input)} + output ${Ge(Zt.cost.output)} + cache r ${Ge(Zt.cost.cacheRead)} + cache w ${Ge(Zt.cost.cacheWrite)}${ie?`
90
90
  active burn: ${ie}`:""}
@@ -40,7 +40,7 @@
40
40
  document.documentElement.setAttribute("data-theme", stored === "light" ? "light" : "dark");
41
41
  })();
42
42
  </script>
43
- <script type="module" crossorigin src="/assets/index-C8j9Sm-C.js"></script>
43
+ <script type="module" crossorigin src="/assets/index-CifRQYMu.js"></script>
44
44
  <link rel="stylesheet" crossorigin href="/assets/index-BQgkpz9j.css">
45
45
  </head>
46
46
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-dag",
3
- "version": "1.46.2",
3
+ "version": "1.46.3",
4
4
  "description": "Live deck of Claude Code and Codex agents — watch tool calls, token spend and every Claude Code subagent on one calm canvas. Run it with npx ccdeck.",
5
5
  "type": "module",
6
6
  "bin": {