agent-dag 1.36.2 → 1.36.4
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/bin/deck.js
CHANGED
|
@@ -446,17 +446,6 @@ async function reportStartup(jobs) {
|
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
// Everything above is once-per-session setup — hook install, tool probes,
|
|
450
|
-
// registry lookups, and the banner it now runs underneath. A respawn is the
|
|
451
|
-
// same session continuing, so it skips the lot and prints one line instead.
|
|
452
|
-
// This is the difference between a restart that feels instant and one that
|
|
453
|
-
// makes you wonder whether it worked.
|
|
454
|
-
if (!RESPAWN) {
|
|
455
|
-
const jobs = startupWork();
|
|
456
|
-
await printBanner();
|
|
457
|
-
await reportStartup(jobs);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
449
|
// Asking the supervisor to bring us back. It is the only party that can, and
|
|
461
450
|
// only after this process is gone — which is precisely what keeps the
|
|
462
451
|
// replacement from racing this listener onto a random fallback port.
|
|
@@ -472,20 +461,22 @@ let upgradeTimer = null;
|
|
|
472
461
|
//
|
|
473
462
|
// The server below starts accepting connections from inside startServer, before
|
|
474
463
|
// that call has returned — so /api/restart is reachable for the whole of the
|
|
475
|
-
// boot that follows it: the port report to the supervisor,
|
|
476
|
-
// and its first fsynced write, and on a cold start the
|
|
477
|
-
// landing in that window used to reach `shutdown`
|
|
478
|
-
// was initialised and die of a ReferenceError,
|
|
479
|
-
// above, with nothing left to clear it — after
|
|
480
|
-
// tab was answered "ok" and did nothing, for the
|
|
464
|
+
// boot that follows it: the startup report, the port report to the supervisor,
|
|
465
|
+
// the discovery file and its first fsynced write, and on a cold start the
|
|
466
|
+
// browser spawn. A restart landing in that window used to reach `shutdown`
|
|
467
|
+
// before the binding holding it was initialised and die of a ReferenceError,
|
|
468
|
+
// having already set the latch above, with nothing left to clear it — after
|
|
469
|
+
// which every restart from every tab was answered "ok" and did nothing, for the
|
|
470
|
+
// life of the process (#448).
|
|
481
471
|
//
|
|
482
|
-
// So an ask that arrives too early is held rather than run: the
|
|
483
|
-
//
|
|
484
|
-
//
|
|
485
|
-
//
|
|
486
|
-
//
|
|
487
|
-
//
|
|
488
|
-
// of it.
|
|
472
|
+
// So an ask that arrives too early is held rather than run: the user asked for
|
|
473
|
+
// something this deck can genuinely give a moment later, and refusing outright
|
|
474
|
+
// would put back the same silence in a politer form. BOOT_RESTART_MS is the
|
|
475
|
+
// outer bound, for the reason UPGRADE_ANSWER_MS above is one — and since #483
|
|
476
|
+
// moved the listen in front of the report, it is a bound that gets used: a boot
|
|
477
|
+
// waiting out a real `uv tool install` is minutes long, and the restart is the
|
|
478
|
+
// right answer to it rather than a casualty of it. Ten seconds in, the ask is
|
|
479
|
+
// run; the respawn skips the report entirely and is up in about a second.
|
|
489
480
|
let booted = false;
|
|
490
481
|
let heldRestart = null;
|
|
491
482
|
let bootTimer = null;
|
|
@@ -626,18 +617,69 @@ let server = null;
|
|
|
626
617
|
let discovery = null;
|
|
627
618
|
let discoveryFile = null;
|
|
628
619
|
|
|
620
|
+
// The listen, begun HERE and awaited below the startup report rather than after
|
|
621
|
+
// it. The report is a narration; the port is the product, and it was queued
|
|
622
|
+
// behind three tool probes for no reason but the order these two statements
|
|
623
|
+
// were written in (#483).
|
|
624
|
+
//
|
|
625
|
+
// What that cost: `reportStartup` awaits `ensureCswap`, which on a machine with
|
|
626
|
+
// no Python tooling runs a real `uv tool install` under a 180-second timeout. So
|
|
627
|
+
// the deck printed its rows and then refused every connection until that install
|
|
628
|
+
// was over — on a first run, which is the one boot a new user judges the tool by.
|
|
629
|
+
// #476 stopped that job blocking the event loop; the socket was shut either way,
|
|
630
|
+
// because the bind had not been attempted yet.
|
|
631
|
+
//
|
|
632
|
+
// Nothing in the report has to finish before the socket opens, and the window
|
|
633
|
+
// this opens is narrow on purpose — the discovery file and the browser are both
|
|
634
|
+
// still written after the report, so the only callers who can arrive inside it
|
|
635
|
+
// are a tab left open by an earlier deck and the user's own curl:
|
|
636
|
+
//
|
|
637
|
+
// • the event log is replayed and the sequence counter primed INSIDE
|
|
638
|
+
// startServer, before it binds — so /events and /api/events answer from a
|
|
639
|
+
// full buffer from the first connection, not a growing one.
|
|
640
|
+
// • the hook install can only make hooks fire; a hook that fires early finds
|
|
641
|
+
// no discovery file and posts nowhere, exactly as it does today.
|
|
642
|
+
// • claude-swap: cswapBin memoizes only a lookup that WORKED, so a probe
|
|
643
|
+
// landing mid-install caches nothing and the next one asks again — see
|
|
644
|
+
// resetCswapBin's note. The accounts panel can report the tool missing for
|
|
645
|
+
// the second it is missing, and answers properly the moment it is not.
|
|
646
|
+
// • ccusage: getRunner awaits the very `_installing` promise primeCcusage
|
|
647
|
+
// started, so a request in this window joins that install rather than
|
|
648
|
+
// racing a second one.
|
|
649
|
+
//
|
|
650
|
+
// Settled into a tagged result rather than left bare, for the reason every job
|
|
651
|
+
// in startupWork carries its own handler: this promise now lives across the
|
|
652
|
+
// whole report, and a bind that fails in there with nothing attached to it is an
|
|
653
|
+
// unhandledRejection — which Node answers by killing the process over a port it
|
|
654
|
+
// could have named.
|
|
629
655
|
const starting = startServer({
|
|
630
656
|
port, persist, workspace, codex: wantCodex, claude: wantClaude,
|
|
631
657
|
// Withheld when nothing is supervising us: without a parent, exiting is just
|
|
632
658
|
// exiting, and /api/restart answers 501 so the UI hides the control.
|
|
633
659
|
onRestart: SUPERVISED ? requestRestart : null,
|
|
634
|
-
});
|
|
635
|
-
|
|
660
|
+
}).then(s => ({ ok: true, s }), err => ({ ok: false, err }));
|
|
661
|
+
|
|
662
|
+
// Once-per-session setup — hook install, tool probes, registry lookups, and the
|
|
663
|
+
// banner it runs underneath. A respawn is the same session continuing, so it
|
|
664
|
+
// skips the lot and prints one line instead. This is the difference between a
|
|
665
|
+
// restart that feels instant and one that makes you wonder whether it worked.
|
|
666
|
+
if (!RESPAWN) {
|
|
667
|
+
const jobs = startupWork();
|
|
668
|
+
await printBanner();
|
|
669
|
+
await reportStartup(jobs);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Usually settled long ago by the time we get here, which is the point: `step`
|
|
673
|
+
// paints nothing for a promise that has already resolved, so the spinner this
|
|
674
|
+
// used to show is simply gone from the boots that were slow enough to need one.
|
|
675
|
+
const bound = await (RESPAWN ? starting : step(`starting server${G.ellipsis}`, starting));
|
|
676
|
+
if (!bound.ok) {
|
|
636
677
|
// stderr, not a row: a deck that could not bind is not a status line, and
|
|
637
678
|
// whatever launched it reads this stream.
|
|
638
|
-
console.error(`${PRODUCT}: server failed: ${err.message}`);
|
|
679
|
+
console.error(`${PRODUCT}: server failed: ${bound.err.message}`);
|
|
639
680
|
process.exit(1);
|
|
640
|
-
}
|
|
681
|
+
}
|
|
682
|
+
server = bound.s;
|
|
641
683
|
const addr = server.address();
|
|
642
684
|
const realPort = typeof addr === "object" && addr ? addr.port : port;
|
|
643
685
|
const url = `http://127.0.0.1:${realPort}`;
|
|
@@ -749,13 +791,13 @@ runHeldRestart();
|
|
|
749
791
|
* A declaration, not the `const` arrow this was for eight months.
|
|
750
792
|
*
|
|
751
793
|
* The difference is the whole of #448: a const is in its temporal dead zone
|
|
752
|
-
* until the line declaring it runs, and every line above — the
|
|
753
|
-
* discovery file, the browser spawn — executes with the
|
|
754
|
-
* accepting connections. A restart arriving in that window
|
|
755
|
-
* `ReferenceError: Cannot access 'shutdown' before
|
|
756
|
-
* latch it had already set is what made that
|
|
757
|
-
* hoisted, so from the first instruction of this
|
|
758
|
-
* here to call.
|
|
794
|
+
* until the line declaring it runs, and every line above — the startup report,
|
|
795
|
+
* the port report, the discovery file, the browser spawn — executes with the
|
|
796
|
+
* server already accepting connections. A restart arriving in that window
|
|
797
|
+
* called this and got `ReferenceError: Cannot access 'shutdown' before
|
|
798
|
+
* initialization`, and the latch it had already set is what made that
|
|
799
|
+
* permanent. A declaration is hoisted, so from the first instruction of this
|
|
800
|
+
* module there is a function here to call.
|
|
759
801
|
*
|
|
760
802
|
* Hoisting alone would only have moved the fault one line down, onto `server`,
|
|
761
803
|
* `discovery` and `discoveryFile` — which is why those are `let … = null` above
|
|
@@ -70,7 +70,7 @@ Claude Code turns only. The sound is a Stop hook Claude Code runs itself when a
|
|
|
70
70
|
|
|
71
71
|
${t.clash} sound hook${t.clash>1?"s":""} of your own in settings.json also run${t.clash>1?"":"s"} here.`:"",a=t.parked>0?`
|
|
72
72
|
|
|
73
|
-
${t.parked} of your own sound hook${t.parked>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${t.parked>1?"them":"it"} back.`:"";return r+i+o+a}function nj(e){const t=new Map;for(const r of e)for(const i of r.agents??[]){if(!i||typeof i.agent!="string"||i.agent==="")continue;const o=t.get(i.agent)??{id:i.agent,cost:0,tokens:0};o.cost+=Number.isFinite(i.totalCost)?i.totalCost:0,o.tokens+=Number.isFinite(i.totalTokens)?i.totalTokens:0,t.set(i.agent,o)}return[...t.values()].sort((r,i)=>i.cost-r.cost||r.id.localeCompare(i.id))}function pq(e){const t=nj([{agents:e}]);return t.length<2?null:t.map(r=>`${gy(r.id)} ${qe(r.cost)}`).join(" · ")}function j_(e){switch(e.toLowerCase()){case"claude":return"#c4b5fd";case"codex":return"#fdba74";case"gemini":return"#a5b4fc";case"copilot":return"#86efac";default:return"#94a3b8"}}function mq(e,t){if(!(t>0)||!(e>0))return"0%";const r=e/t*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function lu(e){const t=e.toLowerCase();return t.includes("opus")?"#c4b5fd":t.includes("sonnet")?"#7dd3fc":t.includes("haiku")?"#86efac":t.includes("gpt-5")||t.includes("gpt5")?"#fcd34d":t.includes("gpt")?"#fca5a5":t.includes("gemini")?"#a5b4fc":t.includes("codex")?"#fdba74":"#94a3b8"}const gq=[7,14,30,90];function vq(e){const[t,r]=R.useState(null),[i,o]=R.useState(!1),a=R.useRef(sq()).current,u=(c=!1)=>{const f=a.begin(),p=e;o(!0);const g=`/api/ccusage?since=${iq(p)}${c?"&refresh=1":""}`;fetch(g).then(y=>y.json()).then(y=>{f()&&r({range:p,resp:y})}).catch(()=>{f()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{f()&&o(!1)})};return R.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:i,reload:()=>u(!0)}}function yq({onClose:e,providers:t}){var P;const[r,i]=R.useState(30),[o,a]=R.useState(null),{landed:u,loading:c,reload:f}=vq(r),p=R.useRef(null),d=wo(e,{focusRef:p}),g=oq({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((P=u.resp.days)==null?void 0:P.length)??0}}),y=g.phase==="chart"?u.resp.days??[]:[],w=R.useMemo(()=>y.reduce((O,D)=>Math.max(O,D.totalCost),0),[y]),{totalCost:E,totalTok:_,inOut:b,cacheRead:S,modelCosts:k}=R.useMemo(()=>{let O=0,D=0,L=0,U=0;const V=new Map;for(const z of y){O+=z.totalCost,D+=z.totalTokens,L+=z.inputTokens+z.outputTokens,U+=z.cacheReadTokens;for(const C of z.modelBreakdowns)V.set(C.modelName,(V.get(C.modelName)??0)+C.cost)}return{totalCost:O,totalTok:D,inOut:L,cacheRead:U,modelCosts:V}},[y]),N=R.useMemo(()=>Array.from(k.entries()).sort((O,D)=>D[1]-O[1]),[k]),j=R.useMemo(()=>nj(y),[y]),A=j.length>1,M=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:lq(t,j.map(O=>O.id))})]}),m.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:gq.map(O=>m.jsxs("button",{type:"button","aria-pressed":r===O,className:`uh-range-btn${r===O?" on":""}`,onClick:()=>{i(O),a(null)},children:[O,"d"]},O))}),m.jsx("button",{className:"btn icon-btn uh-reload",onClick:f,disabled:c,title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),m.jsx("button",{ref:p,className:"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:vo(u.resp)||void 0,children:[u3(u.resp,"ccusage did not report usage"),m.jsx("div",{children:m.jsx("button",{className:"btn uh-retry",onClick:f,disabled: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(uu,{label:"total cost",val:qe(E),accent:!0}),m.jsx(uu,{label:"tokens",val:Nt(_)}),m.jsx(uu,{label:"input+output",val:Nt(b)}),m.jsx(uu,{label:"cache reads",val:Nt(S)})]}),A&&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:j.map(O=>m.jsx("span",{className:"uh-agent-seg",style:{width:`${E>0?O.cost/E*100:0}%`,background:j_(O.id)}},O.id))}),m.jsx("div",{className:"uh-agent-keys",children:j.map(O=>m.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${Nt(O.tokens)} tokens`,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:j_(O.id)}}),gy(O.id),m.jsx("span",{className:"uh-agent-cost",children:qe(O.cost)}),m.jsx("span",{className:"uh-agent-share",children:mq(O.cost,E)})]},O.id))})]}),m.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(O=>{const D=w>0?O.totalCost/w*100:0,L=O.period===o,U=`${O.period}, ${qe(O.totalCost)}`;return m.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>a(L?null:O.period),"aria-pressed":L,"aria-label":U,title:`${O.period} · ${qe(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[m.jsx("div",{className:"uh-bar",style:{height:`${Math.max(D,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((V,z)=>z.cost-V.cost).map(V=>{const z=O.totalCost>0?V.cost/O.totalCost*100:0;return m.jsx("div",{className:"uh-bar-seg",style:{height:`${z}%`,background:lu(V.modelName)}},V.modelName)})}),m.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),m.jsx("div",{className:"uh-legend",children:N.map(([O,D])=>m.jsxs("span",{className:"uh-legend-item",title:O,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:lu(O)}}),Rs(O)," ",m.jsx("span",{className:"uh-legend-cost",children:qe(D)})]},O))}),M&&m.jsxs("div",{className:"uh-detail",children:[m.jsxs("div",{className:"uh-detail-head",children:[m.jsx("span",{className:"uh-detail-date",children:M.period}),m.jsx("span",{className:"uh-detail-cost",children:qe(M.totalCost)}),(()=>{var L,U;const D=pq(M.agents)??((U=(L=M.metadata)==null?void 0:L.agents)!=null&&U.length?M.metadata.agents.join(" · "):null);return D?m.jsx("span",{className:"uh-detail-agents",title:D,children:D}):null})()]}),m.jsxs("div",{className:"uh-detail-mini",children:[m.jsx(cu,{label:"input",val:Nt(M.inputTokens)}),m.jsx(cu,{label:"output",val:Nt(M.outputTokens)}),m.jsx(cu,{label:"cache write",val:Nt(M.cacheCreationTokens)}),m.jsx(cu,{label:"cache read",val:Nt(M.cacheReadTokens)})]}),m.jsx("div",{className:"uh-detail-models",children:M.modelBreakdowns.slice().sort((O,D)=>D.cost-O.cost).map(O=>{const D=M.totalCost>0?O.cost/M.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:lu(O.modelName)}}),m.jsx("span",{className:"uh-model-label",children:Rs(O.modelName)})]}),m.jsx("span",{className:"uh-model-bar",children:m.jsx("span",{className:"uh-model-bar-fill",style:{width:`${D}%`,background:lu(O.modelName)}})}),m.jsx("span",{className:"uh-model-cost",children:qe(O.cost)})]},O.modelName)})})]})]})]})})}function uu({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 cu({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 vy(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 ef,T_;function wq(){if(T_)return ef;T_=1;function e(){this.__data__=[],this.size=0}return ef=e,ef}var tf,R_;function xo(){if(R_)return tf;R_=1;function e(t,r){return t===r||t!==t&&r!==r}return tf=e,tf}var nf,A_;function Bu(){if(A_)return nf;A_=1;var e=xo();function t(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return nf=t,nf}var rf,I_;function xq(){if(I_)return rf;I_=1;var e=Bu(),t=Array.prototype,r=t.splice;function i(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 rf=i,rf}var sf,M_;function _q(){if(M_)return sf;M_=1;var e=Bu();function t(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return sf=t,sf}var of,O_;function bq(){if(O_)return of;O_=1;var e=Bu();function t(r){return e(this.__data__,r)>-1}return of=t,of}var af,P_;function Sq(){if(P_)return af;P_=1;var e=Bu();function t(r,i){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,i])):o[a][1]=i,this}return af=t,af}var lf,L_;function Uu(){if(L_)return lf;L_=1;var e=wq(),t=xq(),r=_q(),i=bq(),o=Sq();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=i,a.prototype.set=o,lf=a,lf}var uf,$_;function kq(){if($_)return uf;$_=1;var e=Uu();function t(){this.__data__=new e,this.size=0}return uf=t,uf}var cf,q_;function Eq(){if(q_)return cf;q_=1;function e(t){var r=this.__data__,i=r.delete(t);return this.size=r.size,i}return cf=e,cf}var df,D_;function Nq(){if(D_)return df;D_=1;function e(t){return this.__data__.get(t)}return df=e,df}var ff,F_;function Cq(){if(F_)return ff;F_=1;function e(t){return this.__data__.has(t)}return ff=e,ff}var hf,z_;function rj(){if(z_)return hf;z_=1;var e=typeof Gl=="object"&&Gl&&Gl.Object===Object&&Gl;return hf=e,hf}var pf,B_;function rr(){if(B_)return pf;B_=1;var e=rj(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return pf=r,pf}var mf,U_;function _o(){if(U_)return mf;U_=1;var e=rr(),t=e.Symbol;return mf=t,mf}var gf,H_;function jq(){if(H_)return gf;H_=1;var e=_o(),t=Object.prototype,r=t.hasOwnProperty,i=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=i.call(u);return p&&(c?u[o]=f:delete u[o]),d}return gf=a,gf}var vf,W_;function Tq(){if(W_)return vf;W_=1;var e=Object.prototype,t=e.toString;function r(i){return t.call(i)}return vf=r,vf}var yf,V_;function gi(){if(V_)return yf;V_=1;var e=_o(),t=jq(),r=Tq(),i="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:a&&a in Object(c)?t(c):r(c)}return yf=u,yf}var wf,G_;function qn(){if(G_)return wf;G_=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return wf=e,wf}var xf,Y_;function $a(){if(Y_)return xf;Y_=1;var e=gi(),t=qn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==i||f==o||f==r||f==a}return xf=u,xf}var _f,K_;function Rq(){if(K_)return _f;K_=1;var e=rr(),t=e["__core-js_shared__"];return _f=t,_f}var bf,X_;function Aq(){if(X_)return bf;X_=1;var e=Rq(),t=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!t&&t in i}return bf=r,bf}var Sf,Q_;function sj(){if(Q_)return Sf;Q_=1;var e=Function.prototype,t=e.toString;function r(i){if(i!=null){try{return t.call(i)}catch{}try{return i+""}catch{}}return""}return Sf=r,Sf}var kf,Z_;function Iq(){if(Z_)return kf;Z_=1;var e=$a(),t=Aq(),r=qn(),i=sj(),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(i(y))}return kf=g,kf}var Ef,J_;function Mq(){if(J_)return Ef;J_=1;function e(t,r){return t==null?void 0:t[r]}return Ef=e,Ef}var Nf,e1;function vi(){if(e1)return Nf;e1=1;var e=Iq(),t=Mq();function r(i,o){var a=t(i,o);return e(a)?a:void 0}return Nf=r,Nf}var Cf,t1;function yy(){if(t1)return Cf;t1=1;var e=vi(),t=rr(),r=e(t,"Map");return Cf=r,Cf}var jf,n1;function Hu(){if(n1)return jf;n1=1;var e=vi(),t=e(Object,"create");return jf=t,jf}var Tf,r1;function Oq(){if(r1)return Tf;r1=1;var e=Hu();function t(){this.__data__=e?e(null):{},this.size=0}return Tf=t,Tf}var Rf,s1;function Pq(){if(s1)return Rf;s1=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Rf=e,Rf}var Af,i1;function Lq(){if(i1)return Af;i1=1;var e=Hu(),t="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(a){var u=this.__data__;if(e){var c=u[a];return c===t?void 0:c}return i.call(u,a)?u[a]:void 0}return Af=o,Af}var If,o1;function $q(){if(o1)return If;o1=1;var e=Hu(),t=Object.prototype,r=t.hasOwnProperty;function i(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return If=i,If}var Mf,a1;function qq(){if(a1)return Mf;a1=1;var e=Hu(),t="__lodash_hash_undefined__";function r(i,o){var a=this.__data__;return this.size+=this.has(i)?0:1,a[i]=e&&o===void 0?t:o,this}return Mf=r,Mf}var Of,l1;function Dq(){if(l1)return Of;l1=1;var e=Oq(),t=Pq(),r=Lq(),i=$q(),o=qq();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=i,a.prototype.set=o,Of=a,Of}var Pf,u1;function Fq(){if(u1)return Pf;u1=1;var e=Dq(),t=Uu(),r=yy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Pf=i,Pf}var Lf,c1;function zq(){if(c1)return Lf;c1=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Lf=e,Lf}var $f,d1;function Wu(){if(d1)return $f;d1=1;var e=zq();function t(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return $f=t,$f}var qf,f1;function Bq(){if(f1)return qf;f1=1;var e=Wu();function t(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return qf=t,qf}var Df,h1;function Uq(){if(h1)return Df;h1=1;var e=Wu();function t(r){return e(this,r).get(r)}return Df=t,Df}var Ff,p1;function Hq(){if(p1)return Ff;p1=1;var e=Wu();function t(r){return e(this,r).has(r)}return Ff=t,Ff}var zf,m1;function Wq(){if(m1)return zf;m1=1;var e=Wu();function t(r,i){var o=e(this,r),a=o.size;return o.set(r,i),this.size+=o.size==a?0:1,this}return zf=t,zf}var Bf,g1;function wy(){if(g1)return Bf;g1=1;var e=Fq(),t=Bq(),r=Uq(),i=Hq(),o=Wq();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=i,a.prototype.set=o,Bf=a,Bf}var Uf,v1;function Vq(){if(v1)return Uf;v1=1;var e=Uu(),t=yy(),r=wy(),i=200;function o(a,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!t||f.length<i-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 Uf=o,Uf}var Hf,y1;function Vu(){if(y1)return Hf;y1=1;var e=Uu(),t=kq(),r=Eq(),i=Nq(),o=Cq(),a=Vq();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=i,u.prototype.has=o,u.prototype.set=a,Hf=u,Hf}var Wf,w1;function xy(){if(w1)return Wf;w1=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o&&r(t[i],i,t)!==!1;);return t}return Wf=e,Wf}var Vf,x1;function ij(){if(x1)return Vf;x1=1;var e=vi(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Vf=t,Vf}var Gf,_1;function Gu(){if(_1)return Gf;_1=1;var e=ij();function t(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Gf=t,Gf}var Yf,b1;function Yu(){if(b1)return Yf;b1=1;var e=Gu(),t=xo(),r=Object.prototype,i=r.hasOwnProperty;function o(a,u,c){var f=a[u];(!(i.call(a,u)&&t(f,c))||c===void 0&&!(u in a))&&e(a,u,c)}return Yf=o,Yf}var Kf,S1;function qa(){if(S1)return Kf;S1=1;var e=Yu(),t=Gu();function r(i,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],i[d],d,a,i):void 0;g===void 0&&(g=i[d]),c?t(a,d,g):e(a,d,g)}return a}return Kf=r,Kf}var Xf,k1;function Gq(){if(k1)return Xf;k1=1;function e(t,r){for(var i=-1,o=Array(t);++i<t;)o[i]=r(i);return o}return Xf=e,Xf}var Qf,E1;function mr(){if(E1)return Qf;E1=1;function e(t){return t!=null&&typeof t=="object"}return Qf=e,Qf}var Zf,N1;function Yq(){if(N1)return Zf;N1=1;var e=gi(),t=mr(),r="[object Arguments]";function i(o){return t(o)&&e(o)==r}return Zf=i,Zf}var Jf,C1;function Da(){if(C1)return Jf;C1=1;var e=Yq(),t=mr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(u){return t(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Jf=a,Jf}var eh,j1;function _t(){if(j1)return eh;j1=1;var e=Array.isArray;return eh=e,eh}var ma={exports:{}},th,T1;function Kq(){if(T1)return th;T1=1;function e(){return!1}return th=e,th}ma.exports;var R1;function bo(){return R1||(R1=1,(function(e,t){var r=rr(),i=Kq(),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||i;e.exports=p})(ma,ma.exports)),ma.exports}var nh,A1;function Ku(){if(A1)return nh;A1=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(i,o){var a=typeof i;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(i))&&i>-1&&i%1==0&&i<o}return nh=r,nh}var rh,I1;function _y(){if(I1)return rh;I1=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return rh=t,rh}var sh,M1;function Xq(){if(M1)return sh;M1=1;var e=gi(),t=_y(),r=mr(),i="[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]",E="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",S="[object DataView]",k="[object Float32Array]",N="[object Float64Array]",j="[object Int8Array]",A="[object Int16Array]",M="[object Int32Array]",P="[object Uint8Array]",O="[object Uint8ClampedArray]",D="[object Uint16Array]",L="[object Uint32Array]",U={};U[k]=U[N]=U[j]=U[A]=U[M]=U[P]=U[O]=U[D]=U[L]=!0,U[i]=U[o]=U[b]=U[a]=U[S]=U[u]=U[c]=U[f]=U[p]=U[d]=U[g]=U[y]=U[w]=U[E]=U[_]=!1;function V(z){return r(z)&&t(z.length)&&!!U[e(z)]}return sh=V,sh}var ih,O1;function Xu(){if(O1)return ih;O1=1;function e(t){return function(r){return t(r)}}return ih=e,ih}var ga={exports:{}};ga.exports;var P1;function by(){return P1||(P1=1,(function(e,t){var r=rj(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,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})(ga,ga.exports)),ga.exports}var oh,L1;function Fa(){if(L1)return oh;L1=1;var e=Xq(),t=Xu(),r=by(),i=r&&r.isTypedArray,o=i?t(i):e;return oh=o,oh}var ah,$1;function oj(){if($1)return ah;$1=1;var e=Gq(),t=Da(),r=_t(),i=bo(),o=Ku(),a=Fa(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var g=r(p),y=!g&&t(p),w=!g&&!y&&i(p),E=!g&&!y&&!w&&a(p),_=g||y||w||E,b=_?e(p.length,String):[],S=b.length;for(var k in p)(d||c.call(p,k))&&!(_&&(k=="length"||w&&(k=="offset"||k=="parent")||E&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,S)))&&b.push(k);return b}return ah=f,ah}var lh,q1;function Qu(){if(q1)return lh;q1=1;var e=Object.prototype;function t(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return lh=t,lh}var uh,D1;function aj(){if(D1)return uh;D1=1;function e(t,r){return function(i){return t(r(i))}}return uh=e,uh}var ch,F1;function Qq(){if(F1)return ch;F1=1;var e=aj(),t=e(Object.keys,Object);return ch=t,ch}var dh,z1;function Sy(){if(z1)return dh;z1=1;var e=Qu(),t=Qq(),r=Object.prototype,i=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var u=[];for(var c in Object(a))i.call(a,c)&&c!="constructor"&&u.push(c);return u}return dh=o,dh}var fh,B1;function Br(){if(B1)return fh;B1=1;var e=$a(),t=_y();function r(i){return i!=null&&t(i.length)&&!e(i)}return fh=r,fh}var hh,U1;function As(){if(U1)return hh;U1=1;var e=oj(),t=Sy(),r=Br();function i(o){return r(o)?e(o):t(o)}return hh=i,hh}var ph,H1;function Zq(){if(H1)return ph;H1=1;var e=qa(),t=As();function r(i,o){return i&&e(o,t(o),i)}return ph=r,ph}var mh,W1;function Jq(){if(W1)return mh;W1=1;function e(t){var r=[];if(t!=null)for(var i in Object(t))r.push(i);return r}return mh=e,mh}var gh,V1;function eD(){if(V1)return gh;V1=1;var e=qn(),t=Qu(),r=Jq(),i=Object.prototype,o=i.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 gh=a,gh}var vh,G1;function yi(){if(G1)return vh;G1=1;var e=oj(),t=eD(),r=Br();function i(o){return r(o)?e(o,!0):t(o)}return vh=i,vh}var yh,Y1;function tD(){if(Y1)return yh;Y1=1;var e=qa(),t=yi();function r(i,o){return i&&e(o,t(o),i)}return yh=r,yh}var va={exports:{}};va.exports;var K1;function lj(){return K1||(K1=1,(function(e,t){var r=rr(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,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})(va,va.exports)),va.exports}var wh,X1;function uj(){if(X1)return wh;X1=1;function e(t,r){var i=-1,o=t.length;for(r||(r=Array(o));++i<o;)r[i]=t[i];return r}return wh=e,wh}var xh,Q1;function cj(){if(Q1)return xh;Q1=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,a=0,u=[];++i<o;){var c=t[i];r(c,i,t)&&(u[a++]=c)}return u}return xh=e,xh}var _h,Z1;function dj(){if(Z1)return _h;Z1=1;function e(){return[]}return _h=e,_h}var bh,J1;function ky(){if(J1)return bh;J1=1;var e=cj(),t=dj(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:t;return bh=a,bh}var Sh,eb;function nD(){if(eb)return Sh;eb=1;var e=qa(),t=ky();function r(i,o){return e(i,t(i),o)}return Sh=r,Sh}var kh,tb;function Ey(){if(tb)return kh;tb=1;function e(t,r){for(var i=-1,o=r.length,a=t.length;++i<o;)t[a+i]=r[i];return t}return kh=e,kh}var Eh,nb;function Zu(){if(nb)return Eh;nb=1;var e=aj(),t=e(Object.getPrototypeOf,Object);return Eh=t,Eh}var Nh,rb;function fj(){if(rb)return Nh;rb=1;var e=Ey(),t=Zu(),r=ky(),i=dj(),o=Object.getOwnPropertySymbols,a=o?function(u){for(var c=[];u;)e(c,r(u)),u=t(u);return c}:i;return Nh=a,Nh}var Ch,sb;function rD(){if(sb)return Ch;sb=1;var e=qa(),t=fj();function r(i,o){return e(i,t(i),o)}return Ch=r,Ch}var jh,ib;function hj(){if(ib)return jh;ib=1;var e=Ey(),t=_t();function r(i,o,a){var u=o(i);return t(i)?u:e(u,a(i))}return jh=r,jh}var Th,ob;function pj(){if(ob)return Th;ob=1;var e=hj(),t=ky(),r=As();function i(o){return e(o,r,t)}return Th=i,Th}var Rh,ab;function sD(){if(ab)return Rh;ab=1;var e=hj(),t=fj(),r=yi();function i(o){return e(o,r,t)}return Rh=i,Rh}var Ah,lb;function iD(){if(lb)return Ah;lb=1;var e=vi(),t=rr(),r=e(t,"DataView");return Ah=r,Ah}var Ih,ub;function oD(){if(ub)return Ih;ub=1;var e=vi(),t=rr(),r=e(t,"Promise");return Ih=r,Ih}var Mh,cb;function mj(){if(cb)return Mh;cb=1;var e=vi(),t=rr(),r=e(t,"Set");return Mh=r,Mh}var Oh,db;function aD(){if(db)return Oh;db=1;var e=vi(),t=rr(),r=e(t,"WeakMap");return Oh=r,Oh}var Ph,fb;function So(){if(fb)return Ph;fb=1;var e=iD(),t=yy(),r=oD(),i=mj(),o=aD(),a=gi(),u=sj(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",g="[object WeakMap]",y="[object DataView]",w=u(e),E=u(t),_=u(r),b=u(i),S=u(o),k=a;return(e&&k(new e(new ArrayBuffer(1)))!=y||t&&k(new t)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=g)&&(k=function(N){var j=a(N),A=j==f?N.constructor:void 0,M=A?u(A):"";if(M)switch(M){case w:return y;case E:return c;case _:return p;case b:return d;case S:return g}return j}),Ph=k,Ph}var Lh,hb;function lD(){if(hb)return Lh;hb=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i){var o=i.length,a=new i.constructor(o);return o&&typeof i[0]=="string"&&t.call(i,"index")&&(a.index=i.index,a.input=i.input),a}return Lh=r,Lh}var $h,pb;function gj(){if(pb)return $h;pb=1;var e=rr(),t=e.Uint8Array;return $h=t,$h}var qh,mb;function Ny(){if(mb)return qh;mb=1;var e=gj();function t(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return qh=t,qh}var Dh,gb;function uD(){if(gb)return Dh;gb=1;var e=Ny();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Dh=t,Dh}var Fh,vb;function cD(){if(vb)return Fh;vb=1;var e=/\w*$/;function t(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Fh=t,Fh}var zh,yb;function dD(){if(yb)return zh;yb=1;var e=_o(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return zh=i,zh}var Bh,wb;function vj(){if(wb)return Bh;wb=1;var e=Ny();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return Bh=t,Bh}var Uh,xb;function fD(){if(xb)return Uh;xb=1;var e=Ny(),t=uD(),r=cD(),i=dD(),o=vj(),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]",E="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",S="[object Int8Array]",k="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",A="[object Uint8ClampedArray]",M="[object Uint16Array]",P="[object Uint32Array]";function O(D,L,U){var V=D.constructor;switch(L){case w:return e(D);case a:case u:return new V(+D);case E:return t(D,U);case _:case b:case S:case k:case N:case j:case A:case M:case P:return o(D,U);case c:return new V;case f:case g:return new V(D);case p:return r(D);case d:return new V;case y:return i(D)}}return Uh=O,Uh}var Hh,_b;function yj(){if(_b)return Hh;_b=1;var e=qn(),t=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(t)return t(o);i.prototype=o;var a=new i;return i.prototype=void 0,a}})();return Hh=r,Hh}var Wh,bb;function wj(){if(bb)return Wh;bb=1;var e=yj(),t=Zu(),r=Qu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return Wh=i,Wh}var Vh,Sb;function hD(){if(Sb)return Vh;Sb=1;var e=So(),t=mr(),r="[object Map]";function i(o){return t(o)&&e(o)==r}return Vh=i,Vh}var Gh,kb;function pD(){if(kb)return Gh;kb=1;var e=hD(),t=Xu(),r=by(),i=r&&r.isMap,o=i?t(i):e;return Gh=o,Gh}var Yh,Eb;function mD(){if(Eb)return Yh;Eb=1;var e=So(),t=mr(),r="[object Set]";function i(o){return t(o)&&e(o)==r}return Yh=i,Yh}var Kh,Nb;function gD(){if(Nb)return Kh;Nb=1;var e=mD(),t=Xu(),r=by(),i=r&&r.isSet,o=i?t(i):e;return Kh=o,Kh}var Xh,Cb;function xj(){if(Cb)return Xh;Cb=1;var e=Vu(),t=xy(),r=Yu(),i=Zq(),o=tD(),a=lj(),u=uj(),c=nD(),f=rD(),p=pj(),d=sD(),g=So(),y=lD(),w=fD(),E=wj(),_=_t(),b=bo(),S=pD(),k=qn(),N=gD(),j=As(),A=yi(),M=1,P=2,O=4,D="[object Arguments]",L="[object Array]",U="[object Boolean]",V="[object Date]",z="[object Error]",C="[object Function]",F="[object GeneratorFunction]",$="[object Map]",re="[object Number]",J="[object Object]",W="[object RegExp]",Z="[object Set]",I="[object String]",G="[object Symbol]",K="[object WeakMap]",q="[object ArrayBuffer]",Q="[object DataView]",ne="[object Float32Array]",ae="[object Float64Array]",fe="[object Int8Array]",te="[object Int16Array]",ce="[object Int32Array]",Ce="[object Uint8Array]",ve="[object Uint8ClampedArray]",Re="[object Uint16Array]",ye="[object Uint32Array]",Ee={};Ee[D]=Ee[L]=Ee[q]=Ee[Q]=Ee[U]=Ee[V]=Ee[ne]=Ee[ae]=Ee[fe]=Ee[te]=Ee[ce]=Ee[$]=Ee[re]=Ee[J]=Ee[W]=Ee[Z]=Ee[I]=Ee[G]=Ee[Ce]=Ee[ve]=Ee[Re]=Ee[ye]=!0,Ee[z]=Ee[C]=Ee[K]=!1;function Ye(we,_e,Be,it,ft,Ze){var De,Je=_e&M,Xe=_e&P,Ot=_e&O;if(Be&&(De=ft?Be(we,it,ft,Ze):Be(we)),De!==void 0)return De;if(!k(we))return we;var lt=_(we);if(lt){if(De=y(we),!Je)return u(we,De)}else{var Qe=g(we),Pt=Qe==C||Qe==F;if(b(we))return a(we,Je);if(Qe==J||Qe==D||Pt&&!ft){if(De=Xe||Pt?{}:E(we),!Je)return Xe?f(we,o(De,we)):c(we,i(De,we))}else{if(!Ee[Qe])return ft?we:{};De=w(we,Qe,Je)}}Ze||(Ze=new e);var zt=Ze.get(we);if(zt)return zt;Ze.set(we,De),N(we)?we.forEach(function(ht){De.add(Ye(ht,_e,Be,ht,we,Ze))}):S(we)&&we.forEach(function(ht,vt){De.set(vt,Ye(ht,_e,Be,vt,we,Ze))});var et=Ot?Xe?d:p:Xe?A:j,bt=lt?void 0:et(we);return t(bt||we,function(ht,vt){bt&&(vt=ht,ht=we[vt]),r(De,vt,Ye(ht,_e,Be,vt,we,Ze))}),De}return Xh=Ye,Xh}var Qh,jb;function vD(){if(jb)return Qh;jb=1;var e=xj(),t=4;function r(i){return e(i,t)}return Qh=r,Qh}var Zh,Tb;function Cy(){if(Tb)return Zh;Tb=1;function e(t){return function(){return t}}return Zh=e,Zh}var Jh,Rb;function yD(){if(Rb)return Jh;Rb=1;function e(t){return function(r,i,o){for(var a=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[t?f:++a];if(i(u[p],p,u)===!1)break}return r}}return Jh=e,Jh}var ep,Ab;function jy(){if(Ab)return ep;Ab=1;var e=yD(),t=e();return ep=t,ep}var tp,Ib;function Ty(){if(Ib)return tp;Ib=1;var e=jy(),t=As();function r(i,o){return i&&e(i,o,t)}return tp=r,tp}var np,Mb;function wD(){if(Mb)return np;Mb=1;var e=Br();function t(r,i){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var u=o.length,c=i?u:-1,f=Object(o);(i?c--:++c<u)&&a(f[c],c,f)!==!1;);return o}}return np=t,np}var rp,Ob;function Ju(){if(Ob)return rp;Ob=1;var e=Ty(),t=wD(),r=t(e);return rp=r,rp}var sp,Pb;function wi(){if(Pb)return sp;Pb=1;function e(t){return t}return sp=e,sp}var ip,Lb;function _j(){if(Lb)return ip;Lb=1;var e=wi();function t(r){return typeof r=="function"?r:e}return ip=t,ip}var op,$b;function bj(){if($b)return op;$b=1;var e=xy(),t=Ju(),r=_j(),i=_t();function o(a,u){var c=i(a)?e:t;return c(a,r(u))}return op=o,op}var ap,qb;function Sj(){return qb||(qb=1,ap=bj()),ap}var lp,Db;function xD(){if(Db)return lp;Db=1;var e=Ju();function t(r,i){var o=[];return e(r,function(a,u,c){i(a,u,c)&&o.push(a)}),o}return lp=t,lp}var up,Fb;function _D(){if(Fb)return up;Fb=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return up=t,up}var cp,zb;function bD(){if(zb)return cp;zb=1;function e(t){return this.__data__.has(t)}return cp=e,cp}var dp,Bb;function kj(){if(Bb)return dp;Bb=1;var e=wy(),t=_D(),r=bD();function i(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new e;++a<u;)this.add(o[a])}return i.prototype.add=i.prototype.push=t,i.prototype.has=r,dp=i,dp}var fp,Ub;function SD(){if(Ub)return fp;Ub=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o;)if(r(t[i],i,t))return!0;return!1}return fp=e,fp}var hp,Hb;function Ej(){if(Hb)return hp;Hb=1;function e(t,r){return t.has(r)}return hp=e,hp}var pp,Wb;function Nj(){if(Wb)return pp;Wb=1;var e=kj(),t=SD(),r=Ej(),i=1,o=2;function a(u,c,f,p,d,g){var y=f&i,w=u.length,E=c.length;if(w!=E&&!(y&&E>w))return!1;var _=g.get(u),b=g.get(c);if(_&&b)return _==c&&b==u;var S=-1,k=!0,N=f&o?new e:void 0;for(g.set(u,c),g.set(c,u);++S<w;){var j=u[S],A=c[S];if(p)var M=y?p(A,j,S,c,u,g):p(j,A,S,u,c,g);if(M!==void 0){if(M)continue;k=!1;break}if(N){if(!t(c,function(P,O){if(!r(N,O)&&(j===P||d(j,P,f,p,g)))return N.push(O)})){k=!1;break}}else if(!(j===A||d(j,A,f,p,g))){k=!1;break}}return g.delete(u),g.delete(c),k}return pp=a,pp}var mp,Vb;function kD(){if(Vb)return mp;Vb=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o,a){i[++r]=[a,o]}),i}return mp=e,mp}var gp,Gb;function Ry(){if(Gb)return gp;Gb=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o){i[++r]=o}),i}return gp=e,gp}var vp,Yb;function ED(){if(Yb)return vp;Yb=1;var e=_o(),t=gj(),r=xo(),i=Nj(),o=kD(),a=Ry(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",E="[object Set]",_="[object String]",b="[object Symbol]",S="[object ArrayBuffer]",k="[object DataView]",N=e?e.prototype:void 0,j=N?N.valueOf:void 0;function A(M,P,O,D,L,U,V){switch(O){case k:if(M.byteLength!=P.byteLength||M.byteOffset!=P.byteOffset)return!1;M=M.buffer,P=P.buffer;case S:return!(M.byteLength!=P.byteLength||!U(new t(M),new t(P)));case f:case p:case y:return r(+M,+P);case d:return M.name==P.name&&M.message==P.message;case w:case _:return M==P+"";case g:var z=o;case E:var C=D&u;if(z||(z=a),M.size!=P.size&&!C)return!1;var F=V.get(M);if(F)return F==P;D|=c,V.set(M,P);var $=i(z(M),z(P),D,L,U,V);return V.delete(M),$;case b:if(j)return j.call(M)==j.call(P)}return!1}return vp=A,vp}var yp,Kb;function ND(){if(Kb)return yp;Kb=1;var e=pj(),t=1,r=Object.prototype,i=r.hasOwnProperty;function o(a,u,c,f,p,d){var g=c&t,y=e(a),w=y.length,E=e(u),_=E.length;if(w!=_&&!g)return!1;for(var b=w;b--;){var S=y[b];if(!(g?S in u:i.call(u,S)))return!1}var k=d.get(a),N=d.get(u);if(k&&N)return k==u&&N==a;var j=!0;d.set(a,u),d.set(u,a);for(var A=g;++b<w;){S=y[b];var M=a[S],P=u[S];if(f)var O=g?f(P,M,S,u,a,d):f(M,P,S,a,u,d);if(!(O===void 0?M===P||p(M,P,c,f,d):O)){j=!1;break}A||(A=S=="constructor")}if(j&&!A){var D=a.constructor,L=u.constructor;D!=L&&"constructor"in a&&"constructor"in u&&!(typeof D=="function"&&D instanceof D&&typeof L=="function"&&L instanceof L)&&(j=!1)}return d.delete(a),d.delete(u),j}return yp=o,yp}var wp,Xb;function CD(){if(Xb)return wp;Xb=1;var e=Vu(),t=Nj(),r=ED(),i=ND(),o=So(),a=_t(),u=bo(),c=Fa(),f=1,p="[object Arguments]",d="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function E(_,b,S,k,N,j){var A=a(_),M=a(b),P=A?d:o(_),O=M?d:o(b);P=P==p?g:P,O=O==p?g:O;var D=P==g,L=O==g,U=P==O;if(U&&u(_)){if(!u(b))return!1;A=!0,D=!1}if(U&&!D)return j||(j=new e),A||c(_)?t(_,b,S,k,N,j):r(_,b,P,S,k,N,j);if(!(S&f)){var V=D&&w.call(_,"__wrapped__"),z=L&&w.call(b,"__wrapped__");if(V||z){var C=V?_.value():_,F=z?b.value():b;return j||(j=new e),N(C,F,S,k,j)}}return U?(j||(j=new e),i(_,b,S,k,N,j)):!1}return wp=E,wp}var xp,Qb;function Cj(){if(Qb)return xp;Qb=1;var e=CD(),t=mr();function r(i,o,a,u,c){return i===o?!0:i==null||o==null||!t(i)&&!t(o)?i!==i&&o!==o:e(i,o,a,u,r,c)}return xp=r,xp}var _p,Zb;function jD(){if(Zb)return _p;Zb=1;var e=Vu(),t=Cj(),r=1,i=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],E=a[w],_=y[1];if(g&&y[2]){if(E===void 0&&!(w in a))return!1}else{var b=new e;if(f)var S=f(E,_,w,a,u,b);if(!(S===void 0?t(_,E,r|i,f,b):S))return!1}}return!0}return _p=o,_p}var bp,Jb;function jj(){if(Jb)return bp;Jb=1;var e=qn();function t(r){return r===r&&!e(r)}return bp=t,bp}var Sp,eS;function TD(){if(eS)return Sp;eS=1;var e=jj(),t=As();function r(i){for(var o=t(i),a=o.length;a--;){var u=o[a],c=i[u];o[a]=[u,c,e(c)]}return o}return Sp=r,Sp}var kp,tS;function Tj(){if(tS)return kp;tS=1;function e(t,r){return function(i){return i==null?!1:i[t]===r&&(r!==void 0||t in Object(i))}}return kp=e,kp}var Ep,nS;function RD(){if(nS)return Ep;nS=1;var e=jD(),t=TD(),r=Tj();function i(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 Ep=i,Ep}var Np,rS;function ko(){if(rS)return Np;rS=1;var e=gi(),t=mr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||t(o)&&e(o)==r}return Np=i,Np}var Cp,sS;function Ay(){if(sS)return Cp;sS=1;var e=_t(),t=ko(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\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:i.test(a)||!r.test(a)||u!=null&&a in Object(u)}return Cp=o,Cp}var jp,iS;function AD(){if(iS)return jp;iS=1;var e=wy(),t="Expected a function";function r(i,o){if(typeof i!="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=i.apply(this,u);return a.cache=f.set(c,p)||f,p};return a.cache=new(r.Cache||e),a}return r.Cache=e,jp=r,jp}var Tp,oS;function ID(){if(oS)return Tp;oS=1;var e=AD(),t=500;function r(i){var o=e(i,function(u){return a.size===t&&a.clear(),u}),a=o.cache;return o}return Tp=r,Tp}var Rp,aS;function MD(){if(aS)return Rp;aS=1;var e=ID(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=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 Rp=i,Rp}var Ap,lS;function ec(){if(lS)return Ap;lS=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,a=Array(o);++i<o;)a[i]=r(t[i],i,t);return a}return Ap=e,Ap}var Ip,uS;function OD(){if(uS)return Ip;uS=1;var e=_o(),t=ec(),r=_t(),i=ko(),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(i(c))return a?a.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return Ip=u,Ip}var Mp,cS;function Rj(){if(cS)return Mp;cS=1;var e=OD();function t(r){return r==null?"":e(r)}return Mp=t,Mp}var Op,dS;function tc(){if(dS)return Op;dS=1;var e=_t(),t=Ay(),r=MD(),i=Rj();function o(a,u){return e(a)?a:t(a,u)?[a]:r(i(a))}return Op=o,Op}var Pp,fS;function za(){if(fS)return Pp;fS=1;var e=ko();function t(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Pp=t,Pp}var Lp,hS;function nc(){if(hS)return Lp;hS=1;var e=tc(),t=za();function r(i,o){o=e(o,i);for(var a=0,u=o.length;i!=null&&a<u;)i=i[t(o[a++])];return a&&a==u?i:void 0}return Lp=r,Lp}var $p,pS;function PD(){if(pS)return $p;pS=1;var e=nc();function t(r,i,o){var a=r==null?void 0:e(r,i);return a===void 0?o:a}return $p=t,$p}var qp,mS;function LD(){if(mS)return qp;mS=1;function e(t,r){return t!=null&&r in Object(t)}return qp=e,qp}var Dp,gS;function Aj(){if(gS)return Dp;gS=1;var e=tc(),t=Da(),r=_t(),i=Ku(),o=_y(),a=za();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)&&i(w,g)&&(r(c)||t(c)))}return Dp=u,Dp}var Fp,vS;function Ij(){if(vS)return Fp;vS=1;var e=LD(),t=Aj();function r(i,o){return i!=null&&t(i,o,e)}return Fp=r,Fp}var zp,yS;function $D(){if(yS)return zp;yS=1;var e=Cj(),t=PD(),r=Ij(),i=Ay(),o=jj(),a=Tj(),u=za(),c=1,f=2;function p(d,g){return i(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 zp=p,zp}var Bp,wS;function Mj(){if(wS)return Bp;wS=1;function e(t){return function(r){return r==null?void 0:r[t]}}return Bp=e,Bp}var Up,xS;function qD(){if(xS)return Up;xS=1;var e=nc();function t(r){return function(i){return e(i,r)}}return Up=t,Up}var Hp,_S;function DD(){if(_S)return Hp;_S=1;var e=Mj(),t=qD(),r=Ay(),i=za();function o(a){return r(a)?e(i(a)):t(a)}return Hp=o,Hp}var Wp,bS;function Ur(){if(bS)return Wp;bS=1;var e=RD(),t=$D(),r=wi(),i=_t(),o=DD();function a(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?t(u[0],u[1]):e(u):o(u)}return Wp=a,Wp}var Vp,SS;function Oj(){if(SS)return Vp;SS=1;var e=cj(),t=xD(),r=Ur(),i=_t();function o(a,u){var c=i(a)?e:t;return c(a,r(u,3))}return Vp=o,Vp}var Gp,kS;function FD(){if(kS)return Gp;kS=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i,o){return i!=null&&t.call(i,o)}return Gp=r,Gp}var Yp,ES;function Pj(){if(ES)return Yp;ES=1;var e=FD(),t=Aj();function r(i,o){return i!=null&&t(i,o,e)}return Yp=r,Yp}var Kp,NS;function zD(){if(NS)return Kp;NS=1;var e=Sy(),t=So(),r=Da(),i=_t(),o=Br(),a=bo(),u=Qu(),c=Fa(),f="[object Map]",p="[object Set]",d=Object.prototype,g=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||c(w)||r(w)))return!w.length;var E=t(w);if(E==f||E==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(g.call(w,_))return!1;return!0}return Kp=y,Kp}var Xp,CS;function Lj(){if(CS)return Xp;CS=1;function e(t){return t===void 0}return Xp=e,Xp}var Qp,jS;function $j(){if(jS)return Qp;jS=1;var e=Ju(),t=Br();function r(i,o){var a=-1,u=t(i)?Array(i.length):[];return e(i,function(c,f,p){u[++a]=o(c,f,p)}),u}return Qp=r,Qp}var Zp,TS;function qj(){if(TS)return Zp;TS=1;var e=ec(),t=Ur(),r=$j(),i=_t();function o(a,u){var c=i(a)?e:r;return c(a,t(u,3))}return Zp=o,Zp}var Jp,RS;function BD(){if(RS)return Jp;RS=1;function e(t,r,i,o){var a=-1,u=t==null?0:t.length;for(o&&u&&(i=t[++a]);++a<u;)i=r(i,t[a],a,t);return i}return Jp=e,Jp}var em,AS;function UD(){if(AS)return em;AS=1;function e(t,r,i,o,a){return a(t,function(u,c,f){i=o?(o=!1,u):r(i,u,c,f)}),i}return em=e,em}var tm,IS;function Dj(){if(IS)return tm;IS=1;var e=BD(),t=Ju(),r=Ur(),i=UD(),o=_t();function a(u,c,f){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),f,d,t)}return tm=a,tm}var nm,MS;function HD(){if(MS)return nm;MS=1;var e=gi(),t=_t(),r=mr(),i="[object String]";function o(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==i}return nm=o,nm}var rm,OS;function WD(){if(OS)return rm;OS=1;var e=Mj(),t=e("length");return rm=t,rm}var sm,PS;function VD(){if(PS)return sm;PS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,a="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+a+"]");function f(p){return c.test(p)}return sm=f,sm}var im,LS;function GD(){if(LS)return im;LS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,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",E=p+"?",_="["+a+"]?",b="(?:"+w+"(?:"+[d,g,y].join("|")+")"+_+E+")*",S=_+E+b,k="(?:"+[d+c+"?",c,g,y,u].join("|")+")",N=RegExp(f+"(?="+f+")|"+k+S,"g");function j(A){for(var M=N.lastIndex=0;N.test(A);)++M;return M}return im=j,im}var om,$S;function YD(){if($S)return om;$S=1;var e=WD(),t=VD(),r=GD();function i(o){return t(o)?r(o):e(o)}return om=i,om}var am,qS;function KD(){if(qS)return am;qS=1;var e=Sy(),t=So(),r=Br(),i=HD(),o=YD(),a="[object Map]",u="[object Set]";function c(f){if(f==null)return 0;if(r(f))return i(f)?o(f):f.length;var p=t(f);return p==a||p==u?f.size:e(f).length}return am=c,am}var lm,DS;function XD(){if(DS)return lm;DS=1;var e=xy(),t=yj(),r=Ty(),i=Ur(),o=Zu(),a=_t(),u=bo(),c=$a(),f=qn(),p=Fa();function d(g,y,w){var E=a(g),_=E||u(g)||p(g);if(y=i(y,4),w==null){var b=g&&g.constructor;_?w=E?new b:[]:f(g)?w=c(b)?t(o(g)):{}:w={}}return(_?e:r)(g,function(S,k,N){return y(w,S,k,N)}),w}return lm=d,lm}var um,FS;function QD(){if(FS)return um;FS=1;var e=_o(),t=Da(),r=_t(),i=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(i&&a&&a[i])}return um=o,um}var cm,zS;function Iy(){if(zS)return cm;zS=1;var e=Ey(),t=QD();function r(i,o,a,u,c){var f=-1,p=i.length;for(a||(a=t),c||(c=[]);++f<p;){var d=i[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 cm=r,cm}var dm,BS;function ZD(){if(BS)return dm;BS=1;function e(t,r,i){switch(i.length){case 0:return t.call(r);case 1:return t.call(r,i[0]);case 2:return t.call(r,i[0],i[1]);case 3:return t.call(r,i[0],i[1],i[2])}return t.apply(r,i)}return dm=e,dm}var fm,US;function Fj(){if(US)return fm;US=1;var e=ZD(),t=Math.max;function r(i,o,a){return o=t(o===void 0?i.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(i,this,d)}}return fm=r,fm}var hm,HS;function JD(){if(HS)return hm;HS=1;var e=Cy(),t=ij(),r=wi(),i=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return hm=i,hm}var pm,WS;function e4(){if(WS)return pm;WS=1;var e=800,t=16,r=Date.now;function i(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 pm=i,pm}var mm,VS;function zj(){if(VS)return mm;VS=1;var e=JD(),t=e4(),r=t(e);return mm=r,mm}var gm,GS;function rc(){if(GS)return gm;GS=1;var e=wi(),t=Fj(),r=zj();function i(o,a){return r(t(o,a,e),o+"")}return gm=i,gm}var vm,YS;function Bj(){if(YS)return vm;YS=1;function e(t,r,i,o){for(var a=t.length,u=i+(o?1:-1);o?u--:++u<a;)if(r(t[u],u,t))return u;return-1}return vm=e,vm}var ym,KS;function t4(){if(KS)return ym;KS=1;function e(t){return t!==t}return ym=e,ym}var wm,XS;function n4(){if(XS)return wm;XS=1;function e(t,r,i){for(var o=i-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return wm=e,wm}var xm,QS;function r4(){if(QS)return xm;QS=1;var e=Bj(),t=t4(),r=n4();function i(o,a,u){return a===a?r(o,a,u):e(o,t,u)}return xm=i,xm}var _m,ZS;function s4(){if(ZS)return _m;ZS=1;var e=r4();function t(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return _m=t,_m}var bm,JS;function i4(){if(JS)return bm;JS=1;function e(t,r,i){for(var o=-1,a=t==null?0:t.length;++o<a;)if(i(r,t[o]))return!0;return!1}return bm=e,bm}var Sm,ek;function o4(){if(ek)return Sm;ek=1;function e(){}return Sm=e,Sm}var km,tk;function a4(){if(tk)return km;tk=1;var e=mj(),t=o4(),r=Ry(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(a){return new e(a)}:t;return km=o,km}var Em,nk;function l4(){if(nk)return Em;nk=1;var e=kj(),t=s4(),r=i4(),i=Ej(),o=a4(),a=Ry(),u=200;function c(f,p,d){var g=-1,y=t,w=f.length,E=!0,_=[],b=_;if(d)E=!1,y=r;else if(w>=u){var S=p?null:o(f);if(S)return a(S);E=!1,y=i,b=new e}else b=p?[]:_;e:for(;++g<w;){var k=f[g],N=p?p(k):k;if(k=d||k!==0?k:0,E&&N===N){for(var j=b.length;j--;)if(b[j]===N)continue e;p&&b.push(N),_.push(k)}else y(b,N,d)||(b!==_&&b.push(N),_.push(k))}return _}return Em=c,Em}var Nm,rk;function Uj(){if(rk)return Nm;rk=1;var e=Br(),t=mr();function r(i){return t(i)&&e(i)}return Nm=r,Nm}var Cm,sk;function u4(){if(sk)return Cm;sk=1;var e=Iy(),t=rc(),r=l4(),i=Uj(),o=t(function(a){return r(e(a,1,i,!0))});return Cm=o,Cm}var jm,ik;function c4(){if(ik)return jm;ik=1;var e=ec();function t(r,i){return e(i,function(o){return r[o]})}return jm=t,jm}var Tm,ok;function Hj(){if(ok)return Tm;ok=1;var e=c4(),t=As();function r(i){return i==null?[]:e(i,t(i))}return Tm=r,Tm}var Rm,ak;function Dn(){if(ak)return Rm;ak=1;var e;if(typeof vy=="function")try{e={clone:vD(),constant:Cy(),each:Sj(),filter:Oj(),has:Pj(),isArray:_t(),isEmpty:zD(),isFunction:$a(),isUndefined:Lj(),keys:As(),map:qj(),reduce:Dj(),size:KD(),transform:XD(),union:u4(),values:Hj()}}catch{}return e||(e=window._),Rm=e,Rm}var Am,lk;function My(){if(lk)return Am;lk=1;var e=Dn();Am=o;var t="\0",r="\0",i="";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(E){y.length>1?w.setNode(E,g):w.setNode(E)}),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 E(_){var b=y.parent(_);return b===void 0||g.hasNode(b)?(w[_]=b,b):b in w?w[b]:E(b)}return this._isCompound&&e.each(g.nodes(),function(_){g.setParent(_,E(_))}),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(E,_){return w.length>1?y.setEdge(E,_,g):y.setEdge(E,_),_}),this},o.prototype.setEdge=function(){var d,g,y,w,E=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,g=_.w,y=_.name,arguments.length===2&&(w=arguments[1],E=!0)):(d=_,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],E=!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 E&&(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]=E?w:this._defaultEdgeLabelFn(d,g,y);var S=f(this._isDirected,d,g,y);return d=S.v,g=S.w,Object.freeze(S),this._edgeObjs[b]=S,a(this._preds[g],d),a(this._sucs[d],g),this._in[g][b]=S,this._out[d][b]=S,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),E=this._edgeObjs[w];return E&&(d=E.v,g=E.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(E){return E.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(E){return E.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 E=""+g,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}return E+i+_+i+(e.isUndefined(w)?t:w)}function f(d,g,y,w){var E=""+g,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}var S={v:E,w:_};return w&&(S.name=w),S}function p(d,g){return c(d,g.v,g.w,g.name)}return Am}var Im,uk;function d4(){return uk||(uk=1,Im="2.1.8"),Im}var Mm,ck;function f4(){return ck||(ck=1,Mm={Graph:My(),version:d4()}),Mm}var Om,dk;function h4(){if(dk)return Om;dk=1;var e=Dn(),t=My();Om={write:r,read:a};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:i(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function i(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 Om}var Pm,fk;function p4(){if(fk)return Pm;fk=1;var e=Dn();Pm=t;function t(r){var i={},o=[],a;function u(c){e.has(i,c)||(i[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 Pm}var Lm,hk;function Wj(){if(hk)return Lm;hk=1;var e=Dn();Lm=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 i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,i){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:i}),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,i){var o=this._keyIndices[r];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)},t.prototype._heapify=function(r){var i=this._arr,o=2*r,a=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,a<i.length&&(u=i[a].priority<i[u].priority?a:u),u!==r&&(this._swap(r,u),this._heapify(u)))},t.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,a;r!==0&&(a=r>>1,!(i[a].priority<o));)this._swap(r,a),r=a},t.prototype._swap=function(r,i){var o=this._arr,a=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,a[c.key]=r,a[u.key]=i},Lm}var $m,pk;function Vj(){if(pk)return $m;pk=1;var e=Dn(),t=Wj();$m=i;var r=e.constant(1);function i(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(E){var _=E.v!==g?E.v:E.w,b=p[_],S=c(E),k=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+E+" Weight: "+S);k<b.distance&&(b.distance=k,b.predecessor=g,d.decrease(_,k))};for(a.nodes().forEach(function(E){var _=E===u?0:Number.POSITIVE_INFINITY;p[E]={distance:_},d.add(E,_)});d.size()>0&&(g=d.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return $m}var qm,mk;function m4(){if(mk)return qm;mk=1;var e=Vj(),t=Dn();qm=r;function r(i,o,a){return t.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,a)},{})}return qm}var Dm,gk;function Gj(){if(gk)return Dm;gk=1;var e=Dn();Dm=t;function t(r){var i=0,o=[],a={},u=[];function c(f){var p=a[f]={onStack:!0,lowlink:i,index:i++};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 Dm}var Fm,vk;function g4(){if(vk)return Fm;vk=1;var e=Dn(),t=Gj();Fm=r;function r(i){return e.filter(t(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Fm}var zm,yk;function v4(){if(yk)return zm;yk=1;var e=Dn();zm=r;var t=e.constant(1);function r(o,a,u){return i(o,a||t,u||function(c){return o.outEdges(c)})}function i(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 E=y[p],_=d[w],b=y[w],S=E.distance+_.distance;S<b.distance&&(b.distance=S,b.predecessor=_.predecessor)})})}),c}return zm}var Bm,wk;function Yj(){if(wk)return Bm;wk=1;var e=Dn();Bm=t,t.CycleException=r;function t(i){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(i.predecessors(f),c),delete a[f],u.push(f))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,Bm}var Um,xk;function y4(){if(xk)return Um;xk=1;var e=Yj();Um=t;function t(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Um}var Hm,_k;function Kj(){if(_k)return Hm;_k=1;var e=Dn();Hm=t;function t(i,o,a){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],f={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,a==="post",f,u,c)}),c}function r(i,o,a,u,c,f){e.has(u,o)||(u[o]=!0,a||f.push(o),e.each(c(o),function(p){r(i,p,a,u,c,f)}),a&&f.push(o))}return Hm}var Wm,bk;function w4(){if(bk)return Wm;bk=1;var e=Kj();Wm=t;function t(r,i){return e(r,i,"post")}return Wm}var Vm,Sk;function x4(){if(Sk)return Vm;Sk=1;var e=Kj();Vm=t;function t(r,i){return e(r,i,"pre")}return Vm}var Gm,kk;function _4(){if(kk)return Gm;kk=1;var e=Dn(),t=My(),r=Wj();Gm=i;function i(o,a){var u=new t,c={},f=new r,p;function d(y){var w=y.v===p?y.w:y.v,E=f.priority(w);if(E!==void 0){var _=a(y);_<E&&(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 Gm}var Ym,Ek;function b4(){return Ek||(Ek=1,Ym={components:p4(),dijkstra:Vj(),dijkstraAll:m4(),findCycles:g4(),floydWarshall:v4(),isAcyclic:y4(),postorder:w4(),preorder:x4(),prim:_4(),tarjan:Gj(),topsort:Yj()}),Ym}var Km,Nk;function S4(){if(Nk)return Km;Nk=1;var e=f4();return Km={Graph:e.Graph,json:h4(),alg:b4(),version:e.version},Km}var Xm,Ck;function tr(){if(Ck)return Xm;Ck=1;var e;if(typeof vy=="function")try{e=S4()}catch{}return e||(e=window.graphlib),Xm=e,Xm}var Qm,jk;function k4(){if(jk)return Qm;jk=1;var e=xj(),t=1,r=4;function i(o){return e(o,t|r)}return Qm=i,Qm}var Zm,Tk;function sc(){if(Tk)return Zm;Tk=1;var e=xo(),t=Br(),r=Ku(),i=qn();function o(a,u,c){if(!i(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 Zm=o,Zm}var Jm,Rk;function E4(){if(Rk)return Jm;Rk=1;var e=rc(),t=xo(),r=sc(),i=yi(),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=i(y),E=-1,_=w.length;++E<_;){var b=w[E],S=c[b];(S===void 0||t(S,o[b])&&!a.call(c,b))&&(c[b]=y[b])}return c});return Jm=u,Jm}var eg,Ak;function N4(){if(Ak)return eg;Ak=1;var e=Ur(),t=Br(),r=As();function i(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 eg=i,eg}var tg,Ik;function C4(){if(Ik)return tg;Ik=1;var e=/\s/;function t(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return tg=t,tg}var ng,Mk;function j4(){if(Mk)return ng;Mk=1;var e=C4(),t=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(t,"")}return ng=r,ng}var rg,Ok;function T4(){if(Ok)return rg;Ok=1;var e=j4(),t=qn(),r=ko(),i=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 i;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)?i:+p}return rg=f,rg}var sg,Pk;function Xj(){if(Pk)return sg;Pk=1;var e=T4(),t=1/0,r=17976931348623157e292;function i(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 sg=i,sg}var ig,Lk;function R4(){if(Lk)return ig;Lk=1;var e=Xj();function t(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return ig=t,ig}var og,$k;function A4(){if($k)return og;$k=1;var e=Bj(),t=Ur(),r=R4(),i=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=i(f+p,0)),e(a,t(u,3),p)}return og=o,og}var ag,qk;function I4(){if(qk)return ag;qk=1;var e=N4(),t=A4(),r=e(t);return ag=r,ag}var lg,Dk;function Qj(){if(Dk)return lg;Dk=1;var e=Iy();function t(r){var i=r==null?0:r.length;return i?e(r,1):[]}return lg=t,lg}var ug,Fk;function M4(){if(Fk)return ug;Fk=1;var e=jy(),t=_j(),r=yi();function i(o,a){return o==null?o:e(o,t(a),r)}return ug=i,ug}var cg,zk;function O4(){if(zk)return cg;zk=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return cg=e,cg}var dg,Bk;function P4(){if(Bk)return dg;Bk=1;var e=Gu(),t=Ty(),r=Ur();function i(o,a){var u={};return a=r(a,3),t(o,function(c,f,p){e(u,f,a(c,f,p))}),u}return dg=i,dg}var fg,Uk;function Oy(){if(Uk)return fg;Uk=1;var e=ko();function t(r,i,o){for(var a=-1,u=r.length;++a<u;){var c=r[a],f=i(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return fg=t,fg}var hg,Hk;function L4(){if(Hk)return hg;Hk=1;function e(t,r){return t>r}return hg=e,hg}var pg,Wk;function $4(){if(Wk)return pg;Wk=1;var e=Oy(),t=L4(),r=wi();function i(o){return o&&o.length?e(o,r,t):void 0}return pg=i,pg}var mg,Vk;function Zj(){if(Vk)return mg;Vk=1;var e=Gu(),t=xo();function r(i,o,a){(a!==void 0&&!t(i[o],a)||a===void 0&&!(o in i))&&e(i,o,a)}return mg=r,mg}var gg,Gk;function q4(){if(Gk)return gg;Gk=1;var e=gi(),t=Zu(),r=mr(),i="[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)!=i)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 gg=p,gg}var vg,Yk;function Jj(){if(Yk)return vg;Yk=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return vg=e,vg}var yg,Kk;function D4(){if(Kk)return yg;Kk=1;var e=qa(),t=yi();function r(i){return e(i,t(i))}return yg=r,yg}var wg,Xk;function F4(){if(Xk)return wg;Xk=1;var e=Zj(),t=lj(),r=vj(),i=uj(),o=wj(),a=Da(),u=_t(),c=Uj(),f=bo(),p=$a(),d=qn(),g=q4(),y=Fa(),w=Jj(),E=D4();function _(b,S,k,N,j,A,M){var P=w(b,k),O=w(S,k),D=M.get(O);if(D){e(b,k,D);return}var L=A?A(P,O,k+"",b,S,M):void 0,U=L===void 0;if(U){var V=u(O),z=!V&&f(O),C=!V&&!z&&y(O);L=O,V||z||C?u(P)?L=P:c(P)?L=i(P):z?(U=!1,L=t(O,!0)):C?(U=!1,L=r(O,!0)):L=[]:g(O)||a(O)?(L=P,a(P)?L=E(P):(!d(P)||p(P))&&(L=o(O))):U=!1}U&&(M.set(O,L),j(L,O,N,A,M),M.delete(O)),e(b,k,L)}return wg=_,wg}var xg,Qk;function z4(){if(Qk)return xg;Qk=1;var e=Vu(),t=Zj(),r=jy(),i=F4(),o=qn(),a=yi(),u=Jj();function c(f,p,d,g,y){f!==p&&r(p,function(w,E){if(y||(y=new e),o(w))i(f,p,E,d,c,g,y);else{var _=g?g(u(f,E),w,E+"",f,p,y):void 0;_===void 0&&(_=w),t(f,E,_)}},a)}return xg=c,xg}var _g,Zk;function B4(){if(Zk)return _g;Zk=1;var e=rc(),t=sc();function r(i){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=i.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&&i(o,d,u,f)}return o})}return _g=r,_g}var bg,Jk;function U4(){if(Jk)return bg;Jk=1;var e=z4(),t=B4(),r=t(function(i,o,a){e(i,o,a)});return bg=r,bg}var Sg,eE;function eT(){if(eE)return Sg;eE=1;function e(t,r){return t<r}return Sg=e,Sg}var kg,tE;function H4(){if(tE)return kg;tE=1;var e=Oy(),t=eT(),r=wi();function i(o){return o&&o.length?e(o,r,t):void 0}return kg=i,kg}var Eg,nE;function W4(){if(nE)return Eg;nE=1;var e=Oy(),t=Ur(),r=eT();function i(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return Eg=i,Eg}var Ng,rE;function V4(){if(rE)return Ng;rE=1;var e=rr(),t=function(){return e.Date.now()};return Ng=t,Ng}var Cg,sE;function G4(){if(sE)return Cg;sE=1;var e=Yu(),t=tc(),r=Ku(),i=qn(),o=za();function a(u,c,f,p){if(!i(u))return u;c=t(c,u);for(var d=-1,g=c.length,y=g-1,w=u;w!=null&&++d<g;){var E=o(c[d]),_=f;if(E==="__proto__"||E==="constructor"||E==="prototype")return u;if(d!=y){var b=w[E];_=p?p(b,E,w):void 0,_===void 0&&(_=i(b)?b:r(c[d+1])?[]:{})}e(w,E,_),w=w[E]}return u}return Cg=a,Cg}var jg,iE;function Y4(){if(iE)return jg;iE=1;var e=nc(),t=G4(),r=tc();function i(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 jg=i,jg}var Tg,oE;function K4(){if(oE)return Tg;oE=1;var e=Y4(),t=Ij();function r(i,o){return e(i,o,function(a,u){return t(i,u)})}return Tg=r,Tg}var Rg,aE;function X4(){if(aE)return Rg;aE=1;var e=Qj(),t=Fj(),r=zj();function i(o){return r(t(o,void 0,e),o+"")}return Rg=i,Rg}var Ag,lE;function Q4(){if(lE)return Ag;lE=1;var e=K4(),t=X4(),r=t(function(i,o){return i==null?{}:e(i,o)});return Ag=r,Ag}var Ig,uE;function Z4(){if(uE)return Ig;uE=1;var e=Math.ceil,t=Math.max;function r(i,o,a,u){for(var c=-1,f=t(e((o-i)/(a||1)),0),p=Array(f);f--;)p[u?f:++c]=i,i+=a;return p}return Ig=r,Ig}var Mg,cE;function J4(){if(cE)return Mg;cE=1;var e=Z4(),t=sc(),r=Xj();function i(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 Mg=i,Mg}var Og,dE;function e5(){if(dE)return Og;dE=1;var e=J4(),t=e();return Og=t,Og}var Pg,fE;function t5(){if(fE)return Pg;fE=1;function e(t,r){var i=t.length;for(t.sort(r);i--;)t[i]=t[i].value;return t}return Pg=e,Pg}var Lg,hE;function n5(){if(hE)return Lg;hE=1;var e=ko();function t(r,i){if(r!==i){var o=r!==void 0,a=r===null,u=r===r,c=e(r),f=i!==void 0,p=i===null,d=i===i,g=e(i);if(!p&&!g&&!c&&r>i||c&&f&&d&&!p&&!g||a&&f&&d||!o&&d||!u)return 1;if(!a&&!c&&!g&&r<i||g&&o&&u&&!a&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return Lg=t,Lg}var $g,pE;function r5(){if(pE)return $g;pE=1;var e=n5();function t(r,i,o){for(var a=-1,u=r.criteria,c=i.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-i.index}return $g=t,$g}var qg,mE;function s5(){if(mE)return qg;mE=1;var e=ec(),t=nc(),r=Ur(),i=$j(),o=t5(),a=Xu(),u=r5(),c=wi(),f=_t();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 E=i(d,function(_,b,S){var k=e(g,function(N){return N(_)});return{criteria:k,index:++w,value:_}});return o(E,function(_,b){return u(_,b,y)})}return qg=p,qg}var Dg,gE;function i5(){if(gE)return Dg;gE=1;var e=Iy(),t=s5(),r=rc(),i=sc(),o=r(function(a,u){if(a==null)return[];var c=u.length;return c>1&&i(a,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),t(a,e(u,1),[])});return Dg=o,Dg}var Fg,vE;function o5(){if(vE)return Fg;vE=1;var e=Rj(),t=0;function r(i){var o=++t;return e(i)+o}return Fg=r,Fg}var zg,yE;function a5(){if(yE)return zg;yE=1;function e(t,r,i){for(var o=-1,a=t.length,u=r.length,c={};++o<a;){var f=o<u?r[o]:void 0;i(c,t[o],f)}return c}return zg=e,zg}var Bg,wE;function l5(){if(wE)return Bg;wE=1;var e=Yu(),t=a5();function r(i,o){return t(i||[],o||[],e)}return Bg=r,Bg}var Ug,xE;function at(){if(xE)return Ug;xE=1;var e;if(typeof vy=="function")try{e={cloneDeep:k4(),constant:Cy(),defaults:E4(),each:Sj(),filter:Oj(),find:I4(),flatten:Qj(),forEach:bj(),forIn:M4(),has:Pj(),isUndefined:Lj(),last:O4(),map:qj(),mapValues:P4(),max:$4(),merge:U4(),min:H4(),minBy:W4(),now:V4(),pick:Q4(),range:e5(),reduce:Dj(),sortBy:i5(),uniqueId:o5(),values:Hj(),zipObject:l5()}}catch{}return e||(e=window._),Ug=e,Ug}var Hg,_E;function u5(){if(_E)return Hg;_E=1,Hg=e;function e(){var i={};i._next=i._prev=i,this._sentinel=i}e.prototype.dequeue=function(){var i=this._sentinel,o=i._prev;if(o!==i)return t(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&t(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o},e.prototype.toString=function(){for(var i=[],o=this._sentinel,a=o._prev;a!==o;)i.push(JSON.stringify(a,r)),a=a._prev;return"["+i.join(", ")+"]"};function t(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,o){if(i!=="_next"&&i!=="_prev")return o}return Hg}var Wg,bE;function c5(){if(bE)return Wg;bE=1;var e=at(),t=tr().Graph,r=u5();Wg=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var g=c(p,d||i),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],E=d[0],_;p.nodeCount();){for(;_=E.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 E=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),S=p.node(_.v);w&&E.push({v:_.v,w:_.w}),S.out-=b,f(d,g,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,k=p.node(S);k.in-=b,f(d,g,k)}),p.removeNode(y.v),E}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 S=g.edge(b.v,b.w)||0,k=d(b),N=S+k;g.setEdge(b.v,b.w,N),w=Math.max(w,g.node(b.v).out+=k),y=Math.max(y,g.node(b.w).in+=k)});var E=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(g.nodes(),function(b){f(E,_,g.node(b))}),{graph:g,buckets:E,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 Wg}var Vg,SE;function d5(){if(SE)return Vg;SE=1;var e=at(),t=c5();Vg={run:r,undo:o};function r(a){var u=a.graph().acyclicer==="greedy"?t(a,c(a)):i(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 i(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 Vg}var Gg,kE;function fn(){if(kE)return Gg;kE=1;var e=at(),t=tr().Graph;Gg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:g,maxRank:y,partition:w,time:E,notime:_};function r(b,S,k,N){var j;do j=e.uniqueId(N);while(b.hasNode(j));return k.dummy=S,b.setNode(j,k),j}function i(b){var S=new t().setGraph(b.graph());return e.forEach(b.nodes(),function(k){S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){var N=S.edge(k.v,k.w)||{weight:0,minlen:1},j=b.edge(k);S.setEdge(k.v,k.w,{weight:N.weight+j.weight,minlen:Math.max(N.minlen,j.minlen)})}),S}function o(b){var S=new t({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(k){b.children(k).length||S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){S.setEdge(k,b.edge(k))}),S}function a(b){var S=e.map(b.nodes(),function(k){var N={};return e.forEach(b.outEdges(k),function(j){N[j.w]=(N[j.w]||0)+b.edge(j).weight}),N});return e.zipObject(b.nodes(),S)}function u(b){var S=e.map(b.nodes(),function(k){var N={};return e.forEach(b.inEdges(k),function(j){N[j.v]=(N[j.v]||0)+b.edge(j).weight}),N});return e.zipObject(b.nodes(),S)}function c(b,S){var k=b.x,N=b.y,j=S.x-k,A=S.y-N,M=b.width/2,P=b.height/2;if(!j&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var O,D;return Math.abs(A)*M>Math.abs(j)*P?(A<0&&(P=-P),O=P*j/A,D=P):(j<0&&(M=-M),O=M,D=M*A/j),{x:k+O,y:N+D}}function f(b){var S=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(k){var N=b.node(k),j=N.rank;e.isUndefined(j)||(S[j][N.order]=k)}),S}function p(b){var S=e.min(e.map(b.nodes(),function(k){return b.node(k).rank}));e.forEach(b.nodes(),function(k){var N=b.node(k);e.has(N,"rank")&&(N.rank-=S)})}function d(b){var S=e.min(e.map(b.nodes(),function(A){return b.node(A).rank})),k=[];e.forEach(b.nodes(),function(A){var M=b.node(A).rank-S;k[M]||(k[M]=[]),k[M].push(A)});var N=0,j=b.graph().nodeRankFactor;e.forEach(k,function(A,M){e.isUndefined(A)&&M%j!==0?--N:N&&e.forEach(A,function(P){b.node(P).rank+=N})})}function g(b,S,k,N){var j={width:0,height:0};return arguments.length>=4&&(j.rank=k,j.order=N),r(b,"border",j,S)}function y(b){return e.max(e.map(b.nodes(),function(S){var k=b.node(S).rank;if(!e.isUndefined(k))return k}))}function w(b,S){var k={lhs:[],rhs:[]};return e.forEach(b,function(N){S(N)?k.lhs.push(N):k.rhs.push(N)}),k}function E(b,S){var k=e.now();try{return S()}finally{console.log(b+" time: "+(e.now()-k)+"ms")}}function _(b,S){return S()}return Gg}var Yg,EE;function f5(){if(EE)return Yg;EE=1;var e=at(),t=fn();Yg={run:r,undo:o};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(u){i(a,u)})}function i(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 E,_,b;for(b=0,++f;f<d;++b,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:f},E=t.addDummyNode(a,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),a.setEdge(c,E,{weight:y.weight},g),b===0&&a.graph().dummyChains.push(E),c=E;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 Yg}var Kg,NE;function Au(){if(NE)return Kg;NE=1;var e=at();Kg={longestPath:t,slack:r};function t(i){var o={};function a(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var f=e.min(e.map(i.outEdges(u),function(p){return a(p.w)-i.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),c.rank=f}e.forEach(i.sources(),a)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return Kg}var Xg,CE;function tT(){if(CE)return Xg;CE=1;var e=at(),t=tr().Graph,r=Au().slack;Xg=i;function i(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 Xg}var Qg,jE;function h5(){if(jE)return Qg;jE=1;var e=at(),t=tT(),r=Au().slack,i=Au().longestPath,o=tr().alg.preorder,a=tr().alg.postorder,u=fn().simplify;Qg=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=E,c.exchangeEdges=_;function c(N){N=u(N),i(N);var j=t(N);g(j),f(j,N);for(var A,M;A=w(j);)M=E(j,N,A),_(j,N,A,M)}function f(N,j){var A=a(N,N.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(M){p(N,j,M)})}function p(N,j,A){var M=N.node(A),P=M.parent;N.edge(A,P).cutvalue=d(N,j,A)}function d(N,j,A){var M=N.node(A),P=M.parent,O=!0,D=j.edge(A,P),L=0;return D||(O=!1,D=j.edge(P,A)),L=D.weight,e.forEach(j.nodeEdges(A),function(U){var V=U.v===A,z=V?U.w:U.v;if(z!==P){var C=V===O,F=j.edge(U).weight;if(L+=C?F:-F,S(N,A,z)){var $=N.edge(A,z).cutvalue;L+=C?-$:$}}}),L}function g(N,j){arguments.length<2&&(j=N.nodes()[0]),y(N,{},1,j)}function y(N,j,A,M,P){var O=A,D=N.node(M);return j[M]=!0,e.forEach(N.neighbors(M),function(L){e.has(j,L)||(A=y(N,j,A,L,M))}),D.low=O,D.lim=A++,P?D.parent=P:delete D.parent,A}function w(N){return e.find(N.edges(),function(j){return N.edge(j).cutvalue<0})}function E(N,j,A){var M=A.v,P=A.w;j.hasEdge(M,P)||(M=A.w,P=A.v);var O=N.node(M),D=N.node(P),L=O,U=!1;O.lim>D.lim&&(L=D,U=!0);var V=e.filter(j.edges(),function(z){return U===k(N,N.node(z.v),L)&&U!==k(N,N.node(z.w),L)});return e.minBy(V,function(z){return r(j,z)})}function _(N,j,A,M){var P=A.v,O=A.w;N.removeEdge(P,O),N.setEdge(M.v,M.w,{}),g(N),f(N,j),b(N,j)}function b(N,j){var A=e.find(N.nodes(),function(P){return!j.node(P).parent}),M=o(N,A);M=M.slice(1),e.forEach(M,function(P){var O=N.node(P).parent,D=j.edge(P,O),L=!1;D||(D=j.edge(O,P),L=!0),j.node(P).rank=j.node(O).rank+(L?D.minlen:-D.minlen)})}function S(N,j,A){return N.hasEdge(j,A)}function k(N,j,A){return A.low<=j.lim&&j.lim<=A.lim}return Qg}var Zg,TE;function p5(){if(TE)return Zg;TE=1;var e=Au(),t=e.longestPath,r=tT(),i=h5();Zg=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){i(f)}return Zg}var Jg,RE;function m5(){if(RE)return Jg;RE=1;var e=at();Jg=t;function t(o){var a=i(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],E=!0;u!==f.w;){if(c=o.node(u),E){for(;(w=d[y])!==g&&o.node(w).maxRank<c.rank;)y++;w===g&&(E=!1)}if(!E){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 i(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 Jg}var ev,AE;function g5(){if(AE)return ev;AE=1;var e=at(),t=fn();ev={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){i(c,f,g,y,d,p,w)}),c.graph().nodeRankFactor=g}function i(c,f,p,d,g,y,w){var E=c.children(w);if(!E.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(c,"_bt"),b=t.addBorderNode(c,"_bb"),S=c.node(w);c.setParent(_,w),S.borderTop=_,c.setParent(b,w),S.borderBottom=b,e.forEach(E,function(k){i(c,f,p,d,g,y,k);var N=c.node(k),j=N.borderTop?N.borderTop:k,A=N.borderBottom?N.borderBottom:k,M=N.borderTop?d:2*d,P=j!==A?1:g-y[w]+1;c.setEdge(_,j,{weight:M,minlen:P,nestingEdge:!0}),c.setEdge(A,b,{weight:M,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 ev}var tv,IE;function v5(){if(IE)return tv;IE=1;var e=at(),t=fn();tv=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)i(o,"borderLeft","_bl",u,f,p),i(o,"borderRight","_br",u,f,p)}}e.forEach(o.children(),a)}function i(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 tv}var nv,ME;function y5(){if(ME)return nv;ME=1;var e=at();nv={adjust:t,undo:r};function t(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&a(p),(d==="lr"||d==="rl")&&(c(p),i(p))}function i(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 nv}var rv,OE;function w5(){if(OE)return rv;OE=1;var e=at();rv=t;function t(r){var i={},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(i,p)){i[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 rv}var sv,PE;function x5(){if(PE)return sv;PE=1;var e=at();sv=t;function t(i,o){for(var a=0,u=1;u<o.length;++u)a+=r(i,o[u-1],o[u]);return a}function r(i,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(i.outEdges(y),function(w){return{pos:u[w.w],weight:i.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 E=0;w>0;)w%2&&(E+=d[w+1]),w=w-1>>1,d[w]+=y.weight;g+=y.weight*E})),g}return sv}var iv,LE;function _5(){if(LE)return iv;LE=1;var e=at();iv=t;function t(r,i){return e.map(i,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 iv}var ov,$E;function b5(){if($E)return ov;$E=1;var e=at();ov=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)&&i(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 i(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 ov}var av,qE;function S5(){if(qE)return av;qE=1;var e=at(),t=fn();av=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=i(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),g+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var E={vs:e.flatten(d,!0)};return y&&(E.barycenter=g/y,E.weight=y),E}function i(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 av}var lv,DE;function k5(){if(DE)return lv;DE=1;var e=at(),t=_5(),r=b5(),i=S5();lv=o;function o(c,f,p,d){var g=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,E=y?y.borderRight:void 0,_={};w&&(g=e.filter(g,function(A){return A!==w&&A!==E}));var b=t(c,g);e.forEach(b,function(A){if(c.children(A.v).length){var M=o(c,A.v,p,d);_[A.v]=M,e.has(M,"barycenter")&&u(A,M)}});var S=r(b,p);a(S,_);var k=i(S,d);if(w&&(k.vs=e.flatten([w,k.vs,E],!0),c.predecessors(w).length)){var N=c.node(c.predecessors(w)[0]),j=c.node(c.predecessors(E)[0]);e.has(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+N.order+j.order)/(k.weight+2),k.weight+=2}return k}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 lv}var uv,FE;function E5(){if(FE)return uv;FE=1;var e=at(),t=tr().Graph;uv=r;function r(o,a,u){var c=i(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,E=f.edge(w,p),_=e.isUndefined(E)?0:E.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 i(o){for(var a;o.hasNode(a=e.uniqueId("_root")););return a}return uv}var cv,zE;function N5(){if(zE)return cv;zE=1;var e=at();cv=t;function t(r,i,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){i.setEdge(d,f);return}f=p}})}return cv}var dv,BE;function C5(){if(BE)return dv;BE=1;var e=at(),t=w5(),r=x5(),i=k5(),o=E5(),a=N5(),u=tr().Graph,c=fn();dv=f;function f(y){var w=c.maxRank(y),E=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 S=Number.POSITIVE_INFINITY,k,N=0,j=0;j<4;++N,++j){d(N%2?E:_,N%4>=2),b=c.buildLayerMatrix(y);var A=r(y,b);A<S&&(j=0,k=e.cloneDeep(b),S=A)}g(y,k)}function p(y,w,E){return e.map(w,function(_){return o(y,_,E)})}function d(y,w){var E=new u;e.forEach(y,function(_){var b=_.graph().root,S=i(_,b,E,w);e.forEach(S.vs,function(k,N){_.node(k).order=N}),a(_,E,S.vs)})}function g(y,w){e.forEach(w,function(E){e.forEach(E,function(_,b){y.node(_).order=b})})}return dv}var fv,UE;function j5(){if(UE)return fv;UE=1;var e=at(),t=tr().Graph,r=fn();fv={positionX:E,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function i(S,k){var N={};function j(A,M){var P=0,O=0,D=A.length,L=e.last(M);return e.forEach(M,function(U,V){var z=a(S,U),C=z?S.node(z).order:D;(z||U===L)&&(e.forEach(M.slice(O,V+1),function(F){e.forEach(S.predecessors(F),function($){var re=S.node($),J=re.order;(J<P||C<J)&&!(re.dummy&&S.node(F).dummy)&&u(N,$,F)})}),O=V+1,P=C)}),M}return e.reduce(k,j),N}function o(S,k){var N={};function j(M,P,O,D,L){var U;e.forEach(e.range(P,O),function(V){U=M[V],S.node(U).dummy&&e.forEach(S.predecessors(U),function(z){var C=S.node(z);C.dummy&&(C.order<D||C.order>L)&&u(N,z,U)})})}function A(M,P){var O=-1,D,L=0;return e.forEach(P,function(U,V){if(S.node(U).dummy==="border"){var z=S.predecessors(U);z.length&&(D=S.node(z[0]).order,j(P,L,V,O,D),L=V,O=D)}j(P,L,P.length,D,M.length)}),P}return e.reduce(k,A),N}function a(S,k){if(S.node(k).dummy)return e.find(S.predecessors(k),function(N){return S.node(N).dummy})}function u(S,k,N){if(k>N){var j=k;k=N,N=j}var A=S[k];A||(S[k]=A={}),A[N]=!0}function c(S,k,N){if(k>N){var j=k;k=N,N=j}return e.has(S[k],N)}function f(S,k,N,j){var A={},M={},P={};return e.forEach(k,function(O){e.forEach(O,function(D,L){A[D]=D,M[D]=D,P[D]=L})}),e.forEach(k,function(O){var D=-1;e.forEach(O,function(L){var U=j(L);if(U.length){U=e.sortBy(U,function($){return P[$]});for(var V=(U.length-1)/2,z=Math.floor(V),C=Math.ceil(V);z<=C;++z){var F=U[z];M[L]===L&&D<P[F]&&!c(N,L,F)&&(M[F]=L,M[L]=A[L]=A[F],D=P[F])}}})}),{root:A,align:M}}function p(S,k,N,j,A){var M={},P=d(S,k,N,A),O=A?"borderLeft":"borderRight";function D(V,z){for(var C=P.nodes(),F=C.pop(),$={};F;)$[F]?V(F):($[F]=!0,C.push(F),C=C.concat(z(F))),F=C.pop()}function L(V){M[V]=P.inEdges(V).reduce(function(z,C){return Math.max(z,M[C.v]+P.edge(C))},0)}function U(V){var z=P.outEdges(V).reduce(function(F,$){return Math.min(F,M[$.w]-P.edge($))},Number.POSITIVE_INFINITY),C=S.node(V);z!==Number.POSITIVE_INFINITY&&C.borderType!==O&&(M[V]=Math.max(M[V],z))}return D(L,P.predecessors.bind(P)),D(U,P.successors.bind(P)),e.forEach(j,function(V){M[V]=M[N[V]]}),M}function d(S,k,N,j){var A=new t,M=S.graph(),P=_(M.nodesep,M.edgesep,j);return e.forEach(k,function(O){var D;e.forEach(O,function(L){var U=N[L];if(A.setNode(U),D){var V=N[D],z=A.edge(V,U);A.setEdge(V,U,Math.max(P(S,L,D),z||0))}D=L})}),A}function g(S,k){return e.minBy(e.values(k),function(N){var j=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(N,function(M,P){var O=b(S,P)/2;j=Math.max(M+O,j),A=Math.min(M-O,A)}),j-A})}function y(S,k){var N=e.values(k),j=e.min(N),A=e.max(N);e.forEach(["u","d"],function(M){e.forEach(["l","r"],function(P){var O=M+P,D=S[O],L;if(D!==k){var U=e.values(D);L=P==="l"?j-e.min(U):A-e.max(U),L&&(S[O]=e.mapValues(D,function(V){return V+L}))}})})}function w(S,k){return e.mapValues(S.ul,function(N,j){if(k)return S[k.toLowerCase()][j];var A=e.sortBy(e.map(S,j));return(A[1]+A[2])/2})}function E(S){var k=r.buildLayerMatrix(S),N=e.merge(i(S,k),o(S,k)),j={},A;e.forEach(["u","d"],function(P){A=P==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(O){O==="r"&&(A=e.map(A,function(V){return e.values(V).reverse()}));var D=(P==="u"?S.predecessors:S.successors).bind(S),L=f(S,A,N,D),U=p(S,A,L.root,L.align,O==="r");O==="r"&&(U=e.mapValues(U,function(V){return-V})),j[P+O]=U})});var M=g(S,j);return y(j,M),w(j,S.graph().align)}function _(S,k,N){return function(j,A,M){var P=j.node(A),O=j.node(M),D=0,L;if(D+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":L=-P.width/2;break;case"r":L=P.width/2;break}if(L&&(D+=N?L:-L),L=0,D+=(P.dummy?k:S)/2,D+=(O.dummy?k:S)/2,D+=O.width/2,e.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":L=O.width/2;break;case"r":L=-O.width/2;break}return L&&(D+=N?L:-L),L=0,D}}function b(S,k){return S.node(k).width}return fv}var hv,HE;function T5(){if(HE)return hv;HE=1;var e=at(),t=fn(),r=j5().positionX;hv=i;function i(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 hv}var pv,WE;function R5(){if(WE)return pv;WE=1;var e=at(),t=d5(),r=f5(),i=p5(),o=fn().normalizeRanks,a=m5(),u=fn().removeEmptyRanks,c=g5(),f=v5(),p=y5(),d=C5(),g=T5(),y=fn(),w=tr().Graph;pv=E;function E(q,Q){var ne=Q&&Q.debugTiming?y.time:y.notime;ne("layout",function(){var ae=ne(" buildLayoutGraph",function(){return D(q)});ne(" runLayout",function(){_(ae,ne)}),ne(" updateInputGraph",function(){b(q,ae)})})}function _(q,Q){Q(" makeSpaceForEdgeLabels",function(){L(q)}),Q(" removeSelfEdges",function(){W(q)}),Q(" acyclic",function(){t.run(q)}),Q(" nestingGraph.run",function(){c.run(q)}),Q(" rank",function(){i(y.asNonCompoundGraph(q))}),Q(" injectEdgeLabelProxies",function(){U(q)}),Q(" removeEmptyRanks",function(){u(q)}),Q(" nestingGraph.cleanup",function(){c.cleanup(q)}),Q(" normalizeRanks",function(){o(q)}),Q(" assignRankMinMax",function(){V(q)}),Q(" removeEdgeLabelProxies",function(){z(q)}),Q(" normalize.run",function(){r.run(q)}),Q(" parentDummyChains",function(){a(q)}),Q(" addBorderSegments",function(){f(q)}),Q(" order",function(){d(q)}),Q(" insertSelfEdges",function(){Z(q)}),Q(" adjustCoordinateSystem",function(){p.adjust(q)}),Q(" position",function(){g(q)}),Q(" positionSelfEdges",function(){I(q)}),Q(" removeBorderNodes",function(){J(q)}),Q(" normalize.undo",function(){r.undo(q)}),Q(" fixupEdgeLabelCoords",function(){$(q)}),Q(" undoCoordinateSystem",function(){p.undo(q)}),Q(" translateGraph",function(){C(q)}),Q(" assignNodeIntersects",function(){F(q)}),Q(" reversePoints",function(){re(q)}),Q(" acyclic.undo",function(){t.undo(q)})}function b(q,Q){e.forEach(q.nodes(),function(ne){var ae=q.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(q.edges(),function(ne){var ae=q.edge(ne),fe=Q.edge(ne);ae.points=fe.points,e.has(fe,"x")&&(ae.x=fe.x,ae.y=fe.y)}),q.graph().width=Q.graph().width,q.graph().height=Q.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],j=["width","height"],A={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},O=["labelpos"];function D(q){var Q=new w({multigraph:!0,compound:!0}),ne=K(q.graph());return Q.setGraph(e.merge({},k,G(ne,S),e.pick(ne,N))),e.forEach(q.nodes(),function(ae){var fe=K(q.node(ae));Q.setNode(ae,e.defaults(G(fe,j),A)),Q.setParent(ae,q.parent(ae))}),e.forEach(q.edges(),function(ae){var fe=K(q.edge(ae));Q.setEdge(ae,e.merge({},P,G(fe,M),e.pick(fe,O)))}),Q}function L(q){var Q=q.graph();Q.ranksep/=2,e.forEach(q.edges(),function(ne){var ae=q.edge(ne);ae.minlen*=2,ae.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?ae.width+=ae.labeloffset:ae.height+=ae.labeloffset)})}function U(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q);if(ne.width&&ne.height){var ae=q.node(Q.v),fe=q.node(Q.w),te={rank:(fe.rank-ae.rank)/2+ae.rank,e:Q};y.addDummyNode(q,"edge-proxy",te,"_ep")}})}function V(q){var Q=0;e.forEach(q.nodes(),function(ne){var ae=q.node(ne);ae.borderTop&&(ae.minRank=q.node(ae.borderTop).rank,ae.maxRank=q.node(ae.borderBottom).rank,Q=e.max(Q,ae.maxRank))}),q.graph().maxRank=Q}function z(q){e.forEach(q.nodes(),function(Q){var ne=q.node(Q);ne.dummy==="edge-proxy"&&(q.edge(ne.e).labelRank=ne.rank,q.removeNode(Q))})}function C(q){var Q=Number.POSITIVE_INFINITY,ne=0,ae=Number.POSITIVE_INFINITY,fe=0,te=q.graph(),ce=te.marginx||0,Ce=te.marginy||0;function ve(Re){var ye=Re.x,Ee=Re.y,Ye=Re.width,we=Re.height;Q=Math.min(Q,ye-Ye/2),ne=Math.max(ne,ye+Ye/2),ae=Math.min(ae,Ee-we/2),fe=Math.max(fe,Ee+we/2)}e.forEach(q.nodes(),function(Re){ve(q.node(Re))}),e.forEach(q.edges(),function(Re){var ye=q.edge(Re);e.has(ye,"x")&&ve(ye)}),Q-=ce,ae-=Ce,e.forEach(q.nodes(),function(Re){var ye=q.node(Re);ye.x-=Q,ye.y-=ae}),e.forEach(q.edges(),function(Re){var ye=q.edge(Re);e.forEach(ye.points,function(Ee){Ee.x-=Q,Ee.y-=ae}),e.has(ye,"x")&&(ye.x-=Q),e.has(ye,"y")&&(ye.y-=ae)}),te.width=ne-Q+ce,te.height=fe-ae+Ce}function F(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q),ae=q.node(Q.v),fe=q.node(Q.w),te,ce;ne.points?(te=ne.points[0],ce=ne.points[ne.points.length-1]):(ne.points=[],te=fe,ce=ae),ne.points.unshift(y.intersectRect(ae,te)),ne.points.push(y.intersectRect(fe,ce))})}function $(q){e.forEach(q.edges(),function(Q){var ne=q.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 re(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q);ne.reversed&&ne.points.reverse()})}function J(q){e.forEach(q.nodes(),function(Q){if(q.children(Q).length){var ne=q.node(Q),ae=q.node(ne.borderTop),fe=q.node(ne.borderBottom),te=q.node(e.last(ne.borderLeft)),ce=q.node(e.last(ne.borderRight));ne.width=Math.abs(ce.x-te.x),ne.height=Math.abs(fe.y-ae.y),ne.x=te.x+ne.width/2,ne.y=ae.y+ne.height/2}}),e.forEach(q.nodes(),function(Q){q.node(Q).dummy==="border"&&q.removeNode(Q)})}function W(q){e.forEach(q.edges(),function(Q){if(Q.v===Q.w){var ne=q.node(Q.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:Q,label:q.edge(Q)}),q.removeEdge(Q)}})}function Z(q){var Q=y.buildLayerMatrix(q);e.forEach(Q,function(ne){var ae=0;e.forEach(ne,function(fe,te){var ce=q.node(fe);ce.order=te+ae,e.forEach(ce.selfEdges,function(Ce){y.addDummyNode(q,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:ce.rank,order:te+ ++ae,e:Ce.e,label:Ce.label},"_se")}),delete ce.selfEdges})})}function I(q){e.forEach(q.nodes(),function(Q){var ne=q.node(Q);if(ne.dummy==="selfedge"){var ae=q.node(ne.e.v),fe=ae.x+ae.width/2,te=ae.y,ce=ne.x-fe,Ce=ae.height/2;q.setEdge(ne.e,ne.label),q.removeNode(Q),ne.label.points=[{x:fe+2*ce/3,y:te-Ce},{x:fe+5*ce/6,y:te-Ce},{x:fe+ce,y:te},{x:fe+5*ce/6,y:te+Ce},{x:fe+2*ce/3,y:te+Ce}],ne.label.x=ne.x,ne.label.y=ne.y}})}function G(q,Q){return e.mapValues(e.pick(q,Q),Number)}function K(q){var Q={};return e.forEach(q,function(ne,ae){Q[ae.toLowerCase()]=ne}),Q}return pv}var mv,VE;function A5(){if(VE)return mv;VE=1;var e=at(),t=fn(),r=tr().Graph;mv={debugOrdering:i};function i(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 mv}var gv,GE;function I5(){return GE||(GE=1,gv="0.8.5"),gv}var vv,YE;function M5(){return YE||(YE=1,vv={graphlib:tr(),layout:R5(),debug:A5(),util:{time:fn().time,notime:fn().notime},version:I5()}),vv}var O5=M5();const KE=Wv(O5),yo=240,Iu=130,co=74,ic=72,XE=co+ic;function P5(e,t){var i;let r=yo;for(const o of e)r=Math.max(r,((i=t.get(o.id))==null?void 0:i.width)??yo);return r}const nT=420,L5=2;function ja(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function $5(e,t){return((t==null?void 0:t.get(e))??0)>0?nT:0}function q5(e,t){const r=(t==null?void 0:t.get(e))??0;return r>0?6+r*36:0}function Ta(e,t,r){const i=t.get(e);return{w:((i==null?void 0:i.width)??yo)+$5(e,r),h:Math.max((i==null?void 0:i.height)??Iu,q5(e,r))}}function D5(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function F5(e,t,r,i,o,a){const u=new KE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(S=>!o.has(S)),f=new Set(c);for(const S of c){const{w:k,h:N}=Ta(S,i,a);u.setNode(S,{width:k,height:N})}for(const S of t)f.has(S.source)&&f.has(S.target)&&u.setEdge(S.source,S.target);KE.layout(u);const p=new Map;let d=1/0,g=1/0,y=-1/0,w=-1/0;for(const S of c){const k=u.node(S);if(!k)continue;const N=i.get(S),j=(N==null?void 0:N.width)??yo,A=(N==null?void 0:N.height)??Iu,M=Ta(S,i,a),P=k.x-M.w/2,O=k.y-M.h/2;p.set(S,{x:P,y:O}),P<d&&(d=P),O<g&&(g=O),P+j>y&&(y=P+j),O+A>w&&(w=O+A)}if(Number.isFinite(d)&&Number.isFinite(g))for(const[S,k]of p)p.set(S,{x:k.x-d,y:k.y-g});const E=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-g:0;let b=null;for(const S of e){const k=o.get(S);if(!k)continue;const N=i.get(S),j=(N==null?void 0:N.width)??yo,A=(N==null?void 0:N.height)??Iu;b=b===null?{minX:k.x,minY:k.y,maxX:k.x+j,maxY:k.y+A}:{minX:Math.min(b.minX,k.x),minY:Math.min(b.minY,k.y),maxX:Math.max(b.maxX,k.x+j),maxY:Math.max(b.maxY,k.y+A)}}return{positions:p,width:E,height:_,pinnedBox:b}}function z5(e,t,r={}){const i=r.direction??"LR",o=r.pinned??new Map,a=r.measured??new Map,u=r.lanes,c=new Map;for(const S of e){const k=ja(S),N=c.get(k);N?N.push(S.id):c.set(k,[S.id])}const p=Array.from(c.keys()).sort().map(S=>({sid:S,...F5(c.get(S),t,i,a,o,u)})),d=P5(e,a),g=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=S=>{const k=[[]];let N=0;for(const j of p)k.length<S&&N>0&&N+j.height>g&&(k.push([]),N=0),k[k.length-1].push(j),N+=j.height+XE;return k},w=S=>S.reduce((k,N)=>Math.max(k,N.width),0)+nT;let E=y(r.availableWidth?L5:1);E.length>1&&E.reduce((k,N)=>k+w(N),0)+d*(E.length-1)>(r.availableWidth??0)&&(E=y(1));const _=new Map;let b=0;for(const S of E){const k=w(S);let N=0;for(const{positions:j,height:A,pinnedBox:M}of S){for(const[O,D]of j)_.set(O,{x:D.x+b,y:D.y+N});let P=N+A;M&&M.maxY>P&&M.minX<b+k&&b<M.maxX&&(P=M.maxY),N=P+XE}b+=k+d}return e.map(S=>{const k=o.get(S.id);if(k)return{...S,position:k};const N=_.get(S.id);return N?{...S,position:N}:S})}function B5(e,t,r,i,o){const u=co+ic,c=60,f=w=>Ta(w,i,o),p=new Map(e.map(w=>[w.id,ja(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,E)=>w.pos.y-E.pos.y||w.pos.x-E.pos.x||w.id.localeCompare(E.id)),y=[];for(const{id:w,pos:E}of g){const{w:_,h:b}=f(w),S=p.get(w)??"_default";if(r.has(w)){d.push({x:E.x,y:E.y,w:_,h:b,sid:S});continue}let k=E.y;for(let N=0;N<d.length+1;N++){const j=d.find(A=>{const M=A.sid===S?24:c,P=A.sid===S?24:u;return E.x<A.x+A.w+M&&A.x<E.x+_+M&&k<A.y+A.h+P&&A.y<k+b+P});if(!j)break;k=j.y+j.h+(j.sid===S?24:u)}k!==E.y&&(t.set(w,{x:E.x,y:k}),y.push(w)),d.push({x:E.x,y:k,w:_,h:b,sid:S})}return y}function U5(e,t,r,i,o,a){const u=_=>Ta(_,i,a),c=_=>r.get(_)??t.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=ja(_),S=f.get(b);S?S.push(_):f.set(b,[_])}const p=new Set;for(const[_,b]of f)b.every(S=>o.has(S.id)&&!r.has(S.id))&&p.add(_);const d=new Map,g=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:k}=u(_.id),N=ja(_);p.has(N)?(d.get(N)??d.set(N,[]).get(N)).push(_):g.push({x:b.x,y:b.y,w:S,h:k})}if(d.size===0)return[];const y=co+ic,w=(_,b,S,k)=>g.some(N=>_<N.x+N.w+co&&N.x<_+S+co&&b<N.y+N.h+y&&N.y<b+k+y),E=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let S=1/0,k=1/0,N=-1/0,j=-1/0;for(const U of b){const V=c(U.id),{w:z,h:C}=u(U.id);S=Math.min(S,V.x),k=Math.min(k,V.y),N=Math.max(N,V.x+z),j=Math.max(j,V.y+C)}const A=N-S,M=j-k,P=[...new Set(g.map(U=>Math.round(U.x)))].sort((U,V)=>U-V),O=P.length?P:[S],D=[0,...g.map(U=>U.y+U.h+y)].sort((U,V)=>U-V);let L=null;e:for(const U of O)for(const V of D){if(V>=k)break;if(!w(U,V,A,M)){L={x:U,y:V};break e}}if(L){const U=L.x-S,V=L.y-k;for(const z of b){const C=c(z.id);t.set(z.id,{x:C.x+U,y:C.y+V})}E.push(_)}for(const U of b){const V=c(U.id),{w:z,h:C}=u(U.id);g.push({x:V.x,y:V.y,w:z,h:C})}}return E}function H5(e,t,r,i,o,a=!1,u){const p=co+ic+1,d=8,g=1.75,y=200,w=.7,E=.01,_=L=>Ta(L,i,u),b=L=>r.get(L)??t.get(L),S=new Map;for(const L of e){if(!b(L.id))continue;const U=ja(L),V=S.get(U);V?V.push(L):S.set(U,[L])}const k=[],N=new Set,j=new Set,A=o.size===0;for(const L of[...S.keys()].sort()){const U=S.get(L);let V=1/0,z=1/0,C=-1/0,F=-1/0,$=!1;for(const Z of U){const I=b(Z.id),{w:G,h:K}=_(Z.id);V=Math.min(V,I.x),z=Math.min(z,I.y),C=Math.max(C,I.x+G),F=Math.max(F,I.y+K),r.has(Z.id)&&($=!0)}const re=C-V,J=F-z;j.add(L);const W=o.get(L);W&&(re>W.w+d||J>W.h+d)&&N.add(L),o.set(L,{w:re,h:J}),k.push({sid:L,members:U.map(Z=>Z.id),x:V,y:z,w:re,h:J,anchored:$,mass:1})}for(const L of[...o.keys()])j.has(L)||o.delete(L);if(a||A)return[];let M=!1;for(let L=0;L<k.length&&!M;L++)for(let U=L+1;U<k.length;U++){const V=k[L],z=k[U];if(!(V.anchored&&z.anchored)&&Math.abs(V.x+V.w/2-(z.x+z.w/2))<(V.w+z.w)/2+61&&Math.abs(V.y+V.h/2-(z.y+z.h/2))<(V.h+z.h)/2+p){M=!0;break}}if(N.size===0&&!M)return[];if(N.size>0)for(const L of k)N.has(L.sid)&&(L.mass=8);else for(const L of k)L.mass=Math.max(1,L.w*L.h/(yo*Iu));const P=new Map(k.map(L=>[L.sid,L.x])),O=new Map(k.map(L=>[L.sid,L.y]));for(let L=0;L<y;L++){const U=new Map,V=new Map;let z=0;for(let C=0;C<k.length;C++)for(let F=C+1;F<k.length;F++){const $=k[C],re=k[F];if($.anchored&&re.anchored)continue;const J=$.x+$.w/2,W=$.y+$.h/2,Z=re.x+re.w/2,I=re.y+re.h/2,G=($.w+re.w)/2+61-Math.abs(J-Z),K=($.h+re.h)/2+p-Math.abs(W-I);if(G<=0||K<=0)continue;const q=(De,Je)=>!De.anchored&&!(Je<0&&De.x<=0),Q=(De,Je)=>!De.anchored&&!(Je<0&&De.y<=0),ne=(De,Je,Xe)=>{const Ot=De===Je,lt=Ot?$.sid<re.sid?-1:1:Math.sign(De-Je);return Xe($,lt)||Xe(re,-lt)?lt:Ot&&(Xe($,-lt)||Xe(re,lt))?-lt:0},ae=ne(J,Z,q),fe=ne(W,I,Q),te=ae!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||G*g<K),[ve,Re,ye,Ee]=Ce?[ae,G,U,q]:[fe,K,V,Q],Ye=Ee($,ve),we=Ee(re,-ve),_e=$.mass,Be=re.mass,it=Ye?we?Be/(_e+Be):1:0,ft=we?Ye?_e/(_e+Be):1:0,Ze=Re*w;ye.set($.sid,(ye.get($.sid)??0)+ve*Ze*it),ye.set(re.sid,(ye.get(re.sid)??0)-ve*Ze*ft),z+=Ze}for(const C of k)C.anchored||(C.x=Math.max(0,C.x+(U.get(C.sid)??0)),C.y=Math.max(0,C.y+(V.get(C.sid)??0)));if(z<E)break}const D=[];for(const L of k){const U=L.x-P.get(L.sid),V=L.y-O.get(L.sid);if(!(Math.abs(U)<1&&Math.abs(V)<1)){for(const z of L.members){if(r.has(z))continue;const C=t.get(z);C&&t.set(z,{x:C.x+U,y:C.y+V})}D.push(L.sid)}}return D}const W5=600;function zv(e,t){return!(e.exitAt!=null&&t-e.exitAt>W5||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function V5(e,t){const r=new Set;for(const i of e.agents.values())zv(i,t)&&r.add(i.id);return r}function G5(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 Y5(e,t,r=0){if(!e)return!1;for(const i of t)if(G5(e,i,r))return!0;return!1}const rT="sessionGroup";function K5(e,t){var i;if(e.type===rT)return"transparent";const r=(i=e.data)==null?void 0:i.state;return t(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const X5="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function Q5(e){if(e.checkDisabled)return X5;if(e.checking)return"Asking npm for the newest release…";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 · click to check npm now`}function Z5(e){const t=`Version v${e.running}`;return e.checkDisabled?`${t}, update checks are off`:e.checking?`${t}, checking npm for a newer release`:`${t}, check npm for a newer release`}function J5(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`;return`Version v${e.from}, ${t} — ${e.open?"hide":"show"} the notice`}function eF(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 Bv={kind:"assumed",claude:!0,codex:!0};function tF(e){if(!e||typeof e!="object")return Bv;const t=e.providers;if(!t||typeof t!="object")return Bv;const r=t;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function sT(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}function nF(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${sT(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",title:"Receiving events"}:{tone:"dead",label:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function rF(e){return e.paused?e.held<=0?{label:"Resume",title:"Nothing has arrived since you paused. Resume to follow the canvas again (Space)"}:{label:`Resume · ${e.held} held`,title:`${sT(e.held)} arrived while paused and will be applied in order when you resume (Space)`}:{label:"Pause",title:"Pause live updates — events keep arriving and are applied when you resume (Space)"}}function iT(e,t){return e!==""&&t>0}function sF(e,t,r){return e===""?{active:!1,matched:t,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:t,total:r,count:`${t} of ${r}`,empty:t===0,message:t===0?`No agents match “${e}”`:null,dim:iT(e,t)}}const iF="Search agents, tools, model…";function oT(e,t){var i,o,a,u;if(!t)return!0;const r=t.toLowerCase();if(e.label.toLowerCase().includes(r)||(i=e.cwd)!=null&&i.toLowerCase().includes(r)||(o=e.cwdBasename)!=null&&o.toLowerCase().includes(r)||e.sessionId.toLowerCase().includes(r)||(a=e.firstPrompt)!=null&&a.toLowerCase().includes(r)||e.model&&(e.model.toLowerCase().includes(r)||Rs(e.model).toLowerCase().includes(r))||(u=e.provider)!=null&&u.toLowerCase().startsWith(r))return!0;for(const c of e.tools)if(c.name.toLowerCase().includes(r))return!0;return!1}function fa(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const oF={agent:_L,sessionGroup:ML},aT="react-flow__node";function QE(e){var t,r;return!!e&&((r=(t=e.classList)==null?void 0:t.contains)==null?void 0:r.call(t,aT))===!0}function aF(e){try{const t=document.querySelector(`.${aT}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const lF=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),uF=420,du=18,cF=200,dF=5*6e4,fF=6,hF=2*6e4,Py="agent-dag.layout",Ly="agent-dag.viewport",lT="agent-dag.summariesDismissed",uT="agent-dag.sessionListOpen",cT="agent-dag.detailOpen",dT="agent-dag.usagePanelOpen",ZE="agent-dag.accountsPanelOpen",JE="agent-dag.versionNoticeDismissed",eN="agent-dag.oldNameNoticeDismissed",pF=15*6e4,yv={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:"},tN="agent-dag.autoRestart",nN="agent-dag.bundleReloadedFor";function mF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(uT)==="1"}catch{return!1}}function gF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(uT,e?"1":"0")}catch{}}function vF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(cT)==="1"}catch{return!1}}function yF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(cT,e?"1":"0")}catch{}}function wF(){const e=py(dT);return e===null?!0:e==="1"}function xF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(dT,e?"1":"0")}catch{}}function _F(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(lT);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 rN(e){if(!(typeof window>"u"))try{const t=Array.from(e),r=t.length>200?t.slice(-200):t;window.localStorage.setItem(lT,JSON.stringify(r))}catch{}}function bF(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Py);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 wv(e,t){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of t)r[i]=o;window.localStorage.setItem(Py,JSON.stringify({v:2,positions:r,pins:Array.from(t.keys())}))}catch{}}function SF(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Ly);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 kF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Ly,JSON.stringify(e))}catch{}}function sN(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Py)}catch{}try{window.localStorage.removeItem(Ly)}catch{}}}function EF(e,t){const r=e.agents.get(t);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===t&&i.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:i.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=`${Gt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Uv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Hv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},fT=BC;function NF(e,t){if(!t)return null;const r=new Set([t]);let i=t;for(;i;){const a=e.agents.get(i);if(!(a!=null&&a.parentId)||r.has(a.parentId))break;r.add(a.parentId),i=a.parentId}let o=!0;for(;o;){o=!1;for(const a of e.agents.values())a.parentId&&r.has(a.parentId)&&!r.has(a.id)&&(r.add(a.id),o=!0)}return r}function CF(e,t,r,i,o,a,u,c,f,p,d,g,y,w,E,_,b,S,k){const N=[],j=[],A=new Set;if(a)for(const z of e.agents.values())S.has(z.id)&&oT(z,a)&&A.add(z.id);const M=iT(a,A.size);for(const z of e.agents.values()){if(!S.has(z.id))continue;const C=M&&!A.has(z.id),F=z.exitAt!=null,$=b!=null&&!b.has(z.id),re=[C?"rf-dim":"",F?"rf-exiting":"",$?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,J=u.get(z.id);if(N.push({id:z.id,type:"agent",position:{x:0,y:0},data:{...z,now:t,onOpenContext:k},className:re,...J?{width:J.width,height:J.height}:null}),z.parentId&&S.has(z.parentId)){const W=uy(z.sessionId),Z=a&&!A.has(z.id)&&!A.has(z.parentId),I=F,G=_.size>0&&(_.has(z.id)||_.has(z.parentId)),K=b!=null&&!b.has(z.id)&&!b.has(z.parentId),q=z.state==="active"?2:1.5,Q=G?q+1.5:q,ne=Z||I?.2:K?.12:1,ae=["sess-edge",z.state==="active"?"sess-live":"sess-idle",I?"rf-edge-exiting":"",G?"rf-edge-selected":""].filter(Boolean).join(" ");j.push({id:`e:${z.parentId}->${z.id}`,source:z.parentId,target:z.id,animated:(z.state==="active"||G)&&!Z&&!I,type:"smoothstep",style:{"--session-hue":W,strokeWidth:Q,opacity:ne,transition:"var(--edge-transition)"},className:ae})}}const P=new Map;for(const z of e.agents.values())z.tools.length>0&&P.set(z.id,Math.min(4,z.tools.length));const O=`${w}#lanes:${D5(P)}`,D=N.filter(z=>H3(z.id,o,g,y));if(D.length>0||O!==E.current){if(D.length>0){const z=z5(N,j,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:P});for(const C of z)JC(C.id,g,y)&&V3(C.id,C.position,g,y);U5(N,g,o,u,new Set(D.map(C=>C.id)),P)}B5(N,g,o,u,P),E.current=O}const L=H5(N,g,o,u,c,!p||d,P);L.length>0&&f(L),au(g,e.agents),au(y,e.agents),au(o,e.agents),au(u,U3(e.agents.values()));const U=[];let V=!1;for(const z of N){let C=o.get(z.id)??g.get(z.id);C||(C=W3(z.id,g,y),V=!0),U.push({...z,position:C})}return V&&(E.current=""),{nodes:U,edges:j}}function jF(){return m.jsx(ly,{children:m.jsx(TF,{})})}function TF(){var Xa,Qa,Za,Ja;const e=Oa(),t=R.useRef(Lv()),[,r]=R.useState(0),i=R.useCallback(()=>r(H=>H+1),[]),[o,a]=R.useState(()=>new Set),[u,c]=R.useState(null),[f,p]=R.useState(null),d=R.useCallback((H,Y)=>{a(oe=>{if(!Y)return new Set([H]);const de=new Set(oe);return de.has(H)?de.delete(H):de.add(H),de}),c(oe=>Y&&oe===H?oe:H)},[]),g=R.useCallback(()=>{a(new Set),c(null)},[]),[y,w]=R.useState(null),[E,_]=R.useState(null),b=R.useCallback(H=>_(H),[]),[S,k]=R.useState(!1),N=R.useRef(_F()),[j,A]=R.useState(mF);R.useEffect(()=>{gF(j)},[j]);const[M,P]=R.useState(vF);R.useEffect(()=>{yF(M)},[M]);const[O,D]=R.useState(wF);R.useEffect(()=>{xF(O)},[O]);const[L,U]=R.useState(()=>{try{const H=window.localStorage.getItem(ZE);return H===null?!0:H==="1"}catch{return!0}});R.useEffect(()=>{try{window.localStorage.setItem(ZE,L?"1":"0")}catch{}},[L]);const[V,z]=R.useState(null),[C,F]=R.useState(!1),[$,re]=R.useState(0),[J,W]=R.useState(0);R.useEffect(()=>{fetch("/api/sound-hook").then(H=>H.ok?H.json():null).then(H=>{H!=null&&H.ok&&(z(H.enabled===!0),re((H.foreign??[]).filter(Y=>Y.worksHere).length),W(typeof H.parked=="number"?H.parked:0))}).catch(()=>{})},[]);const Z=R.useCallback(async()=>{F(!0);try{const Y=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!V})})).json().catch(()=>null);Y!=null&&Y.ok&&z(Y.enabled===!0),fetch("/api/sound-hook").then(oe=>oe.ok?oe.json():null).then(oe=>{oe!=null&&oe.ok&&(re((oe.foreign??[]).filter(de=>de.worksHere).length),W(typeof oe.parked=="number"?oe.parked:0))}).catch(()=>{})}catch{}finally{F(!1)}},[V]),[I,G]=R.useState(!1),[K,q]=R.useState(null),[Q,ne]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(JE)??""}catch{return""}}),[ae,fe]=R.useState(!1),te=R.useRef(0),[ce,Ce]=R.useState(!1),ve=R.useCallback((H=!1)=>{H&&(te.current=Date.now(),Ce(!0)),fetch(H?"/api/version?refresh=1":"/api/version").then(Y=>Y.ok?Y.json():null).then(Y=>{Y&&q(Y)}).catch(()=>{}).finally(()=>{H&&Ce(!1)})},[]),Re=R.useCallback(()=>{ve(Date.now()-te.current>=pF)},[ve]);R.useEffect(()=>{ve();const H=window.setInterval(Re,5*6e4),Y=()=>{document.visibilityState==="visible"&&Re()};return document.addEventListener("visibilitychange",Y),()=>{window.clearInterval(H),document.removeEventListener("visibilitychange",Y)}},[ve,Re]),R.useEffect(()=>{I&&ve()},[I,ve]);const ye=(K==null?void 0:K.notice)??null,[Ee,Ye]=R.useState(null),[we,_e]=R.useState(Bv);R.useEffect(()=>{let H=!1;return fetch("/api/health").then(Y=>Y.ok?Y.json():null).then(Y=>{H||(_e(tF(Y)),!(!Y||typeof Y.workspace!="string")&&Ye(Y.workspace))}).catch(()=>{}),()=>{H=!0}},[I]);const Be=R.useRef(we);Be.current=we;const it=ye?`${ye.kind}:${ye.to}`:"",ft=ye!=null&&Q!==it,Ze=R.useCallback(()=>{if(!ye)return;const H=Q===it?"":it;ne(H);try{window.localStorage.setItem(JE,H)}catch{}},[ye,it,Q]),[De,Je]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(eN)??""}catch{return""}}),Xe=K!=null&&K.invokedAs&&K.invokedAs!==Gt?K.invokedAs:null,Ot=Xe!=null&&De!==Xe,lt=R.useCallback(()=>{if(Xe){Je(Xe);try{window.localStorage.setItem(eN,Xe)}catch{}}},[Xe]),Qe=((Xa=K==null?void 0:K.upgrade)==null?void 0:Xa.state)??"idle",Pt=I3(K==null?void 0:K.upgrade),zt=R.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);R.useEffect(()=>{if(Qe!=="running")return;const H=window.setInterval(ve,3e3);return()=>window.clearInterval(H)},[Qe,ve]);const et=R.useCallback(async()=>{var oe;const H=K==null?void 0:K.command;if(!H)return;let Y=!1;try{Y=await Promise.race([((oe=navigator.clipboard)==null?void 0:oe.writeText(H).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{Y=!1}if(!Y)try{const de=document.createElement("textarea");de.value=H,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),Y=document.execCommand("copy"),de.remove()}catch{Y=!1}Y&&(fe(!0),window.setTimeout(()=>fe(!1),1600))},[K==null?void 0:K.command]),bt=R.useCallback(()=>{A(H=>(H||U(!1),!H))},[]),ht=R.useCallback(()=>{U(H=>(H||A(!1),!H))},[]),[vt,hn]=R.useState(!1),[Yt,Lt]=R.useState(0),bn=R.useRef(null),[gr,Sn]=R.useState(!1),Bt=R.useRef(null),[Fn,pn]=R.useState(0),vr=R.useRef(X3()),[Hr,xi]=R.useState(!1),Wr=R.useCallback(()=>{const H=vr.current,Y=H.setPaused(!H.paused);for(const oe of Y)t.current=Qx(t.current,oe);xi(H.paused)},[]),[ut,_i]=R.useState(Date.now()),[mn,Is]=R.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(tN)!=="0"}catch{return!0}}),yr=R.useCallback(()=>{Is(H=>{const Y=!H;try{window.localStorage.setItem(tN,Y?"1":"0")}catch{}return Y})},[]),[zn,kn]=R.useState(!1),[Vr,Gr]=R.useState("restart"),[Yr,bi]=R.useState(null),sr=R.useRef(!1),Ms=R.useRef(null),En=R.useRef(0),wr=R.useCallback(async H=>{if(sr.current)return;const Y=(H==null?void 0:H.upgrade)===!0;sr.current=!0,Ms.current=Pt;const oe=++En.current;Gr(Y?"npx":"restart"),kn(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ye==null?void 0:ye.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:Y})})}catch{}window.setTimeout(()=>{if(En.current===oe&&sr.current){sr.current=!1,kn(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},Y?18e4:3e4)},[ye==null?void 0:ye.to,Pt]),Os=R.useRef(null);R.useEffect(()=>{let H=!1;for(const oe of t.current.agents.values())if(oe.state==="active"){H=!0;break}const Y=O3({enabled:mn,kind:ye==null?void 0:ye.kind,canRestart:(K==null?void 0:K.canRestart)===!0,busy:H,idleSince:Os.current,now:ut});Os.current=Y.idleSince,Y.restart&&wr()},[mn,ye==null?void 0:ye.kind,K==null?void 0:K.canRestart,ut,wr]),R.useEffect(()=>{const H=K==null?void 0:K.running;let Y=null,oe=null;try{Y=window.sessionStorage.getItem("agent-dag.restartPending"),oe=window.sessionStorage.getItem(nN)}catch{return}const de=A3({bundle:"1.36.2",running:H,pending:Y,lastTried:oe});if(de==="reload"){try{window.sessionStorage.setItem(nN,H??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1),bi(H??null);const xe=window.setTimeout(()=>bi(null),6e3);return()=>window.clearTimeout(xe)},[K==null?void 0:K.running]),R.useEffect(()=>{if(zn&&M3({asked:Ms.current,reported:Pt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1)}},[zn,Pt]);const Ps=R.useRef(bF()).current;R.useRef(!1);const Tt=R.useRef(new Map(Ps.positions.filter(([H])=>Ps.pins.includes(H)))),xr=R.useRef(null),_r=R.useState(()=>SF())[0],[Kt,Kr]=R.useState(""),[Si,nt]=R.useState(()=>new Set),[br,Xr]=R.useState(Z3),[Ls,Qr]=R.useState(!1),Zr=R.useRef(null);R.useEffect(()=>{document.documentElement.dataset.theme=br;try{window.localStorage.setItem(ej,br)}catch{}},[br]),R.useEffect(()=>{if(!_r)return;const H=window.setTimeout(()=>{try{e.setViewport(_r,{duration:0})}catch{}},60);return()=>window.clearTimeout(H)},[e,_r]);const $s=R.useRef(!0);R.useEffect(()=>{const H=new EventSource("/events"),Y=K3(i,{now:()=>Date.now(),setTimeout:(oe,de)=>window.setTimeout(oe,de),clearTimeout:oe=>window.clearTimeout(oe)});return H.addEventListener("open",()=>{G(!0),Qr(!0)}),H.addEventListener("error",()=>G(!1)),H.addEventListener("replay-end",()=>{$s.current=!1,Y.flush()}),H.addEventListener("hook",oe=>{try{const de=JSON.parse(oe.data);if(!vr.current.accept(de))return;t.current=Qx(t.current,de),de.replay===!0||$s.current||Date.now()-de.receivedAt>3e4?Y.replay():Y.live()}catch{}}),()=>{H.close(),Y.cancel()}},[i]),R.useEffect(()=>{const H=setInterval(()=>{const Y=Date.now();_i(Y);let oe=DP(t.current,Y,Xx);FP(t.current,Y,Xx)&&(oe=!0),$P(t.current,Y,cF,dF)&&(oe=!0),qP(t.current,Y,fF,hF)&&(oe=!0),oe&&i()},250);return()=>clearInterval(H)},[i]);const ir=R.useRef(null),St=R.useRef(0),qs=420,pt=R.useCallback((H=500)=>{try{const Se=document.querySelector(".canvas-wrap"),Pe=Array.from(document.querySelectorAll(".react-flow__node")).filter(wt=>wt.offsetWidth>0);if(!Se||Pe.length===0)return;const Fe=Se.getBoundingClientRect(),Ge=e.getViewport();if(!Number.isFinite(Ge.zoom)||Ge.zoom<=0)return;const We=wt=>(wt-Fe.left-Ge.x)/Ge.zoom,ze=wt=>(wt-Fe.top-Ge.y)/Ge.zoom,jn=Pe.map(wt=>wt.getBoundingClientRect()),Ys=Math.min(...jn.map(wt=>We(wt.left))),Io=Math.max(...jn.map(wt=>We(wt.right))),Ks=Math.min(...jn.map(wt=>ze(wt.top))),Mo=Math.max(...jn.map(wt=>ze(wt.bottom))),el=Io-Ys,us=Mo-Ks;if(!(el>0&&us>0))return;const Zt=Math.max(.2,Math.min(1,(Fe.width-160)/(el+qs)*.86,(Fe.height-160)/us*.86));e.setViewport({x:80-Ys*Zt,y:Math.max(80,(Fe.height-us*Zt)/2)-Ks*Zt,zoom:Zt},{duration:H}),St.current=Date.now(),window.setTimeout(()=>{try{const wt={x:80-Ys*Zt,y:Math.max(80,(Fe.height-us*Zt)/2)-Ks*Zt,zoom:Zt},Oo=e.getViewport();(Math.abs(Oo.zoom-Zt)>.01||Math.abs(Oo.x-wt.x)>2)&&e.setViewport(wt,{duration:0})}catch{}},H+60)}catch{}},[e]),Eo=R.useRef(""),No=R.useRef(null),Ba=R.useRef(0),Sr=R.useCallback(()=>{Ba.current=Date.now()},[]),Jr="agent-dag.autoFitDisabled",gn=R.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Jr)==="1"}catch{return!1}})()),[Ds,Ua]=R.useState(gn.current),Ha=R.useCallback(()=>{if(!gn.current){gn.current=!0,Ua(!0);try{window.localStorage.setItem(Jr,"1")}catch{}}},[]),Co=R.useCallback(()=>{gn.current=!1,Ua(!1);try{window.localStorage.removeItem(Jr)}catch{}pt(400)},[e,pt]);R.useEffect(()=>{const H=setInterval(()=>{if(gn.current||Date.now()-Ba.current<800)return;const Y=t.current,oe=Date.now(),de=[];for(const We of Y.agents.values())zv(We,oe)&&de.push({id:We.id});if(de.length===0)return;const xe=e.getViewport(),Se=window.innerWidth-360,Pe=window.innerHeight-52;let Fe=!1,Ge=!1;for(const{id:We}of de){const ze=or.current.get(We),jn=Tt.current.get(We)??Xt.current.get(We);if(!ze||!jn)continue;Ge=!0;const Ys=jn.x*xe.zoom+xe.x,Io=jn.y*xe.zoom+xe.y,Ks=(jn.x+ze.width)*xe.zoom+xe.x,Mo=(jn.y+ze.height)*xe.zoom+xe.y;if(Ks>0&&Ys<Se&&Mo>0&&Io<Pe){Fe=!0;break}}Ge&&!Fe&&pt(600)},1500);return()=>clearInterval(H)},[e]);const ki=R.useRef(!1),or=R.useRef(new Map),es=R.useRef(0),oc=R.useCallback(H=>{const Y=or.current;let oe=!1;for(const de of H.nodeInternals.values()){const xe=de.width,Se=de.height;if(xe==null||Se==null)continue;const Pe=Y.get(de.id);Pe?(Math.abs(Pe.height-Se)>4||Math.abs(Pe.width-xe)>4)&&(Y.set(de.id,{width:xe,height:Se}),oe=!0):(Y.set(de.id,{width:xe,height:Se}),oe=!0)}return oe&&(es.current+=1),es.current},[]),Ei=Ke(oc),[He,Wa]=R.useState(0);R.useEffect(()=>{let H=0;const Y=()=>{const de=or.current;let xe=!1;for(const Se of document.querySelectorAll(".react-flow__node[data-id]")){const Pe=Se.getAttribute("data-id");if(!Pe)continue;const Fe=Se.offsetWidth,Ge=Se.offsetHeight;if(!Fe||!Ge)continue;const We=de.get(Pe);(!We||Math.abs(We.width-Fe)>4||Math.abs(We.height-Ge)>4)&&(de.set(Pe,{width:Fe,height:Ge}),xe=!0)}xe&&Wa(Se=>Se+1)};if(ki.current)return;let oe=0;return document.visibilityState==="hidden"?oe=window.setTimeout(Y,32):H=requestAnimationFrame(Y),()=>{cancelAnimationFrame(H),window.clearTimeout(oe)}});const Xt=R.useRef(new Map(Ps.positions)),jo=R.useRef(new Set),Ni=R.useRef(""),kr=R.useMemo(()=>{const H=[];for(const Y of t.current.agents.values())zv(Y,ut)&&H.push(Y.id+(Y.parentId?`>${Y.parentId}`:""));return H.sort(),`${H.join("|")}#sv${Ei}.${He}`},[t.current,t.current.lastSeq,ut,Ei,He]),ts=R.useRef(null);R.useEffect(()=>(ts.current!=null&&window.clearTimeout(ts.current),ts.current=window.setTimeout(()=>{wv(Xt.current,Tt.current)},1500),()=>{ts.current!=null&&window.clearTimeout(ts.current)}),[kr]),R.useEffect(()=>{if(Eo.current===kr)return;const H=Eo.current;if(Eo.current=kr,!H||gn.current)return;Date.now()-St.current>1200&&pt(400),ir.current&&window.clearTimeout(ir.current),ir.current=window.setTimeout(()=>{gn.current||pt(500)},280)},[kr,e,pt]);const Fs=R.useMemo(()=>{if(o.size===0)return null;const H=new Set;for(const Y of o){const oe=NF(t.current,Y);if(oe)for(const de of oe)H.add(de)}return H.size>0?H:null},[t.current,t.current.lastSeq,o]),Nn=R.useMemo(()=>V5(t.current,ut),[t.current,t.current.lastSeq,ut]),Bn=R.useRef(null),[vn,Un]=R.useState({w:0,h:0});R.useEffect(()=>{const H=Bn.current;if(!H||typeof ResizeObserver>"u")return;const Y=new ResizeObserver(oe=>{var xe;const de=(xe=oe[0])==null?void 0:xe.contentRect;de&&Un(Se=>Math.abs(Se.w-de.width)>40||Math.abs(Se.h-de.height)>40?{w:de.width,h:de.height}:Se)});return Y.observe(H),Un({w:H.clientWidth,h:H.clientHeight}),()=>Y.disconnect()},[]);const zs=R.useCallback(H=>{var oe,de;const Y=H.target;!(Y!=null&&Y.closest)||Y.closest(lF)!==H.currentTarget||(H.preventDefault(),(de=(oe=document.activeElement)==null?void 0:oe.blur)==null||de.call(oe))},[]),Bs=R.useRef(new Map),[Hn,ac]=R.useState(!1);R.useEffect(()=>{const H=window.setTimeout(()=>ac(!0),2500);return()=>window.clearTimeout(H)},[]);const[Va,Er]=R.useState(!1),ar=R.useRef(null),[Ci,Us]=R.useState(!1),Ga=R.useCallback(()=>{ar.current&&(window.clearTimeout(ar.current),ar.current=null),Er(!1)},[]),lc=R.useCallback(H=>{H.length!==0&&queueMicrotask(()=>{Er(!0),ar.current&&window.clearTimeout(ar.current),ar.current=window.setTimeout(()=>Er(!1),uF+80)})},[]);R.useEffect(()=>()=>{ar.current&&window.clearTimeout(ar.current)},[]);const ns=vn.w>0?vn.w*.92:0,rs=vn.h>0?vn.h:0,{nodes:Qt,edges:ji}=R.useMemo(()=>CF(t.current,ut,ns,rs,Tt.current,Kt,or.current,Bs.current,lc,Hn,Ci,Xt.current,jo.current,kr,Ni,o,Fs,Nn,b),[t.current,t.current.lastSeq,ut,ns,rs,Hn,Ci,Kt,kr,o,Fs,Nn,b,Yt]),Ya=R.useMemo(()=>{const H=new Map;for(const oe of Qt){const de=oe.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const xe=oe.width,Se=oe.height;if(xe==null||Se==null)continue;const Pe=oe.position.x,Fe=oe.position.y,Ge=Pe+xe,We=Fe+Se,ze=H.get(de.sessionId);ze?(ze.minX=Math.min(ze.minX,Pe),ze.minY=Math.min(ze.minY,Fe),ze.maxX=Math.max(ze.maxX,Ge),ze.maxY=Math.max(ze.maxY,We)):H.set(de.sessionId,{minX:Pe,minY:Fe,maxX:Ge,maxY:We})}const Y=[];for(const[oe,de]of H){const xe=de.maxX-de.minX+du*2,Se=de.maxY-de.minY+du*2;Y.push({id:`group:${oe}`,type:rT,position:{x:de.minX-du,y:de.minY-du},data:{sessionId:oe,w:xe,h:Se},width:xe,height:Se,style:{width:xe,height:Se},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return Y},[Qt,ut]),uc=R.useMemo(()=>{const H=[...Ya,...Qt],Y=Bt.current;return!Y||Y.size===0?H:H.map(oe=>{const de=Y.get(oe.id);return de?{...oe,position:de}:oe})},[Ya,Qt,Fn]),Nr=R.useMemo(()=>{if(!Kt)return null;const H=new Set;for(const Y of t.current.agents.values())Nn.has(Y.id)&&oT(Y,Kt)&&H.add(Y.id);return H},[t.current,t.current.lastSeq,Kt,Nn]),Cn=R.useMemo(()=>sF(Kt,(Nr==null?void 0:Nr.size)??0,Nn.size),[Kt,Nr,Nn]),ss=R.useMemo(()=>{const H=new Set;for(const Y of t.current.agents.values())for(const oe of Y.tools)H.add(fT(oe.name));return Object.keys(Uv).filter(Y=>H.has(Y))},[t.current,t.current.lastSeq]);R.useEffect(()=>{if(ss.length<=1){Sn(!1);return}let H=0;const Y=()=>{const oe=bn.current;if(oe&&!document.hidden){const de=oe.getBoundingClientRect(),xe=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Pe=>Pe.getBoundingClientRect()),Se=Y5(de,xe,8);Sn(Pe=>Pe===Se?Pe:Se)}H=window.setTimeout(Y,300)};return Y(),()=>window.clearTimeout(H)},[ss.length]);const is=R.useMemo(()=>{const H=new Map;for(const oe of t.current.agents.values())for(const de of oe.tools){if(!de.name.startsWith("mcp__"))continue;const xe=de.name.slice(5),Se=xe.indexOf("__"),Pe=Se>0?xe.slice(0,Se):xe;H.set(Pe,(H.get(Pe)??0)+1)}const Y=[];for(const[oe,de]of H){let xe=5381;for(let Se=0;Se<oe.length;Se++)xe=(xe<<5)+xe^oe.charCodeAt(Se);Y.push({server:oe,count:de,hue:Math.abs(xe)%360})}return Y.sort((oe,de)=>de.count-oe.count),Y},[t.current,t.current.lastSeq]),lr=R.useCallback(H=>{nt(Y=>{const oe=new Set(Y);return oe.has(H)?oe.delete(H):oe.add(H),oe})},[]),Rt=u?t.current.agents.get(u):null,os=f?Array.from(t.current.agents.values()).flatMap(H=>H.tools).find(H=>H.id===f)??null:null,To=R.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}t.current=Lv(),Tt.current.clear(),or.current.clear(),Xt.current.clear(),Ni.current="",sN(),g(),i()},[i,g]),Hs=R.useRef(S);Hs.current=S;const Ws=R.useRef(!1);Ws.current=os!=null||vt||E!=null||y!=null;const Vs=R.useCallback(H=>{const Y=L3(H,{confirmOpen:Hs.current,modalOpen:Ws.current});Y==="confirm"?k(!0):Y==="clear"&&(k(!1),To())},[To]),$t=R.useCallback(()=>{Tt.current.clear(),Xt.current.clear(),Ni.current="",sN(),i(),window.setTimeout(()=>pt(500),80)},[i,e,pt]),Cr=R.useCallback(()=>pt(500),[pt]),as=R.useRef(Qt);as.current=Qt;const ls=R.useRef(u);ls.current=u;const Ro=R.useCallback(H=>{const Y=as.current,oe=q3(Y.map(Se=>({id:Se.id,x:Se.position.x,y:Se.position.y})),ls.current,H),de=oe?Y.find(Se=>Se.id===oe):void 0;if(!de)return;const xe=QE(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}St.current=Date.now(),xe&&aF(de.id)},30)},[d,e]),Ti=R.useCallback(H=>{d(H,!1),window.setTimeout(()=>{try{const Y=as.current.find(oe=>oe.id===H);Y&&e.fitView({padding:.3,duration:500,nodes:[Y]}),St.current=Date.now()}catch{}},60)},[d,e]);R.useEffect(()=>{const H=Y=>{var Fe,Ge,We;const oe=Y.target,de={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(Fe=oe==null?void 0:oe.getAttribute)==null?void 0:Fe.call(oe,"role"),type:oe==null?void 0:oe.type};if(Y.key==="Escape"){const ze=iL({overlayOpen:Ru.depth()>0,typing:cy(de)});ze==="dismiss"?Ru.dismissTop():ze==="blur"?oe==null||oe.blur():(B3(de)&&(oe==null||oe.blur()),g());return}if(DC(Y))return;const xe=QE(oe)?(Ge=oe==null?void 0:oe.getAttribute)==null?void 0:Ge.call(oe,"data-id"):null,Se=xe&&as.current.some(ze=>ze.id===xe)?xe:null,Pe=F3(Y,Se);if(Pe.kind==="activate"){Y.preventDefault(),d(Pe.nodeId,Pe.additive);return}if(Pe.kind!=="node"&&!(Pe.nodeId==null&&hL(de))){if(Y.key==="/"){Y.preventDefault(),(We=Zr.current)==null||We.focus();return}Y.key===" "&&(Y.preventDefault(),Wr()),(Y.key==="c"||Y.key==="C")&&Vs("shortcut"),(Y.key==="r"||Y.key==="R")&&$t(),(Y.key==="f"||Y.key==="F")&&Cr(),(Y.key==="l"||Y.key==="L")&&bt(),(Y.key==="h"||Y.key==="H")&&hn(ze=>!ze),(Y.key==="u"||Y.key==="U")&&D(ze=>!ze),(Y.key==="a"||Y.key==="A")&&Be.current.claude&&ht(),(Y.key==="j"||Y.key==="J")&&Ro(1),(Y.key==="k"||Y.key==="K")&&Ro(-1),(Y.key==="t"||Y.key==="T")&&Xr(ze=>ze==="dark"?"light":"dark")}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[Vs,$t,Cr,g,d,Ro,Wr]);const jr=t.current.agents.size,Gs=new Set(Array.from(t.current.agents.values()).map(H=>H.sessionId)).size,tn=R.useMemo(()=>g$(t.current.agents.values()),[t.current,t.current.lastSeq]),Ao=R.useMemo(()=>v$(t.current.agents.values()),[t.current,t.current.lastSeq]),Ka=R.useRef(null);R.useEffect(()=>{const H=J3({waiting:tn.length,running:Ao}),Y=Ka.current;if(Ka.current=H,(Y==null?void 0:Y.title)!==H.title&&(document.title=H.title),(Y==null?void 0:Y.icon)!==H.icon){const oe=document.querySelector('link[rel="icon"]');oe&&(oe.href=eq[H.icon])}},[tn.length,Ao]);const[cc,dc]=R.useState(""),Ri=nq(tn);R.useEffect(()=>{dc(H=>rq(H,Ri))},[Ri]);const nn=R.useMemo(()=>{let H=0,Y=0,oe=0,de=0,xe=0,Se=0,Pe=0,Fe=0,Ge=0;for(const We of t.current.agents.values()){H+=We.usage.inputTokens,Y+=We.usage.outputTokens,oe+=We.usage.cacheReadTokens,de+=We.usage.cacheCreateTokens;const ze=dn(We.usage,We.model);xe+=ze.total,Se+=ze.input,Pe+=ze.output,Fe+=ze.cacheRead,Ge+=ze.cacheWrite}return{inT:H,outT:Y,cacheR:oe,cacheC:de,sum:H+Y,cost:{total:xe,input:Se,output:Pe,cacheRead:Fe,cacheWrite:Ge}}},[t.current,t.current.lastSeq]);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:"brand",children:[m.jsx("span",{className:"logo"}),m.jsx("h1",{children:Gt}),ye?m.jsxs("button",{type:"button",className:"v stale",onClick:Ze,"aria-label":J5({...ye,open:ft}),title:ye.kind==="restart"?`Running v${ye.from}; v${ye.to} is installed on disk. Restart to pick it up.`:`Running v${ye.from}; v${ye.to} is on npm.`,children:["v",ye.from,m.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const H={running:(K==null?void 0:K.running)??"1.36.2",latest:K==null?void 0:K.latest,latestPending:K==null?void 0:K.latestPending,checkedAgo:K!=null&&K.checkedAt?qv(ut-K.checkedAt):null,checkDisabled:K==null?void 0:K.checkDisabled,checking:ce};return m.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":Z5(H),title:Q5(H),children:["v",H.running]})})()]}),Rt&&(()=>{const H=dn(Rt.usage,Rt.model),Y=Math.max(0,((Rt.endedAt??ut)-Rt.startedAt)/1e3),oe=Rt.state==="active"?ju(H.total,Y):null,de=o.size-1;return m.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Rt.label}`,onClick:()=>{try{const xe=Qt.find(Se=>Se.id===Rt.id);xe&&e.fitView({padding:.35,duration:500,nodes:[xe]}),St.current=Date.now()}catch{}},children:[m.jsx("span",{className:`state-pill state-${Rt.state}`,children:Rt.state==="active"?"live":Rt.state}),m.jsx("span",{className:"selected-label",children:Rt.label}),H.total>0&&m.jsxs("span",{className:"selected-cost",children:[qe(H.total),oe?m.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),de>0&&m.jsxs("span",{className:"selected-extra",children:["+",de]}),m.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:xe=>{xe.stopPropagation(),g()},children:"×"})]})})(),m.jsxs("div",{className:"actions",children:[m.jsxs("div",{className:"search",children:[m.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),m.jsx("input",{ref:Zr,type:"text",placeholder:iF,value:Kt,onChange:H=>Kr(H.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),Kt?m.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Kr(""),children:"×"}):m.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),Cn.count&&m.jsx("span",{className:`search-count${Cn.empty?" none":""}`,"aria-live":"polite",title:`${Cn.count} agents on the canvas match “${Kt}”`,children:Cn.count})]}),m.jsxs("span",{className:"status",children:[(()=>{const H=nF({connected:I,paused:Hr,held:vr.current.size});return m.jsx("span",{className:`pill ${H.tone}`,title:H.title,children:H.label})})(),m.jsxs("span",{className:"stat",title:cq(we),children:[m.jsx("span",{className:"count",children:Gs}),m.jsx("span",{className:"lbl",children:"sessions"})]}),m.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[m.jsx("span",{className:"count",children:jr}),m.jsx("span",{className:"lbl",children:"agents"})]}),m.jsxs("span",{className:"stat",title:dq(we),children:[m.jsx("span",{className:"count",children:t.current.totalEvents}),m.jsx("span",{className:"lbl",children:"events"})]}),m.jsx(F$,{usageOpen:O}),nn.sum>0&&m.jsxs("span",{className:"stat",title:`in:${nn.inT.toLocaleString()} out:${nn.outT.toLocaleString()} cache-r:${nn.cacheR.toLocaleString()} cache-c:${nn.cacheC.toLocaleString()}`,children:[m.jsx("span",{className:"count",children:Nt(nn.sum)}),m.jsx("span",{className:"lbl",children:"tokens"})]}),is.length>0&&m.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
|
|
73
|
+
${t.parked} of your own sound hook${t.parked>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${t.parked>1?"them":"it"} back.`:"";return r+i+o+a}function nj(e){const t=new Map;for(const r of e)for(const i of r.agents??[]){if(!i||typeof i.agent!="string"||i.agent==="")continue;const o=t.get(i.agent)??{id:i.agent,cost:0,tokens:0};o.cost+=Number.isFinite(i.totalCost)?i.totalCost:0,o.tokens+=Number.isFinite(i.totalTokens)?i.totalTokens:0,t.set(i.agent,o)}return[...t.values()].sort((r,i)=>i.cost-r.cost||r.id.localeCompare(i.id))}function pq(e){const t=nj([{agents:e}]);return t.length<2?null:t.map(r=>`${gy(r.id)} ${qe(r.cost)}`).join(" · ")}function j_(e){switch(e.toLowerCase()){case"claude":return"#c4b5fd";case"codex":return"#fdba74";case"gemini":return"#a5b4fc";case"copilot":return"#86efac";default:return"#94a3b8"}}function mq(e,t){if(!(t>0)||!(e>0))return"0%";const r=e/t*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function lu(e){const t=e.toLowerCase();return t.includes("opus")?"#c4b5fd":t.includes("sonnet")?"#7dd3fc":t.includes("haiku")?"#86efac":t.includes("gpt-5")||t.includes("gpt5")?"#fcd34d":t.includes("gpt")?"#fca5a5":t.includes("gemini")?"#a5b4fc":t.includes("codex")?"#fdba74":"#94a3b8"}const gq=[7,14,30,90];function vq(e){const[t,r]=R.useState(null),[i,o]=R.useState(!1),a=R.useRef(sq()).current,u=(c=!1)=>{const f=a.begin(),p=e;o(!0);const g=`/api/ccusage?since=${iq(p)}${c?"&refresh=1":""}`;fetch(g).then(y=>y.json()).then(y=>{f()&&r({range:p,resp:y})}).catch(()=>{f()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{f()&&o(!1)})};return R.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:i,reload:()=>u(!0)}}function yq({onClose:e,providers:t}){var P;const[r,i]=R.useState(30),[o,a]=R.useState(null),{landed:u,loading:c,reload:f}=vq(r),p=R.useRef(null),d=wo(e,{focusRef:p}),g=oq({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((P=u.resp.days)==null?void 0:P.length)??0}}),y=g.phase==="chart"?u.resp.days??[]:[],w=R.useMemo(()=>y.reduce((O,D)=>Math.max(O,D.totalCost),0),[y]),{totalCost:E,totalTok:_,inOut:b,cacheRead:S,modelCosts:k}=R.useMemo(()=>{let O=0,D=0,L=0,U=0;const V=new Map;for(const z of y){O+=z.totalCost,D+=z.totalTokens,L+=z.inputTokens+z.outputTokens,U+=z.cacheReadTokens;for(const C of z.modelBreakdowns)V.set(C.modelName,(V.get(C.modelName)??0)+C.cost)}return{totalCost:O,totalTok:D,inOut:L,cacheRead:U,modelCosts:V}},[y]),N=R.useMemo(()=>Array.from(k.entries()).sort((O,D)=>D[1]-O[1]),[k]),j=R.useMemo(()=>nj(y),[y]),A=j.length>1,M=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:lq(t,j.map(O=>O.id))})]}),m.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:gq.map(O=>m.jsxs("button",{type:"button","aria-pressed":r===O,className:`uh-range-btn${r===O?" on":""}`,onClick:()=>{i(O),a(null)},children:[O,"d"]},O))}),m.jsx("button",{className:"btn icon-btn uh-reload",onClick:f,disabled:c,title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),m.jsx("button",{ref:p,className:"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:vo(u.resp)||void 0,children:[u3(u.resp,"ccusage did not report usage"),m.jsx("div",{children:m.jsx("button",{className:"btn uh-retry",onClick:f,disabled: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(uu,{label:"total cost",val:qe(E),accent:!0}),m.jsx(uu,{label:"tokens",val:Nt(_)}),m.jsx(uu,{label:"input+output",val:Nt(b)}),m.jsx(uu,{label:"cache reads",val:Nt(S)})]}),A&&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:j.map(O=>m.jsx("span",{className:"uh-agent-seg",style:{width:`${E>0?O.cost/E*100:0}%`,background:j_(O.id)}},O.id))}),m.jsx("div",{className:"uh-agent-keys",children:j.map(O=>m.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${Nt(O.tokens)} tokens`,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:j_(O.id)}}),gy(O.id),m.jsx("span",{className:"uh-agent-cost",children:qe(O.cost)}),m.jsx("span",{className:"uh-agent-share",children:mq(O.cost,E)})]},O.id))})]}),m.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(O=>{const D=w>0?O.totalCost/w*100:0,L=O.period===o,U=`${O.period}, ${qe(O.totalCost)}`;return m.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>a(L?null:O.period),"aria-pressed":L,"aria-label":U,title:`${O.period} · ${qe(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[m.jsx("div",{className:"uh-bar",style:{height:`${Math.max(D,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((V,z)=>z.cost-V.cost).map(V=>{const z=O.totalCost>0?V.cost/O.totalCost*100:0;return m.jsx("div",{className:"uh-bar-seg",style:{height:`${z}%`,background:lu(V.modelName)}},V.modelName)})}),m.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),m.jsx("div",{className:"uh-legend",children:N.map(([O,D])=>m.jsxs("span",{className:"uh-legend-item",title:O,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:lu(O)}}),Rs(O)," ",m.jsx("span",{className:"uh-legend-cost",children:qe(D)})]},O))}),M&&m.jsxs("div",{className:"uh-detail",children:[m.jsxs("div",{className:"uh-detail-head",children:[m.jsx("span",{className:"uh-detail-date",children:M.period}),m.jsx("span",{className:"uh-detail-cost",children:qe(M.totalCost)}),(()=>{var L,U;const D=pq(M.agents)??((U=(L=M.metadata)==null?void 0:L.agents)!=null&&U.length?M.metadata.agents.join(" · "):null);return D?m.jsx("span",{className:"uh-detail-agents",title:D,children:D}):null})()]}),m.jsxs("div",{className:"uh-detail-mini",children:[m.jsx(cu,{label:"input",val:Nt(M.inputTokens)}),m.jsx(cu,{label:"output",val:Nt(M.outputTokens)}),m.jsx(cu,{label:"cache write",val:Nt(M.cacheCreationTokens)}),m.jsx(cu,{label:"cache read",val:Nt(M.cacheReadTokens)})]}),m.jsx("div",{className:"uh-detail-models",children:M.modelBreakdowns.slice().sort((O,D)=>D.cost-O.cost).map(O=>{const D=M.totalCost>0?O.cost/M.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:lu(O.modelName)}}),m.jsx("span",{className:"uh-model-label",children:Rs(O.modelName)})]}),m.jsx("span",{className:"uh-model-bar",children:m.jsx("span",{className:"uh-model-bar-fill",style:{width:`${D}%`,background:lu(O.modelName)}})}),m.jsx("span",{className:"uh-model-cost",children:qe(O.cost)})]},O.modelName)})})]})]})]})})}function uu({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 cu({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 vy(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 ef,T_;function wq(){if(T_)return ef;T_=1;function e(){this.__data__=[],this.size=0}return ef=e,ef}var tf,R_;function xo(){if(R_)return tf;R_=1;function e(t,r){return t===r||t!==t&&r!==r}return tf=e,tf}var nf,A_;function Bu(){if(A_)return nf;A_=1;var e=xo();function t(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return nf=t,nf}var rf,I_;function xq(){if(I_)return rf;I_=1;var e=Bu(),t=Array.prototype,r=t.splice;function i(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 rf=i,rf}var sf,M_;function _q(){if(M_)return sf;M_=1;var e=Bu();function t(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return sf=t,sf}var of,O_;function bq(){if(O_)return of;O_=1;var e=Bu();function t(r){return e(this.__data__,r)>-1}return of=t,of}var af,P_;function Sq(){if(P_)return af;P_=1;var e=Bu();function t(r,i){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,i])):o[a][1]=i,this}return af=t,af}var lf,L_;function Uu(){if(L_)return lf;L_=1;var e=wq(),t=xq(),r=_q(),i=bq(),o=Sq();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=i,a.prototype.set=o,lf=a,lf}var uf,$_;function kq(){if($_)return uf;$_=1;var e=Uu();function t(){this.__data__=new e,this.size=0}return uf=t,uf}var cf,q_;function Eq(){if(q_)return cf;q_=1;function e(t){var r=this.__data__,i=r.delete(t);return this.size=r.size,i}return cf=e,cf}var df,D_;function Nq(){if(D_)return df;D_=1;function e(t){return this.__data__.get(t)}return df=e,df}var ff,F_;function Cq(){if(F_)return ff;F_=1;function e(t){return this.__data__.has(t)}return ff=e,ff}var hf,z_;function rj(){if(z_)return hf;z_=1;var e=typeof Gl=="object"&&Gl&&Gl.Object===Object&&Gl;return hf=e,hf}var pf,B_;function rr(){if(B_)return pf;B_=1;var e=rj(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return pf=r,pf}var mf,U_;function _o(){if(U_)return mf;U_=1;var e=rr(),t=e.Symbol;return mf=t,mf}var gf,H_;function jq(){if(H_)return gf;H_=1;var e=_o(),t=Object.prototype,r=t.hasOwnProperty,i=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=i.call(u);return p&&(c?u[o]=f:delete u[o]),d}return gf=a,gf}var vf,W_;function Tq(){if(W_)return vf;W_=1;var e=Object.prototype,t=e.toString;function r(i){return t.call(i)}return vf=r,vf}var yf,V_;function gi(){if(V_)return yf;V_=1;var e=_o(),t=jq(),r=Tq(),i="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:a&&a in Object(c)?t(c):r(c)}return yf=u,yf}var wf,G_;function qn(){if(G_)return wf;G_=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return wf=e,wf}var xf,Y_;function $a(){if(Y_)return xf;Y_=1;var e=gi(),t=qn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==i||f==o||f==r||f==a}return xf=u,xf}var _f,K_;function Rq(){if(K_)return _f;K_=1;var e=rr(),t=e["__core-js_shared__"];return _f=t,_f}var bf,X_;function Aq(){if(X_)return bf;X_=1;var e=Rq(),t=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!t&&t in i}return bf=r,bf}var Sf,Q_;function sj(){if(Q_)return Sf;Q_=1;var e=Function.prototype,t=e.toString;function r(i){if(i!=null){try{return t.call(i)}catch{}try{return i+""}catch{}}return""}return Sf=r,Sf}var kf,Z_;function Iq(){if(Z_)return kf;Z_=1;var e=$a(),t=Aq(),r=qn(),i=sj(),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(i(y))}return kf=g,kf}var Ef,J_;function Mq(){if(J_)return Ef;J_=1;function e(t,r){return t==null?void 0:t[r]}return Ef=e,Ef}var Nf,e1;function vi(){if(e1)return Nf;e1=1;var e=Iq(),t=Mq();function r(i,o){var a=t(i,o);return e(a)?a:void 0}return Nf=r,Nf}var Cf,t1;function yy(){if(t1)return Cf;t1=1;var e=vi(),t=rr(),r=e(t,"Map");return Cf=r,Cf}var jf,n1;function Hu(){if(n1)return jf;n1=1;var e=vi(),t=e(Object,"create");return jf=t,jf}var Tf,r1;function Oq(){if(r1)return Tf;r1=1;var e=Hu();function t(){this.__data__=e?e(null):{},this.size=0}return Tf=t,Tf}var Rf,s1;function Pq(){if(s1)return Rf;s1=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Rf=e,Rf}var Af,i1;function Lq(){if(i1)return Af;i1=1;var e=Hu(),t="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(a){var u=this.__data__;if(e){var c=u[a];return c===t?void 0:c}return i.call(u,a)?u[a]:void 0}return Af=o,Af}var If,o1;function $q(){if(o1)return If;o1=1;var e=Hu(),t=Object.prototype,r=t.hasOwnProperty;function i(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return If=i,If}var Mf,a1;function qq(){if(a1)return Mf;a1=1;var e=Hu(),t="__lodash_hash_undefined__";function r(i,o){var a=this.__data__;return this.size+=this.has(i)?0:1,a[i]=e&&o===void 0?t:o,this}return Mf=r,Mf}var Of,l1;function Dq(){if(l1)return Of;l1=1;var e=Oq(),t=Pq(),r=Lq(),i=$q(),o=qq();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=i,a.prototype.set=o,Of=a,Of}var Pf,u1;function Fq(){if(u1)return Pf;u1=1;var e=Dq(),t=Uu(),r=yy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Pf=i,Pf}var Lf,c1;function zq(){if(c1)return Lf;c1=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Lf=e,Lf}var $f,d1;function Wu(){if(d1)return $f;d1=1;var e=zq();function t(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return $f=t,$f}var qf,f1;function Bq(){if(f1)return qf;f1=1;var e=Wu();function t(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return qf=t,qf}var Df,h1;function Uq(){if(h1)return Df;h1=1;var e=Wu();function t(r){return e(this,r).get(r)}return Df=t,Df}var Ff,p1;function Hq(){if(p1)return Ff;p1=1;var e=Wu();function t(r){return e(this,r).has(r)}return Ff=t,Ff}var zf,m1;function Wq(){if(m1)return zf;m1=1;var e=Wu();function t(r,i){var o=e(this,r),a=o.size;return o.set(r,i),this.size+=o.size==a?0:1,this}return zf=t,zf}var Bf,g1;function wy(){if(g1)return Bf;g1=1;var e=Fq(),t=Bq(),r=Uq(),i=Hq(),o=Wq();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=i,a.prototype.set=o,Bf=a,Bf}var Uf,v1;function Vq(){if(v1)return Uf;v1=1;var e=Uu(),t=yy(),r=wy(),i=200;function o(a,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!t||f.length<i-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 Uf=o,Uf}var Hf,y1;function Vu(){if(y1)return Hf;y1=1;var e=Uu(),t=kq(),r=Eq(),i=Nq(),o=Cq(),a=Vq();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=i,u.prototype.has=o,u.prototype.set=a,Hf=u,Hf}var Wf,w1;function xy(){if(w1)return Wf;w1=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o&&r(t[i],i,t)!==!1;);return t}return Wf=e,Wf}var Vf,x1;function ij(){if(x1)return Vf;x1=1;var e=vi(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Vf=t,Vf}var Gf,_1;function Gu(){if(_1)return Gf;_1=1;var e=ij();function t(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Gf=t,Gf}var Yf,b1;function Yu(){if(b1)return Yf;b1=1;var e=Gu(),t=xo(),r=Object.prototype,i=r.hasOwnProperty;function o(a,u,c){var f=a[u];(!(i.call(a,u)&&t(f,c))||c===void 0&&!(u in a))&&e(a,u,c)}return Yf=o,Yf}var Kf,S1;function qa(){if(S1)return Kf;S1=1;var e=Yu(),t=Gu();function r(i,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],i[d],d,a,i):void 0;g===void 0&&(g=i[d]),c?t(a,d,g):e(a,d,g)}return a}return Kf=r,Kf}var Xf,k1;function Gq(){if(k1)return Xf;k1=1;function e(t,r){for(var i=-1,o=Array(t);++i<t;)o[i]=r(i);return o}return Xf=e,Xf}var Qf,E1;function mr(){if(E1)return Qf;E1=1;function e(t){return t!=null&&typeof t=="object"}return Qf=e,Qf}var Zf,N1;function Yq(){if(N1)return Zf;N1=1;var e=gi(),t=mr(),r="[object Arguments]";function i(o){return t(o)&&e(o)==r}return Zf=i,Zf}var Jf,C1;function Da(){if(C1)return Jf;C1=1;var e=Yq(),t=mr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(u){return t(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Jf=a,Jf}var eh,j1;function _t(){if(j1)return eh;j1=1;var e=Array.isArray;return eh=e,eh}var ma={exports:{}},th,T1;function Kq(){if(T1)return th;T1=1;function e(){return!1}return th=e,th}ma.exports;var R1;function bo(){return R1||(R1=1,(function(e,t){var r=rr(),i=Kq(),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||i;e.exports=p})(ma,ma.exports)),ma.exports}var nh,A1;function Ku(){if(A1)return nh;A1=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(i,o){var a=typeof i;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(i))&&i>-1&&i%1==0&&i<o}return nh=r,nh}var rh,I1;function _y(){if(I1)return rh;I1=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return rh=t,rh}var sh,M1;function Xq(){if(M1)return sh;M1=1;var e=gi(),t=_y(),r=mr(),i="[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]",E="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",S="[object DataView]",k="[object Float32Array]",N="[object Float64Array]",j="[object Int8Array]",A="[object Int16Array]",M="[object Int32Array]",P="[object Uint8Array]",O="[object Uint8ClampedArray]",D="[object Uint16Array]",L="[object Uint32Array]",U={};U[k]=U[N]=U[j]=U[A]=U[M]=U[P]=U[O]=U[D]=U[L]=!0,U[i]=U[o]=U[b]=U[a]=U[S]=U[u]=U[c]=U[f]=U[p]=U[d]=U[g]=U[y]=U[w]=U[E]=U[_]=!1;function V(z){return r(z)&&t(z.length)&&!!U[e(z)]}return sh=V,sh}var ih,O1;function Xu(){if(O1)return ih;O1=1;function e(t){return function(r){return t(r)}}return ih=e,ih}var ga={exports:{}};ga.exports;var P1;function by(){return P1||(P1=1,(function(e,t){var r=rj(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,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})(ga,ga.exports)),ga.exports}var oh,L1;function Fa(){if(L1)return oh;L1=1;var e=Xq(),t=Xu(),r=by(),i=r&&r.isTypedArray,o=i?t(i):e;return oh=o,oh}var ah,$1;function oj(){if($1)return ah;$1=1;var e=Gq(),t=Da(),r=_t(),i=bo(),o=Ku(),a=Fa(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var g=r(p),y=!g&&t(p),w=!g&&!y&&i(p),E=!g&&!y&&!w&&a(p),_=g||y||w||E,b=_?e(p.length,String):[],S=b.length;for(var k in p)(d||c.call(p,k))&&!(_&&(k=="length"||w&&(k=="offset"||k=="parent")||E&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,S)))&&b.push(k);return b}return ah=f,ah}var lh,q1;function Qu(){if(q1)return lh;q1=1;var e=Object.prototype;function t(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return lh=t,lh}var uh,D1;function aj(){if(D1)return uh;D1=1;function e(t,r){return function(i){return t(r(i))}}return uh=e,uh}var ch,F1;function Qq(){if(F1)return ch;F1=1;var e=aj(),t=e(Object.keys,Object);return ch=t,ch}var dh,z1;function Sy(){if(z1)return dh;z1=1;var e=Qu(),t=Qq(),r=Object.prototype,i=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var u=[];for(var c in Object(a))i.call(a,c)&&c!="constructor"&&u.push(c);return u}return dh=o,dh}var fh,B1;function Br(){if(B1)return fh;B1=1;var e=$a(),t=_y();function r(i){return i!=null&&t(i.length)&&!e(i)}return fh=r,fh}var hh,U1;function As(){if(U1)return hh;U1=1;var e=oj(),t=Sy(),r=Br();function i(o){return r(o)?e(o):t(o)}return hh=i,hh}var ph,H1;function Zq(){if(H1)return ph;H1=1;var e=qa(),t=As();function r(i,o){return i&&e(o,t(o),i)}return ph=r,ph}var mh,W1;function Jq(){if(W1)return mh;W1=1;function e(t){var r=[];if(t!=null)for(var i in Object(t))r.push(i);return r}return mh=e,mh}var gh,V1;function eD(){if(V1)return gh;V1=1;var e=qn(),t=Qu(),r=Jq(),i=Object.prototype,o=i.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 gh=a,gh}var vh,G1;function yi(){if(G1)return vh;G1=1;var e=oj(),t=eD(),r=Br();function i(o){return r(o)?e(o,!0):t(o)}return vh=i,vh}var yh,Y1;function tD(){if(Y1)return yh;Y1=1;var e=qa(),t=yi();function r(i,o){return i&&e(o,t(o),i)}return yh=r,yh}var va={exports:{}};va.exports;var K1;function lj(){return K1||(K1=1,(function(e,t){var r=rr(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,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})(va,va.exports)),va.exports}var wh,X1;function uj(){if(X1)return wh;X1=1;function e(t,r){var i=-1,o=t.length;for(r||(r=Array(o));++i<o;)r[i]=t[i];return r}return wh=e,wh}var xh,Q1;function cj(){if(Q1)return xh;Q1=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,a=0,u=[];++i<o;){var c=t[i];r(c,i,t)&&(u[a++]=c)}return u}return xh=e,xh}var _h,Z1;function dj(){if(Z1)return _h;Z1=1;function e(){return[]}return _h=e,_h}var bh,J1;function ky(){if(J1)return bh;J1=1;var e=cj(),t=dj(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:t;return bh=a,bh}var Sh,eb;function nD(){if(eb)return Sh;eb=1;var e=qa(),t=ky();function r(i,o){return e(i,t(i),o)}return Sh=r,Sh}var kh,tb;function Ey(){if(tb)return kh;tb=1;function e(t,r){for(var i=-1,o=r.length,a=t.length;++i<o;)t[a+i]=r[i];return t}return kh=e,kh}var Eh,nb;function Zu(){if(nb)return Eh;nb=1;var e=aj(),t=e(Object.getPrototypeOf,Object);return Eh=t,Eh}var Nh,rb;function fj(){if(rb)return Nh;rb=1;var e=Ey(),t=Zu(),r=ky(),i=dj(),o=Object.getOwnPropertySymbols,a=o?function(u){for(var c=[];u;)e(c,r(u)),u=t(u);return c}:i;return Nh=a,Nh}var Ch,sb;function rD(){if(sb)return Ch;sb=1;var e=qa(),t=fj();function r(i,o){return e(i,t(i),o)}return Ch=r,Ch}var jh,ib;function hj(){if(ib)return jh;ib=1;var e=Ey(),t=_t();function r(i,o,a){var u=o(i);return t(i)?u:e(u,a(i))}return jh=r,jh}var Th,ob;function pj(){if(ob)return Th;ob=1;var e=hj(),t=ky(),r=As();function i(o){return e(o,r,t)}return Th=i,Th}var Rh,ab;function sD(){if(ab)return Rh;ab=1;var e=hj(),t=fj(),r=yi();function i(o){return e(o,r,t)}return Rh=i,Rh}var Ah,lb;function iD(){if(lb)return Ah;lb=1;var e=vi(),t=rr(),r=e(t,"DataView");return Ah=r,Ah}var Ih,ub;function oD(){if(ub)return Ih;ub=1;var e=vi(),t=rr(),r=e(t,"Promise");return Ih=r,Ih}var Mh,cb;function mj(){if(cb)return Mh;cb=1;var e=vi(),t=rr(),r=e(t,"Set");return Mh=r,Mh}var Oh,db;function aD(){if(db)return Oh;db=1;var e=vi(),t=rr(),r=e(t,"WeakMap");return Oh=r,Oh}var Ph,fb;function So(){if(fb)return Ph;fb=1;var e=iD(),t=yy(),r=oD(),i=mj(),o=aD(),a=gi(),u=sj(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",g="[object WeakMap]",y="[object DataView]",w=u(e),E=u(t),_=u(r),b=u(i),S=u(o),k=a;return(e&&k(new e(new ArrayBuffer(1)))!=y||t&&k(new t)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=g)&&(k=function(N){var j=a(N),A=j==f?N.constructor:void 0,M=A?u(A):"";if(M)switch(M){case w:return y;case E:return c;case _:return p;case b:return d;case S:return g}return j}),Ph=k,Ph}var Lh,hb;function lD(){if(hb)return Lh;hb=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i){var o=i.length,a=new i.constructor(o);return o&&typeof i[0]=="string"&&t.call(i,"index")&&(a.index=i.index,a.input=i.input),a}return Lh=r,Lh}var $h,pb;function gj(){if(pb)return $h;pb=1;var e=rr(),t=e.Uint8Array;return $h=t,$h}var qh,mb;function Ny(){if(mb)return qh;mb=1;var e=gj();function t(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return qh=t,qh}var Dh,gb;function uD(){if(gb)return Dh;gb=1;var e=Ny();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Dh=t,Dh}var Fh,vb;function cD(){if(vb)return Fh;vb=1;var e=/\w*$/;function t(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Fh=t,Fh}var zh,yb;function dD(){if(yb)return zh;yb=1;var e=_o(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return zh=i,zh}var Bh,wb;function vj(){if(wb)return Bh;wb=1;var e=Ny();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return Bh=t,Bh}var Uh,xb;function fD(){if(xb)return Uh;xb=1;var e=Ny(),t=uD(),r=cD(),i=dD(),o=vj(),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]",E="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",S="[object Int8Array]",k="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",A="[object Uint8ClampedArray]",M="[object Uint16Array]",P="[object Uint32Array]";function O(D,L,U){var V=D.constructor;switch(L){case w:return e(D);case a:case u:return new V(+D);case E:return t(D,U);case _:case b:case S:case k:case N:case j:case A:case M:case P:return o(D,U);case c:return new V;case f:case g:return new V(D);case p:return r(D);case d:return new V;case y:return i(D)}}return Uh=O,Uh}var Hh,_b;function yj(){if(_b)return Hh;_b=1;var e=qn(),t=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(t)return t(o);i.prototype=o;var a=new i;return i.prototype=void 0,a}})();return Hh=r,Hh}var Wh,bb;function wj(){if(bb)return Wh;bb=1;var e=yj(),t=Zu(),r=Qu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return Wh=i,Wh}var Vh,Sb;function hD(){if(Sb)return Vh;Sb=1;var e=So(),t=mr(),r="[object Map]";function i(o){return t(o)&&e(o)==r}return Vh=i,Vh}var Gh,kb;function pD(){if(kb)return Gh;kb=1;var e=hD(),t=Xu(),r=by(),i=r&&r.isMap,o=i?t(i):e;return Gh=o,Gh}var Yh,Eb;function mD(){if(Eb)return Yh;Eb=1;var e=So(),t=mr(),r="[object Set]";function i(o){return t(o)&&e(o)==r}return Yh=i,Yh}var Kh,Nb;function gD(){if(Nb)return Kh;Nb=1;var e=mD(),t=Xu(),r=by(),i=r&&r.isSet,o=i?t(i):e;return Kh=o,Kh}var Xh,Cb;function xj(){if(Cb)return Xh;Cb=1;var e=Vu(),t=xy(),r=Yu(),i=Zq(),o=tD(),a=lj(),u=uj(),c=nD(),f=rD(),p=pj(),d=sD(),g=So(),y=lD(),w=fD(),E=wj(),_=_t(),b=bo(),S=pD(),k=qn(),N=gD(),j=As(),A=yi(),M=1,P=2,O=4,D="[object Arguments]",L="[object Array]",U="[object Boolean]",V="[object Date]",z="[object Error]",C="[object Function]",F="[object GeneratorFunction]",$="[object Map]",re="[object Number]",J="[object Object]",W="[object RegExp]",Z="[object Set]",I="[object String]",G="[object Symbol]",K="[object WeakMap]",q="[object ArrayBuffer]",Q="[object DataView]",ne="[object Float32Array]",ae="[object Float64Array]",fe="[object Int8Array]",te="[object Int16Array]",ce="[object Int32Array]",Ce="[object Uint8Array]",ve="[object Uint8ClampedArray]",Re="[object Uint16Array]",ye="[object Uint32Array]",Ee={};Ee[D]=Ee[L]=Ee[q]=Ee[Q]=Ee[U]=Ee[V]=Ee[ne]=Ee[ae]=Ee[fe]=Ee[te]=Ee[ce]=Ee[$]=Ee[re]=Ee[J]=Ee[W]=Ee[Z]=Ee[I]=Ee[G]=Ee[Ce]=Ee[ve]=Ee[Re]=Ee[ye]=!0,Ee[z]=Ee[C]=Ee[K]=!1;function Ye(we,_e,Be,it,ft,Ze){var De,Je=_e&M,Xe=_e&P,Ot=_e&O;if(Be&&(De=ft?Be(we,it,ft,Ze):Be(we)),De!==void 0)return De;if(!k(we))return we;var lt=_(we);if(lt){if(De=y(we),!Je)return u(we,De)}else{var Qe=g(we),Pt=Qe==C||Qe==F;if(b(we))return a(we,Je);if(Qe==J||Qe==D||Pt&&!ft){if(De=Xe||Pt?{}:E(we),!Je)return Xe?f(we,o(De,we)):c(we,i(De,we))}else{if(!Ee[Qe])return ft?we:{};De=w(we,Qe,Je)}}Ze||(Ze=new e);var zt=Ze.get(we);if(zt)return zt;Ze.set(we,De),N(we)?we.forEach(function(ht){De.add(Ye(ht,_e,Be,ht,we,Ze))}):S(we)&&we.forEach(function(ht,vt){De.set(vt,Ye(ht,_e,Be,vt,we,Ze))});var et=Ot?Xe?d:p:Xe?A:j,bt=lt?void 0:et(we);return t(bt||we,function(ht,vt){bt&&(vt=ht,ht=we[vt]),r(De,vt,Ye(ht,_e,Be,vt,we,Ze))}),De}return Xh=Ye,Xh}var Qh,jb;function vD(){if(jb)return Qh;jb=1;var e=xj(),t=4;function r(i){return e(i,t)}return Qh=r,Qh}var Zh,Tb;function Cy(){if(Tb)return Zh;Tb=1;function e(t){return function(){return t}}return Zh=e,Zh}var Jh,Rb;function yD(){if(Rb)return Jh;Rb=1;function e(t){return function(r,i,o){for(var a=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[t?f:++a];if(i(u[p],p,u)===!1)break}return r}}return Jh=e,Jh}var ep,Ab;function jy(){if(Ab)return ep;Ab=1;var e=yD(),t=e();return ep=t,ep}var tp,Ib;function Ty(){if(Ib)return tp;Ib=1;var e=jy(),t=As();function r(i,o){return i&&e(i,o,t)}return tp=r,tp}var np,Mb;function wD(){if(Mb)return np;Mb=1;var e=Br();function t(r,i){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var u=o.length,c=i?u:-1,f=Object(o);(i?c--:++c<u)&&a(f[c],c,f)!==!1;);return o}}return np=t,np}var rp,Ob;function Ju(){if(Ob)return rp;Ob=1;var e=Ty(),t=wD(),r=t(e);return rp=r,rp}var sp,Pb;function wi(){if(Pb)return sp;Pb=1;function e(t){return t}return sp=e,sp}var ip,Lb;function _j(){if(Lb)return ip;Lb=1;var e=wi();function t(r){return typeof r=="function"?r:e}return ip=t,ip}var op,$b;function bj(){if($b)return op;$b=1;var e=xy(),t=Ju(),r=_j(),i=_t();function o(a,u){var c=i(a)?e:t;return c(a,r(u))}return op=o,op}var ap,qb;function Sj(){return qb||(qb=1,ap=bj()),ap}var lp,Db;function xD(){if(Db)return lp;Db=1;var e=Ju();function t(r,i){var o=[];return e(r,function(a,u,c){i(a,u,c)&&o.push(a)}),o}return lp=t,lp}var up,Fb;function _D(){if(Fb)return up;Fb=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return up=t,up}var cp,zb;function bD(){if(zb)return cp;zb=1;function e(t){return this.__data__.has(t)}return cp=e,cp}var dp,Bb;function kj(){if(Bb)return dp;Bb=1;var e=wy(),t=_D(),r=bD();function i(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new e;++a<u;)this.add(o[a])}return i.prototype.add=i.prototype.push=t,i.prototype.has=r,dp=i,dp}var fp,Ub;function SD(){if(Ub)return fp;Ub=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o;)if(r(t[i],i,t))return!0;return!1}return fp=e,fp}var hp,Hb;function Ej(){if(Hb)return hp;Hb=1;function e(t,r){return t.has(r)}return hp=e,hp}var pp,Wb;function Nj(){if(Wb)return pp;Wb=1;var e=kj(),t=SD(),r=Ej(),i=1,o=2;function a(u,c,f,p,d,g){var y=f&i,w=u.length,E=c.length;if(w!=E&&!(y&&E>w))return!1;var _=g.get(u),b=g.get(c);if(_&&b)return _==c&&b==u;var S=-1,k=!0,N=f&o?new e:void 0;for(g.set(u,c),g.set(c,u);++S<w;){var j=u[S],A=c[S];if(p)var M=y?p(A,j,S,c,u,g):p(j,A,S,u,c,g);if(M!==void 0){if(M)continue;k=!1;break}if(N){if(!t(c,function(P,O){if(!r(N,O)&&(j===P||d(j,P,f,p,g)))return N.push(O)})){k=!1;break}}else if(!(j===A||d(j,A,f,p,g))){k=!1;break}}return g.delete(u),g.delete(c),k}return pp=a,pp}var mp,Vb;function kD(){if(Vb)return mp;Vb=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o,a){i[++r]=[a,o]}),i}return mp=e,mp}var gp,Gb;function Ry(){if(Gb)return gp;Gb=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o){i[++r]=o}),i}return gp=e,gp}var vp,Yb;function ED(){if(Yb)return vp;Yb=1;var e=_o(),t=gj(),r=xo(),i=Nj(),o=kD(),a=Ry(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",E="[object Set]",_="[object String]",b="[object Symbol]",S="[object ArrayBuffer]",k="[object DataView]",N=e?e.prototype:void 0,j=N?N.valueOf:void 0;function A(M,P,O,D,L,U,V){switch(O){case k:if(M.byteLength!=P.byteLength||M.byteOffset!=P.byteOffset)return!1;M=M.buffer,P=P.buffer;case S:return!(M.byteLength!=P.byteLength||!U(new t(M),new t(P)));case f:case p:case y:return r(+M,+P);case d:return M.name==P.name&&M.message==P.message;case w:case _:return M==P+"";case g:var z=o;case E:var C=D&u;if(z||(z=a),M.size!=P.size&&!C)return!1;var F=V.get(M);if(F)return F==P;D|=c,V.set(M,P);var $=i(z(M),z(P),D,L,U,V);return V.delete(M),$;case b:if(j)return j.call(M)==j.call(P)}return!1}return vp=A,vp}var yp,Kb;function ND(){if(Kb)return yp;Kb=1;var e=pj(),t=1,r=Object.prototype,i=r.hasOwnProperty;function o(a,u,c,f,p,d){var g=c&t,y=e(a),w=y.length,E=e(u),_=E.length;if(w!=_&&!g)return!1;for(var b=w;b--;){var S=y[b];if(!(g?S in u:i.call(u,S)))return!1}var k=d.get(a),N=d.get(u);if(k&&N)return k==u&&N==a;var j=!0;d.set(a,u),d.set(u,a);for(var A=g;++b<w;){S=y[b];var M=a[S],P=u[S];if(f)var O=g?f(P,M,S,u,a,d):f(M,P,S,a,u,d);if(!(O===void 0?M===P||p(M,P,c,f,d):O)){j=!1;break}A||(A=S=="constructor")}if(j&&!A){var D=a.constructor,L=u.constructor;D!=L&&"constructor"in a&&"constructor"in u&&!(typeof D=="function"&&D instanceof D&&typeof L=="function"&&L instanceof L)&&(j=!1)}return d.delete(a),d.delete(u),j}return yp=o,yp}var wp,Xb;function CD(){if(Xb)return wp;Xb=1;var e=Vu(),t=Nj(),r=ED(),i=ND(),o=So(),a=_t(),u=bo(),c=Fa(),f=1,p="[object Arguments]",d="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function E(_,b,S,k,N,j){var A=a(_),M=a(b),P=A?d:o(_),O=M?d:o(b);P=P==p?g:P,O=O==p?g:O;var D=P==g,L=O==g,U=P==O;if(U&&u(_)){if(!u(b))return!1;A=!0,D=!1}if(U&&!D)return j||(j=new e),A||c(_)?t(_,b,S,k,N,j):r(_,b,P,S,k,N,j);if(!(S&f)){var V=D&&w.call(_,"__wrapped__"),z=L&&w.call(b,"__wrapped__");if(V||z){var C=V?_.value():_,F=z?b.value():b;return j||(j=new e),N(C,F,S,k,j)}}return U?(j||(j=new e),i(_,b,S,k,N,j)):!1}return wp=E,wp}var xp,Qb;function Cj(){if(Qb)return xp;Qb=1;var e=CD(),t=mr();function r(i,o,a,u,c){return i===o?!0:i==null||o==null||!t(i)&&!t(o)?i!==i&&o!==o:e(i,o,a,u,r,c)}return xp=r,xp}var _p,Zb;function jD(){if(Zb)return _p;Zb=1;var e=Vu(),t=Cj(),r=1,i=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],E=a[w],_=y[1];if(g&&y[2]){if(E===void 0&&!(w in a))return!1}else{var b=new e;if(f)var S=f(E,_,w,a,u,b);if(!(S===void 0?t(_,E,r|i,f,b):S))return!1}}return!0}return _p=o,_p}var bp,Jb;function jj(){if(Jb)return bp;Jb=1;var e=qn();function t(r){return r===r&&!e(r)}return bp=t,bp}var Sp,eS;function TD(){if(eS)return Sp;eS=1;var e=jj(),t=As();function r(i){for(var o=t(i),a=o.length;a--;){var u=o[a],c=i[u];o[a]=[u,c,e(c)]}return o}return Sp=r,Sp}var kp,tS;function Tj(){if(tS)return kp;tS=1;function e(t,r){return function(i){return i==null?!1:i[t]===r&&(r!==void 0||t in Object(i))}}return kp=e,kp}var Ep,nS;function RD(){if(nS)return Ep;nS=1;var e=jD(),t=TD(),r=Tj();function i(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 Ep=i,Ep}var Np,rS;function ko(){if(rS)return Np;rS=1;var e=gi(),t=mr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||t(o)&&e(o)==r}return Np=i,Np}var Cp,sS;function Ay(){if(sS)return Cp;sS=1;var e=_t(),t=ko(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\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:i.test(a)||!r.test(a)||u!=null&&a in Object(u)}return Cp=o,Cp}var jp,iS;function AD(){if(iS)return jp;iS=1;var e=wy(),t="Expected a function";function r(i,o){if(typeof i!="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=i.apply(this,u);return a.cache=f.set(c,p)||f,p};return a.cache=new(r.Cache||e),a}return r.Cache=e,jp=r,jp}var Tp,oS;function ID(){if(oS)return Tp;oS=1;var e=AD(),t=500;function r(i){var o=e(i,function(u){return a.size===t&&a.clear(),u}),a=o.cache;return o}return Tp=r,Tp}var Rp,aS;function MD(){if(aS)return Rp;aS=1;var e=ID(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=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 Rp=i,Rp}var Ap,lS;function ec(){if(lS)return Ap;lS=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,a=Array(o);++i<o;)a[i]=r(t[i],i,t);return a}return Ap=e,Ap}var Ip,uS;function OD(){if(uS)return Ip;uS=1;var e=_o(),t=ec(),r=_t(),i=ko(),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(i(c))return a?a.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return Ip=u,Ip}var Mp,cS;function Rj(){if(cS)return Mp;cS=1;var e=OD();function t(r){return r==null?"":e(r)}return Mp=t,Mp}var Op,dS;function tc(){if(dS)return Op;dS=1;var e=_t(),t=Ay(),r=MD(),i=Rj();function o(a,u){return e(a)?a:t(a,u)?[a]:r(i(a))}return Op=o,Op}var Pp,fS;function za(){if(fS)return Pp;fS=1;var e=ko();function t(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Pp=t,Pp}var Lp,hS;function nc(){if(hS)return Lp;hS=1;var e=tc(),t=za();function r(i,o){o=e(o,i);for(var a=0,u=o.length;i!=null&&a<u;)i=i[t(o[a++])];return a&&a==u?i:void 0}return Lp=r,Lp}var $p,pS;function PD(){if(pS)return $p;pS=1;var e=nc();function t(r,i,o){var a=r==null?void 0:e(r,i);return a===void 0?o:a}return $p=t,$p}var qp,mS;function LD(){if(mS)return qp;mS=1;function e(t,r){return t!=null&&r in Object(t)}return qp=e,qp}var Dp,gS;function Aj(){if(gS)return Dp;gS=1;var e=tc(),t=Da(),r=_t(),i=Ku(),o=_y(),a=za();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)&&i(w,g)&&(r(c)||t(c)))}return Dp=u,Dp}var Fp,vS;function Ij(){if(vS)return Fp;vS=1;var e=LD(),t=Aj();function r(i,o){return i!=null&&t(i,o,e)}return Fp=r,Fp}var zp,yS;function $D(){if(yS)return zp;yS=1;var e=Cj(),t=PD(),r=Ij(),i=Ay(),o=jj(),a=Tj(),u=za(),c=1,f=2;function p(d,g){return i(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 zp=p,zp}var Bp,wS;function Mj(){if(wS)return Bp;wS=1;function e(t){return function(r){return r==null?void 0:r[t]}}return Bp=e,Bp}var Up,xS;function qD(){if(xS)return Up;xS=1;var e=nc();function t(r){return function(i){return e(i,r)}}return Up=t,Up}var Hp,_S;function DD(){if(_S)return Hp;_S=1;var e=Mj(),t=qD(),r=Ay(),i=za();function o(a){return r(a)?e(i(a)):t(a)}return Hp=o,Hp}var Wp,bS;function Ur(){if(bS)return Wp;bS=1;var e=RD(),t=$D(),r=wi(),i=_t(),o=DD();function a(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?t(u[0],u[1]):e(u):o(u)}return Wp=a,Wp}var Vp,SS;function Oj(){if(SS)return Vp;SS=1;var e=cj(),t=xD(),r=Ur(),i=_t();function o(a,u){var c=i(a)?e:t;return c(a,r(u,3))}return Vp=o,Vp}var Gp,kS;function FD(){if(kS)return Gp;kS=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i,o){return i!=null&&t.call(i,o)}return Gp=r,Gp}var Yp,ES;function Pj(){if(ES)return Yp;ES=1;var e=FD(),t=Aj();function r(i,o){return i!=null&&t(i,o,e)}return Yp=r,Yp}var Kp,NS;function zD(){if(NS)return Kp;NS=1;var e=Sy(),t=So(),r=Da(),i=_t(),o=Br(),a=bo(),u=Qu(),c=Fa(),f="[object Map]",p="[object Set]",d=Object.prototype,g=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||c(w)||r(w)))return!w.length;var E=t(w);if(E==f||E==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(g.call(w,_))return!1;return!0}return Kp=y,Kp}var Xp,CS;function Lj(){if(CS)return Xp;CS=1;function e(t){return t===void 0}return Xp=e,Xp}var Qp,jS;function $j(){if(jS)return Qp;jS=1;var e=Ju(),t=Br();function r(i,o){var a=-1,u=t(i)?Array(i.length):[];return e(i,function(c,f,p){u[++a]=o(c,f,p)}),u}return Qp=r,Qp}var Zp,TS;function qj(){if(TS)return Zp;TS=1;var e=ec(),t=Ur(),r=$j(),i=_t();function o(a,u){var c=i(a)?e:r;return c(a,t(u,3))}return Zp=o,Zp}var Jp,RS;function BD(){if(RS)return Jp;RS=1;function e(t,r,i,o){var a=-1,u=t==null?0:t.length;for(o&&u&&(i=t[++a]);++a<u;)i=r(i,t[a],a,t);return i}return Jp=e,Jp}var em,AS;function UD(){if(AS)return em;AS=1;function e(t,r,i,o,a){return a(t,function(u,c,f){i=o?(o=!1,u):r(i,u,c,f)}),i}return em=e,em}var tm,IS;function Dj(){if(IS)return tm;IS=1;var e=BD(),t=Ju(),r=Ur(),i=UD(),o=_t();function a(u,c,f){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),f,d,t)}return tm=a,tm}var nm,MS;function HD(){if(MS)return nm;MS=1;var e=gi(),t=_t(),r=mr(),i="[object String]";function o(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==i}return nm=o,nm}var rm,OS;function WD(){if(OS)return rm;OS=1;var e=Mj(),t=e("length");return rm=t,rm}var sm,PS;function VD(){if(PS)return sm;PS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,a="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+a+"]");function f(p){return c.test(p)}return sm=f,sm}var im,LS;function GD(){if(LS)return im;LS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,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",E=p+"?",_="["+a+"]?",b="(?:"+w+"(?:"+[d,g,y].join("|")+")"+_+E+")*",S=_+E+b,k="(?:"+[d+c+"?",c,g,y,u].join("|")+")",N=RegExp(f+"(?="+f+")|"+k+S,"g");function j(A){for(var M=N.lastIndex=0;N.test(A);)++M;return M}return im=j,im}var om,$S;function YD(){if($S)return om;$S=1;var e=WD(),t=VD(),r=GD();function i(o){return t(o)?r(o):e(o)}return om=i,om}var am,qS;function KD(){if(qS)return am;qS=1;var e=Sy(),t=So(),r=Br(),i=HD(),o=YD(),a="[object Map]",u="[object Set]";function c(f){if(f==null)return 0;if(r(f))return i(f)?o(f):f.length;var p=t(f);return p==a||p==u?f.size:e(f).length}return am=c,am}var lm,DS;function XD(){if(DS)return lm;DS=1;var e=xy(),t=yj(),r=Ty(),i=Ur(),o=Zu(),a=_t(),u=bo(),c=$a(),f=qn(),p=Fa();function d(g,y,w){var E=a(g),_=E||u(g)||p(g);if(y=i(y,4),w==null){var b=g&&g.constructor;_?w=E?new b:[]:f(g)?w=c(b)?t(o(g)):{}:w={}}return(_?e:r)(g,function(S,k,N){return y(w,S,k,N)}),w}return lm=d,lm}var um,FS;function QD(){if(FS)return um;FS=1;var e=_o(),t=Da(),r=_t(),i=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(i&&a&&a[i])}return um=o,um}var cm,zS;function Iy(){if(zS)return cm;zS=1;var e=Ey(),t=QD();function r(i,o,a,u,c){var f=-1,p=i.length;for(a||(a=t),c||(c=[]);++f<p;){var d=i[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 cm=r,cm}var dm,BS;function ZD(){if(BS)return dm;BS=1;function e(t,r,i){switch(i.length){case 0:return t.call(r);case 1:return t.call(r,i[0]);case 2:return t.call(r,i[0],i[1]);case 3:return t.call(r,i[0],i[1],i[2])}return t.apply(r,i)}return dm=e,dm}var fm,US;function Fj(){if(US)return fm;US=1;var e=ZD(),t=Math.max;function r(i,o,a){return o=t(o===void 0?i.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(i,this,d)}}return fm=r,fm}var hm,HS;function JD(){if(HS)return hm;HS=1;var e=Cy(),t=ij(),r=wi(),i=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return hm=i,hm}var pm,WS;function e4(){if(WS)return pm;WS=1;var e=800,t=16,r=Date.now;function i(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 pm=i,pm}var mm,VS;function zj(){if(VS)return mm;VS=1;var e=JD(),t=e4(),r=t(e);return mm=r,mm}var gm,GS;function rc(){if(GS)return gm;GS=1;var e=wi(),t=Fj(),r=zj();function i(o,a){return r(t(o,a,e),o+"")}return gm=i,gm}var vm,YS;function Bj(){if(YS)return vm;YS=1;function e(t,r,i,o){for(var a=t.length,u=i+(o?1:-1);o?u--:++u<a;)if(r(t[u],u,t))return u;return-1}return vm=e,vm}var ym,KS;function t4(){if(KS)return ym;KS=1;function e(t){return t!==t}return ym=e,ym}var wm,XS;function n4(){if(XS)return wm;XS=1;function e(t,r,i){for(var o=i-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return wm=e,wm}var xm,QS;function r4(){if(QS)return xm;QS=1;var e=Bj(),t=t4(),r=n4();function i(o,a,u){return a===a?r(o,a,u):e(o,t,u)}return xm=i,xm}var _m,ZS;function s4(){if(ZS)return _m;ZS=1;var e=r4();function t(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return _m=t,_m}var bm,JS;function i4(){if(JS)return bm;JS=1;function e(t,r,i){for(var o=-1,a=t==null?0:t.length;++o<a;)if(i(r,t[o]))return!0;return!1}return bm=e,bm}var Sm,ek;function o4(){if(ek)return Sm;ek=1;function e(){}return Sm=e,Sm}var km,tk;function a4(){if(tk)return km;tk=1;var e=mj(),t=o4(),r=Ry(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(a){return new e(a)}:t;return km=o,km}var Em,nk;function l4(){if(nk)return Em;nk=1;var e=kj(),t=s4(),r=i4(),i=Ej(),o=a4(),a=Ry(),u=200;function c(f,p,d){var g=-1,y=t,w=f.length,E=!0,_=[],b=_;if(d)E=!1,y=r;else if(w>=u){var S=p?null:o(f);if(S)return a(S);E=!1,y=i,b=new e}else b=p?[]:_;e:for(;++g<w;){var k=f[g],N=p?p(k):k;if(k=d||k!==0?k:0,E&&N===N){for(var j=b.length;j--;)if(b[j]===N)continue e;p&&b.push(N),_.push(k)}else y(b,N,d)||(b!==_&&b.push(N),_.push(k))}return _}return Em=c,Em}var Nm,rk;function Uj(){if(rk)return Nm;rk=1;var e=Br(),t=mr();function r(i){return t(i)&&e(i)}return Nm=r,Nm}var Cm,sk;function u4(){if(sk)return Cm;sk=1;var e=Iy(),t=rc(),r=l4(),i=Uj(),o=t(function(a){return r(e(a,1,i,!0))});return Cm=o,Cm}var jm,ik;function c4(){if(ik)return jm;ik=1;var e=ec();function t(r,i){return e(i,function(o){return r[o]})}return jm=t,jm}var Tm,ok;function Hj(){if(ok)return Tm;ok=1;var e=c4(),t=As();function r(i){return i==null?[]:e(i,t(i))}return Tm=r,Tm}var Rm,ak;function Dn(){if(ak)return Rm;ak=1;var e;if(typeof vy=="function")try{e={clone:vD(),constant:Cy(),each:Sj(),filter:Oj(),has:Pj(),isArray:_t(),isEmpty:zD(),isFunction:$a(),isUndefined:Lj(),keys:As(),map:qj(),reduce:Dj(),size:KD(),transform:XD(),union:u4(),values:Hj()}}catch{}return e||(e=window._),Rm=e,Rm}var Am,lk;function My(){if(lk)return Am;lk=1;var e=Dn();Am=o;var t="\0",r="\0",i="";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(E){y.length>1?w.setNode(E,g):w.setNode(E)}),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 E(_){var b=y.parent(_);return b===void 0||g.hasNode(b)?(w[_]=b,b):b in w?w[b]:E(b)}return this._isCompound&&e.each(g.nodes(),function(_){g.setParent(_,E(_))}),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(E,_){return w.length>1?y.setEdge(E,_,g):y.setEdge(E,_),_}),this},o.prototype.setEdge=function(){var d,g,y,w,E=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,g=_.w,y=_.name,arguments.length===2&&(w=arguments[1],E=!0)):(d=_,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],E=!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 E&&(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]=E?w:this._defaultEdgeLabelFn(d,g,y);var S=f(this._isDirected,d,g,y);return d=S.v,g=S.w,Object.freeze(S),this._edgeObjs[b]=S,a(this._preds[g],d),a(this._sucs[d],g),this._in[g][b]=S,this._out[d][b]=S,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),E=this._edgeObjs[w];return E&&(d=E.v,g=E.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(E){return E.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(E){return E.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 E=""+g,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}return E+i+_+i+(e.isUndefined(w)?t:w)}function f(d,g,y,w){var E=""+g,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}var S={v:E,w:_};return w&&(S.name=w),S}function p(d,g){return c(d,g.v,g.w,g.name)}return Am}var Im,uk;function d4(){return uk||(uk=1,Im="2.1.8"),Im}var Mm,ck;function f4(){return ck||(ck=1,Mm={Graph:My(),version:d4()}),Mm}var Om,dk;function h4(){if(dk)return Om;dk=1;var e=Dn(),t=My();Om={write:r,read:a};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:i(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function i(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 Om}var Pm,fk;function p4(){if(fk)return Pm;fk=1;var e=Dn();Pm=t;function t(r){var i={},o=[],a;function u(c){e.has(i,c)||(i[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 Pm}var Lm,hk;function Wj(){if(hk)return Lm;hk=1;var e=Dn();Lm=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 i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,i){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:i}),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,i){var o=this._keyIndices[r];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)},t.prototype._heapify=function(r){var i=this._arr,o=2*r,a=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,a<i.length&&(u=i[a].priority<i[u].priority?a:u),u!==r&&(this._swap(r,u),this._heapify(u)))},t.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,a;r!==0&&(a=r>>1,!(i[a].priority<o));)this._swap(r,a),r=a},t.prototype._swap=function(r,i){var o=this._arr,a=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,a[c.key]=r,a[u.key]=i},Lm}var $m,pk;function Vj(){if(pk)return $m;pk=1;var e=Dn(),t=Wj();$m=i;var r=e.constant(1);function i(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(E){var _=E.v!==g?E.v:E.w,b=p[_],S=c(E),k=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+E+" Weight: "+S);k<b.distance&&(b.distance=k,b.predecessor=g,d.decrease(_,k))};for(a.nodes().forEach(function(E){var _=E===u?0:Number.POSITIVE_INFINITY;p[E]={distance:_},d.add(E,_)});d.size()>0&&(g=d.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return $m}var qm,mk;function m4(){if(mk)return qm;mk=1;var e=Vj(),t=Dn();qm=r;function r(i,o,a){return t.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,a)},{})}return qm}var Dm,gk;function Gj(){if(gk)return Dm;gk=1;var e=Dn();Dm=t;function t(r){var i=0,o=[],a={},u=[];function c(f){var p=a[f]={onStack:!0,lowlink:i,index:i++};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 Dm}var Fm,vk;function g4(){if(vk)return Fm;vk=1;var e=Dn(),t=Gj();Fm=r;function r(i){return e.filter(t(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Fm}var zm,yk;function v4(){if(yk)return zm;yk=1;var e=Dn();zm=r;var t=e.constant(1);function r(o,a,u){return i(o,a||t,u||function(c){return o.outEdges(c)})}function i(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 E=y[p],_=d[w],b=y[w],S=E.distance+_.distance;S<b.distance&&(b.distance=S,b.predecessor=_.predecessor)})})}),c}return zm}var Bm,wk;function Yj(){if(wk)return Bm;wk=1;var e=Dn();Bm=t,t.CycleException=r;function t(i){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(i.predecessors(f),c),delete a[f],u.push(f))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,Bm}var Um,xk;function y4(){if(xk)return Um;xk=1;var e=Yj();Um=t;function t(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Um}var Hm,_k;function Kj(){if(_k)return Hm;_k=1;var e=Dn();Hm=t;function t(i,o,a){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],f={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,a==="post",f,u,c)}),c}function r(i,o,a,u,c,f){e.has(u,o)||(u[o]=!0,a||f.push(o),e.each(c(o),function(p){r(i,p,a,u,c,f)}),a&&f.push(o))}return Hm}var Wm,bk;function w4(){if(bk)return Wm;bk=1;var e=Kj();Wm=t;function t(r,i){return e(r,i,"post")}return Wm}var Vm,Sk;function x4(){if(Sk)return Vm;Sk=1;var e=Kj();Vm=t;function t(r,i){return e(r,i,"pre")}return Vm}var Gm,kk;function _4(){if(kk)return Gm;kk=1;var e=Dn(),t=My(),r=Wj();Gm=i;function i(o,a){var u=new t,c={},f=new r,p;function d(y){var w=y.v===p?y.w:y.v,E=f.priority(w);if(E!==void 0){var _=a(y);_<E&&(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 Gm}var Ym,Ek;function b4(){return Ek||(Ek=1,Ym={components:p4(),dijkstra:Vj(),dijkstraAll:m4(),findCycles:g4(),floydWarshall:v4(),isAcyclic:y4(),postorder:w4(),preorder:x4(),prim:_4(),tarjan:Gj(),topsort:Yj()}),Ym}var Km,Nk;function S4(){if(Nk)return Km;Nk=1;var e=f4();return Km={Graph:e.Graph,json:h4(),alg:b4(),version:e.version},Km}var Xm,Ck;function tr(){if(Ck)return Xm;Ck=1;var e;if(typeof vy=="function")try{e=S4()}catch{}return e||(e=window.graphlib),Xm=e,Xm}var Qm,jk;function k4(){if(jk)return Qm;jk=1;var e=xj(),t=1,r=4;function i(o){return e(o,t|r)}return Qm=i,Qm}var Zm,Tk;function sc(){if(Tk)return Zm;Tk=1;var e=xo(),t=Br(),r=Ku(),i=qn();function o(a,u,c){if(!i(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 Zm=o,Zm}var Jm,Rk;function E4(){if(Rk)return Jm;Rk=1;var e=rc(),t=xo(),r=sc(),i=yi(),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=i(y),E=-1,_=w.length;++E<_;){var b=w[E],S=c[b];(S===void 0||t(S,o[b])&&!a.call(c,b))&&(c[b]=y[b])}return c});return Jm=u,Jm}var eg,Ak;function N4(){if(Ak)return eg;Ak=1;var e=Ur(),t=Br(),r=As();function i(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 eg=i,eg}var tg,Ik;function C4(){if(Ik)return tg;Ik=1;var e=/\s/;function t(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return tg=t,tg}var ng,Mk;function j4(){if(Mk)return ng;Mk=1;var e=C4(),t=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(t,"")}return ng=r,ng}var rg,Ok;function T4(){if(Ok)return rg;Ok=1;var e=j4(),t=qn(),r=ko(),i=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 i;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)?i:+p}return rg=f,rg}var sg,Pk;function Xj(){if(Pk)return sg;Pk=1;var e=T4(),t=1/0,r=17976931348623157e292;function i(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 sg=i,sg}var ig,Lk;function R4(){if(Lk)return ig;Lk=1;var e=Xj();function t(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return ig=t,ig}var og,$k;function A4(){if($k)return og;$k=1;var e=Bj(),t=Ur(),r=R4(),i=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=i(f+p,0)),e(a,t(u,3),p)}return og=o,og}var ag,qk;function I4(){if(qk)return ag;qk=1;var e=N4(),t=A4(),r=e(t);return ag=r,ag}var lg,Dk;function Qj(){if(Dk)return lg;Dk=1;var e=Iy();function t(r){var i=r==null?0:r.length;return i?e(r,1):[]}return lg=t,lg}var ug,Fk;function M4(){if(Fk)return ug;Fk=1;var e=jy(),t=_j(),r=yi();function i(o,a){return o==null?o:e(o,t(a),r)}return ug=i,ug}var cg,zk;function O4(){if(zk)return cg;zk=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return cg=e,cg}var dg,Bk;function P4(){if(Bk)return dg;Bk=1;var e=Gu(),t=Ty(),r=Ur();function i(o,a){var u={};return a=r(a,3),t(o,function(c,f,p){e(u,f,a(c,f,p))}),u}return dg=i,dg}var fg,Uk;function Oy(){if(Uk)return fg;Uk=1;var e=ko();function t(r,i,o){for(var a=-1,u=r.length;++a<u;){var c=r[a],f=i(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return fg=t,fg}var hg,Hk;function L4(){if(Hk)return hg;Hk=1;function e(t,r){return t>r}return hg=e,hg}var pg,Wk;function $4(){if(Wk)return pg;Wk=1;var e=Oy(),t=L4(),r=wi();function i(o){return o&&o.length?e(o,r,t):void 0}return pg=i,pg}var mg,Vk;function Zj(){if(Vk)return mg;Vk=1;var e=Gu(),t=xo();function r(i,o,a){(a!==void 0&&!t(i[o],a)||a===void 0&&!(o in i))&&e(i,o,a)}return mg=r,mg}var gg,Gk;function q4(){if(Gk)return gg;Gk=1;var e=gi(),t=Zu(),r=mr(),i="[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)!=i)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 gg=p,gg}var vg,Yk;function Jj(){if(Yk)return vg;Yk=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return vg=e,vg}var yg,Kk;function D4(){if(Kk)return yg;Kk=1;var e=qa(),t=yi();function r(i){return e(i,t(i))}return yg=r,yg}var wg,Xk;function F4(){if(Xk)return wg;Xk=1;var e=Zj(),t=lj(),r=vj(),i=uj(),o=wj(),a=Da(),u=_t(),c=Uj(),f=bo(),p=$a(),d=qn(),g=q4(),y=Fa(),w=Jj(),E=D4();function _(b,S,k,N,j,A,M){var P=w(b,k),O=w(S,k),D=M.get(O);if(D){e(b,k,D);return}var L=A?A(P,O,k+"",b,S,M):void 0,U=L===void 0;if(U){var V=u(O),z=!V&&f(O),C=!V&&!z&&y(O);L=O,V||z||C?u(P)?L=P:c(P)?L=i(P):z?(U=!1,L=t(O,!0)):C?(U=!1,L=r(O,!0)):L=[]:g(O)||a(O)?(L=P,a(P)?L=E(P):(!d(P)||p(P))&&(L=o(O))):U=!1}U&&(M.set(O,L),j(L,O,N,A,M),M.delete(O)),e(b,k,L)}return wg=_,wg}var xg,Qk;function z4(){if(Qk)return xg;Qk=1;var e=Vu(),t=Zj(),r=jy(),i=F4(),o=qn(),a=yi(),u=Jj();function c(f,p,d,g,y){f!==p&&r(p,function(w,E){if(y||(y=new e),o(w))i(f,p,E,d,c,g,y);else{var _=g?g(u(f,E),w,E+"",f,p,y):void 0;_===void 0&&(_=w),t(f,E,_)}},a)}return xg=c,xg}var _g,Zk;function B4(){if(Zk)return _g;Zk=1;var e=rc(),t=sc();function r(i){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=i.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&&i(o,d,u,f)}return o})}return _g=r,_g}var bg,Jk;function U4(){if(Jk)return bg;Jk=1;var e=z4(),t=B4(),r=t(function(i,o,a){e(i,o,a)});return bg=r,bg}var Sg,eE;function eT(){if(eE)return Sg;eE=1;function e(t,r){return t<r}return Sg=e,Sg}var kg,tE;function H4(){if(tE)return kg;tE=1;var e=Oy(),t=eT(),r=wi();function i(o){return o&&o.length?e(o,r,t):void 0}return kg=i,kg}var Eg,nE;function W4(){if(nE)return Eg;nE=1;var e=Oy(),t=Ur(),r=eT();function i(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return Eg=i,Eg}var Ng,rE;function V4(){if(rE)return Ng;rE=1;var e=rr(),t=function(){return e.Date.now()};return Ng=t,Ng}var Cg,sE;function G4(){if(sE)return Cg;sE=1;var e=Yu(),t=tc(),r=Ku(),i=qn(),o=za();function a(u,c,f,p){if(!i(u))return u;c=t(c,u);for(var d=-1,g=c.length,y=g-1,w=u;w!=null&&++d<g;){var E=o(c[d]),_=f;if(E==="__proto__"||E==="constructor"||E==="prototype")return u;if(d!=y){var b=w[E];_=p?p(b,E,w):void 0,_===void 0&&(_=i(b)?b:r(c[d+1])?[]:{})}e(w,E,_),w=w[E]}return u}return Cg=a,Cg}var jg,iE;function Y4(){if(iE)return jg;iE=1;var e=nc(),t=G4(),r=tc();function i(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 jg=i,jg}var Tg,oE;function K4(){if(oE)return Tg;oE=1;var e=Y4(),t=Ij();function r(i,o){return e(i,o,function(a,u){return t(i,u)})}return Tg=r,Tg}var Rg,aE;function X4(){if(aE)return Rg;aE=1;var e=Qj(),t=Fj(),r=zj();function i(o){return r(t(o,void 0,e),o+"")}return Rg=i,Rg}var Ag,lE;function Q4(){if(lE)return Ag;lE=1;var e=K4(),t=X4(),r=t(function(i,o){return i==null?{}:e(i,o)});return Ag=r,Ag}var Ig,uE;function Z4(){if(uE)return Ig;uE=1;var e=Math.ceil,t=Math.max;function r(i,o,a,u){for(var c=-1,f=t(e((o-i)/(a||1)),0),p=Array(f);f--;)p[u?f:++c]=i,i+=a;return p}return Ig=r,Ig}var Mg,cE;function J4(){if(cE)return Mg;cE=1;var e=Z4(),t=sc(),r=Xj();function i(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 Mg=i,Mg}var Og,dE;function e5(){if(dE)return Og;dE=1;var e=J4(),t=e();return Og=t,Og}var Pg,fE;function t5(){if(fE)return Pg;fE=1;function e(t,r){var i=t.length;for(t.sort(r);i--;)t[i]=t[i].value;return t}return Pg=e,Pg}var Lg,hE;function n5(){if(hE)return Lg;hE=1;var e=ko();function t(r,i){if(r!==i){var o=r!==void 0,a=r===null,u=r===r,c=e(r),f=i!==void 0,p=i===null,d=i===i,g=e(i);if(!p&&!g&&!c&&r>i||c&&f&&d&&!p&&!g||a&&f&&d||!o&&d||!u)return 1;if(!a&&!c&&!g&&r<i||g&&o&&u&&!a&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return Lg=t,Lg}var $g,pE;function r5(){if(pE)return $g;pE=1;var e=n5();function t(r,i,o){for(var a=-1,u=r.criteria,c=i.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-i.index}return $g=t,$g}var qg,mE;function s5(){if(mE)return qg;mE=1;var e=ec(),t=nc(),r=Ur(),i=$j(),o=t5(),a=Xu(),u=r5(),c=wi(),f=_t();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 E=i(d,function(_,b,S){var k=e(g,function(N){return N(_)});return{criteria:k,index:++w,value:_}});return o(E,function(_,b){return u(_,b,y)})}return qg=p,qg}var Dg,gE;function i5(){if(gE)return Dg;gE=1;var e=Iy(),t=s5(),r=rc(),i=sc(),o=r(function(a,u){if(a==null)return[];var c=u.length;return c>1&&i(a,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),t(a,e(u,1),[])});return Dg=o,Dg}var Fg,vE;function o5(){if(vE)return Fg;vE=1;var e=Rj(),t=0;function r(i){var o=++t;return e(i)+o}return Fg=r,Fg}var zg,yE;function a5(){if(yE)return zg;yE=1;function e(t,r,i){for(var o=-1,a=t.length,u=r.length,c={};++o<a;){var f=o<u?r[o]:void 0;i(c,t[o],f)}return c}return zg=e,zg}var Bg,wE;function l5(){if(wE)return Bg;wE=1;var e=Yu(),t=a5();function r(i,o){return t(i||[],o||[],e)}return Bg=r,Bg}var Ug,xE;function at(){if(xE)return Ug;xE=1;var e;if(typeof vy=="function")try{e={cloneDeep:k4(),constant:Cy(),defaults:E4(),each:Sj(),filter:Oj(),find:I4(),flatten:Qj(),forEach:bj(),forIn:M4(),has:Pj(),isUndefined:Lj(),last:O4(),map:qj(),mapValues:P4(),max:$4(),merge:U4(),min:H4(),minBy:W4(),now:V4(),pick:Q4(),range:e5(),reduce:Dj(),sortBy:i5(),uniqueId:o5(),values:Hj(),zipObject:l5()}}catch{}return e||(e=window._),Ug=e,Ug}var Hg,_E;function u5(){if(_E)return Hg;_E=1,Hg=e;function e(){var i={};i._next=i._prev=i,this._sentinel=i}e.prototype.dequeue=function(){var i=this._sentinel,o=i._prev;if(o!==i)return t(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&t(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o},e.prototype.toString=function(){for(var i=[],o=this._sentinel,a=o._prev;a!==o;)i.push(JSON.stringify(a,r)),a=a._prev;return"["+i.join(", ")+"]"};function t(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,o){if(i!=="_next"&&i!=="_prev")return o}return Hg}var Wg,bE;function c5(){if(bE)return Wg;bE=1;var e=at(),t=tr().Graph,r=u5();Wg=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var g=c(p,d||i),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],E=d[0],_;p.nodeCount();){for(;_=E.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 E=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),S=p.node(_.v);w&&E.push({v:_.v,w:_.w}),S.out-=b,f(d,g,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,k=p.node(S);k.in-=b,f(d,g,k)}),p.removeNode(y.v),E}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 S=g.edge(b.v,b.w)||0,k=d(b),N=S+k;g.setEdge(b.v,b.w,N),w=Math.max(w,g.node(b.v).out+=k),y=Math.max(y,g.node(b.w).in+=k)});var E=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(g.nodes(),function(b){f(E,_,g.node(b))}),{graph:g,buckets:E,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 Wg}var Vg,SE;function d5(){if(SE)return Vg;SE=1;var e=at(),t=c5();Vg={run:r,undo:o};function r(a){var u=a.graph().acyclicer==="greedy"?t(a,c(a)):i(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 i(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 Vg}var Gg,kE;function fn(){if(kE)return Gg;kE=1;var e=at(),t=tr().Graph;Gg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:g,maxRank:y,partition:w,time:E,notime:_};function r(b,S,k,N){var j;do j=e.uniqueId(N);while(b.hasNode(j));return k.dummy=S,b.setNode(j,k),j}function i(b){var S=new t().setGraph(b.graph());return e.forEach(b.nodes(),function(k){S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){var N=S.edge(k.v,k.w)||{weight:0,minlen:1},j=b.edge(k);S.setEdge(k.v,k.w,{weight:N.weight+j.weight,minlen:Math.max(N.minlen,j.minlen)})}),S}function o(b){var S=new t({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(k){b.children(k).length||S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){S.setEdge(k,b.edge(k))}),S}function a(b){var S=e.map(b.nodes(),function(k){var N={};return e.forEach(b.outEdges(k),function(j){N[j.w]=(N[j.w]||0)+b.edge(j).weight}),N});return e.zipObject(b.nodes(),S)}function u(b){var S=e.map(b.nodes(),function(k){var N={};return e.forEach(b.inEdges(k),function(j){N[j.v]=(N[j.v]||0)+b.edge(j).weight}),N});return e.zipObject(b.nodes(),S)}function c(b,S){var k=b.x,N=b.y,j=S.x-k,A=S.y-N,M=b.width/2,P=b.height/2;if(!j&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var O,D;return Math.abs(A)*M>Math.abs(j)*P?(A<0&&(P=-P),O=P*j/A,D=P):(j<0&&(M=-M),O=M,D=M*A/j),{x:k+O,y:N+D}}function f(b){var S=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(k){var N=b.node(k),j=N.rank;e.isUndefined(j)||(S[j][N.order]=k)}),S}function p(b){var S=e.min(e.map(b.nodes(),function(k){return b.node(k).rank}));e.forEach(b.nodes(),function(k){var N=b.node(k);e.has(N,"rank")&&(N.rank-=S)})}function d(b){var S=e.min(e.map(b.nodes(),function(A){return b.node(A).rank})),k=[];e.forEach(b.nodes(),function(A){var M=b.node(A).rank-S;k[M]||(k[M]=[]),k[M].push(A)});var N=0,j=b.graph().nodeRankFactor;e.forEach(k,function(A,M){e.isUndefined(A)&&M%j!==0?--N:N&&e.forEach(A,function(P){b.node(P).rank+=N})})}function g(b,S,k,N){var j={width:0,height:0};return arguments.length>=4&&(j.rank=k,j.order=N),r(b,"border",j,S)}function y(b){return e.max(e.map(b.nodes(),function(S){var k=b.node(S).rank;if(!e.isUndefined(k))return k}))}function w(b,S){var k={lhs:[],rhs:[]};return e.forEach(b,function(N){S(N)?k.lhs.push(N):k.rhs.push(N)}),k}function E(b,S){var k=e.now();try{return S()}finally{console.log(b+" time: "+(e.now()-k)+"ms")}}function _(b,S){return S()}return Gg}var Yg,EE;function f5(){if(EE)return Yg;EE=1;var e=at(),t=fn();Yg={run:r,undo:o};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(u){i(a,u)})}function i(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 E,_,b;for(b=0,++f;f<d;++b,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:f},E=t.addDummyNode(a,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),a.setEdge(c,E,{weight:y.weight},g),b===0&&a.graph().dummyChains.push(E),c=E;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 Yg}var Kg,NE;function Au(){if(NE)return Kg;NE=1;var e=at();Kg={longestPath:t,slack:r};function t(i){var o={};function a(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var f=e.min(e.map(i.outEdges(u),function(p){return a(p.w)-i.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),c.rank=f}e.forEach(i.sources(),a)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return Kg}var Xg,CE;function tT(){if(CE)return Xg;CE=1;var e=at(),t=tr().Graph,r=Au().slack;Xg=i;function i(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 Xg}var Qg,jE;function h5(){if(jE)return Qg;jE=1;var e=at(),t=tT(),r=Au().slack,i=Au().longestPath,o=tr().alg.preorder,a=tr().alg.postorder,u=fn().simplify;Qg=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=E,c.exchangeEdges=_;function c(N){N=u(N),i(N);var j=t(N);g(j),f(j,N);for(var A,M;A=w(j);)M=E(j,N,A),_(j,N,A,M)}function f(N,j){var A=a(N,N.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(M){p(N,j,M)})}function p(N,j,A){var M=N.node(A),P=M.parent;N.edge(A,P).cutvalue=d(N,j,A)}function d(N,j,A){var M=N.node(A),P=M.parent,O=!0,D=j.edge(A,P),L=0;return D||(O=!1,D=j.edge(P,A)),L=D.weight,e.forEach(j.nodeEdges(A),function(U){var V=U.v===A,z=V?U.w:U.v;if(z!==P){var C=V===O,F=j.edge(U).weight;if(L+=C?F:-F,S(N,A,z)){var $=N.edge(A,z).cutvalue;L+=C?-$:$}}}),L}function g(N,j){arguments.length<2&&(j=N.nodes()[0]),y(N,{},1,j)}function y(N,j,A,M,P){var O=A,D=N.node(M);return j[M]=!0,e.forEach(N.neighbors(M),function(L){e.has(j,L)||(A=y(N,j,A,L,M))}),D.low=O,D.lim=A++,P?D.parent=P:delete D.parent,A}function w(N){return e.find(N.edges(),function(j){return N.edge(j).cutvalue<0})}function E(N,j,A){var M=A.v,P=A.w;j.hasEdge(M,P)||(M=A.w,P=A.v);var O=N.node(M),D=N.node(P),L=O,U=!1;O.lim>D.lim&&(L=D,U=!0);var V=e.filter(j.edges(),function(z){return U===k(N,N.node(z.v),L)&&U!==k(N,N.node(z.w),L)});return e.minBy(V,function(z){return r(j,z)})}function _(N,j,A,M){var P=A.v,O=A.w;N.removeEdge(P,O),N.setEdge(M.v,M.w,{}),g(N),f(N,j),b(N,j)}function b(N,j){var A=e.find(N.nodes(),function(P){return!j.node(P).parent}),M=o(N,A);M=M.slice(1),e.forEach(M,function(P){var O=N.node(P).parent,D=j.edge(P,O),L=!1;D||(D=j.edge(O,P),L=!0),j.node(P).rank=j.node(O).rank+(L?D.minlen:-D.minlen)})}function S(N,j,A){return N.hasEdge(j,A)}function k(N,j,A){return A.low<=j.lim&&j.lim<=A.lim}return Qg}var Zg,TE;function p5(){if(TE)return Zg;TE=1;var e=Au(),t=e.longestPath,r=tT(),i=h5();Zg=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){i(f)}return Zg}var Jg,RE;function m5(){if(RE)return Jg;RE=1;var e=at();Jg=t;function t(o){var a=i(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],E=!0;u!==f.w;){if(c=o.node(u),E){for(;(w=d[y])!==g&&o.node(w).maxRank<c.rank;)y++;w===g&&(E=!1)}if(!E){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 i(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 Jg}var ev,AE;function g5(){if(AE)return ev;AE=1;var e=at(),t=fn();ev={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){i(c,f,g,y,d,p,w)}),c.graph().nodeRankFactor=g}function i(c,f,p,d,g,y,w){var E=c.children(w);if(!E.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(c,"_bt"),b=t.addBorderNode(c,"_bb"),S=c.node(w);c.setParent(_,w),S.borderTop=_,c.setParent(b,w),S.borderBottom=b,e.forEach(E,function(k){i(c,f,p,d,g,y,k);var N=c.node(k),j=N.borderTop?N.borderTop:k,A=N.borderBottom?N.borderBottom:k,M=N.borderTop?d:2*d,P=j!==A?1:g-y[w]+1;c.setEdge(_,j,{weight:M,minlen:P,nestingEdge:!0}),c.setEdge(A,b,{weight:M,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 ev}var tv,IE;function v5(){if(IE)return tv;IE=1;var e=at(),t=fn();tv=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)i(o,"borderLeft","_bl",u,f,p),i(o,"borderRight","_br",u,f,p)}}e.forEach(o.children(),a)}function i(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 tv}var nv,ME;function y5(){if(ME)return nv;ME=1;var e=at();nv={adjust:t,undo:r};function t(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&a(p),(d==="lr"||d==="rl")&&(c(p),i(p))}function i(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 nv}var rv,OE;function w5(){if(OE)return rv;OE=1;var e=at();rv=t;function t(r){var i={},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(i,p)){i[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 rv}var sv,PE;function x5(){if(PE)return sv;PE=1;var e=at();sv=t;function t(i,o){for(var a=0,u=1;u<o.length;++u)a+=r(i,o[u-1],o[u]);return a}function r(i,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(i.outEdges(y),function(w){return{pos:u[w.w],weight:i.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 E=0;w>0;)w%2&&(E+=d[w+1]),w=w-1>>1,d[w]+=y.weight;g+=y.weight*E})),g}return sv}var iv,LE;function _5(){if(LE)return iv;LE=1;var e=at();iv=t;function t(r,i){return e.map(i,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 iv}var ov,$E;function b5(){if($E)return ov;$E=1;var e=at();ov=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)&&i(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 i(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 ov}var av,qE;function S5(){if(qE)return av;qE=1;var e=at(),t=fn();av=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=i(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),g+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var E={vs:e.flatten(d,!0)};return y&&(E.barycenter=g/y,E.weight=y),E}function i(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 av}var lv,DE;function k5(){if(DE)return lv;DE=1;var e=at(),t=_5(),r=b5(),i=S5();lv=o;function o(c,f,p,d){var g=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,E=y?y.borderRight:void 0,_={};w&&(g=e.filter(g,function(A){return A!==w&&A!==E}));var b=t(c,g);e.forEach(b,function(A){if(c.children(A.v).length){var M=o(c,A.v,p,d);_[A.v]=M,e.has(M,"barycenter")&&u(A,M)}});var S=r(b,p);a(S,_);var k=i(S,d);if(w&&(k.vs=e.flatten([w,k.vs,E],!0),c.predecessors(w).length)){var N=c.node(c.predecessors(w)[0]),j=c.node(c.predecessors(E)[0]);e.has(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+N.order+j.order)/(k.weight+2),k.weight+=2}return k}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 lv}var uv,FE;function E5(){if(FE)return uv;FE=1;var e=at(),t=tr().Graph;uv=r;function r(o,a,u){var c=i(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,E=f.edge(w,p),_=e.isUndefined(E)?0:E.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 i(o){for(var a;o.hasNode(a=e.uniqueId("_root")););return a}return uv}var cv,zE;function N5(){if(zE)return cv;zE=1;var e=at();cv=t;function t(r,i,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){i.setEdge(d,f);return}f=p}})}return cv}var dv,BE;function C5(){if(BE)return dv;BE=1;var e=at(),t=w5(),r=x5(),i=k5(),o=E5(),a=N5(),u=tr().Graph,c=fn();dv=f;function f(y){var w=c.maxRank(y),E=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 S=Number.POSITIVE_INFINITY,k,N=0,j=0;j<4;++N,++j){d(N%2?E:_,N%4>=2),b=c.buildLayerMatrix(y);var A=r(y,b);A<S&&(j=0,k=e.cloneDeep(b),S=A)}g(y,k)}function p(y,w,E){return e.map(w,function(_){return o(y,_,E)})}function d(y,w){var E=new u;e.forEach(y,function(_){var b=_.graph().root,S=i(_,b,E,w);e.forEach(S.vs,function(k,N){_.node(k).order=N}),a(_,E,S.vs)})}function g(y,w){e.forEach(w,function(E){e.forEach(E,function(_,b){y.node(_).order=b})})}return dv}var fv,UE;function j5(){if(UE)return fv;UE=1;var e=at(),t=tr().Graph,r=fn();fv={positionX:E,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function i(S,k){var N={};function j(A,M){var P=0,O=0,D=A.length,L=e.last(M);return e.forEach(M,function(U,V){var z=a(S,U),C=z?S.node(z).order:D;(z||U===L)&&(e.forEach(M.slice(O,V+1),function(F){e.forEach(S.predecessors(F),function($){var re=S.node($),J=re.order;(J<P||C<J)&&!(re.dummy&&S.node(F).dummy)&&u(N,$,F)})}),O=V+1,P=C)}),M}return e.reduce(k,j),N}function o(S,k){var N={};function j(M,P,O,D,L){var U;e.forEach(e.range(P,O),function(V){U=M[V],S.node(U).dummy&&e.forEach(S.predecessors(U),function(z){var C=S.node(z);C.dummy&&(C.order<D||C.order>L)&&u(N,z,U)})})}function A(M,P){var O=-1,D,L=0;return e.forEach(P,function(U,V){if(S.node(U).dummy==="border"){var z=S.predecessors(U);z.length&&(D=S.node(z[0]).order,j(P,L,V,O,D),L=V,O=D)}j(P,L,P.length,D,M.length)}),P}return e.reduce(k,A),N}function a(S,k){if(S.node(k).dummy)return e.find(S.predecessors(k),function(N){return S.node(N).dummy})}function u(S,k,N){if(k>N){var j=k;k=N,N=j}var A=S[k];A||(S[k]=A={}),A[N]=!0}function c(S,k,N){if(k>N){var j=k;k=N,N=j}return e.has(S[k],N)}function f(S,k,N,j){var A={},M={},P={};return e.forEach(k,function(O){e.forEach(O,function(D,L){A[D]=D,M[D]=D,P[D]=L})}),e.forEach(k,function(O){var D=-1;e.forEach(O,function(L){var U=j(L);if(U.length){U=e.sortBy(U,function($){return P[$]});for(var V=(U.length-1)/2,z=Math.floor(V),C=Math.ceil(V);z<=C;++z){var F=U[z];M[L]===L&&D<P[F]&&!c(N,L,F)&&(M[F]=L,M[L]=A[L]=A[F],D=P[F])}}})}),{root:A,align:M}}function p(S,k,N,j,A){var M={},P=d(S,k,N,A),O=A?"borderLeft":"borderRight";function D(V,z){for(var C=P.nodes(),F=C.pop(),$={};F;)$[F]?V(F):($[F]=!0,C.push(F),C=C.concat(z(F))),F=C.pop()}function L(V){M[V]=P.inEdges(V).reduce(function(z,C){return Math.max(z,M[C.v]+P.edge(C))},0)}function U(V){var z=P.outEdges(V).reduce(function(F,$){return Math.min(F,M[$.w]-P.edge($))},Number.POSITIVE_INFINITY),C=S.node(V);z!==Number.POSITIVE_INFINITY&&C.borderType!==O&&(M[V]=Math.max(M[V],z))}return D(L,P.predecessors.bind(P)),D(U,P.successors.bind(P)),e.forEach(j,function(V){M[V]=M[N[V]]}),M}function d(S,k,N,j){var A=new t,M=S.graph(),P=_(M.nodesep,M.edgesep,j);return e.forEach(k,function(O){var D;e.forEach(O,function(L){var U=N[L];if(A.setNode(U),D){var V=N[D],z=A.edge(V,U);A.setEdge(V,U,Math.max(P(S,L,D),z||0))}D=L})}),A}function g(S,k){return e.minBy(e.values(k),function(N){var j=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(N,function(M,P){var O=b(S,P)/2;j=Math.max(M+O,j),A=Math.min(M-O,A)}),j-A})}function y(S,k){var N=e.values(k),j=e.min(N),A=e.max(N);e.forEach(["u","d"],function(M){e.forEach(["l","r"],function(P){var O=M+P,D=S[O],L;if(D!==k){var U=e.values(D);L=P==="l"?j-e.min(U):A-e.max(U),L&&(S[O]=e.mapValues(D,function(V){return V+L}))}})})}function w(S,k){return e.mapValues(S.ul,function(N,j){if(k)return S[k.toLowerCase()][j];var A=e.sortBy(e.map(S,j));return(A[1]+A[2])/2})}function E(S){var k=r.buildLayerMatrix(S),N=e.merge(i(S,k),o(S,k)),j={},A;e.forEach(["u","d"],function(P){A=P==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(O){O==="r"&&(A=e.map(A,function(V){return e.values(V).reverse()}));var D=(P==="u"?S.predecessors:S.successors).bind(S),L=f(S,A,N,D),U=p(S,A,L.root,L.align,O==="r");O==="r"&&(U=e.mapValues(U,function(V){return-V})),j[P+O]=U})});var M=g(S,j);return y(j,M),w(j,S.graph().align)}function _(S,k,N){return function(j,A,M){var P=j.node(A),O=j.node(M),D=0,L;if(D+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":L=-P.width/2;break;case"r":L=P.width/2;break}if(L&&(D+=N?L:-L),L=0,D+=(P.dummy?k:S)/2,D+=(O.dummy?k:S)/2,D+=O.width/2,e.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":L=O.width/2;break;case"r":L=-O.width/2;break}return L&&(D+=N?L:-L),L=0,D}}function b(S,k){return S.node(k).width}return fv}var hv,HE;function T5(){if(HE)return hv;HE=1;var e=at(),t=fn(),r=j5().positionX;hv=i;function i(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 hv}var pv,WE;function R5(){if(WE)return pv;WE=1;var e=at(),t=d5(),r=f5(),i=p5(),o=fn().normalizeRanks,a=m5(),u=fn().removeEmptyRanks,c=g5(),f=v5(),p=y5(),d=C5(),g=T5(),y=fn(),w=tr().Graph;pv=E;function E(q,Q){var ne=Q&&Q.debugTiming?y.time:y.notime;ne("layout",function(){var ae=ne(" buildLayoutGraph",function(){return D(q)});ne(" runLayout",function(){_(ae,ne)}),ne(" updateInputGraph",function(){b(q,ae)})})}function _(q,Q){Q(" makeSpaceForEdgeLabels",function(){L(q)}),Q(" removeSelfEdges",function(){W(q)}),Q(" acyclic",function(){t.run(q)}),Q(" nestingGraph.run",function(){c.run(q)}),Q(" rank",function(){i(y.asNonCompoundGraph(q))}),Q(" injectEdgeLabelProxies",function(){U(q)}),Q(" removeEmptyRanks",function(){u(q)}),Q(" nestingGraph.cleanup",function(){c.cleanup(q)}),Q(" normalizeRanks",function(){o(q)}),Q(" assignRankMinMax",function(){V(q)}),Q(" removeEdgeLabelProxies",function(){z(q)}),Q(" normalize.run",function(){r.run(q)}),Q(" parentDummyChains",function(){a(q)}),Q(" addBorderSegments",function(){f(q)}),Q(" order",function(){d(q)}),Q(" insertSelfEdges",function(){Z(q)}),Q(" adjustCoordinateSystem",function(){p.adjust(q)}),Q(" position",function(){g(q)}),Q(" positionSelfEdges",function(){I(q)}),Q(" removeBorderNodes",function(){J(q)}),Q(" normalize.undo",function(){r.undo(q)}),Q(" fixupEdgeLabelCoords",function(){$(q)}),Q(" undoCoordinateSystem",function(){p.undo(q)}),Q(" translateGraph",function(){C(q)}),Q(" assignNodeIntersects",function(){F(q)}),Q(" reversePoints",function(){re(q)}),Q(" acyclic.undo",function(){t.undo(q)})}function b(q,Q){e.forEach(q.nodes(),function(ne){var ae=q.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(q.edges(),function(ne){var ae=q.edge(ne),fe=Q.edge(ne);ae.points=fe.points,e.has(fe,"x")&&(ae.x=fe.x,ae.y=fe.y)}),q.graph().width=Q.graph().width,q.graph().height=Q.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],j=["width","height"],A={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},O=["labelpos"];function D(q){var Q=new w({multigraph:!0,compound:!0}),ne=K(q.graph());return Q.setGraph(e.merge({},k,G(ne,S),e.pick(ne,N))),e.forEach(q.nodes(),function(ae){var fe=K(q.node(ae));Q.setNode(ae,e.defaults(G(fe,j),A)),Q.setParent(ae,q.parent(ae))}),e.forEach(q.edges(),function(ae){var fe=K(q.edge(ae));Q.setEdge(ae,e.merge({},P,G(fe,M),e.pick(fe,O)))}),Q}function L(q){var Q=q.graph();Q.ranksep/=2,e.forEach(q.edges(),function(ne){var ae=q.edge(ne);ae.minlen*=2,ae.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?ae.width+=ae.labeloffset:ae.height+=ae.labeloffset)})}function U(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q);if(ne.width&&ne.height){var ae=q.node(Q.v),fe=q.node(Q.w),te={rank:(fe.rank-ae.rank)/2+ae.rank,e:Q};y.addDummyNode(q,"edge-proxy",te,"_ep")}})}function V(q){var Q=0;e.forEach(q.nodes(),function(ne){var ae=q.node(ne);ae.borderTop&&(ae.minRank=q.node(ae.borderTop).rank,ae.maxRank=q.node(ae.borderBottom).rank,Q=e.max(Q,ae.maxRank))}),q.graph().maxRank=Q}function z(q){e.forEach(q.nodes(),function(Q){var ne=q.node(Q);ne.dummy==="edge-proxy"&&(q.edge(ne.e).labelRank=ne.rank,q.removeNode(Q))})}function C(q){var Q=Number.POSITIVE_INFINITY,ne=0,ae=Number.POSITIVE_INFINITY,fe=0,te=q.graph(),ce=te.marginx||0,Ce=te.marginy||0;function ve(Re){var ye=Re.x,Ee=Re.y,Ye=Re.width,we=Re.height;Q=Math.min(Q,ye-Ye/2),ne=Math.max(ne,ye+Ye/2),ae=Math.min(ae,Ee-we/2),fe=Math.max(fe,Ee+we/2)}e.forEach(q.nodes(),function(Re){ve(q.node(Re))}),e.forEach(q.edges(),function(Re){var ye=q.edge(Re);e.has(ye,"x")&&ve(ye)}),Q-=ce,ae-=Ce,e.forEach(q.nodes(),function(Re){var ye=q.node(Re);ye.x-=Q,ye.y-=ae}),e.forEach(q.edges(),function(Re){var ye=q.edge(Re);e.forEach(ye.points,function(Ee){Ee.x-=Q,Ee.y-=ae}),e.has(ye,"x")&&(ye.x-=Q),e.has(ye,"y")&&(ye.y-=ae)}),te.width=ne-Q+ce,te.height=fe-ae+Ce}function F(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q),ae=q.node(Q.v),fe=q.node(Q.w),te,ce;ne.points?(te=ne.points[0],ce=ne.points[ne.points.length-1]):(ne.points=[],te=fe,ce=ae),ne.points.unshift(y.intersectRect(ae,te)),ne.points.push(y.intersectRect(fe,ce))})}function $(q){e.forEach(q.edges(),function(Q){var ne=q.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 re(q){e.forEach(q.edges(),function(Q){var ne=q.edge(Q);ne.reversed&&ne.points.reverse()})}function J(q){e.forEach(q.nodes(),function(Q){if(q.children(Q).length){var ne=q.node(Q),ae=q.node(ne.borderTop),fe=q.node(ne.borderBottom),te=q.node(e.last(ne.borderLeft)),ce=q.node(e.last(ne.borderRight));ne.width=Math.abs(ce.x-te.x),ne.height=Math.abs(fe.y-ae.y),ne.x=te.x+ne.width/2,ne.y=ae.y+ne.height/2}}),e.forEach(q.nodes(),function(Q){q.node(Q).dummy==="border"&&q.removeNode(Q)})}function W(q){e.forEach(q.edges(),function(Q){if(Q.v===Q.w){var ne=q.node(Q.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:Q,label:q.edge(Q)}),q.removeEdge(Q)}})}function Z(q){var Q=y.buildLayerMatrix(q);e.forEach(Q,function(ne){var ae=0;e.forEach(ne,function(fe,te){var ce=q.node(fe);ce.order=te+ae,e.forEach(ce.selfEdges,function(Ce){y.addDummyNode(q,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:ce.rank,order:te+ ++ae,e:Ce.e,label:Ce.label},"_se")}),delete ce.selfEdges})})}function I(q){e.forEach(q.nodes(),function(Q){var ne=q.node(Q);if(ne.dummy==="selfedge"){var ae=q.node(ne.e.v),fe=ae.x+ae.width/2,te=ae.y,ce=ne.x-fe,Ce=ae.height/2;q.setEdge(ne.e,ne.label),q.removeNode(Q),ne.label.points=[{x:fe+2*ce/3,y:te-Ce},{x:fe+5*ce/6,y:te-Ce},{x:fe+ce,y:te},{x:fe+5*ce/6,y:te+Ce},{x:fe+2*ce/3,y:te+Ce}],ne.label.x=ne.x,ne.label.y=ne.y}})}function G(q,Q){return e.mapValues(e.pick(q,Q),Number)}function K(q){var Q={};return e.forEach(q,function(ne,ae){Q[ae.toLowerCase()]=ne}),Q}return pv}var mv,VE;function A5(){if(VE)return mv;VE=1;var e=at(),t=fn(),r=tr().Graph;mv={debugOrdering:i};function i(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 mv}var gv,GE;function I5(){return GE||(GE=1,gv="0.8.5"),gv}var vv,YE;function M5(){return YE||(YE=1,vv={graphlib:tr(),layout:R5(),debug:A5(),util:{time:fn().time,notime:fn().notime},version:I5()}),vv}var O5=M5();const KE=Wv(O5),yo=240,Iu=130,co=74,ic=72,XE=co+ic;function P5(e,t){var i;let r=yo;for(const o of e)r=Math.max(r,((i=t.get(o.id))==null?void 0:i.width)??yo);return r}const nT=420,L5=2;function ja(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function $5(e,t){return((t==null?void 0:t.get(e))??0)>0?nT:0}function q5(e,t){const r=(t==null?void 0:t.get(e))??0;return r>0?6+r*36:0}function Ta(e,t,r){const i=t.get(e);return{w:((i==null?void 0:i.width)??yo)+$5(e,r),h:Math.max((i==null?void 0:i.height)??Iu,q5(e,r))}}function D5(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function F5(e,t,r,i,o,a){const u=new KE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(S=>!o.has(S)),f=new Set(c);for(const S of c){const{w:k,h:N}=Ta(S,i,a);u.setNode(S,{width:k,height:N})}for(const S of t)f.has(S.source)&&f.has(S.target)&&u.setEdge(S.source,S.target);KE.layout(u);const p=new Map;let d=1/0,g=1/0,y=-1/0,w=-1/0;for(const S of c){const k=u.node(S);if(!k)continue;const N=i.get(S),j=(N==null?void 0:N.width)??yo,A=(N==null?void 0:N.height)??Iu,M=Ta(S,i,a),P=k.x-M.w/2,O=k.y-M.h/2;p.set(S,{x:P,y:O}),P<d&&(d=P),O<g&&(g=O),P+j>y&&(y=P+j),O+A>w&&(w=O+A)}if(Number.isFinite(d)&&Number.isFinite(g))for(const[S,k]of p)p.set(S,{x:k.x-d,y:k.y-g});const E=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-g:0;let b=null;for(const S of e){const k=o.get(S);if(!k)continue;const N=i.get(S),j=(N==null?void 0:N.width)??yo,A=(N==null?void 0:N.height)??Iu;b=b===null?{minX:k.x,minY:k.y,maxX:k.x+j,maxY:k.y+A}:{minX:Math.min(b.minX,k.x),minY:Math.min(b.minY,k.y),maxX:Math.max(b.maxX,k.x+j),maxY:Math.max(b.maxY,k.y+A)}}return{positions:p,width:E,height:_,pinnedBox:b}}function z5(e,t,r={}){const i=r.direction??"LR",o=r.pinned??new Map,a=r.measured??new Map,u=r.lanes,c=new Map;for(const S of e){const k=ja(S),N=c.get(k);N?N.push(S.id):c.set(k,[S.id])}const p=Array.from(c.keys()).sort().map(S=>({sid:S,...F5(c.get(S),t,i,a,o,u)})),d=P5(e,a),g=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=S=>{const k=[[]];let N=0;for(const j of p)k.length<S&&N>0&&N+j.height>g&&(k.push([]),N=0),k[k.length-1].push(j),N+=j.height+XE;return k},w=S=>S.reduce((k,N)=>Math.max(k,N.width),0)+nT;let E=y(r.availableWidth?L5:1);E.length>1&&E.reduce((k,N)=>k+w(N),0)+d*(E.length-1)>(r.availableWidth??0)&&(E=y(1));const _=new Map;let b=0;for(const S of E){const k=w(S);let N=0;for(const{positions:j,height:A,pinnedBox:M}of S){for(const[O,D]of j)_.set(O,{x:D.x+b,y:D.y+N});let P=N+A;M&&M.maxY>P&&M.minX<b+k&&b<M.maxX&&(P=M.maxY),N=P+XE}b+=k+d}return e.map(S=>{const k=o.get(S.id);if(k)return{...S,position:k};const N=_.get(S.id);return N?{...S,position:N}:S})}function B5(e,t,r,i,o){const u=co+ic,c=60,f=w=>Ta(w,i,o),p=new Map(e.map(w=>[w.id,ja(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,E)=>w.pos.y-E.pos.y||w.pos.x-E.pos.x||w.id.localeCompare(E.id)),y=[];for(const{id:w,pos:E}of g){const{w:_,h:b}=f(w),S=p.get(w)??"_default";if(r.has(w)){d.push({x:E.x,y:E.y,w:_,h:b,sid:S});continue}let k=E.y;for(let N=0;N<d.length+1;N++){const j=d.find(A=>{const M=A.sid===S?24:c,P=A.sid===S?24:u;return E.x<A.x+A.w+M&&A.x<E.x+_+M&&k<A.y+A.h+P&&A.y<k+b+P});if(!j)break;k=j.y+j.h+(j.sid===S?24:u)}k!==E.y&&(t.set(w,{x:E.x,y:k}),y.push(w)),d.push({x:E.x,y:k,w:_,h:b,sid:S})}return y}function U5(e,t,r,i,o,a){const u=_=>Ta(_,i,a),c=_=>r.get(_)??t.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=ja(_),S=f.get(b);S?S.push(_):f.set(b,[_])}const p=new Set;for(const[_,b]of f)b.every(S=>o.has(S.id)&&!r.has(S.id))&&p.add(_);const d=new Map,g=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:k}=u(_.id),N=ja(_);p.has(N)?(d.get(N)??d.set(N,[]).get(N)).push(_):g.push({x:b.x,y:b.y,w:S,h:k})}if(d.size===0)return[];const y=co+ic,w=(_,b,S,k)=>g.some(N=>_<N.x+N.w+co&&N.x<_+S+co&&b<N.y+N.h+y&&N.y<b+k+y),E=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let S=1/0,k=1/0,N=-1/0,j=-1/0;for(const U of b){const V=c(U.id),{w:z,h:C}=u(U.id);S=Math.min(S,V.x),k=Math.min(k,V.y),N=Math.max(N,V.x+z),j=Math.max(j,V.y+C)}const A=N-S,M=j-k,P=[...new Set(g.map(U=>Math.round(U.x)))].sort((U,V)=>U-V),O=P.length?P:[S],D=[0,...g.map(U=>U.y+U.h+y)].sort((U,V)=>U-V);let L=null;e:for(const U of O)for(const V of D){if(V>=k)break;if(!w(U,V,A,M)){L={x:U,y:V};break e}}if(L){const U=L.x-S,V=L.y-k;for(const z of b){const C=c(z.id);t.set(z.id,{x:C.x+U,y:C.y+V})}E.push(_)}for(const U of b){const V=c(U.id),{w:z,h:C}=u(U.id);g.push({x:V.x,y:V.y,w:z,h:C})}}return E}function H5(e,t,r,i,o,a=!1,u){const p=co+ic+1,d=8,g=1.75,y=200,w=.7,E=.01,_=L=>Ta(L,i,u),b=L=>r.get(L)??t.get(L),S=new Map;for(const L of e){if(!b(L.id))continue;const U=ja(L),V=S.get(U);V?V.push(L):S.set(U,[L])}const k=[],N=new Set,j=new Set,A=o.size===0;for(const L of[...S.keys()].sort()){const U=S.get(L);let V=1/0,z=1/0,C=-1/0,F=-1/0,$=!1;for(const Z of U){const I=b(Z.id),{w:G,h:K}=_(Z.id);V=Math.min(V,I.x),z=Math.min(z,I.y),C=Math.max(C,I.x+G),F=Math.max(F,I.y+K),r.has(Z.id)&&($=!0)}const re=C-V,J=F-z;j.add(L);const W=o.get(L);W&&(re>W.w+d||J>W.h+d)&&N.add(L),o.set(L,{w:re,h:J}),k.push({sid:L,members:U.map(Z=>Z.id),x:V,y:z,w:re,h:J,anchored:$,mass:1})}for(const L of[...o.keys()])j.has(L)||o.delete(L);if(a||A)return[];let M=!1;for(let L=0;L<k.length&&!M;L++)for(let U=L+1;U<k.length;U++){const V=k[L],z=k[U];if(!(V.anchored&&z.anchored)&&Math.abs(V.x+V.w/2-(z.x+z.w/2))<(V.w+z.w)/2+61&&Math.abs(V.y+V.h/2-(z.y+z.h/2))<(V.h+z.h)/2+p){M=!0;break}}if(N.size===0&&!M)return[];if(N.size>0)for(const L of k)N.has(L.sid)&&(L.mass=8);else for(const L of k)L.mass=Math.max(1,L.w*L.h/(yo*Iu));const P=new Map(k.map(L=>[L.sid,L.x])),O=new Map(k.map(L=>[L.sid,L.y]));for(let L=0;L<y;L++){const U=new Map,V=new Map;let z=0;for(let C=0;C<k.length;C++)for(let F=C+1;F<k.length;F++){const $=k[C],re=k[F];if($.anchored&&re.anchored)continue;const J=$.x+$.w/2,W=$.y+$.h/2,Z=re.x+re.w/2,I=re.y+re.h/2,G=($.w+re.w)/2+61-Math.abs(J-Z),K=($.h+re.h)/2+p-Math.abs(W-I);if(G<=0||K<=0)continue;const q=(De,Je)=>!De.anchored&&!(Je<0&&De.x<=0),Q=(De,Je)=>!De.anchored&&!(Je<0&&De.y<=0),ne=(De,Je,Xe)=>{const Ot=De===Je,lt=Ot?$.sid<re.sid?-1:1:Math.sign(De-Je);return Xe($,lt)||Xe(re,-lt)?lt:Ot&&(Xe($,-lt)||Xe(re,lt))?-lt:0},ae=ne(J,Z,q),fe=ne(W,I,Q),te=ae!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||G*g<K),[ve,Re,ye,Ee]=Ce?[ae,G,U,q]:[fe,K,V,Q],Ye=Ee($,ve),we=Ee(re,-ve),_e=$.mass,Be=re.mass,it=Ye?we?Be/(_e+Be):1:0,ft=we?Ye?_e/(_e+Be):1:0,Ze=Re*w;ye.set($.sid,(ye.get($.sid)??0)+ve*Ze*it),ye.set(re.sid,(ye.get(re.sid)??0)-ve*Ze*ft),z+=Ze}for(const C of k)C.anchored||(C.x=Math.max(0,C.x+(U.get(C.sid)??0)),C.y=Math.max(0,C.y+(V.get(C.sid)??0)));if(z<E)break}const D=[];for(const L of k){const U=L.x-P.get(L.sid),V=L.y-O.get(L.sid);if(!(Math.abs(U)<1&&Math.abs(V)<1)){for(const z of L.members){if(r.has(z))continue;const C=t.get(z);C&&t.set(z,{x:C.x+U,y:C.y+V})}D.push(L.sid)}}return D}const W5=600;function zv(e,t){return!(e.exitAt!=null&&t-e.exitAt>W5||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function V5(e,t){const r=new Set;for(const i of e.agents.values())zv(i,t)&&r.add(i.id);return r}function G5(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 Y5(e,t,r=0){if(!e)return!1;for(const i of t)if(G5(e,i,r))return!0;return!1}const rT="sessionGroup";function K5(e,t){var i;if(e.type===rT)return"transparent";const r=(i=e.data)==null?void 0:i.state;return t(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const X5="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function Q5(e){if(e.checkDisabled)return X5;if(e.checking)return"Asking npm for the newest release…";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 · click to check npm now`}function Z5(e){const t=`Version v${e.running}`;return e.checkDisabled?`${t}, update checks are off`:e.checking?`${t}, checking npm for a newer release`:`${t}, check npm for a newer release`}function J5(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`;return`Version v${e.from}, ${t} — ${e.open?"hide":"show"} the notice`}function eF(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 Bv={kind:"assumed",claude:!0,codex:!0};function tF(e){if(!e||typeof e!="object")return Bv;const t=e.providers;if(!t||typeof t!="object")return Bv;const r=t;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function sT(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}function nF(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${sT(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",title:"Receiving events"}:{tone:"dead",label:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function rF(e){return e.paused?e.held<=0?{label:"Resume",title:"Nothing has arrived since you paused. Resume to follow the canvas again (Space)"}:{label:`Resume · ${e.held} held`,title:`${sT(e.held)} arrived while paused and will be applied in order when you resume (Space)`}:{label:"Pause",title:"Pause live updates — events keep arriving and are applied when you resume (Space)"}}function iT(e,t){return e!==""&&t>0}function sF(e,t,r){return e===""?{active:!1,matched:t,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:t,total:r,count:`${t} of ${r}`,empty:t===0,message:t===0?`No agents match “${e}”`:null,dim:iT(e,t)}}const iF="Search agents, tools, model…";function oT(e,t){var i,o,a,u;if(!t)return!0;const r=t.toLowerCase();if(e.label.toLowerCase().includes(r)||(i=e.cwd)!=null&&i.toLowerCase().includes(r)||(o=e.cwdBasename)!=null&&o.toLowerCase().includes(r)||e.sessionId.toLowerCase().includes(r)||(a=e.firstPrompt)!=null&&a.toLowerCase().includes(r)||e.model&&(e.model.toLowerCase().includes(r)||Rs(e.model).toLowerCase().includes(r))||(u=e.provider)!=null&&u.toLowerCase().startsWith(r))return!0;for(const c of e.tools)if(c.name.toLowerCase().includes(r))return!0;return!1}function fa(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const oF={agent:_L,sessionGroup:ML},aT="react-flow__node";function QE(e){var t,r;return!!e&&((r=(t=e.classList)==null?void 0:t.contains)==null?void 0:r.call(t,aT))===!0}function aF(e){try{const t=document.querySelector(`.${aT}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const lF=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),uF=420,du=18,cF=200,dF=5*6e4,fF=6,hF=2*6e4,Py="agent-dag.layout",Ly="agent-dag.viewport",lT="agent-dag.summariesDismissed",uT="agent-dag.sessionListOpen",cT="agent-dag.detailOpen",dT="agent-dag.usagePanelOpen",ZE="agent-dag.accountsPanelOpen",JE="agent-dag.versionNoticeDismissed",eN="agent-dag.oldNameNoticeDismissed",pF=15*6e4,yv={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:"},tN="agent-dag.autoRestart",nN="agent-dag.bundleReloadedFor";function mF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(uT)==="1"}catch{return!1}}function gF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(uT,e?"1":"0")}catch{}}function vF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(cT)==="1"}catch{return!1}}function yF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(cT,e?"1":"0")}catch{}}function wF(){const e=py(dT);return e===null?!0:e==="1"}function xF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(dT,e?"1":"0")}catch{}}function _F(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(lT);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 rN(e){if(!(typeof window>"u"))try{const t=Array.from(e),r=t.length>200?t.slice(-200):t;window.localStorage.setItem(lT,JSON.stringify(r))}catch{}}function bF(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Py);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 wv(e,t){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of t)r[i]=o;window.localStorage.setItem(Py,JSON.stringify({v:2,positions:r,pins:Array.from(t.keys())}))}catch{}}function SF(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Ly);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 kF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Ly,JSON.stringify(e))}catch{}}function sN(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Py)}catch{}try{window.localStorage.removeItem(Ly)}catch{}}}function EF(e,t){const r=e.agents.get(t);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===t&&i.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:i.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=`${Gt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Uv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Hv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},fT=BC;function NF(e,t){if(!t)return null;const r=new Set([t]);let i=t;for(;i;){const a=e.agents.get(i);if(!(a!=null&&a.parentId)||r.has(a.parentId))break;r.add(a.parentId),i=a.parentId}let o=!0;for(;o;){o=!1;for(const a of e.agents.values())a.parentId&&r.has(a.parentId)&&!r.has(a.id)&&(r.add(a.id),o=!0)}return r}function CF(e,t,r,i,o,a,u,c,f,p,d,g,y,w,E,_,b,S,k){const N=[],j=[],A=new Set;if(a)for(const z of e.agents.values())S.has(z.id)&&oT(z,a)&&A.add(z.id);const M=iT(a,A.size);for(const z of e.agents.values()){if(!S.has(z.id))continue;const C=M&&!A.has(z.id),F=z.exitAt!=null,$=b!=null&&!b.has(z.id),re=[C?"rf-dim":"",F?"rf-exiting":"",$?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,J=u.get(z.id);if(N.push({id:z.id,type:"agent",position:{x:0,y:0},data:{...z,now:t,onOpenContext:k},className:re,...J?{width:J.width,height:J.height}:null}),z.parentId&&S.has(z.parentId)){const W=uy(z.sessionId),Z=a&&!A.has(z.id)&&!A.has(z.parentId),I=F,G=_.size>0&&(_.has(z.id)||_.has(z.parentId)),K=b!=null&&!b.has(z.id)&&!b.has(z.parentId),q=z.state==="active"?2:1.5,Q=G?q+1.5:q,ne=Z||I?.2:K?.12:1,ae=["sess-edge",z.state==="active"?"sess-live":"sess-idle",I?"rf-edge-exiting":"",G?"rf-edge-selected":""].filter(Boolean).join(" ");j.push({id:`e:${z.parentId}->${z.id}`,source:z.parentId,target:z.id,animated:(z.state==="active"||G)&&!Z&&!I,type:"smoothstep",style:{"--session-hue":W,strokeWidth:Q,opacity:ne,transition:"var(--edge-transition)"},className:ae})}}const P=new Map;for(const z of e.agents.values())z.tools.length>0&&P.set(z.id,Math.min(4,z.tools.length));const O=`${w}#lanes:${D5(P)}`,D=N.filter(z=>H3(z.id,o,g,y));if(D.length>0||O!==E.current){if(D.length>0){const z=z5(N,j,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:P});for(const C of z)JC(C.id,g,y)&&V3(C.id,C.position,g,y);U5(N,g,o,u,new Set(D.map(C=>C.id)),P)}B5(N,g,o,u,P),E.current=O}const L=H5(N,g,o,u,c,!p||d,P);L.length>0&&f(L),au(g,e.agents),au(y,e.agents),au(o,e.agents),au(u,U3(e.agents.values()));const U=[];let V=!1;for(const z of N){let C=o.get(z.id)??g.get(z.id);C||(C=W3(z.id,g,y),V=!0),U.push({...z,position:C})}return V&&(E.current=""),{nodes:U,edges:j}}function jF(){return m.jsx(ly,{children:m.jsx(TF,{})})}function TF(){var Xa,Qa,Za,Ja;const e=Oa(),t=R.useRef(Lv()),[,r]=R.useState(0),i=R.useCallback(()=>r(H=>H+1),[]),[o,a]=R.useState(()=>new Set),[u,c]=R.useState(null),[f,p]=R.useState(null),d=R.useCallback((H,Y)=>{a(oe=>{if(!Y)return new Set([H]);const de=new Set(oe);return de.has(H)?de.delete(H):de.add(H),de}),c(oe=>Y&&oe===H?oe:H)},[]),g=R.useCallback(()=>{a(new Set),c(null)},[]),[y,w]=R.useState(null),[E,_]=R.useState(null),b=R.useCallback(H=>_(H),[]),[S,k]=R.useState(!1),N=R.useRef(_F()),[j,A]=R.useState(mF);R.useEffect(()=>{gF(j)},[j]);const[M,P]=R.useState(vF);R.useEffect(()=>{yF(M)},[M]);const[O,D]=R.useState(wF);R.useEffect(()=>{xF(O)},[O]);const[L,U]=R.useState(()=>{try{const H=window.localStorage.getItem(ZE);return H===null?!0:H==="1"}catch{return!0}});R.useEffect(()=>{try{window.localStorage.setItem(ZE,L?"1":"0")}catch{}},[L]);const[V,z]=R.useState(null),[C,F]=R.useState(!1),[$,re]=R.useState(0),[J,W]=R.useState(0);R.useEffect(()=>{fetch("/api/sound-hook").then(H=>H.ok?H.json():null).then(H=>{H!=null&&H.ok&&(z(H.enabled===!0),re((H.foreign??[]).filter(Y=>Y.worksHere).length),W(typeof H.parked=="number"?H.parked:0))}).catch(()=>{})},[]);const Z=R.useCallback(async()=>{F(!0);try{const Y=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!V})})).json().catch(()=>null);Y!=null&&Y.ok&&z(Y.enabled===!0),fetch("/api/sound-hook").then(oe=>oe.ok?oe.json():null).then(oe=>{oe!=null&&oe.ok&&(re((oe.foreign??[]).filter(de=>de.worksHere).length),W(typeof oe.parked=="number"?oe.parked:0))}).catch(()=>{})}catch{}finally{F(!1)}},[V]),[I,G]=R.useState(!1),[K,q]=R.useState(null),[Q,ne]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(JE)??""}catch{return""}}),[ae,fe]=R.useState(!1),te=R.useRef(0),[ce,Ce]=R.useState(!1),ve=R.useCallback((H=!1)=>{H&&(te.current=Date.now(),Ce(!0)),fetch(H?"/api/version?refresh=1":"/api/version").then(Y=>Y.ok?Y.json():null).then(Y=>{Y&&q(Y)}).catch(()=>{}).finally(()=>{H&&Ce(!1)})},[]),Re=R.useCallback(()=>{ve(Date.now()-te.current>=pF)},[ve]);R.useEffect(()=>{ve();const H=window.setInterval(Re,5*6e4),Y=()=>{document.visibilityState==="visible"&&Re()};return document.addEventListener("visibilitychange",Y),()=>{window.clearInterval(H),document.removeEventListener("visibilitychange",Y)}},[ve,Re]),R.useEffect(()=>{I&&ve()},[I,ve]);const ye=(K==null?void 0:K.notice)??null,[Ee,Ye]=R.useState(null),[we,_e]=R.useState(Bv);R.useEffect(()=>{let H=!1;return fetch("/api/health").then(Y=>Y.ok?Y.json():null).then(Y=>{H||(_e(tF(Y)),!(!Y||typeof Y.workspace!="string")&&Ye(Y.workspace))}).catch(()=>{}),()=>{H=!0}},[I]);const Be=R.useRef(we);Be.current=we;const it=ye?`${ye.kind}:${ye.to}`:"",ft=ye!=null&&Q!==it,Ze=R.useCallback(()=>{if(!ye)return;const H=Q===it?"":it;ne(H);try{window.localStorage.setItem(JE,H)}catch{}},[ye,it,Q]),[De,Je]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(eN)??""}catch{return""}}),Xe=K!=null&&K.invokedAs&&K.invokedAs!==Gt?K.invokedAs:null,Ot=Xe!=null&&De!==Xe,lt=R.useCallback(()=>{if(Xe){Je(Xe);try{window.localStorage.setItem(eN,Xe)}catch{}}},[Xe]),Qe=((Xa=K==null?void 0:K.upgrade)==null?void 0:Xa.state)??"idle",Pt=I3(K==null?void 0:K.upgrade),zt=R.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);R.useEffect(()=>{if(Qe!=="running")return;const H=window.setInterval(ve,3e3);return()=>window.clearInterval(H)},[Qe,ve]);const et=R.useCallback(async()=>{var oe;const H=K==null?void 0:K.command;if(!H)return;let Y=!1;try{Y=await Promise.race([((oe=navigator.clipboard)==null?void 0:oe.writeText(H).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{Y=!1}if(!Y)try{const de=document.createElement("textarea");de.value=H,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),Y=document.execCommand("copy"),de.remove()}catch{Y=!1}Y&&(fe(!0),window.setTimeout(()=>fe(!1),1600))},[K==null?void 0:K.command]),bt=R.useCallback(()=>{A(H=>(H||U(!1),!H))},[]),ht=R.useCallback(()=>{U(H=>(H||A(!1),!H))},[]),[vt,hn]=R.useState(!1),[Yt,Lt]=R.useState(0),bn=R.useRef(null),[gr,Sn]=R.useState(!1),Bt=R.useRef(null),[Fn,pn]=R.useState(0),vr=R.useRef(X3()),[Hr,xi]=R.useState(!1),Wr=R.useCallback(()=>{const H=vr.current,Y=H.setPaused(!H.paused);for(const oe of Y)t.current=Qx(t.current,oe);xi(H.paused)},[]),[ut,_i]=R.useState(Date.now()),[mn,Is]=R.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(tN)!=="0"}catch{return!0}}),yr=R.useCallback(()=>{Is(H=>{const Y=!H;try{window.localStorage.setItem(tN,Y?"1":"0")}catch{}return Y})},[]),[zn,kn]=R.useState(!1),[Vr,Gr]=R.useState("restart"),[Yr,bi]=R.useState(null),sr=R.useRef(!1),Ms=R.useRef(null),En=R.useRef(0),wr=R.useCallback(async H=>{if(sr.current)return;const Y=(H==null?void 0:H.upgrade)===!0;sr.current=!0,Ms.current=Pt;const oe=++En.current;Gr(Y?"npx":"restart"),kn(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ye==null?void 0:ye.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:Y})})}catch{}window.setTimeout(()=>{if(En.current===oe&&sr.current){sr.current=!1,kn(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},Y?18e4:3e4)},[ye==null?void 0:ye.to,Pt]),Os=R.useRef(null);R.useEffect(()=>{let H=!1;for(const oe of t.current.agents.values())if(oe.state==="active"){H=!0;break}const Y=O3({enabled:mn,kind:ye==null?void 0:ye.kind,canRestart:(K==null?void 0:K.canRestart)===!0,busy:H,idleSince:Os.current,now:ut});Os.current=Y.idleSince,Y.restart&&wr()},[mn,ye==null?void 0:ye.kind,K==null?void 0:K.canRestart,ut,wr]),R.useEffect(()=>{const H=K==null?void 0:K.running;let Y=null,oe=null;try{Y=window.sessionStorage.getItem("agent-dag.restartPending"),oe=window.sessionStorage.getItem(nN)}catch{return}const de=A3({bundle:"1.36.4",running:H,pending:Y,lastTried:oe});if(de==="reload"){try{window.sessionStorage.setItem(nN,H??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1),bi(H??null);const xe=window.setTimeout(()=>bi(null),6e3);return()=>window.clearTimeout(xe)},[K==null?void 0:K.running]),R.useEffect(()=>{if(zn&&M3({asked:Ms.current,reported:Pt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1)}},[zn,Pt]);const Ps=R.useRef(bF()).current;R.useRef(!1);const Tt=R.useRef(new Map(Ps.positions.filter(([H])=>Ps.pins.includes(H)))),xr=R.useRef(null),_r=R.useState(()=>SF())[0],[Kt,Kr]=R.useState(""),[Si,nt]=R.useState(()=>new Set),[br,Xr]=R.useState(Z3),[Ls,Qr]=R.useState(!1),Zr=R.useRef(null);R.useEffect(()=>{document.documentElement.dataset.theme=br;try{window.localStorage.setItem(ej,br)}catch{}},[br]),R.useEffect(()=>{if(!_r)return;const H=window.setTimeout(()=>{try{e.setViewport(_r,{duration:0})}catch{}},60);return()=>window.clearTimeout(H)},[e,_r]);const $s=R.useRef(!0);R.useEffect(()=>{const H=new EventSource("/events"),Y=K3(i,{now:()=>Date.now(),setTimeout:(oe,de)=>window.setTimeout(oe,de),clearTimeout:oe=>window.clearTimeout(oe)});return H.addEventListener("open",()=>{G(!0),Qr(!0)}),H.addEventListener("error",()=>G(!1)),H.addEventListener("replay-end",()=>{$s.current=!1,Y.flush()}),H.addEventListener("hook",oe=>{try{const de=JSON.parse(oe.data);if(!vr.current.accept(de))return;t.current=Qx(t.current,de),de.replay===!0||$s.current||Date.now()-de.receivedAt>3e4?Y.replay():Y.live()}catch{}}),()=>{H.close(),Y.cancel()}},[i]),R.useEffect(()=>{const H=setInterval(()=>{const Y=Date.now();_i(Y);let oe=DP(t.current,Y,Xx);FP(t.current,Y,Xx)&&(oe=!0),$P(t.current,Y,cF,dF)&&(oe=!0),qP(t.current,Y,fF,hF)&&(oe=!0),oe&&i()},250);return()=>clearInterval(H)},[i]);const ir=R.useRef(null),St=R.useRef(0),qs=420,pt=R.useCallback((H=500)=>{try{const Se=document.querySelector(".canvas-wrap"),Pe=Array.from(document.querySelectorAll(".react-flow__node")).filter(wt=>wt.offsetWidth>0);if(!Se||Pe.length===0)return;const Fe=Se.getBoundingClientRect(),Ge=e.getViewport();if(!Number.isFinite(Ge.zoom)||Ge.zoom<=0)return;const We=wt=>(wt-Fe.left-Ge.x)/Ge.zoom,ze=wt=>(wt-Fe.top-Ge.y)/Ge.zoom,jn=Pe.map(wt=>wt.getBoundingClientRect()),Ys=Math.min(...jn.map(wt=>We(wt.left))),Io=Math.max(...jn.map(wt=>We(wt.right))),Ks=Math.min(...jn.map(wt=>ze(wt.top))),Mo=Math.max(...jn.map(wt=>ze(wt.bottom))),el=Io-Ys,us=Mo-Ks;if(!(el>0&&us>0))return;const Zt=Math.max(.2,Math.min(1,(Fe.width-160)/(el+qs)*.86,(Fe.height-160)/us*.86));e.setViewport({x:80-Ys*Zt,y:Math.max(80,(Fe.height-us*Zt)/2)-Ks*Zt,zoom:Zt},{duration:H}),St.current=Date.now(),window.setTimeout(()=>{try{const wt={x:80-Ys*Zt,y:Math.max(80,(Fe.height-us*Zt)/2)-Ks*Zt,zoom:Zt},Oo=e.getViewport();(Math.abs(Oo.zoom-Zt)>.01||Math.abs(Oo.x-wt.x)>2)&&e.setViewport(wt,{duration:0})}catch{}},H+60)}catch{}},[e]),Eo=R.useRef(""),No=R.useRef(null),Ba=R.useRef(0),Sr=R.useCallback(()=>{Ba.current=Date.now()},[]),Jr="agent-dag.autoFitDisabled",gn=R.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Jr)==="1"}catch{return!1}})()),[Ds,Ua]=R.useState(gn.current),Ha=R.useCallback(()=>{if(!gn.current){gn.current=!0,Ua(!0);try{window.localStorage.setItem(Jr,"1")}catch{}}},[]),Co=R.useCallback(()=>{gn.current=!1,Ua(!1);try{window.localStorage.removeItem(Jr)}catch{}pt(400)},[e,pt]);R.useEffect(()=>{const H=setInterval(()=>{if(gn.current||Date.now()-Ba.current<800)return;const Y=t.current,oe=Date.now(),de=[];for(const We of Y.agents.values())zv(We,oe)&&de.push({id:We.id});if(de.length===0)return;const xe=e.getViewport(),Se=window.innerWidth-360,Pe=window.innerHeight-52;let Fe=!1,Ge=!1;for(const{id:We}of de){const ze=or.current.get(We),jn=Tt.current.get(We)??Xt.current.get(We);if(!ze||!jn)continue;Ge=!0;const Ys=jn.x*xe.zoom+xe.x,Io=jn.y*xe.zoom+xe.y,Ks=(jn.x+ze.width)*xe.zoom+xe.x,Mo=(jn.y+ze.height)*xe.zoom+xe.y;if(Ks>0&&Ys<Se&&Mo>0&&Io<Pe){Fe=!0;break}}Ge&&!Fe&&pt(600)},1500);return()=>clearInterval(H)},[e]);const ki=R.useRef(!1),or=R.useRef(new Map),es=R.useRef(0),oc=R.useCallback(H=>{const Y=or.current;let oe=!1;for(const de of H.nodeInternals.values()){const xe=de.width,Se=de.height;if(xe==null||Se==null)continue;const Pe=Y.get(de.id);Pe?(Math.abs(Pe.height-Se)>4||Math.abs(Pe.width-xe)>4)&&(Y.set(de.id,{width:xe,height:Se}),oe=!0):(Y.set(de.id,{width:xe,height:Se}),oe=!0)}return oe&&(es.current+=1),es.current},[]),Ei=Ke(oc),[He,Wa]=R.useState(0);R.useEffect(()=>{let H=0;const Y=()=>{const de=or.current;let xe=!1;for(const Se of document.querySelectorAll(".react-flow__node[data-id]")){const Pe=Se.getAttribute("data-id");if(!Pe)continue;const Fe=Se.offsetWidth,Ge=Se.offsetHeight;if(!Fe||!Ge)continue;const We=de.get(Pe);(!We||Math.abs(We.width-Fe)>4||Math.abs(We.height-Ge)>4)&&(de.set(Pe,{width:Fe,height:Ge}),xe=!0)}xe&&Wa(Se=>Se+1)};if(ki.current)return;let oe=0;return document.visibilityState==="hidden"?oe=window.setTimeout(Y,32):H=requestAnimationFrame(Y),()=>{cancelAnimationFrame(H),window.clearTimeout(oe)}});const Xt=R.useRef(new Map(Ps.positions)),jo=R.useRef(new Set),Ni=R.useRef(""),kr=R.useMemo(()=>{const H=[];for(const Y of t.current.agents.values())zv(Y,ut)&&H.push(Y.id+(Y.parentId?`>${Y.parentId}`:""));return H.sort(),`${H.join("|")}#sv${Ei}.${He}`},[t.current,t.current.lastSeq,ut,Ei,He]),ts=R.useRef(null);R.useEffect(()=>(ts.current!=null&&window.clearTimeout(ts.current),ts.current=window.setTimeout(()=>{wv(Xt.current,Tt.current)},1500),()=>{ts.current!=null&&window.clearTimeout(ts.current)}),[kr]),R.useEffect(()=>{if(Eo.current===kr)return;const H=Eo.current;if(Eo.current=kr,!H||gn.current)return;Date.now()-St.current>1200&&pt(400),ir.current&&window.clearTimeout(ir.current),ir.current=window.setTimeout(()=>{gn.current||pt(500)},280)},[kr,e,pt]);const Fs=R.useMemo(()=>{if(o.size===0)return null;const H=new Set;for(const Y of o){const oe=NF(t.current,Y);if(oe)for(const de of oe)H.add(de)}return H.size>0?H:null},[t.current,t.current.lastSeq,o]),Nn=R.useMemo(()=>V5(t.current,ut),[t.current,t.current.lastSeq,ut]),Bn=R.useRef(null),[vn,Un]=R.useState({w:0,h:0});R.useEffect(()=>{const H=Bn.current;if(!H||typeof ResizeObserver>"u")return;const Y=new ResizeObserver(oe=>{var xe;const de=(xe=oe[0])==null?void 0:xe.contentRect;de&&Un(Se=>Math.abs(Se.w-de.width)>40||Math.abs(Se.h-de.height)>40?{w:de.width,h:de.height}:Se)});return Y.observe(H),Un({w:H.clientWidth,h:H.clientHeight}),()=>Y.disconnect()},[]);const zs=R.useCallback(H=>{var oe,de;const Y=H.target;!(Y!=null&&Y.closest)||Y.closest(lF)!==H.currentTarget||(H.preventDefault(),(de=(oe=document.activeElement)==null?void 0:oe.blur)==null||de.call(oe))},[]),Bs=R.useRef(new Map),[Hn,ac]=R.useState(!1);R.useEffect(()=>{const H=window.setTimeout(()=>ac(!0),2500);return()=>window.clearTimeout(H)},[]);const[Va,Er]=R.useState(!1),ar=R.useRef(null),[Ci,Us]=R.useState(!1),Ga=R.useCallback(()=>{ar.current&&(window.clearTimeout(ar.current),ar.current=null),Er(!1)},[]),lc=R.useCallback(H=>{H.length!==0&&queueMicrotask(()=>{Er(!0),ar.current&&window.clearTimeout(ar.current),ar.current=window.setTimeout(()=>Er(!1),uF+80)})},[]);R.useEffect(()=>()=>{ar.current&&window.clearTimeout(ar.current)},[]);const ns=vn.w>0?vn.w*.92:0,rs=vn.h>0?vn.h:0,{nodes:Qt,edges:ji}=R.useMemo(()=>CF(t.current,ut,ns,rs,Tt.current,Kt,or.current,Bs.current,lc,Hn,Ci,Xt.current,jo.current,kr,Ni,o,Fs,Nn,b),[t.current,t.current.lastSeq,ut,ns,rs,Hn,Ci,Kt,kr,o,Fs,Nn,b,Yt]),Ya=R.useMemo(()=>{const H=new Map;for(const oe of Qt){const de=oe.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const xe=oe.width,Se=oe.height;if(xe==null||Se==null)continue;const Pe=oe.position.x,Fe=oe.position.y,Ge=Pe+xe,We=Fe+Se,ze=H.get(de.sessionId);ze?(ze.minX=Math.min(ze.minX,Pe),ze.minY=Math.min(ze.minY,Fe),ze.maxX=Math.max(ze.maxX,Ge),ze.maxY=Math.max(ze.maxY,We)):H.set(de.sessionId,{minX:Pe,minY:Fe,maxX:Ge,maxY:We})}const Y=[];for(const[oe,de]of H){const xe=de.maxX-de.minX+du*2,Se=de.maxY-de.minY+du*2;Y.push({id:`group:${oe}`,type:rT,position:{x:de.minX-du,y:de.minY-du},data:{sessionId:oe,w:xe,h:Se},width:xe,height:Se,style:{width:xe,height:Se},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return Y},[Qt,ut]),uc=R.useMemo(()=>{const H=[...Ya,...Qt],Y=Bt.current;return!Y||Y.size===0?H:H.map(oe=>{const de=Y.get(oe.id);return de?{...oe,position:de}:oe})},[Ya,Qt,Fn]),Nr=R.useMemo(()=>{if(!Kt)return null;const H=new Set;for(const Y of t.current.agents.values())Nn.has(Y.id)&&oT(Y,Kt)&&H.add(Y.id);return H},[t.current,t.current.lastSeq,Kt,Nn]),Cn=R.useMemo(()=>sF(Kt,(Nr==null?void 0:Nr.size)??0,Nn.size),[Kt,Nr,Nn]),ss=R.useMemo(()=>{const H=new Set;for(const Y of t.current.agents.values())for(const oe of Y.tools)H.add(fT(oe.name));return Object.keys(Uv).filter(Y=>H.has(Y))},[t.current,t.current.lastSeq]);R.useEffect(()=>{if(ss.length<=1){Sn(!1);return}let H=0;const Y=()=>{const oe=bn.current;if(oe&&!document.hidden){const de=oe.getBoundingClientRect(),xe=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Pe=>Pe.getBoundingClientRect()),Se=Y5(de,xe,8);Sn(Pe=>Pe===Se?Pe:Se)}H=window.setTimeout(Y,300)};return Y(),()=>window.clearTimeout(H)},[ss.length]);const is=R.useMemo(()=>{const H=new Map;for(const oe of t.current.agents.values())for(const de of oe.tools){if(!de.name.startsWith("mcp__"))continue;const xe=de.name.slice(5),Se=xe.indexOf("__"),Pe=Se>0?xe.slice(0,Se):xe;H.set(Pe,(H.get(Pe)??0)+1)}const Y=[];for(const[oe,de]of H){let xe=5381;for(let Se=0;Se<oe.length;Se++)xe=(xe<<5)+xe^oe.charCodeAt(Se);Y.push({server:oe,count:de,hue:Math.abs(xe)%360})}return Y.sort((oe,de)=>de.count-oe.count),Y},[t.current,t.current.lastSeq]),lr=R.useCallback(H=>{nt(Y=>{const oe=new Set(Y);return oe.has(H)?oe.delete(H):oe.add(H),oe})},[]),Rt=u?t.current.agents.get(u):null,os=f?Array.from(t.current.agents.values()).flatMap(H=>H.tools).find(H=>H.id===f)??null:null,To=R.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}t.current=Lv(),Tt.current.clear(),or.current.clear(),Xt.current.clear(),Ni.current="",sN(),g(),i()},[i,g]),Hs=R.useRef(S);Hs.current=S;const Ws=R.useRef(!1);Ws.current=os!=null||vt||E!=null||y!=null;const Vs=R.useCallback(H=>{const Y=L3(H,{confirmOpen:Hs.current,modalOpen:Ws.current});Y==="confirm"?k(!0):Y==="clear"&&(k(!1),To())},[To]),$t=R.useCallback(()=>{Tt.current.clear(),Xt.current.clear(),Ni.current="",sN(),i(),window.setTimeout(()=>pt(500),80)},[i,e,pt]),Cr=R.useCallback(()=>pt(500),[pt]),as=R.useRef(Qt);as.current=Qt;const ls=R.useRef(u);ls.current=u;const Ro=R.useCallback(H=>{const Y=as.current,oe=q3(Y.map(Se=>({id:Se.id,x:Se.position.x,y:Se.position.y})),ls.current,H),de=oe?Y.find(Se=>Se.id===oe):void 0;if(!de)return;const xe=QE(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}St.current=Date.now(),xe&&aF(de.id)},30)},[d,e]),Ti=R.useCallback(H=>{d(H,!1),window.setTimeout(()=>{try{const Y=as.current.find(oe=>oe.id===H);Y&&e.fitView({padding:.3,duration:500,nodes:[Y]}),St.current=Date.now()}catch{}},60)},[d,e]);R.useEffect(()=>{const H=Y=>{var Fe,Ge,We;const oe=Y.target,de={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(Fe=oe==null?void 0:oe.getAttribute)==null?void 0:Fe.call(oe,"role"),type:oe==null?void 0:oe.type};if(Y.key==="Escape"){const ze=iL({overlayOpen:Ru.depth()>0,typing:cy(de)});ze==="dismiss"?Ru.dismissTop():ze==="blur"?oe==null||oe.blur():(B3(de)&&(oe==null||oe.blur()),g());return}if(DC(Y))return;const xe=QE(oe)?(Ge=oe==null?void 0:oe.getAttribute)==null?void 0:Ge.call(oe,"data-id"):null,Se=xe&&as.current.some(ze=>ze.id===xe)?xe:null,Pe=F3(Y,Se);if(Pe.kind==="activate"){Y.preventDefault(),d(Pe.nodeId,Pe.additive);return}if(Pe.kind!=="node"&&!(Pe.nodeId==null&&hL(de))){if(Y.key==="/"){Y.preventDefault(),(We=Zr.current)==null||We.focus();return}Y.key===" "&&(Y.preventDefault(),Wr()),(Y.key==="c"||Y.key==="C")&&Vs("shortcut"),(Y.key==="r"||Y.key==="R")&&$t(),(Y.key==="f"||Y.key==="F")&&Cr(),(Y.key==="l"||Y.key==="L")&&bt(),(Y.key==="h"||Y.key==="H")&&hn(ze=>!ze),(Y.key==="u"||Y.key==="U")&&D(ze=>!ze),(Y.key==="a"||Y.key==="A")&&Be.current.claude&&ht(),(Y.key==="j"||Y.key==="J")&&Ro(1),(Y.key==="k"||Y.key==="K")&&Ro(-1),(Y.key==="t"||Y.key==="T")&&Xr(ze=>ze==="dark"?"light":"dark")}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[Vs,$t,Cr,g,d,Ro,Wr]);const jr=t.current.agents.size,Gs=new Set(Array.from(t.current.agents.values()).map(H=>H.sessionId)).size,tn=R.useMemo(()=>g$(t.current.agents.values()),[t.current,t.current.lastSeq]),Ao=R.useMemo(()=>v$(t.current.agents.values()),[t.current,t.current.lastSeq]),Ka=R.useRef(null);R.useEffect(()=>{const H=J3({waiting:tn.length,running:Ao}),Y=Ka.current;if(Ka.current=H,(Y==null?void 0:Y.title)!==H.title&&(document.title=H.title),(Y==null?void 0:Y.icon)!==H.icon){const oe=document.querySelector('link[rel="icon"]');oe&&(oe.href=eq[H.icon])}},[tn.length,Ao]);const[cc,dc]=R.useState(""),Ri=nq(tn);R.useEffect(()=>{dc(H=>rq(H,Ri))},[Ri]);const nn=R.useMemo(()=>{let H=0,Y=0,oe=0,de=0,xe=0,Se=0,Pe=0,Fe=0,Ge=0;for(const We of t.current.agents.values()){H+=We.usage.inputTokens,Y+=We.usage.outputTokens,oe+=We.usage.cacheReadTokens,de+=We.usage.cacheCreateTokens;const ze=dn(We.usage,We.model);xe+=ze.total,Se+=ze.input,Pe+=ze.output,Fe+=ze.cacheRead,Ge+=ze.cacheWrite}return{inT:H,outT:Y,cacheR:oe,cacheC:de,sum:H+Y,cost:{total:xe,input:Se,output:Pe,cacheRead:Fe,cacheWrite:Ge}}},[t.current,t.current.lastSeq]);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:"brand",children:[m.jsx("span",{className:"logo"}),m.jsx("h1",{children:Gt}),ye?m.jsxs("button",{type:"button",className:"v stale",onClick:Ze,"aria-label":J5({...ye,open:ft}),title:ye.kind==="restart"?`Running v${ye.from}; v${ye.to} is installed on disk. Restart to pick it up.`:`Running v${ye.from}; v${ye.to} is on npm.`,children:["v",ye.from,m.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const H={running:(K==null?void 0:K.running)??"1.36.4",latest:K==null?void 0:K.latest,latestPending:K==null?void 0:K.latestPending,checkedAgo:K!=null&&K.checkedAt?qv(ut-K.checkedAt):null,checkDisabled:K==null?void 0:K.checkDisabled,checking:ce};return m.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":Z5(H),title:Q5(H),children:["v",H.running]})})()]}),Rt&&(()=>{const H=dn(Rt.usage,Rt.model),Y=Math.max(0,((Rt.endedAt??ut)-Rt.startedAt)/1e3),oe=Rt.state==="active"?ju(H.total,Y):null,de=o.size-1;return m.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Rt.label}`,onClick:()=>{try{const xe=Qt.find(Se=>Se.id===Rt.id);xe&&e.fitView({padding:.35,duration:500,nodes:[xe]}),St.current=Date.now()}catch{}},children:[m.jsx("span",{className:`state-pill state-${Rt.state}`,children:Rt.state==="active"?"live":Rt.state}),m.jsx("span",{className:"selected-label",children:Rt.label}),H.total>0&&m.jsxs("span",{className:"selected-cost",children:[qe(H.total),oe?m.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),de>0&&m.jsxs("span",{className:"selected-extra",children:["+",de]}),m.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:xe=>{xe.stopPropagation(),g()},children:"×"})]})})(),m.jsxs("div",{className:"actions",children:[m.jsxs("div",{className:"search",children:[m.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),m.jsx("input",{ref:Zr,type:"text",placeholder:iF,value:Kt,onChange:H=>Kr(H.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),Kt?m.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Kr(""),children:"×"}):m.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),Cn.count&&m.jsx("span",{className:`search-count${Cn.empty?" none":""}`,"aria-live":"polite",title:`${Cn.count} agents on the canvas match “${Kt}”`,children:Cn.count})]}),m.jsxs("span",{className:"status",children:[(()=>{const H=nF({connected:I,paused:Hr,held:vr.current.size});return m.jsx("span",{className:`pill ${H.tone}`,title:H.title,children:H.label})})(),m.jsxs("span",{className:"stat",title:cq(we),children:[m.jsx("span",{className:"count",children:Gs}),m.jsx("span",{className:"lbl",children:"sessions"})]}),m.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[m.jsx("span",{className:"count",children:jr}),m.jsx("span",{className:"lbl",children:"agents"})]}),m.jsxs("span",{className:"stat",title:dq(we),children:[m.jsx("span",{className:"count",children:t.current.totalEvents}),m.jsx("span",{className:"lbl",children:"events"})]}),m.jsx(F$,{usageOpen:O}),nn.sum>0&&m.jsxs("span",{className:"stat",title:`in:${nn.inT.toLocaleString()} out:${nn.outT.toLocaleString()} cache-r:${nn.cacheR.toLocaleString()} cache-c:${nn.cacheC.toLocaleString()}`,children:[m.jsx("span",{className:"count",children:Nt(nn.sum)}),m.jsx("span",{className:"lbl",children:"tokens"})]}),is.length>0&&m.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
|
|
74
74
|
${is.map(H=>` ${H.server}: ${H.count} call${H.count===1?"":"s"}`).join(`
|
|
75
75
|
`)}`,children:[is.slice(0,6).map(H=>m.jsx("span",{className:"mcp-dot",style:{"--mcp-hue":H.hue}},H.server)),is.length>6&&m.jsxs("span",{className:"mcp-more",children:["+",is.length-6]}),m.jsx("span",{className:"lbl",children:"mcp"})]}),nn.cost.total>0&&(()=>{let H=0,Y=0;for(const xe of t.current.agents.values()){if(xe.state!=="active")continue;const Se=dn(xe.usage,xe.model);H+=Se.total,Y=Math.max(Y,((xe.endedAt??ut)-xe.startedAt)/1e3)}const oe=Y>0?ju(H,Y):null,de=`input ${qe(nn.cost.input)} + output ${qe(nn.cost.output)} + cache r ${qe(nn.cost.cacheRead)} + cache w ${qe(nn.cost.cacheWrite)}${oe?`
|
|
76
76
|
active burn: ${oe}`:""}`;return m.jsxs("span",{className:"stat",title:de,children:[m.jsx("span",{className:"count",children:qe(nn.cost.total)}),m.jsxs("span",{className:"lbl",children:["cost",oe?` · ${oe}`:""]})]})})()]}),m.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:cc}),tn.length>0&&m.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Ti(tn[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
package/dist/web/index.html
CHANGED
|
@@ -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-
|
|
43
|
+
<script type="module" crossorigin src="/assets/index-DaHowkOR.js"></script>
|
|
44
44
|
<link rel="stylesheet" crossorigin href="/assets/index-CaAP5Ufx.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.36.
|
|
3
|
+
"version": "1.36.4",
|
|
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. Also available as npx ccdeck and npx agent-dag.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|