agent-dag 1.35.39 → 1.35.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -120,8 +120,13 @@ ccdeck [options]
120
120
  no Accounts panel (Codex only)
121
121
  --uninstall Remove ccdeck's hooks from settings files
122
122
  -h, --help Show this help
123
+ -v, --version Print the version and exit
123
124
  ```
124
125
 
126
+ Anything else on the command line is reported as an unknown option and then
127
+ ignored — the deck still starts, so a typo costs you a warning rather than a
128
+ dashboard.
129
+
125
130
  ccdeck looks for each CLI before it does anything on that CLI's behalf. Claude
126
131
  Code counts as present when its binary is on `PATH` (or in one of the places its
127
132
  installers put it), or when its config dir carries traces of having been used;
package/bin/deck.js CHANGED
@@ -8,6 +8,7 @@ import { resolve, dirname, join } from "node:path";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
9
9
  import { existsSync, readFileSync } from "node:fs";
10
10
  import { dieOfSignal } from "../src/server/supervisor.mjs";
11
+ import { parseArgs } from "../src/server/args.mjs";
11
12
  import {
12
13
  CURSOR_HIDE, CURSOR_SHOW, colorProfile, fit, glyphs, labelColumn, link, motionOK, oneLine,
13
14
  palette, pulseText, spinnerFrames, statusLine, supportsHyperlinks, termColumns, unicodeOK,
@@ -45,6 +46,22 @@ if (flags.help) {
45
46
  process.exit(0);
46
47
  }
47
48
 
49
+ // The version, on stdout, and then nothing — no hooks, no port, no browser.
50
+ //
51
+ // This is the first thing anyone types at a CLI they do not know and the second
52
+ // thing anyone types when filing a bug, and until now it was the one question
53
+ // the deck answered by starting a server and never exiting. The banner has
54
+ // always carried the number, but only underneath a running deck, which is not
55
+ // an answer: it cannot be piped, and the process it comes with has to be killed.
56
+ //
57
+ // Bare, unprefixed, one line: `ccdeck --version` is read by scripts as often as
58
+ // by people, and `node --version` style ornamentation is what those scripts
59
+ // then have to strip. PKG_VERSION is the same read the banner uses.
60
+ if (flags.version) {
61
+ console.log(PKG_VERSION);
62
+ process.exit(0);
63
+ }
64
+
48
65
  if (flags.uninstall) {
49
66
  const { uninstallHooks, hasCodexInstalled } = await import(pathToFileURL(join(PKG_ROOT, "src/server/installer.mjs")).href);
50
67
  const claude = await uninstallHooks({ provider: "claude" });
@@ -195,7 +212,7 @@ process.on("SIGHUP", () => { showCursor(); dieOfSignal("SIGHUP"); });
195
212
  // longer, silently broke the alignment of every other one.
196
213
  const LABELS = [
197
214
  "workspace", "Claude hooks", "Codex sessions", "claude-swap", "accounts",
198
- "ccusage", "update", "name", "server ready", "log",
215
+ "ccusage", "update", "name", "server ready", "log", "unknown option",
199
216
  ];
200
217
  const LABEL_W = labelColumn(LABELS);
201
218
 
@@ -633,6 +650,11 @@ try { process.send?.({ type: "listening", port: realPort }); } catch { /* not su
633
650
 
634
651
  if (RESPAWN) {
635
652
  write(` ${P.ok}${G.restart}${P.reset} ${P.muted}restarted ${G.arrow} ${P.reset}v${PKG_VERSION}${P.muted} ${G.bullet} ${link(url, url, LINKS)}${P.reset}\n`);
653
+ // A respawn skips the whole startup report, but not this: the argv is the
654
+ // same argv, the typo in it is still there, and a deck that mentioned it once
655
+ // and then went quiet for every restart afterwards is back to hiding it from
656
+ // anyone who was not watching the first boot.
657
+ reportUnknownFlags(flags.unknown);
636
658
  } else {
637
659
  // The URL is the one detail an ellipsis would destroy — half an address is
638
660
  // not a shorter address — so it keeps its own line when the terminal is too
@@ -642,6 +664,8 @@ if (RESPAWN) {
642
664
  detail: link(url, url, LINKS), detailTone: `${P.accent}${P.bold}`, keep: true,
643
665
  }));
644
666
  if (persist) write(row({ label: "log", detail: fileLink(persist) }));
667
+ // Last of the rows, on purpose — see reportUnknownFlags.
668
+ reportUnknownFlags(flags.unknown);
645
669
  // Only when one is actually being opened. Under --no-open — which is how an
646
670
  // npx update relaunches, with a tab already waiting — this was announcing
647
671
  // something that never happened.
@@ -806,25 +830,34 @@ function reportReregistered({ file }) {
806
830
  write(`\n ${P.ok}${G.ok}${P.reset} ${P.muted}registered again ${G.arrow} ${fileLink(file)}${P.reset}\n`);
807
831
  }
808
832
 
809
- function parseArgs(args) {
810
- const out = {};
811
- for (let i = 0; i < args.length; i++) {
812
- const a = args[i];
813
- if (a === "-h" || a === "--help") out.help = true;
814
- else if (a === "-p" || a === "--port") out.port = args[++i];
815
- else if (a === "--no-open") out.noOpen = true;
816
- else if (a === "--uninstall") out.uninstall = true;
817
- else if (a === "--workspace") out.workspace = args[++i];
818
- else if (a === "--scope") out.scope = true;
819
- else if (a === "--all") out.all = true; // legacy no-op (now default)
820
- else if (a === "--no-persist") out.noPersist = true;
821
- else if (a === "--history") out.history = args[++i];
822
- else if (a === "--codex") out.codex = true;
823
- else if (a === "--no-codex") out.noCodex = true;
824
- else if (a === "--claude") out.claude = true;
825
- else if (a === "--no-claude") out.noClaude = true;
833
+ /**
834
+ * Every token the parser did not recognise, named, one row each.
835
+ *
836
+ * Said rather than acted on: the deck goes on booting and still exits 0. It is
837
+ * not a one-shot command that can afford the usual contract. `bin/agent-dag.js`
838
+ * hands its own argv to every worker it spawns — including the npx relaunch,
839
+ * which starts a NEWER version of the package on the argv the user typed
840
+ * against an older one and the README recommends running it from a wrapper.
841
+ * Refusing to boot over one token would turn a typo into a dark dashboard, and
842
+ * an argument the newer build no longer knows into a failed upgrade that costs
843
+ * the port and the session. The file already holds that position once, in the
844
+ * `--all` branch: a flag the deck stopped needing is still accepted rather than
845
+ * made fatal.
846
+ *
847
+ * So it goes where the deck puts everything else it decided on your behalf
848
+ * the startup report — and it goes at the END of it. reportStartup writes its
849
+ * rows in a fixed order and three more land underneath them (the server, the
850
+ * log, the browser), so a warning printed among those rows is a warning the
851
+ * rows scroll over. Here it is the last line before the pulse indicator takes
852
+ * the bottom of the screen and stops repainting anything above it.
853
+ */
854
+ function reportUnknownFlags(unknown) {
855
+ for (const token of unknown) {
856
+ write(row({
857
+ mark: G.warn, tone: P.warn, label: "unknown option",
858
+ detail: `${token} ${G.dash} see \`${PRODUCT} --help\``,
859
+ }));
826
860
  }
827
- return out;
828
861
  }
829
862
 
830
863
  function printHelp() {
@@ -850,5 +883,9 @@ Options:
850
883
  Hook entries only: the forwarder script, ~/.claude/agent-dag/,
851
884
  the events log, ~/.agents-deck/ and claude-swap all stay
852
885
  -h, --help Show this help
886
+ -v, --version Print the version and exit
887
+
888
+ Anything else on the command line is reported as an unknown option and then
889
+ ignored: the deck still starts.
853
890
  `);
854
891
  }
@@ -69,7 +69,7 @@ Claude Code turns only. The sound is a Stop hook Claude Code runs itself when a
69
69
 
70
70
  ${n.clash} sound hook${n.clash>1?"s":""} of your own in settings.json also run${n.clash>1?"":"s"} here.`:"",l=n.parked>0?`
71
71
 
72
- ${n.parked} of your own sound hook${n.parked>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${n.parked>1?"them":"it"} back.`:"";return r+i+o+l}function XC(e){const n=new Map;for(const r of e)for(const i of r.agents??[]){if(!i||typeof i.agent!="string"||i.agent==="")continue;const o=n.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,n.set(i.agent,o)}return[...n.values()].sort((r,i)=>i.cost-r.cost||r.id.localeCompare(i.id))}function J$(e){const n=XC([{agents:e}]);return n.length<2?null:n.map(r=>`${dy(r.id)} ${qe(r.cost)}`).join(" · ")}function b_(e){switch(e.toLowerCase()){case"claude":return"#c4b5fd";case"codex":return"#fdba74";case"gemini":return"#a5b4fc";case"copilot":return"#86efac";default:return"#94a3b8"}}function eq(e,n){if(!(n>0)||!(e>0))return"0%";const r=e/n*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function iu(e){const n=e.toLowerCase();return n.includes("opus")?"#c4b5fd":n.includes("sonnet")?"#7dd3fc":n.includes("haiku")?"#86efac":n.includes("gpt-5")||n.includes("gpt5")?"#fcd34d":n.includes("gpt")?"#fca5a5":n.includes("gemini")?"#a5b4fc":n.includes("codex")?"#fdba74":"#94a3b8"}const tq=[7,14,30,90];function nq(e){const[n,r]=R.useState(null),[i,o]=R.useState(!1),l=R.useRef(U$()).current,u=(c=!1)=>{const f=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${H$(p)}${c?"&refresh=1":""}`;fetch(m).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),()=>l.cancel()),[e]),{landed:n,loading:i,reload:()=>u(!0)}}function rq({onClose:e,providers:n}){var O;const[r,i]=R.useState(30),[o,l]=R.useState(null),{landed:u,loading:c,reload:f}=nq(r),p=R.useRef(null),d=yo(e,{focusRef:p}),m=W$({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((O=u.resp.days)==null?void 0:O.length)??0}}),y=m.phase==="chart"?u.resp.days??[]:[],w=R.useMemo(()=>y.reduce((P,D)=>Math.max(P,D.totalCost),0),[y]),{totalCost:E,totalTok:_,inOut:b,cacheRead:S,modelCosts:k}=R.useMemo(()=>{let P=0,D=0,L=0,U=0;const V=new Map;for(const z of y){P+=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:P,totalTok:D,inOut:L,cacheRead:U,modelCosts:V}},[y]),N=R.useMemo(()=>Array.from(k.entries()).sort((P,D)=>D[1]-P[1]),[k]),j=R.useMemo(()=>XC(y),[y]),A=j.length>1,M=o?y.find(P=>P.period===o)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{ref:d,className:"uh-modal",onClick:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[g.jsxs("header",{className:"uh-head",children:[g.jsxs("div",{className:"uh-titlewrap",children:[g.jsx("div",{className:"uh-title",children:"Usage history"}),g.jsx("div",{className:"uh-sub",children:G$(n,j.map(P=>P.id))})]}),g.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:tq.map(P=>g.jsxs("button",{type:"button","aria-pressed":r===P,className:`uh-range-btn${r===P?" on":""}`,onClick:()=>{i(P),l(null)},children:[P,"d"]},P))}),g.jsx("button",{className:"btn icon-btn uh-reload",onClick:f,disabled:c,title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),g.jsx("button",{ref:p,className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),m.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:u?"running ccusage…":"running ccusage… (first run downloads the package)"}):m.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:go(u.resp)||void 0,children:[W3(u.resp,"ccusage did not report usage"),g.jsx("div",{children:g.jsx("button",{className:"btn uh-retry",onClick:f,disabled:c,children:c?"trying…":"Try again"})})]}):m.phase==="empty"?g.jsx("div",{className:`uh-status${m.stale?" uh-stale":""}`,"aria-busy":m.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:m.stale?"uh-stale":void 0,"aria-busy":m.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(ou,{label:"total cost",val:qe(E),accent:!0}),g.jsx(ou,{label:"tokens",val:Nt(_)}),g.jsx(ou,{label:"input+output",val:Nt(b)}),g.jsx(ou,{label:"cache reads",val:Nt(S)})]}),A&&g.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[g.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:j.map(P=>g.jsx("span",{className:"uh-agent-seg",style:{width:`${E>0?P.cost/E*100:0}%`,background:b_(P.id)}},P.id))}),g.jsx("div",{className:"uh-agent-keys",children:j.map(P=>g.jsxs("span",{className:"uh-agent-key",title:`${P.id} · ${Nt(P.tokens)} tokens`,children:[g.jsx("span",{className:"uh-legend-dot",style:{background:b_(P.id)}}),dy(P.id),g.jsx("span",{className:"uh-agent-cost",children:qe(P.cost)}),g.jsx("span",{className:"uh-agent-share",children:eq(P.cost,E)})]},P.id))})]}),g.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(P=>{const D=w>0?P.totalCost/w*100:0,L=P.period===o,U=`${P.period}, ${qe(P.totalCost)}`;return g.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>l(L?null:P.period),"aria-pressed":L,"aria-label":U,title:`${P.period} · ${qe(P.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(D,P.totalCost>0?2:0)}%`},children:P.modelBreakdowns.slice().sort((V,z)=>z.cost-V.cost).map(V=>{const z=P.totalCost>0?V.cost/P.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${z}%`,background:iu(V.modelName)}},V.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:P.period.slice(5)})]},P.period)})}),g.jsx("div",{className:"uh-legend",children:N.map(([P,D])=>g.jsxs("span",{className:"uh-legend-item",title:P,children:[g.jsx("span",{className:"uh-legend-dot",style:{background:iu(P)}}),Rs(P)," ",g.jsx("span",{className:"uh-legend-cost",children:qe(D)})]},P))}),M&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:M.period}),g.jsx("span",{className:"uh-detail-cost",children:qe(M.totalCost)}),(()=>{var L,U;const D=J$(M.agents)??((U=(L=M.metadata)==null?void 0:L.agents)!=null&&U.length?M.metadata.agents.join(" · "):null);return D?g.jsx("span",{className:"uh-detail-agents",title:D,children:D}):null})()]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(au,{label:"input",val:Nt(M.inputTokens)}),g.jsx(au,{label:"output",val:Nt(M.outputTokens)}),g.jsx(au,{label:"cache write",val:Nt(M.cacheCreationTokens)}),g.jsx(au,{label:"cache read",val:Nt(M.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:M.modelBreakdowns.slice().sort((P,D)=>D.cost-P.cost).map(P=>{const D=M.totalCost>0?P.cost/M.totalCost*100:0;return g.jsxs("div",{className:"uh-model-row",title:P.modelName,children:[g.jsxs("span",{className:"uh-model-name",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:iu(P.modelName)}}),g.jsx("span",{className:"uh-model-label",children:Rs(P.modelName)})]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${D}%`,background:iu(P.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:qe(P.cost)})]},P.modelName)})})]})]})]})})}function ou({label:e,val:n,accent:r}){return g.jsxs("div",{className:"uh-stat",children:[g.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:n}),g.jsx("span",{className:"uh-stat-label",children:e})]})}function au({label:e,val:n}){return g.jsxs("div",{className:"uh-ministat",children:[g.jsx("span",{className:"uh-ministat-val",children:n}),g.jsx("span",{className:"uh-ministat-label",children:e})]})}function fy(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 Xd,S_;function sq(){if(S_)return Xd;S_=1;function e(){this.__data__=[],this.size=0}return Xd=e,Xd}var Qd,k_;function wo(){if(k_)return Qd;k_=1;function e(n,r){return n===r||n!==n&&r!==r}return Qd=e,Qd}var Zd,E_;function Du(){if(E_)return Zd;E_=1;var e=wo();function n(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return Zd=n,Zd}var Jd,N_;function iq(){if(N_)return Jd;N_=1;var e=Du(),n=Array.prototype,r=n.splice;function i(o){var l=this.__data__,u=e(l,o);if(u<0)return!1;var c=l.length-1;return u==c?l.pop():r.call(l,u,1),--this.size,!0}return Jd=i,Jd}var ef,C_;function oq(){if(C_)return ef;C_=1;var e=Du();function n(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return ef=n,ef}var tf,j_;function aq(){if(j_)return tf;j_=1;var e=Du();function n(r){return e(this.__data__,r)>-1}return tf=n,tf}var nf,T_;function lq(){if(T_)return nf;T_=1;var e=Du();function n(r,i){var o=this.__data__,l=e(o,r);return l<0?(++this.size,o.push([r,i])):o[l][1]=i,this}return nf=n,nf}var rf,R_;function Fu(){if(R_)return rf;R_=1;var e=sq(),n=iq(),r=oq(),i=aq(),o=lq();function l(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 l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,rf=l,rf}var sf,A_;function uq(){if(A_)return sf;A_=1;var e=Fu();function n(){this.__data__=new e,this.size=0}return sf=n,sf}var of,I_;function cq(){if(I_)return of;I_=1;function e(n){var r=this.__data__,i=r.delete(n);return this.size=r.size,i}return of=e,of}var af,M_;function dq(){if(M_)return af;M_=1;function e(n){return this.__data__.get(n)}return af=e,af}var lf,O_;function fq(){if(O_)return lf;O_=1;function e(n){return this.__data__.has(n)}return lf=e,lf}var uf,P_;function QC(){if(P_)return uf;P_=1;var e=typeof Hl=="object"&&Hl&&Hl.Object===Object&&Hl;return uf=e,uf}var cf,L_;function rr(){if(L_)return cf;L_=1;var e=QC(),n=typeof self=="object"&&self&&self.Object===Object&&self,r=e||n||Function("return this")();return cf=r,cf}var df,$_;function xo(){if($_)return df;$_=1;var e=rr(),n=e.Symbol;return df=n,df}var ff,q_;function hq(){if(q_)return ff;q_=1;var e=xo(),n=Object.prototype,r=n.hasOwnProperty,i=n.toString,o=e?e.toStringTag:void 0;function l(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 ff=l,ff}var hf,D_;function pq(){if(D_)return hf;D_=1;var e=Object.prototype,n=e.toString;function r(i){return n.call(i)}return hf=r,hf}var pf,F_;function gi(){if(F_)return pf;F_=1;var e=xo(),n=hq(),r=pq(),i="[object Null]",o="[object Undefined]",l=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:l&&l in Object(c)?n(c):r(c)}return pf=u,pf}var mf,z_;function qn(){if(z_)return mf;z_=1;function e(n){var r=typeof n;return n!=null&&(r=="object"||r=="function")}return mf=e,mf}var gf,B_;function Oa(){if(B_)return gf;B_=1;var e=gi(),n=qn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",l="[object Proxy]";function u(c){if(!n(c))return!1;var f=e(c);return f==i||f==o||f==r||f==l}return gf=u,gf}var vf,U_;function mq(){if(U_)return vf;U_=1;var e=rr(),n=e["__core-js_shared__"];return vf=n,vf}var yf,H_;function gq(){if(H_)return yf;H_=1;var e=mq(),n=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!n&&n in i}return yf=r,yf}var wf,W_;function ZC(){if(W_)return wf;W_=1;var e=Function.prototype,n=e.toString;function r(i){if(i!=null){try{return n.call(i)}catch{}try{return i+""}catch{}}return""}return wf=r,wf}var xf,V_;function vq(){if(V_)return xf;V_=1;var e=Oa(),n=gq(),r=qn(),i=ZC(),o=/[\\^$.*+?()[\]{}|]/g,l=/^\[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 m(y){if(!r(y)||n(y))return!1;var w=e(y)?d:l;return w.test(i(y))}return xf=m,xf}var _f,G_;function yq(){if(G_)return _f;G_=1;function e(n,r){return n==null?void 0:n[r]}return _f=e,_f}var bf,Y_;function vi(){if(Y_)return bf;Y_=1;var e=vq(),n=yq();function r(i,o){var l=n(i,o);return e(l)?l:void 0}return bf=r,bf}var Sf,K_;function hy(){if(K_)return Sf;K_=1;var e=vi(),n=rr(),r=e(n,"Map");return Sf=r,Sf}var kf,X_;function zu(){if(X_)return kf;X_=1;var e=vi(),n=e(Object,"create");return kf=n,kf}var Ef,Q_;function wq(){if(Q_)return Ef;Q_=1;var e=zu();function n(){this.__data__=e?e(null):{},this.size=0}return Ef=n,Ef}var Nf,Z_;function xq(){if(Z_)return Nf;Z_=1;function e(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return Nf=e,Nf}var Cf,J_;function _q(){if(J_)return Cf;J_=1;var e=zu(),n="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(l){var u=this.__data__;if(e){var c=u[l];return c===n?void 0:c}return i.call(u,l)?u[l]:void 0}return Cf=o,Cf}var jf,e1;function bq(){if(e1)return jf;e1=1;var e=zu(),n=Object.prototype,r=n.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return jf=i,jf}var Tf,t1;function Sq(){if(t1)return Tf;t1=1;var e=zu(),n="__lodash_hash_undefined__";function r(i,o){var l=this.__data__;return this.size+=this.has(i)?0:1,l[i]=e&&o===void 0?n:o,this}return Tf=r,Tf}var Rf,n1;function kq(){if(n1)return Rf;n1=1;var e=wq(),n=xq(),r=_q(),i=bq(),o=Sq();function l(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 l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Rf=l,Rf}var Af,r1;function Eq(){if(r1)return Af;r1=1;var e=kq(),n=Fu(),r=hy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||n),string:new e}}return Af=i,Af}var If,s1;function Nq(){if(s1)return If;s1=1;function e(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return If=e,If}var Mf,i1;function Bu(){if(i1)return Mf;i1=1;var e=Nq();function n(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return Mf=n,Mf}var Of,o1;function Cq(){if(o1)return Of;o1=1;var e=Bu();function n(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return Of=n,Of}var Pf,a1;function jq(){if(a1)return Pf;a1=1;var e=Bu();function n(r){return e(this,r).get(r)}return Pf=n,Pf}var Lf,l1;function Tq(){if(l1)return Lf;l1=1;var e=Bu();function n(r){return e(this,r).has(r)}return Lf=n,Lf}var $f,u1;function Rq(){if(u1)return $f;u1=1;var e=Bu();function n(r,i){var o=e(this,r),l=o.size;return o.set(r,i),this.size+=o.size==l?0:1,this}return $f=n,$f}var qf,c1;function py(){if(c1)return qf;c1=1;var e=Eq(),n=Cq(),r=jq(),i=Tq(),o=Rq();function l(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 l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,qf=l,qf}var Df,d1;function Aq(){if(d1)return Df;d1=1;var e=Fu(),n=hy(),r=py(),i=200;function o(l,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!n||f.length<i-1)return f.push([l,u]),this.size=++c.size,this;c=this.__data__=new r(f)}return c.set(l,u),this.size=c.size,this}return Df=o,Df}var Ff,f1;function Uu(){if(f1)return Ff;f1=1;var e=Fu(),n=uq(),r=cq(),i=dq(),o=fq(),l=Aq();function u(c){var f=this.__data__=new e(c);this.size=f.size}return u.prototype.clear=n,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=l,Ff=u,Ff}var zf,h1;function my(){if(h1)return zf;h1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o&&r(n[i],i,n)!==!1;);return n}return zf=e,zf}var Bf,p1;function JC(){if(p1)return Bf;p1=1;var e=vi(),n=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Bf=n,Bf}var Uf,m1;function Hu(){if(m1)return Uf;m1=1;var e=JC();function n(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Uf=n,Uf}var Hf,g1;function Wu(){if(g1)return Hf;g1=1;var e=Hu(),n=wo(),r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c){var f=l[u];(!(i.call(l,u)&&n(f,c))||c===void 0&&!(u in l))&&e(l,u,c)}return Hf=o,Hf}var Wf,v1;function Pa(){if(v1)return Wf;v1=1;var e=Wu(),n=Hu();function r(i,o,l,u){var c=!l;l||(l={});for(var f=-1,p=o.length;++f<p;){var d=o[f],m=u?u(l[d],i[d],d,l,i):void 0;m===void 0&&(m=i[d]),c?n(l,d,m):e(l,d,m)}return l}return Wf=r,Wf}var Vf,y1;function Iq(){if(y1)return Vf;y1=1;function e(n,r){for(var i=-1,o=Array(n);++i<n;)o[i]=r(i);return o}return Vf=e,Vf}var Gf,w1;function mr(){if(w1)return Gf;w1=1;function e(n){return n!=null&&typeof n=="object"}return Gf=e,Gf}var Yf,x1;function Mq(){if(x1)return Yf;x1=1;var e=gi(),n=mr(),r="[object Arguments]";function i(o){return n(o)&&e(o)==r}return Yf=i,Yf}var Kf,_1;function La(){if(_1)return Kf;_1=1;var e=Mq(),n=mr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return n(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Kf=l,Kf}var Xf,b1;function _t(){if(b1)return Xf;b1=1;var e=Array.isArray;return Xf=e,Xf}var ha={exports:{}},Qf,S1;function Oq(){if(S1)return Qf;S1=1;function e(){return!1}return Qf=e,Qf}ha.exports;var k1;function _o(){return k1||(k1=1,(function(e,n){var r=rr(),i=Oq(),o=n&&!n.nodeType&&n,l=o&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===o,c=u?r.Buffer:void 0,f=c?c.isBuffer:void 0,p=f||i;e.exports=p})(ha,ha.exports)),ha.exports}var Zf,E1;function Vu(){if(E1)return Zf;E1=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,o){var l=typeof i;return o=o??e,!!o&&(l=="number"||l!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<o}return Zf=r,Zf}var Jf,N1;function gy(){if(N1)return Jf;N1=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Jf=n,Jf}var eh,C1;function Pq(){if(C1)return eh;C1=1;var e=gi(),n=gy(),r=mr(),i="[object Arguments]",o="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",m="[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]",O="[object Uint8Array]",P="[object Uint8ClampedArray]",D="[object Uint16Array]",L="[object Uint32Array]",U={};U[k]=U[N]=U[j]=U[A]=U[M]=U[O]=U[P]=U[D]=U[L]=!0,U[i]=U[o]=U[b]=U[l]=U[S]=U[u]=U[c]=U[f]=U[p]=U[d]=U[m]=U[y]=U[w]=U[E]=U[_]=!1;function V(z){return r(z)&&n(z.length)&&!!U[e(z)]}return eh=V,eh}var th,j1;function Gu(){if(j1)return th;j1=1;function e(n){return function(r){return n(r)}}return th=e,th}var pa={exports:{}};pa.exports;var T1;function vy(){return T1||(T1=1,(function(e,n){var r=QC(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l&&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})(pa,pa.exports)),pa.exports}var nh,R1;function $a(){if(R1)return nh;R1=1;var e=Pq(),n=Gu(),r=vy(),i=r&&r.isTypedArray,o=i?n(i):e;return nh=o,nh}var rh,A1;function ej(){if(A1)return rh;A1=1;var e=Iq(),n=La(),r=_t(),i=_o(),o=Vu(),l=$a(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var m=r(p),y=!m&&n(p),w=!m&&!y&&i(p),E=!m&&!y&&!w&&l(p),_=m||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 rh=f,rh}var sh,I1;function Yu(){if(I1)return sh;I1=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return sh=n,sh}var ih,M1;function tj(){if(M1)return ih;M1=1;function e(n,r){return function(i){return n(r(i))}}return ih=e,ih}var oh,O1;function Lq(){if(O1)return oh;O1=1;var e=tj(),n=e(Object.keys,Object);return oh=n,oh}var ah,P1;function yy(){if(P1)return ah;P1=1;var e=Yu(),n=Lq(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=[];for(var c in Object(l))i.call(l,c)&&c!="constructor"&&u.push(c);return u}return ah=o,ah}var lh,L1;function Br(){if(L1)return lh;L1=1;var e=Oa(),n=gy();function r(i){return i!=null&&n(i.length)&&!e(i)}return lh=r,lh}var uh,$1;function As(){if($1)return uh;$1=1;var e=ej(),n=yy(),r=Br();function i(o){return r(o)?e(o):n(o)}return uh=i,uh}var ch,q1;function $q(){if(q1)return ch;q1=1;var e=Pa(),n=As();function r(i,o){return i&&e(o,n(o),i)}return ch=r,ch}var dh,D1;function qq(){if(D1)return dh;D1=1;function e(n){var r=[];if(n!=null)for(var i in Object(n))r.push(i);return r}return dh=e,dh}var fh,F1;function Dq(){if(F1)return fh;F1=1;var e=qn(),n=Yu(),r=qq(),i=Object.prototype,o=i.hasOwnProperty;function l(u){if(!e(u))return r(u);var c=n(u),f=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||f.push(p);return f}return fh=l,fh}var hh,z1;function yi(){if(z1)return hh;z1=1;var e=ej(),n=Dq(),r=Br();function i(o){return r(o)?e(o,!0):n(o)}return hh=i,hh}var ph,B1;function Fq(){if(B1)return ph;B1=1;var e=Pa(),n=yi();function r(i,o){return i&&e(o,n(o),i)}return ph=r,ph}var ma={exports:{}};ma.exports;var U1;function nj(){return U1||(U1=1,(function(e,n){var r=rr(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function f(p,d){if(d)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(ma,ma.exports)),ma.exports}var mh,H1;function rj(){if(H1)return mh;H1=1;function e(n,r){var i=-1,o=n.length;for(r||(r=Array(o));++i<o;)r[i]=n[i];return r}return mh=e,mh}var gh,W1;function sj(){if(W1)return gh;W1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=0,u=[];++i<o;){var c=n[i];r(c,i,n)&&(u[l++]=c)}return u}return gh=e,gh}var vh,V1;function ij(){if(V1)return vh;V1=1;function e(){return[]}return vh=e,vh}var yh,G1;function wy(){if(G1)return yh;G1=1;var e=sj(),n=ij(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,l=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:n;return yh=l,yh}var wh,Y1;function zq(){if(Y1)return wh;Y1=1;var e=Pa(),n=wy();function r(i,o){return e(i,n(i),o)}return wh=r,wh}var xh,K1;function xy(){if(K1)return xh;K1=1;function e(n,r){for(var i=-1,o=r.length,l=n.length;++i<o;)n[l+i]=r[i];return n}return xh=e,xh}var _h,X1;function Ku(){if(X1)return _h;X1=1;var e=tj(),n=e(Object.getPrototypeOf,Object);return _h=n,_h}var bh,Q1;function oj(){if(Q1)return bh;Q1=1;var e=xy(),n=Ku(),r=wy(),i=ij(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=n(u);return c}:i;return bh=l,bh}var Sh,Z1;function Bq(){if(Z1)return Sh;Z1=1;var e=Pa(),n=oj();function r(i,o){return e(i,n(i),o)}return Sh=r,Sh}var kh,J1;function aj(){if(J1)return kh;J1=1;var e=xy(),n=_t();function r(i,o,l){var u=o(i);return n(i)?u:e(u,l(i))}return kh=r,kh}var Eh,eb;function lj(){if(eb)return Eh;eb=1;var e=aj(),n=wy(),r=As();function i(o){return e(o,r,n)}return Eh=i,Eh}var Nh,tb;function Uq(){if(tb)return Nh;tb=1;var e=aj(),n=oj(),r=yi();function i(o){return e(o,r,n)}return Nh=i,Nh}var Ch,nb;function Hq(){if(nb)return Ch;nb=1;var e=vi(),n=rr(),r=e(n,"DataView");return Ch=r,Ch}var jh,rb;function Wq(){if(rb)return jh;rb=1;var e=vi(),n=rr(),r=e(n,"Promise");return jh=r,jh}var Th,sb;function uj(){if(sb)return Th;sb=1;var e=vi(),n=rr(),r=e(n,"Set");return Th=r,Th}var Rh,ib;function Vq(){if(ib)return Rh;ib=1;var e=vi(),n=rr(),r=e(n,"WeakMap");return Rh=r,Rh}var Ah,ob;function bo(){if(ob)return Ah;ob=1;var e=Hq(),n=hy(),r=Wq(),i=uj(),o=Vq(),l=gi(),u=ZC(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",m="[object WeakMap]",y="[object DataView]",w=u(e),E=u(n),_=u(r),b=u(i),S=u(o),k=l;return(e&&k(new e(new ArrayBuffer(1)))!=y||n&&k(new n)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=m)&&(k=function(N){var j=l(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 m}return j}),Ah=k,Ah}var Ih,ab;function Gq(){if(ab)return Ih;ab=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i){var o=i.length,l=new i.constructor(o);return o&&typeof i[0]=="string"&&n.call(i,"index")&&(l.index=i.index,l.input=i.input),l}return Ih=r,Ih}var Mh,lb;function cj(){if(lb)return Mh;lb=1;var e=rr(),n=e.Uint8Array;return Mh=n,Mh}var Oh,ub;function _y(){if(ub)return Oh;ub=1;var e=cj();function n(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return Oh=n,Oh}var Ph,cb;function Yq(){if(cb)return Ph;cb=1;var e=_y();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Ph=n,Ph}var Lh,db;function Kq(){if(db)return Lh;db=1;var e=/\w*$/;function n(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Lh=n,Lh}var $h,fb;function Xq(){if(fb)return $h;fb=1;var e=xo(),n=e?e.prototype:void 0,r=n?n.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return $h=i,$h}var qh,hb;function dj(){if(hb)return qh;hb=1;var e=_y();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return qh=n,qh}var Dh,pb;function Qq(){if(pb)return Dh;pb=1;var e=_y(),n=Yq(),r=Kq(),i=Xq(),o=dj(),l="[object Boolean]",u="[object Date]",c="[object Map]",f="[object Number]",p="[object RegExp]",d="[object Set]",m="[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]",O="[object Uint32Array]";function P(D,L,U){var V=D.constructor;switch(L){case w:return e(D);case l:case u:return new V(+D);case E:return n(D,U);case _:case b:case S:case k:case N:case j:case A:case M:case O:return o(D,U);case c:return new V;case f:case m:return new V(D);case p:return r(D);case d:return new V;case y:return i(D)}}return Dh=P,Dh}var Fh,mb;function fj(){if(mb)return Fh;mb=1;var e=qn(),n=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(n)return n(o);i.prototype=o;var l=new i;return i.prototype=void 0,l}})();return Fh=r,Fh}var zh,gb;function hj(){if(gb)return zh;gb=1;var e=fj(),n=Ku(),r=Yu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(n(o)):{}}return zh=i,zh}var Bh,vb;function Zq(){if(vb)return Bh;vb=1;var e=bo(),n=mr(),r="[object Map]";function i(o){return n(o)&&e(o)==r}return Bh=i,Bh}var Uh,yb;function Jq(){if(yb)return Uh;yb=1;var e=Zq(),n=Gu(),r=vy(),i=r&&r.isMap,o=i?n(i):e;return Uh=o,Uh}var Hh,wb;function eD(){if(wb)return Hh;wb=1;var e=bo(),n=mr(),r="[object Set]";function i(o){return n(o)&&e(o)==r}return Hh=i,Hh}var Wh,xb;function tD(){if(xb)return Wh;xb=1;var e=eD(),n=Gu(),r=vy(),i=r&&r.isSet,o=i?n(i):e;return Wh=o,Wh}var Vh,_b;function pj(){if(_b)return Vh;_b=1;var e=Uu(),n=my(),r=Wu(),i=$q(),o=Fq(),l=nj(),u=rj(),c=zq(),f=Bq(),p=lj(),d=Uq(),m=bo(),y=Gq(),w=Qq(),E=hj(),_=_t(),b=_o(),S=Jq(),k=qn(),N=tD(),j=As(),A=yi(),M=1,O=2,P=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&O,Ot=_e&P;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=m(we),Pt=Qe==C||Qe==F;if(b(we))return l(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 n(bt||we,function(ht,vt){bt&&(vt=ht,ht=we[vt]),r(De,vt,Ye(ht,_e,Be,vt,we,Ze))}),De}return Vh=Ye,Vh}var Gh,bb;function nD(){if(bb)return Gh;bb=1;var e=pj(),n=4;function r(i){return e(i,n)}return Gh=r,Gh}var Yh,Sb;function by(){if(Sb)return Yh;Sb=1;function e(n){return function(){return n}}return Yh=e,Yh}var Kh,kb;function rD(){if(kb)return Kh;kb=1;function e(n){return function(r,i,o){for(var l=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[n?f:++l];if(i(u[p],p,u)===!1)break}return r}}return Kh=e,Kh}var Xh,Eb;function Sy(){if(Eb)return Xh;Eb=1;var e=rD(),n=e();return Xh=n,Xh}var Qh,Nb;function ky(){if(Nb)return Qh;Nb=1;var e=Sy(),n=As();function r(i,o){return i&&e(i,o,n)}return Qh=r,Qh}var Zh,Cb;function sD(){if(Cb)return Zh;Cb=1;var e=Br();function n(r,i){return function(o,l){if(o==null)return o;if(!e(o))return r(o,l);for(var u=o.length,c=i?u:-1,f=Object(o);(i?c--:++c<u)&&l(f[c],c,f)!==!1;);return o}}return Zh=n,Zh}var Jh,jb;function Xu(){if(jb)return Jh;jb=1;var e=ky(),n=sD(),r=n(e);return Jh=r,Jh}var ep,Tb;function wi(){if(Tb)return ep;Tb=1;function e(n){return n}return ep=e,ep}var tp,Rb;function mj(){if(Rb)return tp;Rb=1;var e=wi();function n(r){return typeof r=="function"?r:e}return tp=n,tp}var np,Ab;function gj(){if(Ab)return np;Ab=1;var e=my(),n=Xu(),r=mj(),i=_t();function o(l,u){var c=i(l)?e:n;return c(l,r(u))}return np=o,np}var rp,Ib;function vj(){return Ib||(Ib=1,rp=gj()),rp}var sp,Mb;function iD(){if(Mb)return sp;Mb=1;var e=Xu();function n(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return sp=n,sp}var ip,Ob;function oD(){if(Ob)return ip;Ob=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return ip=n,ip}var op,Pb;function aD(){if(Pb)return op;Pb=1;function e(n){return this.__data__.has(n)}return op=e,op}var ap,Lb;function yj(){if(Lb)return ap;Lb=1;var e=py(),n=oD(),r=aD();function i(o){var l=-1,u=o==null?0:o.length;for(this.__data__=new e;++l<u;)this.add(o[l])}return i.prototype.add=i.prototype.push=n,i.prototype.has=r,ap=i,ap}var lp,$b;function lD(){if($b)return lp;$b=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o;)if(r(n[i],i,n))return!0;return!1}return lp=e,lp}var up,qb;function wj(){if(qb)return up;qb=1;function e(n,r){return n.has(r)}return up=e,up}var cp,Db;function xj(){if(Db)return cp;Db=1;var e=yj(),n=lD(),r=wj(),i=1,o=2;function l(u,c,f,p,d,m){var y=f&i,w=u.length,E=c.length;if(w!=E&&!(y&&E>w))return!1;var _=m.get(u),b=m.get(c);if(_&&b)return _==c&&b==u;var S=-1,k=!0,N=f&o?new e:void 0;for(m.set(u,c),m.set(c,u);++S<w;){var j=u[S],A=c[S];if(p)var M=y?p(A,j,S,c,u,m):p(j,A,S,u,c,m);if(M!==void 0){if(M)continue;k=!1;break}if(N){if(!n(c,function(O,P){if(!r(N,P)&&(j===O||d(j,O,f,p,m)))return N.push(P)})){k=!1;break}}else if(!(j===A||d(j,A,f,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return cp=l,cp}var dp,Fb;function uD(){if(Fb)return dp;Fb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o,l){i[++r]=[l,o]}),i}return dp=e,dp}var fp,zb;function Ey(){if(zb)return fp;zb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o){i[++r]=o}),i}return fp=e,fp}var hp,Bb;function cD(){if(Bb)return hp;Bb=1;var e=xo(),n=cj(),r=wo(),i=xj(),o=uD(),l=Ey(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",m="[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,O,P,D,L,U,V){switch(P){case k:if(M.byteLength!=O.byteLength||M.byteOffset!=O.byteOffset)return!1;M=M.buffer,O=O.buffer;case S:return!(M.byteLength!=O.byteLength||!U(new n(M),new n(O)));case f:case p:case y:return r(+M,+O);case d:return M.name==O.name&&M.message==O.message;case w:case _:return M==O+"";case m:var z=o;case E:var C=D&u;if(z||(z=l),M.size!=O.size&&!C)return!1;var F=V.get(M);if(F)return F==O;D|=c,V.set(M,O);var $=i(z(M),z(O),D,L,U,V);return V.delete(M),$;case b:if(j)return j.call(M)==j.call(O)}return!1}return hp=A,hp}var pp,Ub;function dD(){if(Ub)return pp;Ub=1;var e=lj(),n=1,r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c,f,p,d){var m=c&n,y=e(l),w=y.length,E=e(u),_=E.length;if(w!=_&&!m)return!1;for(var b=w;b--;){var S=y[b];if(!(m?S in u:i.call(u,S)))return!1}var k=d.get(l),N=d.get(u);if(k&&N)return k==u&&N==l;var j=!0;d.set(l,u),d.set(u,l);for(var A=m;++b<w;){S=y[b];var M=l[S],O=u[S];if(f)var P=m?f(O,M,S,u,l,d):f(M,O,S,l,u,d);if(!(P===void 0?M===O||p(M,O,c,f,d):P)){j=!1;break}A||(A=S=="constructor")}if(j&&!A){var D=l.constructor,L=u.constructor;D!=L&&"constructor"in l&&"constructor"in u&&!(typeof D=="function"&&D instanceof D&&typeof L=="function"&&L instanceof L)&&(j=!1)}return d.delete(l),d.delete(u),j}return pp=o,pp}var mp,Hb;function fD(){if(Hb)return mp;Hb=1;var e=Uu(),n=xj(),r=cD(),i=dD(),o=bo(),l=_t(),u=_o(),c=$a(),f=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function E(_,b,S,k,N,j){var A=l(_),M=l(b),O=A?d:o(_),P=M?d:o(b);O=O==p?m:O,P=P==p?m:P;var D=O==m,L=P==m,U=O==P;if(U&&u(_)){if(!u(b))return!1;A=!0,D=!1}if(U&&!D)return j||(j=new e),A||c(_)?n(_,b,S,k,N,j):r(_,b,O,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 mp=E,mp}var gp,Wb;function _j(){if(Wb)return gp;Wb=1;var e=fD(),n=mr();function r(i,o,l,u,c){return i===o?!0:i==null||o==null||!n(i)&&!n(o)?i!==i&&o!==o:e(i,o,l,u,r,c)}return gp=r,gp}var vp,Vb;function hD(){if(Vb)return vp;Vb=1;var e=Uu(),n=_j(),r=1,i=2;function o(l,u,c,f){var p=c.length,d=p,m=!f;if(l==null)return!d;for(l=Object(l);p--;){var y=c[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<d;){y=c[p];var w=y[0],E=l[w],_=y[1];if(m&&y[2]){if(E===void 0&&!(w in l))return!1}else{var b=new e;if(f)var S=f(E,_,w,l,u,b);if(!(S===void 0?n(_,E,r|i,f,b):S))return!1}}return!0}return vp=o,vp}var yp,Gb;function bj(){if(Gb)return yp;Gb=1;var e=qn();function n(r){return r===r&&!e(r)}return yp=n,yp}var wp,Yb;function pD(){if(Yb)return wp;Yb=1;var e=bj(),n=As();function r(i){for(var o=n(i),l=o.length;l--;){var u=o[l],c=i[u];o[l]=[u,c,e(c)]}return o}return wp=r,wp}var xp,Kb;function Sj(){if(Kb)return xp;Kb=1;function e(n,r){return function(i){return i==null?!1:i[n]===r&&(r!==void 0||n in Object(i))}}return xp=e,xp}var _p,Xb;function mD(){if(Xb)return _p;Xb=1;var e=hD(),n=pD(),r=Sj();function i(o){var l=n(o);return l.length==1&&l[0][2]?r(l[0][0],l[0][1]):function(u){return u===o||e(u,o,l)}}return _p=i,_p}var bp,Qb;function So(){if(Qb)return bp;Qb=1;var e=gi(),n=mr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||n(o)&&e(o)==r}return bp=i,bp}var Sp,Zb;function Ny(){if(Zb)return Sp;Zb=1;var e=_t(),n=So(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(l,u){if(e(l))return!1;var c=typeof l;return c=="number"||c=="symbol"||c=="boolean"||l==null||n(l)?!0:i.test(l)||!r.test(l)||u!=null&&l in Object(u)}return Sp=o,Sp}var kp,Jb;function gD(){if(Jb)return kp;Jb=1;var e=py(),n="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(n);var l=function(){var u=arguments,c=o?o.apply(this,u):u[0],f=l.cache;if(f.has(c))return f.get(c);var p=i.apply(this,u);return l.cache=f.set(c,p)||f,p};return l.cache=new(r.Cache||e),l}return r.Cache=e,kp=r,kp}var Ep,eS;function vD(){if(eS)return Ep;eS=1;var e=gD(),n=500;function r(i){var o=e(i,function(u){return l.size===n&&l.clear(),u}),l=o.cache;return o}return Ep=r,Ep}var Np,tS;function yD(){if(tS)return Np;tS=1;var e=vD(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(n,function(u,c,f,p){l.push(f?p.replace(r,"$1"):c||u)}),l});return Np=i,Np}var Cp,nS;function Qu(){if(nS)return Cp;nS=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=Array(o);++i<o;)l[i]=r(n[i],i,n);return l}return Cp=e,Cp}var jp,rS;function wD(){if(rS)return jp;rS=1;var e=xo(),n=Qu(),r=_t(),i=So(),o=e?e.prototype:void 0,l=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return n(c,u)+"";if(i(c))return l?l.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return jp=u,jp}var Tp,sS;function kj(){if(sS)return Tp;sS=1;var e=wD();function n(r){return r==null?"":e(r)}return Tp=n,Tp}var Rp,iS;function Zu(){if(iS)return Rp;iS=1;var e=_t(),n=Ny(),r=yD(),i=kj();function o(l,u){return e(l)?l:n(l,u)?[l]:r(i(l))}return Rp=o,Rp}var Ap,oS;function qa(){if(oS)return Ap;oS=1;var e=So();function n(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Ap=n,Ap}var Ip,aS;function Ju(){if(aS)return Ip;aS=1;var e=Zu(),n=qa();function r(i,o){o=e(o,i);for(var l=0,u=o.length;i!=null&&l<u;)i=i[n(o[l++])];return l&&l==u?i:void 0}return Ip=r,Ip}var Mp,lS;function xD(){if(lS)return Mp;lS=1;var e=Ju();function n(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return Mp=n,Mp}var Op,uS;function _D(){if(uS)return Op;uS=1;function e(n,r){return n!=null&&r in Object(n)}return Op=e,Op}var Pp,cS;function Ej(){if(cS)return Pp;cS=1;var e=Zu(),n=La(),r=_t(),i=Vu(),o=gy(),l=qa();function u(c,f,p){f=e(f,c);for(var d=-1,m=f.length,y=!1;++d<m;){var w=l(f[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=m?y:(m=c==null?0:c.length,!!m&&o(m)&&i(w,m)&&(r(c)||n(c)))}return Pp=u,Pp}var Lp,dS;function Nj(){if(dS)return Lp;dS=1;var e=_D(),n=Ej();function r(i,o){return i!=null&&n(i,o,e)}return Lp=r,Lp}var $p,fS;function bD(){if(fS)return $p;fS=1;var e=_j(),n=xD(),r=Nj(),i=Ny(),o=bj(),l=Sj(),u=qa(),c=1,f=2;function p(d,m){return i(d)&&o(m)?l(u(d),m):function(y){var w=n(y,d);return w===void 0&&w===m?r(y,d):e(m,w,c|f)}}return $p=p,$p}var qp,hS;function Cj(){if(hS)return qp;hS=1;function e(n){return function(r){return r==null?void 0:r[n]}}return qp=e,qp}var Dp,pS;function SD(){if(pS)return Dp;pS=1;var e=Ju();function n(r){return function(i){return e(i,r)}}return Dp=n,Dp}var Fp,mS;function kD(){if(mS)return Fp;mS=1;var e=Cj(),n=SD(),r=Ny(),i=qa();function o(l){return r(l)?e(i(l)):n(l)}return Fp=o,Fp}var zp,gS;function Ur(){if(gS)return zp;gS=1;var e=mD(),n=bD(),r=wi(),i=_t(),o=kD();function l(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?n(u[0],u[1]):e(u):o(u)}return zp=l,zp}var Bp,vS;function jj(){if(vS)return Bp;vS=1;var e=sj(),n=iD(),r=Ur(),i=_t();function o(l,u){var c=i(l)?e:n;return c(l,r(u,3))}return Bp=o,Bp}var Up,yS;function ED(){if(yS)return Up;yS=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i,o){return i!=null&&n.call(i,o)}return Up=r,Up}var Hp,wS;function Tj(){if(wS)return Hp;wS=1;var e=ED(),n=Ej();function r(i,o){return i!=null&&n(i,o,e)}return Hp=r,Hp}var Wp,xS;function ND(){if(xS)return Wp;xS=1;var e=yy(),n=bo(),r=La(),i=_t(),o=Br(),l=_o(),u=Yu(),c=$a(),f="[object Map]",p="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||c(w)||r(w)))return!w.length;var E=n(w);if(E==f||E==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return Wp=y,Wp}var Vp,_S;function Rj(){if(_S)return Vp;_S=1;function e(n){return n===void 0}return Vp=e,Vp}var Gp,bS;function Aj(){if(bS)return Gp;bS=1;var e=Xu(),n=Br();function r(i,o){var l=-1,u=n(i)?Array(i.length):[];return e(i,function(c,f,p){u[++l]=o(c,f,p)}),u}return Gp=r,Gp}var Yp,SS;function Ij(){if(SS)return Yp;SS=1;var e=Qu(),n=Ur(),r=Aj(),i=_t();function o(l,u){var c=i(l)?e:r;return c(l,n(u,3))}return Yp=o,Yp}var Kp,kS;function CD(){if(kS)return Kp;kS=1;function e(n,r,i,o){var l=-1,u=n==null?0:n.length;for(o&&u&&(i=n[++l]);++l<u;)i=r(i,n[l],l,n);return i}return Kp=e,Kp}var Xp,ES;function jD(){if(ES)return Xp;ES=1;function e(n,r,i,o,l){return l(n,function(u,c,f){i=o?(o=!1,u):r(i,u,c,f)}),i}return Xp=e,Xp}var Qp,NS;function Mj(){if(NS)return Qp;NS=1;var e=CD(),n=Xu(),r=Ur(),i=jD(),o=_t();function l(u,c,f){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),f,d,n)}return Qp=l,Qp}var Zp,CS;function TD(){if(CS)return Zp;CS=1;var e=gi(),n=_t(),r=mr(),i="[object String]";function o(l){return typeof l=="string"||!n(l)&&r(l)&&e(l)==i}return Zp=o,Zp}var Jp,jS;function RD(){if(jS)return Jp;jS=1;var e=Cj(),n=e("length");return Jp=n,Jp}var em,TS;function AD(){if(TS)return em;TS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+l+"]");function f(p){return c.test(p)}return em=f,em}var tm,RS;function ID(){if(RS)return tm;RS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+f+")",d="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",E=p+"?",_="["+l+"]?",b="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+E+")*",S=_+E+b,k="(?:"+[d+c+"?",c,m,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 tm=j,tm}var nm,AS;function MD(){if(AS)return nm;AS=1;var e=RD(),n=AD(),r=ID();function i(o){return n(o)?r(o):e(o)}return nm=i,nm}var rm,IS;function OD(){if(IS)return rm;IS=1;var e=yy(),n=bo(),r=Br(),i=TD(),o=MD(),l="[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=n(f);return p==l||p==u?f.size:e(f).length}return rm=c,rm}var sm,MS;function PD(){if(MS)return sm;MS=1;var e=my(),n=fj(),r=ky(),i=Ur(),o=Ku(),l=_t(),u=_o(),c=Oa(),f=qn(),p=$a();function d(m,y,w){var E=l(m),_=E||u(m)||p(m);if(y=i(y,4),w==null){var b=m&&m.constructor;_?w=E?new b:[]:f(m)?w=c(b)?n(o(m)):{}:w={}}return(_?e:r)(m,function(S,k,N){return y(w,S,k,N)}),w}return sm=d,sm}var im,OS;function LD(){if(OS)return im;OS=1;var e=xo(),n=La(),r=_t(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||n(l)||!!(i&&l&&l[i])}return im=o,im}var om,PS;function Cy(){if(PS)return om;PS=1;var e=xy(),n=LD();function r(i,o,l,u,c){var f=-1,p=i.length;for(l||(l=n),c||(c=[]);++f<p;){var d=i[f];o>0&&l(d)?o>1?r(d,o-1,l,u,c):e(c,d):u||(c[c.length]=d)}return c}return om=r,om}var am,LS;function $D(){if(LS)return am;LS=1;function e(n,r,i){switch(i.length){case 0:return n.call(r);case 1:return n.call(r,i[0]);case 2:return n.call(r,i[0],i[1]);case 3:return n.call(r,i[0],i[1],i[2])}return n.apply(r,i)}return am=e,am}var lm,$S;function Oj(){if($S)return lm;$S=1;var e=$D(),n=Math.max;function r(i,o,l){return o=n(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,f=n(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]=l(p),e(i,this,d)}}return lm=r,lm}var um,qS;function qD(){if(qS)return um;qS=1;var e=by(),n=JC(),r=wi(),i=n?function(o,l){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return um=i,um}var cm,DS;function DD(){if(DS)return cm;DS=1;var e=800,n=16,r=Date.now;function i(o){var l=0,u=0;return function(){var c=r(),f=n-(c-u);if(u=c,f>0){if(++l>=e)return arguments[0]}else l=0;return o.apply(void 0,arguments)}}return cm=i,cm}var dm,FS;function Pj(){if(FS)return dm;FS=1;var e=qD(),n=DD(),r=n(e);return dm=r,dm}var fm,zS;function ec(){if(zS)return fm;zS=1;var e=wi(),n=Oj(),r=Pj();function i(o,l){return r(n(o,l,e),o+"")}return fm=i,fm}var hm,BS;function Lj(){if(BS)return hm;BS=1;function e(n,r,i,o){for(var l=n.length,u=i+(o?1:-1);o?u--:++u<l;)if(r(n[u],u,n))return u;return-1}return hm=e,hm}var pm,US;function FD(){if(US)return pm;US=1;function e(n){return n!==n}return pm=e,pm}var mm,HS;function zD(){if(HS)return mm;HS=1;function e(n,r,i){for(var o=i-1,l=n.length;++o<l;)if(n[o]===r)return o;return-1}return mm=e,mm}var gm,WS;function BD(){if(WS)return gm;WS=1;var e=Lj(),n=FD(),r=zD();function i(o,l,u){return l===l?r(o,l,u):e(o,n,u)}return gm=i,gm}var vm,VS;function UD(){if(VS)return vm;VS=1;var e=BD();function n(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return vm=n,vm}var ym,GS;function HD(){if(GS)return ym;GS=1;function e(n,r,i){for(var o=-1,l=n==null?0:n.length;++o<l;)if(i(r,n[o]))return!0;return!1}return ym=e,ym}var wm,YS;function WD(){if(YS)return wm;YS=1;function e(){}return wm=e,wm}var xm,KS;function VD(){if(KS)return xm;KS=1;var e=uj(),n=WD(),r=Ey(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:n;return xm=o,xm}var _m,XS;function GD(){if(XS)return _m;XS=1;var e=yj(),n=UD(),r=HD(),i=wj(),o=VD(),l=Ey(),u=200;function c(f,p,d){var m=-1,y=n,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 l(S);E=!1,y=i,b=new e}else b=p?[]:_;e:for(;++m<w;){var k=f[m],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 _m=c,_m}var bm,QS;function $j(){if(QS)return bm;QS=1;var e=Br(),n=mr();function r(i){return n(i)&&e(i)}return bm=r,bm}var Sm,ZS;function YD(){if(ZS)return Sm;ZS=1;var e=Cy(),n=ec(),r=GD(),i=$j(),o=n(function(l){return r(e(l,1,i,!0))});return Sm=o,Sm}var km,JS;function KD(){if(JS)return km;JS=1;var e=Qu();function n(r,i){return e(i,function(o){return r[o]})}return km=n,km}var Em,ek;function qj(){if(ek)return Em;ek=1;var e=KD(),n=As();function r(i){return i==null?[]:e(i,n(i))}return Em=r,Em}var Nm,tk;function Dn(){if(tk)return Nm;tk=1;var e;if(typeof fy=="function")try{e={clone:nD(),constant:by(),each:vj(),filter:jj(),has:Tj(),isArray:_t(),isEmpty:ND(),isFunction:Oa(),isUndefined:Rj(),keys:As(),map:Ij(),reduce:Mj(),size:OD(),transform:PD(),union:YD(),values:qj()}}catch{}return e||(e=window._),Nm=e,Nm}var Cm,nk;function jy(){if(nk)return Cm;nk=1;var e=Dn();Cm=o;var n="\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(m){return e.isEmpty(d._in[m])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._out[m])})},o.prototype.setNodes=function(d,m){var y=arguments,w=this;return e.each(d,function(E){y.length>1?w.setNode(E,m):w.setNode(E)}),this},o.prototype.setNode=function(d,m){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m: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 m=this;if(e.has(this._nodes,d)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){m.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,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=r;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==r)return m}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var m=this._children[d];if(m)return e.keys(m)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var m=this._preds[d];if(m)return e.keys(m)},o.prototype.successors=function(d){var m=this._sucs[d];if(m)return e.keys(m)},o.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return e.union(m,this.successors(d))},o.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},o.prototype.filterNodes=function(d){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,b){d(b)&&m.setNode(b,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function E(_){var b=y.parent(_);return b===void 0||m.hasNode(b)?(w[_]=b,b):b in w?w[b]:E(b)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,E(_))}),m},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,m){var y=this,w=arguments;return e.reduce(d,function(E,_){return w.length>1?y.setEdge(E,_,m):y.setEdge(E,_),_}),this},o.prototype.setEdge=function(){var d,m,y,w,E=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],E=!0)):(d=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],E=!0)),d=""+d,m=""+m,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,m,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(m),this._edgeLabels[b]=E?w:this._defaultEdgeLabelFn(d,m,y);var S=f(this._isDirected,d,m,y);return d=S.v,m=S.w,Object.freeze(S),this._edgeObjs[b]=S,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][b]=S,this._out[d][b]=S,this._edgeCount++,this},o.prototype.edge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y),E=this._edgeObjs[w];return E&&(d=E.v,m=E.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[m],d),u(this._sucs[d],m),delete this._in[m][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,m){var y=this._in[d];if(y){var w=e.values(y);return m?e.filter(w,function(E){return E.v===m}):w}},o.prototype.outEdges=function(d,m){var y=this._out[d];if(y){var w=e.values(y);return m?e.filter(w,function(E){return E.w===m}):w}},o.prototype.nodeEdges=function(d,m){var y=this.inEdges(d,m);if(y)return y.concat(this.outEdges(d,m))};function l(d,m){d[m]?d[m]++:d[m]=1}function u(d,m){--d[m]||delete d[m]}function c(d,m,y,w){var E=""+m,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}return E+i+_+i+(e.isUndefined(w)?n:w)}function f(d,m,y,w){var E=""+m,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}var S={v:E,w:_};return w&&(S.name=w),S}function p(d,m){return c(d,m.v,m.w,m.name)}return Cm}var jm,rk;function XD(){return rk||(rk=1,jm="2.1.8"),jm}var Tm,sk;function QD(){return sk||(sk=1,Tm={Graph:jy(),version:XD()}),Tm}var Rm,ik;function ZD(){if(ik)return Rm;ik=1;var e=Dn(),n=jy();Rm={write:r,read:l};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 l(u){var c=new n(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 Rm}var Am,ok;function JD(){if(ok)return Am;ok=1;var e=Dn();Am=n;function n(r){var i={},o=[],l;function u(c){e.has(i,c)||(i[c]=!0,l.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){l=[],u(c),l.length&&o.push(l)}),o}return Am}var Im,ak;function Dj(){if(ak)return Im;ak=1;var e=Dn();Im=n;function n(){this._arr=[],this._keyIndices={}}return n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map(function(r){return r.key})},n.prototype.has=function(r){return e.has(this._keyIndices,r)},n.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},n.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var l=this._arr,u=l.length;return o[r]=u,l.push({key:r,priority:i}),this._decrease(u),!0}return!1},n.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},n.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)},n.prototype._heapify=function(r){var i=this._arr,o=2*r,l=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,l<i.length&&(u=i[l].priority<i[u].priority?l:u),u!==r&&(this._swap(r,u),this._heapify(u)))},n.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,l;r!==0&&(l=r>>1,!(i[l].priority<o));)this._swap(r,l),r=l},n.prototype._swap=function(r,i){var o=this._arr,l=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,l[c.key]=r,l[u.key]=i},Im}var Mm,lk;function Fj(){if(lk)return Mm;lk=1;var e=Dn(),n=Dj();Mm=i;var r=e.constant(1);function i(l,u,c,f){return o(l,String(u),c||r,f||function(p){return l.outEdges(p)})}function o(l,u,c,f){var p={},d=new n,m,y,w=function(E){var _=E.v!==m?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=m,d.decrease(_,k))};for(l.nodes().forEach(function(E){var _=E===u?0:Number.POSITIVE_INFINITY;p[E]={distance:_},d.add(E,_)});d.size()>0&&(m=d.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return Mm}var Om,uk;function e4(){if(uk)return Om;uk=1;var e=Fj(),n=Dn();Om=r;function r(i,o,l){return n.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return Om}var Pm,ck;function zj(){if(ck)return Pm;ck=1;var e=Dn();Pm=n;function n(r){var i=0,o=[],l={},u=[];function c(f){var p=l[f]={onStack:!0,lowlink:i,index:i++};if(o.push(f),r.successors(f).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var d=[],m;do m=o.pop(),l[m].onStack=!1,d.push(m);while(f!==m);u.push(d)}}return r.nodes().forEach(function(f){e.has(l,f)||c(f)}),u}return Pm}var Lm,dk;function t4(){if(dk)return Lm;dk=1;var e=Dn(),n=zj();Lm=r;function r(i){return e.filter(n(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Lm}var $m,fk;function n4(){if(fk)return $m;fk=1;var e=Dn();$m=r;var n=e.constant(1);function r(o,l,u){return i(o,l||n,u||function(c){return o.outEdges(c)})}function i(o,l,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 m=d.v===p?d.w:d.v,y=l(d);c[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var d=c[p];f.forEach(function(m){var y=c[m];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 $m}var qm,hk;function Bj(){if(hk)return qm;hk=1;var e=Dn();qm=n,n.CycleException=r;function n(i){var o={},l={},u=[];function c(f){if(e.has(l,f))throw new r;e.has(o,f)||(l[f]=!0,o[f]=!0,e.each(i.predecessors(f),c),delete l[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,qm}var Dm,pk;function r4(){if(pk)return Dm;pk=1;var e=Bj();Dm=n;function n(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Dm}var Fm,mk;function Uj(){if(mk)return Fm;mk=1;var e=Dn();Fm=n;function n(i,o,l){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,l==="post",f,u,c)}),c}function r(i,o,l,u,c,f){e.has(u,o)||(u[o]=!0,l||f.push(o),e.each(c(o),function(p){r(i,p,l,u,c,f)}),l&&f.push(o))}return Fm}var zm,gk;function s4(){if(gk)return zm;gk=1;var e=Uj();zm=n;function n(r,i){return e(r,i,"post")}return zm}var Bm,vk;function i4(){if(vk)return Bm;vk=1;var e=Uj();Bm=n;function n(r,i){return e(r,i,"pre")}return Bm}var Um,yk;function o4(){if(yk)return Um;yk=1;var e=Dn(),n=jy(),r=Dj();Um=i;function i(o,l){var u=new n,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 _=l(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 m=!1;f.size()>0;){if(p=f.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+o);m=!0}o.nodeEdges(p).forEach(d)}return u}return Um}var Hm,wk;function a4(){return wk||(wk=1,Hm={components:JD(),dijkstra:Fj(),dijkstraAll:e4(),findCycles:t4(),floydWarshall:n4(),isAcyclic:r4(),postorder:s4(),preorder:i4(),prim:o4(),tarjan:zj(),topsort:Bj()}),Hm}var Wm,xk;function l4(){if(xk)return Wm;xk=1;var e=QD();return Wm={Graph:e.Graph,json:ZD(),alg:a4(),version:e.version},Wm}var Vm,_k;function tr(){if(_k)return Vm;_k=1;var e;if(typeof fy=="function")try{e=l4()}catch{}return e||(e=window.graphlib),Vm=e,Vm}var Gm,bk;function u4(){if(bk)return Gm;bk=1;var e=pj(),n=1,r=4;function i(o){return e(o,n|r)}return Gm=i,Gm}var Ym,Sk;function tc(){if(Sk)return Ym;Sk=1;var e=wo(),n=Br(),r=Vu(),i=qn();function o(l,u,c){if(!i(c))return!1;var f=typeof u;return(f=="number"?n(c)&&r(u,c.length):f=="string"&&u in c)?e(c[u],l):!1}return Ym=o,Ym}var Km,kk;function c4(){if(kk)return Km;kk=1;var e=ec(),n=wo(),r=tc(),i=yi(),o=Object.prototype,l=o.hasOwnProperty,u=e(function(c,f){c=Object(c);var p=-1,d=f.length,m=d>2?f[2]:void 0;for(m&&r(f[0],f[1],m)&&(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||n(S,o[b])&&!l.call(c,b))&&(c[b]=y[b])}return c});return Km=u,Km}var Xm,Ek;function d4(){if(Ek)return Xm;Ek=1;var e=Ur(),n=Br(),r=As();function i(o){return function(l,u,c){var f=Object(l);if(!n(l)){var p=e(u,3);l=r(l),u=function(m){return p(f[m],m,f)}}var d=o(l,u,c);return d>-1?f[p?l[d]:d]:void 0}}return Xm=i,Xm}var Qm,Nk;function f4(){if(Nk)return Qm;Nk=1;var e=/\s/;function n(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return Qm=n,Qm}var Zm,Ck;function h4(){if(Ck)return Zm;Ck=1;var e=f4(),n=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(n,"")}return Zm=r,Zm}var Jm,jk;function p4(){if(jk)return Jm;jk=1;var e=h4(),n=qn(),r=So(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,l=/^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(n(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=n(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||u.test(p)?c(p.slice(2),m?2:8):o.test(p)?i:+p}return Jm=f,Jm}var eg,Tk;function Hj(){if(Tk)return eg;Tk=1;var e=p4(),n=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===n||o===-n){var l=o<0?-1:1;return l*r}return o===o?o:0}return eg=i,eg}var tg,Rk;function m4(){if(Rk)return tg;Rk=1;var e=Hj();function n(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return tg=n,tg}var ng,Ak;function g4(){if(Ak)return ng;Ak=1;var e=Lj(),n=Ur(),r=m4(),i=Math.max;function o(l,u,c){var f=l==null?0:l.length;if(!f)return-1;var p=c==null?0:r(c);return p<0&&(p=i(f+p,0)),e(l,n(u,3),p)}return ng=o,ng}var rg,Ik;function v4(){if(Ik)return rg;Ik=1;var e=d4(),n=g4(),r=e(n);return rg=r,rg}var sg,Mk;function Wj(){if(Mk)return sg;Mk=1;var e=Cy();function n(r){var i=r==null?0:r.length;return i?e(r,1):[]}return sg=n,sg}var ig,Ok;function y4(){if(Ok)return ig;Ok=1;var e=Sy(),n=mj(),r=yi();function i(o,l){return o==null?o:e(o,n(l),r)}return ig=i,ig}var og,Pk;function w4(){if(Pk)return og;Pk=1;function e(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}return og=e,og}var ag,Lk;function x4(){if(Lk)return ag;Lk=1;var e=Hu(),n=ky(),r=Ur();function i(o,l){var u={};return l=r(l,3),n(o,function(c,f,p){e(u,f,l(c,f,p))}),u}return ag=i,ag}var lg,$k;function Ty(){if($k)return lg;$k=1;var e=So();function n(r,i,o){for(var l=-1,u=r.length;++l<u;){var c=r[l],f=i(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return lg=n,lg}var ug,qk;function _4(){if(qk)return ug;qk=1;function e(n,r){return n>r}return ug=e,ug}var cg,Dk;function b4(){if(Dk)return cg;Dk=1;var e=Ty(),n=_4(),r=wi();function i(o){return o&&o.length?e(o,r,n):void 0}return cg=i,cg}var dg,Fk;function Vj(){if(Fk)return dg;Fk=1;var e=Hu(),n=wo();function r(i,o,l){(l!==void 0&&!n(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return dg=r,dg}var fg,zk;function S4(){if(zk)return fg;zk=1;var e=gi(),n=Ku(),r=mr(),i="[object Object]",o=Function.prototype,l=Object.prototype,u=o.toString,c=l.hasOwnProperty,f=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var m=n(d);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==f}return fg=p,fg}var hg,Bk;function Gj(){if(Bk)return hg;Bk=1;function e(n,r){if(!(r==="constructor"&&typeof n[r]=="function")&&r!="__proto__")return n[r]}return hg=e,hg}var pg,Uk;function k4(){if(Uk)return pg;Uk=1;var e=Pa(),n=yi();function r(i){return e(i,n(i))}return pg=r,pg}var mg,Hk;function E4(){if(Hk)return mg;Hk=1;var e=Vj(),n=nj(),r=dj(),i=rj(),o=hj(),l=La(),u=_t(),c=$j(),f=_o(),p=Oa(),d=qn(),m=S4(),y=$a(),w=Gj(),E=k4();function _(b,S,k,N,j,A,M){var O=w(b,k),P=w(S,k),D=M.get(P);if(D){e(b,k,D);return}var L=A?A(O,P,k+"",b,S,M):void 0,U=L===void 0;if(U){var V=u(P),z=!V&&f(P),C=!V&&!z&&y(P);L=P,V||z||C?u(O)?L=O:c(O)?L=i(O):z?(U=!1,L=n(P,!0)):C?(U=!1,L=r(P,!0)):L=[]:m(P)||l(P)?(L=O,l(O)?L=E(O):(!d(O)||p(O))&&(L=o(P))):U=!1}U&&(M.set(P,L),j(L,P,N,A,M),M.delete(P)),e(b,k,L)}return mg=_,mg}var gg,Wk;function N4(){if(Wk)return gg;Wk=1;var e=Uu(),n=Vj(),r=Sy(),i=E4(),o=qn(),l=yi(),u=Gj();function c(f,p,d,m,y){f!==p&&r(p,function(w,E){if(y||(y=new e),o(w))i(f,p,E,d,c,m,y);else{var _=m?m(u(f,E),w,E+"",f,p,y):void 0;_===void 0&&(_=w),n(f,E,_)}},l)}return gg=c,gg}var vg,Vk;function C4(){if(Vk)return vg;Vk=1;var e=ec(),n=tc();function r(i){return e(function(o,l){var u=-1,c=l.length,f=c>1?l[c-1]:void 0,p=c>2?l[2]:void 0;for(f=i.length>3&&typeof f=="function"?(c--,f):void 0,p&&n(l[0],l[1],p)&&(f=c<3?void 0:f,c=1),o=Object(o);++u<c;){var d=l[u];d&&i(o,d,u,f)}return o})}return vg=r,vg}var yg,Gk;function j4(){if(Gk)return yg;Gk=1;var e=N4(),n=C4(),r=n(function(i,o,l){e(i,o,l)});return yg=r,yg}var wg,Yk;function Yj(){if(Yk)return wg;Yk=1;function e(n,r){return n<r}return wg=e,wg}var xg,Kk;function T4(){if(Kk)return xg;Kk=1;var e=Ty(),n=Yj(),r=wi();function i(o){return o&&o.length?e(o,r,n):void 0}return xg=i,xg}var _g,Xk;function R4(){if(Xk)return _g;Xk=1;var e=Ty(),n=Ur(),r=Yj();function i(o,l){return o&&o.length?e(o,n(l,2),r):void 0}return _g=i,_g}var bg,Qk;function A4(){if(Qk)return bg;Qk=1;var e=rr(),n=function(){return e.Date.now()};return bg=n,bg}var Sg,Zk;function I4(){if(Zk)return Sg;Zk=1;var e=Wu(),n=Zu(),r=Vu(),i=qn(),o=qa();function l(u,c,f,p){if(!i(u))return u;c=n(c,u);for(var d=-1,m=c.length,y=m-1,w=u;w!=null&&++d<m;){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 Sg=l,Sg}var kg,Jk;function M4(){if(Jk)return kg;Jk=1;var e=Ju(),n=I4(),r=Zu();function i(o,l,u){for(var c=-1,f=l.length,p={};++c<f;){var d=l[c],m=e(o,d);u(m,d)&&n(p,r(d,o),m)}return p}return kg=i,kg}var Eg,eE;function O4(){if(eE)return Eg;eE=1;var e=M4(),n=Nj();function r(i,o){return e(i,o,function(l,u){return n(i,u)})}return Eg=r,Eg}var Ng,tE;function P4(){if(tE)return Ng;tE=1;var e=Wj(),n=Oj(),r=Pj();function i(o){return r(n(o,void 0,e),o+"")}return Ng=i,Ng}var Cg,nE;function L4(){if(nE)return Cg;nE=1;var e=O4(),n=P4(),r=n(function(i,o){return i==null?{}:e(i,o)});return Cg=r,Cg}var jg,rE;function $4(){if(rE)return jg;rE=1;var e=Math.ceil,n=Math.max;function r(i,o,l,u){for(var c=-1,f=n(e((o-i)/(l||1)),0),p=Array(f);f--;)p[u?f:++c]=i,i+=l;return p}return jg=r,jg}var Tg,sE;function q4(){if(sE)return Tg;sE=1;var e=$4(),n=tc(),r=Hj();function i(o){return function(l,u,c){return c&&typeof c!="number"&&n(l,u,c)&&(u=c=void 0),l=r(l),u===void 0?(u=l,l=0):u=r(u),c=c===void 0?l<u?1:-1:r(c),e(l,u,c,o)}}return Tg=i,Tg}var Rg,iE;function D4(){if(iE)return Rg;iE=1;var e=q4(),n=e();return Rg=n,Rg}var Ag,oE;function F4(){if(oE)return Ag;oE=1;function e(n,r){var i=n.length;for(n.sort(r);i--;)n[i]=n[i].value;return n}return Ag=e,Ag}var Ig,aE;function z4(){if(aE)return Ig;aE=1;var e=So();function n(r,i){if(r!==i){var o=r!==void 0,l=r===null,u=r===r,c=e(r),f=i!==void 0,p=i===null,d=i===i,m=e(i);if(!p&&!m&&!c&&r>i||c&&f&&d&&!p&&!m||l&&f&&d||!o&&d||!u)return 1;if(!l&&!c&&!m&&r<i||m&&o&&u&&!l&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return Ig=n,Ig}var Mg,lE;function B4(){if(lE)return Mg;lE=1;var e=z4();function n(r,i,o){for(var l=-1,u=r.criteria,c=i.criteria,f=u.length,p=o.length;++l<f;){var d=e(u[l],c[l]);if(d){if(l>=p)return d;var m=o[l];return d*(m=="desc"?-1:1)}}return r.index-i.index}return Mg=n,Mg}var Og,uE;function U4(){if(uE)return Og;uE=1;var e=Qu(),n=Ju(),r=Ur(),i=Aj(),o=F4(),l=Gu(),u=B4(),c=wi(),f=_t();function p(d,m,y){m.length?m=e(m,function(_){return f(_)?function(b){return n(b,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var E=i(d,function(_,b,S){var k=e(m,function(N){return N(_)});return{criteria:k,index:++w,value:_}});return o(E,function(_,b){return u(_,b,y)})}return Og=p,Og}var Pg,cE;function H4(){if(cE)return Pg;cE=1;var e=Cy(),n=U4(),r=ec(),i=tc(),o=r(function(l,u){if(l==null)return[];var c=u.length;return c>1&&i(l,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),n(l,e(u,1),[])});return Pg=o,Pg}var Lg,dE;function W4(){if(dE)return Lg;dE=1;var e=kj(),n=0;function r(i){var o=++n;return e(i)+o}return Lg=r,Lg}var $g,fE;function V4(){if(fE)return $g;fE=1;function e(n,r,i){for(var o=-1,l=n.length,u=r.length,c={};++o<l;){var f=o<u?r[o]:void 0;i(c,n[o],f)}return c}return $g=e,$g}var qg,hE;function G4(){if(hE)return qg;hE=1;var e=Wu(),n=V4();function r(i,o){return n(i||[],o||[],e)}return qg=r,qg}var Dg,pE;function at(){if(pE)return Dg;pE=1;var e;if(typeof fy=="function")try{e={cloneDeep:u4(),constant:by(),defaults:c4(),each:vj(),filter:jj(),find:v4(),flatten:Wj(),forEach:gj(),forIn:y4(),has:Tj(),isUndefined:Rj(),last:w4(),map:Ij(),mapValues:x4(),max:b4(),merge:j4(),min:T4(),minBy:R4(),now:A4(),pick:L4(),range:D4(),reduce:Mj(),sortBy:H4(),uniqueId:W4(),values:qj(),zipObject:G4()}}catch{}return e||(e=window._),Dg=e,Dg}var Fg,mE;function Y4(){if(mE)return Fg;mE=1,Fg=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 n(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&n(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,l=o._prev;l!==o;)i.push(JSON.stringify(l,r)),l=l._prev;return"["+i.join(", ")+"]"};function n(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 Fg}var zg,gE;function K4(){if(gE)return zg;gE=1;var e=at(),n=tr().Graph,r=Y4();zg=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var m=c(p,d||i),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,d,m){for(var y=[],w=d[d.length-1],E=d[0],_;p.nodeCount();){for(;_=E.dequeue();)u(p,d,m,_);for(;_=w.dequeue();)u(p,d,m,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,m,_,!0));break}}}return y}function u(p,d,m,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,m,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,k=p.node(S);k.in-=b,f(d,m,k)}),p.removeNode(y.v),E}function c(p,d){var m=new n,y=0,w=0;e.forEach(p.nodes(),function(b){m.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var S=m.edge(b.v,b.w)||0,k=d(b),N=S+k;m.setEdge(b.v,b.w,N),w=Math.max(w,m.node(b.v).out+=k),y=Math.max(y,m.node(b.w).in+=k)});var E=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(b){f(E,_,m.node(b))}),{graph:m,buckets:E,zeroIdx:_}}function f(p,d,m){m.out?m.in?p[m.out-m.in+d].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return zg}var Bg,vE;function X4(){if(vE)return Bg;vE=1;var e=at(),n=K4();Bg={run:r,undo:o};function r(l){var u=l.graph().acyclicer==="greedy"?n(l,c(l)):i(l);e.forEach(u,function(f){var p=l.edge(f);l.removeEdge(f),p.forwardName=f.name,p.reversed=!0,l.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function c(f){return function(p){return f.edge(p).weight}}}function i(l){var u=[],c={},f={};function p(d){e.has(f,d)||(f[d]=!0,c[d]=!0,e.forEach(l.outEdges(d),function(m){e.has(c,m.w)?u.push(m):p(m.w)}),delete c[d])}return e.forEach(l.nodes(),p),u}function o(l){e.forEach(l.edges(),function(u){var c=l.edge(u);if(c.reversed){l.removeEdge(u);var f=c.forwardName;delete c.reversed,delete c.forwardName,l.setEdge(u.w,u.v,c,f)}})}return Bg}var Ug,yE;function fn(){if(yE)return Ug;yE=1;var e=at(),n=tr().Graph;Ug={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:l,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:m,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 n().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 n({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 l(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,O=b.height/2;if(!j&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var P,D;return Math.abs(A)*M>Math.abs(j)*O?(A<0&&(O=-O),P=O*j/A,D=O):(j<0&&(M=-M),P=M,D=M*A/j),{x:k+P,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(O){b.node(O).rank+=N})})}function m(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 Ug}var Hg,wE;function Q4(){if(wE)return Hg;wE=1;var e=at(),n=fn();Hg={run:r,undo:o};function r(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(u){i(l,u)})}function i(l,u){var c=u.v,f=l.node(c).rank,p=u.w,d=l.node(p).rank,m=u.name,y=l.edge(u),w=y.labelRank;if(d!==f+1){l.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=n.addDummyNode(l,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(c,E,{weight:y.weight},m),b===0&&l.graph().dummyChains.push(E),c=E;l.setEdge(c,p,{weight:y.weight},m)}}function o(l){e.forEach(l.graph().dummyChains,function(u){var c=l.node(u),f=c.edgeLabel,p;for(l.setEdge(c.edgeObj,f);c.dummy;)p=l.successors(u)[0],l.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=l.node(u)})}return Hg}var Wg,xE;function ju(){if(xE)return Wg;xE=1;var e=at();Wg={longestPath:n,slack:r};function n(i){var o={};function l(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 l(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(),l)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return Wg}var Vg,_E;function Kj(){if(_E)return Vg;_E=1;var e=at(),n=tr().Graph,r=ju().slack;Vg=i;function i(c){var f=new n({directed:!1}),p=c.nodes()[0],d=c.nodeCount();f.setNode(p,{});for(var m,y;o(f,c)<d;)m=l(f,c),y=f.hasNode(m.v)?r(c,m):-r(c,m),u(f,c,y);return f}function o(c,f){function p(d){e.forEach(f.nodeEdges(d),function(m){var y=m.v,w=d===y?m.w:y;!c.hasNode(w)&&!r(f,m)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function l(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 Vg}var Gg,bE;function Z4(){if(bE)return Gg;bE=1;var e=at(),n=Kj(),r=ju().slack,i=ju().longestPath,o=tr().alg.preorder,l=tr().alg.postorder,u=fn().simplify;Gg=c,c.initLowLimValues=m,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=E,c.exchangeEdges=_;function c(N){N=u(N),i(N);var j=n(N);m(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=l(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),O=M.parent;N.edge(A,O).cutvalue=d(N,j,A)}function d(N,j,A){var M=N.node(A),O=M.parent,P=!0,D=j.edge(A,O),L=0;return D||(P=!1,D=j.edge(O,A)),L=D.weight,e.forEach(j.nodeEdges(A),function(U){var V=U.v===A,z=V?U.w:U.v;if(z!==O){var C=V===P,F=j.edge(U).weight;if(L+=C?F:-F,S(N,A,z)){var $=N.edge(A,z).cutvalue;L+=C?-$:$}}}),L}function m(N,j){arguments.length<2&&(j=N.nodes()[0]),y(N,{},1,j)}function y(N,j,A,M,O){var P=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=P,D.lim=A++,O?D.parent=O: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,O=A.w;j.hasEdge(M,O)||(M=A.w,O=A.v);var P=N.node(M),D=N.node(O),L=P,U=!1;P.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 O=A.v,P=A.w;N.removeEdge(O,P),N.setEdge(M.v,M.w,{}),m(N),f(N,j),b(N,j)}function b(N,j){var A=e.find(N.nodes(),function(O){return!j.node(O).parent}),M=o(N,A);M=M.slice(1),e.forEach(M,function(O){var P=N.node(O).parent,D=j.edge(O,P),L=!1;D||(D=j.edge(P,O),L=!0),j.node(O).rank=j.node(P).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 Gg}var Yg,SE;function J4(){if(SE)return Yg;SE=1;var e=ju(),n=e.longestPath,r=Kj(),i=Z4();Yg=o;function o(f){switch(f.graph().ranker){case"network-simplex":c(f);break;case"tight-tree":u(f);break;case"longest-path":l(f);break;default:c(f)}}var l=n;function u(f){n(f),r(f)}function c(f){i(f)}return Yg}var Kg,kE;function e5(){if(kE)return Kg;kE=1;var e=at();Kg=n;function n(o){var l=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),f=c.edgeObj,p=r(o,l,f.v,f.w),d=p.path,m=p.lca,y=0,w=d[y],E=!0;u!==f.w;){if(c=o.node(u),E){for(;(w=d[y])!==m&&o.node(w).maxRank<c.rank;)y++;w===m&&(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,l,u,c){var f=[],p=[],d=Math.min(l[u].low,l[c].low),m=Math.max(l[u].lim,l[c].lim),y,w;y=u;do y=o.parent(y),f.push(y);while(y&&(l[y].low>d||m>l[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 l={},u=0;function c(f){var p=u;e.forEach(o.children(f),c),l[f]={low:p,lim:u++}}return e.forEach(o.children(),c),l}return Kg}var Xg,EE;function t5(){if(EE)return Xg;EE=1;var e=at(),n=fn();Xg={run:r,cleanup:u};function r(c){var f=n.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,m=2*d+1;c.graph().nestingRoot=f,e.forEach(c.edges(),function(w){c.edge(w).minlen*=m});var y=l(c)+1;e.forEach(c.children(),function(w){i(c,f,m,y,d,p,w)}),c.graph().nodeRankFactor=m}function i(c,f,p,d,m,y,w){var E=c.children(w);if(!E.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=n.addBorderNode(c,"_bt"),b=n.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,m,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,O=j!==A?1:m-y[w]+1;c.setEdge(_,j,{weight:M,minlen:O,nestingEdge:!0}),c.setEdge(A,b,{weight:M,minlen:O,nestingEdge:!0})}),c.parent(w)||c.setEdge(f,_,{weight:0,minlen:m+y[w]})}function o(c){var f={};function p(d,m){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[d]=m}return e.forEach(c.children(),function(d){p(d,1)}),f}function l(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 Xg}var Qg,NE;function n5(){if(NE)return Qg;NE=1;var e=at(),n=fn();Qg=r;function r(o){function l(u){var c=o.children(u),f=o.node(u);if(c.length&&e.forEach(c,l),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(),l)}function i(o,l,u,c,f,p){var d={width:0,height:0,rank:p,borderType:l},m=f[l][p-1],y=n.addDummyNode(o,"border",d,u);f[l][p]=y,o.setParent(y,c),m&&o.setEdge(m,y,{weight:1})}return Qg}var Zg,CE;function r5(){if(CE)return Zg;CE=1;var e=at();Zg={adjust:n,undo:r};function n(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")&&l(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 l(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,u),e.has(m,"y")&&u(m)})}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 m=p.edge(d);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var d=p.x;p.x=p.y,p.y=d}return Zg}var Jg,jE;function s5(){if(jE)return Jg;jE=1;var e=at();Jg=n;function n(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),l=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(l+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 Jg}var ev,TE;function i5(){if(TE)return ev;TE=1;var e=at();ev=n;function n(i,o){for(var l=0,u=1;u<o.length;++u)l+=r(i,o[u-1],o[u]);return l}function r(i,o,l){for(var u=e.zipObject(l,e.map(l,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<l.length;)f<<=1;var p=2*f-1;f-=1;var d=e.map(new Array(p),function(){return 0}),m=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;m+=y.weight*E})),m}return ev}var tv,RE;function o5(){if(RE)return tv;RE=1;var e=at();tv=n;function n(r,i){return e.map(i,function(o){var l=r.inEdges(o);if(l.length){var u=e.reduce(l,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 tv}var nv,AE;function a5(){if(AE)return nv;AE=1;var e=at();nv=n;function n(o,l){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(l.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 l=[];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();l.push(f),e.forEach(f.in.reverse(),u(f)),e.forEach(f.out,c(f))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,l){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),l.weight&&(u+=l.barycenter*l.weight,c+=l.weight),o.vs=l.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(l.i,o.i),l.merged=!0}return nv}var rv,IE;function l5(){if(IE)return rv;IE=1;var e=at(),n=fn();rv=r;function r(l,u){var c=n.partition(l,function(_){return e.has(_,"barycenter")}),f=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],m=0,y=0,w=0;f.sort(o(!!u)),w=i(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var E={vs:e.flatten(d,!0)};return y&&(E.barycenter=m/y,E.weight=y),E}function i(l,u,c){for(var f;u.length&&(f=e.last(u)).i<=c;)u.pop(),l.push(f.vs),c++;return c}function o(l){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:l?c.i-u.i:u.i-c.i}}return rv}var sv,ME;function u5(){if(ME)return sv;ME=1;var e=at(),n=o5(),r=a5(),i=l5();sv=o;function o(c,f,p,d){var m=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,E=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(A){return A!==w&&A!==E}));var b=n(c,m);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);l(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 l(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 sv}var iv,OE;function c5(){if(OE)return iv;OE=1;var e=at(),n=tr().Graph;iv=r;function r(o,l,u){var c=i(o),f=new n({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),m=o.parent(p);(d.rank===l||d.minRank<=l&&l<=d.maxRank)&&(f.setNode(p),f.setParent(p,m||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[l],borderRight:d.borderRight[l]}))}),f}function i(o){for(var l;o.hasNode(l=e.uniqueId("_root")););return l}return iv}var ov,PE;function d5(){if(PE)return ov;PE=1;var e=at();ov=n;function n(r,i,o){var l={},u;e.forEach(o,function(c){for(var f=r.parent(c),p,d;f;){if(p=r.parent(f),p?(d=l[p],l[p]=f):(d=u,u=f),d&&d!==f){i.setEdge(d,f);return}f=p}})}return ov}var av,LE;function f5(){if(LE)return av;LE=1;var e=at(),n=s5(),r=i5(),i=u5(),o=c5(),l=d5(),u=tr().Graph,c=fn();av=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=n(y);m(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)}m(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}),l(_,E,S.vs)})}function m(y,w){e.forEach(w,function(E){e.forEach(E,function(_,b){y.node(_).order=b})})}return av}var lv,$E;function h5(){if($E)return lv;$E=1;var e=at(),n=tr().Graph,r=fn();lv={positionX:E,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(S,k){var N={};function j(A,M){var O=0,P=0,D=A.length,L=e.last(M);return e.forEach(M,function(U,V){var z=l(S,U),C=z?S.node(z).order:D;(z||U===L)&&(e.forEach(M.slice(P,V+1),function(F){e.forEach(S.predecessors(F),function($){var re=S.node($),J=re.order;(J<O||C<J)&&!(re.dummy&&S.node(F).dummy)&&u(N,$,F)})}),P=V+1,O=C)}),M}return e.reduce(k,j),N}function o(S,k){var N={};function j(M,O,P,D,L){var U;e.forEach(e.range(O,P),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,O){var P=-1,D,L=0;return e.forEach(O,function(U,V){if(S.node(U).dummy==="border"){var z=S.predecessors(U);z.length&&(D=S.node(z[0]).order,j(O,L,V,P,D),L=V,P=D)}j(O,L,O.length,D,M.length)}),O}return e.reduce(k,A),N}function l(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={},O={};return e.forEach(k,function(P){e.forEach(P,function(D,L){A[D]=D,M[D]=D,O[D]=L})}),e.forEach(k,function(P){var D=-1;e.forEach(P,function(L){var U=j(L);if(U.length){U=e.sortBy(U,function($){return O[$]});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<O[F]&&!c(N,L,F)&&(M[F]=L,M[L]=A[L]=A[F],D=O[F])}}})}),{root:A,align:M}}function p(S,k,N,j,A){var M={},O=d(S,k,N,A),P=A?"borderLeft":"borderRight";function D(V,z){for(var C=O.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]=O.inEdges(V).reduce(function(z,C){return Math.max(z,M[C.v]+O.edge(C))},0)}function U(V){var z=O.outEdges(V).reduce(function(F,$){return Math.min(F,M[$.w]-O.edge($))},Number.POSITIVE_INFINITY),C=S.node(V);z!==Number.POSITIVE_INFINITY&&C.borderType!==P&&(M[V]=Math.max(M[V],z))}return D(L,O.predecessors.bind(O)),D(U,O.successors.bind(O)),e.forEach(j,function(V){M[V]=M[N[V]]}),M}function d(S,k,N,j){var A=new n,M=S.graph(),O=_(M.nodesep,M.edgesep,j);return e.forEach(k,function(P){var D;e.forEach(P,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(O(S,L,D),z||0))}D=L})}),A}function m(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,O){var P=b(S,O)/2;j=Math.max(M+P,j),A=Math.min(M-P,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(O){var P=M+O,D=S[P],L;if(D!==k){var U=e.values(D);L=O==="l"?j-e.min(U):A-e.max(U),L&&(S[P]=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(O){A=O==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(P){P==="r"&&(A=e.map(A,function(V){return e.values(V).reverse()}));var D=(O==="u"?S.predecessors:S.successors).bind(S),L=f(S,A,N,D),U=p(S,A,L.root,L.align,P==="r");P==="r"&&(U=e.mapValues(U,function(V){return-V})),j[O+P]=U})});var M=m(S,j);return y(j,M),w(j,S.graph().align)}function _(S,k,N){return function(j,A,M){var O=j.node(A),P=j.node(M),D=0,L;if(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}if(L&&(D+=N?L:-L),L=0,D+=(O.dummy?k:S)/2,D+=(P.dummy?k:S)/2,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}return L&&(D+=N?L:-L),L=0,D}}function b(S,k){return S.node(k).width}return lv}var uv,qE;function p5(){if(qE)return uv;qE=1;var e=at(),n=fn(),r=h5().positionX;uv=i;function i(l){l=n.asNonCompoundGraph(l),o(l),e.forEach(r(l),function(u,c){l.node(c).x=u})}function o(l){var u=n.buildLayerMatrix(l),c=l.graph().ranksep,f=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=f+d/2}),f+=d+c})}return uv}var cv,DE;function m5(){if(DE)return cv;DE=1;var e=at(),n=X4(),r=Q4(),i=J4(),o=fn().normalizeRanks,l=e5(),u=fn().removeEmptyRanks,c=t5(),f=n5(),p=r5(),d=f5(),m=p5(),y=fn(),w=tr().Graph;cv=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(){n.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(){l(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(){m(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(){n.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"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},P=["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({},O,G(fe,M),e.pick(fe,P)))}),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 cv}var dv,FE;function g5(){if(FE)return dv;FE=1;var e=at(),n=fn(),r=tr().Graph;dv={debugOrdering:i};function i(o){var l=n.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(l,function(c,f){var p="layer"+f;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,m){return u.setEdge(d,m,{style:"invis"}),m})}),u}return dv}var fv,zE;function v5(){return zE||(zE=1,fv="0.8.5"),fv}var hv,BE;function y5(){return BE||(BE=1,hv={graphlib:tr(),layout:m5(),debug:g5(),util:{time:fn().time,notime:fn().notime},version:v5()}),hv}var w5=y5();const UE=zv(w5),vo=240,Tu=130,uo=74,nc=72,HE=uo+nc;function x5(e,n){var i;let r=vo;for(const o of e)r=Math.max(r,((i=n.get(o.id))==null?void 0:i.width)??vo);return r}const Xj=420,_5=2;function Ea(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function b5(e,n){return((n==null?void 0:n.get(e))??0)>0?Xj:0}function S5(e,n){const r=(n==null?void 0:n.get(e))??0;return r>0?6+r*36:0}function Na(e,n,r){const i=n.get(e);return{w:((i==null?void 0:i.width)??vo)+b5(e,r),h:Math.max((i==null?void 0:i.height)??Tu,S5(e,r))}}function k5(e){return[...e.keys()].sort().map(n=>`${n}:${e.get(n)}`).join("|")}function E5(e,n,r,i,o,l){const u=new UE.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}=Na(S,i,l);u.setNode(S,{width:k,height:N})}for(const S of n)f.has(S.source)&&f.has(S.target)&&u.setEdge(S.source,S.target);UE.layout(u);const p=new Map;let d=1/0,m=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)??vo,A=(N==null?void 0:N.height)??Tu,M=Na(S,i,l),O=k.x-M.w/2,P=k.y-M.h/2;p.set(S,{x:O,y:P}),O<d&&(d=O),P<m&&(m=P),O+j>y&&(y=O+j),P+A>w&&(w=P+A)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[S,k]of p)p.set(S,{x:k.x-d,y:k.y-m});const E=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m: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)??vo,A=(N==null?void 0:N.height)??Tu;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 N5(e,n,r={}){const i=r.direction??"LR",o=r.pinned??new Map,l=r.measured??new Map,u=r.lanes,c=new Map;for(const S of e){const k=Ea(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,...E5(c.get(S),n,i,l,o,u)})),d=x5(e,l),m=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>m&&(k.push([]),N=0),k[k.length-1].push(j),N+=j.height+HE;return k},w=S=>S.reduce((k,N)=>Math.max(k,N.width),0)+Xj;let E=y(r.availableWidth?_5: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[P,D]of j)_.set(P,{x:D.x+b,y:D.y+N});let O=N+A;M&&M.maxY>O&&M.minX<b+k&&b<M.maxX&&(O=M.maxY),N=O+HE}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 C5(e,n,r,i,o){const u=uo+nc,c=60,f=w=>Na(w,i,o),p=new Map(e.map(w=>[w.id,Ea(w)])),d=[],m=e.map(w=>({id:w.id,pos:r.get(w.id)??n.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 m){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,O=A.sid===S?24:u;return E.x<A.x+A.w+M&&A.x<E.x+_+M&&k<A.y+A.h+O&&A.y<k+b+O});if(!j)break;k=j.y+j.h+(j.sid===S?24:u)}k!==E.y&&(n.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 j5(e,n,r,i,o,l){const u=_=>Na(_,i,l),c=_=>r.get(_)??n.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=Ea(_),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,m=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:k}=u(_.id),N=Ea(_);p.has(N)?(d.get(N)??d.set(N,[]).get(N)).push(_):m.push({x:b.x,y:b.y,w:S,h:k})}if(d.size===0)return[];const y=uo+nc,w=(_,b,S,k)=>m.some(N=>_<N.x+N.w+uo&&N.x<_+S+uo&&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,O=[...new Set(m.map(U=>Math.round(U.x)))].sort((U,V)=>U-V),P=O.length?O:[S],D=[0,...m.map(U=>U.y+U.h+y)].sort((U,V)=>U-V);let L=null;e:for(const U of P)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);n.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);m.push({x:V.x,y:V.y,w:z,h:C})}}return E}function T5(e,n,r,i,o,l=!1,u){const p=uo+nc+1,d=8,m=1.75,y=200,w=.7,E=.01,_=L=>Na(L,i,u),b=L=>r.get(L)??n.get(L),S=new Map;for(const L of e){if(!b(L.id))continue;const U=Ea(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(l||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/(vo*Tu));const O=new Map(k.map(L=>[L.sid,L.x])),P=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*m<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-O.get(L.sid),V=L.y-P.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=n.get(z);C&&n.set(z,{x:C.x+U,y:C.y+V})}D.push(L.sid)}}return D}const R5=600;function $v(e,n){return!(e.exitAt!=null&&n-e.exitAt>R5||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function A5(e,n){const r=new Set;for(const i of e.agents.values())$v(i,n)&&r.add(i.id);return r}function I5(e,n,r=0){return e.right+r>n.left&&e.left-r<n.right&&e.bottom+r>n.top&&e.top-r<n.bottom}function M5(e,n,r=0){if(!e)return!1;for(const i of n)if(I5(e,i,r))return!0;return!1}const Qj="sessionGroup";function O5(e,n){var i;if(e.type===Qj)return"transparent";const r=(i=e.data)==null?void 0:i.state;return n(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const P5="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function L5(e){if(e.checkDisabled)return P5;if(e.checking)return"Asking npm for the newest release…";const n=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`${n}${r} · re-checked periodically · click to check npm now`}function $5(e){const n=`Version v${e.running}`;return e.checkDisabled?`${n}, update checks are off`:e.checking?`${n}, checking npm for a newer release`:`${n}, check npm for a newer release`}function q5(e){const n=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}, ${n} — ${e.open?"hide":"show"} the notice`}function D5(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 n=e.trim();return n===""?{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:n,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const qv={kind:"assumed",claude:!0,codex:!0};function F5(e){if(!e||typeof e!="object")return qv;const n=e.providers;if(!n||typeof n!="object")return qv;const r=n;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function Zj(e){const n=Math.max(0,Math.floor(e));return`${n} event${n===1?"":"s"}`}function z5(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${Zj(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 B5(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:`${Zj(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 Jj(e,n){return e!==""&&n>0}function U5(e,n,r){return e===""?{active:!1,matched:n,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:n,total:r,count:`${n} of ${r}`,empty:n===0,message:n===0?`No agents match “${e}”`:null,dim:Jj(e,n)}}const H5="Search agents, tools, model…";function eT(e,n){var i,o,l,u;if(!n)return!0;const r=n.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)||(l=e.firstPrompt)!=null&&l.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 ca(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const W5={agent:mL,sessionGroup:CL},tT="react-flow__node";function WE(e){var n,r;return!!e&&((r=(n=e.classList)==null?void 0:n.contains)==null?void 0:r.call(n,tT))===!0}function V5(e){try{const n=document.querySelector(`.${tT}[data-id="${CSS.escape(e)}"]`);n==null||n.focus({preventScroll:!0})}catch{}}const G5=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),Y5=420,lu=18,K5=200,X5=5*6e4,Q5=6,Z5=2*6e4,Ry="agent-dag.layout",Ay="agent-dag.viewport",nT="agent-dag.summariesDismissed",rT="agent-dag.sessionListOpen",sT="agent-dag.detailOpen",iT="agent-dag.usagePanelOpen",VE="agent-dag.accountsPanelOpen",GE="agent-dag.versionNoticeDismissed",YE="agent-dag.oldNameNoticeDismissed",J5=15*6e4,pv={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:"},KE="agent-dag.autoRestart",XE="agent-dag.bundleReloadedFor";function eF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(rT)==="1"}catch{return!1}}function tF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(rT,e?"1":"0")}catch{}}function nF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sT)==="1"}catch{return!1}}function rF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sT,e?"1":"0")}catch{}}function sF(){const e=GC(iT);return e===null?!0:e==="1"}function iF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(iT,e?"1":"0")}catch{}}function oF(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(nT);if(!e)return new Set;const n=JSON.parse(e);return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function QE(e){if(!(typeof window>"u"))try{const n=Array.from(e),r=n.length>200?n.slice(-200):n;window.localStorage.setItem(nT,JSON.stringify(r))}catch{}}function aF(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(Ry);if(!n)return e;const r=JSON.parse(n);if(!("v"in r)){const o=Object.entries(r).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:o,pins:o.map(([l])=>l)}}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 mv(e,n){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of n)r[i]=o;window.localStorage.setItem(Ry,JSON.stringify({v:2,positions:r,pins:Array.from(n.keys())}))}catch{}}function lF(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Ay);if(!e)return null;const n=JSON.parse(e);return typeof(n==null?void 0:n.x)!="number"||typeof(n==null?void 0:n.y)!="number"||typeof(n==null?void 0:n.zoom)!="number"?null:n}catch{return null}}function uF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Ay,JSON.stringify(e))}catch{}}function ZE(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Ry)}catch{}try{window.localStorage.removeItem(Ay)}catch{}}}function cF(e,n){const r=e.agents.get(n);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===n&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:n,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(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(o,null,2),u=new Blob([l],{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}-${n.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Dv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Fv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},oT=LC;function dF(e,n){if(!n)return null;const r=new Set([n]);let i=n;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),i=l.parentId}let o=!0;for(;o;){o=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),o=!0)}return r}function fF(e,n,r,i,o,l,u,c,f,p,d,m,y,w,E,_,b,S,k){const N=[],j=[],A=new Set;if(l)for(const z of e.agents.values())S.has(z.id)&&eT(z,l)&&A.add(z.id);const M=Jj(l,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:n,onOpenContext:k},className:re,...J?{width:J.width,height:J.height}:null}),z.parentId&&S.has(z.parentId)){const W=iy(z.sessionId),Z=l&&!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 O=new Map;for(const z of e.agents.values())z.tools.length>0&&O.set(z.id,Math.min(4,z.tools.length));const P=`${w}#lanes:${k5(O)}`,D=N.filter(z=>N$(z.id,o,m,y));if(D.length>0||P!==E.current){if(D.length>0){const z=N5(N,j,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:O});for(const C of z)VC(C.id,m,y)&&j$(C.id,C.position,m,y);j5(N,m,o,u,new Set(D.map(C=>C.id)),O)}C5(N,m,o,u,O),E.current=P}const L=T5(N,m,o,u,c,!p||d,O);L.length>0&&f(L),su(m,e.agents),su(y,e.agents),su(o,e.agents),su(u,E$(e.agents.values()));const U=[];let V=!1;for(const z of N){let C=o.get(z.id)??m.get(z.id);C||(C=C$(z.id,m,y),V=!0),U.push({...z,position:C})}return V&&(E.current=""),{nodes:U,edges:j}}function hF(){return g.jsx(sy,{children:g.jsx(pF,{})})}function pF(){var Ga,Ya,Ka,Xa;const e=Aa(),n=R.useRef(Iv()),[,r]=R.useState(0),i=R.useCallback(()=>r(H=>H+1),[]),[o,l]=R.useState(()=>new Set),[u,c]=R.useState(null),[f,p]=R.useState(null),d=R.useCallback((H,Y)=>{l(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)},[]),m=R.useCallback(()=>{l(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(oF()),[j,A]=R.useState(eF);R.useEffect(()=>{tF(j)},[j]);const[M,O]=R.useState(nF);R.useEffect(()=>{rF(M)},[M]);const[P,D]=R.useState(sF);R.useEffect(()=>{iF(P)},[P]);const[L,U]=R.useState(()=>{try{const H=window.localStorage.getItem(VE);return H===null?!0:H==="1"}catch{return!0}});R.useEffect(()=>{try{window.localStorage.setItem(VE,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(GE)??""}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>=J5)},[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(qv);R.useEffect(()=>{let H=!1;return fetch("/api/health").then(Y=>Y.ok?Y.json():null).then(Y=>{H||(_e(F5(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(GE,H)}catch{}},[ye,it,Q]),[De,Je]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(YE)??""}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(YE,Xe)}catch{}}},[Xe]),Qe=((Ga=K==null?void 0:K.upgrade)==null?void 0:Ga.state)??"idle",Pt=p$(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(I$()),[Hr,xi]=R.useState(!1),Wr=R.useCallback(()=>{const H=vr.current,Y=H.setPaused(!H.paused);for(const oe of Y)n.current=Vx(n.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(KE)!=="0"}catch{return!0}}),yr=R.useCallback(()=>{Is(H=>{const Y=!H;try{window.localStorage.setItem(KE,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 n.current.agents.values())if(oe.state==="active"){H=!0;break}const Y=g$({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(XE)}catch{return}const de=h$({bundle:"1.35.39",running:H,pending:Y,lastTried:oe});if(de==="reload"){try{window.sessionStorage.setItem(XE,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&&m$({asked:Ms.current,reported:Pt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1)}},[zn,Pt]);const Ps=R.useRef(aF()).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(()=>lF())[0],[Kt,Kr]=R.useState(""),[Si,nt]=R.useState(()=>new Set),[br,Xr]=R.useState($$),[Ls,Qr]=R.useState(!1),Zr=R.useRef(null);R.useEffect(()=>{document.documentElement.dataset.theme=br;try{window.localStorage.setItem(YC,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=A$(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;n.current=Vx(n.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=MP(n.current,Y,Wx);OP(n.current,Y,Wx)&&(oe=!0),AP(n.current,Y,K5,X5)&&(oe=!0),IP(n.current,Y,Q5,Z5)&&(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))),Ao=Math.max(...jn.map(wt=>We(wt.right))),Ks=Math.min(...jn.map(wt=>ze(wt.top))),Io=Math.max(...jn.map(wt=>ze(wt.bottom))),Qa=Ao-Ys,us=Io-Ks;if(!(Qa>0&&us>0))return;const Zt=Math.max(.2,Math.min(1,(Fe.width-160)/(Qa+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},Mo=e.getViewport();(Math.abs(Mo.zoom-Zt)>.01||Math.abs(Mo.x-wt.x)>2)&&e.setViewport(wt,{duration:0})}catch{}},H+60)}catch{}},[e]),ko=R.useRef(""),Eo=R.useRef(null),Da=R.useRef(0),Sr=R.useCallback(()=>{Da.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,Fa]=R.useState(gn.current),za=R.useCallback(()=>{if(!gn.current){gn.current=!0,Fa(!0);try{window.localStorage.setItem(Jr,"1")}catch{}}},[]),No=R.useCallback(()=>{gn.current=!1,Fa(!1);try{window.localStorage.removeItem(Jr)}catch{}pt(400)},[e,pt]);R.useEffect(()=>{const H=setInterval(()=>{if(gn.current||Date.now()-Da.current<800)return;const Y=n.current,oe=Date.now(),de=[];for(const We of Y.agents.values())$v(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,Ao=jn.y*xe.zoom+xe.y,Ks=(jn.x+ze.width)*xe.zoom+xe.x,Io=(jn.y+ze.height)*xe.zoom+xe.y;if(Ks>0&&Ys<Se&&Io>0&&Ao<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),rc=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(rc),[He,Ba]=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&&Ba(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)),Co=R.useRef(new Set),Ni=R.useRef(""),kr=R.useMemo(()=>{const H=[];for(const Y of n.current.agents.values())$v(Y,ut)&&H.push(Y.id+(Y.parentId?`>${Y.parentId}`:""));return H.sort(),`${H.join("|")}#sv${Ei}.${He}`},[n.current,n.current.lastSeq,ut,Ei,He]),ts=R.useRef(null);R.useEffect(()=>(ts.current!=null&&window.clearTimeout(ts.current),ts.current=window.setTimeout(()=>{mv(Xt.current,Tt.current)},1500),()=>{ts.current!=null&&window.clearTimeout(ts.current)}),[kr]),R.useEffect(()=>{if(ko.current===kr)return;const H=ko.current;if(ko.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=dF(n.current,Y);if(oe)for(const de of oe)H.add(de)}return H.size>0?H:null},[n.current,n.current.lastSeq,o]),Nn=R.useMemo(()=>A5(n.current,ut),[n.current,n.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(G5)!==H.currentTarget||(H.preventDefault(),(de=(oe=document.activeElement)==null?void 0:oe.blur)==null||de.call(oe))},[]),Bs=R.useRef(new Map),[Hn,sc]=R.useState(!1);R.useEffect(()=>{const H=window.setTimeout(()=>sc(!0),2500);return()=>window.clearTimeout(H)},[]);const[Ua,Er]=R.useState(!1),ar=R.useRef(null),[Ci,Us]=R.useState(!1),Ha=R.useCallback(()=>{ar.current&&(window.clearTimeout(ar.current),ar.current=null),Er(!1)},[]),ic=R.useCallback(H=>{H.length!==0&&queueMicrotask(()=>{Er(!0),ar.current&&window.clearTimeout(ar.current),ar.current=window.setTimeout(()=>Er(!1),Y5+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(()=>fF(n.current,ut,ns,rs,Tt.current,Kt,or.current,Bs.current,ic,Hn,Ci,Xt.current,Co.current,kr,Ni,o,Fs,Nn,b),[n.current,n.current.lastSeq,ut,ns,rs,Hn,Ci,Kt,kr,o,Fs,Nn,b,Yt]),Wa=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+lu*2,Se=de.maxY-de.minY+lu*2;Y.push({id:`group:${oe}`,type:Qj,position:{x:de.minX-lu,y:de.minY-lu},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]),oc=R.useMemo(()=>{const H=[...Wa,...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})},[Wa,Qt,Fn]),Nr=R.useMemo(()=>{if(!Kt)return null;const H=new Set;for(const Y of n.current.agents.values())Nn.has(Y.id)&&eT(Y,Kt)&&H.add(Y.id);return H},[n.current,n.current.lastSeq,Kt,Nn]),Cn=R.useMemo(()=>U5(Kt,(Nr==null?void 0:Nr.size)??0,Nn.size),[Kt,Nr,Nn]),ss=R.useMemo(()=>{const H=new Set;for(const Y of n.current.agents.values())for(const oe of Y.tools)H.add(oT(oe.name));return Object.keys(Dv).filter(Y=>H.has(Y))},[n.current,n.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=M5(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 n.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},[n.current,n.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?n.current.agents.get(u):null,os=f?Array.from(n.current.agents.values()).flatMap(H=>H.tools).find(H=>H.id===f)??null:null,jo=R.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=Iv(),Tt.current.clear(),or.current.clear(),Xt.current.clear(),Ni.current="",ZE(),m(),i()},[i,m]),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=y$(H,{confirmOpen:Hs.current,modalOpen:Ws.current});Y==="confirm"?k(!0):Y==="clear"&&(k(!1),jo())},[jo]),$t=R.useCallback(()=>{Tt.current.clear(),Xt.current.clear(),Ni.current="",ZE(),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 To=R.useCallback(H=>{const Y=as.current,oe=x$(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=WE(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}St.current=Date.now(),xe&&V5(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=JP({overlayOpen:Cu.depth()>0,typing:oy(de)});ze==="dismiss"?Cu.dismissTop():ze==="blur"?oe==null||oe.blur():(k$(de)&&(oe==null||oe.blur()),m());return}if(MC(Y))return;const xe=WE(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=b$(Y,Se);if(Pe.kind==="activate"){Y.preventDefault(),d(Pe.nodeId,Pe.additive);return}if(Pe.kind!=="node"&&!(Pe.nodeId==null&&aL(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")&&To(1),(Y.key==="k"||Y.key==="K")&&To(-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,m,d,To,Wr]);const jr=n.current.agents.size,Gs=new Set(Array.from(n.current.agents.values()).map(H=>H.sessionId)).size,tn=R.useMemo(()=>c3(n.current.agents.values()),[n.current,n.current.lastSeq]),Ro=R.useMemo(()=>d3(n.current.agents.values()),[n.current,n.current.lastSeq]),Va=R.useRef(null);R.useEffect(()=>{const H=q$({waiting:tn.length,running:Ro}),Y=Va.current;if(Va.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=D$[H.icon])}},[tn.length,Ro]);const[ac,lc]=R.useState(""),Ri=z$(tn);R.useEffect(()=>{lc(H=>B$(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 n.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}}},[n.current,n.current.lastSeq]);return g.jsxs("div",{className:"app",children:[g.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"logo"}),g.jsx("h1",{children:Gt}),ye?g.jsxs("button",{type:"button",className:"v stale",onClick:Ze,"aria-label":q5({...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,g.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const H={running:(K==null?void 0:K.running)??"1.35.39",latest:K==null?void 0:K.latest,latestPending:K==null?void 0:K.latestPending,checkedAgo:K!=null&&K.checkedAt?Ov(ut-K.checkedAt):null,checkDisabled:K==null?void 0:K.checkDisabled,checking:ce};return g.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":$5(H),title:L5(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"?Eu(H.total,Y):null,de=o.size-1;return g.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:[g.jsx("span",{className:`state-pill state-${Rt.state}`,children:Rt.state==="active"?"live":Rt.state}),g.jsx("span",{className:"selected-label",children:Rt.label}),H.total>0&&g.jsxs("span",{className:"selected-cost",children:[qe(H.total),oe?g.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),de>0&&g.jsxs("span",{className:"selected-extra",children:["+",de]}),g.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:xe=>{xe.stopPropagation(),m()},children:"×"})]})})(),g.jsxs("div",{className:"actions",children:[g.jsxs("div",{className:"search",children:[g.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),g.jsx("input",{ref:Zr,type:"text",placeholder:H5,value:Kt,onChange:H=>Kr(H.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),Kt?g.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Kr(""),children:"×"}):g.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),Cn.count&&g.jsx("span",{className:`search-count${Cn.empty?" none":""}`,"aria-live":"polite",title:`${Cn.count} agents on the canvas match “${Kt}”`,children:Cn.count})]}),g.jsxs("span",{className:"status",children:[(()=>{const H=z5({connected:I,paused:Hr,held:vr.current.size});return g.jsx("span",{className:`pill ${H.tone}`,title:H.title,children:H.label})})(),g.jsxs("span",{className:"stat",title:K$(we),children:[g.jsx("span",{className:"count",children:Gs}),g.jsx("span",{className:"lbl",children:"sessions"})]}),g.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[g.jsx("span",{className:"count",children:jr}),g.jsx("span",{className:"lbl",children:"agents"})]}),g.jsxs("span",{className:"stat",title:X$(we),children:[g.jsx("span",{className:"count",children:n.current.totalEvents}),g.jsx("span",{className:"lbl",children:"events"})]}),nn.sum>0&&g.jsxs("span",{className:"stat",title:`in:${nn.inT.toLocaleString()} out:${nn.outT.toLocaleString()} cache-r:${nn.cacheR.toLocaleString()} cache-c:${nn.cacheC.toLocaleString()}`,children:[g.jsx("span",{className:"count",children:Nt(nn.sum)}),g.jsx("span",{className:"lbl",children:"tokens"})]}),is.length>0&&g.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
72
+ ${n.parked} of your own sound hook${n.parked>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${n.parked>1?"them":"it"} back.`:"";return r+i+o+l}function XC(e){const n=new Map;for(const r of e)for(const i of r.agents??[]){if(!i||typeof i.agent!="string"||i.agent==="")continue;const o=n.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,n.set(i.agent,o)}return[...n.values()].sort((r,i)=>i.cost-r.cost||r.id.localeCompare(i.id))}function J$(e){const n=XC([{agents:e}]);return n.length<2?null:n.map(r=>`${dy(r.id)} ${qe(r.cost)}`).join(" · ")}function b_(e){switch(e.toLowerCase()){case"claude":return"#c4b5fd";case"codex":return"#fdba74";case"gemini":return"#a5b4fc";case"copilot":return"#86efac";default:return"#94a3b8"}}function eq(e,n){if(!(n>0)||!(e>0))return"0%";const r=e/n*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function iu(e){const n=e.toLowerCase();return n.includes("opus")?"#c4b5fd":n.includes("sonnet")?"#7dd3fc":n.includes("haiku")?"#86efac":n.includes("gpt-5")||n.includes("gpt5")?"#fcd34d":n.includes("gpt")?"#fca5a5":n.includes("gemini")?"#a5b4fc":n.includes("codex")?"#fdba74":"#94a3b8"}const tq=[7,14,30,90];function nq(e){const[n,r]=R.useState(null),[i,o]=R.useState(!1),l=R.useRef(U$()).current,u=(c=!1)=>{const f=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${H$(p)}${c?"&refresh=1":""}`;fetch(m).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),()=>l.cancel()),[e]),{landed:n,loading:i,reload:()=>u(!0)}}function rq({onClose:e,providers:n}){var O;const[r,i]=R.useState(30),[o,l]=R.useState(null),{landed:u,loading:c,reload:f}=nq(r),p=R.useRef(null),d=yo(e,{focusRef:p}),m=W$({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((O=u.resp.days)==null?void 0:O.length)??0}}),y=m.phase==="chart"?u.resp.days??[]:[],w=R.useMemo(()=>y.reduce((P,D)=>Math.max(P,D.totalCost),0),[y]),{totalCost:E,totalTok:_,inOut:b,cacheRead:S,modelCosts:k}=R.useMemo(()=>{let P=0,D=0,L=0,U=0;const V=new Map;for(const z of y){P+=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:P,totalTok:D,inOut:L,cacheRead:U,modelCosts:V}},[y]),N=R.useMemo(()=>Array.from(k.entries()).sort((P,D)=>D[1]-P[1]),[k]),j=R.useMemo(()=>XC(y),[y]),A=j.length>1,M=o?y.find(P=>P.period===o)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{ref:d,className:"uh-modal",onClick:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[g.jsxs("header",{className:"uh-head",children:[g.jsxs("div",{className:"uh-titlewrap",children:[g.jsx("div",{className:"uh-title",children:"Usage history"}),g.jsx("div",{className:"uh-sub",children:G$(n,j.map(P=>P.id))})]}),g.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:tq.map(P=>g.jsxs("button",{type:"button","aria-pressed":r===P,className:`uh-range-btn${r===P?" on":""}`,onClick:()=>{i(P),l(null)},children:[P,"d"]},P))}),g.jsx("button",{className:"btn icon-btn uh-reload",onClick:f,disabled:c,title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),g.jsx("button",{ref:p,className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),m.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:u?"running ccusage…":"running ccusage… (first run downloads the package)"}):m.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:go(u.resp)||void 0,children:[W3(u.resp,"ccusage did not report usage"),g.jsx("div",{children:g.jsx("button",{className:"btn uh-retry",onClick:f,disabled:c,children:c?"trying…":"Try again"})})]}):m.phase==="empty"?g.jsx("div",{className:`uh-status${m.stale?" uh-stale":""}`,"aria-busy":m.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:m.stale?"uh-stale":void 0,"aria-busy":m.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(ou,{label:"total cost",val:qe(E),accent:!0}),g.jsx(ou,{label:"tokens",val:Nt(_)}),g.jsx(ou,{label:"input+output",val:Nt(b)}),g.jsx(ou,{label:"cache reads",val:Nt(S)})]}),A&&g.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[g.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:j.map(P=>g.jsx("span",{className:"uh-agent-seg",style:{width:`${E>0?P.cost/E*100:0}%`,background:b_(P.id)}},P.id))}),g.jsx("div",{className:"uh-agent-keys",children:j.map(P=>g.jsxs("span",{className:"uh-agent-key",title:`${P.id} · ${Nt(P.tokens)} tokens`,children:[g.jsx("span",{className:"uh-legend-dot",style:{background:b_(P.id)}}),dy(P.id),g.jsx("span",{className:"uh-agent-cost",children:qe(P.cost)}),g.jsx("span",{className:"uh-agent-share",children:eq(P.cost,E)})]},P.id))})]}),g.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(P=>{const D=w>0?P.totalCost/w*100:0,L=P.period===o,U=`${P.period}, ${qe(P.totalCost)}`;return g.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>l(L?null:P.period),"aria-pressed":L,"aria-label":U,title:`${P.period} · ${qe(P.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(D,P.totalCost>0?2:0)}%`},children:P.modelBreakdowns.slice().sort((V,z)=>z.cost-V.cost).map(V=>{const z=P.totalCost>0?V.cost/P.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${z}%`,background:iu(V.modelName)}},V.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:P.period.slice(5)})]},P.period)})}),g.jsx("div",{className:"uh-legend",children:N.map(([P,D])=>g.jsxs("span",{className:"uh-legend-item",title:P,children:[g.jsx("span",{className:"uh-legend-dot",style:{background:iu(P)}}),Rs(P)," ",g.jsx("span",{className:"uh-legend-cost",children:qe(D)})]},P))}),M&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:M.period}),g.jsx("span",{className:"uh-detail-cost",children:qe(M.totalCost)}),(()=>{var L,U;const D=J$(M.agents)??((U=(L=M.metadata)==null?void 0:L.agents)!=null&&U.length?M.metadata.agents.join(" · "):null);return D?g.jsx("span",{className:"uh-detail-agents",title:D,children:D}):null})()]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(au,{label:"input",val:Nt(M.inputTokens)}),g.jsx(au,{label:"output",val:Nt(M.outputTokens)}),g.jsx(au,{label:"cache write",val:Nt(M.cacheCreationTokens)}),g.jsx(au,{label:"cache read",val:Nt(M.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:M.modelBreakdowns.slice().sort((P,D)=>D.cost-P.cost).map(P=>{const D=M.totalCost>0?P.cost/M.totalCost*100:0;return g.jsxs("div",{className:"uh-model-row",title:P.modelName,children:[g.jsxs("span",{className:"uh-model-name",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:iu(P.modelName)}}),g.jsx("span",{className:"uh-model-label",children:Rs(P.modelName)})]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${D}%`,background:iu(P.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:qe(P.cost)})]},P.modelName)})})]})]})]})})}function ou({label:e,val:n,accent:r}){return g.jsxs("div",{className:"uh-stat",children:[g.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:n}),g.jsx("span",{className:"uh-stat-label",children:e})]})}function au({label:e,val:n}){return g.jsxs("div",{className:"uh-ministat",children:[g.jsx("span",{className:"uh-ministat-val",children:n}),g.jsx("span",{className:"uh-ministat-label",children:e})]})}function fy(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 Xd,S_;function sq(){if(S_)return Xd;S_=1;function e(){this.__data__=[],this.size=0}return Xd=e,Xd}var Qd,k_;function wo(){if(k_)return Qd;k_=1;function e(n,r){return n===r||n!==n&&r!==r}return Qd=e,Qd}var Zd,E_;function Du(){if(E_)return Zd;E_=1;var e=wo();function n(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return Zd=n,Zd}var Jd,N_;function iq(){if(N_)return Jd;N_=1;var e=Du(),n=Array.prototype,r=n.splice;function i(o){var l=this.__data__,u=e(l,o);if(u<0)return!1;var c=l.length-1;return u==c?l.pop():r.call(l,u,1),--this.size,!0}return Jd=i,Jd}var ef,C_;function oq(){if(C_)return ef;C_=1;var e=Du();function n(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return ef=n,ef}var tf,j_;function aq(){if(j_)return tf;j_=1;var e=Du();function n(r){return e(this.__data__,r)>-1}return tf=n,tf}var nf,T_;function lq(){if(T_)return nf;T_=1;var e=Du();function n(r,i){var o=this.__data__,l=e(o,r);return l<0?(++this.size,o.push([r,i])):o[l][1]=i,this}return nf=n,nf}var rf,R_;function Fu(){if(R_)return rf;R_=1;var e=sq(),n=iq(),r=oq(),i=aq(),o=lq();function l(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 l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,rf=l,rf}var sf,A_;function uq(){if(A_)return sf;A_=1;var e=Fu();function n(){this.__data__=new e,this.size=0}return sf=n,sf}var of,I_;function cq(){if(I_)return of;I_=1;function e(n){var r=this.__data__,i=r.delete(n);return this.size=r.size,i}return of=e,of}var af,M_;function dq(){if(M_)return af;M_=1;function e(n){return this.__data__.get(n)}return af=e,af}var lf,O_;function fq(){if(O_)return lf;O_=1;function e(n){return this.__data__.has(n)}return lf=e,lf}var uf,P_;function QC(){if(P_)return uf;P_=1;var e=typeof Hl=="object"&&Hl&&Hl.Object===Object&&Hl;return uf=e,uf}var cf,L_;function rr(){if(L_)return cf;L_=1;var e=QC(),n=typeof self=="object"&&self&&self.Object===Object&&self,r=e||n||Function("return this")();return cf=r,cf}var df,$_;function xo(){if($_)return df;$_=1;var e=rr(),n=e.Symbol;return df=n,df}var ff,q_;function hq(){if(q_)return ff;q_=1;var e=xo(),n=Object.prototype,r=n.hasOwnProperty,i=n.toString,o=e?e.toStringTag:void 0;function l(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 ff=l,ff}var hf,D_;function pq(){if(D_)return hf;D_=1;var e=Object.prototype,n=e.toString;function r(i){return n.call(i)}return hf=r,hf}var pf,F_;function gi(){if(F_)return pf;F_=1;var e=xo(),n=hq(),r=pq(),i="[object Null]",o="[object Undefined]",l=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:l&&l in Object(c)?n(c):r(c)}return pf=u,pf}var mf,z_;function qn(){if(z_)return mf;z_=1;function e(n){var r=typeof n;return n!=null&&(r=="object"||r=="function")}return mf=e,mf}var gf,B_;function Oa(){if(B_)return gf;B_=1;var e=gi(),n=qn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",l="[object Proxy]";function u(c){if(!n(c))return!1;var f=e(c);return f==i||f==o||f==r||f==l}return gf=u,gf}var vf,U_;function mq(){if(U_)return vf;U_=1;var e=rr(),n=e["__core-js_shared__"];return vf=n,vf}var yf,H_;function gq(){if(H_)return yf;H_=1;var e=mq(),n=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!n&&n in i}return yf=r,yf}var wf,W_;function ZC(){if(W_)return wf;W_=1;var e=Function.prototype,n=e.toString;function r(i){if(i!=null){try{return n.call(i)}catch{}try{return i+""}catch{}}return""}return wf=r,wf}var xf,V_;function vq(){if(V_)return xf;V_=1;var e=Oa(),n=gq(),r=qn(),i=ZC(),o=/[\\^$.*+?()[\]{}|]/g,l=/^\[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 m(y){if(!r(y)||n(y))return!1;var w=e(y)?d:l;return w.test(i(y))}return xf=m,xf}var _f,G_;function yq(){if(G_)return _f;G_=1;function e(n,r){return n==null?void 0:n[r]}return _f=e,_f}var bf,Y_;function vi(){if(Y_)return bf;Y_=1;var e=vq(),n=yq();function r(i,o){var l=n(i,o);return e(l)?l:void 0}return bf=r,bf}var Sf,K_;function hy(){if(K_)return Sf;K_=1;var e=vi(),n=rr(),r=e(n,"Map");return Sf=r,Sf}var kf,X_;function zu(){if(X_)return kf;X_=1;var e=vi(),n=e(Object,"create");return kf=n,kf}var Ef,Q_;function wq(){if(Q_)return Ef;Q_=1;var e=zu();function n(){this.__data__=e?e(null):{},this.size=0}return Ef=n,Ef}var Nf,Z_;function xq(){if(Z_)return Nf;Z_=1;function e(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return Nf=e,Nf}var Cf,J_;function _q(){if(J_)return Cf;J_=1;var e=zu(),n="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(l){var u=this.__data__;if(e){var c=u[l];return c===n?void 0:c}return i.call(u,l)?u[l]:void 0}return Cf=o,Cf}var jf,e1;function bq(){if(e1)return jf;e1=1;var e=zu(),n=Object.prototype,r=n.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return jf=i,jf}var Tf,t1;function Sq(){if(t1)return Tf;t1=1;var e=zu(),n="__lodash_hash_undefined__";function r(i,o){var l=this.__data__;return this.size+=this.has(i)?0:1,l[i]=e&&o===void 0?n:o,this}return Tf=r,Tf}var Rf,n1;function kq(){if(n1)return Rf;n1=1;var e=wq(),n=xq(),r=_q(),i=bq(),o=Sq();function l(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 l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Rf=l,Rf}var Af,r1;function Eq(){if(r1)return Af;r1=1;var e=kq(),n=Fu(),r=hy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||n),string:new e}}return Af=i,Af}var If,s1;function Nq(){if(s1)return If;s1=1;function e(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return If=e,If}var Mf,i1;function Bu(){if(i1)return Mf;i1=1;var e=Nq();function n(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return Mf=n,Mf}var Of,o1;function Cq(){if(o1)return Of;o1=1;var e=Bu();function n(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return Of=n,Of}var Pf,a1;function jq(){if(a1)return Pf;a1=1;var e=Bu();function n(r){return e(this,r).get(r)}return Pf=n,Pf}var Lf,l1;function Tq(){if(l1)return Lf;l1=1;var e=Bu();function n(r){return e(this,r).has(r)}return Lf=n,Lf}var $f,u1;function Rq(){if(u1)return $f;u1=1;var e=Bu();function n(r,i){var o=e(this,r),l=o.size;return o.set(r,i),this.size+=o.size==l?0:1,this}return $f=n,$f}var qf,c1;function py(){if(c1)return qf;c1=1;var e=Eq(),n=Cq(),r=jq(),i=Tq(),o=Rq();function l(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 l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,qf=l,qf}var Df,d1;function Aq(){if(d1)return Df;d1=1;var e=Fu(),n=hy(),r=py(),i=200;function o(l,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!n||f.length<i-1)return f.push([l,u]),this.size=++c.size,this;c=this.__data__=new r(f)}return c.set(l,u),this.size=c.size,this}return Df=o,Df}var Ff,f1;function Uu(){if(f1)return Ff;f1=1;var e=Fu(),n=uq(),r=cq(),i=dq(),o=fq(),l=Aq();function u(c){var f=this.__data__=new e(c);this.size=f.size}return u.prototype.clear=n,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=l,Ff=u,Ff}var zf,h1;function my(){if(h1)return zf;h1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o&&r(n[i],i,n)!==!1;);return n}return zf=e,zf}var Bf,p1;function JC(){if(p1)return Bf;p1=1;var e=vi(),n=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Bf=n,Bf}var Uf,m1;function Hu(){if(m1)return Uf;m1=1;var e=JC();function n(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Uf=n,Uf}var Hf,g1;function Wu(){if(g1)return Hf;g1=1;var e=Hu(),n=wo(),r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c){var f=l[u];(!(i.call(l,u)&&n(f,c))||c===void 0&&!(u in l))&&e(l,u,c)}return Hf=o,Hf}var Wf,v1;function Pa(){if(v1)return Wf;v1=1;var e=Wu(),n=Hu();function r(i,o,l,u){var c=!l;l||(l={});for(var f=-1,p=o.length;++f<p;){var d=o[f],m=u?u(l[d],i[d],d,l,i):void 0;m===void 0&&(m=i[d]),c?n(l,d,m):e(l,d,m)}return l}return Wf=r,Wf}var Vf,y1;function Iq(){if(y1)return Vf;y1=1;function e(n,r){for(var i=-1,o=Array(n);++i<n;)o[i]=r(i);return o}return Vf=e,Vf}var Gf,w1;function mr(){if(w1)return Gf;w1=1;function e(n){return n!=null&&typeof n=="object"}return Gf=e,Gf}var Yf,x1;function Mq(){if(x1)return Yf;x1=1;var e=gi(),n=mr(),r="[object Arguments]";function i(o){return n(o)&&e(o)==r}return Yf=i,Yf}var Kf,_1;function La(){if(_1)return Kf;_1=1;var e=Mq(),n=mr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return n(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Kf=l,Kf}var Xf,b1;function _t(){if(b1)return Xf;b1=1;var e=Array.isArray;return Xf=e,Xf}var ha={exports:{}},Qf,S1;function Oq(){if(S1)return Qf;S1=1;function e(){return!1}return Qf=e,Qf}ha.exports;var k1;function _o(){return k1||(k1=1,(function(e,n){var r=rr(),i=Oq(),o=n&&!n.nodeType&&n,l=o&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===o,c=u?r.Buffer:void 0,f=c?c.isBuffer:void 0,p=f||i;e.exports=p})(ha,ha.exports)),ha.exports}var Zf,E1;function Vu(){if(E1)return Zf;E1=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,o){var l=typeof i;return o=o??e,!!o&&(l=="number"||l!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<o}return Zf=r,Zf}var Jf,N1;function gy(){if(N1)return Jf;N1=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Jf=n,Jf}var eh,C1;function Pq(){if(C1)return eh;C1=1;var e=gi(),n=gy(),r=mr(),i="[object Arguments]",o="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",m="[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]",O="[object Uint8Array]",P="[object Uint8ClampedArray]",D="[object Uint16Array]",L="[object Uint32Array]",U={};U[k]=U[N]=U[j]=U[A]=U[M]=U[O]=U[P]=U[D]=U[L]=!0,U[i]=U[o]=U[b]=U[l]=U[S]=U[u]=U[c]=U[f]=U[p]=U[d]=U[m]=U[y]=U[w]=U[E]=U[_]=!1;function V(z){return r(z)&&n(z.length)&&!!U[e(z)]}return eh=V,eh}var th,j1;function Gu(){if(j1)return th;j1=1;function e(n){return function(r){return n(r)}}return th=e,th}var pa={exports:{}};pa.exports;var T1;function vy(){return T1||(T1=1,(function(e,n){var r=QC(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l&&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})(pa,pa.exports)),pa.exports}var nh,R1;function $a(){if(R1)return nh;R1=1;var e=Pq(),n=Gu(),r=vy(),i=r&&r.isTypedArray,o=i?n(i):e;return nh=o,nh}var rh,A1;function ej(){if(A1)return rh;A1=1;var e=Iq(),n=La(),r=_t(),i=_o(),o=Vu(),l=$a(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var m=r(p),y=!m&&n(p),w=!m&&!y&&i(p),E=!m&&!y&&!w&&l(p),_=m||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 rh=f,rh}var sh,I1;function Yu(){if(I1)return sh;I1=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return sh=n,sh}var ih,M1;function tj(){if(M1)return ih;M1=1;function e(n,r){return function(i){return n(r(i))}}return ih=e,ih}var oh,O1;function Lq(){if(O1)return oh;O1=1;var e=tj(),n=e(Object.keys,Object);return oh=n,oh}var ah,P1;function yy(){if(P1)return ah;P1=1;var e=Yu(),n=Lq(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=[];for(var c in Object(l))i.call(l,c)&&c!="constructor"&&u.push(c);return u}return ah=o,ah}var lh,L1;function Br(){if(L1)return lh;L1=1;var e=Oa(),n=gy();function r(i){return i!=null&&n(i.length)&&!e(i)}return lh=r,lh}var uh,$1;function As(){if($1)return uh;$1=1;var e=ej(),n=yy(),r=Br();function i(o){return r(o)?e(o):n(o)}return uh=i,uh}var ch,q1;function $q(){if(q1)return ch;q1=1;var e=Pa(),n=As();function r(i,o){return i&&e(o,n(o),i)}return ch=r,ch}var dh,D1;function qq(){if(D1)return dh;D1=1;function e(n){var r=[];if(n!=null)for(var i in Object(n))r.push(i);return r}return dh=e,dh}var fh,F1;function Dq(){if(F1)return fh;F1=1;var e=qn(),n=Yu(),r=qq(),i=Object.prototype,o=i.hasOwnProperty;function l(u){if(!e(u))return r(u);var c=n(u),f=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||f.push(p);return f}return fh=l,fh}var hh,z1;function yi(){if(z1)return hh;z1=1;var e=ej(),n=Dq(),r=Br();function i(o){return r(o)?e(o,!0):n(o)}return hh=i,hh}var ph,B1;function Fq(){if(B1)return ph;B1=1;var e=Pa(),n=yi();function r(i,o){return i&&e(o,n(o),i)}return ph=r,ph}var ma={exports:{}};ma.exports;var U1;function nj(){return U1||(U1=1,(function(e,n){var r=rr(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function f(p,d){if(d)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(ma,ma.exports)),ma.exports}var mh,H1;function rj(){if(H1)return mh;H1=1;function e(n,r){var i=-1,o=n.length;for(r||(r=Array(o));++i<o;)r[i]=n[i];return r}return mh=e,mh}var gh,W1;function sj(){if(W1)return gh;W1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=0,u=[];++i<o;){var c=n[i];r(c,i,n)&&(u[l++]=c)}return u}return gh=e,gh}var vh,V1;function ij(){if(V1)return vh;V1=1;function e(){return[]}return vh=e,vh}var yh,G1;function wy(){if(G1)return yh;G1=1;var e=sj(),n=ij(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,l=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:n;return yh=l,yh}var wh,Y1;function zq(){if(Y1)return wh;Y1=1;var e=Pa(),n=wy();function r(i,o){return e(i,n(i),o)}return wh=r,wh}var xh,K1;function xy(){if(K1)return xh;K1=1;function e(n,r){for(var i=-1,o=r.length,l=n.length;++i<o;)n[l+i]=r[i];return n}return xh=e,xh}var _h,X1;function Ku(){if(X1)return _h;X1=1;var e=tj(),n=e(Object.getPrototypeOf,Object);return _h=n,_h}var bh,Q1;function oj(){if(Q1)return bh;Q1=1;var e=xy(),n=Ku(),r=wy(),i=ij(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=n(u);return c}:i;return bh=l,bh}var Sh,Z1;function Bq(){if(Z1)return Sh;Z1=1;var e=Pa(),n=oj();function r(i,o){return e(i,n(i),o)}return Sh=r,Sh}var kh,J1;function aj(){if(J1)return kh;J1=1;var e=xy(),n=_t();function r(i,o,l){var u=o(i);return n(i)?u:e(u,l(i))}return kh=r,kh}var Eh,eb;function lj(){if(eb)return Eh;eb=1;var e=aj(),n=wy(),r=As();function i(o){return e(o,r,n)}return Eh=i,Eh}var Nh,tb;function Uq(){if(tb)return Nh;tb=1;var e=aj(),n=oj(),r=yi();function i(o){return e(o,r,n)}return Nh=i,Nh}var Ch,nb;function Hq(){if(nb)return Ch;nb=1;var e=vi(),n=rr(),r=e(n,"DataView");return Ch=r,Ch}var jh,rb;function Wq(){if(rb)return jh;rb=1;var e=vi(),n=rr(),r=e(n,"Promise");return jh=r,jh}var Th,sb;function uj(){if(sb)return Th;sb=1;var e=vi(),n=rr(),r=e(n,"Set");return Th=r,Th}var Rh,ib;function Vq(){if(ib)return Rh;ib=1;var e=vi(),n=rr(),r=e(n,"WeakMap");return Rh=r,Rh}var Ah,ob;function bo(){if(ob)return Ah;ob=1;var e=Hq(),n=hy(),r=Wq(),i=uj(),o=Vq(),l=gi(),u=ZC(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",m="[object WeakMap]",y="[object DataView]",w=u(e),E=u(n),_=u(r),b=u(i),S=u(o),k=l;return(e&&k(new e(new ArrayBuffer(1)))!=y||n&&k(new n)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=m)&&(k=function(N){var j=l(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 m}return j}),Ah=k,Ah}var Ih,ab;function Gq(){if(ab)return Ih;ab=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i){var o=i.length,l=new i.constructor(o);return o&&typeof i[0]=="string"&&n.call(i,"index")&&(l.index=i.index,l.input=i.input),l}return Ih=r,Ih}var Mh,lb;function cj(){if(lb)return Mh;lb=1;var e=rr(),n=e.Uint8Array;return Mh=n,Mh}var Oh,ub;function _y(){if(ub)return Oh;ub=1;var e=cj();function n(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return Oh=n,Oh}var Ph,cb;function Yq(){if(cb)return Ph;cb=1;var e=_y();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Ph=n,Ph}var Lh,db;function Kq(){if(db)return Lh;db=1;var e=/\w*$/;function n(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Lh=n,Lh}var $h,fb;function Xq(){if(fb)return $h;fb=1;var e=xo(),n=e?e.prototype:void 0,r=n?n.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return $h=i,$h}var qh,hb;function dj(){if(hb)return qh;hb=1;var e=_y();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return qh=n,qh}var Dh,pb;function Qq(){if(pb)return Dh;pb=1;var e=_y(),n=Yq(),r=Kq(),i=Xq(),o=dj(),l="[object Boolean]",u="[object Date]",c="[object Map]",f="[object Number]",p="[object RegExp]",d="[object Set]",m="[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]",O="[object Uint32Array]";function P(D,L,U){var V=D.constructor;switch(L){case w:return e(D);case l:case u:return new V(+D);case E:return n(D,U);case _:case b:case S:case k:case N:case j:case A:case M:case O:return o(D,U);case c:return new V;case f:case m:return new V(D);case p:return r(D);case d:return new V;case y:return i(D)}}return Dh=P,Dh}var Fh,mb;function fj(){if(mb)return Fh;mb=1;var e=qn(),n=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(n)return n(o);i.prototype=o;var l=new i;return i.prototype=void 0,l}})();return Fh=r,Fh}var zh,gb;function hj(){if(gb)return zh;gb=1;var e=fj(),n=Ku(),r=Yu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(n(o)):{}}return zh=i,zh}var Bh,vb;function Zq(){if(vb)return Bh;vb=1;var e=bo(),n=mr(),r="[object Map]";function i(o){return n(o)&&e(o)==r}return Bh=i,Bh}var Uh,yb;function Jq(){if(yb)return Uh;yb=1;var e=Zq(),n=Gu(),r=vy(),i=r&&r.isMap,o=i?n(i):e;return Uh=o,Uh}var Hh,wb;function eD(){if(wb)return Hh;wb=1;var e=bo(),n=mr(),r="[object Set]";function i(o){return n(o)&&e(o)==r}return Hh=i,Hh}var Wh,xb;function tD(){if(xb)return Wh;xb=1;var e=eD(),n=Gu(),r=vy(),i=r&&r.isSet,o=i?n(i):e;return Wh=o,Wh}var Vh,_b;function pj(){if(_b)return Vh;_b=1;var e=Uu(),n=my(),r=Wu(),i=$q(),o=Fq(),l=nj(),u=rj(),c=zq(),f=Bq(),p=lj(),d=Uq(),m=bo(),y=Gq(),w=Qq(),E=hj(),_=_t(),b=_o(),S=Jq(),k=qn(),N=tD(),j=As(),A=yi(),M=1,O=2,P=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&O,Ot=_e&P;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=m(we),Pt=Qe==C||Qe==F;if(b(we))return l(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 n(bt||we,function(ht,vt){bt&&(vt=ht,ht=we[vt]),r(De,vt,Ye(ht,_e,Be,vt,we,Ze))}),De}return Vh=Ye,Vh}var Gh,bb;function nD(){if(bb)return Gh;bb=1;var e=pj(),n=4;function r(i){return e(i,n)}return Gh=r,Gh}var Yh,Sb;function by(){if(Sb)return Yh;Sb=1;function e(n){return function(){return n}}return Yh=e,Yh}var Kh,kb;function rD(){if(kb)return Kh;kb=1;function e(n){return function(r,i,o){for(var l=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[n?f:++l];if(i(u[p],p,u)===!1)break}return r}}return Kh=e,Kh}var Xh,Eb;function Sy(){if(Eb)return Xh;Eb=1;var e=rD(),n=e();return Xh=n,Xh}var Qh,Nb;function ky(){if(Nb)return Qh;Nb=1;var e=Sy(),n=As();function r(i,o){return i&&e(i,o,n)}return Qh=r,Qh}var Zh,Cb;function sD(){if(Cb)return Zh;Cb=1;var e=Br();function n(r,i){return function(o,l){if(o==null)return o;if(!e(o))return r(o,l);for(var u=o.length,c=i?u:-1,f=Object(o);(i?c--:++c<u)&&l(f[c],c,f)!==!1;);return o}}return Zh=n,Zh}var Jh,jb;function Xu(){if(jb)return Jh;jb=1;var e=ky(),n=sD(),r=n(e);return Jh=r,Jh}var ep,Tb;function wi(){if(Tb)return ep;Tb=1;function e(n){return n}return ep=e,ep}var tp,Rb;function mj(){if(Rb)return tp;Rb=1;var e=wi();function n(r){return typeof r=="function"?r:e}return tp=n,tp}var np,Ab;function gj(){if(Ab)return np;Ab=1;var e=my(),n=Xu(),r=mj(),i=_t();function o(l,u){var c=i(l)?e:n;return c(l,r(u))}return np=o,np}var rp,Ib;function vj(){return Ib||(Ib=1,rp=gj()),rp}var sp,Mb;function iD(){if(Mb)return sp;Mb=1;var e=Xu();function n(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return sp=n,sp}var ip,Ob;function oD(){if(Ob)return ip;Ob=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return ip=n,ip}var op,Pb;function aD(){if(Pb)return op;Pb=1;function e(n){return this.__data__.has(n)}return op=e,op}var ap,Lb;function yj(){if(Lb)return ap;Lb=1;var e=py(),n=oD(),r=aD();function i(o){var l=-1,u=o==null?0:o.length;for(this.__data__=new e;++l<u;)this.add(o[l])}return i.prototype.add=i.prototype.push=n,i.prototype.has=r,ap=i,ap}var lp,$b;function lD(){if($b)return lp;$b=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o;)if(r(n[i],i,n))return!0;return!1}return lp=e,lp}var up,qb;function wj(){if(qb)return up;qb=1;function e(n,r){return n.has(r)}return up=e,up}var cp,Db;function xj(){if(Db)return cp;Db=1;var e=yj(),n=lD(),r=wj(),i=1,o=2;function l(u,c,f,p,d,m){var y=f&i,w=u.length,E=c.length;if(w!=E&&!(y&&E>w))return!1;var _=m.get(u),b=m.get(c);if(_&&b)return _==c&&b==u;var S=-1,k=!0,N=f&o?new e:void 0;for(m.set(u,c),m.set(c,u);++S<w;){var j=u[S],A=c[S];if(p)var M=y?p(A,j,S,c,u,m):p(j,A,S,u,c,m);if(M!==void 0){if(M)continue;k=!1;break}if(N){if(!n(c,function(O,P){if(!r(N,P)&&(j===O||d(j,O,f,p,m)))return N.push(P)})){k=!1;break}}else if(!(j===A||d(j,A,f,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return cp=l,cp}var dp,Fb;function uD(){if(Fb)return dp;Fb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o,l){i[++r]=[l,o]}),i}return dp=e,dp}var fp,zb;function Ey(){if(zb)return fp;zb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o){i[++r]=o}),i}return fp=e,fp}var hp,Bb;function cD(){if(Bb)return hp;Bb=1;var e=xo(),n=cj(),r=wo(),i=xj(),o=uD(),l=Ey(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",m="[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,O,P,D,L,U,V){switch(P){case k:if(M.byteLength!=O.byteLength||M.byteOffset!=O.byteOffset)return!1;M=M.buffer,O=O.buffer;case S:return!(M.byteLength!=O.byteLength||!U(new n(M),new n(O)));case f:case p:case y:return r(+M,+O);case d:return M.name==O.name&&M.message==O.message;case w:case _:return M==O+"";case m:var z=o;case E:var C=D&u;if(z||(z=l),M.size!=O.size&&!C)return!1;var F=V.get(M);if(F)return F==O;D|=c,V.set(M,O);var $=i(z(M),z(O),D,L,U,V);return V.delete(M),$;case b:if(j)return j.call(M)==j.call(O)}return!1}return hp=A,hp}var pp,Ub;function dD(){if(Ub)return pp;Ub=1;var e=lj(),n=1,r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c,f,p,d){var m=c&n,y=e(l),w=y.length,E=e(u),_=E.length;if(w!=_&&!m)return!1;for(var b=w;b--;){var S=y[b];if(!(m?S in u:i.call(u,S)))return!1}var k=d.get(l),N=d.get(u);if(k&&N)return k==u&&N==l;var j=!0;d.set(l,u),d.set(u,l);for(var A=m;++b<w;){S=y[b];var M=l[S],O=u[S];if(f)var P=m?f(O,M,S,u,l,d):f(M,O,S,l,u,d);if(!(P===void 0?M===O||p(M,O,c,f,d):P)){j=!1;break}A||(A=S=="constructor")}if(j&&!A){var D=l.constructor,L=u.constructor;D!=L&&"constructor"in l&&"constructor"in u&&!(typeof D=="function"&&D instanceof D&&typeof L=="function"&&L instanceof L)&&(j=!1)}return d.delete(l),d.delete(u),j}return pp=o,pp}var mp,Hb;function fD(){if(Hb)return mp;Hb=1;var e=Uu(),n=xj(),r=cD(),i=dD(),o=bo(),l=_t(),u=_o(),c=$a(),f=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function E(_,b,S,k,N,j){var A=l(_),M=l(b),O=A?d:o(_),P=M?d:o(b);O=O==p?m:O,P=P==p?m:P;var D=O==m,L=P==m,U=O==P;if(U&&u(_)){if(!u(b))return!1;A=!0,D=!1}if(U&&!D)return j||(j=new e),A||c(_)?n(_,b,S,k,N,j):r(_,b,O,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 mp=E,mp}var gp,Wb;function _j(){if(Wb)return gp;Wb=1;var e=fD(),n=mr();function r(i,o,l,u,c){return i===o?!0:i==null||o==null||!n(i)&&!n(o)?i!==i&&o!==o:e(i,o,l,u,r,c)}return gp=r,gp}var vp,Vb;function hD(){if(Vb)return vp;Vb=1;var e=Uu(),n=_j(),r=1,i=2;function o(l,u,c,f){var p=c.length,d=p,m=!f;if(l==null)return!d;for(l=Object(l);p--;){var y=c[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<d;){y=c[p];var w=y[0],E=l[w],_=y[1];if(m&&y[2]){if(E===void 0&&!(w in l))return!1}else{var b=new e;if(f)var S=f(E,_,w,l,u,b);if(!(S===void 0?n(_,E,r|i,f,b):S))return!1}}return!0}return vp=o,vp}var yp,Gb;function bj(){if(Gb)return yp;Gb=1;var e=qn();function n(r){return r===r&&!e(r)}return yp=n,yp}var wp,Yb;function pD(){if(Yb)return wp;Yb=1;var e=bj(),n=As();function r(i){for(var o=n(i),l=o.length;l--;){var u=o[l],c=i[u];o[l]=[u,c,e(c)]}return o}return wp=r,wp}var xp,Kb;function Sj(){if(Kb)return xp;Kb=1;function e(n,r){return function(i){return i==null?!1:i[n]===r&&(r!==void 0||n in Object(i))}}return xp=e,xp}var _p,Xb;function mD(){if(Xb)return _p;Xb=1;var e=hD(),n=pD(),r=Sj();function i(o){var l=n(o);return l.length==1&&l[0][2]?r(l[0][0],l[0][1]):function(u){return u===o||e(u,o,l)}}return _p=i,_p}var bp,Qb;function So(){if(Qb)return bp;Qb=1;var e=gi(),n=mr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||n(o)&&e(o)==r}return bp=i,bp}var Sp,Zb;function Ny(){if(Zb)return Sp;Zb=1;var e=_t(),n=So(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(l,u){if(e(l))return!1;var c=typeof l;return c=="number"||c=="symbol"||c=="boolean"||l==null||n(l)?!0:i.test(l)||!r.test(l)||u!=null&&l in Object(u)}return Sp=o,Sp}var kp,Jb;function gD(){if(Jb)return kp;Jb=1;var e=py(),n="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(n);var l=function(){var u=arguments,c=o?o.apply(this,u):u[0],f=l.cache;if(f.has(c))return f.get(c);var p=i.apply(this,u);return l.cache=f.set(c,p)||f,p};return l.cache=new(r.Cache||e),l}return r.Cache=e,kp=r,kp}var Ep,eS;function vD(){if(eS)return Ep;eS=1;var e=gD(),n=500;function r(i){var o=e(i,function(u){return l.size===n&&l.clear(),u}),l=o.cache;return o}return Ep=r,Ep}var Np,tS;function yD(){if(tS)return Np;tS=1;var e=vD(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(n,function(u,c,f,p){l.push(f?p.replace(r,"$1"):c||u)}),l});return Np=i,Np}var Cp,nS;function Qu(){if(nS)return Cp;nS=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=Array(o);++i<o;)l[i]=r(n[i],i,n);return l}return Cp=e,Cp}var jp,rS;function wD(){if(rS)return jp;rS=1;var e=xo(),n=Qu(),r=_t(),i=So(),o=e?e.prototype:void 0,l=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return n(c,u)+"";if(i(c))return l?l.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return jp=u,jp}var Tp,sS;function kj(){if(sS)return Tp;sS=1;var e=wD();function n(r){return r==null?"":e(r)}return Tp=n,Tp}var Rp,iS;function Zu(){if(iS)return Rp;iS=1;var e=_t(),n=Ny(),r=yD(),i=kj();function o(l,u){return e(l)?l:n(l,u)?[l]:r(i(l))}return Rp=o,Rp}var Ap,oS;function qa(){if(oS)return Ap;oS=1;var e=So();function n(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Ap=n,Ap}var Ip,aS;function Ju(){if(aS)return Ip;aS=1;var e=Zu(),n=qa();function r(i,o){o=e(o,i);for(var l=0,u=o.length;i!=null&&l<u;)i=i[n(o[l++])];return l&&l==u?i:void 0}return Ip=r,Ip}var Mp,lS;function xD(){if(lS)return Mp;lS=1;var e=Ju();function n(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return Mp=n,Mp}var Op,uS;function _D(){if(uS)return Op;uS=1;function e(n,r){return n!=null&&r in Object(n)}return Op=e,Op}var Pp,cS;function Ej(){if(cS)return Pp;cS=1;var e=Zu(),n=La(),r=_t(),i=Vu(),o=gy(),l=qa();function u(c,f,p){f=e(f,c);for(var d=-1,m=f.length,y=!1;++d<m;){var w=l(f[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=m?y:(m=c==null?0:c.length,!!m&&o(m)&&i(w,m)&&(r(c)||n(c)))}return Pp=u,Pp}var Lp,dS;function Nj(){if(dS)return Lp;dS=1;var e=_D(),n=Ej();function r(i,o){return i!=null&&n(i,o,e)}return Lp=r,Lp}var $p,fS;function bD(){if(fS)return $p;fS=1;var e=_j(),n=xD(),r=Nj(),i=Ny(),o=bj(),l=Sj(),u=qa(),c=1,f=2;function p(d,m){return i(d)&&o(m)?l(u(d),m):function(y){var w=n(y,d);return w===void 0&&w===m?r(y,d):e(m,w,c|f)}}return $p=p,$p}var qp,hS;function Cj(){if(hS)return qp;hS=1;function e(n){return function(r){return r==null?void 0:r[n]}}return qp=e,qp}var Dp,pS;function SD(){if(pS)return Dp;pS=1;var e=Ju();function n(r){return function(i){return e(i,r)}}return Dp=n,Dp}var Fp,mS;function kD(){if(mS)return Fp;mS=1;var e=Cj(),n=SD(),r=Ny(),i=qa();function o(l){return r(l)?e(i(l)):n(l)}return Fp=o,Fp}var zp,gS;function Ur(){if(gS)return zp;gS=1;var e=mD(),n=bD(),r=wi(),i=_t(),o=kD();function l(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?n(u[0],u[1]):e(u):o(u)}return zp=l,zp}var Bp,vS;function jj(){if(vS)return Bp;vS=1;var e=sj(),n=iD(),r=Ur(),i=_t();function o(l,u){var c=i(l)?e:n;return c(l,r(u,3))}return Bp=o,Bp}var Up,yS;function ED(){if(yS)return Up;yS=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i,o){return i!=null&&n.call(i,o)}return Up=r,Up}var Hp,wS;function Tj(){if(wS)return Hp;wS=1;var e=ED(),n=Ej();function r(i,o){return i!=null&&n(i,o,e)}return Hp=r,Hp}var Wp,xS;function ND(){if(xS)return Wp;xS=1;var e=yy(),n=bo(),r=La(),i=_t(),o=Br(),l=_o(),u=Yu(),c=$a(),f="[object Map]",p="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||c(w)||r(w)))return!w.length;var E=n(w);if(E==f||E==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return Wp=y,Wp}var Vp,_S;function Rj(){if(_S)return Vp;_S=1;function e(n){return n===void 0}return Vp=e,Vp}var Gp,bS;function Aj(){if(bS)return Gp;bS=1;var e=Xu(),n=Br();function r(i,o){var l=-1,u=n(i)?Array(i.length):[];return e(i,function(c,f,p){u[++l]=o(c,f,p)}),u}return Gp=r,Gp}var Yp,SS;function Ij(){if(SS)return Yp;SS=1;var e=Qu(),n=Ur(),r=Aj(),i=_t();function o(l,u){var c=i(l)?e:r;return c(l,n(u,3))}return Yp=o,Yp}var Kp,kS;function CD(){if(kS)return Kp;kS=1;function e(n,r,i,o){var l=-1,u=n==null?0:n.length;for(o&&u&&(i=n[++l]);++l<u;)i=r(i,n[l],l,n);return i}return Kp=e,Kp}var Xp,ES;function jD(){if(ES)return Xp;ES=1;function e(n,r,i,o,l){return l(n,function(u,c,f){i=o?(o=!1,u):r(i,u,c,f)}),i}return Xp=e,Xp}var Qp,NS;function Mj(){if(NS)return Qp;NS=1;var e=CD(),n=Xu(),r=Ur(),i=jD(),o=_t();function l(u,c,f){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),f,d,n)}return Qp=l,Qp}var Zp,CS;function TD(){if(CS)return Zp;CS=1;var e=gi(),n=_t(),r=mr(),i="[object String]";function o(l){return typeof l=="string"||!n(l)&&r(l)&&e(l)==i}return Zp=o,Zp}var Jp,jS;function RD(){if(jS)return Jp;jS=1;var e=Cj(),n=e("length");return Jp=n,Jp}var em,TS;function AD(){if(TS)return em;TS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+l+"]");function f(p){return c.test(p)}return em=f,em}var tm,RS;function ID(){if(RS)return tm;RS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+f+")",d="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",E=p+"?",_="["+l+"]?",b="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+E+")*",S=_+E+b,k="(?:"+[d+c+"?",c,m,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 tm=j,tm}var nm,AS;function MD(){if(AS)return nm;AS=1;var e=RD(),n=AD(),r=ID();function i(o){return n(o)?r(o):e(o)}return nm=i,nm}var rm,IS;function OD(){if(IS)return rm;IS=1;var e=yy(),n=bo(),r=Br(),i=TD(),o=MD(),l="[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=n(f);return p==l||p==u?f.size:e(f).length}return rm=c,rm}var sm,MS;function PD(){if(MS)return sm;MS=1;var e=my(),n=fj(),r=ky(),i=Ur(),o=Ku(),l=_t(),u=_o(),c=Oa(),f=qn(),p=$a();function d(m,y,w){var E=l(m),_=E||u(m)||p(m);if(y=i(y,4),w==null){var b=m&&m.constructor;_?w=E?new b:[]:f(m)?w=c(b)?n(o(m)):{}:w={}}return(_?e:r)(m,function(S,k,N){return y(w,S,k,N)}),w}return sm=d,sm}var im,OS;function LD(){if(OS)return im;OS=1;var e=xo(),n=La(),r=_t(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||n(l)||!!(i&&l&&l[i])}return im=o,im}var om,PS;function Cy(){if(PS)return om;PS=1;var e=xy(),n=LD();function r(i,o,l,u,c){var f=-1,p=i.length;for(l||(l=n),c||(c=[]);++f<p;){var d=i[f];o>0&&l(d)?o>1?r(d,o-1,l,u,c):e(c,d):u||(c[c.length]=d)}return c}return om=r,om}var am,LS;function $D(){if(LS)return am;LS=1;function e(n,r,i){switch(i.length){case 0:return n.call(r);case 1:return n.call(r,i[0]);case 2:return n.call(r,i[0],i[1]);case 3:return n.call(r,i[0],i[1],i[2])}return n.apply(r,i)}return am=e,am}var lm,$S;function Oj(){if($S)return lm;$S=1;var e=$D(),n=Math.max;function r(i,o,l){return o=n(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,f=n(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]=l(p),e(i,this,d)}}return lm=r,lm}var um,qS;function qD(){if(qS)return um;qS=1;var e=by(),n=JC(),r=wi(),i=n?function(o,l){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return um=i,um}var cm,DS;function DD(){if(DS)return cm;DS=1;var e=800,n=16,r=Date.now;function i(o){var l=0,u=0;return function(){var c=r(),f=n-(c-u);if(u=c,f>0){if(++l>=e)return arguments[0]}else l=0;return o.apply(void 0,arguments)}}return cm=i,cm}var dm,FS;function Pj(){if(FS)return dm;FS=1;var e=qD(),n=DD(),r=n(e);return dm=r,dm}var fm,zS;function ec(){if(zS)return fm;zS=1;var e=wi(),n=Oj(),r=Pj();function i(o,l){return r(n(o,l,e),o+"")}return fm=i,fm}var hm,BS;function Lj(){if(BS)return hm;BS=1;function e(n,r,i,o){for(var l=n.length,u=i+(o?1:-1);o?u--:++u<l;)if(r(n[u],u,n))return u;return-1}return hm=e,hm}var pm,US;function FD(){if(US)return pm;US=1;function e(n){return n!==n}return pm=e,pm}var mm,HS;function zD(){if(HS)return mm;HS=1;function e(n,r,i){for(var o=i-1,l=n.length;++o<l;)if(n[o]===r)return o;return-1}return mm=e,mm}var gm,WS;function BD(){if(WS)return gm;WS=1;var e=Lj(),n=FD(),r=zD();function i(o,l,u){return l===l?r(o,l,u):e(o,n,u)}return gm=i,gm}var vm,VS;function UD(){if(VS)return vm;VS=1;var e=BD();function n(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return vm=n,vm}var ym,GS;function HD(){if(GS)return ym;GS=1;function e(n,r,i){for(var o=-1,l=n==null?0:n.length;++o<l;)if(i(r,n[o]))return!0;return!1}return ym=e,ym}var wm,YS;function WD(){if(YS)return wm;YS=1;function e(){}return wm=e,wm}var xm,KS;function VD(){if(KS)return xm;KS=1;var e=uj(),n=WD(),r=Ey(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:n;return xm=o,xm}var _m,XS;function GD(){if(XS)return _m;XS=1;var e=yj(),n=UD(),r=HD(),i=wj(),o=VD(),l=Ey(),u=200;function c(f,p,d){var m=-1,y=n,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 l(S);E=!1,y=i,b=new e}else b=p?[]:_;e:for(;++m<w;){var k=f[m],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 _m=c,_m}var bm,QS;function $j(){if(QS)return bm;QS=1;var e=Br(),n=mr();function r(i){return n(i)&&e(i)}return bm=r,bm}var Sm,ZS;function YD(){if(ZS)return Sm;ZS=1;var e=Cy(),n=ec(),r=GD(),i=$j(),o=n(function(l){return r(e(l,1,i,!0))});return Sm=o,Sm}var km,JS;function KD(){if(JS)return km;JS=1;var e=Qu();function n(r,i){return e(i,function(o){return r[o]})}return km=n,km}var Em,ek;function qj(){if(ek)return Em;ek=1;var e=KD(),n=As();function r(i){return i==null?[]:e(i,n(i))}return Em=r,Em}var Nm,tk;function Dn(){if(tk)return Nm;tk=1;var e;if(typeof fy=="function")try{e={clone:nD(),constant:by(),each:vj(),filter:jj(),has:Tj(),isArray:_t(),isEmpty:ND(),isFunction:Oa(),isUndefined:Rj(),keys:As(),map:Ij(),reduce:Mj(),size:OD(),transform:PD(),union:YD(),values:qj()}}catch{}return e||(e=window._),Nm=e,Nm}var Cm,nk;function jy(){if(nk)return Cm;nk=1;var e=Dn();Cm=o;var n="\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(m){return e.isEmpty(d._in[m])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._out[m])})},o.prototype.setNodes=function(d,m){var y=arguments,w=this;return e.each(d,function(E){y.length>1?w.setNode(E,m):w.setNode(E)}),this},o.prototype.setNode=function(d,m){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m: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 m=this;if(e.has(this._nodes,d)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){m.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,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=r;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==r)return m}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var m=this._children[d];if(m)return e.keys(m)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var m=this._preds[d];if(m)return e.keys(m)},o.prototype.successors=function(d){var m=this._sucs[d];if(m)return e.keys(m)},o.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return e.union(m,this.successors(d))},o.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},o.prototype.filterNodes=function(d){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,b){d(b)&&m.setNode(b,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function E(_){var b=y.parent(_);return b===void 0||m.hasNode(b)?(w[_]=b,b):b in w?w[b]:E(b)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,E(_))}),m},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,m){var y=this,w=arguments;return e.reduce(d,function(E,_){return w.length>1?y.setEdge(E,_,m):y.setEdge(E,_),_}),this},o.prototype.setEdge=function(){var d,m,y,w,E=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],E=!0)):(d=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],E=!0)),d=""+d,m=""+m,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,m,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(m),this._edgeLabels[b]=E?w:this._defaultEdgeLabelFn(d,m,y);var S=f(this._isDirected,d,m,y);return d=S.v,m=S.w,Object.freeze(S),this._edgeObjs[b]=S,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][b]=S,this._out[d][b]=S,this._edgeCount++,this},o.prototype.edge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y),E=this._edgeObjs[w];return E&&(d=E.v,m=E.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[m],d),u(this._sucs[d],m),delete this._in[m][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,m){var y=this._in[d];if(y){var w=e.values(y);return m?e.filter(w,function(E){return E.v===m}):w}},o.prototype.outEdges=function(d,m){var y=this._out[d];if(y){var w=e.values(y);return m?e.filter(w,function(E){return E.w===m}):w}},o.prototype.nodeEdges=function(d,m){var y=this.inEdges(d,m);if(y)return y.concat(this.outEdges(d,m))};function l(d,m){d[m]?d[m]++:d[m]=1}function u(d,m){--d[m]||delete d[m]}function c(d,m,y,w){var E=""+m,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}return E+i+_+i+(e.isUndefined(w)?n:w)}function f(d,m,y,w){var E=""+m,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}var S={v:E,w:_};return w&&(S.name=w),S}function p(d,m){return c(d,m.v,m.w,m.name)}return Cm}var jm,rk;function XD(){return rk||(rk=1,jm="2.1.8"),jm}var Tm,sk;function QD(){return sk||(sk=1,Tm={Graph:jy(),version:XD()}),Tm}var Rm,ik;function ZD(){if(ik)return Rm;ik=1;var e=Dn(),n=jy();Rm={write:r,read:l};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 l(u){var c=new n(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 Rm}var Am,ok;function JD(){if(ok)return Am;ok=1;var e=Dn();Am=n;function n(r){var i={},o=[],l;function u(c){e.has(i,c)||(i[c]=!0,l.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){l=[],u(c),l.length&&o.push(l)}),o}return Am}var Im,ak;function Dj(){if(ak)return Im;ak=1;var e=Dn();Im=n;function n(){this._arr=[],this._keyIndices={}}return n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map(function(r){return r.key})},n.prototype.has=function(r){return e.has(this._keyIndices,r)},n.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},n.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var l=this._arr,u=l.length;return o[r]=u,l.push({key:r,priority:i}),this._decrease(u),!0}return!1},n.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},n.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)},n.prototype._heapify=function(r){var i=this._arr,o=2*r,l=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,l<i.length&&(u=i[l].priority<i[u].priority?l:u),u!==r&&(this._swap(r,u),this._heapify(u)))},n.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,l;r!==0&&(l=r>>1,!(i[l].priority<o));)this._swap(r,l),r=l},n.prototype._swap=function(r,i){var o=this._arr,l=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,l[c.key]=r,l[u.key]=i},Im}var Mm,lk;function Fj(){if(lk)return Mm;lk=1;var e=Dn(),n=Dj();Mm=i;var r=e.constant(1);function i(l,u,c,f){return o(l,String(u),c||r,f||function(p){return l.outEdges(p)})}function o(l,u,c,f){var p={},d=new n,m,y,w=function(E){var _=E.v!==m?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=m,d.decrease(_,k))};for(l.nodes().forEach(function(E){var _=E===u?0:Number.POSITIVE_INFINITY;p[E]={distance:_},d.add(E,_)});d.size()>0&&(m=d.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return Mm}var Om,uk;function e4(){if(uk)return Om;uk=1;var e=Fj(),n=Dn();Om=r;function r(i,o,l){return n.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return Om}var Pm,ck;function zj(){if(ck)return Pm;ck=1;var e=Dn();Pm=n;function n(r){var i=0,o=[],l={},u=[];function c(f){var p=l[f]={onStack:!0,lowlink:i,index:i++};if(o.push(f),r.successors(f).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var d=[],m;do m=o.pop(),l[m].onStack=!1,d.push(m);while(f!==m);u.push(d)}}return r.nodes().forEach(function(f){e.has(l,f)||c(f)}),u}return Pm}var Lm,dk;function t4(){if(dk)return Lm;dk=1;var e=Dn(),n=zj();Lm=r;function r(i){return e.filter(n(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Lm}var $m,fk;function n4(){if(fk)return $m;fk=1;var e=Dn();$m=r;var n=e.constant(1);function r(o,l,u){return i(o,l||n,u||function(c){return o.outEdges(c)})}function i(o,l,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 m=d.v===p?d.w:d.v,y=l(d);c[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var d=c[p];f.forEach(function(m){var y=c[m];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 $m}var qm,hk;function Bj(){if(hk)return qm;hk=1;var e=Dn();qm=n,n.CycleException=r;function n(i){var o={},l={},u=[];function c(f){if(e.has(l,f))throw new r;e.has(o,f)||(l[f]=!0,o[f]=!0,e.each(i.predecessors(f),c),delete l[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,qm}var Dm,pk;function r4(){if(pk)return Dm;pk=1;var e=Bj();Dm=n;function n(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Dm}var Fm,mk;function Uj(){if(mk)return Fm;mk=1;var e=Dn();Fm=n;function n(i,o,l){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,l==="post",f,u,c)}),c}function r(i,o,l,u,c,f){e.has(u,o)||(u[o]=!0,l||f.push(o),e.each(c(o),function(p){r(i,p,l,u,c,f)}),l&&f.push(o))}return Fm}var zm,gk;function s4(){if(gk)return zm;gk=1;var e=Uj();zm=n;function n(r,i){return e(r,i,"post")}return zm}var Bm,vk;function i4(){if(vk)return Bm;vk=1;var e=Uj();Bm=n;function n(r,i){return e(r,i,"pre")}return Bm}var Um,yk;function o4(){if(yk)return Um;yk=1;var e=Dn(),n=jy(),r=Dj();Um=i;function i(o,l){var u=new n,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 _=l(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 m=!1;f.size()>0;){if(p=f.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+o);m=!0}o.nodeEdges(p).forEach(d)}return u}return Um}var Hm,wk;function a4(){return wk||(wk=1,Hm={components:JD(),dijkstra:Fj(),dijkstraAll:e4(),findCycles:t4(),floydWarshall:n4(),isAcyclic:r4(),postorder:s4(),preorder:i4(),prim:o4(),tarjan:zj(),topsort:Bj()}),Hm}var Wm,xk;function l4(){if(xk)return Wm;xk=1;var e=QD();return Wm={Graph:e.Graph,json:ZD(),alg:a4(),version:e.version},Wm}var Vm,_k;function tr(){if(_k)return Vm;_k=1;var e;if(typeof fy=="function")try{e=l4()}catch{}return e||(e=window.graphlib),Vm=e,Vm}var Gm,bk;function u4(){if(bk)return Gm;bk=1;var e=pj(),n=1,r=4;function i(o){return e(o,n|r)}return Gm=i,Gm}var Ym,Sk;function tc(){if(Sk)return Ym;Sk=1;var e=wo(),n=Br(),r=Vu(),i=qn();function o(l,u,c){if(!i(c))return!1;var f=typeof u;return(f=="number"?n(c)&&r(u,c.length):f=="string"&&u in c)?e(c[u],l):!1}return Ym=o,Ym}var Km,kk;function c4(){if(kk)return Km;kk=1;var e=ec(),n=wo(),r=tc(),i=yi(),o=Object.prototype,l=o.hasOwnProperty,u=e(function(c,f){c=Object(c);var p=-1,d=f.length,m=d>2?f[2]:void 0;for(m&&r(f[0],f[1],m)&&(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||n(S,o[b])&&!l.call(c,b))&&(c[b]=y[b])}return c});return Km=u,Km}var Xm,Ek;function d4(){if(Ek)return Xm;Ek=1;var e=Ur(),n=Br(),r=As();function i(o){return function(l,u,c){var f=Object(l);if(!n(l)){var p=e(u,3);l=r(l),u=function(m){return p(f[m],m,f)}}var d=o(l,u,c);return d>-1?f[p?l[d]:d]:void 0}}return Xm=i,Xm}var Qm,Nk;function f4(){if(Nk)return Qm;Nk=1;var e=/\s/;function n(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return Qm=n,Qm}var Zm,Ck;function h4(){if(Ck)return Zm;Ck=1;var e=f4(),n=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(n,"")}return Zm=r,Zm}var Jm,jk;function p4(){if(jk)return Jm;jk=1;var e=h4(),n=qn(),r=So(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,l=/^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(n(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=n(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||u.test(p)?c(p.slice(2),m?2:8):o.test(p)?i:+p}return Jm=f,Jm}var eg,Tk;function Hj(){if(Tk)return eg;Tk=1;var e=p4(),n=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===n||o===-n){var l=o<0?-1:1;return l*r}return o===o?o:0}return eg=i,eg}var tg,Rk;function m4(){if(Rk)return tg;Rk=1;var e=Hj();function n(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return tg=n,tg}var ng,Ak;function g4(){if(Ak)return ng;Ak=1;var e=Lj(),n=Ur(),r=m4(),i=Math.max;function o(l,u,c){var f=l==null?0:l.length;if(!f)return-1;var p=c==null?0:r(c);return p<0&&(p=i(f+p,0)),e(l,n(u,3),p)}return ng=o,ng}var rg,Ik;function v4(){if(Ik)return rg;Ik=1;var e=d4(),n=g4(),r=e(n);return rg=r,rg}var sg,Mk;function Wj(){if(Mk)return sg;Mk=1;var e=Cy();function n(r){var i=r==null?0:r.length;return i?e(r,1):[]}return sg=n,sg}var ig,Ok;function y4(){if(Ok)return ig;Ok=1;var e=Sy(),n=mj(),r=yi();function i(o,l){return o==null?o:e(o,n(l),r)}return ig=i,ig}var og,Pk;function w4(){if(Pk)return og;Pk=1;function e(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}return og=e,og}var ag,Lk;function x4(){if(Lk)return ag;Lk=1;var e=Hu(),n=ky(),r=Ur();function i(o,l){var u={};return l=r(l,3),n(o,function(c,f,p){e(u,f,l(c,f,p))}),u}return ag=i,ag}var lg,$k;function Ty(){if($k)return lg;$k=1;var e=So();function n(r,i,o){for(var l=-1,u=r.length;++l<u;){var c=r[l],f=i(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return lg=n,lg}var ug,qk;function _4(){if(qk)return ug;qk=1;function e(n,r){return n>r}return ug=e,ug}var cg,Dk;function b4(){if(Dk)return cg;Dk=1;var e=Ty(),n=_4(),r=wi();function i(o){return o&&o.length?e(o,r,n):void 0}return cg=i,cg}var dg,Fk;function Vj(){if(Fk)return dg;Fk=1;var e=Hu(),n=wo();function r(i,o,l){(l!==void 0&&!n(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return dg=r,dg}var fg,zk;function S4(){if(zk)return fg;zk=1;var e=gi(),n=Ku(),r=mr(),i="[object Object]",o=Function.prototype,l=Object.prototype,u=o.toString,c=l.hasOwnProperty,f=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var m=n(d);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==f}return fg=p,fg}var hg,Bk;function Gj(){if(Bk)return hg;Bk=1;function e(n,r){if(!(r==="constructor"&&typeof n[r]=="function")&&r!="__proto__")return n[r]}return hg=e,hg}var pg,Uk;function k4(){if(Uk)return pg;Uk=1;var e=Pa(),n=yi();function r(i){return e(i,n(i))}return pg=r,pg}var mg,Hk;function E4(){if(Hk)return mg;Hk=1;var e=Vj(),n=nj(),r=dj(),i=rj(),o=hj(),l=La(),u=_t(),c=$j(),f=_o(),p=Oa(),d=qn(),m=S4(),y=$a(),w=Gj(),E=k4();function _(b,S,k,N,j,A,M){var O=w(b,k),P=w(S,k),D=M.get(P);if(D){e(b,k,D);return}var L=A?A(O,P,k+"",b,S,M):void 0,U=L===void 0;if(U){var V=u(P),z=!V&&f(P),C=!V&&!z&&y(P);L=P,V||z||C?u(O)?L=O:c(O)?L=i(O):z?(U=!1,L=n(P,!0)):C?(U=!1,L=r(P,!0)):L=[]:m(P)||l(P)?(L=O,l(O)?L=E(O):(!d(O)||p(O))&&(L=o(P))):U=!1}U&&(M.set(P,L),j(L,P,N,A,M),M.delete(P)),e(b,k,L)}return mg=_,mg}var gg,Wk;function N4(){if(Wk)return gg;Wk=1;var e=Uu(),n=Vj(),r=Sy(),i=E4(),o=qn(),l=yi(),u=Gj();function c(f,p,d,m,y){f!==p&&r(p,function(w,E){if(y||(y=new e),o(w))i(f,p,E,d,c,m,y);else{var _=m?m(u(f,E),w,E+"",f,p,y):void 0;_===void 0&&(_=w),n(f,E,_)}},l)}return gg=c,gg}var vg,Vk;function C4(){if(Vk)return vg;Vk=1;var e=ec(),n=tc();function r(i){return e(function(o,l){var u=-1,c=l.length,f=c>1?l[c-1]:void 0,p=c>2?l[2]:void 0;for(f=i.length>3&&typeof f=="function"?(c--,f):void 0,p&&n(l[0],l[1],p)&&(f=c<3?void 0:f,c=1),o=Object(o);++u<c;){var d=l[u];d&&i(o,d,u,f)}return o})}return vg=r,vg}var yg,Gk;function j4(){if(Gk)return yg;Gk=1;var e=N4(),n=C4(),r=n(function(i,o,l){e(i,o,l)});return yg=r,yg}var wg,Yk;function Yj(){if(Yk)return wg;Yk=1;function e(n,r){return n<r}return wg=e,wg}var xg,Kk;function T4(){if(Kk)return xg;Kk=1;var e=Ty(),n=Yj(),r=wi();function i(o){return o&&o.length?e(o,r,n):void 0}return xg=i,xg}var _g,Xk;function R4(){if(Xk)return _g;Xk=1;var e=Ty(),n=Ur(),r=Yj();function i(o,l){return o&&o.length?e(o,n(l,2),r):void 0}return _g=i,_g}var bg,Qk;function A4(){if(Qk)return bg;Qk=1;var e=rr(),n=function(){return e.Date.now()};return bg=n,bg}var Sg,Zk;function I4(){if(Zk)return Sg;Zk=1;var e=Wu(),n=Zu(),r=Vu(),i=qn(),o=qa();function l(u,c,f,p){if(!i(u))return u;c=n(c,u);for(var d=-1,m=c.length,y=m-1,w=u;w!=null&&++d<m;){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 Sg=l,Sg}var kg,Jk;function M4(){if(Jk)return kg;Jk=1;var e=Ju(),n=I4(),r=Zu();function i(o,l,u){for(var c=-1,f=l.length,p={};++c<f;){var d=l[c],m=e(o,d);u(m,d)&&n(p,r(d,o),m)}return p}return kg=i,kg}var Eg,eE;function O4(){if(eE)return Eg;eE=1;var e=M4(),n=Nj();function r(i,o){return e(i,o,function(l,u){return n(i,u)})}return Eg=r,Eg}var Ng,tE;function P4(){if(tE)return Ng;tE=1;var e=Wj(),n=Oj(),r=Pj();function i(o){return r(n(o,void 0,e),o+"")}return Ng=i,Ng}var Cg,nE;function L4(){if(nE)return Cg;nE=1;var e=O4(),n=P4(),r=n(function(i,o){return i==null?{}:e(i,o)});return Cg=r,Cg}var jg,rE;function $4(){if(rE)return jg;rE=1;var e=Math.ceil,n=Math.max;function r(i,o,l,u){for(var c=-1,f=n(e((o-i)/(l||1)),0),p=Array(f);f--;)p[u?f:++c]=i,i+=l;return p}return jg=r,jg}var Tg,sE;function q4(){if(sE)return Tg;sE=1;var e=$4(),n=tc(),r=Hj();function i(o){return function(l,u,c){return c&&typeof c!="number"&&n(l,u,c)&&(u=c=void 0),l=r(l),u===void 0?(u=l,l=0):u=r(u),c=c===void 0?l<u?1:-1:r(c),e(l,u,c,o)}}return Tg=i,Tg}var Rg,iE;function D4(){if(iE)return Rg;iE=1;var e=q4(),n=e();return Rg=n,Rg}var Ag,oE;function F4(){if(oE)return Ag;oE=1;function e(n,r){var i=n.length;for(n.sort(r);i--;)n[i]=n[i].value;return n}return Ag=e,Ag}var Ig,aE;function z4(){if(aE)return Ig;aE=1;var e=So();function n(r,i){if(r!==i){var o=r!==void 0,l=r===null,u=r===r,c=e(r),f=i!==void 0,p=i===null,d=i===i,m=e(i);if(!p&&!m&&!c&&r>i||c&&f&&d&&!p&&!m||l&&f&&d||!o&&d||!u)return 1;if(!l&&!c&&!m&&r<i||m&&o&&u&&!l&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return Ig=n,Ig}var Mg,lE;function B4(){if(lE)return Mg;lE=1;var e=z4();function n(r,i,o){for(var l=-1,u=r.criteria,c=i.criteria,f=u.length,p=o.length;++l<f;){var d=e(u[l],c[l]);if(d){if(l>=p)return d;var m=o[l];return d*(m=="desc"?-1:1)}}return r.index-i.index}return Mg=n,Mg}var Og,uE;function U4(){if(uE)return Og;uE=1;var e=Qu(),n=Ju(),r=Ur(),i=Aj(),o=F4(),l=Gu(),u=B4(),c=wi(),f=_t();function p(d,m,y){m.length?m=e(m,function(_){return f(_)?function(b){return n(b,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var E=i(d,function(_,b,S){var k=e(m,function(N){return N(_)});return{criteria:k,index:++w,value:_}});return o(E,function(_,b){return u(_,b,y)})}return Og=p,Og}var Pg,cE;function H4(){if(cE)return Pg;cE=1;var e=Cy(),n=U4(),r=ec(),i=tc(),o=r(function(l,u){if(l==null)return[];var c=u.length;return c>1&&i(l,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),n(l,e(u,1),[])});return Pg=o,Pg}var Lg,dE;function W4(){if(dE)return Lg;dE=1;var e=kj(),n=0;function r(i){var o=++n;return e(i)+o}return Lg=r,Lg}var $g,fE;function V4(){if(fE)return $g;fE=1;function e(n,r,i){for(var o=-1,l=n.length,u=r.length,c={};++o<l;){var f=o<u?r[o]:void 0;i(c,n[o],f)}return c}return $g=e,$g}var qg,hE;function G4(){if(hE)return qg;hE=1;var e=Wu(),n=V4();function r(i,o){return n(i||[],o||[],e)}return qg=r,qg}var Dg,pE;function at(){if(pE)return Dg;pE=1;var e;if(typeof fy=="function")try{e={cloneDeep:u4(),constant:by(),defaults:c4(),each:vj(),filter:jj(),find:v4(),flatten:Wj(),forEach:gj(),forIn:y4(),has:Tj(),isUndefined:Rj(),last:w4(),map:Ij(),mapValues:x4(),max:b4(),merge:j4(),min:T4(),minBy:R4(),now:A4(),pick:L4(),range:D4(),reduce:Mj(),sortBy:H4(),uniqueId:W4(),values:qj(),zipObject:G4()}}catch{}return e||(e=window._),Dg=e,Dg}var Fg,mE;function Y4(){if(mE)return Fg;mE=1,Fg=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 n(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&n(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,l=o._prev;l!==o;)i.push(JSON.stringify(l,r)),l=l._prev;return"["+i.join(", ")+"]"};function n(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 Fg}var zg,gE;function K4(){if(gE)return zg;gE=1;var e=at(),n=tr().Graph,r=Y4();zg=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var m=c(p,d||i),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,d,m){for(var y=[],w=d[d.length-1],E=d[0],_;p.nodeCount();){for(;_=E.dequeue();)u(p,d,m,_);for(;_=w.dequeue();)u(p,d,m,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,m,_,!0));break}}}return y}function u(p,d,m,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,m,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,k=p.node(S);k.in-=b,f(d,m,k)}),p.removeNode(y.v),E}function c(p,d){var m=new n,y=0,w=0;e.forEach(p.nodes(),function(b){m.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var S=m.edge(b.v,b.w)||0,k=d(b),N=S+k;m.setEdge(b.v,b.w,N),w=Math.max(w,m.node(b.v).out+=k),y=Math.max(y,m.node(b.w).in+=k)});var E=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(b){f(E,_,m.node(b))}),{graph:m,buckets:E,zeroIdx:_}}function f(p,d,m){m.out?m.in?p[m.out-m.in+d].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return zg}var Bg,vE;function X4(){if(vE)return Bg;vE=1;var e=at(),n=K4();Bg={run:r,undo:o};function r(l){var u=l.graph().acyclicer==="greedy"?n(l,c(l)):i(l);e.forEach(u,function(f){var p=l.edge(f);l.removeEdge(f),p.forwardName=f.name,p.reversed=!0,l.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function c(f){return function(p){return f.edge(p).weight}}}function i(l){var u=[],c={},f={};function p(d){e.has(f,d)||(f[d]=!0,c[d]=!0,e.forEach(l.outEdges(d),function(m){e.has(c,m.w)?u.push(m):p(m.w)}),delete c[d])}return e.forEach(l.nodes(),p),u}function o(l){e.forEach(l.edges(),function(u){var c=l.edge(u);if(c.reversed){l.removeEdge(u);var f=c.forwardName;delete c.reversed,delete c.forwardName,l.setEdge(u.w,u.v,c,f)}})}return Bg}var Ug,yE;function fn(){if(yE)return Ug;yE=1;var e=at(),n=tr().Graph;Ug={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:l,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:m,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 n().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 n({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 l(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,O=b.height/2;if(!j&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var P,D;return Math.abs(A)*M>Math.abs(j)*O?(A<0&&(O=-O),P=O*j/A,D=O):(j<0&&(M=-M),P=M,D=M*A/j),{x:k+P,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(O){b.node(O).rank+=N})})}function m(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 Ug}var Hg,wE;function Q4(){if(wE)return Hg;wE=1;var e=at(),n=fn();Hg={run:r,undo:o};function r(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(u){i(l,u)})}function i(l,u){var c=u.v,f=l.node(c).rank,p=u.w,d=l.node(p).rank,m=u.name,y=l.edge(u),w=y.labelRank;if(d!==f+1){l.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=n.addDummyNode(l,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(c,E,{weight:y.weight},m),b===0&&l.graph().dummyChains.push(E),c=E;l.setEdge(c,p,{weight:y.weight},m)}}function o(l){e.forEach(l.graph().dummyChains,function(u){var c=l.node(u),f=c.edgeLabel,p;for(l.setEdge(c.edgeObj,f);c.dummy;)p=l.successors(u)[0],l.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=l.node(u)})}return Hg}var Wg,xE;function ju(){if(xE)return Wg;xE=1;var e=at();Wg={longestPath:n,slack:r};function n(i){var o={};function l(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 l(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(),l)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return Wg}var Vg,_E;function Kj(){if(_E)return Vg;_E=1;var e=at(),n=tr().Graph,r=ju().slack;Vg=i;function i(c){var f=new n({directed:!1}),p=c.nodes()[0],d=c.nodeCount();f.setNode(p,{});for(var m,y;o(f,c)<d;)m=l(f,c),y=f.hasNode(m.v)?r(c,m):-r(c,m),u(f,c,y);return f}function o(c,f){function p(d){e.forEach(f.nodeEdges(d),function(m){var y=m.v,w=d===y?m.w:y;!c.hasNode(w)&&!r(f,m)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function l(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 Vg}var Gg,bE;function Z4(){if(bE)return Gg;bE=1;var e=at(),n=Kj(),r=ju().slack,i=ju().longestPath,o=tr().alg.preorder,l=tr().alg.postorder,u=fn().simplify;Gg=c,c.initLowLimValues=m,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=E,c.exchangeEdges=_;function c(N){N=u(N),i(N);var j=n(N);m(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=l(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),O=M.parent;N.edge(A,O).cutvalue=d(N,j,A)}function d(N,j,A){var M=N.node(A),O=M.parent,P=!0,D=j.edge(A,O),L=0;return D||(P=!1,D=j.edge(O,A)),L=D.weight,e.forEach(j.nodeEdges(A),function(U){var V=U.v===A,z=V?U.w:U.v;if(z!==O){var C=V===P,F=j.edge(U).weight;if(L+=C?F:-F,S(N,A,z)){var $=N.edge(A,z).cutvalue;L+=C?-$:$}}}),L}function m(N,j){arguments.length<2&&(j=N.nodes()[0]),y(N,{},1,j)}function y(N,j,A,M,O){var P=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=P,D.lim=A++,O?D.parent=O: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,O=A.w;j.hasEdge(M,O)||(M=A.w,O=A.v);var P=N.node(M),D=N.node(O),L=P,U=!1;P.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 O=A.v,P=A.w;N.removeEdge(O,P),N.setEdge(M.v,M.w,{}),m(N),f(N,j),b(N,j)}function b(N,j){var A=e.find(N.nodes(),function(O){return!j.node(O).parent}),M=o(N,A);M=M.slice(1),e.forEach(M,function(O){var P=N.node(O).parent,D=j.edge(O,P),L=!1;D||(D=j.edge(P,O),L=!0),j.node(O).rank=j.node(P).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 Gg}var Yg,SE;function J4(){if(SE)return Yg;SE=1;var e=ju(),n=e.longestPath,r=Kj(),i=Z4();Yg=o;function o(f){switch(f.graph().ranker){case"network-simplex":c(f);break;case"tight-tree":u(f);break;case"longest-path":l(f);break;default:c(f)}}var l=n;function u(f){n(f),r(f)}function c(f){i(f)}return Yg}var Kg,kE;function e5(){if(kE)return Kg;kE=1;var e=at();Kg=n;function n(o){var l=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),f=c.edgeObj,p=r(o,l,f.v,f.w),d=p.path,m=p.lca,y=0,w=d[y],E=!0;u!==f.w;){if(c=o.node(u),E){for(;(w=d[y])!==m&&o.node(w).maxRank<c.rank;)y++;w===m&&(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,l,u,c){var f=[],p=[],d=Math.min(l[u].low,l[c].low),m=Math.max(l[u].lim,l[c].lim),y,w;y=u;do y=o.parent(y),f.push(y);while(y&&(l[y].low>d||m>l[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 l={},u=0;function c(f){var p=u;e.forEach(o.children(f),c),l[f]={low:p,lim:u++}}return e.forEach(o.children(),c),l}return Kg}var Xg,EE;function t5(){if(EE)return Xg;EE=1;var e=at(),n=fn();Xg={run:r,cleanup:u};function r(c){var f=n.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,m=2*d+1;c.graph().nestingRoot=f,e.forEach(c.edges(),function(w){c.edge(w).minlen*=m});var y=l(c)+1;e.forEach(c.children(),function(w){i(c,f,m,y,d,p,w)}),c.graph().nodeRankFactor=m}function i(c,f,p,d,m,y,w){var E=c.children(w);if(!E.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=n.addBorderNode(c,"_bt"),b=n.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,m,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,O=j!==A?1:m-y[w]+1;c.setEdge(_,j,{weight:M,minlen:O,nestingEdge:!0}),c.setEdge(A,b,{weight:M,minlen:O,nestingEdge:!0})}),c.parent(w)||c.setEdge(f,_,{weight:0,minlen:m+y[w]})}function o(c){var f={};function p(d,m){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[d]=m}return e.forEach(c.children(),function(d){p(d,1)}),f}function l(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 Xg}var Qg,NE;function n5(){if(NE)return Qg;NE=1;var e=at(),n=fn();Qg=r;function r(o){function l(u){var c=o.children(u),f=o.node(u);if(c.length&&e.forEach(c,l),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(),l)}function i(o,l,u,c,f,p){var d={width:0,height:0,rank:p,borderType:l},m=f[l][p-1],y=n.addDummyNode(o,"border",d,u);f[l][p]=y,o.setParent(y,c),m&&o.setEdge(m,y,{weight:1})}return Qg}var Zg,CE;function r5(){if(CE)return Zg;CE=1;var e=at();Zg={adjust:n,undo:r};function n(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")&&l(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 l(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,u),e.has(m,"y")&&u(m)})}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 m=p.edge(d);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var d=p.x;p.x=p.y,p.y=d}return Zg}var Jg,jE;function s5(){if(jE)return Jg;jE=1;var e=at();Jg=n;function n(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),l=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(l+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 Jg}var ev,TE;function i5(){if(TE)return ev;TE=1;var e=at();ev=n;function n(i,o){for(var l=0,u=1;u<o.length;++u)l+=r(i,o[u-1],o[u]);return l}function r(i,o,l){for(var u=e.zipObject(l,e.map(l,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<l.length;)f<<=1;var p=2*f-1;f-=1;var d=e.map(new Array(p),function(){return 0}),m=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;m+=y.weight*E})),m}return ev}var tv,RE;function o5(){if(RE)return tv;RE=1;var e=at();tv=n;function n(r,i){return e.map(i,function(o){var l=r.inEdges(o);if(l.length){var u=e.reduce(l,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 tv}var nv,AE;function a5(){if(AE)return nv;AE=1;var e=at();nv=n;function n(o,l){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(l.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 l=[];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();l.push(f),e.forEach(f.in.reverse(),u(f)),e.forEach(f.out,c(f))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,l){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),l.weight&&(u+=l.barycenter*l.weight,c+=l.weight),o.vs=l.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(l.i,o.i),l.merged=!0}return nv}var rv,IE;function l5(){if(IE)return rv;IE=1;var e=at(),n=fn();rv=r;function r(l,u){var c=n.partition(l,function(_){return e.has(_,"barycenter")}),f=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],m=0,y=0,w=0;f.sort(o(!!u)),w=i(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var E={vs:e.flatten(d,!0)};return y&&(E.barycenter=m/y,E.weight=y),E}function i(l,u,c){for(var f;u.length&&(f=e.last(u)).i<=c;)u.pop(),l.push(f.vs),c++;return c}function o(l){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:l?c.i-u.i:u.i-c.i}}return rv}var sv,ME;function u5(){if(ME)return sv;ME=1;var e=at(),n=o5(),r=a5(),i=l5();sv=o;function o(c,f,p,d){var m=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,E=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(A){return A!==w&&A!==E}));var b=n(c,m);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);l(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 l(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 sv}var iv,OE;function c5(){if(OE)return iv;OE=1;var e=at(),n=tr().Graph;iv=r;function r(o,l,u){var c=i(o),f=new n({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),m=o.parent(p);(d.rank===l||d.minRank<=l&&l<=d.maxRank)&&(f.setNode(p),f.setParent(p,m||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[l],borderRight:d.borderRight[l]}))}),f}function i(o){for(var l;o.hasNode(l=e.uniqueId("_root")););return l}return iv}var ov,PE;function d5(){if(PE)return ov;PE=1;var e=at();ov=n;function n(r,i,o){var l={},u;e.forEach(o,function(c){for(var f=r.parent(c),p,d;f;){if(p=r.parent(f),p?(d=l[p],l[p]=f):(d=u,u=f),d&&d!==f){i.setEdge(d,f);return}f=p}})}return ov}var av,LE;function f5(){if(LE)return av;LE=1;var e=at(),n=s5(),r=i5(),i=u5(),o=c5(),l=d5(),u=tr().Graph,c=fn();av=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=n(y);m(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)}m(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}),l(_,E,S.vs)})}function m(y,w){e.forEach(w,function(E){e.forEach(E,function(_,b){y.node(_).order=b})})}return av}var lv,$E;function h5(){if($E)return lv;$E=1;var e=at(),n=tr().Graph,r=fn();lv={positionX:E,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(S,k){var N={};function j(A,M){var O=0,P=0,D=A.length,L=e.last(M);return e.forEach(M,function(U,V){var z=l(S,U),C=z?S.node(z).order:D;(z||U===L)&&(e.forEach(M.slice(P,V+1),function(F){e.forEach(S.predecessors(F),function($){var re=S.node($),J=re.order;(J<O||C<J)&&!(re.dummy&&S.node(F).dummy)&&u(N,$,F)})}),P=V+1,O=C)}),M}return e.reduce(k,j),N}function o(S,k){var N={};function j(M,O,P,D,L){var U;e.forEach(e.range(O,P),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,O){var P=-1,D,L=0;return e.forEach(O,function(U,V){if(S.node(U).dummy==="border"){var z=S.predecessors(U);z.length&&(D=S.node(z[0]).order,j(O,L,V,P,D),L=V,P=D)}j(O,L,O.length,D,M.length)}),O}return e.reduce(k,A),N}function l(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={},O={};return e.forEach(k,function(P){e.forEach(P,function(D,L){A[D]=D,M[D]=D,O[D]=L})}),e.forEach(k,function(P){var D=-1;e.forEach(P,function(L){var U=j(L);if(U.length){U=e.sortBy(U,function($){return O[$]});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<O[F]&&!c(N,L,F)&&(M[F]=L,M[L]=A[L]=A[F],D=O[F])}}})}),{root:A,align:M}}function p(S,k,N,j,A){var M={},O=d(S,k,N,A),P=A?"borderLeft":"borderRight";function D(V,z){for(var C=O.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]=O.inEdges(V).reduce(function(z,C){return Math.max(z,M[C.v]+O.edge(C))},0)}function U(V){var z=O.outEdges(V).reduce(function(F,$){return Math.min(F,M[$.w]-O.edge($))},Number.POSITIVE_INFINITY),C=S.node(V);z!==Number.POSITIVE_INFINITY&&C.borderType!==P&&(M[V]=Math.max(M[V],z))}return D(L,O.predecessors.bind(O)),D(U,O.successors.bind(O)),e.forEach(j,function(V){M[V]=M[N[V]]}),M}function d(S,k,N,j){var A=new n,M=S.graph(),O=_(M.nodesep,M.edgesep,j);return e.forEach(k,function(P){var D;e.forEach(P,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(O(S,L,D),z||0))}D=L})}),A}function m(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,O){var P=b(S,O)/2;j=Math.max(M+P,j),A=Math.min(M-P,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(O){var P=M+O,D=S[P],L;if(D!==k){var U=e.values(D);L=O==="l"?j-e.min(U):A-e.max(U),L&&(S[P]=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(O){A=O==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(P){P==="r"&&(A=e.map(A,function(V){return e.values(V).reverse()}));var D=(O==="u"?S.predecessors:S.successors).bind(S),L=f(S,A,N,D),U=p(S,A,L.root,L.align,P==="r");P==="r"&&(U=e.mapValues(U,function(V){return-V})),j[O+P]=U})});var M=m(S,j);return y(j,M),w(j,S.graph().align)}function _(S,k,N){return function(j,A,M){var O=j.node(A),P=j.node(M),D=0,L;if(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}if(L&&(D+=N?L:-L),L=0,D+=(O.dummy?k:S)/2,D+=(P.dummy?k:S)/2,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}return L&&(D+=N?L:-L),L=0,D}}function b(S,k){return S.node(k).width}return lv}var uv,qE;function p5(){if(qE)return uv;qE=1;var e=at(),n=fn(),r=h5().positionX;uv=i;function i(l){l=n.asNonCompoundGraph(l),o(l),e.forEach(r(l),function(u,c){l.node(c).x=u})}function o(l){var u=n.buildLayerMatrix(l),c=l.graph().ranksep,f=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=f+d/2}),f+=d+c})}return uv}var cv,DE;function m5(){if(DE)return cv;DE=1;var e=at(),n=X4(),r=Q4(),i=J4(),o=fn().normalizeRanks,l=e5(),u=fn().removeEmptyRanks,c=t5(),f=n5(),p=r5(),d=f5(),m=p5(),y=fn(),w=tr().Graph;cv=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(){n.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(){l(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(){m(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(){n.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"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},P=["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({},O,G(fe,M),e.pick(fe,P)))}),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 cv}var dv,FE;function g5(){if(FE)return dv;FE=1;var e=at(),n=fn(),r=tr().Graph;dv={debugOrdering:i};function i(o){var l=n.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(l,function(c,f){var p="layer"+f;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,m){return u.setEdge(d,m,{style:"invis"}),m})}),u}return dv}var fv,zE;function v5(){return zE||(zE=1,fv="0.8.5"),fv}var hv,BE;function y5(){return BE||(BE=1,hv={graphlib:tr(),layout:m5(),debug:g5(),util:{time:fn().time,notime:fn().notime},version:v5()}),hv}var w5=y5();const UE=zv(w5),vo=240,Tu=130,uo=74,nc=72,HE=uo+nc;function x5(e,n){var i;let r=vo;for(const o of e)r=Math.max(r,((i=n.get(o.id))==null?void 0:i.width)??vo);return r}const Xj=420,_5=2;function Ea(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function b5(e,n){return((n==null?void 0:n.get(e))??0)>0?Xj:0}function S5(e,n){const r=(n==null?void 0:n.get(e))??0;return r>0?6+r*36:0}function Na(e,n,r){const i=n.get(e);return{w:((i==null?void 0:i.width)??vo)+b5(e,r),h:Math.max((i==null?void 0:i.height)??Tu,S5(e,r))}}function k5(e){return[...e.keys()].sort().map(n=>`${n}:${e.get(n)}`).join("|")}function E5(e,n,r,i,o,l){const u=new UE.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}=Na(S,i,l);u.setNode(S,{width:k,height:N})}for(const S of n)f.has(S.source)&&f.has(S.target)&&u.setEdge(S.source,S.target);UE.layout(u);const p=new Map;let d=1/0,m=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)??vo,A=(N==null?void 0:N.height)??Tu,M=Na(S,i,l),O=k.x-M.w/2,P=k.y-M.h/2;p.set(S,{x:O,y:P}),O<d&&(d=O),P<m&&(m=P),O+j>y&&(y=O+j),P+A>w&&(w=P+A)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[S,k]of p)p.set(S,{x:k.x-d,y:k.y-m});const E=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m: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)??vo,A=(N==null?void 0:N.height)??Tu;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 N5(e,n,r={}){const i=r.direction??"LR",o=r.pinned??new Map,l=r.measured??new Map,u=r.lanes,c=new Map;for(const S of e){const k=Ea(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,...E5(c.get(S),n,i,l,o,u)})),d=x5(e,l),m=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>m&&(k.push([]),N=0),k[k.length-1].push(j),N+=j.height+HE;return k},w=S=>S.reduce((k,N)=>Math.max(k,N.width),0)+Xj;let E=y(r.availableWidth?_5: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[P,D]of j)_.set(P,{x:D.x+b,y:D.y+N});let O=N+A;M&&M.maxY>O&&M.minX<b+k&&b<M.maxX&&(O=M.maxY),N=O+HE}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 C5(e,n,r,i,o){const u=uo+nc,c=60,f=w=>Na(w,i,o),p=new Map(e.map(w=>[w.id,Ea(w)])),d=[],m=e.map(w=>({id:w.id,pos:r.get(w.id)??n.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 m){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,O=A.sid===S?24:u;return E.x<A.x+A.w+M&&A.x<E.x+_+M&&k<A.y+A.h+O&&A.y<k+b+O});if(!j)break;k=j.y+j.h+(j.sid===S?24:u)}k!==E.y&&(n.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 j5(e,n,r,i,o,l){const u=_=>Na(_,i,l),c=_=>r.get(_)??n.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=Ea(_),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,m=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:k}=u(_.id),N=Ea(_);p.has(N)?(d.get(N)??d.set(N,[]).get(N)).push(_):m.push({x:b.x,y:b.y,w:S,h:k})}if(d.size===0)return[];const y=uo+nc,w=(_,b,S,k)=>m.some(N=>_<N.x+N.w+uo&&N.x<_+S+uo&&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,O=[...new Set(m.map(U=>Math.round(U.x)))].sort((U,V)=>U-V),P=O.length?O:[S],D=[0,...m.map(U=>U.y+U.h+y)].sort((U,V)=>U-V);let L=null;e:for(const U of P)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);n.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);m.push({x:V.x,y:V.y,w:z,h:C})}}return E}function T5(e,n,r,i,o,l=!1,u){const p=uo+nc+1,d=8,m=1.75,y=200,w=.7,E=.01,_=L=>Na(L,i,u),b=L=>r.get(L)??n.get(L),S=new Map;for(const L of e){if(!b(L.id))continue;const U=Ea(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(l||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/(vo*Tu));const O=new Map(k.map(L=>[L.sid,L.x])),P=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*m<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-O.get(L.sid),V=L.y-P.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=n.get(z);C&&n.set(z,{x:C.x+U,y:C.y+V})}D.push(L.sid)}}return D}const R5=600;function $v(e,n){return!(e.exitAt!=null&&n-e.exitAt>R5||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function A5(e,n){const r=new Set;for(const i of e.agents.values())$v(i,n)&&r.add(i.id);return r}function I5(e,n,r=0){return e.right+r>n.left&&e.left-r<n.right&&e.bottom+r>n.top&&e.top-r<n.bottom}function M5(e,n,r=0){if(!e)return!1;for(const i of n)if(I5(e,i,r))return!0;return!1}const Qj="sessionGroup";function O5(e,n){var i;if(e.type===Qj)return"transparent";const r=(i=e.data)==null?void 0:i.state;return n(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const P5="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function L5(e){if(e.checkDisabled)return P5;if(e.checking)return"Asking npm for the newest release…";const n=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`${n}${r} · re-checked periodically · click to check npm now`}function $5(e){const n=`Version v${e.running}`;return e.checkDisabled?`${n}, update checks are off`:e.checking?`${n}, checking npm for a newer release`:`${n}, check npm for a newer release`}function q5(e){const n=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}, ${n} — ${e.open?"hide":"show"} the notice`}function D5(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 n=e.trim();return n===""?{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:n,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const qv={kind:"assumed",claude:!0,codex:!0};function F5(e){if(!e||typeof e!="object")return qv;const n=e.providers;if(!n||typeof n!="object")return qv;const r=n;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function Zj(e){const n=Math.max(0,Math.floor(e));return`${n} event${n===1?"":"s"}`}function z5(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${Zj(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 B5(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:`${Zj(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 Jj(e,n){return e!==""&&n>0}function U5(e,n,r){return e===""?{active:!1,matched:n,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:n,total:r,count:`${n} of ${r}`,empty:n===0,message:n===0?`No agents match “${e}”`:null,dim:Jj(e,n)}}const H5="Search agents, tools, model…";function eT(e,n){var i,o,l,u;if(!n)return!0;const r=n.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)||(l=e.firstPrompt)!=null&&l.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 ca(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const W5={agent:mL,sessionGroup:CL},tT="react-flow__node";function WE(e){var n,r;return!!e&&((r=(n=e.classList)==null?void 0:n.contains)==null?void 0:r.call(n,tT))===!0}function V5(e){try{const n=document.querySelector(`.${tT}[data-id="${CSS.escape(e)}"]`);n==null||n.focus({preventScroll:!0})}catch{}}const G5=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),Y5=420,lu=18,K5=200,X5=5*6e4,Q5=6,Z5=2*6e4,Ry="agent-dag.layout",Ay="agent-dag.viewport",nT="agent-dag.summariesDismissed",rT="agent-dag.sessionListOpen",sT="agent-dag.detailOpen",iT="agent-dag.usagePanelOpen",VE="agent-dag.accountsPanelOpen",GE="agent-dag.versionNoticeDismissed",YE="agent-dag.oldNameNoticeDismissed",J5=15*6e4,pv={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:"},KE="agent-dag.autoRestart",XE="agent-dag.bundleReloadedFor";function eF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(rT)==="1"}catch{return!1}}function tF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(rT,e?"1":"0")}catch{}}function nF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sT)==="1"}catch{return!1}}function rF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sT,e?"1":"0")}catch{}}function sF(){const e=GC(iT);return e===null?!0:e==="1"}function iF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(iT,e?"1":"0")}catch{}}function oF(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(nT);if(!e)return new Set;const n=JSON.parse(e);return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function QE(e){if(!(typeof window>"u"))try{const n=Array.from(e),r=n.length>200?n.slice(-200):n;window.localStorage.setItem(nT,JSON.stringify(r))}catch{}}function aF(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(Ry);if(!n)return e;const r=JSON.parse(n);if(!("v"in r)){const o=Object.entries(r).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:o,pins:o.map(([l])=>l)}}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 mv(e,n){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of n)r[i]=o;window.localStorage.setItem(Ry,JSON.stringify({v:2,positions:r,pins:Array.from(n.keys())}))}catch{}}function lF(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Ay);if(!e)return null;const n=JSON.parse(e);return typeof(n==null?void 0:n.x)!="number"||typeof(n==null?void 0:n.y)!="number"||typeof(n==null?void 0:n.zoom)!="number"?null:n}catch{return null}}function uF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Ay,JSON.stringify(e))}catch{}}function ZE(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Ry)}catch{}try{window.localStorage.removeItem(Ay)}catch{}}}function cF(e,n){const r=e.agents.get(n);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===n&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:n,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(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(o,null,2),u=new Blob([l],{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}-${n.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Dv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Fv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},oT=LC;function dF(e,n){if(!n)return null;const r=new Set([n]);let i=n;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),i=l.parentId}let o=!0;for(;o;){o=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),o=!0)}return r}function fF(e,n,r,i,o,l,u,c,f,p,d,m,y,w,E,_,b,S,k){const N=[],j=[],A=new Set;if(l)for(const z of e.agents.values())S.has(z.id)&&eT(z,l)&&A.add(z.id);const M=Jj(l,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:n,onOpenContext:k},className:re,...J?{width:J.width,height:J.height}:null}),z.parentId&&S.has(z.parentId)){const W=iy(z.sessionId),Z=l&&!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 O=new Map;for(const z of e.agents.values())z.tools.length>0&&O.set(z.id,Math.min(4,z.tools.length));const P=`${w}#lanes:${k5(O)}`,D=N.filter(z=>N$(z.id,o,m,y));if(D.length>0||P!==E.current){if(D.length>0){const z=N5(N,j,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:O});for(const C of z)VC(C.id,m,y)&&j$(C.id,C.position,m,y);j5(N,m,o,u,new Set(D.map(C=>C.id)),O)}C5(N,m,o,u,O),E.current=P}const L=T5(N,m,o,u,c,!p||d,O);L.length>0&&f(L),su(m,e.agents),su(y,e.agents),su(o,e.agents),su(u,E$(e.agents.values()));const U=[];let V=!1;for(const z of N){let C=o.get(z.id)??m.get(z.id);C||(C=C$(z.id,m,y),V=!0),U.push({...z,position:C})}return V&&(E.current=""),{nodes:U,edges:j}}function hF(){return g.jsx(sy,{children:g.jsx(pF,{})})}function pF(){var Ga,Ya,Ka,Xa;const e=Aa(),n=R.useRef(Iv()),[,r]=R.useState(0),i=R.useCallback(()=>r(H=>H+1),[]),[o,l]=R.useState(()=>new Set),[u,c]=R.useState(null),[f,p]=R.useState(null),d=R.useCallback((H,Y)=>{l(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)},[]),m=R.useCallback(()=>{l(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(oF()),[j,A]=R.useState(eF);R.useEffect(()=>{tF(j)},[j]);const[M,O]=R.useState(nF);R.useEffect(()=>{rF(M)},[M]);const[P,D]=R.useState(sF);R.useEffect(()=>{iF(P)},[P]);const[L,U]=R.useState(()=>{try{const H=window.localStorage.getItem(VE);return H===null?!0:H==="1"}catch{return!0}});R.useEffect(()=>{try{window.localStorage.setItem(VE,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(GE)??""}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>=J5)},[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(qv);R.useEffect(()=>{let H=!1;return fetch("/api/health").then(Y=>Y.ok?Y.json():null).then(Y=>{H||(_e(F5(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(GE,H)}catch{}},[ye,it,Q]),[De,Je]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(YE)??""}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(YE,Xe)}catch{}}},[Xe]),Qe=((Ga=K==null?void 0:K.upgrade)==null?void 0:Ga.state)??"idle",Pt=p$(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(I$()),[Hr,xi]=R.useState(!1),Wr=R.useCallback(()=>{const H=vr.current,Y=H.setPaused(!H.paused);for(const oe of Y)n.current=Vx(n.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(KE)!=="0"}catch{return!0}}),yr=R.useCallback(()=>{Is(H=>{const Y=!H;try{window.localStorage.setItem(KE,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 n.current.agents.values())if(oe.state==="active"){H=!0;break}const Y=g$({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(XE)}catch{return}const de=h$({bundle:"1.35.40",running:H,pending:Y,lastTried:oe});if(de==="reload"){try{window.sessionStorage.setItem(XE,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&&m$({asked:Ms.current,reported:Pt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}sr.current=!1,kn(!1)}},[zn,Pt]);const Ps=R.useRef(aF()).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(()=>lF())[0],[Kt,Kr]=R.useState(""),[Si,nt]=R.useState(()=>new Set),[br,Xr]=R.useState($$),[Ls,Qr]=R.useState(!1),Zr=R.useRef(null);R.useEffect(()=>{document.documentElement.dataset.theme=br;try{window.localStorage.setItem(YC,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=A$(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;n.current=Vx(n.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=MP(n.current,Y,Wx);OP(n.current,Y,Wx)&&(oe=!0),AP(n.current,Y,K5,X5)&&(oe=!0),IP(n.current,Y,Q5,Z5)&&(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))),Ao=Math.max(...jn.map(wt=>We(wt.right))),Ks=Math.min(...jn.map(wt=>ze(wt.top))),Io=Math.max(...jn.map(wt=>ze(wt.bottom))),Qa=Ao-Ys,us=Io-Ks;if(!(Qa>0&&us>0))return;const Zt=Math.max(.2,Math.min(1,(Fe.width-160)/(Qa+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},Mo=e.getViewport();(Math.abs(Mo.zoom-Zt)>.01||Math.abs(Mo.x-wt.x)>2)&&e.setViewport(wt,{duration:0})}catch{}},H+60)}catch{}},[e]),ko=R.useRef(""),Eo=R.useRef(null),Da=R.useRef(0),Sr=R.useCallback(()=>{Da.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,Fa]=R.useState(gn.current),za=R.useCallback(()=>{if(!gn.current){gn.current=!0,Fa(!0);try{window.localStorage.setItem(Jr,"1")}catch{}}},[]),No=R.useCallback(()=>{gn.current=!1,Fa(!1);try{window.localStorage.removeItem(Jr)}catch{}pt(400)},[e,pt]);R.useEffect(()=>{const H=setInterval(()=>{if(gn.current||Date.now()-Da.current<800)return;const Y=n.current,oe=Date.now(),de=[];for(const We of Y.agents.values())$v(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,Ao=jn.y*xe.zoom+xe.y,Ks=(jn.x+ze.width)*xe.zoom+xe.x,Io=(jn.y+ze.height)*xe.zoom+xe.y;if(Ks>0&&Ys<Se&&Io>0&&Ao<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),rc=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(rc),[He,Ba]=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&&Ba(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)),Co=R.useRef(new Set),Ni=R.useRef(""),kr=R.useMemo(()=>{const H=[];for(const Y of n.current.agents.values())$v(Y,ut)&&H.push(Y.id+(Y.parentId?`>${Y.parentId}`:""));return H.sort(),`${H.join("|")}#sv${Ei}.${He}`},[n.current,n.current.lastSeq,ut,Ei,He]),ts=R.useRef(null);R.useEffect(()=>(ts.current!=null&&window.clearTimeout(ts.current),ts.current=window.setTimeout(()=>{mv(Xt.current,Tt.current)},1500),()=>{ts.current!=null&&window.clearTimeout(ts.current)}),[kr]),R.useEffect(()=>{if(ko.current===kr)return;const H=ko.current;if(ko.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=dF(n.current,Y);if(oe)for(const de of oe)H.add(de)}return H.size>0?H:null},[n.current,n.current.lastSeq,o]),Nn=R.useMemo(()=>A5(n.current,ut),[n.current,n.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(G5)!==H.currentTarget||(H.preventDefault(),(de=(oe=document.activeElement)==null?void 0:oe.blur)==null||de.call(oe))},[]),Bs=R.useRef(new Map),[Hn,sc]=R.useState(!1);R.useEffect(()=>{const H=window.setTimeout(()=>sc(!0),2500);return()=>window.clearTimeout(H)},[]);const[Ua,Er]=R.useState(!1),ar=R.useRef(null),[Ci,Us]=R.useState(!1),Ha=R.useCallback(()=>{ar.current&&(window.clearTimeout(ar.current),ar.current=null),Er(!1)},[]),ic=R.useCallback(H=>{H.length!==0&&queueMicrotask(()=>{Er(!0),ar.current&&window.clearTimeout(ar.current),ar.current=window.setTimeout(()=>Er(!1),Y5+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(()=>fF(n.current,ut,ns,rs,Tt.current,Kt,or.current,Bs.current,ic,Hn,Ci,Xt.current,Co.current,kr,Ni,o,Fs,Nn,b),[n.current,n.current.lastSeq,ut,ns,rs,Hn,Ci,Kt,kr,o,Fs,Nn,b,Yt]),Wa=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+lu*2,Se=de.maxY-de.minY+lu*2;Y.push({id:`group:${oe}`,type:Qj,position:{x:de.minX-lu,y:de.minY-lu},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]),oc=R.useMemo(()=>{const H=[...Wa,...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})},[Wa,Qt,Fn]),Nr=R.useMemo(()=>{if(!Kt)return null;const H=new Set;for(const Y of n.current.agents.values())Nn.has(Y.id)&&eT(Y,Kt)&&H.add(Y.id);return H},[n.current,n.current.lastSeq,Kt,Nn]),Cn=R.useMemo(()=>U5(Kt,(Nr==null?void 0:Nr.size)??0,Nn.size),[Kt,Nr,Nn]),ss=R.useMemo(()=>{const H=new Set;for(const Y of n.current.agents.values())for(const oe of Y.tools)H.add(oT(oe.name));return Object.keys(Dv).filter(Y=>H.has(Y))},[n.current,n.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=M5(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 n.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},[n.current,n.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?n.current.agents.get(u):null,os=f?Array.from(n.current.agents.values()).flatMap(H=>H.tools).find(H=>H.id===f)??null:null,jo=R.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=Iv(),Tt.current.clear(),or.current.clear(),Xt.current.clear(),Ni.current="",ZE(),m(),i()},[i,m]),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=y$(H,{confirmOpen:Hs.current,modalOpen:Ws.current});Y==="confirm"?k(!0):Y==="clear"&&(k(!1),jo())},[jo]),$t=R.useCallback(()=>{Tt.current.clear(),Xt.current.clear(),Ni.current="",ZE(),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 To=R.useCallback(H=>{const Y=as.current,oe=x$(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=WE(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}St.current=Date.now(),xe&&V5(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=JP({overlayOpen:Cu.depth()>0,typing:oy(de)});ze==="dismiss"?Cu.dismissTop():ze==="blur"?oe==null||oe.blur():(k$(de)&&(oe==null||oe.blur()),m());return}if(MC(Y))return;const xe=WE(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=b$(Y,Se);if(Pe.kind==="activate"){Y.preventDefault(),d(Pe.nodeId,Pe.additive);return}if(Pe.kind!=="node"&&!(Pe.nodeId==null&&aL(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")&&To(1),(Y.key==="k"||Y.key==="K")&&To(-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,m,d,To,Wr]);const jr=n.current.agents.size,Gs=new Set(Array.from(n.current.agents.values()).map(H=>H.sessionId)).size,tn=R.useMemo(()=>c3(n.current.agents.values()),[n.current,n.current.lastSeq]),Ro=R.useMemo(()=>d3(n.current.agents.values()),[n.current,n.current.lastSeq]),Va=R.useRef(null);R.useEffect(()=>{const H=q$({waiting:tn.length,running:Ro}),Y=Va.current;if(Va.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=D$[H.icon])}},[tn.length,Ro]);const[ac,lc]=R.useState(""),Ri=z$(tn);R.useEffect(()=>{lc(H=>B$(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 n.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}}},[n.current,n.current.lastSeq]);return g.jsxs("div",{className:"app",children:[g.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"logo"}),g.jsx("h1",{children:Gt}),ye?g.jsxs("button",{type:"button",className:"v stale",onClick:Ze,"aria-label":q5({...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,g.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const H={running:(K==null?void 0:K.running)??"1.35.40",latest:K==null?void 0:K.latest,latestPending:K==null?void 0:K.latestPending,checkedAgo:K!=null&&K.checkedAt?Ov(ut-K.checkedAt):null,checkDisabled:K==null?void 0:K.checkDisabled,checking:ce};return g.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":$5(H),title:L5(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"?Eu(H.total,Y):null,de=o.size-1;return g.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:[g.jsx("span",{className:`state-pill state-${Rt.state}`,children:Rt.state==="active"?"live":Rt.state}),g.jsx("span",{className:"selected-label",children:Rt.label}),H.total>0&&g.jsxs("span",{className:"selected-cost",children:[qe(H.total),oe?g.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),de>0&&g.jsxs("span",{className:"selected-extra",children:["+",de]}),g.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:xe=>{xe.stopPropagation(),m()},children:"×"})]})})(),g.jsxs("div",{className:"actions",children:[g.jsxs("div",{className:"search",children:[g.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),g.jsx("input",{ref:Zr,type:"text",placeholder:H5,value:Kt,onChange:H=>Kr(H.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),Kt?g.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Kr(""),children:"×"}):g.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),Cn.count&&g.jsx("span",{className:`search-count${Cn.empty?" none":""}`,"aria-live":"polite",title:`${Cn.count} agents on the canvas match “${Kt}”`,children:Cn.count})]}),g.jsxs("span",{className:"status",children:[(()=>{const H=z5({connected:I,paused:Hr,held:vr.current.size});return g.jsx("span",{className:`pill ${H.tone}`,title:H.title,children:H.label})})(),g.jsxs("span",{className:"stat",title:K$(we),children:[g.jsx("span",{className:"count",children:Gs}),g.jsx("span",{className:"lbl",children:"sessions"})]}),g.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[g.jsx("span",{className:"count",children:jr}),g.jsx("span",{className:"lbl",children:"agents"})]}),g.jsxs("span",{className:"stat",title:X$(we),children:[g.jsx("span",{className:"count",children:n.current.totalEvents}),g.jsx("span",{className:"lbl",children:"events"})]}),nn.sum>0&&g.jsxs("span",{className:"stat",title:`in:${nn.inT.toLocaleString()} out:${nn.outT.toLocaleString()} cache-r:${nn.cacheR.toLocaleString()} cache-c:${nn.cacheC.toLocaleString()}`,children:[g.jsx("span",{className:"count",children:Nt(nn.sum)}),g.jsx("span",{className:"lbl",children:"tokens"})]}),is.length>0&&g.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
73
73
  ${is.map(H=>` ${H.server}: ${H.count} call${H.count===1?"":"s"}`).join(`
74
74
  `)}`,children:[is.slice(0,6).map(H=>g.jsx("span",{className:"mcp-dot",style:{"--mcp-hue":H.hue}},H.server)),is.length>6&&g.jsxs("span",{className:"mcp-more",children:["+",is.length-6]}),g.jsx("span",{className:"lbl",children:"mcp"})]}),nn.cost.total>0&&(()=>{let H=0,Y=0;for(const xe of n.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?Eu(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?`
75
75
  active burn: ${oe}`:""}`;return g.jsxs("span",{className:"stat",title:de,children:[g.jsx("span",{className:"count",children:qe(nn.cost.total)}),g.jsxs("span",{className:"lbl",children:["cost",oe?` · ${oe}`:""]})]})})()]}),g.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:ac}),tn.length>0&&g.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:
@@ -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-urwzWy4Z.js"></script>
43
+ <script type="module" crossorigin src="/assets/index-DRGdm9Mn.js"></script>
44
44
  <link rel="stylesheet" crossorigin href="/assets/index-B9aJiIdI.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.35.39",
3
+ "version": "1.35.40",
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": {
@@ -0,0 +1,58 @@
1
+ // The command line, parsed: everything the deck recognises, and everything it
2
+ // does not.
3
+ //
4
+ // Its own module rather than a function inside bin/deck.js, for one reason —
5
+ // importing bin/deck.js RUNS a deck. That file installs hooks, binds a port and
6
+ // opens a browser at module scope, so there was no way to ask what `--prot`
7
+ // parses to without starting a server to find out. Nothing here does any of
8
+ // that: strings in, a plain object out, no I/O, no process, no terminal.
9
+ //
10
+ // bin/deck.js is the only caller. The parser is the whole of the module's
11
+ // surface; the tables it matches against stay inside it.
12
+
13
+ /**
14
+ * Parse `process.argv.slice(2)`.
15
+ *
16
+ * Returns the flags that were set, plus `unknown` — every token the loop did
17
+ * not recognise, in the order it met them. That list is the point of this
18
+ * module: the loop used to have no `else`, so `ccdeck --prot 4500` booted on
19
+ * 4317 and said nothing, and a typo was indistinguishable from a flag that
20
+ * worked.
21
+ *
22
+ * The three flags that TAKE a value (`--port`, `--workspace`, `--history`)
23
+ * consume it with `args[++i]`, so the value is never re-examined as a token of
24
+ * its own and cannot land in `unknown` — `--port 4500` says nothing about
25
+ * `4500`, and `--workspace ~/some dir` nothing about the path. That is the way
26
+ * an unknown-flag warning usually goes wrong, and it is asserted rather than
27
+ * assumed; see src/web/__tests__/argv-480.test.ts.
28
+ *
29
+ * A bare word is `unknown` too, and deliberately: the deck takes no positional
30
+ * arguments at all, so `ccdeck ~/proj` is the same mistake as `ccdeck --workpace
31
+ * ~/proj` — something the deck read and then did nothing with. It is also how
32
+ * an unquoted path with a space in it becomes visible, which is a failure this
33
+ * repo already knew about and could not previously report: `--workspace
34
+ * C:\Users\John Smith\proj` reaches the parser as two arguments, and the second
35
+ * one used to be dropped in silence (see launchNpx in bin/agent-dag.js).
36
+ */
37
+ export function parseArgs(args) {
38
+ const out = { unknown: [] };
39
+ for (let i = 0; i < args.length; i++) {
40
+ const a = args[i];
41
+ if (a === "-h" || a === "--help") out.help = true;
42
+ else if (a === "-v" || a === "--version") out.version = true;
43
+ else if (a === "-p" || a === "--port") out.port = args[++i];
44
+ else if (a === "--no-open") out.noOpen = true;
45
+ else if (a === "--uninstall") out.uninstall = true;
46
+ else if (a === "--workspace") out.workspace = args[++i];
47
+ else if (a === "--scope") out.scope = true;
48
+ else if (a === "--all") out.all = true; // legacy no-op (now default)
49
+ else if (a === "--no-persist") out.noPersist = true;
50
+ else if (a === "--history") out.history = args[++i];
51
+ else if (a === "--codex") out.codex = true;
52
+ else if (a === "--no-codex") out.noCodex = true;
53
+ else if (a === "--claude") out.claude = true;
54
+ else if (a === "--no-claude") out.noClaude = true;
55
+ else out.unknown.push(a);
56
+ }
57
+ return out;
58
+ }